import * as __WEBPACK_EXTERNAL_MODULE_base64_js_f145eb6e__ from "base64-js";
import * as __WEBPACK_EXTERNAL_MODULE_ieee754__ from "ieee754";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE_redux__ from "redux";
import * as __WEBPACK_EXTERNAL_MODULE_immutable__ from "immutable";
import * as __WEBPACK_EXTERNAL_MODULE_redux_immutable_446c9f82__ from "redux-immutable";
import * as __WEBPACK_EXTERNAL_MODULE_serialize_error_5f2df3e5__ from "serialize-error";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_merge_cf99375a__ from "lodash/merge";
import * as __WEBPACK_EXTERNAL_MODULE__braintree_sanitize_url_2340607f__ from "@braintree/sanitize-url";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_camelCase_81fadc19__ from "lodash/camelCase";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_upperFirst_9993ecb4__ from "lodash/upperFirst";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_memoize_2b5bc477__ from "lodash/memoize";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_find_e8ecc2cb__ from "lodash/find";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_some_5cd47809__ from "lodash/some";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_eq_b41b823a__ from "lodash/eq";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_isFunction_f90b20d6__ from "lodash/isFunction";
import * as __WEBPACK_EXTERNAL_MODULE_css_escape_2d301448__ from "css.escape";
import * as __WEBPACK_EXTERNAL_MODULE_url_parse_6456105f__ from "url-parse";
import * as __WEBPACK_EXTERNAL_MODULE_reselect__ from "reselect";
import * as __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_objectSpread2_89fd8f56__ from "@babel/runtime-corejs3/helpers/objectSpread2";
import * as __WEBPACK_EXTERNAL_MODULE_prop_types_adfe8e31__ from "prop-types";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_omit_d930e0f3__ from "lodash/omit";
import * as __WEBPACK_EXTERNAL_MODULE_js_yaml_78384032__ from "js-yaml";
import * as __WEBPACK_EXTERNAL_MODULE_zenscroll__ from "zenscroll";
import * as __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_defineProperty_807a2698__ from "@babel/runtime-corejs3/helpers/defineProperty";
import * as __WEBPACK_EXTERNAL_MODULE_react_immutable_proptypes_89c7d083__ from "react-immutable-proptypes";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_reduce_11e69996__ from "lodash/reduce";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_get_9427f899__ from "lodash/get";
import * as __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_extends_d20d3ceb__ from "@babel/runtime-corejs3/helpers/extends";
import * as __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_objectWithoutProperties_9beedba5__ from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
import * as __WEBPACK_EXTERNAL_MODULE_react_copy_to_clipboard_5b11dd57__ from "react-copy-to-clipboard";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_light_746e1958__ from "react-syntax-highlighter/dist/esm/light";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_javascript_e22911f7__ from "react-syntax-highlighter/dist/esm/languages/hljs/javascript";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_json_b876afc5__ from "react-syntax-highlighter/dist/esm/languages/hljs/json";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_xml_a81c807b__ from "react-syntax-highlighter/dist/esm/languages/hljs/xml";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_bash_1621c621__ from "react-syntax-highlighter/dist/esm/languages/hljs/bash";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_yaml_02838f34__ from "react-syntax-highlighter/dist/esm/languages/hljs/yaml";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_http_4e924b23__ from "react-syntax-highlighter/dist/esm/languages/hljs/http";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_powershell_d51eb4f6__ from "react-syntax-highlighter/dist/esm/languages/hljs/powershell";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_agate_99a46aa2__ from "react-syntax-highlighter/dist/esm/styles/hljs/agate";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_arta_570691fc__ from "react-syntax-highlighter/dist/esm/styles/hljs/arta";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_monokai_2529bafb__ from "react-syntax-highlighter/dist/esm/styles/hljs/monokai";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_nord_5bfa1099__ from "react-syntax-highlighter/dist/esm/styles/hljs/nord";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_obsidian_a278dd52__ from "react-syntax-highlighter/dist/esm/styles/hljs/obsidian";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_tomorrow_night_63765df9__ from "react-syntax-highlighter/dist/esm/styles/hljs/tomorrow-night";
import * as __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_idea_023aba2e__ from "react-syntax-highlighter/dist/esm/styles/hljs/idea";
import * as __WEBPACK_EXTERNAL_MODULE_xml__ from "xml";
import * as __WEBPACK_EXTERNAL_MODULE_randexp__ from "randexp";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_isEmpty_e109fd6b__ from "lodash/isEmpty";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_isString_e6fa8a5b__ from "lodash/isString";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_debounce_3540babe__ from "lodash/debounce";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_set_b4b15ee5__ from "lodash/set";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_fp_assocPath_f9d64e33__ from "lodash/fp/assocPath";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_constant_f5c0879f__ from "lodash/constant";
import * as __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_strategies_generic_08dd5200__ from "swagger-client/es/resolver/strategies/generic";
import * as __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_strategies_openapi_2_ff6e79cf__ from "swagger-client/es/resolver/strategies/openapi-2";
import * as __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_strategies_openapi_3_0_2fa0ff7c__ from "swagger-client/es/resolver/strategies/openapi-3-0";
import * as __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_strategies_openapi_3_1_apidom_5e628d39__ from "swagger-client/es/resolver/strategies/openapi-3-1-apidom";
import * as __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_f879c638__ from "swagger-client/es/resolver";
import * as __WEBPACK_EXTERNAL_MODULE_swagger_client_es_execute_d486d3d6__ from "swagger-client/es/execute";
import * as __WEBPACK_EXTERNAL_MODULE_swagger_client_es_http_69655560__ from "swagger-client/es/http";
import * as __WEBPACK_EXTERNAL_MODULE_swagger_client_es_subtree_resolver_741cb9d9__ from "swagger-client/es/subtree-resolver";
import * as __WEBPACK_EXTERNAL_MODULE_swagger_client_es_helpers_4d7bea47__ from "swagger-client/es/helpers";
import * as __WEBPACK_EXTERNAL_MODULE_react_dom_7dac9eee__ from "react-dom";
import * as __WEBPACK_EXTERNAL_MODULE_react_redux_87be03b0__ from "react-redux";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_identity_75ffe4a7__ from "lodash/identity";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_zipObject_c74f1c14__ from "lodash/zipObject";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_toString_da931f05__ from "lodash/toString";
import * as __WEBPACK_EXTERNAL_MODULE_classnames__ from "classnames";
import * as __WEBPACK_EXTERNAL_MODULE_js_file_download_bd23dbb6__ from "js-file-download";
import * as __WEBPACK_EXTERNAL_MODULE_xml_but_prettier_2ed4d5cb__ from "xml-but-prettier";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_toLower_c29ee2b0__ from "lodash/toLower";
import * as __WEBPACK_EXTERNAL_MODULE_react_immutable_pure_component_cbcfaebd__ from "react-immutable-pure-component";
import * as __WEBPACK_EXTERNAL_MODULE_remarkable__ from "remarkable";
import * as __WEBPACK_EXTERNAL_MODULE_remarkable_linkify_34829ba6__ from "remarkable/linkify";
import * as __WEBPACK_EXTERNAL_MODULE_dompurify__ from "dompurify";
import * as __WEBPACK_EXTERNAL_MODULE_react_debounce_input_7ed3e068__ from "react-debounce-input";
import * as __WEBPACK_EXTERNAL_MODULE_lodash_isPlainObject_116f2243__ from "lodash/isPlainObject";
import * as __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_classPrivateFieldGet_c0aa81e1__ from "@babel/runtime-corejs3/helpers/classPrivateFieldGet";
/******/ var __webpack_modules__ = ({
/***/ 764:
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh
* @license MIT
*/
/* eslint-disable no-proto */
const base64 = __webpack_require__(780)
const ieee754 = __webpack_require__(294)
const customInspectSymbol =
(typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation
? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
: null
exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
exports.INSPECT_MAX_BYTES = 50
const K_MAX_LENGTH = 0x7fffffff
exports.kMaxLength = K_MAX_LENGTH
/**
* If `Buffer.TYPED_ARRAY_SUPPORT`:
* === true Use Uint8Array implementation (fastest)
* === false Print warning and recommend using `buffer` v4.x which has an Object
* implementation (most compatible, even IE6)
*
* Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
* Opera 11.6+, iOS 4.2+.
*
* We report that the browser does not support typed arrays if the are not subclassable
* using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
* (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
* for __proto__ and has a buggy typed array implementation.
*/
Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
typeof console.error === 'function') {
console.error(
'This browser lacks typed array (Uint8Array) support which is required by ' +
'`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
)
}
function typedArraySupport () {
// Can typed array instances can be augmented?
try {
const arr = new Uint8Array(1)
const proto = { foo: function () { return 42 } }
Object.setPrototypeOf(proto, Uint8Array.prototype)
Object.setPrototypeOf(arr, proto)
return arr.foo() === 42
} catch (e) {
return false
}
}
Object.defineProperty(Buffer.prototype, 'parent', {
enumerable: true,
get: function () {
if (!Buffer.isBuffer(this)) return undefined
return this.buffer
}
})
Object.defineProperty(Buffer.prototype, 'offset', {
enumerable: true,
get: function () {
if (!Buffer.isBuffer(this)) return undefined
return this.byteOffset
}
})
function createBuffer (length) {
if (length > K_MAX_LENGTH) {
throw new RangeError('The value "' + length + '" is invalid for option "size"')
}
// Return an augmented `Uint8Array` instance
const buf = new Uint8Array(length)
Object.setPrototypeOf(buf, Buffer.prototype)
return buf
}
/**
* The Buffer constructor returns instances of `Uint8Array` that have their
* prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
* `Uint8Array`, so the returned instances will have all the node `Buffer` methods
* and the `Uint8Array` methods. Square bracket notation works as expected -- it
* returns a single octet.
*
* The `Uint8Array` prototype remains unmodified.
*/
function Buffer (arg, encodingOrOffset, length) {
// Common case.
if (typeof arg === 'number') {
if (typeof encodingOrOffset === 'string') {
throw new TypeError(
'The "string" argument must be of type string. Received type number'
)
}
return allocUnsafe(arg)
}
return from(arg, encodingOrOffset, length)
}
Buffer.poolSize = 8192 // not used by this implementation
function from (value, encodingOrOffset, length) {
if (typeof value === 'string') {
return fromString(value, encodingOrOffset)
}
if (ArrayBuffer.isView(value)) {
return fromArrayView(value)
}
if (value == null) {
throw new TypeError(
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
'or Array-like Object. Received type ' + (typeof value)
)
}
if (isInstance(value, ArrayBuffer) ||
(value && isInstance(value.buffer, ArrayBuffer))) {
return fromArrayBuffer(value, encodingOrOffset, length)
}
if (typeof SharedArrayBuffer !== 'undefined' &&
(isInstance(value, SharedArrayBuffer) ||
(value && isInstance(value.buffer, SharedArrayBuffer)))) {
return fromArrayBuffer(value, encodingOrOffset, length)
}
if (typeof value === 'number') {
throw new TypeError(
'The "value" argument must not be of type number. Received type number'
)
}
const valueOf = value.valueOf && value.valueOf()
if (valueOf != null && valueOf !== value) {
return Buffer.from(valueOf, encodingOrOffset, length)
}
const b = fromObject(value)
if (b) return b
if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
typeof value[Symbol.toPrimitive] === 'function') {
return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)
}
throw new TypeError(
'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
'or Array-like Object. Received type ' + (typeof value)
)
}
/**
* Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
* if value is a number.
* Buffer.from(str[, encoding])
* Buffer.from(array)
* Buffer.from(buffer)
* Buffer.from(arrayBuffer[, byteOffset[, length]])
**/
Buffer.from = function (value, encodingOrOffset, length) {
return from(value, encodingOrOffset, length)
}
// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
// https://github.com/feross/buffer/pull/148
Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)
Object.setPrototypeOf(Buffer, Uint8Array)
function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be of type number')
} else if (size < 0) {
throw new RangeError('The value "' + size + '" is invalid for option "size"')
}
}
function alloc (size, fill, encoding) {
assertSize(size)
if (size <= 0) {
return createBuffer(size)
}
if (fill !== undefined) {
// Only pay attention to encoding if it's a string. This
// prevents accidentally sending in a number that would
// be interpreted as a start offset.
return typeof encoding === 'string'
? createBuffer(size).fill(fill, encoding)
: createBuffer(size).fill(fill)
}
return createBuffer(size)
}
/**
* Creates a new filled Buffer instance.
* alloc(size[, fill[, encoding]])
**/
Buffer.alloc = function (size, fill, encoding) {
return alloc(size, fill, encoding)
}
function allocUnsafe (size) {
assertSize(size)
return createBuffer(size < 0 ? 0 : checked(size) | 0)
}
/**
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
* */
Buffer.allocUnsafe = function (size) {
return allocUnsafe(size)
}
/**
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
*/
Buffer.allocUnsafeSlow = function (size) {
return allocUnsafe(size)
}
function fromString (string, encoding) {
if (typeof encoding !== 'string' || encoding === '') {
encoding = 'utf8'
}
if (!Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
const length = byteLength(string, encoding) | 0
let buf = createBuffer(length)
const actual = buf.write(string, encoding)
if (actual !== length) {
// Writing a hex string, for example, that contains invalid characters will
// cause everything after the first invalid character to be ignored. (e.g.
// 'abxxcd' will be treated as 'ab')
buf = buf.slice(0, actual)
}
return buf
}
function fromArrayLike (array) {
const length = array.length < 0 ? 0 : checked(array.length) | 0
const buf = createBuffer(length)
for (let i = 0; i < length; i += 1) {
buf[i] = array[i] & 255
}
return buf
}
function fromArrayView (arrayView) {
if (isInstance(arrayView, Uint8Array)) {
const copy = new Uint8Array(arrayView)
return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)
}
return fromArrayLike(arrayView)
}
function fromArrayBuffer (array, byteOffset, length) {
if (byteOffset < 0 || array.byteLength < byteOffset) {
throw new RangeError('"offset" is outside of buffer bounds')
}
if (array.byteLength < byteOffset + (length || 0)) {
throw new RangeError('"length" is outside of buffer bounds')
}
let buf
if (byteOffset === undefined && length === undefined) {
buf = new Uint8Array(array)
} else if (length === undefined) {
buf = new Uint8Array(array, byteOffset)
} else {
buf = new Uint8Array(array, byteOffset, length)
}
// Return an augmented `Uint8Array` instance
Object.setPrototypeOf(buf, Buffer.prototype)
return buf
}
function fromObject (obj) {
if (Buffer.isBuffer(obj)) {
const len = checked(obj.length) | 0
const buf = createBuffer(len)
if (buf.length === 0) {
return buf
}
obj.copy(buf, 0, 0, len)
return buf
}
if (obj.length !== undefined) {
if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
return createBuffer(0)
}
return fromArrayLike(obj)
}
if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
return fromArrayLike(obj.data)
}
}
function checked (length) {
// Note: cannot use `length < K_MAX_LENGTH` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= K_MAX_LENGTH) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
}
return length | 0
}
function SlowBuffer (length) {
if (+length != length) { // eslint-disable-line eqeqeq
length = 0
}
return Buffer.alloc(+length)
}
Buffer.isBuffer = function isBuffer (b) {
return b != null && b._isBuffer === true &&
b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
}
Buffer.compare = function compare (a, b) {
if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
throw new TypeError(
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
)
}
if (a === b) return 0
let x = a.length
let y = b.length
for (let i = 0, len = Math.min(x, y); i < len; ++i) {
if (a[i] !== b[i]) {
x = a[i]
y = b[i]
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
}
Buffer.isEncoding = function isEncoding (encoding) {
switch (String(encoding).toLowerCase()) {
case 'hex':
case 'utf8':
case 'utf-8':
case 'ascii':
case 'latin1':
case 'binary':
case 'base64':
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return true
default:
return false
}
}
Buffer.concat = function concat (list, length) {
if (!Array.isArray(list)) {
throw new TypeError('"list" argument must be an Array of Buffers')
}
if (list.length === 0) {
return Buffer.alloc(0)
}
let i
if (length === undefined) {
length = 0
for (i = 0; i < list.length; ++i) {
length += list[i].length
}
}
const buffer = Buffer.allocUnsafe(length)
let pos = 0
for (i = 0; i < list.length; ++i) {
let buf = list[i]
if (isInstance(buf, Uint8Array)) {
if (pos + buf.length > buffer.length) {
if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)
buf.copy(buffer, pos)
} else {
Uint8Array.prototype.set.call(
buffer,
buf,
pos
)
}
} else if (!Buffer.isBuffer(buf)) {
throw new TypeError('"list" argument must be an Array of Buffers')
} else {
buf.copy(buffer, pos)
}
pos += buf.length
}
return buffer
}
function byteLength (string, encoding) {
if (Buffer.isBuffer(string)) {
return string.length
}
if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
return string.byteLength
}
if (typeof string !== 'string') {
throw new TypeError(
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
'Received type ' + typeof string
)
}
const len = string.length
const mustMatch = (arguments.length > 2 && arguments[2] === true)
if (!mustMatch && len === 0) return 0
// Use a for loop to avoid recursion
let loweredCase = false
for (;;) {
switch (encoding) {
case 'ascii':
case 'latin1':
case 'binary':
return len
case 'utf8':
case 'utf-8':
return utf8ToBytes(string).length
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return len * 2
case 'hex':
return len >>> 1
case 'base64':
return base64ToBytes(string).length
default:
if (loweredCase) {
return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
}
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
Buffer.byteLength = byteLength
function slowToString (encoding, start, end) {
let loweredCase = false
// No need to verify that "this.length <= MAX_UINT32" since it's a read-only
// property of a typed array.
// This behaves neither like String nor Uint8Array in that we set start/end
// to their upper/lower bounds if the value passed is out of range.
// undefined is handled specially as per ECMA-262 6th Edition,
// Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
if (start === undefined || start < 0) {
start = 0
}
// Return early if start > this.length. Done here to prevent potential uint32
// coercion fail below.
if (start > this.length) {
return ''
}
if (end === undefined || end > this.length) {
end = this.length
}
if (end <= 0) {
return ''
}
// Force coercion to uint32. This will also coerce falsey/NaN values to 0.
end >>>= 0
start >>>= 0
if (end <= start) {
return ''
}
if (!encoding) encoding = 'utf8'
while (true) {
switch (encoding) {
case 'hex':
return hexSlice(this, start, end)
case 'utf8':
case 'utf-8':
return utf8Slice(this, start, end)
case 'ascii':
return asciiSlice(this, start, end)
case 'latin1':
case 'binary':
return latin1Slice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return utf16leSlice(this, start, end)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = (encoding + '').toLowerCase()
loweredCase = true
}
}
}
// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
// reliably in a browserify context because there could be multiple different
// copies of the 'buffer' package in use. This method works even for Buffer
// instances that were created from another copy of the `buffer` package.
// See: https://github.com/feross/buffer/issues/154
Buffer.prototype._isBuffer = true
function swap (b, n, m) {
const i = b[n]
b[n] = b[m]
b[m] = i
}
Buffer.prototype.swap16 = function swap16 () {
const len = this.length
if (len % 2 !== 0) {
throw new RangeError('Buffer size must be a multiple of 16-bits')
}
for (let i = 0; i < len; i += 2) {
swap(this, i, i + 1)
}
return this
}
Buffer.prototype.swap32 = function swap32 () {
const len = this.length
if (len % 4 !== 0) {
throw new RangeError('Buffer size must be a multiple of 32-bits')
}
for (let i = 0; i < len; i += 4) {
swap(this, i, i + 3)
swap(this, i + 1, i + 2)
}
return this
}
Buffer.prototype.swap64 = function swap64 () {
const len = this.length
if (len % 8 !== 0) {
throw new RangeError('Buffer size must be a multiple of 64-bits')
}
for (let i = 0; i < len; i += 8) {
swap(this, i, i + 7)
swap(this, i + 1, i + 6)
swap(this, i + 2, i + 5)
swap(this, i + 3, i + 4)
}
return this
}
Buffer.prototype.toString = function toString () {
const length = this.length
if (length === 0) return ''
if (arguments.length === 0) return utf8Slice(this, 0, length)
return slowToString.apply(this, arguments)
}
Buffer.prototype.toLocaleString = Buffer.prototype.toString
Buffer.prototype.equals = function equals (b) {
if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
if (this === b) return true
return Buffer.compare(this, b) === 0
}
Buffer.prototype.inspect = function inspect () {
let str = ''
const max = exports.INSPECT_MAX_BYTES
str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
if (this.length > max) str += ' ... '
return ''
}
if (customInspectSymbol) {
Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect
}
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
if (isInstance(target, Uint8Array)) {
target = Buffer.from(target, target.offset, target.byteLength)
}
if (!Buffer.isBuffer(target)) {
throw new TypeError(
'The "target" argument must be one of type Buffer or Uint8Array. ' +
'Received type ' + (typeof target)
)
}
if (start === undefined) {
start = 0
}
if (end === undefined) {
end = target ? target.length : 0
}
if (thisStart === undefined) {
thisStart = 0
}
if (thisEnd === undefined) {
thisEnd = this.length
}
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
throw new RangeError('out of range index')
}
if (thisStart >= thisEnd && start >= end) {
return 0
}
if (thisStart >= thisEnd) {
return -1
}
if (start >= end) {
return 1
}
start >>>= 0
end >>>= 0
thisStart >>>= 0
thisEnd >>>= 0
if (this === target) return 0
let x = thisEnd - thisStart
let y = end - start
const len = Math.min(x, y)
const thisCopy = this.slice(thisStart, thisEnd)
const targetCopy = target.slice(start, end)
for (let i = 0; i < len; ++i) {
if (thisCopy[i] !== targetCopy[i]) {
x = thisCopy[i]
y = targetCopy[i]
break
}
}
if (x < y) return -1
if (y < x) return 1
return 0
}
// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
//
// Arguments:
// - buffer - a Buffer to search
// - val - a string, Buffer, or number
// - byteOffset - an index into `buffer`; will be clamped to an int32
// - encoding - an optional encoding, relevant is val is a string
// - dir - true for indexOf, false for lastIndexOf
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
// Empty buffer means no match
if (buffer.length === 0) return -1
// Normalize byteOffset
if (typeof byteOffset === 'string') {
encoding = byteOffset
byteOffset = 0
} else if (byteOffset > 0x7fffffff) {
byteOffset = 0x7fffffff
} else if (byteOffset < -0x80000000) {
byteOffset = -0x80000000
}
byteOffset = +byteOffset // Coerce to Number.
if (numberIsNaN(byteOffset)) {
// byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
byteOffset = dir ? 0 : (buffer.length - 1)
}
// Normalize byteOffset: negative offsets start from the end of the buffer
if (byteOffset < 0) byteOffset = buffer.length + byteOffset
if (byteOffset >= buffer.length) {
if (dir) return -1
else byteOffset = buffer.length - 1
} else if (byteOffset < 0) {
if (dir) byteOffset = 0
else return -1
}
// Normalize val
if (typeof val === 'string') {
val = Buffer.from(val, encoding)
}
// Finally, search either indexOf (if dir is true) or lastIndexOf
if (Buffer.isBuffer(val)) {
// Special case: looking for empty string/buffer always fails
if (val.length === 0) {
return -1
}
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
} else if (typeof val === 'number') {
val = val & 0xFF // Search for a byte value [0-255]
if (typeof Uint8Array.prototype.indexOf === 'function') {
if (dir) {
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
} else {
return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
}
}
return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)
}
throw new TypeError('val must be string, number or Buffer')
}
function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
let indexSize = 1
let arrLength = arr.length
let valLength = val.length
if (encoding !== undefined) {
encoding = String(encoding).toLowerCase()
if (encoding === 'ucs2' || encoding === 'ucs-2' ||
encoding === 'utf16le' || encoding === 'utf-16le') {
if (arr.length < 2 || val.length < 2) {
return -1
}
indexSize = 2
arrLength /= 2
valLength /= 2
byteOffset /= 2
}
}
function read (buf, i) {
if (indexSize === 1) {
return buf[i]
} else {
return buf.readUInt16BE(i * indexSize)
}
}
let i
if (dir) {
let foundIndex = -1
for (i = byteOffset; i < arrLength; i++) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
if (foundIndex === -1) foundIndex = i
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
} else {
if (foundIndex !== -1) i -= i - foundIndex
foundIndex = -1
}
}
} else {
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
for (i = byteOffset; i >= 0; i--) {
let found = true
for (let j = 0; j < valLength; j++) {
if (read(arr, i + j) !== read(val, j)) {
found = false
break
}
}
if (found) return i
}
}
return -1
}
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
return this.indexOf(val, byteOffset, encoding) !== -1
}
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
}
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
}
function hexWrite (buf, string, offset, length) {
offset = Number(offset) || 0
const remaining = buf.length - offset
if (!length) {
length = remaining
} else {
length = Number(length)
if (length > remaining) {
length = remaining
}
}
const strLen = string.length
if (length > strLen / 2) {
length = strLen / 2
}
let i
for (i = 0; i < length; ++i) {
const parsed = parseInt(string.substr(i * 2, 2), 16)
if (numberIsNaN(parsed)) return i
buf[offset + i] = parsed
}
return i
}
function utf8Write (buf, string, offset, length) {
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}
function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
function base64Write (buf, string, offset, length) {
return blitBuffer(base64ToBytes(string), buf, offset, length)
}
function ucs2Write (buf, string, offset, length) {
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}
Buffer.prototype.write = function write (string, offset, length, encoding) {
// Buffer#write(string)
if (offset === undefined) {
encoding = 'utf8'
length = this.length
offset = 0
// Buffer#write(string, encoding)
} else if (length === undefined && typeof offset === 'string') {
encoding = offset
length = this.length
offset = 0
// Buffer#write(string, offset[, length][, encoding])
} else if (isFinite(offset)) {
offset = offset >>> 0
if (isFinite(length)) {
length = length >>> 0
if (encoding === undefined) encoding = 'utf8'
} else {
encoding = length
length = undefined
}
} else {
throw new Error(
'Buffer.write(string, encoding, offset[, length]) is no longer supported'
)
}
const remaining = this.length - offset
if (length === undefined || length > remaining) length = remaining
if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
throw new RangeError('Attempt to write outside buffer bounds')
}
if (!encoding) encoding = 'utf8'
let loweredCase = false
for (;;) {
switch (encoding) {
case 'hex':
return hexWrite(this, string, offset, length)
case 'utf8':
case 'utf-8':
return utf8Write(this, string, offset, length)
case 'ascii':
case 'latin1':
case 'binary':
return asciiWrite(this, string, offset, length)
case 'base64':
// Warning: maxLength not taken into account in base64Write
return base64Write(this, string, offset, length)
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
return ucs2Write(this, string, offset, length)
default:
if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
encoding = ('' + encoding).toLowerCase()
loweredCase = true
}
}
}
Buffer.prototype.toJSON = function toJSON () {
return {
type: 'Buffer',
data: Array.prototype.slice.call(this._arr || this, 0)
}
}
function base64Slice (buf, start, end) {
if (start === 0 && end === buf.length) {
return base64.fromByteArray(buf)
} else {
return base64.fromByteArray(buf.slice(start, end))
}
}
function utf8Slice (buf, start, end) {
end = Math.min(buf.length, end)
const res = []
let i = start
while (i < end) {
const firstByte = buf[i]
let codePoint = null
let bytesPerSequence = (firstByte > 0xEF)
? 4
: (firstByte > 0xDF)
? 3
: (firstByte > 0xBF)
? 2
: 1
if (i + bytesPerSequence <= end) {
let secondByte, thirdByte, fourthByte, tempCodePoint
switch (bytesPerSequence) {
case 1:
if (firstByte < 0x80) {
codePoint = firstByte
}
break
case 2:
secondByte = buf[i + 1]
if ((secondByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
if (tempCodePoint > 0x7F) {
codePoint = tempCodePoint
}
}
break
case 3:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
codePoint = tempCodePoint
}
}
break
case 4:
secondByte = buf[i + 1]
thirdByte = buf[i + 2]
fourthByte = buf[i + 3]
if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
codePoint = tempCodePoint
}
}
}
}
if (codePoint === null) {
// we did not generate a valid codePoint so insert a
// replacement char (U+FFFD) and advance only 1 byte
codePoint = 0xFFFD
bytesPerSequence = 1
} else if (codePoint > 0xFFFF) {
// encode to utf16 (surrogate pair dance)
codePoint -= 0x10000
res.push(codePoint >>> 10 & 0x3FF | 0xD800)
codePoint = 0xDC00 | codePoint & 0x3FF
}
res.push(codePoint)
i += bytesPerSequence
}
return decodeCodePointsArray(res)
}
// Based on http://stackoverflow.com/a/22747272/680742, the browser with
// the lowest limit is Chrome, with 0x10000 args.
// We go 1 magnitude less, for safety
const MAX_ARGUMENTS_LENGTH = 0x1000
function decodeCodePointsArray (codePoints) {
const len = codePoints.length
if (len <= MAX_ARGUMENTS_LENGTH) {
return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
}
// Decode in chunks to avoid "call stack size exceeded".
let res = ''
let i = 0
while (i < len) {
res += String.fromCharCode.apply(
String,
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
)
}
return res
}
function asciiSlice (buf, start, end) {
let ret = ''
end = Math.min(buf.length, end)
for (let i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F)
}
return ret
}
function latin1Slice (buf, start, end) {
let ret = ''
end = Math.min(buf.length, end)
for (let i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i])
}
return ret
}
function hexSlice (buf, start, end) {
const len = buf.length
if (!start || start < 0) start = 0
if (!end || end < 0 || end > len) end = len
let out = ''
for (let i = start; i < end; ++i) {
out += hexSliceLookupTable[buf[i]]
}
return out
}
function utf16leSlice (buf, start, end) {
const bytes = buf.slice(start, end)
let res = ''
// If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
for (let i = 0; i < bytes.length - 1; i += 2) {
res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
}
return res
}
Buffer.prototype.slice = function slice (start, end) {
const len = this.length
start = ~~start
end = end === undefined ? len : ~~end
if (start < 0) {
start += len
if (start < 0) start = 0
} else if (start > len) {
start = len
}
if (end < 0) {
end += len
if (end < 0) end = 0
} else if (end > len) {
end = len
}
if (end < start) end = start
const newBuf = this.subarray(start, end)
// Return an augmented `Uint8Array` instance
Object.setPrototypeOf(newBuf, Buffer.prototype)
return newBuf
}
/*
* Need to make sure that buffer isn't trying to write out of bounds.
*/
function checkOffset (offset, ext, length) {
if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}
Buffer.prototype.readUintLE =
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
let val = this[offset]
let mul = 1
let i = 0
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul
}
return val
}
Buffer.prototype.readUintBE =
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) {
checkOffset(offset, byteLength, this.length)
}
let val = this[offset + --byteLength]
let mul = 1
while (byteLength > 0 && (mul *= 0x100)) {
val += this[offset + --byteLength] * mul
}
return val
}
Buffer.prototype.readUint8 =
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 1, this.length)
return this[offset]
}
Buffer.prototype.readUint16LE =
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 2, this.length)
return this[offset] | (this[offset + 1] << 8)
}
Buffer.prototype.readUint16BE =
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 2, this.length)
return (this[offset] << 8) | this[offset + 1]
}
Buffer.prototype.readUint32LE =
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 4, this.length)
return ((this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16)) +
(this[offset + 3] * 0x1000000)
}
Buffer.prototype.readUint32BE =
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset] * 0x1000000) +
((this[offset + 1] << 16) |
(this[offset + 2] << 8) |
this[offset + 3])
}
Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {
offset = offset >>> 0
validateNumber(offset, 'offset')
const first = this[offset]
const last = this[offset + 7]
if (first === undefined || last === undefined) {
boundsError(offset, this.length - 8)
}
const lo = first +
this[++offset] * 2 ** 8 +
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 24
const hi = this[++offset] +
this[++offset] * 2 ** 8 +
this[++offset] * 2 ** 16 +
last * 2 ** 24
return BigInt(lo) + (BigInt(hi) << BigInt(32))
})
Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {
offset = offset >>> 0
validateNumber(offset, 'offset')
const first = this[offset]
const last = this[offset + 7]
if (first === undefined || last === undefined) {
boundsError(offset, this.length - 8)
}
const hi = first * 2 ** 24 +
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 8 +
this[++offset]
const lo = this[++offset] * 2 ** 24 +
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 8 +
last
return (BigInt(hi) << BigInt(32)) + BigInt(lo)
})
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
let val = this[offset]
let mul = 1
let i = 0
while (++i < byteLength && (mul *= 0x100)) {
val += this[offset + i] * mul
}
mul *= 0x80
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
return val
}
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) checkOffset(offset, byteLength, this.length)
let i = byteLength
let mul = 1
let val = this[offset + --i]
while (i > 0 && (mul *= 0x100)) {
val += this[offset + --i] * mul
}
mul *= 0x80
if (val >= mul) val -= Math.pow(2, 8 * byteLength)
return val
}
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 1, this.length)
if (!(this[offset] & 0x80)) return (this[offset])
return ((0xff - this[offset] + 1) * -1)
}
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 2, this.length)
const val = this[offset] | (this[offset + 1] << 8)
return (val & 0x8000) ? val | 0xFFFF0000 : val
}
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 2, this.length)
const val = this[offset + 1] | (this[offset] << 8)
return (val & 0x8000) ? val | 0xFFFF0000 : val
}
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset]) |
(this[offset + 1] << 8) |
(this[offset + 2] << 16) |
(this[offset + 3] << 24)
}
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 4, this.length)
return (this[offset] << 24) |
(this[offset + 1] << 16) |
(this[offset + 2] << 8) |
(this[offset + 3])
}
Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {
offset = offset >>> 0
validateNumber(offset, 'offset')
const first = this[offset]
const last = this[offset + 7]
if (first === undefined || last === undefined) {
boundsError(offset, this.length - 8)
}
const val = this[offset + 4] +
this[offset + 5] * 2 ** 8 +
this[offset + 6] * 2 ** 16 +
(last << 24) // Overflow
return (BigInt(val) << BigInt(32)) +
BigInt(first +
this[++offset] * 2 ** 8 +
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 24)
})
Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {
offset = offset >>> 0
validateNumber(offset, 'offset')
const first = this[offset]
const last = this[offset + 7]
if (first === undefined || last === undefined) {
boundsError(offset, this.length - 8)
}
const val = (first << 24) + // Overflow
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 8 +
this[++offset]
return (BigInt(val) << BigInt(32)) +
BigInt(this[++offset] * 2 ** 24 +
this[++offset] * 2 ** 16 +
this[++offset] * 2 ** 8 +
last)
})
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, true, 23, 4)
}
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 4, this.length)
return ieee754.read(this, offset, false, 23, 4)
}
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, true, 52, 8)
}
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
offset = offset >>> 0
if (!noAssert) checkOffset(offset, 8, this.length)
return ieee754.read(this, offset, false, 52, 8)
}
function checkInt (buf, value, offset, ext, max, min) {
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
if (offset + ext > buf.length) throw new RangeError('Index out of range')
}
Buffer.prototype.writeUintLE =
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
value = +value
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) {
const maxBytes = Math.pow(2, 8 * byteLength) - 1
checkInt(this, value, offset, byteLength, maxBytes, 0)
}
let mul = 1
let i = 0
this[offset] = value & 0xFF
while (++i < byteLength && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeUintBE =
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
value = +value
offset = offset >>> 0
byteLength = byteLength >>> 0
if (!noAssert) {
const maxBytes = Math.pow(2, 8 * byteLength) - 1
checkInt(this, value, offset, byteLength, maxBytes, 0)
}
let i = byteLength - 1
let mul = 1
this[offset + i] = value & 0xFF
while (--i >= 0 && (mul *= 0x100)) {
this[offset + i] = (value / mul) & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeUint8 =
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
this[offset] = (value & 0xff)
return offset + 1
}
Buffer.prototype.writeUint16LE =
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
this[offset] = (value & 0xff)
this[offset + 1] = (value >>> 8)
return offset + 2
}
Buffer.prototype.writeUint16BE =
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
this[offset] = (value >>> 8)
this[offset + 1] = (value & 0xff)
return offset + 2
}
Buffer.prototype.writeUint32LE =
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
this[offset + 3] = (value >>> 24)
this[offset + 2] = (value >>> 16)
this[offset + 1] = (value >>> 8)
this[offset] = (value & 0xff)
return offset + 4
}
Buffer.prototype.writeUint32BE =
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = (value & 0xff)
return offset + 4
}
function wrtBigUInt64LE (buf, value, offset, min, max) {
checkIntBI(value, min, max, buf, offset, 7)
let lo = Number(value & BigInt(0xffffffff))
buf[offset++] = lo
lo = lo >> 8
buf[offset++] = lo
lo = lo >> 8
buf[offset++] = lo
lo = lo >> 8
buf[offset++] = lo
let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
buf[offset++] = hi
hi = hi >> 8
buf[offset++] = hi
hi = hi >> 8
buf[offset++] = hi
hi = hi >> 8
buf[offset++] = hi
return offset
}
function wrtBigUInt64BE (buf, value, offset, min, max) {
checkIntBI(value, min, max, buf, offset, 7)
let lo = Number(value & BigInt(0xffffffff))
buf[offset + 7] = lo
lo = lo >> 8
buf[offset + 6] = lo
lo = lo >> 8
buf[offset + 5] = lo
lo = lo >> 8
buf[offset + 4] = lo
let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))
buf[offset + 3] = hi
hi = hi >> 8
buf[offset + 2] = hi
hi = hi >> 8
buf[offset + 1] = hi
hi = hi >> 8
buf[offset] = hi
return offset + 8
}
Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {
return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
})
Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {
return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))
})
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
const limit = Math.pow(2, (8 * byteLength) - 1)
checkInt(this, value, offset, byteLength, limit - 1, -limit)
}
let i = 0
let mul = 1
let sub = 0
this[offset] = value & 0xFF
while (++i < byteLength && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
sub = 1
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
const limit = Math.pow(2, (8 * byteLength) - 1)
checkInt(this, value, offset, byteLength, limit - 1, -limit)
}
let i = byteLength - 1
let mul = 1
let sub = 0
this[offset + i] = value & 0xFF
while (--i >= 0 && (mul *= 0x100)) {
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
sub = 1
}
this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
}
return offset + byteLength
}
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
if (value < 0) value = 0xff + value + 1
this[offset] = (value & 0xff)
return offset + 1
}
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
this[offset] = (value & 0xff)
this[offset + 1] = (value >>> 8)
return offset + 2
}
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
this[offset] = (value >>> 8)
this[offset + 1] = (value & 0xff)
return offset + 2
}
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
this[offset] = (value & 0xff)
this[offset + 1] = (value >>> 8)
this[offset + 2] = (value >>> 16)
this[offset + 3] = (value >>> 24)
return offset + 4
}
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
if (value < 0) value = 0xffffffff + value + 1
this[offset] = (value >>> 24)
this[offset + 1] = (value >>> 16)
this[offset + 2] = (value >>> 8)
this[offset + 3] = (value & 0xff)
return offset + 4
}
Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {
return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
})
Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {
return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))
})
function checkIEEE754 (buf, value, offset, ext, max, min) {
if (offset + ext > buf.length) throw new RangeError('Index out of range')
if (offset < 0) throw new RangeError('Index out of range')
}
function writeFloat (buf, value, offset, littleEndian, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
}
ieee754.write(buf, value, offset, littleEndian, 23, 4)
return offset + 4
}
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
return writeFloat(this, value, offset, true, noAssert)
}
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
return writeFloat(this, value, offset, false, noAssert)
}
function writeDouble (buf, value, offset, littleEndian, noAssert) {
value = +value
offset = offset >>> 0
if (!noAssert) {
checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
}
ieee754.write(buf, value, offset, littleEndian, 52, 8)
return offset + 8
}
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
return writeDouble(this, value, offset, true, noAssert)
}
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
return writeDouble(this, value, offset, false, noAssert)
}
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
if (!start) start = 0
if (!end && end !== 0) end = this.length
if (targetStart >= target.length) targetStart = target.length
if (!targetStart) targetStart = 0
if (end > 0 && end < start) end = start
// Copy 0 bytes; we're done
if (end === start) return 0
if (target.length === 0 || this.length === 0) return 0
// Fatal error conditions
if (targetStart < 0) {
throw new RangeError('targetStart out of bounds')
}
if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
if (end < 0) throw new RangeError('sourceEnd out of bounds')
// Are we oob?
if (end > this.length) end = this.length
if (target.length - targetStart < end - start) {
end = target.length - targetStart + start
}
const len = end - start
if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
// Use built-in when available, missing from IE11
this.copyWithin(targetStart, start, end)
} else {
Uint8Array.prototype.set.call(
target,
this.subarray(start, end),
targetStart
)
}
return len
}
// Usage:
// buffer.fill(number[, offset[, end]])
// buffer.fill(buffer[, offset[, end]])
// buffer.fill(string[, offset[, end]][, encoding])
Buffer.prototype.fill = function fill (val, start, end, encoding) {
// Handle string cases:
if (typeof val === 'string') {
if (typeof start === 'string') {
encoding = start
start = 0
end = this.length
} else if (typeof end === 'string') {
encoding = end
end = this.length
}
if (encoding !== undefined && typeof encoding !== 'string') {
throw new TypeError('encoding must be a string')
}
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
throw new TypeError('Unknown encoding: ' + encoding)
}
if (val.length === 1) {
const code = val.charCodeAt(0)
if ((encoding === 'utf8' && code < 128) ||
encoding === 'latin1') {
// Fast path: If `val` fits into a single byte, use that numeric value.
val = code
}
}
} else if (typeof val === 'number') {
val = val & 255
} else if (typeof val === 'boolean') {
val = Number(val)
}
// Invalid ranges are not set to a default, so can range check early.
if (start < 0 || this.length < start || this.length < end) {
throw new RangeError('Out of range index')
}
if (end <= start) {
return this
}
start = start >>> 0
end = end === undefined ? this.length : end >>> 0
if (!val) val = 0
let i
if (typeof val === 'number') {
for (i = start; i < end; ++i) {
this[i] = val
}
} else {
const bytes = Buffer.isBuffer(val)
? val
: Buffer.from(val, encoding)
const len = bytes.length
if (len === 0) {
throw new TypeError('The value "' + val +
'" is invalid for argument "value"')
}
for (i = 0; i < end - start; ++i) {
this[i + start] = bytes[i % len]
}
}
return this
}
// CUSTOM ERRORS
// =============
// Simplified versions from Node, changed for Buffer-only usage
const errors = {}
function E (sym, getMessage, Base) {
errors[sym] = class NodeError extends Base {
constructor () {
super()
Object.defineProperty(this, 'message', {
value: getMessage.apply(this, arguments),
writable: true,
configurable: true
})
// Add the error code to the name to include it in the stack trace.
this.name = `${this.name} [${sym}]`
// Access the stack to generate the error message including the error code
// from the name.
this.stack // eslint-disable-line no-unused-expressions
// Reset the name to the actual name.
delete this.name
}
get code () {
return sym
}
set code (value) {
Object.defineProperty(this, 'code', {
configurable: true,
enumerable: true,
value,
writable: true
})
}
toString () {
return `${this.name} [${sym}]: ${this.message}`
}
}
}
E('ERR_BUFFER_OUT_OF_BOUNDS',
function (name) {
if (name) {
return `${name} is outside of buffer bounds`
}
return 'Attempt to access memory outside buffer bounds'
}, RangeError)
E('ERR_INVALID_ARG_TYPE',
function (name, actual) {
return `The "${name}" argument must be of type number. Received type ${typeof actual}`
}, TypeError)
E('ERR_OUT_OF_RANGE',
function (str, range, input) {
let msg = `The value of "${str}" is out of range.`
let received = input
if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
received = addNumericalSeparator(String(input))
} else if (typeof input === 'bigint') {
received = String(input)
if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
received = addNumericalSeparator(received)
}
received += 'n'
}
msg += ` It must be ${range}. Received ${received}`
return msg
}, RangeError)
function addNumericalSeparator (val) {
let res = ''
let i = val.length
const start = val[0] === '-' ? 1 : 0
for (; i >= start + 4; i -= 3) {
res = `_${val.slice(i - 3, i)}${res}`
}
return `${val.slice(0, i)}${res}`
}
// CHECK FUNCTIONS
// ===============
function checkBounds (buf, offset, byteLength) {
validateNumber(offset, 'offset')
if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
boundsError(offset, buf.length - (byteLength + 1))
}
}
function checkIntBI (value, min, max, buf, offset, byteLength) {
if (value > max || value < min) {
const n = typeof min === 'bigint' ? 'n' : ''
let range
if (byteLength > 3) {
if (min === 0 || min === BigInt(0)) {
range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`
} else {
range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +
`${(byteLength + 1) * 8 - 1}${n}`
}
} else {
range = `>= ${min}${n} and <= ${max}${n}`
}
throw new errors.ERR_OUT_OF_RANGE('value', range, value)
}
checkBounds(buf, offset, byteLength)
}
function validateNumber (value, name) {
if (typeof value !== 'number') {
throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)
}
}
function boundsError (value, length, type) {
if (Math.floor(value) !== value) {
validateNumber(value, type)
throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)
}
if (length < 0) {
throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()
}
throw new errors.ERR_OUT_OF_RANGE(type || 'offset',
`>= ${type ? 1 : 0} and <= ${length}`,
value)
}
// HELPER FUNCTIONS
// ================
const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
function base64clean (str) {
// Node takes equal signs as end of the Base64 encoding
str = str.split('=')[0]
// Node strips out invalid characters like \n and \t from the string, base64-js does not
str = str.trim().replace(INVALID_BASE64_RE, '')
// Node converts strings with length < 2 to ''
if (str.length < 2) return ''
// Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
while (str.length % 4 !== 0) {
str = str + '='
}
return str
}
function utf8ToBytes (string, units) {
units = units || Infinity
let codePoint
const length = string.length
let leadSurrogate = null
const bytes = []
for (let i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i)
// is surrogate component
if (codePoint > 0xD7FF && codePoint < 0xE000) {
// last char was a lead
if (!leadSurrogate) {
// no lead yet
if (codePoint > 0xDBFF) {
// unexpected trail
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
} else if (i + 1 === length) {
// unpaired lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
continue
}
// valid lead
leadSurrogate = codePoint
continue
}
// 2 leads in a row
if (codePoint < 0xDC00) {
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
leadSurrogate = codePoint
continue
}
// valid surrogate pair
codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
} else if (leadSurrogate) {
// valid bmp char, but last char was a lead
if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
}
leadSurrogate = null
// encode utf8
if (codePoint < 0x80) {
if ((units -= 1) < 0) break
bytes.push(codePoint)
} else if (codePoint < 0x800) {
if ((units -= 2) < 0) break
bytes.push(
codePoint >> 0x6 | 0xC0,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x10000) {
if ((units -= 3) < 0) break
bytes.push(
codePoint >> 0xC | 0xE0,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else if (codePoint < 0x110000) {
if ((units -= 4) < 0) break
bytes.push(
codePoint >> 0x12 | 0xF0,
codePoint >> 0xC & 0x3F | 0x80,
codePoint >> 0x6 & 0x3F | 0x80,
codePoint & 0x3F | 0x80
)
} else {
throw new Error('Invalid code point')
}
}
return bytes
}
function asciiToBytes (str) {
const byteArray = []
for (let i = 0; i < str.length; ++i) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF)
}
return byteArray
}
function utf16leToBytes (str, units) {
let c, hi, lo
const byteArray = []
for (let i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i)
hi = c >> 8
lo = c % 256
byteArray.push(lo)
byteArray.push(hi)
}
return byteArray
}
function base64ToBytes (str) {
return base64.toByteArray(base64clean(str))
}
function blitBuffer (src, dst, offset, length) {
let i
for (i = 0; i < length; ++i) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i]
}
return i
}
// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
// the `instanceof` check but they should be treated as of that type.
// See: https://github.com/feross/buffer/issues/166
function isInstance (obj, type) {
return obj instanceof type ||
(obj != null && obj.constructor != null && obj.constructor.name != null &&
obj.constructor.name === type.name)
}
function numberIsNaN (obj) {
// For IE11 support
return obj !== obj // eslint-disable-line no-self-compare
}
// Create lookup table for `toString('hex')`
// See: https://github.com/feross/buffer/issues/219
const hexSliceLookupTable = (function () {
const alphabet = '0123456789abcdef'
const table = new Array(256)
for (let i = 0; i < 16; ++i) {
const i16 = i * 16
for (let j = 0; j < 16; ++j) {
table[i16 + j] = alphabet[i] + alphabet[j]
}
}
return table
})()
// Return not function with Error if BigInt not supported
function defineBigIntMethod (fn) {
return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn
}
function BufferBigIntNotDefined () {
throw new Error('BigInt not supported')
}
/***/ }),
/***/ 698:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/* provided dependency */ var Buffer = __webpack_require__(764)["Buffer"];
/*!
* @description Recursive object extending
* @author Viacheslav Lotsmanov
* @license MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function isSpecificValue(val) {
return (
val instanceof Buffer
|| val instanceof Date
|| val instanceof RegExp
) ? true : false;
}
function cloneSpecificValue(val) {
if (val instanceof Buffer) {
var x = Buffer.alloc
? Buffer.alloc(val.length)
: new Buffer(val.length);
val.copy(x);
return x;
} else if (val instanceof Date) {
return new Date(val.getTime());
} else if (val instanceof RegExp) {
return new RegExp(val);
} else {
throw new Error('Unexpected situation');
}
}
/**
* Recursive cloning array.
*/
function deepCloneArray(arr) {
var clone = [];
arr.forEach(function (item, index) {
if (typeof item === 'object' && item !== null) {
if (Array.isArray(item)) {
clone[index] = deepCloneArray(item);
} else if (isSpecificValue(item)) {
clone[index] = cloneSpecificValue(item);
} else {
clone[index] = deepExtend({}, item);
}
} else {
clone[index] = item;
}
});
return clone;
}
function safeGetProperty(object, property) {
return property === '__proto__' ? undefined : object[property];
}
/**
* Extening object that entered in first argument.
*
* Returns extended object or false if have no target object or incorrect type.
*
* If you wish to clone source object (without modify it), just use empty new
* object as first argument, like this:
* deepExtend({}, yourObj_1, [yourObj_N]);
*/
var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) {
if (arguments.length < 1 || typeof arguments[0] !== 'object') {
return false;
}
if (arguments.length < 2) {
return arguments[0];
}
var target = arguments[0];
// convert arguments to array and cut off target object
var args = Array.prototype.slice.call(arguments, 1);
var val, src, clone;
args.forEach(function (obj) {
// skip argument if isn't an object, is null, or is an array
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
return;
}
Object.keys(obj).forEach(function (key) {
src = safeGetProperty(target, key); // source value
val = safeGetProperty(obj, key); // new value
// recursion prevention
if (val === target) {
return;
/**
* if new value isn't object then just overwrite by new value
* instead of extending.
*/
} else if (typeof val !== 'object' || val === null) {
target[key] = val;
return;
// just clone arrays (and recursive clone objects inside)
} else if (Array.isArray(val)) {
target[key] = deepCloneArray(val);
return;
// custom cloning and overwrite for specific objects
} else if (isSpecificValue(val)) {
target[key] = cloneSpecificValue(val);
return;
// overwrite by new value if source isn't object or array
} else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
target[key] = deepExtend({}, val);
return;
// source value and new value is objects both, extending...
} else {
target[key] = deepExtend(src, val);
return;
}
});
});
return target;
};
/***/ }),
/***/ 717:
/***/ ((module) => {
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
})
}
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
}
/***/ }),
/***/ 155:
/***/ ((module) => {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/***/ 798:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/* provided dependency */ var process = __webpack_require__(155);
// limit of Crypto.getRandomValues()
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
var MAX_BYTES = 65536
// Node supports requesting up to this number of bytes
// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48
var MAX_UINT32 = 4294967295
function oldBrowser () {
throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11')
}
var Buffer = (__webpack_require__(509).Buffer)
var crypto = __webpack_require__.g.crypto || __webpack_require__.g.msCrypto
if (crypto && crypto.getRandomValues) {
module.exports = randomBytes
} else {
module.exports = oldBrowser
}
function randomBytes (size, cb) {
// phantomjs needs to throw
if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
var bytes = Buffer.allocUnsafe(size)
if (size > 0) { // getRandomValues fails on IE if size == 0
if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
// can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
for (var generated = 0; generated < size; generated += MAX_BYTES) {
// buffer.slice automatically checks if the end is past the end of
// the buffer so we don't have to here
crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))
}
} else {
crypto.getRandomValues(bytes)
}
}
if (typeof cb === 'function') {
return process.nextTick(function () {
cb(null, bytes)
})
}
return bytes
}
/***/ }),
/***/ 509:
/***/ ((module, exports, __webpack_require__) => {
/*! safe-buffer. MIT License. Feross Aboukhadijeh */
/* eslint-disable node/no-deprecated-api */
var buffer = __webpack_require__(764)
var Buffer = buffer.Buffer
// alternative to using Object.keys for old browsers
function copyProps (src, dst) {
for (var key in src) {
dst[key] = src[key]
}
}
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
module.exports = buffer
} else {
// Copy properties from require('buffer')
copyProps(buffer, exports)
exports.Buffer = SafeBuffer
}
function SafeBuffer (arg, encodingOrOffset, length) {
return Buffer(arg, encodingOrOffset, length)
}
SafeBuffer.prototype = Object.create(Buffer.prototype)
// Copy static methods from Buffer
copyProps(Buffer, SafeBuffer)
SafeBuffer.from = function (arg, encodingOrOffset, length) {
if (typeof arg === 'number') {
throw new TypeError('Argument must not be a number')
}
return Buffer(arg, encodingOrOffset, length)
}
SafeBuffer.alloc = function (size, fill, encoding) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
var buf = Buffer(size)
if (fill !== undefined) {
if (typeof encoding === 'string') {
buf.fill(fill, encoding)
} else {
buf.fill(fill)
}
} else {
buf.fill(0)
}
return buf
}
SafeBuffer.allocUnsafe = function (size) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
return Buffer(size)
}
SafeBuffer.allocUnsafeSlow = function (size) {
if (typeof size !== 'number') {
throw new TypeError('Argument must be a number')
}
return buffer.SlowBuffer(size)
}
/***/ }),
/***/ 189:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var Buffer = (__webpack_require__(509).Buffer)
// prototype class for hash functions
function Hash (blockSize, finalSize) {
this._block = Buffer.alloc(blockSize)
this._finalSize = finalSize
this._blockSize = blockSize
this._len = 0
}
Hash.prototype.update = function (data, enc) {
if (typeof data === 'string') {
enc = enc || 'utf8'
data = Buffer.from(data, enc)
}
var block = this._block
var blockSize = this._blockSize
var length = data.length
var accum = this._len
for (var offset = 0; offset < length;) {
var assigned = accum % blockSize
var remainder = Math.min(length - offset, blockSize - assigned)
for (var i = 0; i < remainder; i++) {
block[assigned + i] = data[offset + i]
}
accum += remainder
offset += remainder
if ((accum % blockSize) === 0) {
this._update(block)
}
}
this._len += length
return this
}
Hash.prototype.digest = function (enc) {
var rem = this._len % this._blockSize
this._block[rem] = 0x80
// zero (rem + 1) trailing bits, where (rem + 1) is the smallest
// non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize
this._block.fill(0, rem + 1)
if (rem >= this._finalSize) {
this._update(this._block)
this._block.fill(0)
}
var bits = this._len * 8
// uint32
if (bits <= 0xffffffff) {
this._block.writeUInt32BE(bits, this._blockSize - 4)
// uint64
} else {
var lowBits = (bits & 0xffffffff) >>> 0
var highBits = (bits - lowBits) / 0x100000000
this._block.writeUInt32BE(highBits, this._blockSize - 8)
this._block.writeUInt32BE(lowBits, this._blockSize - 4)
}
this._update(this._block)
var hash = this._hash()
return enc ? hash.toString(enc) : hash
}
Hash.prototype._update = function () {
throw new Error('_update must be implemented by subclass')
}
module.exports = Hash
/***/ }),
/***/ 72:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var exports = module.exports = function SHA (algorithm) {
algorithm = algorithm.toLowerCase()
var Algorithm = exports[algorithm]
if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
return new Algorithm()
}
exports.sha = __webpack_require__(448)
exports.sha1 = __webpack_require__(336)
exports.sha224 = __webpack_require__(432)
exports.sha256 = __webpack_require__(499)
exports.sha384 = __webpack_require__(686)
exports.sha512 = __webpack_require__(816)
/***/ }),
/***/ 448:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
* in FIPS PUB 180-1
* This source code is derived from sha1.js of the same repository.
* The difference between SHA-0 and SHA-1 is just a bitwise rotate left
* operation was added.
*/
var inherits = __webpack_require__(717)
var Hash = __webpack_require__(189)
var Buffer = (__webpack_require__(509).Buffer)
var K = [
0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
]
var W = new Array(80)
function Sha () {
this.init()
this._w = W
Hash.call(this, 64, 56)
}
inherits(Sha, Hash)
Sha.prototype.init = function () {
this._a = 0x67452301
this._b = 0xefcdab89
this._c = 0x98badcfe
this._d = 0x10325476
this._e = 0xc3d2e1f0
return this
}
function rotl5 (num) {
return (num << 5) | (num >>> 27)
}
function rotl30 (num) {
return (num << 30) | (num >>> 2)
}
function ft (s, b, c, d) {
if (s === 0) return (b & c) | ((~b) & d)
if (s === 2) return (b & c) | (b & d) | (c & d)
return b ^ c ^ d
}
Sha.prototype._update = function (M) {
var W = this._w
var a = this._a | 0
var b = this._b | 0
var c = this._c | 0
var d = this._d | 0
var e = this._e | 0
for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
for (var j = 0; j < 80; ++j) {
var s = ~~(j / 20)
var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
e = d
d = c
c = rotl30(b)
b = a
a = t
}
this._a = (a + this._a) | 0
this._b = (b + this._b) | 0
this._c = (c + this._c) | 0
this._d = (d + this._d) | 0
this._e = (e + this._e) | 0
}
Sha.prototype._hash = function () {
var H = Buffer.allocUnsafe(20)
H.writeInt32BE(this._a | 0, 0)
H.writeInt32BE(this._b | 0, 4)
H.writeInt32BE(this._c | 0, 8)
H.writeInt32BE(this._d | 0, 12)
H.writeInt32BE(this._e | 0, 16)
return H
}
module.exports = Sha
/***/ }),
/***/ 336:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
* in FIPS PUB 180-1
* Version 2.1a Copyright Paul Johnston 2000 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for details.
*/
var inherits = __webpack_require__(717)
var Hash = __webpack_require__(189)
var Buffer = (__webpack_require__(509).Buffer)
var K = [
0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
]
var W = new Array(80)
function Sha1 () {
this.init()
this._w = W
Hash.call(this, 64, 56)
}
inherits(Sha1, Hash)
Sha1.prototype.init = function () {
this._a = 0x67452301
this._b = 0xefcdab89
this._c = 0x98badcfe
this._d = 0x10325476
this._e = 0xc3d2e1f0
return this
}
function rotl1 (num) {
return (num << 1) | (num >>> 31)
}
function rotl5 (num) {
return (num << 5) | (num >>> 27)
}
function rotl30 (num) {
return (num << 30) | (num >>> 2)
}
function ft (s, b, c, d) {
if (s === 0) return (b & c) | ((~b) & d)
if (s === 2) return (b & c) | (b & d) | (c & d)
return b ^ c ^ d
}
Sha1.prototype._update = function (M) {
var W = this._w
var a = this._a | 0
var b = this._b | 0
var c = this._c | 0
var d = this._d | 0
var e = this._e | 0
for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
for (var j = 0; j < 80; ++j) {
var s = ~~(j / 20)
var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
e = d
d = c
c = rotl30(b)
b = a
a = t
}
this._a = (a + this._a) | 0
this._b = (b + this._b) | 0
this._c = (c + this._c) | 0
this._d = (d + this._d) | 0
this._e = (e + this._e) | 0
}
Sha1.prototype._hash = function () {
var H = Buffer.allocUnsafe(20)
H.writeInt32BE(this._a | 0, 0)
H.writeInt32BE(this._b | 0, 4)
H.writeInt32BE(this._c | 0, 8)
H.writeInt32BE(this._d | 0, 12)
H.writeInt32BE(this._e | 0, 16)
return H
}
module.exports = Sha1
/***/ }),
/***/ 432:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/**
* A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
* in FIPS 180-2
* Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
*
*/
var inherits = __webpack_require__(717)
var Sha256 = __webpack_require__(499)
var Hash = __webpack_require__(189)
var Buffer = (__webpack_require__(509).Buffer)
var W = new Array(64)
function Sha224 () {
this.init()
this._w = W // new Array(64)
Hash.call(this, 64, 56)
}
inherits(Sha224, Sha256)
Sha224.prototype.init = function () {
this._a = 0xc1059ed8
this._b = 0x367cd507
this._c = 0x3070dd17
this._d = 0xf70e5939
this._e = 0xffc00b31
this._f = 0x68581511
this._g = 0x64f98fa7
this._h = 0xbefa4fa4
return this
}
Sha224.prototype._hash = function () {
var H = Buffer.allocUnsafe(28)
H.writeInt32BE(this._a, 0)
H.writeInt32BE(this._b, 4)
H.writeInt32BE(this._c, 8)
H.writeInt32BE(this._d, 12)
H.writeInt32BE(this._e, 16)
H.writeInt32BE(this._f, 20)
H.writeInt32BE(this._g, 24)
return H
}
module.exports = Sha224
/***/ }),
/***/ 499:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
/**
* A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
* in FIPS 180-2
* Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
*
*/
var inherits = __webpack_require__(717)
var Hash = __webpack_require__(189)
var Buffer = (__webpack_require__(509).Buffer)
var K = [
0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
]
var W = new Array(64)
function Sha256 () {
this.init()
this._w = W // new Array(64)
Hash.call(this, 64, 56)
}
inherits(Sha256, Hash)
Sha256.prototype.init = function () {
this._a = 0x6a09e667
this._b = 0xbb67ae85
this._c = 0x3c6ef372
this._d = 0xa54ff53a
this._e = 0x510e527f
this._f = 0x9b05688c
this._g = 0x1f83d9ab
this._h = 0x5be0cd19
return this
}
function ch (x, y, z) {
return z ^ (x & (y ^ z))
}
function maj (x, y, z) {
return (x & y) | (z & (x | y))
}
function sigma0 (x) {
return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
}
function sigma1 (x) {
return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
}
function gamma0 (x) {
return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
}
function gamma1 (x) {
return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
}
Sha256.prototype._update = function (M) {
var W = this._w
var a = this._a | 0
var b = this._b | 0
var c = this._c | 0
var d = this._d | 0
var e = this._e | 0
var f = this._f | 0
var g = this._g | 0
var h = this._h | 0
for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
for (var j = 0; j < 64; ++j) {
var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
var T2 = (sigma0(a) + maj(a, b, c)) | 0
h = g
g = f
f = e
e = (d + T1) | 0
d = c
c = b
b = a
a = (T1 + T2) | 0
}
this._a = (a + this._a) | 0
this._b = (b + this._b) | 0
this._c = (c + this._c) | 0
this._d = (d + this._d) | 0
this._e = (e + this._e) | 0
this._f = (f + this._f) | 0
this._g = (g + this._g) | 0
this._h = (h + this._h) | 0
}
Sha256.prototype._hash = function () {
var H = Buffer.allocUnsafe(32)
H.writeInt32BE(this._a, 0)
H.writeInt32BE(this._b, 4)
H.writeInt32BE(this._c, 8)
H.writeInt32BE(this._d, 12)
H.writeInt32BE(this._e, 16)
H.writeInt32BE(this._f, 20)
H.writeInt32BE(this._g, 24)
H.writeInt32BE(this._h, 28)
return H
}
module.exports = Sha256
/***/ }),
/***/ 686:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var inherits = __webpack_require__(717)
var SHA512 = __webpack_require__(816)
var Hash = __webpack_require__(189)
var Buffer = (__webpack_require__(509).Buffer)
var W = new Array(160)
function Sha384 () {
this.init()
this._w = W
Hash.call(this, 128, 112)
}
inherits(Sha384, SHA512)
Sha384.prototype.init = function () {
this._ah = 0xcbbb9d5d
this._bh = 0x629a292a
this._ch = 0x9159015a
this._dh = 0x152fecd8
this._eh = 0x67332667
this._fh = 0x8eb44a87
this._gh = 0xdb0c2e0d
this._hh = 0x47b5481d
this._al = 0xc1059ed8
this._bl = 0x367cd507
this._cl = 0x3070dd17
this._dl = 0xf70e5939
this._el = 0xffc00b31
this._fl = 0x68581511
this._gl = 0x64f98fa7
this._hl = 0xbefa4fa4
return this
}
Sha384.prototype._hash = function () {
var H = Buffer.allocUnsafe(48)
function writeInt64BE (h, l, offset) {
H.writeInt32BE(h, offset)
H.writeInt32BE(l, offset + 4)
}
writeInt64BE(this._ah, this._al, 0)
writeInt64BE(this._bh, this._bl, 8)
writeInt64BE(this._ch, this._cl, 16)
writeInt64BE(this._dh, this._dl, 24)
writeInt64BE(this._eh, this._el, 32)
writeInt64BE(this._fh, this._fl, 40)
return H
}
module.exports = Sha384
/***/ }),
/***/ 816:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var inherits = __webpack_require__(717)
var Hash = __webpack_require__(189)
var Buffer = (__webpack_require__(509).Buffer)
var K = [
0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
]
var W = new Array(160)
function Sha512 () {
this.init()
this._w = W
Hash.call(this, 128, 112)
}
inherits(Sha512, Hash)
Sha512.prototype.init = function () {
this._ah = 0x6a09e667
this._bh = 0xbb67ae85
this._ch = 0x3c6ef372
this._dh = 0xa54ff53a
this._eh = 0x510e527f
this._fh = 0x9b05688c
this._gh = 0x1f83d9ab
this._hh = 0x5be0cd19
this._al = 0xf3bcc908
this._bl = 0x84caa73b
this._cl = 0xfe94f82b
this._dl = 0x5f1d36f1
this._el = 0xade682d1
this._fl = 0x2b3e6c1f
this._gl = 0xfb41bd6b
this._hl = 0x137e2179
return this
}
function Ch (x, y, z) {
return z ^ (x & (y ^ z))
}
function maj (x, y, z) {
return (x & y) | (z & (x | y))
}
function sigma0 (x, xl) {
return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
}
function sigma1 (x, xl) {
return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
}
function Gamma0 (x, xl) {
return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
}
function Gamma0l (x, xl) {
return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
}
function Gamma1 (x, xl) {
return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
}
function Gamma1l (x, xl) {
return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
}
function getCarry (a, b) {
return (a >>> 0) < (b >>> 0) ? 1 : 0
}
Sha512.prototype._update = function (M) {
var W = this._w
var ah = this._ah | 0
var bh = this._bh | 0
var ch = this._ch | 0
var dh = this._dh | 0
var eh = this._eh | 0
var fh = this._fh | 0
var gh = this._gh | 0
var hh = this._hh | 0
var al = this._al | 0
var bl = this._bl | 0
var cl = this._cl | 0
var dl = this._dl | 0
var el = this._el | 0
var fl = this._fl | 0
var gl = this._gl | 0
var hl = this._hl | 0
for (var i = 0; i < 32; i += 2) {
W[i] = M.readInt32BE(i * 4)
W[i + 1] = M.readInt32BE(i * 4 + 4)
}
for (; i < 160; i += 2) {
var xh = W[i - 15 * 2]
var xl = W[i - 15 * 2 + 1]
var gamma0 = Gamma0(xh, xl)
var gamma0l = Gamma0l(xl, xh)
xh = W[i - 2 * 2]
xl = W[i - 2 * 2 + 1]
var gamma1 = Gamma1(xh, xl)
var gamma1l = Gamma1l(xl, xh)
// W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
var Wi7h = W[i - 7 * 2]
var Wi7l = W[i - 7 * 2 + 1]
var Wi16h = W[i - 16 * 2]
var Wi16l = W[i - 16 * 2 + 1]
var Wil = (gamma0l + Wi7l) | 0
var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
Wil = (Wil + gamma1l) | 0
Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
Wil = (Wil + Wi16l) | 0
Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
W[i] = Wih
W[i + 1] = Wil
}
for (var j = 0; j < 160; j += 2) {
Wih = W[j]
Wil = W[j + 1]
var majh = maj(ah, bh, ch)
var majl = maj(al, bl, cl)
var sigma0h = sigma0(ah, al)
var sigma0l = sigma0(al, ah)
var sigma1h = sigma1(eh, el)
var sigma1l = sigma1(el, eh)
// t1 = h + sigma1 + ch + K[j] + W[j]
var Kih = K[j]
var Kil = K[j + 1]
var chh = Ch(eh, fh, gh)
var chl = Ch(el, fl, gl)
var t1l = (hl + sigma1l) | 0
var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
t1l = (t1l + chl) | 0
t1h = (t1h + chh + getCarry(t1l, chl)) | 0
t1l = (t1l + Kil) | 0
t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
t1l = (t1l + Wil) | 0
t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
// t2 = sigma0 + maj
var t2l = (sigma0l + majl) | 0
var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
hh = gh
hl = gl
gh = fh
gl = fl
fh = eh
fl = el
el = (dl + t1l) | 0
eh = (dh + t1h + getCarry(el, dl)) | 0
dh = ch
dl = cl
ch = bh
cl = bl
bh = ah
bl = al
al = (t1l + t2l) | 0
ah = (t1h + t2h + getCarry(al, t1l)) | 0
}
this._al = (this._al + al) | 0
this._bl = (this._bl + bl) | 0
this._cl = (this._cl + cl) | 0
this._dl = (this._dl + dl) | 0
this._el = (this._el + el) | 0
this._fl = (this._fl + fl) | 0
this._gl = (this._gl + gl) | 0
this._hl = (this._hl + hl) | 0
this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
}
Sha512.prototype._hash = function () {
var H = Buffer.allocUnsafe(64)
function writeInt64BE (h, l, offset) {
H.writeInt32BE(h, offset)
H.writeInt32BE(l, offset + 4)
}
writeInt64BE(this._ah, this._al, 0)
writeInt64BE(this._bh, this._bl, 8)
writeInt64BE(this._ch, this._cl, 16)
writeInt64BE(this._dh, this._dl, 24)
writeInt64BE(this._eh, this._el, 32)
writeInt64BE(this._fh, this._fl, 40)
writeInt64BE(this._gh, this._gl, 48)
writeInt64BE(this._hh, this._hl, 56)
return H
}
module.exports = Sha512
/***/ }),
/***/ 780:
/***/ ((module) => {
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var y = x => () => x
module.exports = __WEBPACK_EXTERNAL_MODULE_base64_js_f145eb6e__;
/***/ }),
/***/ 294:
/***/ ((module) => {
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var y = x => () => x
module.exports = __WEBPACK_EXTERNAL_MODULE_ieee754__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Z: () => (/* binding */ src)
});
// NAMESPACE OBJECT: ./src/core/plugins/err/actions.js
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
__webpack_require__.d(actions_namespaceObject, {
CLEAR: () => (CLEAR),
CLEAR_BY: () => (CLEAR_BY),
NEW_AUTH_ERR: () => (NEW_AUTH_ERR),
NEW_SPEC_ERR: () => (NEW_SPEC_ERR),
NEW_SPEC_ERR_BATCH: () => (NEW_SPEC_ERR_BATCH),
NEW_THROWN_ERR: () => (NEW_THROWN_ERR),
NEW_THROWN_ERR_BATCH: () => (NEW_THROWN_ERR_BATCH),
clear: () => (clear),
clearBy: () => (clearBy),
newAuthErr: () => (newAuthErr),
newSpecErr: () => (newSpecErr),
newSpecErrBatch: () => (newSpecErrBatch),
newThrownErr: () => (newThrownErr),
newThrownErrBatch: () => (newThrownErrBatch)
});
// NAMESPACE OBJECT: ./src/core/plugins/auth/actions.js
var auth_actions_namespaceObject = {};
__webpack_require__.r(auth_actions_namespaceObject);
__webpack_require__.d(auth_actions_namespaceObject, {
AUTHORIZE: () => (AUTHORIZE),
AUTHORIZE_OAUTH2: () => (AUTHORIZE_OAUTH2),
CONFIGURE_AUTH: () => (CONFIGURE_AUTH),
LOGOUT: () => (LOGOUT),
PRE_AUTHORIZE_OAUTH2: () => (PRE_AUTHORIZE_OAUTH2),
RESTORE_AUTHORIZATION: () => (RESTORE_AUTHORIZATION),
SHOW_AUTH_POPUP: () => (SHOW_AUTH_POPUP),
VALIDATE: () => (VALIDATE),
authPopup: () => (authPopup),
authorize: () => (authorize),
authorizeAccessCodeWithBasicAuthentication: () => (authorizeAccessCodeWithBasicAuthentication),
authorizeAccessCodeWithFormParams: () => (authorizeAccessCodeWithFormParams),
authorizeApplication: () => (authorizeApplication),
authorizeOauth2: () => (authorizeOauth2),
authorizeOauth2WithPersistOption: () => (authorizeOauth2WithPersistOption),
authorizePassword: () => (authorizePassword),
authorizeRequest: () => (authorizeRequest),
authorizeWithPersistOption: () => (authorizeWithPersistOption),
configureAuth: () => (configureAuth),
logout: () => (logout),
logoutWithPersistOption: () => (logoutWithPersistOption),
persistAuthorizationIfNeeded: () => (persistAuthorizationIfNeeded),
preAuthorizeImplicit: () => (preAuthorizeImplicit),
restoreAuthorization: () => (restoreAuthorization),
showDefinitions: () => (showDefinitions)
});
// NAMESPACE OBJECT: ./src/core/plugins/auth/selectors.js
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
__webpack_require__.d(selectors_namespaceObject, {
authorized: () => (authorized),
definitionsForRequirements: () => (definitionsForRequirements),
definitionsToAuthorize: () => (definitionsToAuthorize),
getConfigs: () => (getConfigs),
getDefinitionsByNames: () => (getDefinitionsByNames),
isAuthorized: () => (isAuthorized),
shownDefinitions: () => (shownDefinitions)
});
// NAMESPACE OBJECT: ./src/core/plugins/configs/actions.js
var configs_actions_namespaceObject = {};
__webpack_require__.r(configs_actions_namespaceObject);
__webpack_require__.d(configs_actions_namespaceObject, {
TOGGLE_CONFIGS: () => (TOGGLE_CONFIGS),
UPDATE_CONFIGS: () => (UPDATE_CONFIGS),
loaded: () => (actions_loaded),
toggle: () => (toggle),
update: () => (update)
});
// NAMESPACE OBJECT: ./src/core/plugins/configs/spec-actions.js
var spec_actions_namespaceObject = {};
__webpack_require__.r(spec_actions_namespaceObject);
__webpack_require__.d(spec_actions_namespaceObject, {
downloadConfig: () => (downloadConfig),
getConfigByUrl: () => (getConfigByUrl)
});
// NAMESPACE OBJECT: ./src/core/plugins/configs/selectors.js
var configs_selectors_namespaceObject = {};
__webpack_require__.r(configs_selectors_namespaceObject);
__webpack_require__.d(configs_selectors_namespaceObject, {
get: () => (get)
});
// NAMESPACE OBJECT: ./src/core/plugins/err/error-transformers/transformers/not-of-type.js
var not_of_type_namespaceObject = {};
__webpack_require__.r(not_of_type_namespaceObject);
__webpack_require__.d(not_of_type_namespaceObject, {
transform: () => (transform)
});
// NAMESPACE OBJECT: ./src/core/plugins/err/error-transformers/transformers/parameter-oneof.js
var parameter_oneof_namespaceObject = {};
__webpack_require__.r(parameter_oneof_namespaceObject);
__webpack_require__.d(parameter_oneof_namespaceObject, {
transform: () => (parameter_oneof_transform)
});
// NAMESPACE OBJECT: ./src/core/plugins/err/selectors.js
var err_selectors_namespaceObject = {};
__webpack_require__.r(err_selectors_namespaceObject);
__webpack_require__.d(err_selectors_namespaceObject, {
allErrors: () => (allErrors),
lastError: () => (lastError)
});
// NAMESPACE OBJECT: ./src/core/plugins/layout/actions.js
var layout_actions_namespaceObject = {};
__webpack_require__.r(layout_actions_namespaceObject);
__webpack_require__.d(layout_actions_namespaceObject, {
SHOW: () => (SHOW),
UPDATE_FILTER: () => (UPDATE_FILTER),
UPDATE_LAYOUT: () => (UPDATE_LAYOUT),
UPDATE_MODE: () => (UPDATE_MODE),
changeMode: () => (changeMode),
show: () => (actions_show),
updateFilter: () => (updateFilter),
updateLayout: () => (updateLayout)
});
// NAMESPACE OBJECT: ./src/core/plugins/layout/selectors.js
var layout_selectors_namespaceObject = {};
__webpack_require__.r(layout_selectors_namespaceObject);
__webpack_require__.d(layout_selectors_namespaceObject, {
current: () => (current),
currentFilter: () => (currentFilter),
isShown: () => (isShown),
showSummary: () => (showSummary),
whatMode: () => (whatMode)
});
// NAMESPACE OBJECT: ./src/core/plugins/layout/spec-extensions/wrap-selector.js
var wrap_selector_namespaceObject = {};
__webpack_require__.r(wrap_selector_namespaceObject);
__webpack_require__.d(wrap_selector_namespaceObject, {
taggedOperations: () => (taggedOperations)
});
// NAMESPACE OBJECT: ./src/core/plugins/request-snippets/fn.js
var fn_namespaceObject = {};
__webpack_require__.r(fn_namespaceObject);
__webpack_require__.d(fn_namespaceObject, {
requestSnippetGenerator_curl_bash: () => (requestSnippetGenerator_curl_bash),
requestSnippetGenerator_curl_cmd: () => (requestSnippetGenerator_curl_cmd),
requestSnippetGenerator_curl_powershell: () => (requestSnippetGenerator_curl_powershell)
});
// NAMESPACE OBJECT: ./src/core/plugins/request-snippets/selectors.js
var request_snippets_selectors_namespaceObject = {};
__webpack_require__.r(request_snippets_selectors_namespaceObject);
__webpack_require__.d(request_snippets_selectors_namespaceObject, {
getActiveLanguage: () => (getActiveLanguage),
getDefaultExpanded: () => (getDefaultExpanded),
getGenerators: () => (getGenerators),
getSnippetGenerators: () => (getSnippetGenerators)
});
// NAMESPACE OBJECT: ./src/core/plugins/spec/selectors.js
var spec_selectors_namespaceObject = {};
__webpack_require__.r(spec_selectors_namespaceObject);
__webpack_require__.d(spec_selectors_namespaceObject, {
allowTryItOutFor: () => (allowTryItOutFor),
basePath: () => (basePath),
canExecuteScheme: () => (canExecuteScheme),
consumes: () => (consumes),
consumesOptionsFor: () => (consumesOptionsFor),
contentTypeValues: () => (contentTypeValues),
currentProducesFor: () => (currentProducesFor),
definitions: () => (definitions),
externalDocs: () => (externalDocs),
findDefinition: () => (findDefinition),
getOAS3RequiredRequestBodyContentType: () => (getOAS3RequiredRequestBodyContentType),
getParameter: () => (getParameter),
hasHost: () => (hasHost),
host: () => (host),
info: () => (info),
isMediaTypeSchemaPropertiesEqual: () => (isMediaTypeSchemaPropertiesEqual),
isOAS3: () => (isOAS3),
lastError: () => (selectors_lastError),
mutatedRequestFor: () => (mutatedRequestFor),
mutatedRequests: () => (mutatedRequests),
operationScheme: () => (operationScheme),
operationWithMeta: () => (operationWithMeta),
operations: () => (operations),
operationsWithRootInherited: () => (operationsWithRootInherited),
operationsWithTags: () => (operationsWithTags),
parameterInclusionSettingFor: () => (parameterInclusionSettingFor),
parameterValues: () => (parameterValues),
parameterWithMeta: () => (parameterWithMeta),
parameterWithMetaByIdentity: () => (parameterWithMetaByIdentity),
parametersIncludeIn: () => (parametersIncludeIn),
parametersIncludeType: () => (parametersIncludeType),
paths: () => (paths),
produces: () => (produces),
producesOptionsFor: () => (producesOptionsFor),
requestFor: () => (requestFor),
requests: () => (requests),
responseFor: () => (responseFor),
responses: () => (responses),
schemes: () => (schemes),
security: () => (security),
securityDefinitions: () => (securityDefinitions),
semver: () => (semver),
spec: () => (spec),
specJS: () => (specJS),
specJson: () => (specJson),
specJsonWithResolvedSubtrees: () => (specJsonWithResolvedSubtrees),
specResolved: () => (specResolved),
specResolvedSubtree: () => (specResolvedSubtree),
specSource: () => (specSource),
specStr: () => (specStr),
tagDetails: () => (tagDetails),
taggedOperations: () => (selectors_taggedOperations),
tags: () => (tags),
url: () => (url),
validOperationMethods: () => (validOperationMethods),
validateBeforeExecute: () => (validateBeforeExecute),
validationErrors: () => (validationErrors),
version: () => (version)
});
// NAMESPACE OBJECT: ./src/core/plugins/spec/actions.js
var plugins_spec_actions_namespaceObject = {};
__webpack_require__.r(plugins_spec_actions_namespaceObject);
__webpack_require__.d(plugins_spec_actions_namespaceObject, {
CLEAR_REQUEST: () => (CLEAR_REQUEST),
CLEAR_RESPONSE: () => (CLEAR_RESPONSE),
CLEAR_VALIDATE_PARAMS: () => (CLEAR_VALIDATE_PARAMS),
LOG_REQUEST: () => (LOG_REQUEST),
SET_MUTATED_REQUEST: () => (SET_MUTATED_REQUEST),
SET_REQUEST: () => (SET_REQUEST),
SET_RESPONSE: () => (SET_RESPONSE),
SET_SCHEME: () => (SET_SCHEME),
UPDATE_EMPTY_PARAM_INCLUSION: () => (UPDATE_EMPTY_PARAM_INCLUSION),
UPDATE_JSON: () => (UPDATE_JSON),
UPDATE_OPERATION_META_VALUE: () => (UPDATE_OPERATION_META_VALUE),
UPDATE_PARAM: () => (UPDATE_PARAM),
UPDATE_RESOLVED: () => (UPDATE_RESOLVED),
UPDATE_RESOLVED_SUBTREE: () => (UPDATE_RESOLVED_SUBTREE),
UPDATE_SPEC: () => (UPDATE_SPEC),
UPDATE_URL: () => (UPDATE_URL),
VALIDATE_PARAMS: () => (VALIDATE_PARAMS),
changeConsumesValue: () => (changeConsumesValue),
changeParam: () => (changeParam),
changeParamByIdentity: () => (changeParamByIdentity),
changeProducesValue: () => (changeProducesValue),
clearRequest: () => (clearRequest),
clearResponse: () => (clearResponse),
clearValidateParams: () => (clearValidateParams),
execute: () => (actions_execute),
executeRequest: () => (executeRequest),
invalidateResolvedSubtreeCache: () => (invalidateResolvedSubtreeCache),
logRequest: () => (logRequest),
parseToJson: () => (parseToJson),
requestResolvedSubtree: () => (requestResolvedSubtree),
resolveSpec: () => (resolveSpec),
setMutatedRequest: () => (setMutatedRequest),
setRequest: () => (setRequest),
setResponse: () => (setResponse),
setScheme: () => (setScheme),
updateEmptyParamInclusion: () => (updateEmptyParamInclusion),
updateJsonSpec: () => (updateJsonSpec),
updateResolved: () => (updateResolved),
updateResolvedSubtree: () => (updateResolvedSubtree),
updateSpec: () => (updateSpec),
updateUrl: () => (updateUrl),
validateParams: () => (validateParams)
});
// NAMESPACE OBJECT: ./src/core/plugins/spec/wrap-actions.js
var spec_wrap_actions_namespaceObject = {};
__webpack_require__.r(spec_wrap_actions_namespaceObject);
__webpack_require__.d(spec_wrap_actions_namespaceObject, {
executeRequest: () => (wrap_actions_executeRequest),
updateJsonSpec: () => (wrap_actions_updateJsonSpec),
updateSpec: () => (wrap_actions_updateSpec),
validateParams: () => (wrap_actions_validateParams)
});
// NAMESPACE OBJECT: ./src/core/components/layout-utils.jsx
var layout_utils_namespaceObject = {};
__webpack_require__.r(layout_utils_namespaceObject);
__webpack_require__.d(layout_utils_namespaceObject, {
Button: () => (Button),
Col: () => (Col),
Collapse: () => (Collapse),
Container: () => (Container),
Input: () => (Input),
Link: () => (Link),
Row: () => (Row),
Select: () => (Select),
TextArea: () => (TextArea)
});
// NAMESPACE OBJECT: ./src/core/components/json-schema-components.jsx
var json_schema_components_namespaceObject = {};
__webpack_require__.r(json_schema_components_namespaceObject);
__webpack_require__.d(json_schema_components_namespaceObject, {
JsonSchemaArrayItemFile: () => (JsonSchemaArrayItemFile),
JsonSchemaArrayItemText: () => (JsonSchemaArrayItemText),
JsonSchemaForm: () => (JsonSchemaForm),
JsonSchema_array: () => (JsonSchema_array),
JsonSchema_boolean: () => (JsonSchema_boolean),
JsonSchema_object: () => (JsonSchema_object),
JsonSchema_string: () => (JsonSchema_string)
});
// NAMESPACE OBJECT: ./src/core/plugins/oas3/spec-extensions/wrap-selectors.js
var wrap_selectors_namespaceObject = {};
__webpack_require__.r(wrap_selectors_namespaceObject);
__webpack_require__.d(wrap_selectors_namespaceObject, {
basePath: () => (wrap_selectors_basePath),
consumes: () => (wrap_selectors_consumes),
definitions: () => (wrap_selectors_definitions),
hasHost: () => (wrap_selectors_hasHost),
host: () => (wrap_selectors_host),
produces: () => (wrap_selectors_produces),
schemes: () => (wrap_selectors_schemes),
securityDefinitions: () => (wrap_selectors_securityDefinitions),
validOperationMethods: () => (wrap_selectors_validOperationMethods)
});
// NAMESPACE OBJECT: ./src/core/plugins/oas3/auth-extensions/wrap-selectors.js
var auth_extensions_wrap_selectors_namespaceObject = {};
__webpack_require__.r(auth_extensions_wrap_selectors_namespaceObject);
__webpack_require__.d(auth_extensions_wrap_selectors_namespaceObject, {
definitionsToAuthorize: () => (wrap_selectors_definitionsToAuthorize)
});
// NAMESPACE OBJECT: ./src/core/plugins/oas3/spec-extensions/selectors.js
var spec_extensions_selectors_namespaceObject = {};
__webpack_require__.r(spec_extensions_selectors_namespaceObject);
__webpack_require__.d(spec_extensions_selectors_namespaceObject, {
callbacksOperations: () => (callbacksOperations),
isOAS3: () => (selectors_isOAS3),
isOAS30: () => (selectors_isOAS30),
isSwagger2: () => (selectors_isSwagger2),
servers: () => (servers)
});
// NAMESPACE OBJECT: ./src/core/plugins/oas3/actions.js
var oas3_actions_namespaceObject = {};
__webpack_require__.r(oas3_actions_namespaceObject);
__webpack_require__.d(oas3_actions_namespaceObject, {
CLEAR_REQUEST_BODY_VALIDATE_ERROR: () => (CLEAR_REQUEST_BODY_VALIDATE_ERROR),
CLEAR_REQUEST_BODY_VALUE: () => (CLEAR_REQUEST_BODY_VALUE),
SET_REQUEST_BODY_VALIDATE_ERROR: () => (SET_REQUEST_BODY_VALIDATE_ERROR),
UPDATE_ACTIVE_EXAMPLES_MEMBER: () => (UPDATE_ACTIVE_EXAMPLES_MEMBER),
UPDATE_REQUEST_BODY_INCLUSION: () => (UPDATE_REQUEST_BODY_INCLUSION),
UPDATE_REQUEST_BODY_VALUE: () => (UPDATE_REQUEST_BODY_VALUE),
UPDATE_REQUEST_BODY_VALUE_RETAIN_FLAG: () => (UPDATE_REQUEST_BODY_VALUE_RETAIN_FLAG),
UPDATE_REQUEST_CONTENT_TYPE: () => (UPDATE_REQUEST_CONTENT_TYPE),
UPDATE_RESPONSE_CONTENT_TYPE: () => (UPDATE_RESPONSE_CONTENT_TYPE),
UPDATE_SELECTED_SERVER: () => (UPDATE_SELECTED_SERVER),
UPDATE_SERVER_VARIABLE_VALUE: () => (UPDATE_SERVER_VARIABLE_VALUE),
clearRequestBodyValidateError: () => (clearRequestBodyValidateError),
clearRequestBodyValue: () => (clearRequestBodyValue),
initRequestBodyValidateError: () => (initRequestBodyValidateError),
setActiveExamplesMember: () => (setActiveExamplesMember),
setRequestBodyInclusion: () => (setRequestBodyInclusion),
setRequestBodyValidateError: () => (setRequestBodyValidateError),
setRequestBodyValue: () => (setRequestBodyValue),
setRequestContentType: () => (setRequestContentType),
setResponseContentType: () => (setResponseContentType),
setRetainRequestBodyValueFlag: () => (setRetainRequestBodyValueFlag),
setSelectedServer: () => (setSelectedServer),
setServerVariableValue: () => (setServerVariableValue)
});
// NAMESPACE OBJECT: ./src/core/plugins/oas3/selectors.js
var oas3_selectors_namespaceObject = {};
__webpack_require__.r(oas3_selectors_namespaceObject);
__webpack_require__.d(oas3_selectors_namespaceObject, {
activeExamplesMember: () => (activeExamplesMember),
hasUserEditedBody: () => (hasUserEditedBody),
requestBodyErrors: () => (requestBodyErrors),
requestBodyInclusionSetting: () => (requestBodyInclusionSetting),
requestBodyValue: () => (requestBodyValue),
requestContentType: () => (requestContentType),
responseContentType: () => (responseContentType),
selectDefaultRequestBodyValue: () => (selectDefaultRequestBodyValue),
selectedServer: () => (selectedServer),
serverEffectiveValue: () => (serverEffectiveValue),
serverVariableValue: () => (serverVariableValue),
serverVariables: () => (serverVariables),
shouldRetainRequestBodyValue: () => (shouldRetainRequestBodyValue),
validOperationMethods: () => (selectors_validOperationMethods),
validateBeforeExecute: () => (selectors_validateBeforeExecute),
validateShallowRequired: () => (validateShallowRequired)
});
// EXTERNAL MODULE: ./node_modules/deep-extend/lib/deep-extend.js
var deep_extend = __webpack_require__(698);
var deep_extend_default = /*#__PURE__*/__webpack_require__.n(deep_extend);
;// CONCATENATED MODULE: external "react"
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var y = x => () => x
const external_react_namespaceObject = x({ ["Component"]: () => __WEBPACK_EXTERNAL_MODULE_react__.Component, ["PureComponent"]: () => __WEBPACK_EXTERNAL_MODULE_react__.PureComponent, ["createContext"]: () => __WEBPACK_EXTERNAL_MODULE_react__.createContext, ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react__["default"], ["forwardRef"]: () => __WEBPACK_EXTERNAL_MODULE_react__.forwardRef, ["useCallback"]: () => __WEBPACK_EXTERNAL_MODULE_react__.useCallback, ["useContext"]: () => __WEBPACK_EXTERNAL_MODULE_react__.useContext, ["useEffect"]: () => __WEBPACK_EXTERNAL_MODULE_react__.useEffect, ["useRef"]: () => __WEBPACK_EXTERNAL_MODULE_react__.useRef, ["useState"]: () => __WEBPACK_EXTERNAL_MODULE_react__.useState });
;// CONCATENATED MODULE: external "redux"
var external_redux_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_redux_y = x => () => x
const external_redux_namespaceObject = external_redux_x({ ["applyMiddleware"]: () => __WEBPACK_EXTERNAL_MODULE_redux__.applyMiddleware, ["bindActionCreators"]: () => __WEBPACK_EXTERNAL_MODULE_redux__.bindActionCreators, ["compose"]: () => __WEBPACK_EXTERNAL_MODULE_redux__.compose, ["createStore"]: () => __WEBPACK_EXTERNAL_MODULE_redux__.createStore });
;// CONCATENATED MODULE: external "immutable"
var external_immutable_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_immutable_y = x => () => x
const external_immutable_namespaceObject = external_immutable_x({ ["List"]: () => __WEBPACK_EXTERNAL_MODULE_immutable__.List, ["Map"]: () => __WEBPACK_EXTERNAL_MODULE_immutable__.Map, ["OrderedMap"]: () => __WEBPACK_EXTERNAL_MODULE_immutable__.OrderedMap, ["Seq"]: () => __WEBPACK_EXTERNAL_MODULE_immutable__.Seq, ["Set"]: () => __WEBPACK_EXTERNAL_MODULE_immutable__.Set, ["default"]: () => __WEBPACK_EXTERNAL_MODULE_immutable__["default"], ["fromJS"]: () => __WEBPACK_EXTERNAL_MODULE_immutable__.fromJS });
;// CONCATENATED MODULE: external "redux-immutable"
var external_redux_immutable_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_redux_immutable_y = x => () => x
const external_redux_immutable_namespaceObject = external_redux_immutable_x({ ["combineReducers"]: () => __WEBPACK_EXTERNAL_MODULE_redux_immutable_446c9f82__.combineReducers });
;// CONCATENATED MODULE: external "serialize-error"
var external_serialize_error_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_serialize_error_y = x => () => x
const external_serialize_error_namespaceObject = external_serialize_error_x({ ["serializeError"]: () => __WEBPACK_EXTERNAL_MODULE_serialize_error_5f2df3e5__.serializeError });
;// CONCATENATED MODULE: external "lodash/merge"
var merge_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var merge_y = x => () => x
const merge_namespaceObject = merge_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_merge_cf99375a__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/err/actions.js
const NEW_THROWN_ERR = "err_new_thrown_err";
const NEW_THROWN_ERR_BATCH = "err_new_thrown_err_batch";
const NEW_SPEC_ERR = "err_new_spec_err";
const NEW_SPEC_ERR_BATCH = "err_new_spec_err_batch";
const NEW_AUTH_ERR = "err_new_auth_err";
const CLEAR = "err_clear";
const CLEAR_BY = "err_clear_by";
function newThrownErr(err) {
return {
type: NEW_THROWN_ERR,
payload: (0,external_serialize_error_namespaceObject.serializeError)(err)
};
}
function newThrownErrBatch(errors) {
return {
type: NEW_THROWN_ERR_BATCH,
payload: errors
};
}
function newSpecErr(err) {
return {
type: NEW_SPEC_ERR,
payload: err
};
}
function newSpecErrBatch(errArray) {
return {
type: NEW_SPEC_ERR_BATCH,
payload: errArray
};
}
function newAuthErr(err) {
return {
type: NEW_AUTH_ERR,
payload: err
};
}
function clear() {let filter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
// filter looks like: {type: 'spec'}, {source: 'parser'}
return {
type: CLEAR,
payload: filter
};
}
function clearBy() {let filter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => true;
// filter is a function
return {
type: CLEAR_BY,
payload: filter
};
}
;// CONCATENATED MODULE: ./src/core/window.js
function makeWindow() {
var win = {
location: {},
history: {},
open: () => {},
close: () => {},
File: function () {},
FormData: function () {}
};
if (typeof window === "undefined") {
return win;
}
try {
win = window;
var props = ["File", "Blob", "FormData"];
for (var prop of props) {
if (prop in window) {
win[prop] = window[prop];
}
}
} catch (e) {
console.error(e);
}
return win;
}
/* harmony default export */ const core_window = (makeWindow());
;// CONCATENATED MODULE: external "@braintree/sanitize-url"
var sanitize_url_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var sanitize_url_y = x => () => x
const sanitize_url_namespaceObject = sanitize_url_x({ ["sanitizeUrl"]: () => __WEBPACK_EXTERNAL_MODULE__braintree_sanitize_url_2340607f__.sanitizeUrl });
;// CONCATENATED MODULE: external "lodash/camelCase"
var camelCase_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var camelCase_y = x => () => x
const camelCase_namespaceObject = camelCase_x({ });
;// CONCATENATED MODULE: external "lodash/upperFirst"
var upperFirst_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var upperFirst_y = x => () => x
const upperFirst_namespaceObject = upperFirst_x({ });
;// CONCATENATED MODULE: external "lodash/memoize"
var memoize_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var memoize_y = x => () => x
const memoize_namespaceObject = memoize_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_memoize_2b5bc477__["default"] });
;// CONCATENATED MODULE: external "lodash/find"
var find_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var find_y = x => () => x
const find_namespaceObject = find_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_find_e8ecc2cb__["default"] });
;// CONCATENATED MODULE: external "lodash/some"
var some_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var some_y = x => () => x
const some_namespaceObject = some_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_some_5cd47809__["default"] });
;// CONCATENATED MODULE: external "lodash/eq"
var eq_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var eq_y = x => () => x
const eq_namespaceObject = eq_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_eq_b41b823a__["default"] });
;// CONCATENATED MODULE: external "lodash/isFunction"
var isFunction_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var isFunction_y = x => () => x
const isFunction_namespaceObject = isFunction_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isFunction_f90b20d6__["default"] });
;// CONCATENATED MODULE: external "css.escape"
var external_css_escape_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_css_escape_y = x => () => x
const external_css_escape_namespaceObject = external_css_escape_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_css_escape_2d301448__["default"] });
// EXTERNAL MODULE: ./node_modules/randombytes/browser.js
var browser = __webpack_require__(798);
var browser_default = /*#__PURE__*/__webpack_require__.n(browser);
// EXTERNAL MODULE: ./node_modules/sha.js/index.js
var sha_js = __webpack_require__(72);
var sha_js_default = /*#__PURE__*/__webpack_require__.n(sha_js);
;// CONCATENATED MODULE: ./src/core/utils/get-parameter-schema.js
/**
* @prettier
*/
const swagger2SchemaKeys = external_immutable_namespaceObject["default"].Set.of(
"type",
"format",
"items",
"default",
"maximum",
"exclusiveMaximum",
"minimum",
"exclusiveMinimum",
"maxLength",
"minLength",
"pattern",
"maxItems",
"minItems",
"uniqueItems",
"enum",
"multipleOf"
);
/**
* @typedef {Object} ParameterSchemaDescriptor
* @property {Immutable.Map} schema - the parameter schema
* @property {string|null} parameterContentMediaType - the effective media type, for `content`-based OpenAPI 3.0 Parameters, or `null` otherwise
*/
/**
* Get the effective schema value for a parameter, or an empty Immutable.Map if
* no suitable schema can be found.
*
* Supports OpenAPI 3.0 `Parameter.content` priority -- since a Parameter Object
* cannot have both `schema` and `content`, this function ignores `schema` when
* `content` is present.
*
* @param {Immutable.Map} parameter The parameter to identify a schema for
* @param {object} config
* @param {boolean} config.isOAS3 Whether the parameter is from an OpenAPI 2.0
* or OpenAPI 3.0 definition
* @return {ParameterSchemaDescriptor} Information about the parameter schema
*/
function getParameterSchema(parameter) {let { isOAS3 } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// Return empty Map if `parameter` isn't a Map
if (!external_immutable_namespaceObject["default"].Map.isMap(parameter)) {
return {
schema: external_immutable_namespaceObject["default"].Map(),
parameterContentMediaType: null
};
}
if (!isOAS3) {
// Swagger 2.0
if (parameter.get("in") === "body") {
return {
schema: parameter.get("schema", external_immutable_namespaceObject["default"].Map()),
parameterContentMediaType: null
};
} else {
return {
schema: parameter.filter((v, k) => swagger2SchemaKeys.includes(k)),
parameterContentMediaType: null
};
}
}
// If we've reached here, the parameter is OpenAPI 3.0
if (parameter.get("content")) {
const parameterContentMediaTypes = parameter.
get("content", external_immutable_namespaceObject["default"].Map({})).
keySeq();
const parameterContentMediaType = parameterContentMediaTypes.first();
return {
schema: parameter.getIn(
["content", parameterContentMediaType, "schema"],
external_immutable_namespaceObject["default"].Map()
),
parameterContentMediaType
};
}
return {
schema: parameter.get("schema") ? parameter.get("schema", external_immutable_namespaceObject["default"].Map()) : external_immutable_namespaceObject["default"].Map(),
parameterContentMediaType: null
};
}
;// CONCATENATED MODULE: ./src/core/utils/index.js
/* provided dependency */ var Buffer = __webpack_require__(764)["Buffer"];
/*
ATTENTION! This file (but not the functions within) is deprecated.
You should probably add a new file to `./helpers/` instead of adding a new
function here.
One-function-per-file is a better pattern than what we have here.
If you're refactoring something in here, feel free to break it out to a file
in `./helpers` if you have the time.
*/
const DEFAULT_RESPONSE_KEY = "default";
const isImmutable = (maybe) => external_immutable_namespaceObject["default"].Iterable.isIterable(maybe);
function objectify(thing) {
if (!isObject(thing))
return {};
if (isImmutable(thing))
return thing.toJS();
return thing;
}
function arrayify(thing) {
if (!thing)
return [];
if (thing.toArray)
return thing.toArray();
return normalizeArray(thing);
}
function fromJSOrdered(js) {
if (isImmutable(js)) {
return js; // Can't do much here
}
if (js instanceof core_window.File) {
return js;
}
if (!isObject(js)) {
return js;
}
if (Array.isArray(js)) {
return external_immutable_namespaceObject["default"].Seq(js).map(fromJSOrdered).toList();
}
if ((0,isFunction_namespaceObject["default"])(js.entries)) {
// handle multipart/form-data
const objWithHashedKeys = createObjWithHashedKeys(js);
return external_immutable_namespaceObject["default"].OrderedMap(objWithHashedKeys).map(fromJSOrdered);
}
return external_immutable_namespaceObject["default"].OrderedMap(js).map(fromJSOrdered);
}
/**
* Convert a FormData object into plain object
* Append a hashIdx and counter to the key name, if multiple exists
* if single, key name =
* if multiple, key name =
* @example single entry for vegetable
* fdObj.entries.vegtables: "carrot"
* // returns newObj.vegetables : "carrot"
* @example multiple entries for fruits[]
* fdObj.entries.fruits[]: "apple"
* // returns newObj.fruits[]_**[]1 : "apple"
* fdObj.entries.fruits[]: "banana"
* // returns newObj.fruits[]_**[]2 : "banana"
* fdObj.entries.fruits[]: "grape"
* // returns newObj.fruits[]_**[]3 : "grape"
* @param {FormData} fdObj - a FormData object
* @return {Object} - a plain object
*/
function createObjWithHashedKeys(fdObj) {
if (!(0,isFunction_namespaceObject["default"])(fdObj.entries)) {
return fdObj; // not a FormData object with iterable
}
const newObj = {};
const hashIdx = "_**[]"; // our internal identifier
const trackKeys = {};
for (let pair of fdObj.entries()) {
if (!newObj[pair[0]] && !(trackKeys[pair[0]] && trackKeys[pair[0]].containsMultiple)) {
newObj[pair[0]] = pair[1]; // first key name: no hash required
} else {
if (!trackKeys[pair[0]]) {
// initiate tracking key for multiple
trackKeys[pair[0]] = {
containsMultiple: true,
length: 1
};
// "reassign" first pair to matching hashed format for multiple
let hashedKeyFirst = `${pair[0]}${hashIdx}${trackKeys[pair[0]].length}`;
newObj[hashedKeyFirst] = newObj[pair[0]];
// remove non-hashed key of multiple
delete newObj[pair[0]]; // first
}
trackKeys[pair[0]].length += 1;
let hashedKeyCurrent = `${pair[0]}${hashIdx}${trackKeys[pair[0]].length}`;
newObj[hashedKeyCurrent] = pair[1];
}
}
return newObj;
}
function bindToState(obj, state) {
var newObj = {};
Object.keys(obj).
filter((key) => typeof obj[key] === "function").
forEach((key) => newObj[key] = obj[key].bind(null, state));
return newObj;
}
function normalizeArray(arr) {
if (Array.isArray(arr))
return arr;
return [arr];
}
function isFn(fn) {
return typeof fn === "function";
}
function isObject(obj) {
return !!obj && typeof obj === "object";
}
function isFunc(thing) {
return typeof thing === "function";
}
function isArray(thing) {
return Array.isArray(thing);
}
// I've changed memoize libs more than once, so I'm using this a way to make that simpler
const memoize = memoize_namespaceObject["default"];
function objMap(obj, fn) {
return Object.keys(obj).reduce((newObj, key) => {
newObj[key] = fn(obj[key], key);
return newObj;
}, {});
}
function objReduce(obj, fn) {
return Object.keys(obj).reduce((newObj, key) => {
let res = fn(obj[key], key);
if (res && typeof res === "object")
Object.assign(newObj, res);
return newObj;
}, {});
}
// Redux middleware that exposes the system to async actions (like redux-thunk, but with out system instead of (dispatch, getState)
function systemThunkMiddleware(getSystem) {
return (_ref) => {let { dispatch, getState } = _ref; // eslint-disable-line no-unused-vars
return (next) => (action) => {
if (typeof action === "function") {
return action(getSystem());
}
return next(action);
};
};
}
function defaultStatusCode(responses) {
let codes = responses.keySeq();
return codes.contains(DEFAULT_RESPONSE_KEY) ? DEFAULT_RESPONSE_KEY : codes.filter((key) => (key + "")[0] === "2").sort().first();
}
/**
* Returns an Immutable List, safely
* @param {Immutable.Iterable} iterable the iterable to get the key from
* @param {String|[String]} key either an array of keys, or a single key
* @returns {Immutable.List} either iterable.get(keys) or an empty Immutable.List
*/
function getList(iterable, keys) {
if (!external_immutable_namespaceObject["default"].Iterable.isIterable(iterable)) {
return external_immutable_namespaceObject["default"].List();
}
let val = iterable.getIn(Array.isArray(keys) ? keys : [keys]);
return external_immutable_namespaceObject["default"].List.isList(val) ? val : external_immutable_namespaceObject["default"].List();
}
/**
* Take an immutable map, and convert to a list.
* Where the keys are merged with the value objects
* @param {Immutable.Map} map, the map to convert
* @param {String} key the key to use, when merging the `key`
* @returns {Immutable.List}
*/
function mapToList(map) {let keyNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "key";let collectedKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Im.Map();
if (!Im.Map.isMap(map) || !map.size) {
return Im.List();
}
if (!Array.isArray(keyNames)) {
keyNames = [keyNames];
}
if (keyNames.length < 1) {
return map.merge(collectedKeys);
}
// I need to avoid `flatMap` from merging in the Maps, as well as the lists
let list = Im.List();
let keyName = keyNames[0];
for (let entry of map.entries()) {
let [key, val] = entry;
let nextList = mapToList(val, keyNames.slice(1), collectedKeys.set(keyName, key));
if (Im.List.isList(nextList)) {
list = list.concat(nextList);
} else {
list = list.push(nextList);
}
}
return list;
}
function extractFileNameFromContentDispositionHeader(value) {
let patterns = [
/filename\*=[^']+'\w*'"([^"]+)";?/i,
/filename\*=[^']+'\w*'([^;]+);?/i,
/filename="([^;]*);?"/i,
/filename=([^;]*);?/i];
let responseFilename;
patterns.some((regex) => {
responseFilename = regex.exec(value);
return responseFilename !== null;
});
if (responseFilename !== null && responseFilename.length > 1) {
try {
return decodeURIComponent(responseFilename[1]);
} catch (e) {
console.error(e);
}
}
return null;
}
// PascalCase, aka UpperCamelCase
function pascalCase(str) {
return upperFirst(camelCase(str));
}
// Remove the ext of a filename, and pascalCase it
function pascalCaseFilename(filename) {
return pascalCase(filename.replace(/\.[^./]*$/, ""));
}
// Check if ...
// - new props
// - If immutable, use .is()
// - if in explicit objectList, then compare using _.eq
// - else use ===
const propChecker = function (props, nextProps) {let objectList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];let ignoreList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
if (Object.keys(props).length !== Object.keys(nextProps).length) {
return true;
}
return (
some(props, (a, name) => {
if (ignoreList.includes(name)) {
return false;
}
let b = nextProps[name];
if (Im.Iterable.isIterable(a)) {
return !Im.is(a, b);
}
// Not going to compare objects
if (typeof a === "object" && typeof b === "object") {
return false;
}
return a !== b;
}) ||
objectList.some((objectPropName) => !eq(props[objectPropName], nextProps[objectPropName])));
};
const validateMaximum = (val, max) => {
if (val > max) {
return `Value must be less than ${max}`;
}
};
const validateMinimum = (val, min) => {
if (val < min) {
return `Value must be greater than ${min}`;
}
};
const validateNumber = (val) => {
if (!/^-?\d+(\.?\d+)?$/.test(val)) {
return "Value must be a number";
}
};
const validateInteger = (val) => {
if (!/^-?\d+$/.test(val)) {
return "Value must be an integer";
}
};
const validateFile = (val) => {
if (val && !(val instanceof core_window.File)) {
return "Value must be a file";
}
};
const validateBoolean = (val) => {
if (!(val === "true" || val === "false" || val === true || val === false)) {
return "Value must be a boolean";
}
};
const validateString = (val) => {
if (val && typeof val !== "string") {
return "Value must be a string";
}
};
const validateDateTime = (val) => {
if (isNaN(Date.parse(val))) {
return "Value must be a DateTime";
}
};
const validateGuid = (val) => {
val = val.toString().toLowerCase();
if (!/^[{(]?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}[)}]?$/.test(val)) {
return "Value must be a Guid";
}
};
const validateMaxLength = (val, max) => {
if (val.length > max) {
return `Value must be no longer than ${max} character${max !== 1 ? "s" : ""}`;
}
};
const validateUniqueItems = (val, uniqueItems) => {
if (!val) {
return;
}
if (uniqueItems === "true" || uniqueItems === true) {
const list = (0,external_immutable_namespaceObject.fromJS)(val);
const set = list.toSet();
const hasDuplicates = val.length > set.size;
if (hasDuplicates) {
let errorsPerIndex = (0,external_immutable_namespaceObject.Set)();
list.forEach((item, i) => {
if (list.filter((v) => isFunc(v.equals) ? v.equals(item) : v === item).size > 1) {
errorsPerIndex = errorsPerIndex.add(i);
}
});
if (errorsPerIndex.size !== 0) {
return errorsPerIndex.map((i) => ({ index: i, error: "No duplicates allowed." })).toArray();
}
}
}
};
const validateMinItems = (val, min) => {
if (!val && min >= 1 || val && val.length < min) {
return `Array must contain at least ${min} item${min === 1 ? "" : "s"}`;
}
};
const validateMaxItems = (val, max) => {
if (val && val.length > max) {
return `Array must not contain more then ${max} item${max === 1 ? "" : "s"}`;
}
};
const validateMinLength = (val, min) => {
if (val.length < min) {
return `Value must be at least ${min} character${min !== 1 ? "s" : ""}`;
}
};
const validatePattern = (val, rxPattern) => {
var patt = new RegExp(rxPattern);
if (!patt.test(val)) {
return "Value must follow pattern " + rxPattern;
}
};
function validateValueBySchema(value, schema, requiredByParam, bypassRequiredCheck, parameterContentMediaType) {
if (!schema) return [];
let errors = [];
let nullable = schema.get("nullable");
let requiredBySchema = schema.get("required");
let maximum = schema.get("maximum");
let minimum = schema.get("minimum");
let type = schema.get("type");
let format = schema.get("format");
let maxLength = schema.get("maxLength");
let minLength = schema.get("minLength");
let uniqueItems = schema.get("uniqueItems");
let maxItems = schema.get("maxItems");
let minItems = schema.get("minItems");
let pattern = schema.get("pattern");
const schemaRequiresValue = requiredByParam || requiredBySchema === true;
const hasValue = value !== undefined && value !== null;
const isValidEmpty = !schemaRequiresValue && !hasValue;
const needsExplicitConstraintValidation = hasValue && type === "array";
const requiresFurtherValidation =
schemaRequiresValue ||
needsExplicitConstraintValidation ||
!isValidEmpty;
const isValidNullable = nullable && value === null;
// will not be included in the request or [schema / value] does not [allow / require] further analysis.
const noFurtherValidationNeeded =
isValidNullable ||
!type ||
!requiresFurtherValidation;
if (noFurtherValidationNeeded) {
return [];
}
// Further this point the parameter is considered worth to validate
let stringCheck = type === "string" && value;
let arrayCheck = type === "array" && Array.isArray(value) && value.length;
let arrayListCheck = type === "array" && external_immutable_namespaceObject["default"].List.isList(value) && value.count();
let arrayStringCheck = type === "array" && typeof value === "string" && value;
let fileCheck = type === "file" && value instanceof core_window.File;
let booleanCheck = type === "boolean" && (value || value === false);
let numberCheck = type === "number" && (value || value === 0);
let integerCheck = type === "integer" && (value || value === 0);
let objectCheck = type === "object" && typeof value === "object" && value !== null;
let objectStringCheck = type === "object" && typeof value === "string" && value;
const allChecks = [
stringCheck, arrayCheck, arrayListCheck, arrayStringCheck, fileCheck,
booleanCheck, numberCheck, integerCheck, objectCheck, objectStringCheck];
const passedAnyCheck = allChecks.some((v) => !!v);
if (schemaRequiresValue && !passedAnyCheck && !bypassRequiredCheck) {
errors.push("Required field is not provided");
return errors;
}
if (
type === "object" && (
parameterContentMediaType === null ||
parameterContentMediaType === "application/json"))
{
let objectVal = value;
if (typeof value === "string") {
try {
objectVal = JSON.parse(value);
} catch (e) {
errors.push("Parameter string value must be valid JSON");
return errors;
}
}
if (schema && schema.has("required") && isFunc(requiredBySchema.isList) && requiredBySchema.isList()) {
requiredBySchema.forEach((key) => {
if (objectVal[key] === undefined) {
errors.push({ propKey: key, error: "Required property not found" });
}
});
}
if (schema && schema.has("properties")) {
schema.get("properties").forEach((val, key) => {
const errs = validateValueBySchema(objectVal[key], val, false, bypassRequiredCheck, parameterContentMediaType);
errors.push(...errs.
map((error) => ({ propKey: key, error })));
});
}
}
if (pattern) {
let err = validatePattern(value, pattern);
if (err) errors.push(err);
}
if (minItems) {
if (type === "array") {
let err = validateMinItems(value, minItems);
if (err) errors.push(err);
}
}
if (maxItems) {
if (type === "array") {
let err = validateMaxItems(value, maxItems);
if (err) errors.push({ needRemove: true, error: err });
}
}
if (uniqueItems) {
if (type === "array") {
let errorPerItem = validateUniqueItems(value, uniqueItems);
if (errorPerItem) errors.push(...errorPerItem);
}
}
if (maxLength || maxLength === 0) {
let err = validateMaxLength(value, maxLength);
if (err) errors.push(err);
}
if (minLength) {
let err = validateMinLength(value, minLength);
if (err) errors.push(err);
}
if (maximum || maximum === 0) {
let err = validateMaximum(value, maximum);
if (err) errors.push(err);
}
if (minimum || minimum === 0) {
let err = validateMinimum(value, minimum);
if (err) errors.push(err);
}
if (type === "string") {
let err;
if (format === "date-time") {
err = validateDateTime(value);
} else if (format === "uuid") {
err = validateGuid(value);
} else {
err = validateString(value);
}
if (!err) return errors;
errors.push(err);
} else if (type === "boolean") {
let err = validateBoolean(value);
if (!err) return errors;
errors.push(err);
} else if (type === "number") {
let err = validateNumber(value);
if (!err) return errors;
errors.push(err);
} else if (type === "integer") {
let err = validateInteger(value);
if (!err) return errors;
errors.push(err);
} else if (type === "array") {
if (!(arrayCheck || arrayListCheck)) {
return errors;
}
if (value) {
value.forEach((item, i) => {
const errs = validateValueBySchema(item, schema.get("items"), false, bypassRequiredCheck, parameterContentMediaType);
errors.push(...errs.
map((err) => ({ index: i, error: err })));
});
}
} else if (type === "file") {
let err = validateFile(value);
if (!err) return errors;
errors.push(err);
}
return errors;
}
// validation of parameters before execute
const validateParam = function (param, value) {let { isOAS3 = false, bypassRequiredCheck = false } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let paramRequired = param.get("required");
let {
schema: paramDetails,
parameterContentMediaType
} = getParameterSchema(param, { isOAS3 });
return validateValueBySchema(value, paramDetails, paramRequired, bypassRequiredCheck, parameterContentMediaType);
};
const parseSearch = () => {
let map = {};
let search = core_window.location.search;
if (!search)
return {};
if (search != "") {
let params = search.substr(1).split("&");
for (let i in params) {
if (!Object.prototype.hasOwnProperty.call(params, i)) {
continue;
}
i = params[i].split("=");
map[decodeURIComponent(i[0])] = i[1] && decodeURIComponent(i[1]) || "";
}
}
return map;
};
const serializeSearch = (searchMap) => {
return Object.keys(searchMap).map((k) => {
return encodeURIComponent(k) + "=" + encodeURIComponent(searchMap[k]);
}).join("&");
};
const btoa = (str) => {
let buffer;
if (str instanceof Buffer) {
buffer = str;
} else {
buffer = Buffer.from(str.toString(), "utf-8");
}
return buffer.toString("base64");
};
const sorters = {
operationsSorter: {
alpha: (a, b) => a.get("path").localeCompare(b.get("path")),
method: (a, b) => a.get("method").localeCompare(b.get("method"))
},
tagsSorter: {
alpha: (a, b) => a.localeCompare(b)
}
};
const buildFormData = (data) => {
let formArr = [];
for (let name in data) {
let val = data[name];
if (val !== undefined && val !== "") {
formArr.push([name, "=", encodeURIComponent(val).replace(/%20/g, "+")].join(""));
}
}
return formArr.join("&");
};
// Is this really required as a helper? Perhaps. TODO: expose the system of presets.apis in docs, so we know what is supported
const shallowEqualKeys = (a, b, keys) => {
return !!(0,find_namespaceObject["default"])(keys, (key) => {
return (0,eq_namespaceObject["default"])(a[key], b[key]);
});
};
function sanitizeUrl(url) {
if (typeof url !== "string" || url === "") {
return "";
}
return (0,sanitize_url_namespaceObject.sanitizeUrl)(url);
}
function requiresValidationURL(uri) {
if (!uri || uri.indexOf("localhost") >= 0 || uri.indexOf("127.0.0.1") >= 0 || uri === "none") {
return false;
}
return true;
}
function getAcceptControllingResponse(responses) {
if (!external_immutable_namespaceObject["default"].OrderedMap.isOrderedMap(responses)) {
// wrong type!
return null;
}
if (!responses.size) {
// responses is empty
return null;
}
const suitable2xxResponse = responses.find((res, k) => {
return k.startsWith("2") && Object.keys(res.get("content") || {}).length > 0;
});
// try to find a suitable `default` responses
const defaultResponse = responses.get("default") || external_immutable_namespaceObject["default"].OrderedMap();
const defaultResponseMediaTypes = (defaultResponse.get("content") || external_immutable_namespaceObject["default"].OrderedMap()).keySeq().toJS();
const suitableDefaultResponse = defaultResponseMediaTypes.length ? defaultResponse : null;
return suitable2xxResponse || suitableDefaultResponse;
}
// suitable for use in URL fragments
const createDeepLinkPath = (str) => typeof str == "string" || str instanceof String ? str.trim().replace(/\s/g, "%20") : "";
// suitable for use in CSS classes and ids
const escapeDeepLinkPath = (str) => (0,external_css_escape_namespaceObject["default"])(createDeepLinkPath(str).replace(/%20/g, "_"));
const getExtensions = (defObj) => defObj.filter((v, k) => /^x-/.test(k));
const getCommonExtensions = (defObj) => defObj.filter((v, k) => /^pattern|maxLength|minLength|maximum|minimum/.test(k));
// Deeply strips a specific key from an object.
//
// `predicate` can be used to discriminate the stripping further,
// by preserving the key's place in the object based on its value.
function deeplyStripKey(input, keyToStrip) {let predicate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => true;
if (typeof input !== "object" || Array.isArray(input) || input === null || !keyToStrip) {
return input;
}
const obj = Object.assign({}, input);
Object.keys(obj).forEach((k) => {
if (k === keyToStrip && predicate(obj[k], k)) {
delete obj[k];
return;
}
obj[k] = deeplyStripKey(obj[k], keyToStrip, predicate);
});
return obj;
}
function stringify(thing) {
if (typeof thing === "string") {
return thing;
}
if (thing && thing.toJS) {
thing = thing.toJS();
}
if (typeof thing === "object" && thing !== null) {
try {
return JSON.stringify(thing, null, 2);
}
catch (e) {
return String(thing);
}
}
if (thing === null || thing === undefined) {
return "";
}
return thing.toString();
}
function numberToString(thing) {
if (typeof thing === "number") {
return thing.toString();
}
return thing;
}
function paramToIdentifier(param) {let { returnAll = false, allowHashes = true } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!external_immutable_namespaceObject["default"].Map.isMap(param)) {
throw new Error("paramToIdentifier: received a non-Im.Map parameter as input");
}
const paramName = param.get("name");
const paramIn = param.get("in");
let generatedIdentifiers = [];
// Generate identifiers in order of most to least specificity
if (param && param.hashCode && paramIn && paramName && allowHashes) {
generatedIdentifiers.push(`${paramIn}.${paramName}.hash-${param.hashCode()}`);
}
if (paramIn && paramName) {
generatedIdentifiers.push(`${paramIn}.${paramName}`);
}
generatedIdentifiers.push(paramName);
// Return the most preferred identifier, or all if requested
return returnAll ? generatedIdentifiers : generatedIdentifiers[0] || "";
}
function paramToValue(param, paramValues) {
const allIdentifiers = paramToIdentifier(param, { returnAll: true });
// Map identifiers to values in the provided value hash, filter undefined values,
// and return the first value found
const values = allIdentifiers.
map((id) => {
return paramValues[id];
}).
filter((value) => value !== undefined);
return values[0];
}
// adapted from https://auth0.com/docs/flows/guides/auth-code-pkce/includes/create-code-verifier
function generateCodeVerifier() {
return b64toB64UrlEncoded(
browser_default()(32).toString("base64")
);
}
function createCodeChallenge(codeVerifier) {
return b64toB64UrlEncoded(
sha_js_default()("sha256").
update(codeVerifier).
digest("base64")
);
}
function b64toB64UrlEncoded(str) {
return str.
replace(/\+/g, "-").
replace(/\//g, "_").
replace(/=/g, "");
}
const isEmptyValue = (value) => {
if (!value) {
return true;
}
if (isImmutable(value) && value.isEmpty()) {
return true;
}
return false;
};
;// CONCATENATED MODULE: ./src/core/system.js
const idFn = (a) => a;
// Apply middleware that gets sandwitched between `dispatch` and the reducer function(s)
function createStoreWithMiddleware(rootReducer, initialState, getSystem) {
let middlwares = [
// createLogger( {
// stateTransformer: state => state && state.toJS()
// } ),
systemThunkMiddleware(getSystem)];
const composeEnhancers = core_window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || external_redux_namespaceObject.compose;
return (0,external_redux_namespaceObject.createStore)(rootReducer, initialState, composeEnhancers(
(0,external_redux_namespaceObject.applyMiddleware)(...middlwares)
));
}
class Store {
constructor() {let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
deep_extend_default()(this, {
state: {},
plugins: [],
pluginsOptions: {},
system: {
configs: {},
fn: {},
components: {},
rootInjects: {},
statePlugins: {}
},
boundSystem: {},
toolbox: {}
}, opts);
this.getSystem = this._getSystem.bind(this);
// Bare system (nothing in it, besides the state)
this.store = configureStore(idFn, (0,external_immutable_namespaceObject.fromJS)(this.state), this.getSystem);
// will be the system + Im, we can add more tools when we need to
this.buildSystem(false);
// Bootstrap plugins
this.register(this.plugins);
}
getStore() {
return this.store;
}
register(plugins) {let rebuild = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var pluginSystem = combinePlugins(plugins, this.getSystem(), this.pluginsOptions);
systemExtend(this.system, pluginSystem);
if (rebuild) {
this.buildSystem();
}
const needAnotherRebuild = callAfterLoad.call(this.system, plugins, this.getSystem());
if (needAnotherRebuild) {
this.buildSystem();
}
}
buildSystem() {let buildReducer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
let dispatch = this.getStore().dispatch;
let getState = this.getStore().getState;
this.boundSystem = Object.assign({},
this.getRootInjects(),
this.getWrappedAndBoundActions(dispatch),
this.getWrappedAndBoundSelectors(getState, this.getSystem),
this.getStateThunks(getState),
this.getFn(),
this.getConfigs()
);
if (buildReducer)
this.rebuildReducer();
}
_getSystem() {
return this.boundSystem;
}
getRootInjects() {
return Object.assign({
getSystem: this.getSystem,
getStore: this.getStore.bind(this),
getComponents: this.getComponents.bind(this),
getState: this.getStore().getState,
getConfigs: this._getConfigs.bind(this),
Im: external_immutable_namespaceObject["default"],
React: external_react_namespaceObject["default"]
}, this.system.rootInjects || {});
}
_getConfigs() {
return this.system.configs;
}
getConfigs() {
return {
configs: this.system.configs
};
}
setConfigs(configs) {
this.system.configs = configs;
}
rebuildReducer() {
this.store.replaceReducer(buildReducer(this.system.statePlugins));
}
/**
* Generic getter from system.statePlugins
*
*/
getType(name) {
let upName = name[0].toUpperCase() + name.slice(1);
return objReduce(this.system.statePlugins, (val, namespace) => {
let thing = val[name];
if (thing)
return { [namespace + upName]: thing };
});
}
getSelectors() {
return this.getType("selectors");
}
getActions() {
let actionHolders = this.getType("actions");
return objMap(actionHolders, (actions) => {
return objReduce(actions, (action, actionName) => {
if (isFn(action))
return { [actionName]: action };
});
});
}
getWrappedAndBoundActions(dispatch) {var _this = this;
let actionGroups = this.getBoundActions(dispatch);
return objMap(actionGroups, (actions, actionGroupName) => {
let wrappers = this.system.statePlugins[actionGroupName.slice(0, -7)].wrapActions;
if (wrappers) {
return objMap(actions, (action, actionName) => {
let wrap = wrappers[actionName];
if (!wrap) {
return action;
}
if (!Array.isArray(wrap)) {
wrap = [wrap];
}
return wrap.reduce((acc, fn) => {
let newAction = function () {
return fn(acc, _this.getSystem())(...arguments);
};
if (!isFn(newAction)) {
throw new TypeError("wrapActions needs to return a function that returns a new function (ie the wrapped action)");
}
return wrapWithTryCatch(newAction);
}, action || Function.prototype);
});
}
return actions;
});
}
getWrappedAndBoundSelectors(getState, getSystem) {var _this2 = this;
let selectorGroups = this.getBoundSelectors(getState, getSystem);
return objMap(selectorGroups, (selectors, selectorGroupName) => {
let stateName = [selectorGroupName.slice(0, -9)]; // selectors = 9 chars
let wrappers = this.system.statePlugins[stateName].wrapSelectors;
if (wrappers) {
return objMap(selectors, (selector, selectorName) => {
let wrap = wrappers[selectorName];
if (!wrap) {
return selector;
}
if (!Array.isArray(wrap)) {
wrap = [wrap];
}
return wrap.reduce((acc, fn) => {
let wrappedSelector = function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}
return fn(acc, _this2.getSystem())(getState().getIn(stateName), ...args);
};
if (!isFn(wrappedSelector)) {
throw new TypeError("wrapSelector needs to return a function that returns a new function (ie the wrapped action)");
}
return wrappedSelector;
}, selector || Function.prototype);
});
}
return selectors;
});
}
getStates(state) {
return Object.keys(this.system.statePlugins).reduce((obj, key) => {
obj[key] = state.get(key);
return obj;
}, {});
}
getStateThunks(getState) {
return Object.keys(this.system.statePlugins).reduce((obj, key) => {
obj[key] = () => getState().get(key);
return obj;
}, {});
}
getFn() {
return {
fn: this.system.fn
};
}
getComponents(component) {
const res = this.system.components[component];
if (Array.isArray(res)) {
return res.reduce((ori, wrapper) => {
return wrapper(ori, this.getSystem());
});
}
if (typeof component !== "undefined") {
return this.system.components[component];
}
return this.system.components;
}
getBoundSelectors(getState, getSystem) {
return objMap(this.getSelectors(), (obj, key) => {
let stateName = [key.slice(0, -9)]; // selectors = 9 chars
const getNestedState = () => getState().getIn(stateName);
return objMap(obj, (fn) => {
return function () {for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {args[_key2] = arguments[_key2];}
let res = wrapWithTryCatch(fn).apply(null, [getNestedState(), ...args]);
// If a selector returns a function, give it the system - for advanced usage
if (typeof res === "function")
res = wrapWithTryCatch(res)(getSystem());
return res;
};
});
});
}
getBoundActions(dispatch) {
dispatch = dispatch || this.getStore().dispatch;
const actions = this.getActions();
const process = (creator) => {
if (typeof creator !== "function") {
return objMap(creator, (prop) => process(prop));
}
return function () {
var action = null;
try {
action = creator(...arguments);
}
catch (e) {
action = { type: NEW_THROWN_ERR, error: true, payload: (0,external_serialize_error_namespaceObject.serializeError)(e) };
} finally
{
return action; // eslint-disable-line no-unsafe-finally
}
};
};
return objMap(actions, (actionCreator) => (0,external_redux_namespaceObject.bindActionCreators)(process(actionCreator), dispatch));
}
getMapStateToProps() {
return () => {
return Object.assign({}, this.getSystem());
};
}
getMapDispatchToProps(extras) {
return (dispatch) => {
return deep_extend_default()({}, this.getWrappedAndBoundActions(dispatch), this.getFn(), extras);
};
}
}
function combinePlugins(plugins, toolbox, pluginOptions) {
if (isObject(plugins) && !isArray(plugins)) {
return (0,merge_namespaceObject["default"])({}, plugins);
}
if (isFunc(plugins)) {
return combinePlugins(plugins(toolbox), toolbox, pluginOptions);
}
if (isArray(plugins)) {
const dest = pluginOptions.pluginLoadType === "chain" ? toolbox.getComponents() : {};
return plugins.
map((plugin) => combinePlugins(plugin, toolbox, pluginOptions)).
reduce(systemExtend, dest);
}
return {};
}
function callAfterLoad(plugins, system) {let { hasLoaded } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let calledSomething = hasLoaded;
if (isObject(plugins) && !isArray(plugins)) {
if (typeof plugins.afterLoad === "function") {
calledSomething = true;
wrapWithTryCatch(plugins.afterLoad).call(this, system);
}
}
if (isFunc(plugins))
return callAfterLoad.call(this, plugins(system), system, { hasLoaded: calledSomething });
if (isArray(plugins)) {
return plugins.map((plugin) => callAfterLoad.call(this, plugin, system, { hasLoaded: calledSomething }));
}
return calledSomething;
}
// Wraps deepExtend, to account for certain fields, being wrappers.
// Ie: we need to convert some fields into arrays, and append to them.
// Rather than overwrite
function systemExtend() {let dest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};let src = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!isObject(dest)) {
return {};
}
if (!isObject(src)) {
return dest;
}
// Wrap components
// Parses existing components in the system, and prepares them for wrapping via getComponents
if (src.wrapComponents) {
objMap(src.wrapComponents, (wrapperFn, key) => {
const ori = dest.components && dest.components[key];
if (ori && Array.isArray(ori)) {
dest.components[key] = ori.concat([wrapperFn]);
delete src.wrapComponents[key];
} else if (ori) {
dest.components[key] = [ori, wrapperFn];
delete src.wrapComponents[key];
}
});
if (!Object.keys(src.wrapComponents).length) {
// only delete wrapComponents if we've matched all of our wrappers to components
// this handles cases where the component to wrap may be out of our scope,
// but a higher recursive `combinePlugins` call will be able to handle it.
delete src.wrapComponents;
}
}
// Account for wrapActions, make it an array and append to it
// Modifies `src`
// 80% of this code is just safe traversal. We need to address that ( ie: use a lib )
const { statePlugins } = dest;
if (isObject(statePlugins)) {
for (let namespace in statePlugins) {
const namespaceObj = statePlugins[namespace];
if (!isObject(namespaceObj)) {
continue;
}
const { wrapActions, wrapSelectors } = namespaceObj;
// process action wrapping
if (isObject(wrapActions)) {
for (let actionName in wrapActions) {
let action = wrapActions[actionName];
// This should only happen if dest is the first plugin, since invocations after that will ensure its an array
if (!Array.isArray(action)) {
action = [action];
wrapActions[actionName] = action; // Put the value inside an array
}
if (src && src.statePlugins && src.statePlugins[namespace] && src.statePlugins[namespace].wrapActions && src.statePlugins[namespace].wrapActions[actionName]) {
src.statePlugins[namespace].wrapActions[actionName] = wrapActions[actionName].concat(src.statePlugins[namespace].wrapActions[actionName]);
}
}
}
// process selector wrapping
if (isObject(wrapSelectors)) {
for (let selectorName in wrapSelectors) {
let selector = wrapSelectors[selectorName];
// This should only happen if dest is the first plugin, since invocations after that will ensure its an array
if (!Array.isArray(selector)) {
selector = [selector];
wrapSelectors[selectorName] = selector; // Put the value inside an array
}
if (src && src.statePlugins && src.statePlugins[namespace] && src.statePlugins[namespace].wrapSelectors && src.statePlugins[namespace].wrapSelectors[selectorName]) {
src.statePlugins[namespace].wrapSelectors[selectorName] = wrapSelectors[selectorName].concat(src.statePlugins[namespace].wrapSelectors[selectorName]);
}
}
}
}
}
return deep_extend_default()(dest, src);
}
function buildReducer(states) {
let reducerObj = objMap(states, (val) => {
return val.reducers;
});
return allReducers(reducerObj);
}
function allReducers(reducerSystem) {
let reducers = Object.keys(reducerSystem).reduce((obj, key) => {
obj[key] = makeReducer(reducerSystem[key]);
return obj;
}, {});
if (!Object.keys(reducers).length) {
return idFn;
}
return (0,external_redux_immutable_namespaceObject.combineReducers)(reducers);
}
function makeReducer(reducerObj) {
return function () {let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new external_immutable_namespaceObject.Map();let action = arguments.length > 1 ? arguments[1] : undefined;
if (!reducerObj)
return state;
let redFn = reducerObj[action.type];
if (redFn) {
const res = wrapWithTryCatch(redFn)(state, action);
// If the try/catch wrapper kicks in, we'll get null back...
// in that case, we want to avoid making any changes to state
return res === null ? state : res;
}
return state;
};
}
function wrapWithTryCatch(fn)
{let { logErrors = true } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (typeof fn !== "function") {
return fn;
}
return function () {
try {for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {args[_key3] = arguments[_key3];}
return fn.call(this, ...args);
} catch (e) {
if (logErrors) {
console.error(e);
}
return null;
}
};
}
function configureStore(rootReducer, initialState, getSystem) {
const store = createStoreWithMiddleware(rootReducer, initialState, getSystem);
// if (module.hot) {
// // Enable Webpack hot module replacement for reducers
// module.hot.accept("reducers/index", () => {
// const nextRootReducer = require("reducers/index")
// store.replaceReducer(nextRootReducer)
// })
// }
return store;
}
;// CONCATENATED MODULE: external "url-parse"
var external_url_parse_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_url_parse_y = x => () => x
const external_url_parse_namespaceObject = external_url_parse_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_url_parse_6456105f__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/auth/actions.js
const SHOW_AUTH_POPUP = "show_popup";
const AUTHORIZE = "authorize";
const LOGOUT = "logout";
const PRE_AUTHORIZE_OAUTH2 = "pre_authorize_oauth2";
const AUTHORIZE_OAUTH2 = "authorize_oauth2";
const VALIDATE = "validate";
const CONFIGURE_AUTH = "configure_auth";
const RESTORE_AUTHORIZATION = "restore_authorization";
const scopeSeparator = " ";
function showDefinitions(payload) {
return {
type: SHOW_AUTH_POPUP,
payload: payload
};
}
function authorize(payload) {
return {
type: AUTHORIZE,
payload: payload
};
}
const authorizeWithPersistOption = (payload) => (_ref) => {let { authActions } = _ref;
authActions.authorize(payload);
authActions.persistAuthorizationIfNeeded();
};
function logout(payload) {
return {
type: LOGOUT,
payload: payload
};
}
const logoutWithPersistOption = (payload) => (_ref2) => {let { authActions } = _ref2;
authActions.logout(payload);
authActions.persistAuthorizationIfNeeded();
};
const preAuthorizeImplicit = (payload) => (_ref3) => {let { authActions, errActions } = _ref3;
let { auth, token, isValid } = payload;
let { schema, name } = auth;
let flow = schema.get("flow");
// remove oauth2 property from window after redirect from authentication
delete core_window.swaggerUIRedirectOauth2;
if (flow !== "accessCode" && !isValid) {
errActions.newAuthErr({
authId: name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
});
}
if (token.error) {
errActions.newAuthErr({
authId: name,
source: "auth",
level: "error",
message: JSON.stringify(token)
});
return;
}
authActions.authorizeOauth2WithPersistOption({ auth, token });
};
function authorizeOauth2(payload) {
return {
type: AUTHORIZE_OAUTH2,
payload: payload
};
}
const authorizeOauth2WithPersistOption = (payload) => (_ref4) => {let { authActions } = _ref4;
authActions.authorizeOauth2(payload);
authActions.persistAuthorizationIfNeeded();
};
const authorizePassword = (auth) => (_ref5) => {let { authActions } = _ref5;
let { schema, name, username, password, passwordType, clientId, clientSecret } = auth;
let form = {
grant_type: "password",
scope: auth.scopes.join(scopeSeparator),
username,
password
};
let query = {};
let headers = {};
switch (passwordType) {
case "request-body":
setClientIdAndSecret(form, clientId, clientSecret);
break;
case "basic":
headers.Authorization = "Basic " + btoa(clientId + ":" + clientSecret);
break;
default:
console.warn(`Warning: invalid passwordType ${passwordType} was passed, not including client id and secret`);
}
return authActions.authorizeRequest({ body: buildFormData(form), url: schema.get("tokenUrl"), name, headers, query, auth });
};
function setClientIdAndSecret(target, clientId, clientSecret) {
if (clientId) {
Object.assign(target, { client_id: clientId });
}
if (clientSecret) {
Object.assign(target, { client_secret: clientSecret });
}
}
const authorizeApplication = (auth) => (_ref6) => {let { authActions } = _ref6;
let { schema, scopes, name, clientId, clientSecret } = auth;
let headers = {
Authorization: "Basic " + btoa(clientId + ":" + clientSecret)
};
let form = {
grant_type: "client_credentials",
scope: scopes.join(scopeSeparator)
};
return authActions.authorizeRequest({ body: buildFormData(form), name, url: schema.get("tokenUrl"), auth, headers });
};
const authorizeAccessCodeWithFormParams = (_ref7) => {let { auth, redirectUrl } = _ref7;return (_ref8) => {let { authActions } = _ref8;
let { schema, name, clientId, clientSecret, codeVerifier } = auth;
let form = {
grant_type: "authorization_code",
code: auth.code,
client_id: clientId,
client_secret: clientSecret,
redirect_uri: redirectUrl,
code_verifier: codeVerifier
};
return authActions.authorizeRequest({ body: buildFormData(form), name, url: schema.get("tokenUrl"), auth });
};};
const authorizeAccessCodeWithBasicAuthentication = (_ref9) => {let { auth, redirectUrl } = _ref9;return (_ref10) => {let { authActions } = _ref10;
let { schema, name, clientId, clientSecret, codeVerifier } = auth;
let headers = {
Authorization: "Basic " + btoa(clientId + ":" + clientSecret)
};
let form = {
grant_type: "authorization_code",
code: auth.code,
client_id: clientId,
redirect_uri: redirectUrl,
code_verifier: codeVerifier
};
return authActions.authorizeRequest({ body: buildFormData(form), name, url: schema.get("tokenUrl"), auth, headers });
};};
const authorizeRequest = (data) => (_ref11) => {let { fn, getConfigs, authActions, errActions, oas3Selectors, specSelectors, authSelectors } = _ref11;
let { body, query = {}, headers = {}, name, url, auth } = data;
let { additionalQueryStringParams } = authSelectors.getConfigs() || {};
let parsedUrl;
if (specSelectors.isOAS3()) {
let finalServerUrl = oas3Selectors.serverEffectiveValue(oas3Selectors.selectedServer());
parsedUrl = (0,external_url_parse_namespaceObject["default"])(url, finalServerUrl, true);
} else {
parsedUrl = (0,external_url_parse_namespaceObject["default"])(url, specSelectors.url(), true);
}
if (typeof additionalQueryStringParams === "object") {
parsedUrl.query = Object.assign({}, parsedUrl.query, additionalQueryStringParams);
}
const fetchUrl = parsedUrl.toString();
let _headers = Object.assign({
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/x-www-form-urlencoded",
"X-Requested-With": "XMLHttpRequest"
}, headers);
fn.fetch({
url: fetchUrl,
method: "post",
headers: _headers,
query: query,
body: body,
requestInterceptor: getConfigs().requestInterceptor,
responseInterceptor: getConfigs().responseInterceptor
}).
then(function (response) {
let token = JSON.parse(response.data);
let error = token && (token.error || "");
let parseError = token && (token.parseError || "");
if (!response.ok) {
errActions.newAuthErr({
authId: name,
level: "error",
source: "auth",
message: response.statusText
});
return;
}
if (error || parseError) {
errActions.newAuthErr({
authId: name,
level: "error",
source: "auth",
message: JSON.stringify(token)
});
return;
}
authActions.authorizeOauth2WithPersistOption({ auth, token });
}).
catch((e) => {
let err = new Error(e);
let message = err.message;
// swagger-js wraps the response (if available) into the e.response property;
// investigate to check whether there are more details on why the authorization
// request failed (according to RFC 6479).
// See also https://github.com/swagger-api/swagger-ui/issues/4048
if (e.response && e.response.data) {
const errData = e.response.data;
try {
const jsonResponse = typeof errData === "string" ? JSON.parse(errData) : errData;
if (jsonResponse.error)
message += `, error: ${jsonResponse.error}`;
if (jsonResponse.error_description)
message += `, description: ${jsonResponse.error_description}`;
} catch (jsonError) {
// Ignore
}}
errActions.newAuthErr({
authId: name,
level: "error",
source: "auth",
message: message
});
});
};
function configureAuth(payload) {
return {
type: CONFIGURE_AUTH,
payload: payload
};
}
function restoreAuthorization(payload) {
return {
type: RESTORE_AUTHORIZATION,
payload: payload
};
}
const persistAuthorizationIfNeeded = () => (_ref12) => {let { authSelectors, getConfigs } = _ref12;
const configs = getConfigs();
if (!configs.persistAuthorization) return;
// persist authorization to local storage
const authorized = authSelectors.authorized().toJS();
localStorage.setItem("authorized", JSON.stringify(authorized));
};
const authPopup = (url, swaggerUIRedirectOauth2) => () => {
core_window.swaggerUIRedirectOauth2 = swaggerUIRedirectOauth2;
core_window.open(url);
};
;// CONCATENATED MODULE: ./src/core/plugins/auth/reducers.js
/* harmony default export */ const reducers = ({
[SHOW_AUTH_POPUP]: (state, _ref) => {let { payload } = _ref;
return state.set("showDefinitions", payload);
},
[AUTHORIZE]: (state, _ref2) => {let { payload } = _ref2;
let securities = (0,external_immutable_namespaceObject.fromJS)(payload);
let map = state.get("authorized") || (0,external_immutable_namespaceObject.Map)();
// refactor withMutations
securities.entrySeq().forEach((_ref3) => {let [key, security] = _ref3;
if (!isFunc(security.getIn)) {
return state.set("authorized", map);
}
let type = security.getIn(["schema", "type"]);
if (type === "apiKey" || type === "http") {
map = map.set(key, security);
} else if (type === "basic") {
let username = security.getIn(["value", "username"]);
let password = security.getIn(["value", "password"]);
map = map.setIn([key, "value"], {
username: username,
header: "Basic " + btoa(username + ":" + password)
});
map = map.setIn([key, "schema"], security.get("schema"));
}
});
return state.set("authorized", map);
},
[AUTHORIZE_OAUTH2]: (state, _ref4) => {let { payload } = _ref4;
let { auth, token } = payload;
let parsedAuth;
auth.token = Object.assign({}, token);
parsedAuth = (0,external_immutable_namespaceObject.fromJS)(auth);
let map = state.get("authorized") || (0,external_immutable_namespaceObject.Map)();
map = map.set(parsedAuth.get("name"), parsedAuth);
return state.set("authorized", map);
},
[LOGOUT]: (state, _ref5) => {let { payload } = _ref5;
let result = state.get("authorized").withMutations((authorized) => {
payload.forEach((auth) => {
authorized.delete(auth);
});
});
return state.set("authorized", result);
},
[CONFIGURE_AUTH]: (state, _ref6) => {let { payload } = _ref6;
return state.set("configs", payload);
},
[RESTORE_AUTHORIZATION]: (state, _ref7) => {let { payload } = _ref7;
return state.set("authorized", (0,external_immutable_namespaceObject.fromJS)(payload.authorized));
}
});
;// CONCATENATED MODULE: external "reselect"
var external_reselect_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_reselect_y = x => () => x
const external_reselect_namespaceObject = external_reselect_x({ ["createSelector"]: () => __WEBPACK_EXTERNAL_MODULE_reselect__.createSelector });
;// CONCATENATED MODULE: ./src/core/plugins/auth/selectors.js
const state = (state) => state;
const shownDefinitions = (0,external_reselect_namespaceObject.createSelector)(
state,
(auth) => auth.get("showDefinitions")
);
const definitionsToAuthorize = (0,external_reselect_namespaceObject.createSelector)(
state,
() => (_ref) => {let { specSelectors } = _ref;
let definitions = specSelectors.securityDefinitions() || (0,external_immutable_namespaceObject.Map)({});
let list = (0,external_immutable_namespaceObject.List)();
//todo refactor
definitions.entrySeq().forEach((_ref2) => {let [key, val] = _ref2;
let map = (0,external_immutable_namespaceObject.Map)();
map = map.set(key, val);
list = list.push(map);
});
return list;
}
);
const getDefinitionsByNames = (state, securities) => (_ref3) => {let { specSelectors } = _ref3;
console.warn("WARNING: getDefinitionsByNames is deprecated and will be removed in the next major version.");
let securityDefinitions = specSelectors.securityDefinitions();
let result = (0,external_immutable_namespaceObject.List)();
securities.valueSeq().forEach((names) => {
let map = (0,external_immutable_namespaceObject.Map)();
names.entrySeq().forEach((_ref4) => {let [name, scopes] = _ref4;
let definition = securityDefinitions.get(name);
let allowedScopes;
if (definition.get("type") === "oauth2" && scopes.size) {
allowedScopes = definition.get("scopes");
allowedScopes.keySeq().forEach((key) => {
if (!scopes.contains(key)) {
allowedScopes = allowedScopes.delete(key);
}
});
definition = definition.set("allowedScopes", allowedScopes);
}
map = map.set(name, definition);
});
result = result.push(map);
});
return result;
};
const definitionsForRequirements = function (state) {let securities = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0,external_immutable_namespaceObject.List)();return (_ref5) => {let { authSelectors } = _ref5;
const allDefinitions = authSelectors.definitionsToAuthorize() || (0,external_immutable_namespaceObject.List)();
let result = (0,external_immutable_namespaceObject.List)();
allDefinitions.forEach((definition) => {
let security = securities.find((sec) => sec.get(definition.keySeq().first()));
if (security) {
definition.forEach((props, name) => {
if (props.get("type") === "oauth2") {
const securityScopes = security.get(name);
let definitionScopes = props.get("scopes");
if (external_immutable_namespaceObject.List.isList(securityScopes) && external_immutable_namespaceObject.Map.isMap(definitionScopes)) {
definitionScopes.keySeq().forEach((key) => {
if (!securityScopes.contains(key)) {
definitionScopes = definitionScopes.delete(key);
}
});
definition = definition.set(name, props.set("scopes", definitionScopes));
}
}
});
result = result.push(definition);
}
});
return result;
};};
const authorized = (0,external_reselect_namespaceObject.createSelector)(
state,
(auth) => auth.get("authorized") || (0,external_immutable_namespaceObject.Map)()
);
const isAuthorized = (state, securities) => (_ref6) => {let { authSelectors } = _ref6;
let authorized = authSelectors.authorized();
if (!external_immutable_namespaceObject.List.isList(securities)) {
return null;
}
return !!securities.toJS().filter((security) => {
let isAuthorized = true;
return Object.keys(security).map((key) => {
return !isAuthorized || !!authorized.get(key);
}).indexOf(false) === -1;
}).length;
};
const getConfigs = (0,external_reselect_namespaceObject.createSelector)(
state,
(auth) => auth.get("configs")
);
;// CONCATENATED MODULE: external "@babel/runtime-corejs3/helpers/objectSpread2"
var objectSpread2_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var objectSpread2_y = x => () => x
const objectSpread2_namespaceObject = objectSpread2_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_objectSpread2_89fd8f56__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/auth/spec-extensions/wrap-actions.js
// Add security to the final `execute` call ( via `extras` )
const execute = (oriAction, _ref) => {let { authSelectors, specSelectors } = _ref;return (_ref2) => {let { path, method, operation, extras } = _ref2;
let securities = {
authorized: authSelectors.authorized() && authSelectors.authorized().toJS(),
definitions: specSelectors.securityDefinitions() && specSelectors.securityDefinitions().toJS(),
specSecurity: specSelectors.security() && specSelectors.security().toJS()
};
return oriAction((0,objectSpread2_namespaceObject["default"])({ path, method, operation, securities }, extras));
};};
;// CONCATENATED MODULE: ./src/core/plugins/auth/configs-extensions/wrap-actions.js
/**
* @prettier
*/
const loaded = (oriAction, system) => (payload) => {
const { getConfigs, authActions } = system;
const configs = getConfigs();
oriAction(payload);
// check if we should restore authorization data from localStorage
if (configs.persistAuthorization) {
const authorized = localStorage.getItem("authorized");
if (authorized) {
authActions.restoreAuthorization({
authorized: JSON.parse(authorized)
});
}
}
};
;// CONCATENATED MODULE: ./src/core/plugins/auth/wrap-actions.js
/**
* @prettier
*/
/**
* `authorize` and `logout` wrapped actions provide capacity
* to persist cookie based apiKey in document.cookie.
*
* `persistAuthorization` SwaggerUI options needs to set to `true`
* for document.cookie persistence to work.
*/
const wrap_actions_authorize = (oriAction, system) => (payload) => {
oriAction(payload);
const configs = system.getConfigs();
if (!configs.persistAuthorization) return;
// create cookie
try {
const [{ schema, value }] = Object.values(payload);
const isApiKeyAuth = schema.get("type") === "apiKey";
const isInCookie = schema.get("in") === "cookie";
const isApiKeyInCookie = isApiKeyAuth && isInCookie;
if (isApiKeyInCookie) {
document.cookie = `${schema.get("name")}=${value}; SameSite=None; Secure`;
}
} catch (error) {
console.error(
"Error persisting cookie based apiKey in document.cookie.",
error
);
}
};
const wrap_actions_logout = (oriAction, system) => (payload) => {
const configs = system.getConfigs();
const authorized = system.authSelectors.authorized();
// deleting cookie
try {
if (configs.persistAuthorization && Array.isArray(payload)) {
payload.forEach((authorizedName) => {
const auth = authorized.get(authorizedName, {});
const isApiKeyAuth = auth.getIn(["schema", "type"]) === "apiKey";
const isInCookie = auth.getIn(["schema", "in"]) === "cookie";
const isApiKeyInCookie = isApiKeyAuth && isInCookie;
if (isApiKeyInCookie) {
const cookieName = auth.getIn(["schema", "name"]);
document.cookie = `${cookieName}=; Max-Age=-99999999`;
}
});
}
} catch (error) {
console.error(
"Error deleting cookie based apiKey from document.cookie.",
error
);
}
oriAction(payload);
};
;// CONCATENATED MODULE: external "prop-types"
var external_prop_types_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_prop_types_y = x => () => x
const external_prop_types_namespaceObject = external_prop_types_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_prop_types_adfe8e31__["default"] });
;// CONCATENATED MODULE: external "lodash/omit"
var omit_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var omit_y = x => () => x
const omit_namespaceObject = omit_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_omit_d930e0f3__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/auth/components/lock-auth-icon.jsx
/**
* @prettier
*/
class LockAuthIcon extends external_react_namespaceObject["default"].Component {
mapStateToProps(state, props) {
const ownProps = (0,omit_namespaceObject["default"])(props, Object.keys(props.getSystem()));
return { state, ownProps };
}
render() {
const { getComponent, ownProps } = this.props;
const LockIcon = getComponent("LockIcon");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(LockIcon, ownProps);
}
}
/* harmony default export */ const lock_auth_icon = (LockAuthIcon);
;// CONCATENATED MODULE: ./src/core/plugins/auth/components/unlock-auth-icon.jsx
/**
* @prettier
*/
class UnlockAuthIcon extends external_react_namespaceObject["default"].Component {
mapStateToProps(state, props) {
const ownProps = (0,omit_namespaceObject["default"])(props, Object.keys(props.getSystem()));
return { state, ownProps };
}
render() {
const { getComponent, ownProps } = this.props;
const UnlockIcon = getComponent("UnlockIcon");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(UnlockIcon, ownProps);
}
}
/* harmony default export */ const unlock_auth_icon = (UnlockAuthIcon);
;// CONCATENATED MODULE: ./src/core/plugins/auth/index.js
/* harmony default export */ function auth() {
return {
afterLoad(system) {
this.rootInjects = this.rootInjects || {};
this.rootInjects.initOAuth = system.authActions.configureAuth;
this.rootInjects.preauthorizeApiKey = preauthorizeApiKey.bind(null, system);
this.rootInjects.preauthorizeBasic = preauthorizeBasic.bind(null, system);
},
components: {
LockAuthIcon: lock_auth_icon,
UnlockAuthIcon: unlock_auth_icon,
LockAuthOperationIcon: lock_auth_icon,
UnlockAuthOperationIcon: unlock_auth_icon
},
statePlugins: {
auth: {
reducers: reducers,
actions: auth_actions_namespaceObject,
selectors: selectors_namespaceObject,
wrapActions: {
authorize: wrap_actions_authorize,
logout: wrap_actions_logout
}
},
configs: {
wrapActions: {
loaded: loaded
}
},
spec: {
wrapActions: {
execute: execute
}
}
}
};
}
function preauthorizeBasic(system, key, username, password) {
const {
authActions: { authorize },
specSelectors: { specJson, isOAS3 }
} = system;
const definitionBase = isOAS3() ? ["components", "securitySchemes"] : ["securityDefinitions"];
const schema = specJson().getIn([...definitionBase, key]);
if (!schema) {
return null;
}
return authorize({
[key]: {
value: {
username,
password
},
schema: schema.toJS()
}
});
}
function preauthorizeApiKey(system, key, value) {
const {
authActions: { authorize },
specSelectors: { specJson, isOAS3 }
} = system;
const definitionBase = isOAS3() ? ["components", "securitySchemes"] : ["securityDefinitions"];
const schema = specJson().getIn([...definitionBase, key]);
if (!schema) {
return null;
}
return authorize({
[key]: {
value,
schema: schema.toJS()
}
});
}
;// CONCATENATED MODULE: ./swagger-config.yaml
const swagger_config_namespaceObject = "---\nurl: \"https://petstore.swagger.io/v2/swagger.json\"\ndom_id: \"#swagger-ui\"\nvalidatorUrl: \"https://validator.swagger.io/validator\"\n";
;// CONCATENATED MODULE: external "js-yaml"
var external_js_yaml_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_js_yaml_y = x => () => x
const external_js_yaml_namespaceObject = external_js_yaml_x({ ["JSON_SCHEMA"]: () => __WEBPACK_EXTERNAL_MODULE_js_yaml_78384032__.JSON_SCHEMA, ["default"]: () => __WEBPACK_EXTERNAL_MODULE_js_yaml_78384032__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/configs/helpers.js
const parseYamlConfig = (yaml, system) => {
try {
return external_js_yaml_namespaceObject["default"].load(yaml);
} catch (e) {
if (system) {
system.errActions.newThrownErr(new Error(e));
}
return {};
}
};
;// CONCATENATED MODULE: ./src/core/plugins/configs/actions.js
const UPDATE_CONFIGS = "configs_update";
const TOGGLE_CONFIGS = "configs_toggle";
// Update the configs, with a merge ( not deep )
function update(configName, configValue) {
return {
type: UPDATE_CONFIGS,
payload: {
[configName]: configValue
}
};
}
// Toggle's the config, by name
function toggle(configName) {
return {
type: TOGGLE_CONFIGS,
payload: configName
};
}
// Hook
const actions_loaded = () => () => {
// noop
};
;// CONCATENATED MODULE: ./src/core/plugins/configs/spec-actions.js
const downloadConfig = (req) => (system) => {
const { fn: { fetch } } = system;
return fetch(req);
};
const getConfigByUrl = (req, cb) => (_ref) => {let { specActions } = _ref;
if (req) {
return specActions.downloadConfig(req).then(next, next);
}
function next(res) {
if (res instanceof Error || res.status >= 400) {
specActions.updateLoadingStatus("failedConfig");
specActions.updateLoadingStatus("failedConfig");
specActions.updateUrl("");
console.error(res.statusText + " " + req.url);
cb(null);
} else {
cb(parseYamlConfig(res.text));
}
}
};
;// CONCATENATED MODULE: ./src/core/plugins/configs/selectors.js
// Just get the config value ( it can possibly be an immutable object)
const get = (state, path) => {
return state.getIn(Array.isArray(path) ? path : [path]);
};
;// CONCATENATED MODULE: ./src/core/plugins/configs/reducers.js
/* harmony default export */ const configs_reducers = ({
[UPDATE_CONFIGS]: (state, action) => {
return state.merge((0,external_immutable_namespaceObject.fromJS)(action.payload));
},
[TOGGLE_CONFIGS]: (state, action) => {
const configName = action.payload;
const oriVal = state.get(configName);
return state.set(configName, !oriVal);
}
});
;// CONCATENATED MODULE: ./src/core/plugins/configs/index.js
const specSelectors = {
getLocalConfig: () => {
return parseYamlConfig(swagger_config_namespaceObject);
}
};
function configsPlugin() {
return {
statePlugins: {
spec: {
actions: spec_actions_namespaceObject,
selectors: specSelectors
},
configs: {
reducers: configs_reducers,
actions: configs_actions_namespaceObject,
selectors: configs_selectors_namespaceObject
}
}
};
}
;// CONCATENATED MODULE: ./src/core/plugins/deep-linking/helpers.js
const setHash = (value) => {
if (value) {
return history.pushState(null, null, `#${value}`);
} else {
return window.location.hash = "";
}
};
;// CONCATENATED MODULE: external "zenscroll"
var external_zenscroll_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_zenscroll_y = x => () => x
const external_zenscroll_namespaceObject = external_zenscroll_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_zenscroll__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/deep-linking/layout.js
const SCROLL_TO = "layout_scroll_to";
const CLEAR_SCROLL_TO = "layout_clear_scroll";
const show = (ori, _ref) => {let { getConfigs, layoutSelectors } = _ref;return function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}
ori(...args);
if (!getConfigs().deepLinking) {
return;
}
try {
let [tokenArray, shown] = args;
//Coerce in to array
tokenArray = Array.isArray(tokenArray) ? tokenArray : [tokenArray];
// Convert into something we can put in the URL hash
// Or return empty, if we cannot
const urlHashArray = layoutSelectors.urlHashArrayFromIsShownKey(tokenArray); // Will convert
// No hash friendly list?
if (!urlHashArray.length)
return;
const [type, assetName] = urlHashArray;
if (!shown) {
return setHash("/");
}
if (urlHashArray.length === 2) {
setHash(createDeepLinkPath(`/${encodeURIComponent(type)}/${encodeURIComponent(assetName)}`));
} else if (urlHashArray.length === 1) {
setHash(createDeepLinkPath(`/${encodeURIComponent(type)}`));
}
} catch (e) {
// This functionality is not mission critical, so if something goes wrong
// we'll just move on
console.error(e); // eslint-disable-line no-console
}
};};
const scrollTo = (path) => {
return {
type: SCROLL_TO,
payload: Array.isArray(path) ? path : [path]
};
};
const parseDeepLinkHash = (rawHash) => (_ref2) => {let { layoutActions, layoutSelectors, getConfigs } = _ref2;
if (!getConfigs().deepLinking) {
return;
}
if (rawHash) {
let hash = rawHash.slice(1); // # is first character
if (hash[0] === "!") {
// Parse UI 2.x shebangs
hash = hash.slice(1);
}
if (hash[0] === "/") {
// "/pet/addPet" => "pet/addPet"
// makes the split result cleaner
// also handles forgotten leading slash
hash = hash.slice(1);
}
const hashArray = hash.split("/").map((val) => val || "");
const isShownKey = layoutSelectors.isShownKeyFromUrlHashArray(hashArray);
const [type, tagId = "", maybeOperationId = ""] = isShownKey;
if (type === "operations") {
// we're going to show an operation, so we need to expand the tag as well
const tagIsShownKey = layoutSelectors.isShownKeyFromUrlHashArray([tagId]);
// If an `_` is present, trigger the legacy escaping behavior to be safe
// TODO: remove this in v4.0, it is deprecated
if (tagId.indexOf("_") > -1) {
console.warn("Warning: escaping deep link whitespace with `_` will be unsupported in v4.0, use `%20` instead.");
layoutActions.show(tagIsShownKey.map((val) => val.replace(/_/g, " ")), true);
}
layoutActions.show(tagIsShownKey, true);
}
// If an `_` is present, trigger the legacy escaping behavior to be safe
// TODO: remove this in v4.0, it is deprecated
if (tagId.indexOf("_") > -1 || maybeOperationId.indexOf("_") > -1) {
console.warn("Warning: escaping deep link whitespace with `_` will be unsupported in v4.0, use `%20` instead.");
layoutActions.show(isShownKey.map((val) => val.replace(/_/g, " ")), true);
}
layoutActions.show(isShownKey, true);
// Scroll to the newly expanded entity
layoutActions.scrollTo(isShownKey);
}
};
const readyToScroll = (isShownKey, ref) => (system) => {
const scrollToKey = system.layoutSelectors.getScrollToKey();
if (external_immutable_namespaceObject["default"].is(scrollToKey, (0,external_immutable_namespaceObject.fromJS)(isShownKey))) {
system.layoutActions.scrollToElement(ref);
system.layoutActions.clearScrollTo();
}
};
// Scroll to "ref" (dom node) with the scrollbar on "container" or the nearest parent
const scrollToElement = (ref, container) => (system) => {
try {
container = container || system.fn.getScrollParent(ref);
let myScroller = external_zenscroll_namespaceObject["default"].createScroller(container);
myScroller.to(ref);
} catch (e) {
console.error(e); // eslint-disable-line no-console
}
};
const clearScrollTo = () => {
return {
type: CLEAR_SCROLL_TO
};
};
// From: https://stackoverflow.com/a/42543908/3933724
// Modified to return html instead of body element as last resort
function getScrollParent(element, includeHidden) {
const LAST_RESORT = document.documentElement;
let style = getComputedStyle(element);
const excludeStaticParent = style.position === "absolute";
const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/;
if (style.position === "fixed")
return LAST_RESORT;
for (let parent = element; parent = parent.parentElement;) {
style = getComputedStyle(parent);
if (excludeStaticParent && style.position === "static") {
continue;
}
if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX))
return parent;
}
return LAST_RESORT;
}
/* harmony default export */ const layout = ({
fn: {
getScrollParent
},
statePlugins: {
layout: {
actions: {
scrollToElement,
scrollTo,
clearScrollTo,
readyToScroll,
parseDeepLinkHash
},
selectors: {
getScrollToKey(state) {
return state.get("scrollToKey");
},
isShownKeyFromUrlHashArray(state, urlHashArray) {
const [tag, operationId] = urlHashArray;
// We only put operations in the URL
if (operationId) {
return ["operations", tag, operationId];
} else if (tag) {
return ["operations-tag", tag];
}
return [];
},
urlHashArrayFromIsShownKey(state, isShownKey) {
let [type, tag, operationId] = isShownKey;
// We only put operations in the URL
if (type == "operations") {
return [tag, operationId];
} else if (type == "operations-tag") {
return [tag];
}
return [];
}
},
reducers: {
[SCROLL_TO](state, action) {
return state.set("scrollToKey", external_immutable_namespaceObject["default"].fromJS(action.payload));
},
[CLEAR_SCROLL_TO](state) {
return state.delete("scrollToKey");
}
},
wrapActions: {
show
}
}
}
});
;// CONCATENATED MODULE: external "@babel/runtime-corejs3/helpers/defineProperty"
var defineProperty_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var defineProperty_y = x => () => x
const defineProperty_namespaceObject = defineProperty_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_defineProperty_807a2698__["default"] });
;// CONCATENATED MODULE: external "react-immutable-proptypes"
var external_react_immutable_proptypes_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_react_immutable_proptypes_y = x => () => x
const external_react_immutable_proptypes_namespaceObject = external_react_immutable_proptypes_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_immutable_proptypes_89c7d083__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/deep-linking/operation-wrapper.jsx
const Wrapper = (Ori, system) => class OperationWrapper extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onLoad",
(ref) => {
const { operation } = this.props;
const { tag, operationId } = operation.toObject();
let { isShownKey } = operation.toObject();
isShownKey = isShownKey || ["operations", tag, operationId];
system.layoutActions.readyToScroll(isShownKey, ref);
});}
render() {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", { ref: this.onLoad }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Ori, this.props)
));
}
};
/* harmony default export */ const operation_wrapper = (Wrapper);
;// CONCATENATED MODULE: ./src/core/plugins/deep-linking/operation-tag-wrapper.jsx
const operation_tag_wrapper_Wrapper = (Ori, system) => class OperationTagWrapper extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onLoad",
(ref) => {
const { tag } = this.props;
const isShownKey = ["operations-tag", tag];
system.layoutActions.readyToScroll(isShownKey, ref);
});}
render() {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", { ref: this.onLoad }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Ori, this.props)
));
}
};
/* harmony default export */ const operation_tag_wrapper = (operation_tag_wrapper_Wrapper);
;// CONCATENATED MODULE: ./src/core/plugins/deep-linking/index.js
/* harmony default export */ function deep_linking() {
return [layout, {
statePlugins: {
configs: {
wrapActions: {
loaded: (ori, system) => function () {
ori(...arguments);
// location.hash was an UTF-16 String, here is required UTF-8
const hash = decodeURIComponent(window.location.hash);
system.layoutActions.parseDeepLinkHash(hash);
}
}
}
},
wrapComponents: {
operation: operation_wrapper,
OperationTag: operation_tag_wrapper
}
}];
}
;// CONCATENATED MODULE: external "lodash/reduce"
var reduce_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var reduce_y = x => () => x
const reduce_namespaceObject = reduce_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_reduce_11e69996__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/err/error-transformers/transformers/not-of-type.js
function transform(errors) {
// JSONSchema refers to the current object being validated
// as 'instance'. This isn't helpful to users, so we remove it.
return errors.
map((err) => {
let seekStr = "is not of a type(s)";
let i = err.get("message").indexOf(seekStr);
if (i > -1) {
let types = err.get("message").slice(i + seekStr.length).split(",");
return err.set("message", err.get("message").slice(0, i) + makeNewMessage(types));
} else {
return err;
}
});
}
function makeNewMessage(types) {
return types.reduce((p, c, i, arr) => {
if (i === arr.length - 1 && arr.length > 1) {
return p + "or " + c;
} else if (arr[i + 1] && arr.length > 2) {
return p + c + ", ";
} else if (arr[i + 1]) {
return p + c + " ";
} else {
return p + c;
}
}, "should be a");
}
;// CONCATENATED MODULE: external "lodash/get"
var get_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var get_y = x => () => x
const get_namespaceObject = get_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_get_9427f899__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/err/error-transformers/transformers/parameter-oneof.js
function parameter_oneof_transform(errors, _ref) {let { jsSpec } = _ref;
// LOOK HERE THIS TRANSFORMER IS CURRENTLY DISABLED 😃
// TODO: finish implementing, fix flattening problem
/* eslint-disable no-unreachable */
return errors;
// JSONSchema gives us very little to go on
let searchStr = "is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference>";
return errors.
map((err) => {
let message = err.get("message");
let isParameterOneOfError = message.indexOf(searchStr) > -1;
if (isParameterOneOfError) {
// try to find what's wrong
return createTailoredParameterError(err, jsSpec);
} else {
return err;
}
}).
flatten(true); // shallow Immutable flatten
}
const VALID_IN_VALUES = ["path", "query", "header", "body", "formData"];
const VALID_COLLECTIONFORMAT_VALUES = ["csv", "ssv", "tsv", "pipes", "multi"];
function createTailoredParameterError(err, jsSpec) {
let newErrs = [];
let parameter = (0,get_namespaceObject["default"])(jsSpec, err.get("path"));
// find addressable cases
if (parameter.in && VALID_IN_VALUES.indexOf(parameter.in) === -1) {
let message = `Wrong value for the "in" keyword. Expected one of: ${VALID_IN_VALUES.join(", ")}.`;
newErrs.push({
message,
path: err.get("path") + ".in",
type: "spec",
source: "structural",
level: "error"
});
}
if (parameter.collectionFormat && VALID_COLLECTIONFORMAT_VALUES.indexOf(parameter.collectionFormat) === -1) {
let message = `Wrong value for the "collectionFormat" keyword. Expected one of: ${VALID_COLLECTIONFORMAT_VALUES.join(", ")}.`;
newErrs.push({
message,
path: err.get("path") + ".collectionFormat",
type: "spec",
source: "structural",
level: "error"
});
}
return newErrs.length ? (0,external_immutable_namespaceObject.fromJS)(newErrs) : err; // fall back to making no changes
}
;// CONCATENATED MODULE: ./src/core/plugins/err/error-transformers/hook.js
const errorTransformers = [
not_of_type_namespaceObject,
parameter_oneof_namespaceObject];
function transformErrors(errors) {
// Dev note: unimplemented artifact where
// jsSpec: system.specSelectors.specJS()
// regardless, to be compliant with redux@4, instead of calling the store method here,
// jsSpec should be pass down as an argument,
let inputs = {
jsSpec: {}
};
let transformedErrors = (0,reduce_namespaceObject["default"])(errorTransformers, (result, transformer) => {
try {
let newlyTransformedErrors = transformer.transform(result, inputs);
return newlyTransformedErrors.filter((err) => !!err); // filter removed errors
} catch (e) {
console.error("Transformer error:", e);
return result;
}
}, errors);
return transformedErrors.
filter((err) => !!err) // filter removed errors
.map((err) => {
if (!err.get("line") && err.get("path")) {
// TODO: re-resolve line number if we've transformed it away
}return err;
});
}
;// CONCATENATED MODULE: ./src/core/plugins/err/reducers.js
let DEFAULT_ERROR_STRUCTURE = {
// defaults
line: 0,
level: "error",
message: "Unknown error"
};
/* harmony default export */ function err_reducers() {
return {
[NEW_THROWN_ERR]: (state, _ref) => {let { payload } = _ref;
let error = Object.assign(DEFAULT_ERROR_STRUCTURE, payload, { type: "thrown" });
return state.
update("errors", (errors) => (errors || (0,external_immutable_namespaceObject.List)()).push((0,external_immutable_namespaceObject.fromJS)(error))).
update("errors", (errors) => transformErrors(errors));
},
[NEW_THROWN_ERR_BATCH]: (state, _ref2) => {let { payload } = _ref2;
payload = payload.map((err) => {
return (0,external_immutable_namespaceObject.fromJS)(Object.assign(DEFAULT_ERROR_STRUCTURE, err, { type: "thrown" }));
});
return state.
update("errors", (errors) => (errors || (0,external_immutable_namespaceObject.List)()).concat((0,external_immutable_namespaceObject.fromJS)(payload))).
update("errors", (errors) => transformErrors(errors));
},
[NEW_SPEC_ERR]: (state, _ref3) => {let { payload } = _ref3;
let error = (0,external_immutable_namespaceObject.fromJS)(payload);
error = error.set("type", "spec");
return state.
update("errors", (errors) => (errors || (0,external_immutable_namespaceObject.List)()).push((0,external_immutable_namespaceObject.fromJS)(error)).sortBy((err) => err.get("line"))).
update("errors", (errors) => transformErrors(errors));
},
[NEW_SPEC_ERR_BATCH]: (state, _ref4) => {let { payload } = _ref4;
payload = payload.map((err) => {
return (0,external_immutable_namespaceObject.fromJS)(Object.assign(DEFAULT_ERROR_STRUCTURE, err, { type: "spec" }));
});
return state.
update("errors", (errors) => (errors || (0,external_immutable_namespaceObject.List)()).concat((0,external_immutable_namespaceObject.fromJS)(payload))).
update("errors", (errors) => transformErrors(errors));
},
[NEW_AUTH_ERR]: (state, _ref5) => {let { payload } = _ref5;
let error = (0,external_immutable_namespaceObject.fromJS)(Object.assign({}, payload));
error = error.set("type", "auth");
return state.
update("errors", (errors) => (errors || (0,external_immutable_namespaceObject.List)()).push((0,external_immutable_namespaceObject.fromJS)(error))).
update("errors", (errors) => transformErrors(errors));
},
[CLEAR]: (state, _ref6) => {let { payload } = _ref6;
if (!payload || !state.get("errors")) {
return state;
}
let newErrors = state.get("errors").
filter((err) => {
return err.keySeq().every((k) => {
const errValue = err.get(k);
const filterValue = payload[k];
if (!filterValue) return true;
return errValue !== filterValue;
});
});
return state.merge({
errors: newErrors
});
},
[CLEAR_BY]: (state, _ref7) => {let { payload } = _ref7;
if (!payload || typeof payload !== "function") {
return state;
}
let newErrors = state.get("errors").
filter((err) => {
return payload(err);
});
return state.merge({
errors: newErrors
});
}
};
}
;// CONCATENATED MODULE: ./src/core/plugins/err/selectors.js
const selectors_state = (state) => state;
const allErrors = (0,external_reselect_namespaceObject.createSelector)(
selectors_state,
(err) => err.get("errors", (0,external_immutable_namespaceObject.List)())
);
const lastError = (0,external_reselect_namespaceObject.createSelector)(
allErrors,
(all) => all.last()
);
;// CONCATENATED MODULE: ./src/core/plugins/err/index.js
/* harmony default export */ function err(system) {
return {
statePlugins: {
err: {
reducers: err_reducers(system),
actions: actions_namespaceObject,
selectors: err_selectors_namespaceObject
}
}
};
}
;// CONCATENATED MODULE: ./src/core/plugins/filter/opsFilter.js
/* harmony default export */ function opsFilter(taggedOps, phrase) {
return taggedOps.filter((tagObj, tag) => tag.indexOf(phrase) !== -1);
}
;// CONCATENATED MODULE: ./src/core/plugins/filter/index.js
/* harmony default export */ function filter() {
return {
fn: {
opsFilter: opsFilter
}
};
}
;// CONCATENATED MODULE: external "@babel/runtime-corejs3/helpers/extends"
var extends_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var extends_y = x => () => x
const extends_namespaceObject = extends_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_extends_d20d3ceb__["default"] });
;// CONCATENATED MODULE: external "@babel/runtime-corejs3/helpers/objectWithoutProperties"
var objectWithoutProperties_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var objectWithoutProperties_y = x => () => x
const objectWithoutProperties_namespaceObject = objectWithoutProperties_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_objectWithoutProperties_9beedba5__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/icons/components/arrow-up.jsx
const _excluded = ["className", "width", "height"]; /**
* @prettier
*/
const ArrowUp = (_ref) => {let { className, width, height } = _ref,rest = (0,objectWithoutProperties_namespaceObject["default"])(_ref, _excluded);return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("svg", (0,extends_namespaceObject["default"])({
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20",
className: className,
width: width,
height: height,
"aria-hidden": "true",
focusable: "false" },
rest), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M 17.418 14.908 C 17.69 15.176 18.127 15.176 18.397 14.908 C 18.667 14.64 18.668 14.207 18.397 13.939 L 10.489 6.109 C 10.219 5.841 9.782 5.841 9.51 6.109 L 1.602 13.939 C 1.332 14.207 1.332 14.64 1.602 14.908 C 1.873 15.176 2.311 15.176 2.581 14.908 L 10 7.767 L 17.418 14.908 Z" })
));};
ArrowUp.defaultProps = {
className: null,
width: 20,
height: 20
};
/* harmony default export */ const arrow_up = (ArrowUp);
;// CONCATENATED MODULE: ./src/core/plugins/icons/components/arrow-down.jsx
const arrow_down_excluded = ["className", "width", "height"]; /**
* @prettier
*/
const ArrowDown = (_ref) => {let { className, width, height } = _ref,rest = (0,objectWithoutProperties_namespaceObject["default"])(_ref, arrow_down_excluded);return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("svg", (0,extends_namespaceObject["default"])({
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20",
className: className,
width: width,
height: height,
"aria-hidden": "true",
focusable: "false" },
rest), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z" })
));};
ArrowDown.defaultProps = {
className: null,
width: 20,
height: 20
};
/* harmony default export */ const arrow_down = (ArrowDown);
;// CONCATENATED MODULE: ./src/core/plugins/icons/components/arrow.jsx
const arrow_excluded = ["className", "width", "height"]; /**
* @prettier
*/
const Arrow = (_ref) => {let { className, width, height } = _ref,rest = (0,objectWithoutProperties_namespaceObject["default"])(_ref, arrow_excluded);return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("svg", (0,extends_namespaceObject["default"])({
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20",
className: className,
width: width,
height: height,
"aria-hidden": "true",
focusable: "false" },
rest), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z" })
));};
Arrow.defaultProps = {
className: null,
width: 20,
height: 20
};
/* harmony default export */ const arrow = (Arrow);
;// CONCATENATED MODULE: ./src/core/plugins/icons/components/close.jsx
const close_excluded = ["className", "width", "height"]; /**
* @prettier
*/
const Close = (_ref) => {let { className, width, height } = _ref,rest = (0,objectWithoutProperties_namespaceObject["default"])(_ref, close_excluded);return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("svg", (0,extends_namespaceObject["default"])({
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20",
className: className,
width: width,
height: height,
"aria-hidden": "true",
focusable: "false" },
rest), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z" })
));};
Close.defaultProps = {
className: null,
width: 20,
height: 20
};
/* harmony default export */ const components_close = (Close);
;// CONCATENATED MODULE: ./src/core/plugins/icons/components/copy.jsx
const copy_excluded = ["className", "width", "height"]; /**
* @prettier
*/
const Copy = (_ref) => {let { className, width, height } = _ref,rest = (0,objectWithoutProperties_namespaceObject["default"])(_ref, copy_excluded);return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("svg", (0,extends_namespaceObject["default"])({
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 15 16",
className: className,
width: width,
height: height,
"aria-hidden": "true",
focusable: "false" },
rest), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("g", { transform: "translate(2, -1)" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", {
fill: "#ffffff",
fillRule: "evenodd",
d: "M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z" }
)
)
));};
Copy.defaultProps = {
className: null,
width: 15,
height: 16
};
/* harmony default export */ const copy = (Copy);
;// CONCATENATED MODULE: ./src/core/plugins/icons/components/lock.jsx
const lock_excluded = ["className", "width", "height"]; /**
* @prettier
*/
const Lock = (_ref) => {let { className, width, height } = _ref,rest = (0,objectWithoutProperties_namespaceObject["default"])(_ref, lock_excluded);return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("svg", (0,extends_namespaceObject["default"])({
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20",
className: className,
width: width,
height: height,
"aria-hidden": "true",
focusable: "false" },
rest), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z" })
));};
Lock.defaultProps = {
className: null,
width: 20,
height: 20
};
/* harmony default export */ const lock = (Lock);
;// CONCATENATED MODULE: ./src/core/plugins/icons/components/unlock.jsx
const unlock_excluded = ["className", "width", "height"]; /**
* @prettier
*/
const Unlock = (_ref) => {let { className, width, height } = _ref,rest = (0,objectWithoutProperties_namespaceObject["default"])(_ref, unlock_excluded);return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("svg", (0,extends_namespaceObject["default"])({
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 20 20",
className: className,
width: width,
height: height,
"aria-hidden": "true",
focusable: "false" },
rest), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z" })
));};
Unlock.defaultProps = {
className: null,
width: 20,
height: 20
};
/* harmony default export */ const unlock = (Unlock);
;// CONCATENATED MODULE: ./src/core/plugins/icons/index.js
/**
* @prettier
*/
const IconsPlugin = () => ({
components: {
ArrowUpIcon: arrow_up,
ArrowDownIcon: arrow_down,
ArrowIcon: arrow,
CloseIcon: components_close,
CopyIcon: copy,
LockIcon: lock,
UnlockIcon: unlock
}
});
/* harmony default export */ const icons = (IconsPlugin);
;// CONCATENATED MODULE: ./src/core/plugins/layout/actions.js
const UPDATE_LAYOUT = "layout_update_layout";
const UPDATE_FILTER = "layout_update_filter";
const UPDATE_MODE = "layout_update_mode";
const SHOW = "layout_show";
// export const ONLY_SHOW = "layout_only_show"
function updateLayout(layout) {
return {
type: UPDATE_LAYOUT,
payload: layout
};
}
function updateFilter(filter) {
return {
type: UPDATE_FILTER,
payload: filter
};
}
function actions_show(thing) {let shown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
thing = normalizeArray(thing);
return {
type: SHOW,
payload: { thing, shown }
};
}
// Simple string key-store, used for
function changeMode(thing) {let mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
thing = normalizeArray(thing);
return {
type: UPDATE_MODE,
payload: { thing, mode }
};
}
;// CONCATENATED MODULE: ./src/core/plugins/layout/reducers.js
/* harmony default export */ const layout_reducers = ({
[UPDATE_LAYOUT]: (state, action) => state.set("layout", action.payload),
[UPDATE_FILTER]: (state, action) => state.set("filter", action.payload),
[SHOW]: (state, action) => {
const isShown = action.payload.shown;
// This is one way to serialize an array, another (preferred) is to convert to json-pointer
// TODO: use json-pointer serilization instead of fromJS(...), for performance
const thingToShow = (0,external_immutable_namespaceObject.fromJS)(action.payload.thing);
// This is a map of paths to bools
// eg: [one, two] => true
// eg: [one] => false
return state.update("shown", (0,external_immutable_namespaceObject.fromJS)({}), (a) => a.set(thingToShow, isShown));
},
[UPDATE_MODE]: (state, action) => {
let thing = action.payload.thing;
let mode = action.payload.mode;
return state.setIn(["modes"].concat(thing), (mode || "") + "");
}
});
;// CONCATENATED MODULE: ./src/core/plugins/layout/selectors.js
const layout_selectors_state = (state) => state;
const current = (state) => state.get("layout");
const currentFilter = (state) => state.get("filter");
const isShown = (state, thing, def) => {
thing = normalizeArray(thing);
return state.get("shown", (0,external_immutable_namespaceObject.fromJS)({})).get((0,external_immutable_namespaceObject.fromJS)(thing), def);
};
const whatMode = function (state, thing) {let def = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
thing = normalizeArray(thing);
return state.getIn(["modes", ...thing], def);
};
const showSummary = (0,external_reselect_namespaceObject.createSelector)(
layout_selectors_state,
(state) => !isShown(state, "editor")
);
;// CONCATENATED MODULE: ./src/core/plugins/layout/spec-extensions/wrap-selector.js
const taggedOperations = (oriSelector, system) => function (state) {for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {args[_key - 1] = arguments[_key];}
let taggedOps = oriSelector(state, ...args);
const { fn, layoutSelectors, getConfigs } = system.getSystem();
const configs = getConfigs();
const { maxDisplayedTags } = configs;
// Filter, if requested
let filter = layoutSelectors.currentFilter();
if (filter) {
if (filter !== true && filter !== "true" && filter !== "false") {
taggedOps = fn.opsFilter(taggedOps, filter);
}
}
// Limit to [max] items, if specified
if (maxDisplayedTags && !isNaN(maxDisplayedTags) && maxDisplayedTags >= 0) {
taggedOps = taggedOps.slice(0, maxDisplayedTags);
}
return taggedOps;
};
;// CONCATENATED MODULE: ./src/core/plugins/layout/index.js
/* harmony default export */ function plugins_layout() {
return {
statePlugins: {
layout: {
reducers: layout_reducers,
actions: layout_actions_namespaceObject,
selectors: layout_selectors_namespaceObject
},
spec: {
wrapSelectors: wrap_selector_namespaceObject
}
}
};
}
;// CONCATENATED MODULE: ./src/core/plugins/logs/index.js
/* harmony default export */ function logs(_ref) {let { configs } = _ref;
const levels = {
"debug": 0,
"info": 1,
"log": 2,
"warn": 3,
"error": 4
};
const getLevel = (level) => levels[level] || -1;
let { logLevel } = configs;
let logLevelInt = getLevel(logLevel);
function log(level) {for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {args[_key - 1] = arguments[_key];}
if (getLevel(level) >= logLevelInt)
// eslint-disable-next-line no-console
console[level](...args);
}
log.warn = log.bind(null, "warn");
log.error = log.bind(null, "error");
log.info = log.bind(null, "info");
log.debug = log.bind(null, "debug");
return { rootInjects: { log } };
}
;// CONCATENATED MODULE: ./src/core/plugins/on-complete/index.js
let engaged = false;
/* harmony default export */ function on_complete() {
return {
statePlugins: {
spec: {
wrapActions: {
updateSpec: (ori) => function () {
engaged = true;
return ori(...arguments);
},
updateJsonSpec: (ori, system) => function () {
const cb = system.getConfigs().onComplete;
if (engaged && typeof cb === "function") {
// call `onComplete` on next tick, which allows React to
// reconcile the DOM before we notify the user
setTimeout(cb, 0);
engaged = false;
}
return ori(...arguments);
}
}
}
}
};
}
;// CONCATENATED MODULE: ./src/core/plugins/request-snippets/fn.js
/**
* if duplicate key name existed from FormData entries,
* we mutated the key name by appending a hashIdx
* @param {String} k - possibly mutated key name
* @return {String} - src key name
*/
const extractKey = (k) => {
const hashIdx = "_**[]";
if (k.indexOf(hashIdx) < 0) {
return k;
}
return k.split(hashIdx)[0].trim();
};
const escapeShell = (str) => {
if (str === "-d ") {
return str;
}
// eslint-disable-next-line no-useless-escape
if (!/^[_\/-]/g.test(str))
return "'" + str.
replace(/'/g, "'\\''") + "'";else
return str;
};
const escapeCMD = (str) => {
str = str.
replace(/\^/g, "^^").
replace(/\\"/g, "\\\\\"").
replace(/"/g, "\"\"").
replace(/\n/g, "^\n");
if (str === "-d ") {
return str.
replace(/-d /g, "-d ^\n");
}
// eslint-disable-next-line no-useless-escape
if (!/^[_\/-]/g.test(str))
return "\"" + str + "\"";else
return str;
};
const escapePowershell = (str) => {
if (str === "-d ") {
return str;
}
if (/\n/.test(str)) {
return "@\"\n" + str.replace(/"/g, "\\\"").replace(/`/g, "``").replace(/\$/, "`$") + "\n\"@";
}
// eslint-disable-next-line no-useless-escape
if (!/^[_\/-]/g.test(str))
return "'" + str.
replace(/"/g, "\"\"").
replace(/'/g, "''") + "'";else
return str;
};
function getStringBodyOfMap(request) {
let curlifyToJoin = [];
for (let [k, v] of request.get("body").entrySeq()) {
let extractedKey = extractKey(k);
if (v instanceof core_window.File) {
curlifyToJoin.push(` "${extractedKey}": {\n "name": "${v.name}"${v.type ? `,\n "type": "${v.type}"` : ""}\n }`);
} else {
curlifyToJoin.push(` "${extractedKey}": ${JSON.stringify(v, null, 2).replace(/(\r\n|\r|\n)/g, "\n ")}`);
}
}
return `{\n${curlifyToJoin.join(",\n")}\n}`;
}
const curlify = function (request, escape, newLine) {let ext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
let isMultipartFormDataRequest = false;
let curlified = "";
const addWords = function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}return curlified += " " + args.map(escape).join(" ");};
const addWordsWithoutLeadingSpace = function () {for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {args[_key2] = arguments[_key2];}return curlified += args.map(escape).join(" ");};
const addNewLine = () => curlified += ` ${newLine}`;
const addIndent = function () {let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;return curlified += " ".repeat(level);};
let headers = request.get("headers");
curlified += "curl" + ext;
if (request.has("curlOptions")) {
addWords(...request.get("curlOptions"));
}
addWords("-X", request.get("method"));
addNewLine();
addIndent();
addWordsWithoutLeadingSpace(`${request.get("url")}`);
if (headers && headers.size) {
for (let p of request.get("headers").entries()) {
addNewLine();
addIndent();
let [h, v] = p;
addWordsWithoutLeadingSpace("-H", `${h}: ${v}`);
isMultipartFormDataRequest = isMultipartFormDataRequest || /^content-type$/i.test(h) && /^multipart\/form-data$/i.test(v);
}
}
const body = request.get("body");
if (body) {
if (isMultipartFormDataRequest && ["POST", "PUT", "PATCH"].includes(request.get("method"))) {
for (let [k, v] of body.entrySeq()) {
let extractedKey = extractKey(k);
addNewLine();
addIndent();
addWordsWithoutLeadingSpace("-F");
/**
* SwaggerClient produces specialized sub-class of File class, that only
* accepts string data and retain this data in `data`
* public property throughout the lifecycle of its instances.
*
* This sub-class is exclusively used only when Encoding Object
* is defined within the Media Type Object (OpenAPI 3.x.y).
*/
if (v instanceof core_window.File && typeof v.valueOf() === "string") {
addWords(`${extractedKey}=${v.data}${v.type ? `;type=${v.type}` : ""}`);
} else if (v instanceof core_window.File) {
addWords(`${extractedKey}=@${v.name}${v.type ? `;type=${v.type}` : ""}`);
} else {
addWords(`${extractedKey}=${v}`);
}
}
} else if (body instanceof core_window.File) {
addNewLine();
addIndent();
addWordsWithoutLeadingSpace(`--data-binary '@${body.name}'`);
} else {
addNewLine();
addIndent();
addWordsWithoutLeadingSpace("-d ");
let reqBody = body;
if (!external_immutable_namespaceObject.Map.isMap(reqBody)) {
if (typeof reqBody !== "string") {
reqBody = JSON.stringify(reqBody);
}
addWordsWithoutLeadingSpace(reqBody);
} else {
addWordsWithoutLeadingSpace(getStringBodyOfMap(request));
}
}
} else if (!body && request.get("method") === "POST") {
addNewLine();
addIndent();
addWordsWithoutLeadingSpace("-d ''");
}
return curlified;
};
// eslint-disable-next-line camelcase
const requestSnippetGenerator_curl_powershell = (request) => {
return curlify(request, escapePowershell, "`\n", ".exe");
};
// eslint-disable-next-line camelcase
const requestSnippetGenerator_curl_bash = (request) => {
return curlify(request, escapeShell, "\\\n");
};
// eslint-disable-next-line camelcase
const requestSnippetGenerator_curl_cmd = (request) => {
return curlify(request, escapeCMD, "^\n");
};
;// CONCATENATED MODULE: ./src/core/plugins/request-snippets/selectors.js
const request_snippets_selectors_state = (state) => state || (0,external_immutable_namespaceObject.Map)();
const getGenerators = (0,external_reselect_namespaceObject.createSelector)(
request_snippets_selectors_state,
(state) => {
const languageKeys = state.
get("languages");
const generators = state.
get("generators", (0,external_immutable_namespaceObject.Map)());
if (!languageKeys || languageKeys.isEmpty()) {
return generators;
}
return generators.
filter((v, key) => languageKeys.includes(key));
}
);
const getSnippetGenerators = (state) => (_ref) => {let { fn } = _ref;
const getGenFn = (key) => fn[`requestSnippetGenerator_${key}`];
return getGenerators(state).
map((gen, key) => {
const genFn = getGenFn(key);
if (typeof genFn !== "function") {
return null;
}
return gen.set("fn", genFn);
}).
filter((v) => v);
};
const getActiveLanguage = (0,external_reselect_namespaceObject.createSelector)(
request_snippets_selectors_state,
(state) => state.
get("activeLanguage")
);
const getDefaultExpanded = (0,external_reselect_namespaceObject.createSelector)(
request_snippets_selectors_state,
(state) => state.
get("defaultExpanded")
);
;// CONCATENATED MODULE: external "react-copy-to-clipboard"
var external_react_copy_to_clipboard_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_react_copy_to_clipboard_y = x => () => x
const external_react_copy_to_clipboard_namespaceObject = external_react_copy_to_clipboard_x({ ["CopyToClipboard"]: () => __WEBPACK_EXTERNAL_MODULE_react_copy_to_clipboard_5b11dd57__.CopyToClipboard });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/light"
var light_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var light_y = x => () => x
const light_namespaceObject = light_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_light_746e1958__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/languages/hljs/javascript"
var javascript_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var javascript_y = x => () => x
const javascript_namespaceObject = javascript_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_javascript_e22911f7__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/languages/hljs/json"
var json_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var json_y = x => () => x
const json_namespaceObject = json_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_json_b876afc5__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/languages/hljs/xml"
var xml_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var xml_y = x => () => x
const xml_namespaceObject = xml_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_xml_a81c807b__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/languages/hljs/bash"
var bash_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var bash_y = x => () => x
const bash_namespaceObject = bash_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_bash_1621c621__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/languages/hljs/yaml"
var yaml_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var yaml_y = x => () => x
const yaml_namespaceObject = yaml_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_yaml_02838f34__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/languages/hljs/http"
var http_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var http_y = x => () => x
const http_namespaceObject = http_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_http_4e924b23__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/languages/hljs/powershell"
var powershell_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var powershell_y = x => () => x
const powershell_namespaceObject = powershell_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_languages_hljs_powershell_d51eb4f6__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/styles/hljs/agate"
var agate_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var agate_y = x => () => x
const agate_namespaceObject = agate_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_agate_99a46aa2__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/styles/hljs/arta"
var arta_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var arta_y = x => () => x
const arta_namespaceObject = arta_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_arta_570691fc__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/styles/hljs/monokai"
var monokai_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var monokai_y = x => () => x
const monokai_namespaceObject = monokai_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_monokai_2529bafb__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/styles/hljs/nord"
var nord_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var nord_y = x => () => x
const nord_namespaceObject = nord_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_nord_5bfa1099__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/styles/hljs/obsidian"
var obsidian_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var obsidian_y = x => () => x
const obsidian_namespaceObject = obsidian_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_obsidian_a278dd52__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/styles/hljs/tomorrow-night"
var tomorrow_night_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var tomorrow_night_y = x => () => x
const tomorrow_night_namespaceObject = tomorrow_night_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_tomorrow_night_63765df9__["default"] });
;// CONCATENATED MODULE: external "react-syntax-highlighter/dist/esm/styles/hljs/idea"
var idea_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var idea_y = x => () => x
const idea_namespaceObject = idea_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_syntax_highlighter_dist_esm_styles_hljs_idea_023aba2e__["default"] });
;// CONCATENATED MODULE: ./src/core/syntax-highlighting.js
light_namespaceObject["default"].registerLanguage("json", json_namespaceObject["default"]);
light_namespaceObject["default"].registerLanguage("js", javascript_namespaceObject["default"]);
light_namespaceObject["default"].registerLanguage("xml", xml_namespaceObject["default"]);
light_namespaceObject["default"].registerLanguage("yaml", yaml_namespaceObject["default"]);
light_namespaceObject["default"].registerLanguage("http", http_namespaceObject["default"]);
light_namespaceObject["default"].registerLanguage("bash", bash_namespaceObject["default"]);
light_namespaceObject["default"].registerLanguage("powershell", powershell_namespaceObject["default"]);
light_namespaceObject["default"].registerLanguage("javascript", javascript_namespaceObject["default"]);
const styles = { agate: agate_namespaceObject["default"], arta: arta_namespaceObject["default"], monokai: monokai_namespaceObject["default"], nord: nord_namespaceObject["default"], obsidian: obsidian_namespaceObject["default"], "tomorrow-night": tomorrow_night_namespaceObject["default"], idea: idea_namespaceObject["default"] };
const availableStyles = Object.keys(styles);
const getStyle = (name) => {
if (!availableStyles.includes(name)) {
console.warn(`Request style '${name}' is not available, returning default instead`);
return agate_namespaceObject["default"];
}
return styles[name];
};
;// CONCATENATED MODULE: ./src/core/plugins/request-snippets/request-snippets.jsx
const style = {
cursor: "pointer",
lineHeight: 1,
display: "inline-flex",
backgroundColor: "rgb(250, 250, 250)",
paddingBottom: "0",
paddingTop: "0",
border: "1px solid rgb(51, 51, 51)",
borderRadius: "4px 4px 0 0",
boxShadow: "none",
borderBottom: "none"
};
const activeStyle = {
cursor: "pointer",
lineHeight: 1,
display: "inline-flex",
backgroundColor: "rgb(51, 51, 51)",
boxShadow: "none",
border: "1px solid rgb(51, 51, 51)",
paddingBottom: "0",
paddingTop: "0",
borderRadius: "4px 4px 0 0",
marginTop: "-5px",
marginRight: "-5px",
marginLeft: "-5px",
zIndex: "9999",
borderBottom: "none"
};
const RequestSnippets = (_ref) => {var _requestSnippetsSelec;let { request, requestSnippetsSelectors, getConfigs, getComponent } = _ref;
const config = (0,isFunction_namespaceObject["default"])(getConfigs) ? getConfigs() : null;
const canSyntaxHighlight = (0,get_namespaceObject["default"])(config, "syntaxHighlight") !== false && (0,get_namespaceObject["default"])(config, "syntaxHighlight.activated", true);
const rootRef = (0,external_react_namespaceObject.useRef)(null);
const ArrowIcon = getComponent("ArrowUpIcon");
const ArrowDownIcon = getComponent("ArrowDownIcon");
const [activeLanguage, setActiveLanguage] = (0,external_react_namespaceObject.useState)((_requestSnippetsSelec = requestSnippetsSelectors.getSnippetGenerators()) === null || _requestSnippetsSelec === void 0 ? void 0 : _requestSnippetsSelec.keySeq().first());
const [isExpanded, setIsExpanded] = (0,external_react_namespaceObject.useState)(requestSnippetsSelectors === null || requestSnippetsSelectors === void 0 ? void 0 : requestSnippetsSelectors.getDefaultExpanded());
(0,external_react_namespaceObject.useEffect)(() => {
const doIt = () => {
};
doIt();
}, []);
(0,external_react_namespaceObject.useEffect)(() => {
const childNodes = Array.
from(rootRef.current.childNodes).
filter((node) => {var _node$classList;return !!node.nodeType && ((_node$classList = node.classList) === null || _node$classList === void 0 ? void 0 : _node$classList.contains("curl-command"));});
// eslint-disable-next-line no-use-before-define
childNodes.forEach((node) => node.addEventListener("mousewheel", handlePreventYScrollingBeyondElement, { passive: false }));
return () => {
// eslint-disable-next-line no-use-before-define
childNodes.forEach((node) => node.removeEventListener("mousewheel", handlePreventYScrollingBeyondElement));
};
}, [request]);
const snippetGenerators = requestSnippetsSelectors.getSnippetGenerators();
const activeGenerator = snippetGenerators.get(activeLanguage);
const snippet = activeGenerator.get("fn")(request);
const handleGenChange = (key) => {
const needsChange = activeLanguage !== key;
if (needsChange) {
setActiveLanguage(key);
}
};
const handleSetIsExpanded = () => {
setIsExpanded(!isExpanded);
};
const handleGetBtnStyle = (key) => {
if (key === activeLanguage) {
return activeStyle;
}
return style;
};
const handlePreventYScrollingBeyondElement = (e) => {
const { target, deltaY } = e;
const { scrollHeight: contentHeight, offsetHeight: visibleHeight, scrollTop } = target;
const scrollOffset = visibleHeight + scrollTop;
const isElementScrollable = contentHeight > visibleHeight;
const isScrollingPastTop = scrollTop === 0 && deltaY < 0;
const isScrollingPastBottom = scrollOffset >= contentHeight && deltaY > 0;
if (isElementScrollable && (isScrollingPastTop || isScrollingPastBottom)) {
e.preventDefault();
}
};
const SnippetComponent = canSyntaxHighlight ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(light_namespaceObject["default"], {
language: activeGenerator.get("syntax"),
className: "curl microlight",
style: getStyle((0,get_namespaceObject["default"])(config, "syntaxHighlight.theme")) },
snippet
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("textarea", { readOnly: true, className: "curl", value: snippet });
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "request-snippets", ref: rootRef }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { style: { width: "100%", display: "flex", justifyContent: "flex-start", alignItems: "center", marginBottom: "15px" } }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", {
onClick: () => handleSetIsExpanded(),
style: { cursor: "pointer" } },
"Snippets"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", {
onClick: () => handleSetIsExpanded(),
style: { border: "none", background: "none" },
title: isExpanded ? "Collapse operation" : "Expand operation" },
isExpanded ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowDownIcon, { className: "arrow", width: "10", height: "10" }) : /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowIcon, { className: "arrow", width: "10", height: "10" })
)
),
isExpanded && /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "curl-command" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { style: { paddingLeft: "15px", paddingRight: "10px", width: "100%", display: "flex" } },
snippetGenerators.entrySeq().map((_ref2) => {let [key, gen] = _ref2;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { style: handleGetBtnStyle(key), className: "btn", key: key, onClick: () => handleGenChange(key) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { style: key === activeLanguage ? { color: "white" } : {} }, gen.get("title"))
);
})
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "copy-to-clipboard" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_copy_to_clipboard_namespaceObject.CopyToClipboard, { text: snippet }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", null)
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null,
SnippetComponent
)
)
));
};
/* harmony default export */ const request_snippets = (RequestSnippets);
;// CONCATENATED MODULE: ./src/core/plugins/request-snippets/index.js
/* harmony default export */ const plugins_request_snippets = (() => {
return {
components: {
RequestSnippets: request_snippets
},
fn: fn_namespaceObject,
statePlugins: {
requestSnippets: {
selectors: request_snippets_selectors_namespaceObject
}
}
};
});
;// CONCATENATED MODULE: external "xml"
var external_xml_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_xml_y = x => () => x
const external_xml_namespaceObject = external_xml_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_xml__["default"] });
;// CONCATENATED MODULE: external "randexp"
var external_randexp_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_randexp_y = x => () => x
const external_randexp_namespaceObject = external_randexp_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_randexp__["default"] });
;// CONCATENATED MODULE: external "lodash/isEmpty"
var isEmpty_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var isEmpty_y = x => () => x
const isEmpty_namespaceObject = isEmpty_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isEmpty_e109fd6b__["default"] });
;// CONCATENATED MODULE: ./src/core/utils/memoizeN.js
/**
* This function is extension on top of lodash.memoize.
* It uses all the arguments of the `fn` as the cache key instead of just the first one.
* If resolver is provided, it determines the cache key for
* storing the result based on the arguments provided to the memoized function.
*/
const shallowArrayEquals = (a) => (b) => {
return Array.isArray(a) && Array.isArray(b) &&
a.length === b.length &&
a.every((val, index) => val === b[index]);
};
const list = function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}return args;};
class Cache extends Map {
delete(key) {
const keys = Array.from(this.keys());
const foundKey = keys.find(shallowArrayEquals(key));
return super.delete(foundKey);
}
get(key) {
const keys = Array.from(this.keys());
const foundKey = keys.find(shallowArrayEquals(key));
return super.get(foundKey);
}
has(key) {
const keys = Array.from(this.keys());
return keys.findIndex(shallowArrayEquals(key)) !== -1;
}
}
const memoizeN = function (fn) {let resolver = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : list;
const { Cache: OriginalCache } = memoize_namespaceObject["default"];
memoize_namespaceObject["default"].Cache = Cache;
const memoized = (0,memoize_namespaceObject["default"])(fn, resolver);
memoize_namespaceObject["default"].Cache = OriginalCache;
return memoized;
};
/* harmony default export */ const utils_memoizeN = (memoizeN);
;// CONCATENATED MODULE: ./src/core/plugins/samples/fn/index.js
const generateStringFromRegex = (pattern) => {
try {
const randexp = new external_randexp_namespaceObject["default"](pattern);
return randexp.gen();
} catch (e) {
// Invalid regex should not cause a crash (regex syntax varies across languages)
return "string";
}
};
const primitives = {
"string": (schema) => schema.pattern ? generateStringFromRegex(schema.pattern) : "string",
"string_email": () => "user@example.com",
"string_date-time": () => new Date().toISOString(),
"string_date": () => new Date().toISOString().substring(0, 10),
"string_uuid": () => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"string_hostname": () => "example.com",
"string_ipv4": () => "198.51.100.42",
"string_ipv6": () => "2001:0db8:5b96:0000:0000:426f:8e17:642a",
"number": () => 0,
"number_float": () => 0.0,
"integer": () => 0,
"boolean": (schema) => typeof schema.default === "boolean" ? schema.default : true
};
const primitive = (schema) => {
schema = objectify(schema);
let { type, format } = schema;
let fn = primitives[`${type}_${format}`] || primitives[type];
if (isFunc(fn))
return fn(schema);
return "Unknown Type: " + schema.type;
};
// do a couple of quick sanity tests to ensure the value
// looks like a $$ref that swagger-client generates.
const sanitizeRef = (value) => deeplyStripKey(value, "$$ref", (val) =>
typeof val === "string" && val.indexOf("#") > -1);
const objectContracts = ["maxProperties", "minProperties"];
const arrayContracts = ["minItems", "maxItems"];
const numberContracts = [
"minimum",
"maximum",
"exclusiveMinimum",
"exclusiveMaximum"];
const stringContracts = ["minLength", "maxLength"];
const liftSampleHelper = function (oldSchema, target) {let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
const setIfNotDefinedInTarget = (key) => {
if (target[key] === undefined && oldSchema[key] !== undefined) {
target[key] = oldSchema[key];
}
};
[
"example",
"default",
"enum",
"xml",
"type",
...objectContracts,
...arrayContracts,
...numberContracts,
...stringContracts].
forEach((key) => setIfNotDefinedInTarget(key));
if (oldSchema.required !== undefined && Array.isArray(oldSchema.required)) {
if (target.required === undefined || !target.required.length) {
target.required = [];
}
oldSchema.required.forEach((key) => {
if (target.required.includes(key)) {
return;
}
target.required.push(key);
});
}
if (oldSchema.properties) {
if (!target.properties) {
target.properties = {};
}
let props = objectify(oldSchema.properties);
for (let propName in props) {
if (!Object.prototype.hasOwnProperty.call(props, propName)) {
continue;
}
if (props[propName] && props[propName].deprecated) {
continue;
}
if (props[propName] && props[propName].readOnly && !config.includeReadOnly) {
continue;
}
if (props[propName] && props[propName].writeOnly && !config.includeWriteOnly) {
continue;
}
if (!target.properties[propName]) {
target.properties[propName] = props[propName];
if (!oldSchema.required && Array.isArray(oldSchema.required) && oldSchema.required.indexOf(propName) !== -1) {
if (!target.required) {
target.required = [propName];
} else {
target.required.push(propName);
}
}
}
}
}
if (oldSchema.items) {
if (!target.items) {
target.items = {};
}
target.items = liftSampleHelper(oldSchema.items, target.items, config);
}
return target;
};
const sampleFromSchemaGeneric = function (schema) {let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};let exampleOverride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;let respectXML = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if (schema && isFunc(schema.toJS))
schema = schema.toJS();
let usePlainValue = exampleOverride !== undefined || schema && schema.example !== undefined || schema && schema.default !== undefined;
// first check if there is the need of combining this schema with others required by allOf
const hasOneOf = !usePlainValue && schema && schema.oneOf && schema.oneOf.length > 0;
const hasAnyOf = !usePlainValue && schema && schema.anyOf && schema.anyOf.length > 0;
if (!usePlainValue && (hasOneOf || hasAnyOf)) {
const schemaToAdd = objectify(hasOneOf ?
schema.oneOf[0] :
schema.anyOf[0]
);
liftSampleHelper(schemaToAdd, schema, config);
if (!schema.xml && schemaToAdd.xml) {
schema.xml = schemaToAdd.xml;
}
if (schema.example !== undefined && schemaToAdd.example !== undefined) {
usePlainValue = true;
} else if (schemaToAdd.properties) {
if (!schema.properties) {
schema.properties = {};
}
let props = objectify(schemaToAdd.properties);
for (let propName in props) {
if (!Object.prototype.hasOwnProperty.call(props, propName)) {
continue;
}
if (props[propName] && props[propName].deprecated) {
continue;
}
if (props[propName] && props[propName].readOnly && !config.includeReadOnly) {
continue;
}
if (props[propName] && props[propName].writeOnly && !config.includeWriteOnly) {
continue;
}
if (!schema.properties[propName]) {
schema.properties[propName] = props[propName];
if (!schemaToAdd.required && Array.isArray(schemaToAdd.required) && schemaToAdd.required.indexOf(propName) !== -1) {
if (!schema.required) {
schema.required = [propName];
} else {
schema.required.push(propName);
}
}
}
}
}
}
const _attr = {};
let { xml, type, example, properties, additionalProperties, items } = schema || {};
let { includeReadOnly, includeWriteOnly } = config;
xml = xml || {};
let { name, prefix, namespace } = xml;
let displayName;
let res = {};
// set xml naming and attributes
if (respectXML) {
name = name || "notagname";
// add prefix to name if exists
displayName = (prefix ? prefix + ":" : "") + name;
if (namespace) {
//add prefix to namespace if exists
let namespacePrefix = prefix ? "xmlns:" + prefix : "xmlns";
_attr[namespacePrefix] = namespace;
}
}
// init xml default response sample obj
if (respectXML) {
res[displayName] = [];
}
const schemaHasAny = (keys) => keys.some((key) => Object.prototype.hasOwnProperty.call(schema, key));
// try recover missing type
if (schema && !type) {
if (properties || additionalProperties || schemaHasAny(objectContracts)) {
type = "object";
} else if (items || schemaHasAny(arrayContracts)) {
type = "array";
} else if (schemaHasAny(numberContracts)) {
type = "number";
schema.type = "number";
} else if (!usePlainValue && !schema.enum) {
// implicit cover schemaHasAny(stringContracts) or A schema without a type matches any data type is:
// components:
// schemas:
// AnyValue:
// anyOf:
// - type: string
// - type: number
// - type: integer
// - type: boolean
// - type: array
// items: {}
// - type: object
//
// which would resolve to type: string
type = "string";
schema.type = "string";
}
}
const handleMinMaxItems = (sampleArray) => {var _schema, _schema2, _schema4, _schema5;
if (((_schema = schema) === null || _schema === void 0 ? void 0 : _schema.maxItems) !== null && ((_schema2 = schema) === null || _schema2 === void 0 ? void 0 : _schema2.maxItems) !== undefined) {var _schema3;
sampleArray = sampleArray.slice(0, (_schema3 = schema) === null || _schema3 === void 0 ? void 0 : _schema3.maxItems);
}
if (((_schema4 = schema) === null || _schema4 === void 0 ? void 0 : _schema4.minItems) !== null && ((_schema5 = schema) === null || _schema5 === void 0 ? void 0 : _schema5.minItems) !== undefined) {
let i = 0;
while (sampleArray.length < ((_schema6 = schema) === null || _schema6 === void 0 ? void 0 : _schema6.minItems)) {var _schema6;
sampleArray.push(sampleArray[i++ % sampleArray.length]);
}
}
return sampleArray;
};
// add to result helper init for xml or json
const props = objectify(properties);
let addPropertyToResult;
let propertyAddedCounter = 0;
const hasExceededMaxProperties = () => schema &&
schema.maxProperties !== null && schema.maxProperties !== undefined &&
propertyAddedCounter >= schema.maxProperties;
const requiredPropertiesToAdd = () => {
if (!schema || !schema.required) {
return 0;
}
let addedCount = 0;
if (respectXML) {
schema.required.forEach((key) => addedCount +=
res[key] === undefined ?
0 :
1
);
} else {
schema.required.forEach((key) => {var _res$displayName;return addedCount +=
((_res$displayName = res[displayName]) === null || _res$displayName === void 0 ? void 0 : _res$displayName.find((x) => x[key] !== undefined)) === undefined ?
0 :
1;}
);
}
return schema.required.length - addedCount;
};
const isOptionalProperty = (propName) => {
if (!schema || !schema.required || !schema.required.length) {
return true;
}
return !schema.required.includes(propName);
};
const canAddProperty = (propName) => {
if (!schema || schema.maxProperties === null || schema.maxProperties === undefined) {
return true;
}
if (hasExceededMaxProperties()) {
return false;
}
if (!isOptionalProperty(propName)) {
return true;
}
return schema.maxProperties - propertyAddedCounter - requiredPropertiesToAdd() > 0;
};
if (respectXML) {
addPropertyToResult = function (propName) {let overrideE = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
if (schema && props[propName]) {
// case it is an xml attribute
props[propName].xml = props[propName].xml || {};
if (props[propName].xml.attribute) {
const enumAttrVal = Array.isArray(props[propName].enum) ?
props[propName].enum[0] :
undefined;
const attrExample = props[propName].example;
const attrDefault = props[propName].default;
if (attrExample !== undefined) {
_attr[props[propName].xml.name || propName] = attrExample;
} else if (attrDefault !== undefined) {
_attr[props[propName].xml.name || propName] = attrDefault;
} else if (enumAttrVal !== undefined) {
_attr[props[propName].xml.name || propName] = enumAttrVal;
} else {
_attr[props[propName].xml.name || propName] = primitive(props[propName]);
}
return;
}
props[propName].xml.name = props[propName].xml.name || propName;
} else if (!props[propName] && additionalProperties !== false) {
// case only additionalProperty that is not defined in schema
props[propName] = {
xml: {
name: propName
}
};
}
let t = sampleFromSchemaGeneric(schema && props[propName] || undefined, config, overrideE, respectXML);
if (!canAddProperty(propName)) {
return;
}
propertyAddedCounter++;
if (Array.isArray(t)) {
res[displayName] = res[displayName].concat(t);
} else {
res[displayName].push(t);
}
};
} else {
addPropertyToResult = (propName, overrideE) => {
if (!canAddProperty(propName)) {
return;
}
if (Object.prototype.hasOwnProperty.call(schema, "discriminator") &&
schema.discriminator &&
Object.prototype.hasOwnProperty.call(schema.discriminator, "mapping") &&
schema.discriminator.mapping &&
Object.prototype.hasOwnProperty.call(schema, "$$ref") &&
schema.$$ref &&
schema.discriminator.propertyName === propName) {
for (let pair in schema.discriminator.mapping) {
if (schema.$$ref.search(schema.discriminator.mapping[pair]) !== -1) {
res[propName] = pair;
break;
}
}
} else {
res[propName] = sampleFromSchemaGeneric(props[propName], config, overrideE, respectXML);
}
propertyAddedCounter++;
};
}
// check for plain value and if found use it to generate sample from it
if (usePlainValue) {
let sample;
if (exampleOverride !== undefined) {
sample = sanitizeRef(exampleOverride);
} else if (example !== undefined) {
sample = sanitizeRef(example);
} else {
sample = sanitizeRef(schema.default);
}
// if json just return
if (!respectXML) {
// spacial case yaml parser can not know about
if (typeof sample === "number" && type === "string") {
return `${sample}`;
}
// return if sample does not need any parsing
if (typeof sample !== "string" || type === "string") {
return sample;
}
// check if sample is parsable or just a plain string
try {
return JSON.parse(sample);
} catch (e) {
// sample is just plain string return it
return sample;
}
}
// recover missing type
if (!schema) {
type = Array.isArray(sample) ? "array" : typeof sample;
}
// generate xml sample recursively for array case
if (type === "array") {
if (!Array.isArray(sample)) {
if (typeof sample === "string") {
return sample;
}
sample = [sample];
}
const itemSchema = schema ?
schema.items :
undefined;
if (itemSchema) {
itemSchema.xml = itemSchema.xml || xml || {};
itemSchema.xml.name = itemSchema.xml.name || xml.name;
}
let itemSamples = sample.
map((s) => sampleFromSchemaGeneric(itemSchema, config, s, respectXML));
itemSamples = handleMinMaxItems(itemSamples);
if (xml.wrapped) {
res[displayName] = itemSamples;
if (!(0,isEmpty_namespaceObject["default"])(_attr)) {
res[displayName].push({ _attr: _attr });
}
} else
{
res = itemSamples;
}
return res;
}
// generate xml sample recursively for object case
if (type === "object") {
// case literal example
if (typeof sample === "string") {
return sample;
}
for (let propName in sample) {
if (!Object.prototype.hasOwnProperty.call(sample, propName)) {
continue;
}
if (schema && props[propName] && props[propName].readOnly && !includeReadOnly) {
continue;
}
if (schema && props[propName] && props[propName].writeOnly && !includeWriteOnly) {
continue;
}
if (schema && props[propName] && props[propName].xml && props[propName].xml.attribute) {
_attr[props[propName].xml.name || propName] = sample[propName];
continue;
}
addPropertyToResult(propName, sample[propName]);
}
if (!(0,isEmpty_namespaceObject["default"])(_attr)) {
res[displayName].push({ _attr: _attr });
}
return res;
}
res[displayName] = !(0,isEmpty_namespaceObject["default"])(_attr) ? [{ _attr: _attr }, sample] : sample;
return res;
}
// use schema to generate sample
if (type === "object") {
for (let propName in props) {
if (!Object.prototype.hasOwnProperty.call(props, propName)) {
continue;
}
if (props[propName] && props[propName].deprecated) {
continue;
}
if (props[propName] && props[propName].readOnly && !includeReadOnly) {
continue;
}
if (props[propName] && props[propName].writeOnly && !includeWriteOnly) {
continue;
}
addPropertyToResult(propName);
}
if (respectXML && _attr) {
res[displayName].push({ _attr: _attr });
}
if (hasExceededMaxProperties()) {
return res;
}
if (additionalProperties === true) {
if (respectXML) {
res[displayName].push({ additionalProp: "Anything can be here" });
} else {
res.additionalProp1 = {};
}
propertyAddedCounter++;
} else if (additionalProperties) {
const additionalProps = objectify(additionalProperties);
const additionalPropSample = sampleFromSchemaGeneric(additionalProps, config, undefined, respectXML);
if (respectXML && additionalProps.xml && additionalProps.xml.name && additionalProps.xml.name !== "notagname")
{
res[displayName].push(additionalPropSample);
} else {
const toGenerateCount = schema.minProperties !== null && schema.minProperties !== undefined && propertyAddedCounter < schema.minProperties ?
schema.minProperties - propertyAddedCounter :
3;
for (let i = 1; i <= toGenerateCount; i++) {
if (hasExceededMaxProperties()) {
return res;
}
if (respectXML) {
const temp = {};
temp["additionalProp" + i] = additionalPropSample["notagname"];
res[displayName].push(temp);
} else {
res["additionalProp" + i] = additionalPropSample;
}
propertyAddedCounter++;
}
}
}
return res;
}
if (type === "array") {
if (!items) {
return;
}
let sampleArray;
if (respectXML) {var _schema7;
items.xml = items.xml || ((_schema7 = schema) === null || _schema7 === void 0 ? void 0 : _schema7.xml) || {};
items.xml.name = items.xml.name || xml.name;
}
if (Array.isArray(items.anyOf)) {
sampleArray = items.anyOf.map((i) => sampleFromSchemaGeneric(liftSampleHelper(items, i, config), config, undefined, respectXML));
} else if (Array.isArray(items.oneOf)) {
sampleArray = items.oneOf.map((i) => sampleFromSchemaGeneric(liftSampleHelper(items, i, config), config, undefined, respectXML));
} else if (!respectXML || respectXML && xml.wrapped) {
sampleArray = [sampleFromSchemaGeneric(items, config, undefined, respectXML)];
} else {
return sampleFromSchemaGeneric(items, config, undefined, respectXML);
}
sampleArray = handleMinMaxItems(sampleArray);
if (respectXML && xml.wrapped) {
res[displayName] = sampleArray;
if (!(0,isEmpty_namespaceObject["default"])(_attr)) {
res[displayName].push({ _attr: _attr });
}
return res;
}
return sampleArray;
}
let value;
if (schema && Array.isArray(schema.enum)) {
//display enum first value
value = normalizeArray(schema.enum)[0];
} else if (schema) {
// display schema default
value = primitive(schema);
if (typeof value === "number") {
let min = schema.minimum;
if (min !== undefined && min !== null) {
if (schema.exclusiveMinimum) {
min++;
}
value = min;
}
let max = schema.maximum;
if (max !== undefined && max !== null) {
if (schema.exclusiveMaximum) {
max--;
}
value = max;
}
}
if (typeof value === "string") {
if (schema.maxLength !== null && schema.maxLength !== undefined) {
value = value.slice(0, schema.maxLength);
}
if (schema.minLength !== null && schema.minLength !== undefined) {
let i = 0;
while (value.length < schema.minLength) {
value += value[i++ % value.length];
}
}
}
} else {
return;
}
if (type === "file") {
return;
}
if (respectXML) {
res[displayName] = !(0,isEmpty_namespaceObject["default"])(_attr) ? [{ _attr: _attr }, value] : value;
return res;
}
return value;
};
const inferSchema = (thing) => {
if (thing.schema)
thing = thing.schema;
if (thing.properties) {
thing.type = "object";
}
return thing; // Hopefully this will have something schema like in it... `type` for example
};
const createXMLExample = (schema, config, o) => {
const json = sampleFromSchemaGeneric(schema, config, o, true);
if (!json) {return;}
if (typeof json === "string") {
return json;
}
return (0,external_xml_namespaceObject["default"])(json, { declaration: true, indent: "\t" });
};
const sampleFromSchema = (schema, config, o) =>
sampleFromSchemaGeneric(schema, config, o, false);
const resolver = (arg1, arg2, arg3) => [arg1, JSON.stringify(arg2), JSON.stringify(arg3)];
const memoizedCreateXMLExample = utils_memoizeN(createXMLExample, resolver);
const memoizedSampleFromSchema = utils_memoizeN(sampleFromSchema, resolver);
;// CONCATENATED MODULE: ./src/core/plugins/samples/fn/get-json-sample-schema.js
/**
* @prettier
*/
const shouldStringifyTypesConfig = [
{
when: /json/,
shouldStringifyTypes: ["string"]
}];
const defaultStringifyTypes = ["object"];
const makeGetJsonSampleSchema =
(getSystem) => (schema, config, contentType, exampleOverride) => {
const { fn } = getSystem();
const res = fn.memoizedSampleFromSchema(schema, config, exampleOverride);
const resType = typeof res;
const typesToStringify = shouldStringifyTypesConfig.reduce(
(types, nextConfig) =>
nextConfig.when.test(contentType) ?
[...types, ...nextConfig.shouldStringifyTypes] :
types,
defaultStringifyTypes
);
return (0,some_namespaceObject["default"])(typesToStringify, (x) => x === resType) ?
JSON.stringify(res, null, 2) :
res;
};
/* harmony default export */ const get_json_sample_schema = (makeGetJsonSampleSchema);
;// CONCATENATED MODULE: ./src/core/plugins/samples/fn/get-yaml-sample-schema.js
/**
* @prettier
*/
const makeGetYamlSampleSchema =
(getSystem) => (schema, config, contentType, exampleOverride) => {
const { fn } = getSystem();
const jsonExample = fn.getJsonSampleSchema(
schema,
config,
contentType,
exampleOverride
);
let yamlString;
try {
yamlString = external_js_yaml_namespaceObject["default"].dump(
external_js_yaml_namespaceObject["default"].load(jsonExample),
{
lineWidth: -1 // don't generate line folds
},
{ schema: external_js_yaml_namespaceObject.JSON_SCHEMA }
);
if (yamlString[yamlString.length - 1] === "\n") {
yamlString = yamlString.slice(0, yamlString.length - 1);
}
} catch (e) {
console.error(e);
return "error: could not generate yaml example";
}
return yamlString.replace(/\t/g, " ");
};
/* harmony default export */ const get_yaml_sample_schema = (makeGetYamlSampleSchema);
;// CONCATENATED MODULE: ./src/core/plugins/samples/fn/get-xml-sample-schema.js
/**
* @prettier
*/
const makeGetXmlSampleSchema =
(getSystem) => (schema, config, exampleOverride) => {
const { fn } = getSystem();
if (schema && !schema.xml) {
schema.xml = {};
}
if (schema && !schema.xml.name) {
if (
!schema.$$ref && (
schema.type ||
schema.items ||
schema.properties ||
schema.additionalProperties))
{
// eslint-disable-next-line quotes
return '\n';
}
if (schema.$$ref) {
let match = schema.$$ref.match(/\S*\/(\S+)$/);
schema.xml.name = match[1];
}
}
return fn.memoizedCreateXMLExample(schema, config, exampleOverride);
};
/* harmony default export */ const get_xml_sample_schema = (makeGetXmlSampleSchema);
;// CONCATENATED MODULE: ./src/core/plugins/samples/fn/get-sample-schema.js
/**
* @prettier
*/
const makeGetSampleSchema =
(getSystem) =>
function (schema) {var _schema, _exampleOverride;let contentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};let exampleOverride = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
const { fn } = getSystem();
if (typeof ((_schema = schema) === null || _schema === void 0 ? void 0 : _schema.toJS) === "function") {
schema = schema.toJS();
}
if (typeof ((_exampleOverride = exampleOverride) === null || _exampleOverride === void 0 ? void 0 : _exampleOverride.toJS) === "function") {
exampleOverride = exampleOverride.toJS();
}
if (/xml/.test(contentType)) {
return fn.getXmlSampleSchema(schema, config, exampleOverride);
}
if (/(yaml|yml)/.test(contentType)) {
return fn.getYamlSampleSchema(
schema,
config,
contentType,
exampleOverride
);
}
return fn.getJsonSampleSchema(schema, config, contentType, exampleOverride);
};
/* harmony default export */ const get_sample_schema = (makeGetSampleSchema);
;// CONCATENATED MODULE: ./src/core/plugins/samples/index.js
/**
* @prettier
*/
const SamplesPlugin = (_ref) => {let { getSystem } = _ref;return {
fn: {
inferSchema: inferSchema,
sampleFromSchema: sampleFromSchema,
sampleFromSchemaGeneric: sampleFromSchemaGeneric,
createXMLExample: createXMLExample,
memoizedSampleFromSchema: memoizedSampleFromSchema,
memoizedCreateXMLExample: memoizedCreateXMLExample,
getJsonSampleSchema: get_json_sample_schema(getSystem),
getYamlSampleSchema: get_yaml_sample_schema(getSystem),
getXmlSampleSchema: get_xml_sample_schema(getSystem),
getSampleSchema: get_sample_schema(getSystem)
}
};};
/* harmony default export */ const samples = (SamplesPlugin);
;// CONCATENATED MODULE: ./src/core/plugins/spec/selectors.js
const DEFAULT_TAG = "default";
const OPERATION_METHODS = [
"get", "put", "post", "delete", "options", "head", "patch", "trace"];
const spec_selectors_state = (state) => {
return state || (0,external_immutable_namespaceObject.Map)();
};
const selectors_lastError = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(spec) => spec.get("lastError")
);
const url = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(spec) => spec.get("url")
);
const specStr = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(spec) => spec.get("spec") || ""
);
const specSource = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(spec) => spec.get("specSource") || "not-editor"
);
const specJson = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(spec) => spec.get("json", (0,external_immutable_namespaceObject.Map)())
);
const specJS = (0,external_reselect_namespaceObject.createSelector)(
specJson,
(spec) => spec.toJS()
);
const specResolved = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(spec) => spec.get("resolved", (0,external_immutable_namespaceObject.Map)())
);
const specResolvedSubtree = (state, path) => {
return state.getIn(["resolvedSubtrees", ...path], undefined);
};
const mergerFn = (oldVal, newVal) => {
if (external_immutable_namespaceObject.Map.isMap(oldVal) && external_immutable_namespaceObject.Map.isMap(newVal)) {
if (newVal.get("$$ref")) {
// resolver artifacts indicated that this key was directly resolved
// so we should drop the old value entirely
return newVal;
}
return (0,external_immutable_namespaceObject.OrderedMap)().mergeWith(
mergerFn,
oldVal,
newVal
);
}
return newVal;
};
const specJsonWithResolvedSubtrees = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(spec) => (0,external_immutable_namespaceObject.OrderedMap)().mergeWith(
mergerFn,
spec.get("json"),
spec.get("resolvedSubtrees")
)
);
// Default Spec ( as an object )
const spec = (state) => {
let res = specJson(state);
return res;
};
const isOAS3 = (0,external_reselect_namespaceObject.createSelector)(
// isOAS3 is stubbed out here to work around an issue with injecting more selectors
// in the OAS3 plugin, and to ensure that the function is always available.
// It's not perfect, but our hybrid (core+plugin code) implementation for OAS3
// needs this. //KS
spec,
() => false
);
const info = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => returnSelfOrNewMap(spec && spec.get("info"))
);
const externalDocs = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => returnSelfOrNewMap(spec && spec.get("externalDocs"))
);
const version = (0,external_reselect_namespaceObject.createSelector)(
info,
(info) => info && info.get("version")
);
const semver = (0,external_reselect_namespaceObject.createSelector)(
version,
(version) => /v?([0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(version).slice(1)
);
const paths = (0,external_reselect_namespaceObject.createSelector)(
specJsonWithResolvedSubtrees,
(spec) => spec.get("paths")
);
const validOperationMethods = (0,external_reselect_namespaceObject.createSelector)(() => ["get", "put", "post", "delete", "options", "head", "patch"]);
const operations = (0,external_reselect_namespaceObject.createSelector)(
paths,
(paths) => {
if (!paths || paths.size < 1)
return (0,external_immutable_namespaceObject.List)();
let list = (0,external_immutable_namespaceObject.List)();
if (!paths || !paths.forEach) {
return (0,external_immutable_namespaceObject.List)();
}
paths.forEach((path, pathName) => {
if (!path || !path.forEach) {
return {};
}
path.forEach((operation, method) => {
if (OPERATION_METHODS.indexOf(method) < 0) {
return;
}
list = list.push((0,external_immutable_namespaceObject.fromJS)({
path: pathName,
method,
operation,
id: `${method}-${pathName}`
}));
});
});
return list;
}
);
const consumes = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => (0,external_immutable_namespaceObject.Set)(spec.get("consumes"))
);
const produces = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => (0,external_immutable_namespaceObject.Set)(spec.get("produces"))
);
const security = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => spec.get("security", (0,external_immutable_namespaceObject.List)())
);
const securityDefinitions = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => spec.get("securityDefinitions")
);
const findDefinition = (state, name) => {
const resolvedRes = state.getIn(["resolvedSubtrees", "definitions", name], null);
const unresolvedRes = state.getIn(["json", "definitions", name], null);
return resolvedRes || unresolvedRes || null;
};
const definitions = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => {
const res = spec.get("definitions");
return external_immutable_namespaceObject.Map.isMap(res) ? res : (0,external_immutable_namespaceObject.Map)();
}
);
const basePath = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => spec.get("basePath")
);
const host = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => spec.get("host")
);
const schemes = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => spec.get("schemes", (0,external_immutable_namespaceObject.Map)())
);
const operationsWithRootInherited = (0,external_reselect_namespaceObject.createSelector)(
operations,
consumes,
produces,
(operations, consumes, produces) => {
return operations.map((ops) => ops.update("operation", (op) => {
if (op) {
if (!external_immutable_namespaceObject.Map.isMap(op)) {return;}
return op.withMutations((op) => {
if (!op.get("consumes")) {
op.update("consumes", (a) => (0,external_immutable_namespaceObject.Set)(a).merge(consumes));
}
if (!op.get("produces")) {
op.update("produces", (a) => (0,external_immutable_namespaceObject.Set)(a).merge(produces));
}
return op;
});
} else {
// return something with Immutable methods
return (0,external_immutable_namespaceObject.Map)();
}
}));
}
);
const tags = (0,external_reselect_namespaceObject.createSelector)(
spec,
(json) => {
const tags = json.get("tags", (0,external_immutable_namespaceObject.List)());
return external_immutable_namespaceObject.List.isList(tags) ? tags.filter((tag) => external_immutable_namespaceObject.Map.isMap(tag)) : (0,external_immutable_namespaceObject.List)();
}
);
const tagDetails = (state, tag) => {
let currentTags = tags(state) || (0,external_immutable_namespaceObject.List)();
return currentTags.filter(external_immutable_namespaceObject.Map.isMap).find((t) => t.get("name") === tag, (0,external_immutable_namespaceObject.Map)());
};
const operationsWithTags = (0,external_reselect_namespaceObject.createSelector)(
operationsWithRootInherited,
tags,
(operations, tags) => {
return operations.reduce((taggedMap, op) => {
let tags = (0,external_immutable_namespaceObject.Set)(op.getIn(["operation", "tags"]));
if (tags.count() < 1)
return taggedMap.update(DEFAULT_TAG, (0,external_immutable_namespaceObject.List)(), (ar) => ar.push(op));
return tags.reduce((res, tag) => res.update(tag, (0,external_immutable_namespaceObject.List)(), (ar) => ar.push(op)), taggedMap);
}, tags.reduce((taggedMap, tag) => {
return taggedMap.set(tag.get("name"), (0,external_immutable_namespaceObject.List)());
}, (0,external_immutable_namespaceObject.OrderedMap)()));
}
);
const selectors_taggedOperations = (state) => (_ref) => {let { getConfigs } = _ref;
let { tagsSorter, operationsSorter } = getConfigs();
return operationsWithTags(state).
sortBy(
(val, key) => key, // get the name of the tag to be passed to the sorter
(tagA, tagB) => {
let sortFn = typeof tagsSorter === "function" ? tagsSorter : sorters.tagsSorter[tagsSorter];
return !sortFn ? null : sortFn(tagA, tagB);
}
).
map((ops, tag) => {
let sortFn = typeof operationsSorter === "function" ? operationsSorter : sorters.operationsSorter[operationsSorter];
let operations = !sortFn ? ops : ops.sort(sortFn);
return (0,external_immutable_namespaceObject.Map)({ tagDetails: tagDetails(state, tag), operations: operations });
});
};
const responses = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(state) => state.get("responses", (0,external_immutable_namespaceObject.Map)())
);
const requests = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(state) => state.get("requests", (0,external_immutable_namespaceObject.Map)())
);
const mutatedRequests = (0,external_reselect_namespaceObject.createSelector)(
spec_selectors_state,
(state) => state.get("mutatedRequests", (0,external_immutable_namespaceObject.Map)())
);
const responseFor = (state, path, method) => {
return responses(state).getIn([path, method], null);
};
const requestFor = (state, path, method) => {
return requests(state).getIn([path, method], null);
};
const mutatedRequestFor = (state, path, method) => {
return mutatedRequests(state).getIn([path, method], null);
};
const allowTryItOutFor = () => {
// This is just a hook for now.
return true;
};
const parameterWithMetaByIdentity = (state, pathMethod, param) => {
const opParams = specJsonWithResolvedSubtrees(state).getIn(["paths", ...pathMethod, "parameters"], (0,external_immutable_namespaceObject.OrderedMap)());
const metaParams = state.getIn(["meta", "paths", ...pathMethod, "parameters"], (0,external_immutable_namespaceObject.OrderedMap)());
const mergedParams = opParams.map((currentParam) => {
const inNameKeyedMeta = metaParams.get(`${param.get("in")}.${param.get("name")}`);
const hashKeyedMeta = metaParams.get(`${param.get("in")}.${param.get("name")}.hash-${param.hashCode()}`);
return (0,external_immutable_namespaceObject.OrderedMap)().merge(
currentParam,
inNameKeyedMeta,
hashKeyedMeta
);
});
return mergedParams.find((curr) => curr.get("in") === param.get("in") && curr.get("name") === param.get("name"), (0,external_immutable_namespaceObject.OrderedMap)());
};
const parameterInclusionSettingFor = (state, pathMethod, paramName, paramIn) => {
const paramKey = `${paramIn}.${paramName}`;
return state.getIn(["meta", "paths", ...pathMethod, "parameter_inclusions", paramKey], false);
};
const parameterWithMeta = (state, pathMethod, paramName, paramIn) => {
const opParams = specJsonWithResolvedSubtrees(state).getIn(["paths", ...pathMethod, "parameters"], (0,external_immutable_namespaceObject.OrderedMap)());
const currentParam = opParams.find((param) => param.get("in") === paramIn && param.get("name") === paramName, (0,external_immutable_namespaceObject.OrderedMap)());
return parameterWithMetaByIdentity(state, pathMethod, currentParam);
};
const operationWithMeta = (state, path, method) => {
const op = specJsonWithResolvedSubtrees(state).getIn(["paths", path, method], (0,external_immutable_namespaceObject.OrderedMap)());
const meta = state.getIn(["meta", "paths", path, method], (0,external_immutable_namespaceObject.OrderedMap)());
const mergedParams = op.get("parameters", (0,external_immutable_namespaceObject.List)()).map((param) => {
return parameterWithMetaByIdentity(state, [path, method], param);
});
return (0,external_immutable_namespaceObject.OrderedMap)().
merge(op, meta).
set("parameters", mergedParams);
};
// Get the parameter value by parameter name
function getParameter(state, pathMethod, name, inType) {
pathMethod = pathMethod || [];
let params = state.getIn(["meta", "paths", ...pathMethod, "parameters"], (0,external_immutable_namespaceObject.fromJS)([]));
return params.find((p) => {
return external_immutable_namespaceObject.Map.isMap(p) && p.get("name") === name && p.get("in") === inType;
}) || (0,external_immutable_namespaceObject.Map)(); // Always return a map
}
const hasHost = (0,external_reselect_namespaceObject.createSelector)(
spec,
(spec) => {
const host = spec.get("host");
return typeof host === "string" && host.length > 0 && host[0] !== "/";
}
);
// Get the parameter values, that the user filled out
function parameterValues(state, pathMethod, isXml) {
pathMethod = pathMethod || [];
let paramValues = operationWithMeta(state, ...pathMethod).get("parameters", (0,external_immutable_namespaceObject.List)());
return paramValues.reduce((hash, p) => {
let value = isXml && p.get("in") === "body" ? p.get("value_xml") : p.get("value");
return hash.set(paramToIdentifier(p, { allowHashes: false }), value);
}, (0,external_immutable_namespaceObject.fromJS)({}));
}
// True if any parameter includes `in: ?`
function parametersIncludeIn(parameters) {let inValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
if (external_immutable_namespaceObject.List.isList(parameters)) {
return parameters.some((p) => external_immutable_namespaceObject.Map.isMap(p) && p.get("in") === inValue);
}
}
// True if any parameter includes `type: ?`
function parametersIncludeType(parameters) {let typeValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
if (external_immutable_namespaceObject.List.isList(parameters)) {
return parameters.some((p) => external_immutable_namespaceObject.Map.isMap(p) && p.get("type") === typeValue);
}
}
// Get the consumes/produces value that the user selected
function contentTypeValues(state, pathMethod) {
pathMethod = pathMethod || [];
let op = specJsonWithResolvedSubtrees(state).getIn(["paths", ...pathMethod], (0,external_immutable_namespaceObject.fromJS)({}));
let meta = state.getIn(["meta", "paths", ...pathMethod], (0,external_immutable_namespaceObject.fromJS)({}));
let producesValue = currentProducesFor(state, pathMethod);
const parameters = op.get("parameters") || new external_immutable_namespaceObject.List();
const requestContentType =
meta.get("consumes_value") ? meta.get("consumes_value") :
parametersIncludeType(parameters, "file") ? "multipart/form-data" :
parametersIncludeType(parameters, "formData") ? "application/x-www-form-urlencoded" :
undefined;
return (0,external_immutable_namespaceObject.fromJS)({
requestContentType,
responseContentType: producesValue
});
}
// Get the currently selected produces value for an operation
function currentProducesFor(state, pathMethod) {
pathMethod = pathMethod || [];
const operation = specJsonWithResolvedSubtrees(state).getIn(["paths", ...pathMethod], null);
if (operation === null) {
// return nothing if the operation does not exist
return;
}
const currentProducesValue = state.getIn(["meta", "paths", ...pathMethod, "produces_value"], null);
const firstProducesArrayItem = operation.getIn(["produces", 0], null);
return currentProducesValue || firstProducesArrayItem || "application/json";
}
// Get the produces options for an operation
function producesOptionsFor(state, pathMethod) {
pathMethod = pathMethod || [];
const spec = specJsonWithResolvedSubtrees(state);
const operation = spec.getIn(["paths", ...pathMethod], null);
if (operation === null) {
// return nothing if the operation does not exist
return;
}
const [path] = pathMethod;
const operationProduces = operation.get("produces", null);
const pathItemProduces = spec.getIn(["paths", path, "produces"], null);
const globalProduces = spec.getIn(["produces"], null);
return operationProduces || pathItemProduces || globalProduces;
}
// Get the consumes options for an operation
function consumesOptionsFor(state, pathMethod) {
pathMethod = pathMethod || [];
const spec = specJsonWithResolvedSubtrees(state);
const operation = spec.getIn(["paths", ...pathMethod], null);
if (operation === null) {
// return nothing if the operation does not exist
return;
}
const [path] = pathMethod;
const operationConsumes = operation.get("consumes", null);
const pathItemConsumes = spec.getIn(["paths", path, "consumes"], null);
const globalConsumes = spec.getIn(["consumes"], null);
return operationConsumes || pathItemConsumes || globalConsumes;
}
const operationScheme = (state, path, method) => {
let url = state.get("url");
let matchResult = url.match(/^([a-z][a-z0-9+\-.]*):/);
let urlScheme = Array.isArray(matchResult) ? matchResult[1] : null;
return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || urlScheme || "";
};
const canExecuteScheme = (state, path, method) => {
return ["http", "https"].indexOf(operationScheme(state, path, method)) > -1;
};
const validationErrors = (state, pathMethod) => {
pathMethod = pathMethod || [];
let paramValues = state.getIn(["meta", "paths", ...pathMethod, "parameters"], (0,external_immutable_namespaceObject.fromJS)([]));
const result = [];
paramValues.forEach((p) => {
let errors = p.get("errors");
if (errors && errors.count()) {
errors.forEach((e) => result.push(e));
}
});
return result;
};
const validateBeforeExecute = (state, pathMethod) => {
return validationErrors(state, pathMethod).length === 0;
};
const getOAS3RequiredRequestBodyContentType = (state, pathMethod) => {
let requiredObj = {
requestBody: false,
requestContentType: {}
};
let requestBody = state.getIn(["resolvedSubtrees", "paths", ...pathMethod, "requestBody"], (0,external_immutable_namespaceObject.fromJS)([]));
if (requestBody.size < 1) {
return requiredObj;
}
if (requestBody.getIn(["required"])) {
requiredObj.requestBody = requestBody.getIn(["required"]);
}
requestBody.getIn(["content"]).entrySeq().forEach((contentType) => {// e.g application/json
const key = contentType[0];
if (contentType[1].getIn(["schema", "required"])) {
const val = contentType[1].getIn(["schema", "required"]).toJS();
requiredObj.requestContentType[key] = val;
}
});
return requiredObj;
};
const isMediaTypeSchemaPropertiesEqual = (state, pathMethod, currentMediaType, targetMediaType) => {
if ((currentMediaType || targetMediaType) && currentMediaType === targetMediaType) {
return true;
}
let requestBodyContent = state.getIn(["resolvedSubtrees", "paths", ...pathMethod, "requestBody", "content"], (0,external_immutable_namespaceObject.fromJS)([]));
if (requestBodyContent.size < 2 || !currentMediaType || !targetMediaType) {
// nothing to compare
return false;
}
let currentMediaTypeSchemaProperties = requestBodyContent.getIn([currentMediaType, "schema", "properties"], (0,external_immutable_namespaceObject.fromJS)([]));
let targetMediaTypeSchemaProperties = requestBodyContent.getIn([targetMediaType, "schema", "properties"], (0,external_immutable_namespaceObject.fromJS)([]));
return !!currentMediaTypeSchemaProperties.equals(targetMediaTypeSchemaProperties);
};
function returnSelfOrNewMap(obj) {
// returns obj if obj is an Immutable map, else returns a new Map
return external_immutable_namespaceObject.Map.isMap(obj) ? obj : new external_immutable_namespaceObject.Map();
}
;// CONCATENATED MODULE: external "lodash/isString"
var isString_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var isString_y = x => () => x
const isString_namespaceObject = isString_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isString_e6fa8a5b__["default"] });
;// CONCATENATED MODULE: external "lodash/debounce"
var debounce_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var debounce_y = x => () => x
const debounce_namespaceObject = debounce_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_debounce_3540babe__["default"] });
;// CONCATENATED MODULE: external "lodash/set"
var set_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var set_y = x => () => x
const set_namespaceObject = set_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_set_b4b15ee5__["default"] });
;// CONCATENATED MODULE: external "lodash/fp/assocPath"
var assocPath_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var assocPath_y = x => () => x
const assocPath_namespaceObject = assocPath_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_fp_assocPath_f9d64e33__["default"] });
;// CONCATENATED MODULE: external "lodash/constant"
var constant_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var constant_y = x => () => x
const constant_namespaceObject = constant_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_constant_f5c0879f__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/spec/actions.js
const actions_excluded = ["path", "method"];
// Actions conform to FSA (flux-standard-actions)
// {type: string,payload: Any|Error, meta: obj, error: bool}
const UPDATE_SPEC = "spec_update_spec";
const UPDATE_URL = "spec_update_url";
const UPDATE_JSON = "spec_update_json";
const UPDATE_PARAM = "spec_update_param";
const UPDATE_EMPTY_PARAM_INCLUSION = "spec_update_empty_param_inclusion";
const VALIDATE_PARAMS = "spec_validate_param";
const SET_RESPONSE = "spec_set_response";
const SET_REQUEST = "spec_set_request";
const SET_MUTATED_REQUEST = "spec_set_mutated_request";
const LOG_REQUEST = "spec_log_request";
const CLEAR_RESPONSE = "spec_clear_response";
const CLEAR_REQUEST = "spec_clear_request";
const CLEAR_VALIDATE_PARAMS = "spec_clear_validate_param";
const UPDATE_OPERATION_META_VALUE = "spec_update_operation_meta_value";
const UPDATE_RESOLVED = "spec_update_resolved";
const UPDATE_RESOLVED_SUBTREE = "spec_update_resolved_subtree";
const SET_SCHEME = "set_scheme";
const toStr = (str) => (0,isString_namespaceObject["default"])(str) ? str : "";
function updateSpec(spec) {
const cleanSpec = toStr(spec).replace(/\t/g, " ");
if (typeof spec === "string") {
return {
type: UPDATE_SPEC,
payload: cleanSpec
};
}
}
function updateResolved(spec) {
return {
type: UPDATE_RESOLVED,
payload: spec
};
}
function updateUrl(url) {
return { type: UPDATE_URL, payload: url };
}
function updateJsonSpec(json) {
return { type: UPDATE_JSON, payload: json };
}
const parseToJson = (str) => (_ref) => {let { specActions, specSelectors, errActions } = _ref;
let { specStr } = specSelectors;
let json = null;
try {
str = str || specStr();
errActions.clear({ source: "parser" });
json = external_js_yaml_namespaceObject["default"].load(str, { schema: external_js_yaml_namespaceObject.JSON_SCHEMA });
} catch (e) {
// TODO: push error to state
console.error(e);
return errActions.newSpecErr({
source: "parser",
level: "error",
message: e.reason,
line: e.mark && e.mark.line ? e.mark.line + 1 : undefined
});
}
if (json && typeof json === "object") {
return specActions.updateJsonSpec(json);
}
return {};
};
let hasWarnedAboutResolveSpecDeprecation = false;
const resolveSpec = (json, url) => (_ref2) => {let { specActions, specSelectors, errActions, fn: { fetch, resolve, AST = {} }, getConfigs } = _ref2;
if (!hasWarnedAboutResolveSpecDeprecation) {
console.warn(`specActions.resolveSpec is deprecated since v3.10.0 and will be removed in v4.0.0; use requestResolvedSubtree instead!`);
hasWarnedAboutResolveSpecDeprecation = true;
}
const {
modelPropertyMacro,
parameterMacro,
requestInterceptor,
responseInterceptor
} = getConfigs();
if (typeof json === "undefined") {
json = specSelectors.specJson();
}
if (typeof url === "undefined") {
url = specSelectors.url();
}
let getLineNumberForPath = AST.getLineNumberForPath ? AST.getLineNumberForPath : () => undefined;
let specStr = specSelectors.specStr();
return resolve({
fetch,
spec: json,
baseDoc: url,
modelPropertyMacro,
parameterMacro,
requestInterceptor,
responseInterceptor
}).then((_ref3) => {let { spec, errors } = _ref3;
errActions.clear({
type: "thrown"
});
if (Array.isArray(errors) && errors.length > 0) {
let preparedErrors = errors.
map((err) => {
console.error(err);
err.line = err.fullPath ? getLineNumberForPath(specStr, err.fullPath) : null;
err.path = err.fullPath ? err.fullPath.join(".") : null;
err.level = "error";
err.type = "thrown";
err.source = "resolver";
Object.defineProperty(err, "message", { enumerable: true, value: err.message });
return err;
});
errActions.newThrownErrBatch(preparedErrors);
}
return specActions.updateResolved(spec);
});
};
let requestBatch = [];
const debResolveSubtrees = (0,debounce_namespaceObject["default"])(() => {
const systemPartitionedBatches = requestBatch.reduce((acc, _ref4) => {let { path, system } = _ref4;
if (!acc.has(system)) acc.set(system, []);
acc.get(system).push(path);
return acc;
}, new Map());
requestBatch = []; // clear stack
systemPartitionedBatches.forEach(async (systemRequestBatch, system) => {var _AST$getLineNumberFor;
if (!system) {
console.error("debResolveSubtrees: don't have a system to operate on, aborting.");
return;
}
if (!system.fn.resolveSubtree) {
console.error("Error: Swagger-Client did not provide a `resolveSubtree` method, doing nothing.");
return;
}
const {
errActions,
errSelectors,
fn: {
resolveSubtree,
fetch,
AST = {}
},
specSelectors,
specActions
} = system;
const getLineNumberForPath = (_AST$getLineNumberFor = AST.getLineNumberForPath) !== null && _AST$getLineNumberFor !== void 0 ? _AST$getLineNumberFor : (0,constant_namespaceObject["default"])(undefined);
const specStr = specSelectors.specStr();
const {
modelPropertyMacro,
parameterMacro,
requestInterceptor,
responseInterceptor
} = system.getConfigs();
try {
const batchResult = await systemRequestBatch.reduce(async (prev, path) => {
let { resultMap, specWithCurrentSubtrees } = await prev;
const { errors, spec } = await resolveSubtree(specWithCurrentSubtrees, path, {
baseDoc: specSelectors.url(),
modelPropertyMacro,
parameterMacro,
requestInterceptor,
responseInterceptor
});
if (errSelectors.allErrors().size) {
errActions.clearBy((err) => {
// keep if...
return err.get("type") !== "thrown" // it's not a thrown error
|| err.get("source") !== "resolver" // it's not a resolver error
|| !err.get("fullPath").every((key, i) => key === path[i] || path[i] === undefined); // it's not within the path we're resolving
});
}
if (Array.isArray(errors) && errors.length > 0) {
let preparedErrors = errors.
map((err) => {
err.line = err.fullPath ? getLineNumberForPath(specStr, err.fullPath) : null;
err.path = err.fullPath ? err.fullPath.join(".") : null;
err.level = "error";
err.type = "thrown";
err.source = "resolver";
Object.defineProperty(err, "message", { enumerable: true, value: err.message });
return err;
});
errActions.newThrownErrBatch(preparedErrors);
}
if (spec && specSelectors.isOAS3() && path[0] === "components" && path[1] === "securitySchemes") {
// Resolve OIDC URLs if present
await Promise.all(Object.values(spec).
filter((scheme) => scheme.type === "openIdConnect").
map(async (oidcScheme) => {
const req = {
url: oidcScheme.openIdConnectUrl,
requestInterceptor: requestInterceptor,
responseInterceptor: responseInterceptor
};
try {
const res = await fetch(req);
if (res instanceof Error || res.status >= 400) {
console.error(res.statusText + " " + req.url);
} else {
oidcScheme.openIdConnectData = JSON.parse(res.text);
}
} catch (e) {
console.error(e);
}
}));
}
(0,set_namespaceObject["default"])(resultMap, path, spec);
specWithCurrentSubtrees = (0,assocPath_namespaceObject["default"])(path, spec, specWithCurrentSubtrees);
return {
resultMap,
specWithCurrentSubtrees
};
}, Promise.resolve({
resultMap: (specSelectors.specResolvedSubtree([]) || (0,external_immutable_namespaceObject.Map)()).toJS(),
specWithCurrentSubtrees: specSelectors.specJS()
}));
specActions.updateResolvedSubtree([], batchResult.resultMap);
} catch (e) {
console.error(e);
}
});
}, 35);
const requestResolvedSubtree = (path) => (system) => {
const isPathAlreadyBatched = requestBatch.find((_ref5) => {let { path: batchedPath, system: batchedSystem } = _ref5;
return batchedSystem === system && batchedPath.toString() === path.toString();
});
if (isPathAlreadyBatched) {
return;
}
requestBatch.push({ path, system });
debResolveSubtrees();
};
function changeParam(path, paramName, paramIn, value, isXml) {
return {
type: UPDATE_PARAM,
payload: { path, value, paramName, paramIn, isXml }
};
}
function changeParamByIdentity(pathMethod, param, value, isXml) {
return {
type: UPDATE_PARAM,
payload: { path: pathMethod, param, value, isXml }
};
}
const updateResolvedSubtree = (path, value) => {
return {
type: UPDATE_RESOLVED_SUBTREE,
payload: { path, value }
};
};
const invalidateResolvedSubtreeCache = () => {
return {
type: UPDATE_RESOLVED_SUBTREE,
payload: {
path: [],
value: (0,external_immutable_namespaceObject.Map)()
}
};
};
const validateParams = (payload, isOAS3) => {
return {
type: VALIDATE_PARAMS,
payload: {
pathMethod: payload,
isOAS3
}
};
};
const updateEmptyParamInclusion = (pathMethod, paramName, paramIn, includeEmptyValue) => {
return {
type: UPDATE_EMPTY_PARAM_INCLUSION,
payload: {
pathMethod,
paramName,
paramIn,
includeEmptyValue
}
};
};
function clearValidateParams(payload) {
return {
type: CLEAR_VALIDATE_PARAMS,
payload: { pathMethod: payload }
};
}
function changeConsumesValue(path, value) {
return {
type: UPDATE_OPERATION_META_VALUE,
payload: { path, value, key: "consumes_value" }
};
}
function changeProducesValue(path, value) {
return {
type: UPDATE_OPERATION_META_VALUE,
payload: { path, value, key: "produces_value" }
};
}
const setResponse = (path, method, res) => {
return {
payload: { path, method, res },
type: SET_RESPONSE
};
};
const setRequest = (path, method, req) => {
return {
payload: { path, method, req },
type: SET_REQUEST
};
};
const setMutatedRequest = (path, method, req) => {
return {
payload: { path, method, req },
type: SET_MUTATED_REQUEST
};
};
// This is for debugging, remove this comment if you depend on this action
const logRequest = (req) => {
return {
payload: req,
type: LOG_REQUEST
};
};
// Actually fire the request via fn.execute
// (For debugging) and ease of testing
const executeRequest = (req) =>
(_ref6) => {let { fn, specActions, specSelectors, getConfigs, oas3Selectors } = _ref6;
let { pathName, method, operation } = req;
let { requestInterceptor, responseInterceptor } = getConfigs();
let op = operation.toJS();
// ensure that explicitly-included params are in the request
if (operation && operation.get("parameters")) {
operation.get("parameters").
filter((param) => param && param.get("allowEmptyValue") === true).
forEach((param) => {
if (specSelectors.parameterInclusionSettingFor([pathName, method], param.get("name"), param.get("in"))) {
req.parameters = req.parameters || {};
const paramValue = paramToValue(param, req.parameters);
// if the value is falsy or an empty Immutable iterable...
if (!paramValue || paramValue && paramValue.size === 0) {
// set it to empty string, so Swagger Client will treat it as
// present but empty.
req.parameters[param.get("name")] = "";
}
}
});
}
// if url is relative, parseUrl makes it absolute by inferring from `window.location`
req.contextUrl = (0,external_url_parse_namespaceObject["default"])(specSelectors.url()).toString();
if (op && op.operationId) {
req.operationId = op.operationId;
} else if (op && pathName && method) {
req.operationId = fn.opId(op, pathName, method);
}
if (specSelectors.isOAS3()) {
const namespace = `${pathName}:${method}`;
req.server = oas3Selectors.selectedServer(namespace) || oas3Selectors.selectedServer();
const namespaceVariables = oas3Selectors.serverVariables({
server: req.server,
namespace
}).toJS();
const globalVariables = oas3Selectors.serverVariables({ server: req.server }).toJS();
req.serverVariables = Object.keys(namespaceVariables).length ? namespaceVariables : globalVariables;
req.requestContentType = oas3Selectors.requestContentType(pathName, method);
req.responseContentType = oas3Selectors.responseContentType(pathName, method) || "*/*";
const requestBody = oas3Selectors.requestBodyValue(pathName, method);
const requestBodyInclusionSetting = oas3Selectors.requestBodyInclusionSetting(pathName, method);
if (requestBody && requestBody.toJS) {
req.requestBody = requestBody.
map(
(val) => {
if (external_immutable_namespaceObject.Map.isMap(val)) {
return val.get("value");
}
return val;
}
).
filter(
(value, key) => (Array.isArray(value) ?
value.length !== 0 :
!isEmptyValue(value)) ||
requestBodyInclusionSetting.get(key)
).
toJS();
} else {
req.requestBody = requestBody;
}
}
let parsedRequest = Object.assign({}, req);
parsedRequest = fn.buildRequest(parsedRequest);
specActions.setRequest(req.pathName, req.method, parsedRequest);
let requestInterceptorWrapper = async (r) => {
let mutatedRequest = await requestInterceptor.apply(undefined, [r]);
let parsedMutatedRequest = Object.assign({}, mutatedRequest);
specActions.setMutatedRequest(req.pathName, req.method, parsedMutatedRequest);
return mutatedRequest;
};
req.requestInterceptor = requestInterceptorWrapper;
req.responseInterceptor = responseInterceptor;
// track duration of request
const startTime = Date.now();
return fn.execute(req).
then((res) => {
res.duration = Date.now() - startTime;
specActions.setResponse(req.pathName, req.method, res);
}).
catch(
(err) => {
// console.error(err)
if (err.message === "Failed to fetch") {
err.name = "";
err.message = "**Failed to fetch.** \n**Possible Reasons:** \n - CORS \n - Network Failure \n - URL scheme must be \"http\" or \"https\" for CORS request.";
}
specActions.setResponse(req.pathName, req.method, {
error: true, err: (0,external_serialize_error_namespaceObject.serializeError)(err)
});
}
);
};
// I'm using extras as a way to inject properties into the final, `execute` method - It's not great. Anyone have a better idea? @ponelat
const actions_execute = function () {let _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};let { path, method } = _ref7,extras = (0,objectWithoutProperties_namespaceObject["default"])(_ref7, actions_excluded);return (system) => {
let { fn: { fetch }, specSelectors, specActions } = system;
let spec = specSelectors.specJsonWithResolvedSubtrees().toJS();
let scheme = specSelectors.operationScheme(path, method);
let { requestContentType, responseContentType } = specSelectors.contentTypeValues([path, method]).toJS();
let isXml = /xml/i.test(requestContentType);
let parameters = specSelectors.parameterValues([path, method], isXml).toJS();
return specActions.executeRequest((0,objectSpread2_namespaceObject["default"])((0,objectSpread2_namespaceObject["default"])({},
extras), {}, {
fetch,
spec,
pathName: path,
method, parameters,
requestContentType,
scheme,
responseContentType })
);
};};
function clearResponse(path, method) {
return {
type: CLEAR_RESPONSE,
payload: { path, method }
};
}
function clearRequest(path, method) {
return {
type: CLEAR_REQUEST,
payload: { path, method }
};
}
function setScheme(scheme, path, method) {
return {
type: SET_SCHEME,
payload: { scheme, path, method }
};
}
;// CONCATENATED MODULE: ./src/core/plugins/spec/reducers.js
// selector-in-reducer is suboptimal, but `operationWithMeta` is more of a helper
/* harmony default export */ const spec_reducers = ({
[UPDATE_SPEC]: (state, action) => {
return typeof action.payload === "string" ?
state.set("spec", action.payload) :
state;
},
[UPDATE_URL]: (state, action) => {
return state.set("url", action.payload + "");
},
[UPDATE_JSON]: (state, action) => {
return state.set("json", fromJSOrdered(action.payload));
},
[UPDATE_RESOLVED]: (state, action) => {
return state.setIn(["resolved"], fromJSOrdered(action.payload));
},
[UPDATE_RESOLVED_SUBTREE]: (state, action) => {
const { value, path } = action.payload;
return state.setIn(["resolvedSubtrees", ...path], fromJSOrdered(value));
},
[UPDATE_PARAM]: (state, _ref) => {let { payload } = _ref;
let { path: pathMethod, paramName, paramIn, param, value, isXml } = payload;
let paramKey = param ? paramToIdentifier(param) : `${paramIn}.${paramName}`;
const valueKey = isXml ? "value_xml" : "value";
return state.setIn(
["meta", "paths", ...pathMethod, "parameters", paramKey, valueKey],
value
);
},
[UPDATE_EMPTY_PARAM_INCLUSION]: (state, _ref2) => {let { payload } = _ref2;
let { pathMethod, paramName, paramIn, includeEmptyValue } = payload;
if (!paramName || !paramIn) {
console.warn("Warning: UPDATE_EMPTY_PARAM_INCLUSION could not generate a paramKey.");
return state;
}
const paramKey = `${paramIn}.${paramName}`;
return state.setIn(
["meta", "paths", ...pathMethod, "parameter_inclusions", paramKey],
includeEmptyValue
);
},
[VALIDATE_PARAMS]: (state, _ref3) => {let { payload: { pathMethod, isOAS3 } } = _ref3;
const op = specJsonWithResolvedSubtrees(state).getIn(["paths", ...pathMethod]);
const paramValues = parameterValues(state, pathMethod).toJS();
return state.updateIn(["meta", "paths", ...pathMethod, "parameters"], (0,external_immutable_namespaceObject.fromJS)({}), (paramMeta) => {
return op.get("parameters", (0,external_immutable_namespaceObject.List)()).reduce((res, param) => {
const value = paramToValue(param, paramValues);
const isEmptyValueIncluded = parameterInclusionSettingFor(state, pathMethod, param.get("name"), param.get("in"));
const errors = validateParam(param, value, {
bypassRequiredCheck: isEmptyValueIncluded,
isOAS3
});
return res.setIn([paramToIdentifier(param), "errors"], (0,external_immutable_namespaceObject.fromJS)(errors));
}, paramMeta);
});
},
[CLEAR_VALIDATE_PARAMS]: (state, _ref4) => {let { payload: { pathMethod } } = _ref4;
return state.updateIn(["meta", "paths", ...pathMethod, "parameters"], (0,external_immutable_namespaceObject.fromJS)([]), (parameters) => {
return parameters.map((param) => param.set("errors", (0,external_immutable_namespaceObject.fromJS)([])));
});
},
[SET_RESPONSE]: (state, _ref5) => {let { payload: { res, path, method } } = _ref5;
let result;
if (res.error) {
result = Object.assign({
error: true,
name: res.err.name,
message: res.err.message,
statusCode: res.err.statusCode
}, res.err.response);
} else {
result = res;
}
// Ensure headers
result.headers = result.headers || {};
let newState = state.setIn(["responses", path, method], fromJSOrdered(result));
// ImmutableJS messes up Blob. Needs to reset its value.
if (core_window.Blob && res.data instanceof core_window.Blob) {
newState = newState.setIn(["responses", path, method, "text"], res.data);
}
return newState;
},
[SET_REQUEST]: (state, _ref6) => {let { payload: { req, path, method } } = _ref6;
return state.setIn(["requests", path, method], fromJSOrdered(req));
},
[SET_MUTATED_REQUEST]: (state, _ref7) => {let { payload: { req, path, method } } = _ref7;
return state.setIn(["mutatedRequests", path, method], fromJSOrdered(req));
},
[UPDATE_OPERATION_META_VALUE]: (state, _ref8) => {let { payload: { path, value, key } } = _ref8;
// path is a pathMethod tuple... can't change the name now.
let operationPath = ["paths", ...path];
let metaPath = ["meta", "paths", ...path];
if (
!state.getIn(["json", ...operationPath]) &&
!state.getIn(["resolved", ...operationPath]) &&
!state.getIn(["resolvedSubtrees", ...operationPath]))
{
// do nothing if the operation does not exist
return state;
}
return state.setIn([...metaPath, key], (0,external_immutable_namespaceObject.fromJS)(value));
},
[CLEAR_RESPONSE]: (state, _ref9) => {let { payload: { path, method } } = _ref9;
return state.deleteIn(["responses", path, method]);
},
[CLEAR_REQUEST]: (state, _ref10) => {let { payload: { path, method } } = _ref10;
return state.deleteIn(["requests", path, method]);
},
[SET_SCHEME]: (state, _ref11) => {let { payload: { scheme, path, method } } = _ref11;
if (path && method) {
return state.setIn(["scheme", path, method], scheme);
}
if (!path && !method) {
return state.setIn(["scheme", "_defaultScheme"], scheme);
}
}
});
;// CONCATENATED MODULE: ./src/core/plugins/spec/wrap-actions.js
const wrap_actions_updateSpec = (ori, _ref) => {let { specActions } = _ref;return function () {
ori(...arguments);
specActions.parseToJson(...arguments);
};};
const wrap_actions_updateJsonSpec = (ori, _ref2) => {let { specActions } = _ref2;return function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}
ori(...args);
specActions.invalidateResolvedSubtreeCache();
// Trigger resolution of any path-level $refs.
const [json] = args;
const pathItems = (0,get_namespaceObject["default"])(json, ["paths"]) || {};
const pathItemKeys = Object.keys(pathItems);
pathItemKeys.forEach((k) => {
const val = (0,get_namespaceObject["default"])(pathItems, [k]);
if (val.$ref) {
specActions.requestResolvedSubtree(["paths", k]);
}
});
// Trigger resolution of any securitySchemes-level $refs.
specActions.requestResolvedSubtree(["components", "securitySchemes"]);
};};
// Log the request ( just for debugging, shouldn't affect prod )
const wrap_actions_executeRequest = (ori, _ref3) => {let { specActions } = _ref3;return (req) => {
specActions.logRequest(req);
return ori(req);
};};
const wrap_actions_validateParams = (ori, _ref4) => {let { specSelectors } = _ref4;return (req) => {
return ori(req, specSelectors.isOAS3());
};};
;// CONCATENATED MODULE: ./src/core/plugins/spec/index.js
/**
* @prettier
*/
const SpecPlugin = () => ({
statePlugins: {
spec: {
wrapActions: (0,objectSpread2_namespaceObject["default"])({}, spec_wrap_actions_namespaceObject),
reducers: (0,objectSpread2_namespaceObject["default"])({}, spec_reducers),
actions: (0,objectSpread2_namespaceObject["default"])({}, plugins_spec_actions_namespaceObject),
selectors: (0,objectSpread2_namespaceObject["default"])({}, spec_selectors_namespaceObject)
}
}
});
/* harmony default export */ const plugins_spec = (SpecPlugin);
;// CONCATENATED MODULE: external "swagger-client/es/resolver/strategies/generic"
var generic_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var generic_y = x => () => x
const generic_namespaceObject = generic_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_strategies_generic_08dd5200__["default"] });
;// CONCATENATED MODULE: external "swagger-client/es/resolver/strategies/openapi-2"
var openapi_2_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var openapi_2_y = x => () => x
const openapi_2_namespaceObject = openapi_2_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_strategies_openapi_2_ff6e79cf__["default"] });
;// CONCATENATED MODULE: external "swagger-client/es/resolver/strategies/openapi-3-0"
var openapi_3_0_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var openapi_3_0_y = x => () => x
const openapi_3_0_namespaceObject = openapi_3_0_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_strategies_openapi_3_0_2fa0ff7c__["default"] });
;// CONCATENATED MODULE: external "swagger-client/es/resolver/strategies/openapi-3-1-apidom"
var openapi_3_1_apidom_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var openapi_3_1_apidom_y = x => () => x
const openapi_3_1_apidom_namespaceObject = openapi_3_1_apidom_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_strategies_openapi_3_1_apidom_5e628d39__["default"] });
;// CONCATENATED MODULE: external "swagger-client/es/resolver"
var resolver_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var resolver_y = x => () => x
const resolver_namespaceObject = resolver_x({ ["makeResolve"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_resolver_f879c638__.makeResolve });
;// CONCATENATED MODULE: external "swagger-client/es/execute"
var execute_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var execute_y = x => () => x
const execute_namespaceObject = execute_x({ ["buildRequest"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_execute_d486d3d6__.buildRequest, ["execute"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_execute_d486d3d6__.execute });
;// CONCATENATED MODULE: external "swagger-client/es/http"
var es_http_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var es_http_y = x => () => x
const es_http_namespaceObject = es_http_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_http_69655560__["default"], ["makeHttp"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_http_69655560__.makeHttp, ["serializeRes"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_http_69655560__.serializeRes });
;// CONCATENATED MODULE: external "swagger-client/es/subtree-resolver"
var subtree_resolver_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var subtree_resolver_y = x => () => x
const subtree_resolver_namespaceObject = subtree_resolver_x({ ["makeResolveSubtree"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_subtree_resolver_741cb9d9__.makeResolveSubtree });
;// CONCATENATED MODULE: external "swagger-client/es/helpers"
var helpers_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var helpers_y = x => () => x
const es_helpers_namespaceObject = helpers_x({ ["opId"]: () => __WEBPACK_EXTERNAL_MODULE_swagger_client_es_helpers_4d7bea47__.opId });
;// CONCATENATED MODULE: ./src/core/plugins/swagger-client/configs-wrap-actions.js
const configs_wrap_actions_loaded = (ori, system) => function () {
ori(...arguments);
const value = system.getConfigs().withCredentials;
if (value !== undefined) {
system.fn.fetch.withCredentials = typeof value === "string" ? value === "true" : !!value;
}
};
;// CONCATENATED MODULE: ./src/core/plugins/swagger-client/index.js
/* harmony default export */ function swagger_client(_ref) {let { configs, getConfigs } = _ref;
return {
fn: {
fetch: (0,es_http_namespaceObject.makeHttp)(es_http_namespaceObject["default"], configs.preFetch, configs.postFetch),
buildRequest: execute_namespaceObject.buildRequest,
execute: execute_namespaceObject.execute,
resolve: (0,resolver_namespaceObject.makeResolve)({
strategies: [
openapi_3_1_apidom_namespaceObject["default"],
openapi_3_0_namespaceObject["default"],
openapi_2_namespaceObject["default"],
generic_namespaceObject["default"]]
}),
resolveSubtree: async function (obj, path) {let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
const freshConfigs = getConfigs();
const defaultOptions = {
modelPropertyMacro: freshConfigs.modelPropertyMacro,
parameterMacro: freshConfigs.parameterMacro,
requestInterceptor: freshConfigs.requestInterceptor,
responseInterceptor: freshConfigs.responseInterceptor,
strategies: [
openapi_3_1_apidom_namespaceObject["default"],
openapi_3_0_namespaceObject["default"],
openapi_2_namespaceObject["default"],
generic_namespaceObject["default"]]
};
return (0,subtree_resolver_namespaceObject.makeResolveSubtree)(defaultOptions)(obj, path, options);
},
serializeRes: es_http_namespaceObject.serializeRes,
opId: es_helpers_namespaceObject.opId
},
statePlugins: {
configs: {
wrapActions: {
loaded: configs_wrap_actions_loaded
}
}
}
};
}
;// CONCATENATED MODULE: ./src/core/plugins/util/index.js
/* harmony default export */ function util() {
return {
fn: { shallowEqualKeys: shallowEqualKeys }
};
}
;// CONCATENATED MODULE: external "react-dom"
var external_react_dom_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_react_dom_y = x => () => x
const external_react_dom_namespaceObject = external_react_dom_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_dom_7dac9eee__["default"] });
;// CONCATENATED MODULE: external "react-redux"
var external_react_redux_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_react_redux_y = x => () => x
const external_react_redux_namespaceObject = external_react_redux_x({ ["Provider"]: () => __WEBPACK_EXTERNAL_MODULE_react_redux_87be03b0__.Provider, ["connect"]: () => __WEBPACK_EXTERNAL_MODULE_react_redux_87be03b0__.connect });
;// CONCATENATED MODULE: external "lodash/identity"
var identity_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var identity_y = x => () => x
const identity_namespaceObject = identity_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_identity_75ffe4a7__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/view/root-injects.jsx
const withSystem = (getSystem) => (WrappedComponent) => {
const { fn } = getSystem();
class WithSystem extends external_react_namespaceObject.Component {
render() {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(WrappedComponent, (0,extends_namespaceObject["default"])({}, getSystem(), this.props, this.context));
}
}
WithSystem.displayName = `WithSystem(${fn.getDisplayName(WrappedComponent)})`;
return WithSystem;
};
const withRoot = (getSystem, reduxStore) => (WrappedComponent) => {
const { fn } = getSystem();
class WithRoot extends external_react_namespaceObject.Component {
render() {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(external_react_redux_namespaceObject.Provider, { store: reduxStore }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(WrappedComponent, (0,extends_namespaceObject["default"])({}, this.props, this.context))
));
}
}
WithRoot.displayName = `WithRoot(${fn.getDisplayName(WrappedComponent)})`;
return WithRoot;
};
const withConnect = (getSystem, WrappedComponent, reduxStore) => {
const mapStateToProps = (state, ownProps) => {var _WrappedComponent$pro;
const props = (0,objectSpread2_namespaceObject["default"])((0,objectSpread2_namespaceObject["default"])({}, ownProps), getSystem());
const customMapStateToProps = ((_WrappedComponent$pro = WrappedComponent.prototype) === null || _WrappedComponent$pro === void 0 ? void 0 : _WrappedComponent$pro.mapStateToProps) || ((state) => ({ state }));
return customMapStateToProps(state, props);
};
return (0,external_redux_namespaceObject.compose)(
reduxStore ? withRoot(getSystem, reduxStore) : identity_namespaceObject["default"],
(0,external_react_redux_namespaceObject.connect)(mapStateToProps),
withSystem(getSystem)
)(WrappedComponent);
};
const handleProps = (getSystem, mapping, props, oldProps) => {
for (const prop in mapping) {
const fn = mapping[prop];
if (typeof fn === "function") {
fn(props[prop], oldProps[prop], getSystem());
}
}
};
const withMappedContainer = (getSystem, getStore, memGetComponent) => (componentName, mapping) => {
const { fn } = getSystem();
const WrappedComponent = memGetComponent(componentName, "root");
class WithMappedContainer extends external_react_namespaceObject.Component {
constructor(props, context) {
super(props, context);
handleProps(getSystem, mapping, props, {});
}
UNSAFE_componentWillReceiveProps(nextProps) {
handleProps(getSystem, mapping, nextProps, this.props);
}
render() {
const cleanProps = (0,omit_namespaceObject["default"])(this.props, mapping ? Object.keys(mapping) : []);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(WrappedComponent, cleanProps);
}
}
WithMappedContainer.displayName = `WithMappedContainer(${fn.getDisplayName(WrappedComponent)})`;
return WithMappedContainer;
};
const render = (getSystem, getStore, getComponent, getComponents) => (domNode) => {
const App = getComponent(getSystem, getStore, getComponents)("App", "root");
external_react_dom_namespaceObject["default"].render( /*#__PURE__*/external_react_namespaceObject["default"].createElement(App, null), domNode);
};
const getComponent = (getSystem, getStore, getComponents) => function (componentName, container) {let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
if (typeof componentName !== "string")
throw new TypeError("Need a string, to fetch a component. Was given a " + typeof componentName);
// getComponent has a config object as a third, optional parameter
// using the config object requires the presence of the second parameter, container
// e.g. getComponent("JsonSchema_string_whatever", false, { failSilently: true })
const component = getComponents(componentName);
if (!component) {
if (!config.failSilently) {
getSystem().log.warn("Could not find component:", componentName);
}
return null;
}
if (!container) {
return component;
}
if (container === "root") {
return withConnect(getSystem, component, getStore());
}
// container == truthy
return withConnect(getSystem, component);
};
;// CONCATENATED MODULE: ./src/core/plugins/view/fn.js
const getDisplayName = (WrappedComponent) => WrappedComponent.displayName || WrappedComponent.name || "Component";
;// CONCATENATED MODULE: ./src/core/plugins/view/index.js
const memoizeForGetComponent = (fn) => {
const resolver = function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}return JSON.stringify(args);};
return memoize(fn, resolver);
};
const memoizeForWithMappedContainer = (fn) => {
const resolver = function () {for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {args[_key2] = arguments[_key2];}return args;};
return utils_memoizeN(fn, resolver);
};
const viewPlugin = (_ref) => {let { getComponents, getStore, getSystem } = _ref;
// getComponent should be passed into makeMappedContainer, _already_ memoized... otherwise we have a big performance hit ( think, really big )
const memGetComponent = memoizeForGetComponent(getComponent(getSystem, getStore, getComponents));
const memMakeMappedContainer = memoizeForWithMappedContainer(withMappedContainer(getSystem, getStore, memGetComponent));
return {
rootInjects: {
getComponent: memGetComponent,
makeMappedContainer: memMakeMappedContainer,
render: render(getSystem, getStore, getComponent, getComponents)
},
fn: {
getDisplayName: getDisplayName
}
};
};
/* harmony default export */ const view = (viewPlugin);
;// CONCATENATED MODULE: ./src/core/plugins/download-url/index.js
/**
* @prettier
*/
function downloadUrlPlugin(toolbox) {
let { fn } = toolbox;
const actions = {
download:
(url) =>
(_ref) => {let { errActions, specSelectors, specActions, getConfigs } = _ref;
let { fetch } = fn;
const config = getConfigs();
url = url || specSelectors.url();
specActions.updateLoadingStatus("loading");
errActions.clear({ source: "fetch" });
fetch({
url,
loadSpec: true,
requestInterceptor: config.requestInterceptor || ((a) => a),
responseInterceptor: config.responseInterceptor || ((a) => a),
credentials: "same-origin",
headers: {
Accept: "application/json,*/*"
}
}).then(next, next);
function next(res) {
if (res instanceof Error || res.status >= 400) {
specActions.updateLoadingStatus("failed");
errActions.newThrownErr(
Object.assign(
new Error((res.message || res.statusText) + " " + url),
{ source: "fetch" }
)
);
// Check if the failure was possibly due to CORS or mixed content
if (!res.status && res instanceof Error) checkPossibleFailReasons();
return;
}
specActions.updateLoadingStatus("success");
specActions.updateSpec(res.text);
if (specSelectors.url() !== url) {
specActions.updateUrl(url);
}
}
function checkPossibleFailReasons() {
try {
let specUrl;
if ("URL" in core_window) {
specUrl = new URL(url);
} else {
// legacy browser, use to parse the URL
specUrl = document.createElement("a");
specUrl.href = url;
}
if (
specUrl.protocol !== "https:" &&
core_window.location.protocol === "https:")
{
const error = Object.assign(
new Error(
`Possible mixed-content issue? The page was loaded over https:// but a ${specUrl.protocol}// URL was specified. Check that you are not attempting to load mixed content.`
),
{ source: "fetch" }
);
errActions.newThrownErr(error);
return;
}
if (specUrl.origin !== core_window.location.origin) {
const error = Object.assign(
new Error(
`Possible cross-origin (CORS) issue? The URL origin (${specUrl.origin}) does not match the page (${core_window.location.origin}). Check the server returns the correct 'Access-Control-Allow-*' headers.`
),
{ source: "fetch" }
);
errActions.newThrownErr(error);
}
} catch (e) {
return;
}
}
},
updateLoadingStatus: (status) => {
let enums = [null, "loading", "failed", "success", "failedConfig"];
if (enums.indexOf(status) === -1) {
console.error(`Error: ${status} is not one of ${JSON.stringify(enums)}`);
}
return {
type: "spec_update_loading_status",
payload: status
};
}
};
let reducers = {
spec_update_loading_status: (state, action) => {
return typeof action.payload === "string" ?
state.set("loadingStatus", action.payload) :
state;
}
};
let selectors = {
loadingStatus: (0,external_reselect_namespaceObject.createSelector)(
(state) => {
return state || (0,external_immutable_namespaceObject.Map)();
},
(spec) => spec.get("loadingStatus") || null
)
};
return {
statePlugins: {
spec: { actions, reducers, selectors }
}
};
}
;// CONCATENATED MODULE: external "lodash/zipObject"
var zipObject_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var zipObject_y = x => () => x
const zipObject_namespaceObject = zipObject_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_zipObject_c74f1c14__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/safe-render/fn.jsx
const componentDidCatch = console.error;
const isClassComponent = (component) => component.prototype && component.prototype.isReactComponent;
const withErrorBoundary = (getSystem) => (WrappedComponent) => {
const { getComponent, fn } = getSystem();
const ErrorBoundary = getComponent("ErrorBoundary");
const targetName = fn.getDisplayName(WrappedComponent);
class WithErrorBoundary extends external_react_namespaceObject.Component {
render() {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(ErrorBoundary, { targetName: targetName, getComponent: getComponent, fn: fn }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(WrappedComponent, (0,extends_namespaceObject["default"])({}, this.props, this.context))
));
}
}
WithErrorBoundary.displayName = `WithErrorBoundary(${targetName})`;
if (isClassComponent(WrappedComponent)) {
/**
* We need to handle case of class components defining a `mapStateToProps` public method.
* Components with `mapStateToProps` public method cannot be wrapped.
*/
WithErrorBoundary.prototype.mapStateToProps = WrappedComponent.prototype.mapStateToProps;
}
return WithErrorBoundary;
};
;// CONCATENATED MODULE: ./src/core/plugins/safe-render/components/fallback.jsx
const Fallback = (_ref) => {let { name } = _ref;return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "fallback" }, "\uD83D\uDE31 ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("i", null, "Could not render ", name === "t" ? "this component" : name, ", see the console.")
));};
/* harmony default export */ const fallback = (Fallback);
;// CONCATENATED MODULE: ./src/core/plugins/safe-render/components/error-boundary.jsx
class ErrorBoundary extends external_react_namespaceObject.Component {
static getDerivedStateFromError(error) {
return { hasError: true, error };
}
constructor() {
super(...arguments);
this.state = { hasError: false, error: null };
}
componentDidCatch(error, errorInfo) {
this.props.fn.componentDidCatch(error, errorInfo);
}
render() {
const { getComponent, targetName, children } = this.props;
if (this.state.hasError) {
const FallbackComponent = getComponent("Fallback");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(FallbackComponent, { name: targetName });
}
return children;
}
}
ErrorBoundary.defaultProps = {
targetName: "this component",
getComponent: () => fallback,
fn: {
componentDidCatch: componentDidCatch
},
children: null
};
/* harmony default export */ const error_boundary = (ErrorBoundary);
;// CONCATENATED MODULE: ./src/core/plugins/safe-render/index.js
const safeRenderPlugin = function () {let { componentList = [], fullOverride = false } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};return (_ref) => {let { getSystem } = _ref;
const defaultComponentList = [
"App",
"BaseLayout",
"VersionPragmaFilter",
"InfoContainer",
"ServersContainer",
"SchemesContainer",
"AuthorizeBtnContainer",
"FilterContainer",
"Operations",
"OperationContainer",
"parameters",
"responses",
"OperationServers",
"Models",
"ModelWrapper"];
const mergedComponentList = fullOverride ? componentList : [...defaultComponentList, ...componentList];
const wrapFactory = (Original, _ref2) => {let { fn } = _ref2;return fn.withErrorBoundary(Original);};
const wrapComponents = (0,zipObject_namespaceObject["default"])(mergedComponentList, Array(mergedComponentList.length).fill(wrapFactory));
return {
fn: {
componentDidCatch: componentDidCatch,
withErrorBoundary: withErrorBoundary(getSystem)
},
components: {
ErrorBoundary: error_boundary,
Fallback: fallback
},
wrapComponents
};
};};
/* harmony default export */ const safe_render = (safeRenderPlugin);
;// CONCATENATED MODULE: ./src/core/components/app.jsx
class App extends external_react_namespaceObject["default"].Component {
getLayout() {
let { getComponent, layoutSelectors } = this.props;
const layoutName = layoutSelectors.current();
const Component = getComponent(layoutName, true);
return Component ? Component : () => /*#__PURE__*/external_react_namespaceObject["default"].createElement("h1", null, " No layout defined for \"", layoutName, "\" ");
}
render() {
const Layout = this.getLayout();
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(Layout, null));
}
}
App.defaultProps = {
};
;// CONCATENATED MODULE: ./src/core/components/auth/authorization-popup.jsx
class AuthorizationPopup extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "close",
() => {
let { authActions } = this.props;
authActions.showDefinitions(false);
});}
render() {
let { authSelectors, authActions, getComponent, errSelectors, specSelectors, fn: { AST = {} } } = this.props;
let definitions = authSelectors.shownDefinitions();
const Auths = getComponent("auths");
const CloseIcon = getComponent("CloseIcon");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "dialog-ux" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "backdrop-ux" }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "modal-ux" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "modal-dialog-ux" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "modal-ux-inner" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "modal-ux-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h3", null, "Available authorizations"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", { type: "button", className: "close-modal", onClick: this.close }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(CloseIcon, null)
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "modal-ux-content" },
definitions.valueSeq().map((definition, key) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Auths, { key: key,
AST: AST,
definitions: definition,
getComponent: getComponent,
errSelectors: errSelectors,
authSelectors: authSelectors,
authActions: authActions,
specSelectors: specSelectors });
})
)
)
)
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/auth/authorize-btn.jsx
class AuthorizeBtn extends external_react_namespaceObject["default"].Component {
render() {
let { isAuthorized, showPopup, onClick, getComponent } = this.props;
//must be moved out of button component
const AuthorizationPopup = getComponent("authorizationPopup", true);
const LockAuthIcon = getComponent("LockAuthIcon", true);
const UnlockAuthIcon = getComponent("UnlockAuthIcon", true);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "auth-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", { className: isAuthorized ? "btn authorize locked" : "btn authorize unlocked", onClick: onClick }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, "Authorize"),
isAuthorized ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(LockAuthIcon, null) : /*#__PURE__*/external_react_namespaceObject["default"].createElement(UnlockAuthIcon, null)
),
showPopup && /*#__PURE__*/external_react_namespaceObject["default"].createElement(AuthorizationPopup, null)
));
}
}
;// CONCATENATED MODULE: ./src/core/containers/authorize-btn.jsx
class AuthorizeBtnContainer extends external_react_namespaceObject["default"].Component {
render() {
const { authActions, authSelectors, specSelectors, getComponent } = this.props;
const securityDefinitions = specSelectors.securityDefinitions();
const authorizableDefinitions = authSelectors.definitionsToAuthorize();
const AuthorizeBtn = getComponent("authorizeBtn");
return securityDefinitions ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(AuthorizeBtn, {
onClick: () => authActions.showDefinitions(authorizableDefinitions),
isAuthorized: !!authSelectors.authorized().size,
showPopup: !!authSelectors.shownDefinitions(),
getComponent: getComponent }
) :
null;
}
}
;// CONCATENATED MODULE: ./src/core/components/auth/authorize-operation-btn.jsx
class AuthorizeOperationBtn extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onClick",
(e) => {
e.stopPropagation();
let { onClick } = this.props;
if (onClick) {
onClick();
}
});}
render() {
let { isAuthorized, getComponent } = this.props;
const LockAuthOperationIcon = getComponent("LockAuthOperationIcon", true);
const UnlockAuthOperationIcon = getComponent("UnlockAuthOperationIcon", true);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("button", { className: "authorization__btn",
"aria-label": isAuthorized ? "authorization button locked" : "authorization button unlocked",
onClick: this.onClick },
isAuthorized ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(LockAuthOperationIcon, { className: "locked" }) : /*#__PURE__*/external_react_namespaceObject["default"].createElement(UnlockAuthOperationIcon, { className: "unlocked" })
));
}
}
;// CONCATENATED MODULE: ./src/core/components/auth/auths.jsx
class Auths extends external_react_namespaceObject["default"].Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "onAuthChange",
(auth) => {
let { name } = auth;
this.setState({ [name]: auth });
});(0,defineProperty_namespaceObject["default"])(this, "submitAuth",
(e) => {
e.preventDefault();
let { authActions } = this.props;
authActions.authorizeWithPersistOption(this.state);
});(0,defineProperty_namespaceObject["default"])(this, "logoutClick",
(e) => {
e.preventDefault();
let { authActions, definitions } = this.props;
let auths = definitions.map((val, key) => {
return key;
}).toArray();
this.setState(auths.reduce((prev, auth) => {
prev[auth] = "";
return prev;
}, {}));
authActions.logoutWithPersistOption(auths);
});(0,defineProperty_namespaceObject["default"])(this, "close",
(e) => {
e.preventDefault();
let { authActions } = this.props;
authActions.showDefinitions(false);
});this.state = {};}
render() {
let { definitions, getComponent, authSelectors, errSelectors } = this.props;
const AuthItem = getComponent("AuthItem");
const Oauth2 = getComponent("oauth2", true);
const Button = getComponent("Button");
let authorized = authSelectors.authorized();
let authorizedAuth = definitions.filter((definition, key) => {
return !!authorized.get(key);
});
let nonOauthDefinitions = definitions.filter((schema) => schema.get("type") !== "oauth2");
let oauthDefinitions = definitions.filter((schema) => schema.get("type") === "oauth2");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "auth-container" },
!!nonOauthDefinitions.size && /*#__PURE__*/external_react_namespaceObject["default"].createElement("form", { onSubmit: this.submitAuth },
nonOauthDefinitions.map((schema, name) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(AuthItem, {
key: name,
schema: schema,
name: name,
getComponent: getComponent,
onAuthChange: this.onAuthChange,
authorized: authorized,
errSelectors: errSelectors }
);
}).toArray(), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "auth-btn-wrapper" },
nonOauthDefinitions.size === authorizedAuth.size ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(Button, { className: "btn modal-btn auth", onClick: this.logoutClick }, "Logout") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Button, { type: "submit", className: "btn modal-btn auth authorize" }, "Authorize"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Button, { className: "btn modal-btn auth btn-done", onClick: this.close }, "Close")
)
),
oauthDefinitions && oauthDefinitions.size ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "scope-def" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes."), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "API requires the following scopes. Select which ones you want to grant to Swagger UI.")
),
definitions.filter((schema) => schema.get("type") === "oauth2").
map((schema, name) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { key: name }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Oauth2, { authorized: authorized,
schema: schema,
name: name })
);
}
).toArray()
) : null
));
}
}
;// CONCATENATED MODULE: ./src/core/components/auth/auth-item.jsx
class auth_item_Auths extends external_react_namespaceObject["default"].Component {
render() {
let {
schema,
name,
getComponent,
onAuthChange,
authorized,
errSelectors
} = this.props;
const ApiKeyAuth = getComponent("apiKeyAuth");
const BasicAuth = getComponent("basicAuth");
let authEl;
const type = schema.get("type");
switch (type) {
case "apiKey":authEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement(ApiKeyAuth, { key: name,
schema: schema,
name: name,
errSelectors: errSelectors,
authorized: authorized,
getComponent: getComponent,
onChange: onAuthChange });
break;
case "basic":authEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement(BasicAuth, { key: name,
schema: schema,
name: name,
errSelectors: errSelectors,
authorized: authorized,
getComponent: getComponent,
onChange: onAuthChange });
break;
default:authEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { key: name }, "Unknown security definition type ", type);
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { key: `${name}-jump` },
authEl
);
}
}
;// CONCATENATED MODULE: ./src/core/components/auth/error.jsx
class AuthError extends external_react_namespaceObject["default"].Component {
render() {
let { error } = this.props;
let level = error.get("level");
let message = error.get("message");
let source = error.get("source");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "errors" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("b", null, source, " ", level), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, message)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/auth/api-key-auth.jsx
class ApiKeyAuth extends external_react_namespaceObject["default"].Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "onChange",
(e) => {
let { onChange } = this.props;
let value = e.target.value;
let newState = Object.assign({}, this.state, { value: value });
this.setState(newState);
onChange(newState);
});let { name, schema } = this.props;let _value = this.getValue();this.state = { name: name, schema: schema, value: _value };}getValue() {let { name, authorized } = this.props;return authorized && authorized.getIn([name, "value"]);}
render() {
let { schema, getComponent, errSelectors, name } = this.props;
const Input = getComponent("Input");
const Row = getComponent("Row");
const Col = getComponent("Col");
const AuthError = getComponent("authError");
const Markdown = getComponent("Markdown", true);
const JumpToPath = getComponent("JumpToPath", true);
let value = this.getValue();
let errors = errSelectors.allErrors().filter((err) => err.get("authId") === name);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, name || schema.get("name")), "\xA0(apiKey)", /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JumpToPath, { path: ["securityDefinitions", name] })
),
value && /*#__PURE__*/external_react_namespaceObject["default"].createElement("h6", null, "Authorized"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: schema.get("description") })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "Name: ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, schema.get("name")))
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "In: ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, schema.get("in")))
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", null, "Value:"),
value ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ****** ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, null, /*#__PURE__*/external_react_namespaceObject["default"].createElement(Input, { type: "text", onChange: this.onChange, autoFocus: true }))
),
errors.valueSeq().map((error, key) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(AuthError, { error: error,
key: key });
})
));
}
}
;// CONCATENATED MODULE: ./src/core/components/auth/basic-auth.jsx
class BasicAuth extends external_react_namespaceObject["default"].Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "onChange",
(e) => {
let { onChange } = this.props;
let { value, name } = e.target;
let newValue = this.state.value;
newValue[name] = value;
this.setState({ value: newValue });
onChange(this.state);
});let { schema, name: _name } = this.props;let _value = this.getValue();let username = _value.username;this.state = { name: _name, schema: schema, value: !username ? {} : { username: username } };}getValue() {let { authorized, name } = this.props;return authorized && authorized.getIn([name, "value"]) || {};}
render() {
let { schema, getComponent, name, errSelectors } = this.props;
const Input = getComponent("Input");
const Row = getComponent("Row");
const Col = getComponent("Col");
const AuthError = getComponent("authError");
const JumpToPath = getComponent("JumpToPath", true);
const Markdown = getComponent("Markdown", true);
let username = this.getValue().username;
let errors = errSelectors.allErrors().filter((err) => err.get("authId") === name);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, "Basic authorization", /*#__PURE__*/external_react_namespaceObject["default"].createElement(JumpToPath, { path: ["securityDefinitions", name] })),
username && /*#__PURE__*/external_react_namespaceObject["default"].createElement("h6", null, "Authorized"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: schema.get("description") })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", null, "Username:"),
username ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ", username, " ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, null, /*#__PURE__*/external_react_namespaceObject["default"].createElement(Input, { type: "text", required: "required", name: "username", onChange: this.onChange, autoFocus: true }))
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", null, "Password:"),
username ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ****** ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, null, /*#__PURE__*/external_react_namespaceObject["default"].createElement(Input, { autoComplete: "new-password",
name: "password",
type: "password",
onChange: this.onChange }))
),
errors.valueSeq().map((error, key) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(AuthError, { error: error,
key: key });
})
));
}
}
;// CONCATENATED MODULE: ./src/core/components/example.jsx
/**
* @prettier
*/
function Example(props) {
const { example, showValue, getComponent, getConfigs } = props;
const Markdown = getComponent("Markdown", true);
const HighlightCode = getComponent("highlightCode");
if (!example) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "example" },
example.get("description") ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("section", { className: "example__section" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "example__section-header" }, "Example Description"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: example.get("description") })
)
) :
null,
showValue && example.has("value") ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("section", { className: "example__section" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "example__section-header" }, "Example Value"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(HighlightCode, { getConfigs: getConfigs, value: stringify(example.get("value")) })
) :
null
));
}
;// CONCATENATED MODULE: ./src/core/components/examples-select.jsx
/**
* @prettier
*/
class ExamplesSelect extends external_react_namespaceObject["default"].PureComponent {constructor() {var _this;super(...arguments);_this = this;(0,defineProperty_namespaceObject["default"])(this, "_onSelect",
function (key) {let { isSyntheticChange = false } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (typeof _this.props.onSelect === "function") {
_this.props.onSelect(key, {
isSyntheticChange
});
}
});(0,defineProperty_namespaceObject["default"])(this, "_onDomSelect",
(e) => {
if (typeof this.props.onSelect === "function") {
const element = e.target.selectedOptions[0];
const key = element.getAttribute("value");
this._onSelect(key, {
isSyntheticChange: false
});
}
});(0,defineProperty_namespaceObject["default"])(this, "getCurrentExample",
() => {
const { examples, currentExampleKey } = this.props;
const currentExamplePerProps = examples.get(currentExampleKey);
const firstExamplesKey = examples.keySeq().first();
const firstExample = examples.get(firstExamplesKey);
return currentExamplePerProps || firstExample || Map({});
});}
componentDidMount() {
// this is the not-so-great part of ExamplesSelect... here we're
// artificially kicking off an onSelect event in order to set a default
// value in state. the consumer has the option to avoid this by checking
// `isSyntheticEvent`, but we should really be doing this in a selector.
// TODO: clean this up
// FIXME: should this only trigger if `currentExamplesKey` is nullish?
const { onSelect, examples } = this.props;
if (typeof onSelect === "function") {
const firstExample = examples.first();
const firstExampleKey = examples.keyOf(firstExample);
this._onSelect(firstExampleKey, {
isSyntheticChange: true
});
}
}
UNSAFE_componentWillReceiveProps(nextProps) {
const { currentExampleKey, examples } = nextProps;
if (examples !== this.props.examples && !examples.has(currentExampleKey)) {
// examples have changed from under us, and the currentExampleKey is no longer
// valid.
const firstExample = examples.first();
const firstExampleKey = examples.keyOf(firstExample);
this._onSelect(firstExampleKey, {
isSyntheticChange: true
});
}
}
render() {
const {
examples,
currentExampleKey,
isValueModified,
isModifiedValueAvailable,
showLabels
} = this.props;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "examples-select" },
showLabels ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "examples-select__section-label" }, "Examples: ") :
null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("select", {
className: "examples-select-element",
onChange: this._onDomSelect,
value:
isModifiedValueAvailable && isValueModified ?
"__MODIFIED__VALUE__" :
currentExampleKey || "" },
isModifiedValueAvailable ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("option", { value: "__MODIFIED__VALUE__" }, "[Modified value]") :
null,
examples.
map((example, exampleName) => {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("option", {
key: exampleName // for React
, value: exampleName // for matching to select's `value`
},
example.get("summary") || exampleName
));
}).
valueSeq()
)
));
}
}(0,defineProperty_namespaceObject["default"])(ExamplesSelect, "defaultProps", { examples: external_immutable_namespaceObject["default"].Map({}), onSelect: function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}return console.log( // eslint-disable-line no-console
// FIXME: remove before merging to master...
`DEBUG: ExamplesSelect was not given an onSelect callback`, ...args);}, currentExampleKey: null, showLabels: true });
;// CONCATENATED MODULE: ./src/core/components/examples-select-value-retainer.jsx
/**
* @prettier
*/
// This stateful component lets us avoid writing competing values (user
// modifications vs example values) into global state, and the mess that comes
// with that: tracking which of the two values are currently used for
// Try-It-Out, which example a modified value came from, etc...
//
// The solution here is to retain the last user-modified value in
// ExamplesSelectValueRetainer's component state, so that our global state can stay
// clean, always simply being the source of truth for what value should be both
// displayed to the user and used as a value during request execution.
//
// This approach/tradeoff was chosen in order to encapsulate the particular
// logic of Examples within the Examples component tree, and to avoid
// regressions within our current implementation elsewhere (non-Examples
// definitions, OpenAPI 2.0, etc). A future refactor to global state might make
// this component unnecessary.
//
// TL;DR: this is not our usual approach, but the choice was made consciously.
// Note that `currentNamespace` isn't currently used anywhere!
const stringifyUnlessList = (input) =>
external_immutable_namespaceObject.List.isList(input) ? input : stringify(input);
class ExamplesSelectValueRetainer extends external_react_namespaceObject["default"].PureComponent {
constructor(_props) {var _this;
super(_props);_this = this;(0,defineProperty_namespaceObject["default"])(this, "_getStateForCurrentNamespace",
() => {
const { currentNamespace } = this.props;
return (this.state[currentNamespace] || (0,external_immutable_namespaceObject.Map)()).toObject();
});(0,defineProperty_namespaceObject["default"])(this, "_setStateForCurrentNamespace",
(obj) => {
const { currentNamespace } = this.props;
return this._setStateForNamespace(currentNamespace, obj);
});(0,defineProperty_namespaceObject["default"])(this, "_setStateForNamespace",
(namespace, obj) => {
const oldStateForNamespace = this.state[namespace] || (0,external_immutable_namespaceObject.Map)();
const newStateForNamespace = oldStateForNamespace.mergeDeep(obj);
return this.setState({
[namespace]: newStateForNamespace
});
});(0,defineProperty_namespaceObject["default"])(this, "_isCurrentUserInputSameAsExampleValue",
() => {
const { currentUserInputValue } = this.props;
const valueFromExample = this._getCurrentExampleValue();
return valueFromExample === currentUserInputValue;
});(0,defineProperty_namespaceObject["default"])(this, "_getValueForExample",
(exampleKey, props) => {
// props are accepted so that this can be used in UNSAFE_componentWillReceiveProps,
// which has access to `nextProps`
const { examples } = props || this.props;
return stringifyUnlessList(
(examples || (0,external_immutable_namespaceObject.Map)({})).getIn([exampleKey, "value"])
);
});(0,defineProperty_namespaceObject["default"])(this, "_getCurrentExampleValue",
(props) => {
// props are accepted so that this can be used in UNSAFE_componentWillReceiveProps,
// which has access to `nextProps`
const { currentKey } = props || this.props;
return this._getValueForExample(currentKey, props || this.props);
});(0,defineProperty_namespaceObject["default"])(this, "_onExamplesSelect",
function (key) {let { isSyntheticChange } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const {
onSelect,
updateValue,
currentUserInputValue,
userHasEditedBody
} = _this.props;
const { lastUserEditedValue } = _this._getStateForCurrentNamespace();
const valueFromExample = _this._getValueForExample(key);
if (key === "__MODIFIED__VALUE__") {
updateValue(stringifyUnlessList(lastUserEditedValue));
return _this._setStateForCurrentNamespace({
isModifiedValueSelected: true
});
}
if (typeof onSelect === "function") {for (var _len = arguments.length, otherArgs = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {otherArgs[_key - 2] = arguments[_key];}
onSelect(key, { isSyntheticChange }, ...otherArgs);
}
_this._setStateForCurrentNamespace({
lastDownstreamValue: valueFromExample,
isModifiedValueSelected:
isSyntheticChange && userHasEditedBody ||
!!currentUserInputValue && currentUserInputValue !== valueFromExample
});
// we never want to send up value updates from synthetic changes
if (isSyntheticChange) return;
if (typeof updateValue === "function") {
updateValue(stringifyUnlessList(valueFromExample));
}
});const _valueFromExample = this._getCurrentExampleValue();this.state = { // user edited: last value that came from the world around us, and didn't
// match the current example's value
// internal: last value that came from user selecting an Example
[_props.currentNamespace]: (0,external_immutable_namespaceObject.Map)({ lastUserEditedValue: this.props.currentUserInputValue, lastDownstreamValue: _valueFromExample, isModifiedValueSelected: // valueFromExample !== undefined &&
this.props.userHasEditedBody || this.props.currentUserInputValue !== _valueFromExample }) };}componentWillUnmount() {this.props.setRetainRequestBodyValueFlag(false);}UNSAFE_componentWillReceiveProps(nextProps) {// update `lastUserEditedValue` as new currentUserInput values come in
const {
currentUserInputValue: newValue,
examples,
onSelect,
userHasEditedBody
} = nextProps;
const {
lastUserEditedValue,
lastDownstreamValue
} = this._getStateForCurrentNamespace();
const valueFromCurrentExample = this._getValueForExample(
nextProps.currentKey,
nextProps
);
const examplesMatchingNewValue = examples.filter(
(example) =>
example.get("value") === newValue ||
// sometimes data is stored as a string (e.g. in Request Bodies), so
// let's check against a stringified version of our example too
stringify(example.get("value")) === newValue
);
if (examplesMatchingNewValue.size) {
let key;
if (examplesMatchingNewValue.has(nextProps.currentKey))
{
key = nextProps.currentKey;
} else {
key = examplesMatchingNewValue.keySeq().first();
}
onSelect(key, {
isSyntheticChange: true
});
} else if (
newValue !== this.props.currentUserInputValue && // value has changed
newValue !== lastUserEditedValue && // value isn't already tracked
newValue !== lastDownstreamValue // value isn't what we've seen on the other side
) {
this.props.setRetainRequestBodyValueFlag(true);
this._setStateForNamespace(nextProps.currentNamespace, {
lastUserEditedValue: nextProps.currentUserInputValue,
isModifiedValueSelected:
userHasEditedBody || newValue !== valueFromCurrentExample
});
}
}
render() {
const {
currentUserInputValue,
examples,
currentKey,
getComponent,
userHasEditedBody
} = this.props;
const {
lastDownstreamValue,
lastUserEditedValue,
isModifiedValueSelected
} = this._getStateForCurrentNamespace();
const ExamplesSelect = getComponent("ExamplesSelect");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(ExamplesSelect, {
examples: examples,
currentExampleKey: currentKey,
onSelect: this._onExamplesSelect,
isModifiedValueAvailable:
!!lastUserEditedValue && lastUserEditedValue !== lastDownstreamValue,
isValueModified:
currentUserInputValue !== undefined &&
isModifiedValueSelected &&
currentUserInputValue !== this._getCurrentExampleValue() ||
userHasEditedBody }
));
}
}(0,defineProperty_namespaceObject["default"])(ExamplesSelectValueRetainer, "defaultProps", { userHasEditedBody: false, examples: (0,external_immutable_namespaceObject.Map)({}), currentNamespace: "__DEFAULT__NAMESPACE__", setRetainRequestBodyValueFlag: () => {// NOOP
}, onSelect: function () {for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {args[_key2] = arguments[_key2];}return console.log( // eslint-disable-line no-console
"ExamplesSelectValueRetainer: no `onSelect` function was provided", ...args);}, updateValue: function () {for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {args[_key3] = arguments[_key3];}return console.log( // eslint-disable-line no-console
"ExamplesSelectValueRetainer: no `updateValue` function was provided", ...args);} });
;// CONCATENATED MODULE: ./src/core/oauth2-authorize.js
function oauth2_authorize_authorize(_ref) {let { auth, authActions, errActions, configs, authConfigs = {}, currentServer } = _ref;
let { schema, scopes, name, clientId } = auth;
let flow = schema.get("flow");
let query = [];
switch (flow) {
case "password":
authActions.authorizePassword(auth);
return;
case "application":
authActions.authorizeApplication(auth);
return;
case "accessCode":
query.push("response_type=code");
break;
case "implicit":
query.push("response_type=token");
break;
case "clientCredentials":
case "client_credentials":
// OAS3
authActions.authorizeApplication(auth);
return;
case "authorizationCode":
case "authorization_code":
// OAS3
query.push("response_type=code");
break;
}
if (typeof clientId === "string") {
query.push("client_id=" + encodeURIComponent(clientId));
}
let redirectUrl = configs.oauth2RedirectUrl;
// todo move to parser
if (typeof redirectUrl === "undefined") {
errActions.newAuthErr({
authId: name,
source: "validation",
level: "error",
message: "oauth2RedirectUrl configuration is not passed. Oauth2 authorization cannot be performed."
});
return;
}
query.push("redirect_uri=" + encodeURIComponent(redirectUrl));
let scopesArray = [];
if (Array.isArray(scopes)) {
scopesArray = scopes;
} else if (external_immutable_namespaceObject["default"].List.isList(scopes)) {
scopesArray = scopes.toArray();
}
if (scopesArray.length > 0) {
let scopeSeparator = authConfigs.scopeSeparator || " ";
query.push("scope=" + encodeURIComponent(scopesArray.join(scopeSeparator)));
}
let state = btoa(new Date());
query.push("state=" + encodeURIComponent(state));
if (typeof authConfigs.realm !== "undefined") {
query.push("realm=" + encodeURIComponent(authConfigs.realm));
}
if ((flow === "authorizationCode" || flow === "authorization_code" || flow === "accessCode") && authConfigs.usePkceWithAuthorizationCodeGrant) {
const codeVerifier = generateCodeVerifier();
const codeChallenge = createCodeChallenge(codeVerifier);
query.push("code_challenge=" + codeChallenge);
query.push("code_challenge_method=S256");
// storing the Code Verifier so it can be sent to the token endpoint
// when exchanging the Authorization Code for an Access Token
auth.codeVerifier = codeVerifier;
}
let { additionalQueryStringParams } = authConfigs;
for (let key in additionalQueryStringParams) {
if (typeof additionalQueryStringParams[key] !== "undefined") {
query.push([key, additionalQueryStringParams[key]].map(encodeURIComponent).join("="));
}
}
const authorizationUrl = schema.get("authorizationUrl");
let sanitizedAuthorizationUrl;
if (currentServer) {
// OpenAPI 3
sanitizedAuthorizationUrl = (0,external_url_parse_namespaceObject["default"])(
sanitizeUrl(authorizationUrl),
currentServer,
true
).toString();
} else {
sanitizedAuthorizationUrl = sanitizeUrl(authorizationUrl);
}
let url = [sanitizedAuthorizationUrl, query.join("&")].join(authorizationUrl.indexOf("?") === -1 ? "?" : "&");
// pass action authorizeOauth2 and authentication data through window
// to authorize with oauth2
let callback;
if (flow === "implicit") {
callback = authActions.preAuthorizeImplicit;
} else if (authConfigs.useBasicAuthenticationWithAccessCodeGrant) {
callback = authActions.authorizeAccessCodeWithBasicAuthentication;
} else {
callback = authActions.authorizeAccessCodeWithFormParams;
}
authActions.authPopup(url, {
auth: auth,
state: state,
redirectUrl: redirectUrl,
callback: callback,
errCb: errActions.newAuthErr
});
}
;// CONCATENATED MODULE: ./src/core/components/auth/oauth2.jsx
class Oauth2 extends external_react_namespaceObject["default"].Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "close",
(e) => {
e.preventDefault();
let { authActions } = this.props;
authActions.showDefinitions(false);
});(0,defineProperty_namespaceObject["default"])(this, "authorize",
() => {
let { authActions, errActions, getConfigs, authSelectors, oas3Selectors } = this.props;
let configs = getConfigs();
let authConfigs = authSelectors.getConfigs();
errActions.clear({ authId: name, type: "auth", source: "auth" });
oauth2_authorize_authorize({
auth: this.state,
currentServer: oas3Selectors.serverEffectiveValue(oas3Selectors.selectedServer()),
authActions,
errActions,
configs,
authConfigs
});
});(0,defineProperty_namespaceObject["default"])(this, "onScopeChange",
(e) => {
let { target } = e;
let { checked } = target;
let scope = target.dataset.value;
if (checked && this.state.scopes.indexOf(scope) === -1) {
let newScopes = this.state.scopes.concat([scope]);
this.setState({ scopes: newScopes });
} else if (!checked && this.state.scopes.indexOf(scope) > -1) {
this.setState({ scopes: this.state.scopes.filter((val) => val !== scope) });
}
});(0,defineProperty_namespaceObject["default"])(this, "onInputChange",
(e) => {
let { target: { dataset: { name }, value } } = e;
let state = {
[name]: value
};
this.setState(state);
});(0,defineProperty_namespaceObject["default"])(this, "selectScopes",
(e) => {
if (e.target.dataset.all) {
this.setState({
scopes: Array.from((this.props.schema.get("allowedScopes") || this.props.schema.get("scopes")).keys())
});
} else {
this.setState({ scopes: [] });
}
});(0,defineProperty_namespaceObject["default"])(this, "logout",
(e) => {
e.preventDefault();
let { authActions, errActions, name } = this.props;
errActions.clear({ authId: name, type: "auth", source: "auth" });
authActions.logoutWithPersistOption([name]);
});let { name: _name, schema, authorized, authSelectors: _authSelectors } = this.props;let auth = authorized && authorized.get(_name);let _authConfigs = _authSelectors.getConfigs() || {};let username = auth && auth.get("username") || "";let clientId = auth && auth.get("clientId") || _authConfigs.clientId || "";let clientSecret = auth && auth.get("clientSecret") || _authConfigs.clientSecret || "";let passwordType = auth && auth.get("passwordType") || "basic";let scopes = auth && auth.get("scopes") || _authConfigs.scopes || [];if (typeof scopes === "string") {scopes = scopes.split(_authConfigs.scopeSeparator || " ");}this.state = { appName: _authConfigs.appName, name: _name, schema: schema, scopes: scopes, clientId: clientId, clientSecret: clientSecret, username: username, password: "", passwordType: passwordType };}
render() {
let {
schema, getComponent, authSelectors, errSelectors, name, specSelectors
} = this.props;
const Input = getComponent("Input");
const Row = getComponent("Row");
const Col = getComponent("Col");
const Button = getComponent("Button");
const AuthError = getComponent("authError");
const JumpToPath = getComponent("JumpToPath", true);
const Markdown = getComponent("Markdown", true);
const InitializedInput = getComponent("InitializedInput");
const { isOAS3 } = specSelectors;
let oidcUrl = isOAS3() ? schema.get("openIdConnectUrl") : null;
// Auth type consts
const AUTH_FLOW_IMPLICIT = "implicit";
const AUTH_FLOW_PASSWORD = "password";
const AUTH_FLOW_ACCESS_CODE = isOAS3() ? oidcUrl ? "authorization_code" : "authorizationCode" : "accessCode";
const AUTH_FLOW_APPLICATION = isOAS3() ? oidcUrl ? "client_credentials" : "clientCredentials" : "application";
let authConfigs = authSelectors.getConfigs() || {};
let isPkceCodeGrant = !!authConfigs.usePkceWithAuthorizationCodeGrant;
let flow = schema.get("flow");
let flowToDisplay = flow === AUTH_FLOW_ACCESS_CODE && isPkceCodeGrant ? flow + " with PKCE" : flow;
let scopes = schema.get("allowedScopes") || schema.get("scopes");
let authorizedAuth = authSelectors.authorized().get(name);
let isAuthorized = !!authorizedAuth;
let errors = errSelectors.allErrors().filter((err) => err.get("authId") === name);
let isValid = !errors.filter((err) => err.get("source") === "validation").size;
let description = schema.get("description");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, name, " (OAuth2, ", flowToDisplay, ") ", /*#__PURE__*/external_react_namespaceObject["default"].createElement(JumpToPath, { path: ["securityDefinitions", name] })),
!this.state.appName ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement("h5", null, "Application: ", this.state.appName, " "),
description && /*#__PURE__*/external_react_namespaceObject["default"].createElement(Markdown, { source: schema.get("description") }),
isAuthorized && /*#__PURE__*/external_react_namespaceObject["default"].createElement("h6", null, "Authorized"),
oidcUrl && /*#__PURE__*/external_react_namespaceObject["default"].createElement("p", null, "OpenID Connect URL: ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, oidcUrl)),
(flow === AUTH_FLOW_IMPLICIT || flow === AUTH_FLOW_ACCESS_CODE) && /*#__PURE__*/external_react_namespaceObject["default"].createElement("p", null, "Authorization URL: ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, schema.get("authorizationUrl"))),
(flow === AUTH_FLOW_PASSWORD || flow === AUTH_FLOW_ACCESS_CODE || flow === AUTH_FLOW_APPLICATION) && /*#__PURE__*/external_react_namespaceObject["default"].createElement("p", null, "Token URL:", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ", schema.get("tokenUrl"))), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", { className: "flow" }, "Flow: ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, flowToDisplay)),
flow !== AUTH_FLOW_PASSWORD ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", { htmlFor: "oauth_username" }, "username:"),
isAuthorized ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ", this.state.username, " ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { tablet: 10, desktop: 10 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("input", { id: "oauth_username", type: "text", "data-name": "username", onChange: this.onInputChange, autoFocus: true })
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", { htmlFor: "oauth_password" }, "password:"),
isAuthorized ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ****** ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { tablet: 10, desktop: 10 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("input", { id: "oauth_password", type: "password", "data-name": "password", onChange: this.onInputChange })
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", { htmlFor: "password_type" }, "Client credentials location:"),
isAuthorized ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ", this.state.passwordType, " ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { tablet: 10, desktop: 10 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("select", { id: "password_type", "data-name": "passwordType", onChange: this.onInputChange }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("option", { value: "basic" }, "Authorization header"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("option", { value: "request-body" }, "Request body")
)
)
)
),
(flow === AUTH_FLOW_APPLICATION || flow === AUTH_FLOW_IMPLICIT || flow === AUTH_FLOW_ACCESS_CODE || flow === AUTH_FLOW_PASSWORD) && (
!isAuthorized || isAuthorized && this.state.clientId) && /*#__PURE__*/external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", { htmlFor: "client_id" }, "client_id:"),
isAuthorized ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ****** ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { tablet: 10, desktop: 10 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(InitializedInput, { id: "client_id",
type: "text",
required: flow === AUTH_FLOW_PASSWORD,
initialValue: this.state.clientId,
"data-name": "clientId",
onChange: this.onInputChange })
)
),
(flow === AUTH_FLOW_APPLICATION || flow === AUTH_FLOW_ACCESS_CODE || flow === AUTH_FLOW_PASSWORD) && /*#__PURE__*/external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", { htmlFor: "client_secret" }, "client_secret:"),
isAuthorized ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ****** ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { tablet: 10, desktop: 10 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(InitializedInput, { id: "client_secret",
initialValue: this.state.clientSecret,
type: "password",
"data-name": "clientSecret",
onChange: this.onInputChange })
)
),
!isAuthorized && scopes && scopes.size ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "scopes" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h2", null, "Scopes:", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("a", { onClick: this.selectScopes, "data-all": true }, "select all"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("a", { onClick: this.selectScopes }, "select none")
),
scopes.map((description, name) => {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(Row, { key: name }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "checkbox" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Input, { "data-value": name,
id: `${name}-${flow}-checkbox-${this.state.name}`,
disabled: isAuthorized,
checked: this.state.scopes.includes(name),
type: "checkbox",
onChange: this.onScopeChange }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", { htmlFor: `${name}-${flow}-checkbox-${this.state.name}` }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "item" }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "text" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", { className: "name" }, name), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", { className: "description" }, description)
)
)
)
));
}).toArray()
) : null,
errors.valueSeq().map((error, key) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(AuthError, { error: error,
key: key });
}), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "auth-btn-wrapper" },
isValid && (
isAuthorized ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(Button, { className: "btn modal-btn auth authorize", onClick: this.logout }, "Logout") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Button, { className: "btn modal-btn auth authorize", onClick: this.authorize }, "Authorize")), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Button, { className: "btn modal-btn auth btn-done", onClick: this.close }, "Close")
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/clear.jsx
class Clear extends external_react_namespaceObject.Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onClick",
() => {
let { specActions, path, method } = this.props;
specActions.clearResponse(path, method);
specActions.clearRequest(path, method);
});}
render() {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("button", { className: "btn btn-clear opblock-control__btn", onClick: this.onClick }, "Clear"
));
}
}
;// CONCATENATED MODULE: ./src/core/components/live-response.jsx
const Headers = (_ref) => {let { headers } = _ref;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h5", null, "Response headers"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("pre", { className: "microlight" }, headers)
));
};
const Duration = (_ref2) => {let { duration } = _ref2;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h5", null, "Request duration"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("pre", { className: "microlight" }, duration, " ms")
));
};
class LiveResponse extends external_react_namespaceObject["default"].Component {
shouldComponentUpdate(nextProps) {
// BUG: props.response is always coming back as a new Immutable instance
// same issue as responses.jsx (tryItOutResponse)
return this.props.response !== nextProps.response ||
this.props.path !== nextProps.path ||
this.props.method !== nextProps.method ||
this.props.displayRequestDuration !== nextProps.displayRequestDuration;
}
render() {
const { response, getComponent, getConfigs, displayRequestDuration, specSelectors, path, method } = this.props;
const { showMutatedRequest, requestSnippetsEnabled } = getConfigs();
const curlRequest = showMutatedRequest ? specSelectors.mutatedRequestFor(path, method) : specSelectors.requestFor(path, method);
const status = response.get("status");
const url = curlRequest.get("url");
const headers = response.get("headers").toJS();
const notDocumented = response.get("notDocumented");
const isError = response.get("error");
const body = response.get("text");
const duration = response.get("duration");
const headersKeys = Object.keys(headers);
const contentType = headers["content-type"] || headers["Content-Type"];
const ResponseBody = getComponent("responseBody");
const returnObject = headersKeys.map((key) => {
var joinedHeaders = Array.isArray(headers[key]) ? headers[key].join() : headers[key];
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "headerline", key: key }, " ", key, ": ", joinedHeaders, " ");
});
const hasHeaders = returnObject.length !== 0;
const Markdown = getComponent("Markdown", true);
const RequestSnippets = getComponent("RequestSnippets", true);
const Curl = getComponent("curl");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null,
curlRequest && (requestSnippetsEnabled === true || requestSnippetsEnabled === "true" ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(RequestSnippets, { request: curlRequest }) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Curl, { request: curlRequest, getConfigs: getConfigs })),
url && /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "request-url" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, "Request URL"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("pre", { className: "microlight" }, url)
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, "Server response"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("table", { className: "responses-table live-responses-table" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("thead", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", { className: "responses-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "col_header response-col_status" }, "Code"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "col_header response-col_description" }, "Details")
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tbody", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", { className: "response" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "response-col_status" },
status,
notDocumented ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "response-undocumented" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("i", null, " Undocumented ")
) :
null
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "response-col_description" },
isError ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(Markdown, { source: `${response.get("name") !== "" ? `${response.get("name")}: ` : ""}${response.get("message")}` }) :
null,
body ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(ResponseBody, { content: body,
contentType: contentType,
url: url,
headers: headers,
getConfigs: getConfigs,
getComponent: getComponent }) :
null,
hasHeaders ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(Headers, { headers: returnObject }) : null,
displayRequestDuration && duration ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(Duration, { duration: duration }) : null
)
)
)
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/online-validator-badge.jsx
class OnlineValidatorBadge extends external_react_namespaceObject["default"].Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "getDefinitionUrl",
() => {
// TODO: test this behavior by stubbing `window.location` in an Enzyme/JSDom env
let { specSelectors } = this.props;
const urlObject = new external_url_parse_namespaceObject["default"](specSelectors.url(), core_window.location);
return urlObject.toString();
});let { getConfigs } = props;let { validatorUrl } = getConfigs();this.state = { url: this.getDefinitionUrl(), validatorUrl: validatorUrl === undefined ? "https://validator.swagger.io/validator" : validatorUrl };}
UNSAFE_componentWillReceiveProps(nextProps) {
let { getConfigs } = nextProps;
let { validatorUrl } = getConfigs();
this.setState({
url: this.getDefinitionUrl(),
validatorUrl: validatorUrl === undefined ? "https://validator.swagger.io/validator" : validatorUrl
});
}
render() {
let { getConfigs } = this.props;
let { spec } = getConfigs();
let sanitizedValidatorUrl = sanitizeUrl(this.state.validatorUrl);
if (typeof spec === "object" && Object.keys(spec).length) return null;
if (!this.state.url || !requiresValidationURL(this.state.validatorUrl) ||
!requiresValidationURL(this.state.url)) {
return null;
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "float-right" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("a", { target: "_blank", rel: "noopener noreferrer", href: `${sanitizedValidatorUrl}/debug?url=${encodeURIComponent(this.state.url)}` }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ValidatorImage, { src: `${sanitizedValidatorUrl}?url=${encodeURIComponent(this.state.url)}`, alt: "Online validator badge" })
)
);
}
}
class ValidatorImage extends external_react_namespaceObject["default"].Component {
constructor(props) {
super(props);
this.state = {
loaded: false,
error: false
};
}
componentDidMount() {
const img = new Image();
img.onload = () => {
this.setState({
loaded: true
});
};
img.onerror = () => {
this.setState({
error: true
});
};
img.src = this.props.src;
}
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.src !== this.props.src) {
const img = new Image();
img.onload = () => {
this.setState({
loaded: true
});
};
img.onerror = () => {
this.setState({
error: true
});
};
img.src = nextProps.src;
}
}
render() {
if (this.state.error) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("img", { alt: "Error" });
} else if (!this.state.loaded) {
return null;
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("img", { src: this.props.src, alt: this.props.alt });
}
}
;// CONCATENATED MODULE: ./src/core/components/operations.jsx
class Operations extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "renderOperationTag",
(tagObj, tag) => {
const {
specSelectors,
getComponent,
oas3Selectors,
layoutSelectors,
layoutActions,
getConfigs
} = this.props;
const validOperationMethods = specSelectors.validOperationMethods();
const OperationContainer = getComponent("OperationContainer", true);
const OperationTag = getComponent("OperationTag");
const operations = tagObj.get("operations");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(OperationTag, {
key: "operation-" + tag,
tagObj: tagObj,
tag: tag,
oas3Selectors: oas3Selectors,
layoutSelectors: layoutSelectors,
layoutActions: layoutActions,
getConfigs: getConfigs,
getComponent: getComponent,
specUrl: specSelectors.url() }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "operation-tag-content" },
operations.map((op) => {
const path = op.get("path");
const method = op.get("method");
const specPath = external_immutable_namespaceObject["default"].List(["paths", path, method]);
if (validOperationMethods.indexOf(method) === -1) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(OperationContainer, {
key: `${path}-${method}`,
specPath: specPath,
op: op,
path: path,
method: method,
tag: tag }));
}).toArray()
)
));
});}render() {let { specSelectors } = this.props;const taggedOps = specSelectors.taggedOperations();if (taggedOps.size === 0) {return /*#__PURE__*/external_react_namespaceObject["default"].createElement("h3", null, " No operations defined in spec!");}return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, taggedOps.map(this.renderOperationTag).toArray(), taggedOps.size < 1 ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("h3", null, " No operations defined in spec! ") : null);}
}
;// CONCATENATED MODULE: ./src/core/utils/url.js
function isAbsoluteUrl(url) {
return url.match(/^(?:[a-z]+:)?\/\//i); // Matches http://, HTTP://, https://, ftp://, //example.com,
}
function addProtocol(url) {
if (!url.match(/^\/\//i)) return url; // Checks if protocol is missing e.g. //example.com
return `${window.location.protocol}${url}`;
}
function buildBaseUrl(selectedServer, specUrl) {
if (!selectedServer) return specUrl;
if (isAbsoluteUrl(selectedServer)) return addProtocol(selectedServer);
return new URL(selectedServer, specUrl).href;
}
function buildUrl(url, specUrl) {let { selectedServer = "" } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
if (!url) return undefined;
if (isAbsoluteUrl(url)) return url;
const baseUrl = buildBaseUrl(selectedServer, specUrl);
if (!isAbsoluteUrl(baseUrl)) {
return new URL(url, window.location.href).href;
}
return new URL(url, baseUrl).href;
}
/**
* Safe version of buildUrl function. `selectedServer` can contain server variables
* which can fail the URL resolution.
*/
function safeBuildUrl(url, specUrl) {let { selectedServer = "" } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
try {
return buildUrl(url, specUrl, { selectedServer });
} catch {
return undefined;
}
}
;// CONCATENATED MODULE: ./src/core/components/operation-tag.jsx
class OperationTag extends external_react_namespaceObject["default"].Component {
render() {
const {
tagObj,
tag,
children,
oas3Selectors,
layoutSelectors,
layoutActions,
getConfigs,
getComponent,
specUrl
} = this.props;
let {
docExpansion,
deepLinking
} = getConfigs();
const isDeepLinkingEnabled = deepLinking && deepLinking !== "false";
const Collapse = getComponent("Collapse");
const Markdown = getComponent("Markdown", true);
const DeepLink = getComponent("DeepLink");
const Link = getComponent("Link");
const ArrowUpIcon = getComponent("ArrowUpIcon");
const ArrowDownIcon = getComponent("ArrowDownIcon");
let tagDescription = tagObj.getIn(["tagDetails", "description"], null);
let tagExternalDocsDescription = tagObj.getIn(["tagDetails", "externalDocs", "description"]);
let rawTagExternalDocsUrl = tagObj.getIn(["tagDetails", "externalDocs", "url"]);
let tagExternalDocsUrl;
if (isFunc(oas3Selectors) && isFunc(oas3Selectors.selectedServer)) {
tagExternalDocsUrl = safeBuildUrl(rawTagExternalDocsUrl, specUrl, { selectedServer: oas3Selectors.selectedServer() });
} else {
tagExternalDocsUrl = rawTagExternalDocsUrl;
}
let isShownKey = ["operations-tag", tag];
let showTag = layoutSelectors.isShown(isShownKey, docExpansion === "full" || docExpansion === "list");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: showTag ? "opblock-tag-section is-open" : "opblock-tag-section" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h3", {
onClick: () => layoutActions.show(isShownKey, !showTag),
className: !tagDescription ? "opblock-tag no-desc" : "opblock-tag",
id: isShownKey.map((v) => escapeDeepLinkPath(v)).join("-"),
"data-tag": tag,
"data-is-open": showTag }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(DeepLink, {
enabled: isDeepLinkingEnabled,
isShown: showTag,
path: createDeepLinkPath(tag),
text: tag }),
!tagDescription ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("small", null) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("small", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: tagDescription })
),
!tagExternalDocsUrl ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "info__externaldocs" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("small", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, {
href: sanitizeUrl(tagExternalDocsUrl),
onClick: (e) => e.stopPropagation(),
target: "_blank" },
tagExternalDocsDescription || tagExternalDocsUrl)
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", {
"aria-expanded": showTag,
className: "expand-operation",
title: showTag ? "Collapse operation" : "Expand operation",
onClick: () => layoutActions.show(isShownKey, !showTag) },
showTag ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowUpIcon, { className: "arrow" }) : /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowDownIcon, { className: "arrow" })
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Collapse, { isOpened: showTag },
children
)
));
}
}(0,defineProperty_namespaceObject["default"])(OperationTag, "defaultProps", { tagObj: external_immutable_namespaceObject["default"].fromJS({}), tag: "" });
;// CONCATENATED MODULE: ./src/core/assets/rolling-load.svg
const rolling_load_namespaceObject = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwcHgiICBoZWlnaHQ9IjIwMHB4IiAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQiIGNsYXNzPSJsZHMtcm9sbGluZyIgc3R5bGU9ImJhY2tncm91bmQtaW1hZ2U6IG5vbmU7IGJhY2tncm91bmQtcG9zaXRpb246IGluaXRpYWwgaW5pdGlhbDsgYmFja2dyb3VuZC1yZXBlYXQ6IGluaXRpYWwgaW5pdGlhbDsiPjxjaXJjbGUgY3g9IjUwIiBjeT0iNTAiIGZpbGw9Im5vbmUiIG5nLWF0dHItc3Ryb2tlPSJ7e2NvbmZpZy5jb2xvcn19IiBuZy1hdHRyLXN0cm9rZS13aWR0aD0ie3tjb25maWcud2lkdGh9fSIgbmctYXR0ci1yPSJ7e2NvbmZpZy5yYWRpdXN9fSIgbmctYXR0ci1zdHJva2UtZGFzaGFycmF5PSJ7e2NvbmZpZy5kYXNoYXJyYXl9fSIgc3Ryb2tlPSIjNTU1NTU1IiBzdHJva2Utd2lkdGg9IjEwIiByPSIzNSIgc3Ryb2tlLWRhc2hhcnJheT0iMTY0LjkzMzYxNDMxMzQ2NDE1IDU2Ljk3Nzg3MTQzNzgyMTM4Ij48YW5pbWF0ZVRyYW5zZm9ybSBhdHRyaWJ1dGVOYW1lPSJ0cmFuc2Zvcm0iIHR5cGU9InJvdGF0ZSIgY2FsY01vZGU9ImxpbmVhciIgdmFsdWVzPSIwIDUwIDUwOzM2MCA1MCA1MCIga2V5VGltZXM9IjA7MSIgZHVyPSIxcyIgYmVnaW49IjBzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSI+PC9hbmltYXRlVHJhbnNmb3JtPjwvY2lyY2xlPjwvc3ZnPgo=";
;// CONCATENATED MODULE: ./src/core/components/operation.jsx
class Operation extends external_react_namespaceObject.PureComponent {
render() {
let {
specPath,
response,
request,
toggleShown,
onTryoutClick,
onResetClick,
onCancelClick,
onExecute,
fn,
getComponent,
getConfigs,
specActions,
specSelectors,
authActions,
authSelectors,
oas3Actions,
oas3Selectors
} = this.props;
let operationProps = this.props.operation;
let {
deprecated,
isShown,
path,
method,
op,
tag,
operationId,
allowTryItOut,
displayRequestDuration,
tryItOutEnabled,
executeInProgress
} = operationProps.toJS();
let {
description,
externalDocs,
schemes
} = op;
const externalDocsUrl = externalDocs ? safeBuildUrl(externalDocs.url, specSelectors.url(), { selectedServer: oas3Selectors.selectedServer() }) : "";
let operation = operationProps.getIn(["op"]);
let responses = operation.get("responses");
let parameters = getList(operation, ["parameters"]);
let operationScheme = specSelectors.operationScheme(path, method);
let isShownKey = ["operations", tag, operationId];
let extensions = getExtensions(operation);
const Responses = getComponent("responses");
const Parameters = getComponent("parameters");
const Execute = getComponent("execute");
const Clear = getComponent("clear");
const Collapse = getComponent("Collapse");
const Markdown = getComponent("Markdown", true);
const Schemes = getComponent("schemes");
const OperationServers = getComponent("OperationServers");
const OperationExt = getComponent("OperationExt");
const OperationSummary = getComponent("OperationSummary");
const Link = getComponent("Link");
const { showExtensions } = getConfigs();
// Merge in Live Response
if (responses && response && response.size > 0) {
let notDocumented = !responses.get(String(response.get("status"))) && !responses.get("default");
response = response.set("notDocumented", notDocumented);
}
let onChangeKey = [path, method]; // Used to add values to _this_ operation ( indexed by path and method )
const validationErrors = specSelectors.validationErrors([path, method]);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: deprecated ? "opblock opblock-deprecated" : isShown ? `opblock opblock-${method} is-open` : `opblock opblock-${method}`, id: escapeDeepLinkPath(isShownKey.join("-")) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(OperationSummary, { operationProps: operationProps, isShown: isShown, toggleShown: toggleShown, getComponent: getComponent, authActions: authActions, authSelectors: authSelectors, specPath: specPath }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Collapse, { isOpened: isShown }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-body" },
operation && operation.size || operation === null ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("img", { height: "32px", width: "32px", src: rolling_load_namespaceObject, className: "opblock-loading-animation" }),
deprecated && /*#__PURE__*/external_react_namespaceObject["default"].createElement("h4", { className: "opblock-title_normal" }, " Warning: Deprecated"),
description && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-description-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: description })
)
),
externalDocsUrl ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-external-docs-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "opblock-title_normal" }, "Find more details"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-external-docs" },
externalDocs.description && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "opblock-external-docs__description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: externalDocs.description })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", className: "opblock-external-docs__link", href: sanitizeUrl(externalDocsUrl) }, externalDocsUrl)
)
) : null,
!operation || !operation.size ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Parameters, {
parameters: parameters,
specPath: specPath.push("parameters"),
operation: operation,
onChangeKey: onChangeKey,
onTryoutClick: onTryoutClick,
onResetClick: onResetClick,
onCancelClick: onCancelClick,
tryItOutEnabled: tryItOutEnabled,
allowTryItOut: allowTryItOut,
fn: fn,
getComponent: getComponent,
specActions: specActions,
specSelectors: specSelectors,
pathMethod: [path, method],
getConfigs: getConfigs,
oas3Actions: oas3Actions,
oas3Selectors: oas3Selectors }
),
!tryItOutEnabled ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(OperationServers, {
getComponent: getComponent,
path: path,
method: method,
operationServers: operation.get("servers"),
pathServers: specSelectors.paths().getIn([path, "servers"]),
getSelectedServer: oas3Selectors.selectedServer,
setSelectedServer: oas3Actions.setSelectedServer,
setServerVariableValue: oas3Actions.setServerVariableValue,
getServerVariable: oas3Selectors.serverVariableValue,
getEffectiveServerValue: oas3Selectors.serverEffectiveValue }
),
!tryItOutEnabled || !allowTryItOut ? null : schemes && schemes.size ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "opblock-schemes" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Schemes, { schemes: schemes,
path: path,
method: method,
specActions: specActions,
currentScheme: operationScheme })
) : null,
!tryItOutEnabled || !allowTryItOut || validationErrors.length <= 0 ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "validation-errors errors-wrapper" }, "Please correct the following validation errors and try again.", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", null,
validationErrors.map((error, index) => /*#__PURE__*/external_react_namespaceObject["default"].createElement("li", { key: index }, " ", error, " "))
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: !tryItOutEnabled || !response || !allowTryItOut ? "execute-wrapper" : "btn-group" },
!tryItOutEnabled || !allowTryItOut ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Execute, {
operation: operation,
specActions: specActions,
specSelectors: specSelectors,
oas3Selectors: oas3Selectors,
oas3Actions: oas3Actions,
path: path,
method: method,
onExecute: onExecute,
disabled: executeInProgress }),
!tryItOutEnabled || !response || !allowTryItOut ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Clear, {
specActions: specActions,
path: path,
method: method })
),
executeInProgress ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "loading-container" }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "loading" })) : null,
!responses ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Responses, {
responses: responses,
request: request,
tryItOutResponse: response,
getComponent: getComponent,
getConfigs: getConfigs,
specSelectors: specSelectors,
oas3Actions: oas3Actions,
oas3Selectors: oas3Selectors,
specActions: specActions,
produces: specSelectors.producesOptionsFor([path, method]),
producesValue: specSelectors.currentProducesFor([path, method]),
specPath: specPath.push("responses"),
path: path,
method: method,
displayRequestDuration: displayRequestDuration,
fn: fn }),
!showExtensions || !extensions.size ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(OperationExt, { extensions: extensions, getComponent: getComponent })
)
)
));
}
}(0,defineProperty_namespaceObject["default"])(Operation, "defaultProps", { operation: null, response: null, request: null, specPath: (0,external_immutable_namespaceObject.List)(), summary: "" });
;// CONCATENATED MODULE: ./src/core/containers/OperationContainer.jsx
class OperationContainer extends external_react_namespaceObject.PureComponent {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "toggleShown",
() => {
let { layoutActions, tag, operationId, isShown } = this.props;
const resolvedSubtree = this.getResolvedSubtree();
if (!isShown && resolvedSubtree === undefined) {
// transitioning from collapsed to expanded
this.requestResolvedSubtree();
}
layoutActions.show(["operations", tag, operationId], !isShown);
});(0,defineProperty_namespaceObject["default"])(this, "onCancelClick",
() => {
this.setState({ tryItOutEnabled: !this.state.tryItOutEnabled });
});(0,defineProperty_namespaceObject["default"])(this, "onTryoutClick",
() => {
this.setState({ tryItOutEnabled: !this.state.tryItOutEnabled });
});(0,defineProperty_namespaceObject["default"])(this, "onResetClick",
(pathMethod) => {
const defaultRequestBodyValue = this.props.oas3Selectors.selectDefaultRequestBodyValue(...pathMethod);
this.props.oas3Actions.setRequestBodyValue({ value: defaultRequestBodyValue, pathMethod });
});(0,defineProperty_namespaceObject["default"])(this, "onExecute",
() => {
this.setState({ executeInProgress: true });
});(0,defineProperty_namespaceObject["default"])(this, "getResolvedSubtree",
() => {
const {
specSelectors,
path,
method,
specPath
} = this.props;
if (specPath) {
return specSelectors.specResolvedSubtree(specPath.toJS());
}
return specSelectors.specResolvedSubtree(["paths", path, method]);
});(0,defineProperty_namespaceObject["default"])(this, "requestResolvedSubtree",
() => {
const {
specActions,
path,
method,
specPath
} = this.props;
if (specPath) {
return specActions.requestResolvedSubtree(specPath.toJS());
}
return specActions.requestResolvedSubtree(["paths", path, method]);
});const { tryItOutEnabled } = props.getConfigs();this.state = { tryItOutEnabled: tryItOutEnabled === true || tryItOutEnabled === "true", executeInProgress: false };}mapStateToProps(nextState, props) {const { op, layoutSelectors, getConfigs } = props;const { docExpansion, deepLinking, displayOperationId, displayRequestDuration, supportedSubmitMethods } = getConfigs();const showSummary = layoutSelectors.showSummary();const operationId = op.getIn(["operation", "__originalOperationId"]) || op.getIn(["operation", "operationId"]) || (0,es_helpers_namespaceObject.opId)(op.get("operation"), props.path, props.method) || op.get("id");const isShownKey = ["operations", props.tag, operationId];const isDeepLinkingEnabled = deepLinking && deepLinking !== "false";const allowTryItOut = supportedSubmitMethods.indexOf(props.method) >= 0 && (typeof props.allowTryItOut === "undefined" ? props.specSelectors.allowTryItOutFor(props.path, props.method) : props.allowTryItOut);const security = op.getIn(["operation", "security"]) || props.specSelectors.security();return { operationId, isDeepLinkingEnabled, showSummary, displayOperationId, displayRequestDuration, allowTryItOut, security, isAuthorized: props.authSelectors.isAuthorized(security), isShown: layoutSelectors.isShown(isShownKey, docExpansion === "full"), jumpToKey: `paths.${props.path}.${props.method}`, response: props.specSelectors.responseFor(props.path, props.method), request: props.specSelectors.requestFor(props.path, props.method) };}componentDidMount() {const { isShown } = this.props;const resolvedSubtree = this.getResolvedSubtree();if (isShown && resolvedSubtree === undefined) {this.requestResolvedSubtree();}}UNSAFE_componentWillReceiveProps(nextProps) {const { response, isShown } = nextProps;const resolvedSubtree = this.getResolvedSubtree();if (response !== this.props.response) {this.setState({ executeInProgress: false });}if (isShown && resolvedSubtree === undefined) {this.requestResolvedSubtree();}}
render() {
let {
op: unresolvedOp,
tag,
path,
method,
security,
isAuthorized,
operationId,
showSummary,
isShown,
jumpToKey,
allowTryItOut,
response,
request,
displayOperationId,
displayRequestDuration,
isDeepLinkingEnabled,
specPath,
specSelectors,
specActions,
getComponent,
getConfigs,
layoutSelectors,
layoutActions,
authActions,
authSelectors,
oas3Actions,
oas3Selectors,
fn
} = this.props;
const Operation = getComponent("operation");
const resolvedSubtree = this.getResolvedSubtree() || (0,external_immutable_namespaceObject.Map)();
const operationProps = (0,external_immutable_namespaceObject.fromJS)({
op: resolvedSubtree,
tag,
path,
summary: unresolvedOp.getIn(["operation", "summary"]) || "",
deprecated: resolvedSubtree.get("deprecated") || unresolvedOp.getIn(["operation", "deprecated"]) || false,
method,
security,
isAuthorized,
operationId,
originalOperationId: resolvedSubtree.getIn(["operation", "__originalOperationId"]),
showSummary,
isShown,
jumpToKey,
allowTryItOut,
request,
displayOperationId,
displayRequestDuration,
isDeepLinkingEnabled,
executeInProgress: this.state.executeInProgress,
tryItOutEnabled: this.state.tryItOutEnabled
});
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(Operation, {
operation: operationProps,
response: response,
request: request,
isShown: isShown,
toggleShown: this.toggleShown,
onTryoutClick: this.onTryoutClick,
onResetClick: this.onResetClick,
onCancelClick: this.onCancelClick,
onExecute: this.onExecute,
specPath: specPath,
specActions: specActions,
specSelectors: specSelectors,
oas3Actions: oas3Actions,
oas3Selectors: oas3Selectors,
layoutActions: layoutActions,
layoutSelectors: layoutSelectors,
authActions: authActions,
authSelectors: authSelectors,
getComponent: getComponent,
getConfigs: getConfigs,
fn: fn }
));
}
}(0,defineProperty_namespaceObject["default"])(OperationContainer, "defaultProps", { showSummary: true, response: null, allowTryItOut: true, displayOperationId: false, displayRequestDuration: false });
;// CONCATENATED MODULE: external "lodash/toString"
var toString_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var toString_y = x => () => x
const toString_namespaceObject = toString_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_toString_da931f05__["default"] });
;// CONCATENATED MODULE: ./src/core/components/operation-summary.jsx
class OperationSummary extends external_react_namespaceObject.PureComponent {
render() {
let {
isShown,
toggleShown,
getComponent,
authActions,
authSelectors,
operationProps,
specPath
} = this.props;
let {
summary,
isAuthorized,
method,
op,
showSummary,
path,
operationId,
originalOperationId,
displayOperationId
} = operationProps.toJS();
let {
summary: resolvedSummary
} = op;
let security = operationProps.get("security");
const AuthorizeOperationBtn = getComponent("authorizeOperationBtn", true);
const OperationSummaryMethod = getComponent("OperationSummaryMethod");
const OperationSummaryPath = getComponent("OperationSummaryPath");
const JumpToPath = getComponent("JumpToPath", true);
const CopyToClipboardBtn = getComponent("CopyToClipboardBtn", true);
const ArrowUpIcon = getComponent("ArrowUpIcon");
const ArrowDownIcon = getComponent("ArrowDownIcon");
const hasSecurity = security && !!security.count();
const securityIsOptional = hasSecurity && security.size === 1 && security.first().isEmpty();
const allowAnonymous = !hasSecurity || securityIsOptional;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: `opblock-summary opblock-summary-${method}` }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", {
"aria-label": `${method} ${path.replace(/\//g, "\u200b/")}`,
"aria-expanded": isShown,
className: "opblock-summary-control",
onClick: toggleShown }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(OperationSummaryMethod, { method: method }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(OperationSummaryPath, { getComponent: getComponent, operationProps: operationProps, specPath: specPath }),
!showSummary ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-summary-description" },
(0,toString_namespaceObject["default"])(resolvedSummary || summary)
),
displayOperationId && (originalOperationId || operationId) ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "opblock-summary-operation-id" }, originalOperationId || operationId) : null
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(CopyToClipboardBtn, { textToCopy: `${specPath.get(1)}` }),
allowAnonymous ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(AuthorizeOperationBtn, {
isAuthorized: isAuthorized,
onClick: () => {
const applicableDefinitions = authSelectors.definitionsForRequirements(security);
authActions.showDefinitions(applicableDefinitions);
} }
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", {
"aria-label": `${method} ${path.replace(/\//g, "\u200b/")}`,
className: "opblock-control-arrow",
"aria-expanded": isShown,
tabIndex: "-1",
onClick: toggleShown },
isShown ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowUpIcon, { className: "arrow" }) : /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowDownIcon, { className: "arrow" })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JumpToPath, { path: specPath })
));
}
}(0,defineProperty_namespaceObject["default"])(OperationSummary, "defaultProps", { operationProps: null, specPath: (0,external_immutable_namespaceObject.List)(), summary: "" });
;// CONCATENATED MODULE: ./src/core/components/operation-summary-method.jsx
class OperationSummaryMethod extends external_react_namespaceObject.PureComponent {
render() {
let {
method
} = this.props;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", { className: "opblock-summary-method" }, method.toUpperCase()));
}
}(0,defineProperty_namespaceObject["default"])(OperationSummaryMethod, "defaultProps", { operationProps: null });
;// CONCATENATED MODULE: ./src/core/components/operation-summary-path.jsx
class OperationSummaryPath extends external_react_namespaceObject.PureComponent {
render() {
let {
getComponent,
operationProps
} = this.props;
let {
deprecated,
isShown,
path,
tag,
operationId,
isDeepLinkingEnabled
} = operationProps.toJS();
/**
* Add word-break elements between each segment, before the slash
* to allow browsers an opportunity to break long paths into sensible segments.
*/
const pathParts = path.split(/(?=\/)/g);
for (let i = 1; i < pathParts.length; i += 2) {
pathParts.splice(i, 0, /*#__PURE__*/external_react_namespaceObject["default"].createElement("wbr", { key: i }));
}
const DeepLink = getComponent("DeepLink");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", { className: deprecated ? "opblock-summary-path__deprecated" : "opblock-summary-path",
"data-path": path }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(DeepLink, {
enabled: isDeepLinkingEnabled,
isShown: isShown,
path: createDeepLinkPath(`${tag}/${operationId}`),
text: pathParts })
));
}
}
;// CONCATENATED MODULE: ./src/core/components/operation-extensions.jsx
const OperationExt = (_ref) => {let { extensions, getComponent } = _ref;
let OperationExtRow = getComponent("OperationExtRow");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "opblock-section" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-section-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, "Extensions")
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "table-container" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("table", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("thead", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "col_header" }, "Field"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "col_header" }, "Value")
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tbody", null,
extensions.entrySeq().map((_ref2) => {let [k, v] = _ref2;return /*#__PURE__*/external_react_namespaceObject["default"].createElement(OperationExtRow, { key: `${k}-${v}`, xKey: k, xVal: v });})
)
)
)
));
};
/* harmony default export */ const operation_extensions = (OperationExt);
;// CONCATENATED MODULE: ./src/core/components/operation-extension-row.jsx
const OperationExtRow = (_ref) => {let { xKey, xVal } = _ref;
const xNormalizedValue = !xVal ? null : xVal.toJS ? xVal.toJS() : xVal;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("tr", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, xKey), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, JSON.stringify(xNormalizedValue))
);
};
/* harmony default export */ const operation_extension_row = (OperationExtRow);
;// CONCATENATED MODULE: external "classnames"
var external_classnames_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_classnames_y = x => () => x
const external_classnames_namespaceObject = external_classnames_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_classnames__["default"] });
;// CONCATENATED MODULE: external "js-file-download"
var external_js_file_download_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_js_file_download_y = x => () => x
const external_js_file_download_namespaceObject = external_js_file_download_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_js_file_download_bd23dbb6__["default"] });
;// CONCATENATED MODULE: ./src/core/components/highlight-code.jsx
const HighlightCode = (_ref) => {let { value, fileName, className, downloadable, getConfigs, canCopy, language } = _ref;
const config = (0,isFunction_namespaceObject["default"])(getConfigs) ? getConfigs() : null;
const canSyntaxHighlight = (0,get_namespaceObject["default"])(config, "syntaxHighlight") !== false && (0,get_namespaceObject["default"])(config, "syntaxHighlight.activated", true);
const rootRef = (0,external_react_namespaceObject.useRef)(null);
(0,external_react_namespaceObject.useEffect)(() => {
const childNodes = Array.
from(rootRef.current.childNodes).
filter((node) => !!node.nodeType && node.classList.contains("microlight"));
// eslint-disable-next-line no-use-before-define
childNodes.forEach((node) => node.addEventListener("mousewheel", handlePreventYScrollingBeyondElement, { passive: false }));
return () => {
// eslint-disable-next-line no-use-before-define
childNodes.forEach((node) => node.removeEventListener("mousewheel", handlePreventYScrollingBeyondElement));
};
}, [value, className, language]);
const handleDownload = () => {
(0,external_js_file_download_namespaceObject["default"])(value, fileName);
};
const handlePreventYScrollingBeyondElement = (e) => {
const { target, deltaY } = e;
const { scrollHeight: contentHeight, offsetHeight: visibleHeight, scrollTop } = target;
const scrollOffset = visibleHeight + scrollTop;
const isElementScrollable = contentHeight > visibleHeight;
const isScrollingPastTop = scrollTop === 0 && deltaY < 0;
const isScrollingPastBottom = scrollOffset >= contentHeight && deltaY > 0;
if (isElementScrollable && (isScrollingPastTop || isScrollingPastBottom)) {
e.preventDefault();
}
};
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "highlight-code", ref: rootRef },
canCopy && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "copy-to-clipboard" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_copy_to_clipboard_namespaceObject.CopyToClipboard, { text: value }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("button", null))
),
!downloadable ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", { className: "download-contents", onClick: handleDownload }, "Download"
),
canSyntaxHighlight ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(light_namespaceObject["default"], {
language: language,
className: (0,external_classnames_namespaceObject["default"])(className, "microlight"),
style: getStyle((0,get_namespaceObject["default"])(config, "syntaxHighlight.theme", "agate")) },
value
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("pre", { className: (0,external_classnames_namespaceObject["default"])(className, "microlight") }, value)
));
};
HighlightCode.defaultProps = {
fileName: "response.txt"
};
/* harmony default export */ const highlight_code = (HighlightCode);
;// CONCATENATED MODULE: ./src/core/utils/create-html-ready-id.js
/**
* Replace invalid characters from a string to create an html-ready ID
*
* @param {string} id A string that may contain invalid characters for the HTML ID attribute
* @param {string} [replacement=_] The string to replace invalid characters with; "_" by default
* @return {string} Information about the parameter schema
*/
function createHtmlReadyId(id) {let replacement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "_";
return id.replace(/[^\w-]/g, replacement);
}
;// CONCATENATED MODULE: ./src/core/components/responses.jsx
class Responses extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);
// These performance-enhancing checks were disabled as part of Multiple Examples
// because they were causing data-consistency issues
//
// shouldComponentUpdate(nextProps) {
// // BUG: props.tryItOutResponse is always coming back as a new Immutable instance
// let render = this.props.tryItOutResponse !== nextProps.tryItOutResponse
// || this.props.responses !== nextProps.responses
// || this.props.produces !== nextProps.produces
// || this.props.producesValue !== nextProps.producesValue
// || this.props.displayRequestDuration !== nextProps.displayRequestDuration
// || this.props.path !== nextProps.path
// || this.props.method !== nextProps.method
// return render
// }
(0,defineProperty_namespaceObject["default"])(this, "onChangeProducesWrapper",
(val) => this.props.specActions.changeProducesValue([this.props.path, this.props.method], val));(0,defineProperty_namespaceObject["default"])(this, "onResponseContentTypeChange",
(_ref) => {let { controlsAcceptHeader, value } = _ref;
const { oas3Actions, path, method } = this.props;
if (controlsAcceptHeader) {
oas3Actions.setResponseContentType({
value,
path,
method
});
}
});}
render() {
let {
responses,
tryItOutResponse,
getComponent,
getConfigs,
specSelectors,
fn,
producesValue,
displayRequestDuration,
specPath,
path,
method,
oas3Selectors,
oas3Actions
} = this.props;
let defaultCode = defaultStatusCode(responses);
const ContentType = getComponent("contentType");
const LiveResponse = getComponent("liveResponse");
const Response = getComponent("response");
let produces = this.props.produces && this.props.produces.size ? this.props.produces : Responses.defaultProps.produces;
const isSpecOAS3 = specSelectors.isOAS3();
const acceptControllingResponse = isSpecOAS3 ?
getAcceptControllingResponse(responses) : null;
const regionId = createHtmlReadyId(`${method}${path}_responses`);
const controlId = `${regionId}_select`;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "responses-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-section-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, "Responses"),
specSelectors.isOAS3() ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement("label", { htmlFor: controlId }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, "Response content type"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ContentType, { value: producesValue,
ariaControls: regionId,
ariaLabel: "Response content type",
className: "execute-content-type",
contentTypes: produces,
controlId: controlId,
onChange: this.onChangeProducesWrapper })
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "responses-inner" },
!tryItOutResponse ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(LiveResponse, { response: tryItOutResponse,
getComponent: getComponent,
getConfigs: getConfigs,
specSelectors: specSelectors,
path: this.props.path,
method: this.props.method,
displayRequestDuration: displayRequestDuration }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, "Responses")
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("table", { "aria-live": "polite", className: "responses-table", id: regionId, role: "region" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("thead", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", { className: "responses-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "col_header response-col_status" }, "Code"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "col_header response-col_description" }, "Description"),
specSelectors.isOAS3() ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("td", { className: "col col_header response-col_links" }, "Links") : null
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tbody", null,
responses.entrySeq().map((_ref2) => {let [code, response] = _ref2;
let className = tryItOutResponse && tryItOutResponse.get("status") == code ? "response_current" : "";
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(Response, { key: code,
path: path,
method: method,
specPath: specPath.push(code),
isDefault: defaultCode === code,
fn: fn,
className: className,
code: code,
response: response,
specSelectors: specSelectors,
controlsAcceptHeader: response === acceptControllingResponse,
onContentTypeChange: this.onResponseContentTypeChange,
contentType: producesValue,
getConfigs: getConfigs,
activeExamplesKey: oas3Selectors.activeExamplesMember(
path,
method,
"responses",
code
),
oas3Actions: oas3Actions,
getComponent: getComponent }));
}).toArray()
)
)
)
));
}
}(0,defineProperty_namespaceObject["default"])(Responses, "defaultProps", { tryItOutResponse: null, produces: (0,external_immutable_namespaceObject.fromJS)(["application/json"]), displayRequestDuration: false });
;// CONCATENATED MODULE: ./src/core/utils/jsonParse.js
function canJsonParse(str) {
try {
let testValueForJson = JSON.parse(str);
return testValueForJson ? true : false;
} catch (e) {
// exception: string is not valid json
return null;
}
}
function getKnownSyntaxHighlighterLanguage(val) {
// to start, only check for json. can expand as needed in future
const isValidJson = canJsonParse(val);
return isValidJson ? "json" : null;
}
;// CONCATENATED MODULE: ./src/core/components/response.jsx
const getExampleComponent = (sampleResponse, HighlightCode, getConfigs) => {
if (
sampleResponse !== undefined &&
sampleResponse !== null)
{
let language = null;
let testValueForJson = getKnownSyntaxHighlighterLanguage(sampleResponse);
if (testValueForJson) {
language = "json";
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(HighlightCode, { className: "example", getConfigs: getConfigs, language: language, value: stringify(sampleResponse) })
);
}
return null;
};
class Response extends external_react_namespaceObject["default"].Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "_onContentTypeChange",
(value) => {
const { onContentTypeChange, controlsAcceptHeader } = this.props;
this.setState({ responseContentType: value });
onContentTypeChange({
value: value,
controlsAcceptHeader
});
});(0,defineProperty_namespaceObject["default"])(this, "getTargetExamplesKey",
() => {
const { response, contentType, activeExamplesKey } = this.props;
const activeContentType = this.state.responseContentType || contentType;
const activeMediaType = response.getIn(["content", activeContentType], (0,external_immutable_namespaceObject.Map)({}));
const examplesForMediaType = activeMediaType.get("examples", null);
const firstExamplesKey = examplesForMediaType.keySeq().first();
return activeExamplesKey || firstExamplesKey;
});this.state = { responseContentType: "" };}
render() {
let {
path,
method,
code,
response,
className,
specPath,
fn,
getComponent,
getConfigs,
specSelectors,
contentType,
controlsAcceptHeader,
oas3Actions
} = this.props;
let { inferSchema, getSampleSchema } = fn;
let isOAS3 = specSelectors.isOAS3();
const { showExtensions } = getConfigs();
let extensions = showExtensions ? getExtensions(response) : null;
let headers = response.get("headers");
let links = response.get("links");
const ResponseExtension = getComponent("ResponseExtension");
const Headers = getComponent("headers");
const HighlightCode = getComponent("highlightCode");
const ModelExample = getComponent("modelExample");
const Markdown = getComponent("Markdown", true);
const OperationLink = getComponent("operationLink");
const ContentType = getComponent("contentType");
const ExamplesSelect = getComponent("ExamplesSelect");
const Example = getComponent("Example");
var schema, specPathWithPossibleSchema;
const activeContentType = this.state.responseContentType || contentType;
const activeMediaType = response.getIn(["content", activeContentType], (0,external_immutable_namespaceObject.Map)({}));
const examplesForMediaType = activeMediaType.get("examples", null);
// Goal: find a schema value for `schema`
if (isOAS3) {
const oas3SchemaForContentType = activeMediaType.get("schema");
schema = oas3SchemaForContentType ? inferSchema(oas3SchemaForContentType.toJS()) : null;
specPathWithPossibleSchema = oas3SchemaForContentType ? (0,external_immutable_namespaceObject.List)(["content", this.state.responseContentType, "schema"]) : specPath;
} else {
schema = response.get("schema");
specPathWithPossibleSchema = response.has("schema") ? specPath.push("schema") : specPath;
}
let mediaTypeExample;
let shouldOverrideSchemaExample = false;
let sampleSchema;
let sampleGenConfig = {
includeReadOnly: true
};
// Goal: find an example value for `sampleResponse`
if (isOAS3) {var _activeMediaType$get;
sampleSchema = (_activeMediaType$get = activeMediaType.get("schema")) === null || _activeMediaType$get === void 0 ? void 0 : _activeMediaType$get.toJS();
if (examplesForMediaType) {
const targetExamplesKey = this.getTargetExamplesKey();
const targetExample = examplesForMediaType.
get(targetExamplesKey, (0,external_immutable_namespaceObject.Map)({}));
const getMediaTypeExample = (targetExample) =>
targetExample.get("value");
mediaTypeExample = getMediaTypeExample(targetExample);
if (mediaTypeExample === undefined) {
mediaTypeExample = getMediaTypeExample(examplesForMediaType.values().next().value);
}
shouldOverrideSchemaExample = true;
} else if (activeMediaType.get("example") !== undefined) {
// use the example key's value
mediaTypeExample = activeMediaType.get("example");
shouldOverrideSchemaExample = true;
}
} else {
sampleSchema = schema;
sampleGenConfig = (0,objectSpread2_namespaceObject["default"])((0,objectSpread2_namespaceObject["default"])({}, sampleGenConfig), {}, { includeWriteOnly: true });
const oldOASMediaTypeExample = response.getIn(["examples", activeContentType]);
if (oldOASMediaTypeExample) {
mediaTypeExample = oldOASMediaTypeExample;
shouldOverrideSchemaExample = true;
}
}
const sampleResponse = getSampleSchema(
sampleSchema,
activeContentType,
sampleGenConfig,
shouldOverrideSchemaExample ? mediaTypeExample : undefined
);
let example = getExampleComponent(sampleResponse, HighlightCode, getConfigs);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("tr", { className: "response " + (className || ""), "data-code": code }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "response-col_status" },
code
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "response-col_description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "response-col_description__inner" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: response.get("description") })
),
!showExtensions || !extensions.size ? null : extensions.entrySeq().map((_ref) => {let [key, v] = _ref;return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ResponseExtension, { key: `${key}-${v}`, xKey: key, xVal: v });}),
isOAS3 && response.get("content") ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("section", { className: "response-controls" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", {
className: (0,external_classnames_namespaceObject["default"])("response-control-media-type", {
"response-control-media-type--accept-controller": controlsAcceptHeader
}) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("small", { className: "response-control-media-type__title" }, "Media type"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ContentType, {
value: this.state.responseContentType,
contentTypes:
response.get("content") ?
response.get("content").keySeq() :
(0,external_immutable_namespaceObject.Seq)(),
onChange: this._onContentTypeChange,
ariaLabel: "Media Type" }
),
controlsAcceptHeader ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("small", { className: "response-control-media-type__accept-message" }, "Controls ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, "Accept"), " header."
) :
null
),
examplesForMediaType ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "response-control-examples" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("small", { className: "response-control-examples__title" }, "Examples"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExamplesSelect, {
examples: examplesForMediaType,
currentExampleKey: this.getTargetExamplesKey(),
onSelect: (key) =>
oas3Actions.setActiveExamplesMember({
name: key,
pathMethod: [path, method],
contextType: "responses",
contextName: code
}),
showLabels: false }
)
) :
null
) :
null,
example || schema ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ModelExample, {
specPath: specPathWithPossibleSchema,
getComponent: getComponent,
getConfigs: getConfigs,
specSelectors: specSelectors,
schema: fromJSOrdered(schema),
example: example,
includeReadOnly: true }) :
null,
isOAS3 && examplesForMediaType ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Example, {
example: examplesForMediaType.get(this.getTargetExamplesKey(), (0,external_immutable_namespaceObject.Map)({})),
getComponent: getComponent,
getConfigs: getConfigs,
omitValue: true }
) :
null,
headers ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Headers, {
headers: headers,
getComponent: getComponent }
) :
null
),
isOAS3 ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("td", { className: "response-col_links" },
links ?
links.toSeq().entrySeq().map((_ref2) => {let [key, link] = _ref2;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(OperationLink, { key: key, name: key, link: link, getComponent: getComponent });
}) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("i", null, "No links")
) : null
));
}
}(0,defineProperty_namespaceObject["default"])(Response, "defaultProps", { response: (0,external_immutable_namespaceObject.fromJS)({}), onContentTypeChange: () => {} });
;// CONCATENATED MODULE: ./src/core/components/response-extension.jsx
const ResponseExtension = (_ref) => {let { xKey, xVal } = _ref;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "response__extension" }, xKey, ": ", String(xVal));
};
/* harmony default export */ const response_extension = (ResponseExtension);
;// CONCATENATED MODULE: external "xml-but-prettier"
var external_xml_but_prettier_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_xml_but_prettier_y = x => () => x
const external_xml_but_prettier_namespaceObject = external_xml_but_prettier_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_xml_but_prettier_2ed4d5cb__["default"] });
;// CONCATENATED MODULE: external "lodash/toLower"
var toLower_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var toLower_y = x => () => x
const toLower_namespaceObject = toLower_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_toLower_c29ee2b0__["default"] });
;// CONCATENATED MODULE: ./src/core/components/response-body.jsx
class ResponseBody extends external_react_namespaceObject["default"].PureComponent {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "state",
{
parsedContent: null
});(0,defineProperty_namespaceObject["default"])(this, "updateParsedContent",
(prevContent) => {
const { content } = this.props;
if (prevContent === content) {
return;
}
if (content && content instanceof Blob) {
var reader = new FileReader();
reader.onload = () => {
this.setState({
parsedContent: reader.result
});
};
reader.readAsText(content);
} else {
this.setState({
parsedContent: content.toString()
});
}
});}
componentDidMount() {
this.updateParsedContent(null);
}
componentDidUpdate(prevProps) {
this.updateParsedContent(prevProps.content);
}
render() {
let { content, contentType, url, headers = {}, getConfigs, getComponent } = this.props;
const { parsedContent } = this.state;
const HighlightCode = getComponent("highlightCode");
const downloadName = "response_" + new Date().getTime();
let body, bodyEl;
url = url || "";
if (
(/^application\/octet-stream/i.test(contentType) ||
headers["Content-Disposition"] && /attachment/i.test(headers["Content-Disposition"]) ||
headers["content-disposition"] && /attachment/i.test(headers["content-disposition"]) ||
headers["Content-Description"] && /File Transfer/i.test(headers["Content-Description"]) ||
headers["content-description"] && /File Transfer/i.test(headers["content-description"])) &&
content.size > 0)
{
// Download
if ("Blob" in window) {
let type = contentType || "text/html";
let blob = content instanceof Blob ? content : new Blob([content], { type: type });
let href = window.URL.createObjectURL(blob);
let fileName = url.substr(url.lastIndexOf("/") + 1);
let download = [type, fileName, href].join(":");
// Use filename from response header,
// First check if filename is quoted (e.g. contains space), if no, fallback to not quoted check
let disposition = headers["content-disposition"] || headers["Content-Disposition"];
if (typeof disposition !== "undefined") {
let responseFilename = extractFileNameFromContentDispositionHeader(disposition);
if (responseFilename !== null) {
download = responseFilename;
}
}
if (core_window.navigator && core_window.navigator.msSaveOrOpenBlob) {
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/external_react_namespaceObject["default"].createElement("a", { href: href, onClick: () => core_window.navigator.msSaveOrOpenBlob(blob, download) }, "Download file"));
} else {
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/external_react_namespaceObject["default"].createElement("a", { href: href, download: download }, "Download file"));
}
} else {
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement("pre", { className: "microlight" }, "Download headers detected but your browser does not support downloading binary via XHR (Blob).");
}
// Anything else (CORS)
} else if (/json/i.test(contentType)) {
// JSON
let language = null;
let testValueForJson = getKnownSyntaxHighlighterLanguage(content);
if (testValueForJson) {
language = "json";
}
try {
body = JSON.stringify(JSON.parse(content), null, " ");
} catch (error) {
body = "can't parse JSON. Raw result:\n\n" + content;
}
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement(HighlightCode, { language: language, downloadable: true, fileName: `${downloadName}.json`, value: body, getConfigs: getConfigs, canCopy: true });
// XML
} else if (/xml/i.test(contentType)) {
body = (0,external_xml_but_prettier_namespaceObject["default"])(content, {
textNodesOnSameLine: true,
indentor: " "
});
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement(HighlightCode, { downloadable: true, fileName: `${downloadName}.xml`, value: body, getConfigs: getConfigs, canCopy: true });
// HTML or Plain Text
} else if ((0,toLower_namespaceObject["default"])(contentType) === "text/html" || /text\/plain/.test(contentType)) {
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement(HighlightCode, { downloadable: true, fileName: `${downloadName}.html`, value: content, getConfigs: getConfigs, canCopy: true });
// CSV
} else if ((0,toLower_namespaceObject["default"])(contentType) === "text/csv" || /text\/csv/.test(contentType)) {
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement(HighlightCode, { downloadable: true, fileName: `${downloadName}.csv`, value: content, getConfigs: getConfigs, canCopy: true });
// Image
} else if (/^image\//i.test(contentType)) {
if (contentType.includes("svg")) {
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, " ", content, " ");
} else {
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement("img", { src: window.URL.createObjectURL(content) });
}
// Audio
} else if (/^audio\//i.test(contentType)) {
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement("pre", { className: "microlight" }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("audio", { controls: true, key: url }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("source", { src: url, type: contentType })));
} else if (typeof content === "string") {
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement(HighlightCode, { downloadable: true, fileName: `${downloadName}.txt`, value: content, getConfigs: getConfigs, canCopy: true });
} else if (content.size > 0) {
// We don't know the contentType, but there was some content returned
if (parsedContent) {
// We were able to squeeze something out of content
// in `updateParsedContent`, so let's display it
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", { className: "i" }, "Unrecognized response type; displaying content as text."
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(HighlightCode, { downloadable: true, fileName: `${downloadName}.txt`, value: parsedContent, getConfigs: getConfigs, canCopy: true })
);
} else {
// Give up
bodyEl = /*#__PURE__*/external_react_namespaceObject["default"].createElement("p", { className: "i" }, "Unrecognized response type; unable to display."
);
}
} else {
// We don't know the contentType and there was no content returned
bodyEl = null;
}
return !bodyEl ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h5", null, "Response body"),
bodyEl
);
}
}
;// CONCATENATED MODULE: ./src/core/components/parameters/parameters.jsx
class Parameters extends external_react_namespaceObject.Component {
constructor(props) {
super(props);(0,defineProperty_namespaceObject["default"])(this, "onChange",
(param, value, isXml) => {
let {
specActions: { changeParamByIdentity },
onChangeKey
} = this.props;
changeParamByIdentity(onChangeKey, param, value, isXml);
});(0,defineProperty_namespaceObject["default"])(this, "onChangeConsumesWrapper",
(val) => {
let {
specActions: { changeConsumesValue },
onChangeKey
} = this.props;
changeConsumesValue(onChangeKey, val);
});(0,defineProperty_namespaceObject["default"])(this, "toggleTab",
(tab) => {
if (tab === "parameters") {
return this.setState({
parametersVisible: true,
callbackVisible: false
});
} else if (tab === "callbacks") {
return this.setState({
callbackVisible: true,
parametersVisible: false
});
}
});(0,defineProperty_namespaceObject["default"])(this, "onChangeMediaType",
(_ref) => {let { value, pathMethod } = _ref;
let { specActions, oas3Selectors, oas3Actions } = this.props;
const userHasEditedBody = oas3Selectors.hasUserEditedBody(...pathMethod);
const shouldRetainRequestBodyValue = oas3Selectors.shouldRetainRequestBodyValue(...pathMethod);
oas3Actions.setRequestContentType({ value, pathMethod });
oas3Actions.initRequestBodyValidateError({ pathMethod });
if (!userHasEditedBody) {
if (!shouldRetainRequestBodyValue) {
oas3Actions.setRequestBodyValue({ value: undefined, pathMethod });
}
specActions.clearResponse(...pathMethod);
specActions.clearRequest(...pathMethod);
specActions.clearValidateParams(pathMethod);
}
});this.state = { callbackVisible: false, parametersVisible: true };}
render() {
let {
onTryoutClick,
onResetClick,
parameters,
allowTryItOut,
tryItOutEnabled,
specPath,
fn,
getComponent,
getConfigs,
specSelectors,
specActions,
pathMethod,
oas3Actions,
oas3Selectors,
operation
} = this.props;
const ParameterRow = getComponent("parameterRow");
const TryItOutButton = getComponent("TryItOutButton");
const ContentType = getComponent("contentType");
const Callbacks = getComponent("Callbacks", true);
const RequestBody = getComponent("RequestBody", true);
const isExecute = tryItOutEnabled && allowTryItOut;
const isOAS3 = specSelectors.isOAS3();
const requestBody = operation.get("requestBody");
const groupedParametersArr = Object.values(parameters.
reduce((acc, x) => {var _acc$key;
const key = x.get("in");
(_acc$key = acc[key]) !== null && _acc$key !== void 0 ? _acc$key : acc[key] = [];
acc[key].push(x);
return acc;
}, {})).
reduce((acc, x) => acc.concat(x), []);
const retainRequestBodyValueFlagForOperation = (f) => oas3Actions.setRetainRequestBodyValueFlag({ value: f, pathMethod });
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "opblock-section" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-section-header" },
isOAS3 ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "tab-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { onClick: () => this.toggleTab("parameters"),
className: `tab-item ${this.state.parametersVisible && "active"}` }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "opblock-title" }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, "Parameters"))
),
operation.get("callbacks") ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { onClick: () => this.toggleTab("callbacks"),
className: `tab-item ${this.state.callbackVisible && "active"}` }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "opblock-title" }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, "Callbacks"))
) :
null
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "tab-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "opblock-title" }, "Parameters")
),
allowTryItOut ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(TryItOutButton, {
isOAS3: specSelectors.isOAS3(),
hasUserEditedBody: oas3Selectors.hasUserEditedBody(...pathMethod),
enabled: tryItOutEnabled,
onCancelClick: this.props.onCancelClick,
onTryoutClick: onTryoutClick,
onResetClick: () => onResetClick(pathMethod) }) :
null
),
this.state.parametersVisible ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "parameters-container" },
!groupedParametersArr.length ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "opblock-description-wrapper" }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("p", null, "No parameters")) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "table-container" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("table", { className: "parameters" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("thead", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("th", { className: "col_header parameters-col_name" }, "Name"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("th", { className: "col_header parameters-col_description" }, "Description")
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tbody", null,
groupedParametersArr.map((parameter, i) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ParameterRow, {
fn: fn,
specPath: specPath.push(i.toString()),
getComponent: getComponent,
getConfigs: getConfigs,
rawParam: parameter,
param: specSelectors.parameterWithMetaByIdentity(pathMethod, parameter),
key: `${parameter.get("in")}.${parameter.get("name")}`,
onChange: this.onChange,
onChangeConsumes: this.onChangeConsumesWrapper,
specSelectors: specSelectors,
specActions: specActions,
oas3Actions: oas3Actions,
oas3Selectors: oas3Selectors,
pathMethod: pathMethod,
isExecute: isExecute })
)
)
)
)
) : null,
this.state.callbackVisible ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "callbacks-container opblock-description-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Callbacks, {
callbacks: (0,external_immutable_namespaceObject.Map)(operation.get("callbacks")),
specPath: specPath.slice(0, -1).push("callbacks") }
)
) : null,
isOAS3 && requestBody && this.state.parametersVisible && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-section opblock-section-request-body" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-section-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: `opblock-title parameter__name ${requestBody.get("required") && "required"}` }, "Request body"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ContentType, {
value: oas3Selectors.requestContentType(...pathMethod),
contentTypes: requestBody.get("content", (0,external_immutable_namespaceObject.List)()).keySeq(),
onChange: (value) => {
this.onChangeMediaType({ value, pathMethod });
},
className: "body-param-content-type",
ariaLabel: "Request content type" })
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-description-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(RequestBody, {
setRetainRequestBodyValueFlag: retainRequestBodyValueFlagForOperation,
userHasEditedBody: oas3Selectors.hasUserEditedBody(...pathMethod),
specPath: specPath.slice(0, -1).push("requestBody"),
requestBody: requestBody,
requestBodyValue: oas3Selectors.requestBodyValue(...pathMethod),
requestBodyInclusionSetting: oas3Selectors.requestBodyInclusionSetting(...pathMethod),
requestBodyErrors: oas3Selectors.requestBodyErrors(...pathMethod),
isExecute: isExecute,
getConfigs: getConfigs,
activeExamplesKey: oas3Selectors.activeExamplesMember(
...pathMethod,
"requestBody",
"requestBody" // RBs are currently not stored per-mediaType
),
updateActiveExamplesKey: (key) => {
this.props.oas3Actions.setActiveExamplesMember({
name: key,
pathMethod: this.props.pathMethod,
contextType: "requestBody",
contextName: "requestBody" // RBs are currently not stored per-mediaType
});
},
onChange: (value, path) => {
if (path) {
const lastValue = oas3Selectors.requestBodyValue(...pathMethod);
const usableValue = external_immutable_namespaceObject.Map.isMap(lastValue) ? lastValue : (0,external_immutable_namespaceObject.Map)();
return oas3Actions.setRequestBodyValue({
pathMethod,
value: usableValue.setIn(path, value)
});
}
oas3Actions.setRequestBodyValue({ value, pathMethod });
},
onChangeIncludeEmpty: (name, value) => {
oas3Actions.setRequestBodyInclusion({
pathMethod,
value,
name
});
},
contentType: oas3Selectors.requestContentType(...pathMethod) })
)
)
));
}
}(0,defineProperty_namespaceObject["default"])(Parameters, "defaultProps", { onTryoutClick: Function.prototype, onCancelClick: Function.prototype, tryItOutEnabled: false, allowTryItOut: true, onChangeKey: [], specPath: [] });
;// CONCATENATED MODULE: ./src/core/components/parameters/index.js
;// CONCATENATED MODULE: ./src/core/components/parameter-extension.jsx
const ParameterExt = (_ref) => {let { xKey, xVal } = _ref;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "parameter__extension" }, xKey, ": ", String(xVal));
};
/* harmony default export */ const parameter_extension = (ParameterExt);
;// CONCATENATED MODULE: ./src/core/components/parameter-include-empty.jsx
const noop = () => {};
const ParameterIncludeEmptyDefaultProps = {
onChange: noop,
isIncludedOptions: {}
};
class ParameterIncludeEmpty extends external_react_namespaceObject.Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onCheckboxChange",
(e) => {
const { onChange } = this.props;
onChange(e.target.checked);
});}componentDidMount() {const { isIncludedOptions, onChange } = this.props;const { shouldDispatchInit, defaultValue } = isIncludedOptions;if (shouldDispatchInit) {onChange(defaultValue);}}
render() {
let { isIncluded, isDisabled } = this.props;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", { className: (0,external_classnames_namespaceObject["default"])("parameter__empty_value_toggle", {
"disabled": isDisabled
}) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("input", { type: "checkbox",
disabled: isDisabled,
checked: !isDisabled && isIncluded,
onChange: this.onCheckboxChange }), "Send empty value"
)
));
}
}(0,defineProperty_namespaceObject["default"])(ParameterIncludeEmpty, "defaultProps", ParameterIncludeEmptyDefaultProps);
;// CONCATENATED MODULE: ./src/core/components/parameter-row.jsx
class ParameterRow extends external_react_namespaceObject.Component {
constructor(props, context) {var _this;
super(props, context);_this = this;(0,defineProperty_namespaceObject["default"])(this, "onChangeWrapper",
function (value) {let isXml = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
let { onChange, rawParam } = _this.props;
let valueForUpstream;
// Coerce empty strings and empty Immutable objects to null
if (value === "" || value && value.size === 0) {
valueForUpstream = null;
} else {
valueForUpstream = value;
}
return onChange(rawParam, valueForUpstream, isXml);
});(0,defineProperty_namespaceObject["default"])(this, "_onExampleSelect",
(key /* { isSyntheticChange } = {} */) => {
this.props.oas3Actions.setActiveExamplesMember({
name: key,
pathMethod: this.props.pathMethod,
contextType: "parameters",
contextName: this.getParamKey()
});
});(0,defineProperty_namespaceObject["default"])(this, "onChangeIncludeEmpty",
(newValue) => {
let { specActions, param, pathMethod } = this.props;
const paramName = param.get("name");
const paramIn = param.get("in");
return specActions.updateEmptyParamInclusion(pathMethod, paramName, paramIn, newValue);
});(0,defineProperty_namespaceObject["default"])(this, "setDefaultValue",
() => {
let { specSelectors, pathMethod, rawParam, oas3Selectors, fn } = this.props;
const paramWithMeta = specSelectors.parameterWithMetaByIdentity(pathMethod, rawParam) || (0,external_immutable_namespaceObject.Map)();
const { schema } = getParameterSchema(paramWithMeta, { isOAS3: specSelectors.isOAS3() });
const parameterMediaType = paramWithMeta.
get("content", (0,external_immutable_namespaceObject.Map)()).
keySeq().
first();
// getSampleSchema could return null
const generatedSampleValue = schema ? fn.getSampleSchema(schema.toJS(), parameterMediaType, {
includeWriteOnly: true
}) : null;
if (!paramWithMeta || paramWithMeta.get("value") !== undefined) {
return;
}
if (paramWithMeta.get("in") !== "body") {
let initialValue;
//// Find an initial value
if (specSelectors.isSwagger2()) {
initialValue =
paramWithMeta.get("x-example") !== undefined ?
paramWithMeta.get("x-example") :
paramWithMeta.getIn(["schema", "example"]) !== undefined ?
paramWithMeta.getIn(["schema", "example"]) :
schema && schema.getIn(["default"]);
} else if (specSelectors.isOAS3()) {
const currentExampleKey = oas3Selectors.activeExamplesMember(...pathMethod, "parameters", this.getParamKey());
initialValue =
paramWithMeta.getIn(["examples", currentExampleKey, "value"]) !== undefined ?
paramWithMeta.getIn(["examples", currentExampleKey, "value"]) :
paramWithMeta.getIn(["content", parameterMediaType, "example"]) !== undefined ?
paramWithMeta.getIn(["content", parameterMediaType, "example"]) :
paramWithMeta.get("example") !== undefined ?
paramWithMeta.get("example") :
(schema && schema.get("example")) !== undefined ?
schema && schema.get("example") :
(schema && schema.get("default")) !== undefined ?
schema && schema.get("default") :
paramWithMeta.get("default"); // ensures support for `parameterMacro`
}
//// Process the initial value
if (initialValue !== undefined && !external_immutable_namespaceObject.List.isList(initialValue)) {
// Stringify if it isn't a List
initialValue = stringify(initialValue);
}
//// Dispatch the initial value
if (initialValue !== undefined) {
this.onChangeWrapper(initialValue);
} else if (
schema && schema.get("type") === "object" &&
generatedSampleValue &&
!paramWithMeta.get("examples"))
{
// Object parameters get special treatment.. if the user doesn't set any
// default or example values, we'll provide initial values generated from
// the schema.
// However, if `examples` exist for the parameter, we won't do anything,
// so that the appropriate `examples` logic can take over.
this.onChangeWrapper(
external_immutable_namespaceObject.List.isList(generatedSampleValue) ?
generatedSampleValue :
stringify(generatedSampleValue)
);
}
}
});this.setDefaultValue();}UNSAFE_componentWillReceiveProps(props) {let { specSelectors, pathMethod, rawParam } = props;let isOAS3 = specSelectors.isOAS3();let parameterWithMeta = specSelectors.parameterWithMetaByIdentity(pathMethod, rawParam) || new external_immutable_namespaceObject.Map(); // fallback, if the meta lookup fails
parameterWithMeta = parameterWithMeta.isEmpty() ? rawParam : parameterWithMeta;let enumValue;if (isOAS3) {let { schema } = getParameterSchema(parameterWithMeta, { isOAS3 });enumValue = schema ? schema.get("enum") : undefined;} else {enumValue = parameterWithMeta ? parameterWithMeta.get("enum") : undefined;}let paramValue = parameterWithMeta ? parameterWithMeta.get("value") : undefined;let value;if (paramValue !== undefined) {value = paramValue;} else if (rawParam.get("required") && enumValue && enumValue.size) {value = enumValue.first();}if (value !== undefined && value !== paramValue) {this.onChangeWrapper(numberToString(value));} // todo: could check if schema here; if not, do not call. impact?
this.setDefaultValue();}getParamKey() {
const { param } = this.props;
if (!param) return null;
return `${param.get("name")}-${param.get("in")}`;
}
render() {
let { param, rawParam, getComponent, getConfigs, isExecute, fn, onChangeConsumes, specSelectors, pathMethod, specPath, oas3Selectors } = this.props;
let isOAS3 = specSelectors.isOAS3();
const { showExtensions, showCommonExtensions } = getConfigs();
if (!param) {
param = rawParam;
}
if (!rawParam) return null;
// const onChangeWrapper = (value) => onChange(param, value)
const JsonSchemaForm = getComponent("JsonSchemaForm");
const ParamBody = getComponent("ParamBody");
let inType = param.get("in");
let bodyParam = inType !== "body" ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ParamBody, { getComponent: getComponent,
getConfigs: getConfigs,
fn: fn,
param: param,
consumes: specSelectors.consumesOptionsFor(pathMethod),
consumesValue: specSelectors.contentTypeValues(pathMethod).get("requestContentType"),
onChange: this.onChangeWrapper,
onChangeConsumes: onChangeConsumes,
isExecute: isExecute,
specSelectors: specSelectors,
pathMethod: pathMethod }
);
const ModelExample = getComponent("modelExample");
const Markdown = getComponent("Markdown", true);
const ParameterExt = getComponent("ParameterExt");
const ParameterIncludeEmpty = getComponent("ParameterIncludeEmpty");
const ExamplesSelectValueRetainer = getComponent("ExamplesSelectValueRetainer");
const Example = getComponent("Example");
let { schema } = getParameterSchema(param, { isOAS3 });
let paramWithMeta = specSelectors.parameterWithMetaByIdentity(pathMethod, rawParam) || (0,external_immutable_namespaceObject.Map)();
let format = schema ? schema.get("format") : null;
let type = schema ? schema.get("type") : null;
let itemType = schema ? schema.getIn(["items", "type"]) : null;
let isFormData = inType === "formData";
let isFormDataSupported = ("FormData" in core_window);
let required = param.get("required");
let value = paramWithMeta ? paramWithMeta.get("value") : "";
let commonExt = showCommonExtensions ? getCommonExtensions(schema) : null;
let extensions = showExtensions ? getExtensions(param) : null;
let paramItems; // undefined
let paramEnum; // undefined
let paramDefaultValue; // undefined
let paramExample; // undefined
let isDisplayParamEnum = false;
if (param !== undefined && schema) {
paramItems = schema.get("items");
}
if (paramItems !== undefined) {
paramEnum = paramItems.get("enum");
paramDefaultValue = paramItems.get("default");
} else if (schema) {
paramEnum = schema.get("enum");
}
if (paramEnum && paramEnum.size && paramEnum.size > 0) {
isDisplayParamEnum = true;
}
// Default and Example Value for readonly doc
if (param !== undefined) {
if (schema) {
paramDefaultValue = schema.get("default");
}
if (paramDefaultValue === undefined) {
paramDefaultValue = param.get("default");
}
paramExample = param.get("example");
if (paramExample === undefined) {
paramExample = param.get("x-example");
}
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("tr", { "data-param-name": param.get("name"), "data-param-in": param.get("in") }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "parameters-col_name" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: required ? "parameter__name required" : "parameter__name" },
param.get("name"),
!required ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, "\xA0*")
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "parameter__type" },
type,
itemType && `[${itemType}]`,
format && /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "prop-format" }, "($", format, ")")
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "parameter__deprecated" },
isOAS3 && param.get("deprecated") ? "deprecated" : null
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "parameter__in" }, "(", param.get("in"), ")"),
!showCommonExtensions || !commonExt.size ? null : commonExt.entrySeq().map((_ref) => {let [key, v] = _ref;return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ParameterExt, { key: `${key}-${v}`, xKey: key, xVal: v });}),
!showExtensions || !extensions.size ? null : extensions.entrySeq().map((_ref2) => {let [key, v] = _ref2;return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ParameterExt, { key: `${key}-${v}`, xKey: key, xVal: v });})
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "parameters-col_description" },
param.get("description") ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(Markdown, { source: param.get("description") }) : null,
(bodyParam || !isExecute) && isDisplayParamEnum ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { className: "parameter__enum", source:
"Available values : " + paramEnum.map(function (item) {
return item;
}).toArray().join(", ") }) :
null,
(bodyParam || !isExecute) && paramDefaultValue !== undefined ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { className: "parameter__default", source: "Default value : " + paramDefaultValue }) :
null,
(bodyParam || !isExecute) && paramExample !== undefined ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: "Example : " + paramExample }) :
null,
isFormData && !isFormDataSupported && /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, "Error: your browser does not support FormData"),
isOAS3 && param.get("examples") ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("section", { className: "parameter-controls" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExamplesSelectValueRetainer, {
examples: param.get("examples"),
onSelect: this._onExampleSelect,
updateValue: this.onChangeWrapper,
getComponent: getComponent,
defaultToFirstExample: true,
currentKey: oas3Selectors.activeExamplesMember(...pathMethod, "parameters", this.getParamKey()),
currentUserInputValue: value }
)
) :
null,
bodyParam ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JsonSchemaForm, { fn: fn,
getComponent: getComponent,
value: value,
required: required,
disabled: !isExecute,
description: param.get("name"),
onChange: this.onChangeWrapper,
errors: paramWithMeta.get("errors"),
schema: schema }),
bodyParam && schema ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(ModelExample, { getComponent: getComponent,
specPath: specPath.push("schema"),
getConfigs: getConfigs,
isExecute: isExecute,
specSelectors: specSelectors,
schema: schema,
example: bodyParam,
includeWriteOnly: true }) :
null,
!bodyParam && isExecute && param.get("allowEmptyValue") ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ParameterIncludeEmpty, {
onChange: this.onChangeIncludeEmpty,
isIncluded: specSelectors.parameterInclusionSettingFor(pathMethod, param.get("name"), param.get("in")),
isDisabled: !isEmptyValue(value) }) :
null,
isOAS3 && param.get("examples") ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Example, {
example: param.getIn([
"examples",
oas3Selectors.activeExamplesMember(...pathMethod, "parameters", this.getParamKey())]
),
getComponent: getComponent,
getConfigs: getConfigs }
) :
null
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/execute.jsx
class Execute extends external_react_namespaceObject.Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "handleValidateParameters",
() => {
let { specSelectors, specActions, path, method } = this.props;
specActions.validateParams([path, method]);
return specSelectors.validateBeforeExecute([path, method]);
});(0,defineProperty_namespaceObject["default"])(this, "handleValidateRequestBody",
() => {
let { path, method, specSelectors, oas3Selectors, oas3Actions } = this.props;
let validationErrors = {
missingBodyValue: false,
missingRequiredKeys: []
};
// context: reset errors, then (re)validate
oas3Actions.clearRequestBodyValidateError({ path, method });
let oas3RequiredRequestBodyContentType = specSelectors.getOAS3RequiredRequestBodyContentType([path, method]);
let oas3RequestBodyValue = oas3Selectors.requestBodyValue(path, method);
let oas3ValidateBeforeExecuteSuccess = oas3Selectors.validateBeforeExecute([path, method]);
let oas3RequestContentType = oas3Selectors.requestContentType(path, method);
if (!oas3ValidateBeforeExecuteSuccess) {
validationErrors.missingBodyValue = true;
oas3Actions.setRequestBodyValidateError({ path, method, validationErrors });
return false;
}
if (!oas3RequiredRequestBodyContentType) {
return true;
}
let missingRequiredKeys = oas3Selectors.validateShallowRequired({
oas3RequiredRequestBodyContentType,
oas3RequestContentType,
oas3RequestBodyValue
});
if (!missingRequiredKeys || missingRequiredKeys.length < 1) {
return true;
}
missingRequiredKeys.forEach((missingKey) => {
validationErrors.missingRequiredKeys.push(missingKey);
});
oas3Actions.setRequestBodyValidateError({ path, method, validationErrors });
return false;
});(0,defineProperty_namespaceObject["default"])(this, "handleValidationResultPass",
() => {
let { specActions, operation, path, method } = this.props;
if (this.props.onExecute) {
// loading spinner
this.props.onExecute();
}
specActions.execute({ operation, path, method });
});(0,defineProperty_namespaceObject["default"])(this, "handleValidationResultFail",
() => {
let { specActions, path, method } = this.props;
// deferred by 40ms, to give element class change time to settle.
specActions.clearValidateParams([path, method]);
setTimeout(() => {
specActions.validateParams([path, method]);
}, 40);
});(0,defineProperty_namespaceObject["default"])(this, "handleValidationResult",
(isPass) => {
if (isPass) {
this.handleValidationResultPass();
} else {
this.handleValidationResultFail();
}
});(0,defineProperty_namespaceObject["default"])(this, "onClick",
() => {
let paramsResult = this.handleValidateParameters();
let requestBodyResult = this.handleValidateRequestBody();
let isPass = paramsResult && requestBodyResult;
this.handleValidationResult(isPass);
});(0,defineProperty_namespaceObject["default"])(this, "onChangeProducesWrapper",
(val) => this.props.specActions.changeProducesValue([this.props.path, this.props.method], val));}
render() {
const { disabled } = this.props;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("button", { className: "btn execute opblock-control__btn", onClick: this.onClick, disabled: disabled }, "Execute"
));
}
}
;// CONCATENATED MODULE: ./src/core/components/headers.jsx
const propClass = "header-example";
class headers_Headers extends external_react_namespaceObject["default"].Component {
render() {
let { headers, getComponent } = this.props;
const Property = getComponent("Property");
const Markdown = getComponent("Markdown", true);
if (!headers || !headers.size)
return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "headers-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "headers__title" }, "Headers:"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("table", { className: "headers" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("thead", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", { className: "header-row" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("th", { className: "header-col" }, "Name"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("th", { className: "header-col" }, "Description"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("th", { className: "header-col" }, "Type")
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tbody", null,
headers.entrySeq().map((_ref) => {let [key, header] = _ref;
if (!external_immutable_namespaceObject["default"].Map.isMap(header)) {
return null;
}
const description = header.get("description");
const type = header.getIn(["schema"]) ? header.getIn(["schema", "type"]) : header.getIn(["type"]);
const schemaExample = header.getIn(["schema", "example"]);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("tr", { key: key }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "header-col" }, key), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "header-col" },
!description ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement(Markdown, { source: description })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "header-col" }, type, " ", schemaExample ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(Property, { propKey: "Example", propVal: schemaExample, propClass: propClass }) : null)
);
}).toArray()
)
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/errors.jsx
class Errors extends external_react_namespaceObject["default"].Component {
render() {
let { editorActions, errSelectors, layoutSelectors, layoutActions, getComponent } = this.props;
const Collapse = getComponent("Collapse");
if (editorActions && editorActions.jumpToLine) {
var jumpToLine = editorActions.jumpToLine;
}
let errors = errSelectors.allErrors();
// all thrown errors, plus error-level everything else
let allErrorsToDisplay = errors.filter((err) => err.get("type") === "thrown" ? true : err.get("level") === "error");
if (!allErrorsToDisplay || allErrorsToDisplay.count() < 1) {
return null;
}
let isVisible = layoutSelectors.isShown(["errorPane"], true);
let toggleVisibility = () => layoutActions.show(["errorPane"], !isVisible);
let sortedJSErrors = allErrorsToDisplay.sortBy((err) => err.get("line"));
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("pre", { className: "errors-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("hgroup", { className: "error" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "errors__title" }, "Errors"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", { className: "btn errors__clear-btn", onClick: toggleVisibility }, isVisible ? "Hide" : "Show")
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Collapse, { isOpened: isVisible, animated: true }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "errors" },
sortedJSErrors.map((err, i) => {
let type = err.get("type");
if (type === "thrown" || type === "auth") {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ThrownErrorItem, { key: i, error: err.get("error") || err, jumpToLine: jumpToLine });
}
if (type === "spec") {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(SpecErrorItem, { key: i, error: err, jumpToLine: jumpToLine });
}
})
)
)
));
}
}
const ThrownErrorItem = (_ref) => {let { error, jumpToLine } = _ref;
if (!error) {
return null;
}
let errorLine = error.get("line");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "error-wrapper" },
!error ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, error.get("source") && error.get("level") ?
toTitleCase(error.get("source")) + " " + error.get("level") : "",
error.get("path") ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("small", null, " at ", error.get("path")) : null), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "message thrown" },
error.get("message")
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "error-line" },
errorLine && jumpToLine ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("a", { onClick: jumpToLine.bind(null, errorLine) }, "Jump to line ", errorLine) : null
)
)
));
};
const SpecErrorItem = (_ref2) => {let { error, jumpToLine } = _ref2;
let locationMessage = null;
if (error.get("path")) {
if (external_immutable_namespaceObject.List.isList(error.get("path"))) {
locationMessage = /*#__PURE__*/external_react_namespaceObject["default"].createElement("small", null, "at ", error.get("path").join("."));
} else {
locationMessage = /*#__PURE__*/external_react_namespaceObject["default"].createElement("small", null, "at ", error.get("path"));
}
} else if (error.get("line") && !jumpToLine) {
locationMessage = /*#__PURE__*/external_react_namespaceObject["default"].createElement("small", null, "on line ", error.get("line"));
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "error-wrapper" },
!error ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, toTitleCase(error.get("source")) + " " + error.get("level"), "\xA0", locationMessage), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "message" }, error.get("message")), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "error-line" },
jumpToLine ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("a", { onClick: jumpToLine.bind(null, error.get("line")) }, "Jump to line ", error.get("line")) :
null
)
)
));
};
function toTitleCase(str) {
return (str || "").
split(" ").
map((substr) => substr[0].toUpperCase() + substr.slice(1)).
join(" ");
}
ThrownErrorItem.defaultProps = {
jumpToLine: null
};
;// CONCATENATED MODULE: ./src/core/components/content-type.jsx
const content_type_noop = () => {};
class ContentType extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onChangeWrapper",
(e) => this.props.onChange(e.target.value));}componentDidMount() {// Needed to populate the form, initially
if (this.props.contentTypes) {this.props.onChange(this.props.contentTypes.first());}}UNSAFE_componentWillReceiveProps(nextProps) {if (!nextProps.contentTypes || !nextProps.contentTypes.size) {return;}if (!nextProps.contentTypes.includes(nextProps.value)) {nextProps.onChange(nextProps.contentTypes.first());}}
render() {
let { ariaControls, ariaLabel, className, contentTypes, controlId, value } = this.props;
if (!contentTypes || !contentTypes.size)
return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "content-type-wrapper " + (className || "") }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("select", { "aria-controls": ariaControls, "aria-label": ariaLabel, className: "content-type", id: controlId, onChange: this.onChangeWrapper, value: value || "" },
contentTypes.map((val) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("option", { key: val, value: val }, val);
}).toArray()
)
));
}
}(0,defineProperty_namespaceObject["default"])(ContentType, "defaultProps", { onChange: content_type_noop, value: null, contentTypes: (0,external_immutable_namespaceObject.fromJS)(["application/json"]) });
;// CONCATENATED MODULE: ./src/core/components/layout-utils.jsx
const layout_utils_excluded = ["fullscreen", "full"],_excluded2 = ["hide", "keepContents", "mobile", "tablet", "desktop", "large"];
function xclass() {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}
return args.filter((a) => !!a).join(" ").trim();
}
class Container extends external_react_namespaceObject["default"].Component {
render() {
let _this$props = this.props,{ fullscreen, full } = _this$props,rest = (0,objectWithoutProperties_namespaceObject["default"])(_this$props, layout_utils_excluded);
// Normal element
if (fullscreen)
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("section", rest);
let containerClass = "swagger-container" + (full ? "-full" : "");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("section", (0,extends_namespaceObject["default"])({}, rest, { className: xclass(rest.className, containerClass) })));
}
}
const DEVICES = {
"mobile": "",
"tablet": "-tablet",
"desktop": "-desktop",
"large": "-hd"
};
class Col extends external_react_namespaceObject["default"].Component {
render() {
const _this$props2 =
this.props,{ hide, keepContents, /* we don't want these in the `rest` object that passes to the final component,
since React now complains. So we extract them */ /* eslint-disable no-unused-vars */mobile, tablet, desktop, large /* eslint-enable no-unused-vars */ } = _this$props2,rest = (0,objectWithoutProperties_namespaceObject["default"])(_this$props2, _excluded2);
if (hide && !keepContents)
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null);
let classesAr = [];
for (let device in DEVICES) {
if (!Object.prototype.hasOwnProperty.call(DEVICES, device)) {
continue;
}
let deviceClass = DEVICES[device];
if (device in this.props) {
let val = this.props[device];
if (val < 1) {
classesAr.push("none" + deviceClass);
continue;
}
classesAr.push("block" + deviceClass);
classesAr.push("col-" + val + deviceClass);
}
}
if (hide) {
classesAr.push("hidden");
}
let classes = xclass(rest.className, ...classesAr);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("section", (0,extends_namespaceObject["default"])({}, rest, { className: classes })));
}
}
class Row extends external_react_namespaceObject["default"].Component {
render() {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", (0,extends_namespaceObject["default"])({}, this.props, { className: xclass(this.props.className, "wrapper") }));
}
}
class Button extends external_react_namespaceObject["default"].Component {
render() {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("button", (0,extends_namespaceObject["default"])({}, this.props, { className: xclass(this.props.className, "button") }));
}
}(0,defineProperty_namespaceObject["default"])(Button, "defaultProps", { className: "" });
const TextArea = (props) => /*#__PURE__*/external_react_namespaceObject["default"].createElement("textarea", props);
const Input = (props) => /*#__PURE__*/external_react_namespaceObject["default"].createElement("input", props);
class Select extends external_react_namespaceObject["default"].Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "onChange",
(e) => {
let { onChange, multiple } = this.props;
let options = [].slice.call(e.target.options);
let value;
if (multiple) {
value = options.filter(function (option) {
return option.selected;
}).
map(function (option) {
return option.value;
});
} else {
value = e.target.value;
}
this.setState({ value: value });
onChange && onChange(value);
});let _value;if (props.value) {_value = props.value;} else {_value = props.multiple ? [""] : "";}this.state = { value: _value };}
UNSAFE_componentWillReceiveProps(nextProps) {
// TODO: this puts us in a weird area btwn un/controlled selection... review
if (nextProps.value !== this.props.value) {
this.setState({ value: nextProps.value });
}
}
render() {var _this$state$value, _this$state$value$toJ;
let { allowedValues, multiple, allowEmptyValue, disabled } = this.props;
let value = ((_this$state$value = this.state.value) === null || _this$state$value === void 0 || (_this$state$value$toJ = _this$state$value.toJS) === null || _this$state$value$toJ === void 0 ? void 0 : _this$state$value$toJ.call(_this$state$value)) || this.state.value;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("select", { className: this.props.className, multiple: multiple, value: value, onChange: this.onChange, disabled: disabled },
allowEmptyValue ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("option", { value: "" }, "--") : null,
allowedValues.map(function (item, key) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("option", { key: key, value: String(item) }, String(item));
})
));
}
}(0,defineProperty_namespaceObject["default"])(Select, "defaultProps", { multiple: false, allowEmptyValue: true });
class Link extends external_react_namespaceObject["default"].Component {
render() {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("a", (0,extends_namespaceObject["default"])({}, this.props, { rel: "noopener noreferrer", className: xclass(this.props.className, "link") }));
}
}
const NoMargin = (_ref) => {let { children } = _ref;return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "no-margin" }, " ", children, " ");};
class Collapse extends external_react_namespaceObject["default"].Component {
renderNotAnimated() {
if (!this.props.isOpened)
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("noscript", null);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(NoMargin, null,
this.props.children
));
}
render() {
let { animated, isOpened, children } = this.props;
if (!animated)
return this.renderNotAnimated();
children = isOpened ? children : null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(NoMargin, null,
children
));
}
}(0,defineProperty_namespaceObject["default"])(Collapse, "defaultProps", { isOpened: false, animated: false });
;// CONCATENATED MODULE: ./src/core/components/overview.jsx
class Overview extends external_react_namespaceObject["default"].Component {
constructor() {
super(...arguments);
this.setTagShown = this._setTagShown.bind(this);
}
_setTagShown(showTagId, shown) {
this.props.layoutActions.show(showTagId, shown);
}
showOp(key, shown) {
let { layoutActions } = this.props;
layoutActions.show(key, shown);
}
render() {
let { specSelectors, layoutSelectors, layoutActions, getComponent } = this.props;
let taggedOps = specSelectors.taggedOperations();
const Collapse = getComponent("Collapse");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "overview-title" }, "Overview"),
taggedOps.map((tagObj, tag) => {
let operations = tagObj.get("operations");
let showTagId = ["overview-tags", tag];
let showTag = layoutSelectors.isShown(showTagId, true);
let toggleShow = () => layoutActions.show(showTagId, !showTag);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { key: "overview-" + tag }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { onClick: toggleShow, className: "link overview-tag" }, " ", showTag ? "-" : "+", tag), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Collapse, { isOpened: showTag, animated: true },
operations.map((op) => {
let { path, method, id } = op.toObject(); // toObject is shallow
let showOpIdPrefix = "operations";
let showOpId = id;
let shown = layoutSelectors.isShown([showOpIdPrefix, showOpId]);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(OperationLink, { key: id,
path: path,
method: method,
id: path + "-" + method,
shown: shown,
showOpId: showOpId,
showOpIdPrefix: showOpIdPrefix,
href: `#operation-${showOpId}`,
onClick: layoutActions.show });
}).toArray()
)
));
}).toArray(),
taggedOps.size < 1 && /*#__PURE__*/external_react_namespaceObject["default"].createElement("h3", null, " No operations defined in spec! ")
));
}
}
class OperationLink extends external_react_namespaceObject["default"].Component {
constructor(props) {
super(props);
this.onClick = this._onClick.bind(this);
}
_onClick() {
let { showOpId, showOpIdPrefix, onClick, shown } = this.props;
onClick([showOpIdPrefix, showOpId], !shown);
}
render() {
let { id, method, shown, href } = this.props;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(Link, { href: href, onClick: this.onClick, className: `block opblock-link ${shown ? "shown" : ""}` }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("small", { className: `bold-label-${method}` }, method.toUpperCase()), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "bold-label" }, id)
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/initialized-input.jsx
const initialized_input_excluded = ["value", "defaultValue", "initialValue"]; // This component provides an interface that feels like an uncontrolled input
// to consumers, while providing a `defaultValue` interface that initializes
// the input's value using JavaScript value property APIs instead of React's
// vanilla[0] implementation that uses HTML value attributes.
//
// This is useful in situations where we don't want to surface an input's value
// into the HTML/CSS-exposed side of the DOM, for example to avoid sequential
// input chaining attacks[1].
//
// [0]: https://github.com/facebook/react/blob/baff5cc2f69d30589a5dc65b089e47765437294b/fixtures/dom/src/components/fixtures/text-inputs/README.md
// [1]: https://github.com/d0nutptr/sic
class InitializedInput extends external_react_namespaceObject["default"].Component {
componentDidMount() {
// Set the element's `value` property (*not* the `value` attribute)
// once, on mount, if an `initialValue` is provided.
if (this.props.initialValue) {
this.inputRef.value = this.props.initialValue;
}
}
render() {
// Filter out `value` and `defaultValue`, since we have our own
// `initialValue` interface that we provide.
// eslint-disable-next-line no-unused-vars, react/prop-types
const _this$props = this.props,{ value, defaultValue, initialValue } = _this$props,otherProps = (0,objectWithoutProperties_namespaceObject["default"])(_this$props, initialized_input_excluded);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("input", (0,extends_namespaceObject["default"])({}, otherProps, { ref: (c) => this.inputRef = c }));
}
}
;// CONCATENATED MODULE: ./src/core/components/info.jsx
/**
* @prettier
*/
class InfoBasePath extends external_react_namespaceObject["default"].Component {
render() {
const { host, basePath } = this.props;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("pre", { className: "base-url" }, "[ Base URL: ",
host,
basePath, " ]"
));
}
}
class InfoUrl extends external_react_namespaceObject["default"].PureComponent {
render() {
const { url, getComponent } = this.props;
const Link = getComponent("Link");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: sanitizeUrl(url) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "url" }, " ", url)
));
}
}
class Info extends external_react_namespaceObject["default"].Component {
render() {
const {
info,
url,
host,
basePath,
getComponent,
externalDocs,
selectedServer,
url: specUrl
} = this.props;
const version = info.get("version");
const description = info.get("description");
const title = info.get("title");
const termsOfServiceUrl = safeBuildUrl(
info.get("termsOfService"),
specUrl,
{ selectedServer }
);
const contactData = info.get("contact");
const licenseData = info.get("license");
const rawExternalDocsUrl = externalDocs && externalDocs.get("url");
const externalDocsUrl = safeBuildUrl(rawExternalDocsUrl, specUrl, {
selectedServer
});
const externalDocsDescription =
externalDocs && externalDocs.get("description");
const Markdown = getComponent("Markdown", true);
const Link = getComponent("Link");
const VersionStamp = getComponent("VersionStamp");
const OpenAPIVersion = getComponent("OpenAPIVersion");
const InfoUrl = getComponent("InfoUrl");
const InfoBasePath = getComponent("InfoBasePath");
const License = getComponent("License");
const Contact = getComponent("Contact");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "info" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("hgroup", { className: "main" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h2", { className: "title" },
title,
version && /*#__PURE__*/external_react_namespaceObject["default"].createElement(VersionStamp, { version: version }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(OpenAPIVersion, { oasVersion: "2.0" })
),
host || basePath ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(InfoBasePath, { host: host, basePath: basePath }) :
null,
url && /*#__PURE__*/external_react_namespaceObject["default"].createElement(InfoUrl, { getComponent: getComponent, url: url })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: description })
),
termsOfServiceUrl && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "info__tos" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: sanitizeUrl(termsOfServiceUrl) }, "Terms of service"
)
),
(contactData === null || contactData === void 0 ? void 0 : contactData.size) > 0 && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Contact, {
getComponent: getComponent,
data: contactData,
selectedServer: selectedServer,
url: url }
),
(licenseData === null || licenseData === void 0 ? void 0 : licenseData.size) > 0 && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(License, {
getComponent: getComponent,
license: licenseData,
selectedServer: selectedServer,
url: url }
),
externalDocsUrl ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, {
className: "info__extdocs",
target: "_blank",
href: sanitizeUrl(externalDocsUrl) },
externalDocsDescription || externalDocsUrl
) :
null
));
}
}
/* harmony default export */ const components_info = (Info);
;// CONCATENATED MODULE: ./src/core/containers/info.jsx
class InfoContainer extends external_react_namespaceObject["default"].Component {
render() {
const { specSelectors, getComponent, oas3Selectors } = this.props;
const info = specSelectors.info();
const url = specSelectors.url();
const basePath = specSelectors.basePath();
const host = specSelectors.host();
const externalDocs = specSelectors.externalDocs();
const selectedServer = oas3Selectors.selectedServer();
const Info = getComponent("info");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null,
info && info.count() ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Info, { info: info, url: url, host: host, basePath: basePath, externalDocs: externalDocs,
getComponent: getComponent, selectedServer: selectedServer }) :
null
));
}
}
;// CONCATENATED MODULE: ./src/core/components/contact.jsx
/**
* @prettier
*/
class Contact extends external_react_namespaceObject["default"].Component {
render() {
const { data, getComponent, selectedServer, url: specUrl } = this.props;
const name = data.get("name", "the developer");
const url = safeBuildUrl(data.get("url"), specUrl, { selectedServer });
const email = data.get("email");
const Link = getComponent("Link");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "info__contact" },
url && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { href: sanitizeUrl(url), target: "_blank" },
name, " - Website"
)
),
email && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { href: sanitizeUrl(`mailto:${email}`) },
url ? `Send email to ${name}` : `Contact ${name}`
)
));
}
}
/* harmony default export */ const contact = (Contact);
;// CONCATENATED MODULE: ./src/core/components/license.jsx
/**
* @prettier
*/
class License extends external_react_namespaceObject["default"].Component {
render() {
const { license, getComponent, selectedServer, url: specUrl } = this.props;
const name = license.get("name", "License");
const url = safeBuildUrl(license.get("url"), specUrl, { selectedServer });
const Link = getComponent("Link");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "info__license" },
url ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "info__license__url" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: sanitizeUrl(url) },
name
)
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, name)
));
}
}
/* harmony default export */ const license = (License);
;// CONCATENATED MODULE: ./src/core/components/jump-to-path.jsx
// Nothing by default- component can be overridden by another plugin.
class JumpToPath extends external_react_namespaceObject["default"].Component {
render() {
return null;
}
}
;// CONCATENATED MODULE: ./src/core/components/copy-to-clipboard-btn.jsx
/**
* @param {{ getComponent: func, textToCopy: string }} props
* @returns {JSX.Element}
* @constructor
*/
class CopyToClipboardBtn extends external_react_namespaceObject["default"].Component {
render() {
let { getComponent } = this.props;
const CopyIcon = getComponent("CopyIcon");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "view-line-link copy-to-clipboard", title: "Copy to clipboard" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_copy_to_clipboard_namespaceObject.CopyToClipboard, { text: this.props.textToCopy }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(CopyIcon, null)
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/footer.jsx
class Footer extends external_react_namespaceObject["default"].Component {
render() {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "footer" }));
}
}
;// CONCATENATED MODULE: ./src/core/containers/filter.jsx
class FilterContainer extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onFilterChange",
(e) => {
const { target: { value } } = e;
this.props.layoutActions.updateFilter(value);
});}
render() {
const { specSelectors, layoutSelectors, getComponent } = this.props;
const Col = getComponent("Col");
const isLoading = specSelectors.loadingStatus() === "loading";
const isFailed = specSelectors.loadingStatus() === "failed";
const filter = layoutSelectors.currentFilter();
const classNames = ["operation-filter-input"];
if (isFailed) classNames.push("failed");
if (isLoading) classNames.push("loading");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null,
filter === null || filter === false || filter === "false" ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "filter-container" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { className: "filter wrapper", mobile: 12 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("input", { className: classNames.join(" "), placeholder: "Filter by tag", type: "text",
onChange: this.onFilterChange, value: filter === true || filter === "true" ? "" : filter,
disabled: isLoading })
)
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/param-body.jsx
const NOOP = Function.prototype;
class ParamBody extends external_react_namespaceObject.PureComponent {
constructor(_props, context) {
super(_props, context);(0,defineProperty_namespaceObject["default"])(this, "updateValues",
(props) => {
let { param, isExecute, consumesValue = "" } = props;
let isXml = /xml/i.test(consumesValue);
let isJson = /json/i.test(consumesValue);
let paramValue = isXml ? param.get("value_xml") : param.get("value");
if (paramValue !== undefined) {
let val = !paramValue && isJson ? "{}" : paramValue;
this.setState({ value: val });
this.onChange(val, { isXml: isXml, isEditBox: isExecute });
} else {
if (isXml) {
this.onChange(this.sample("xml"), { isXml: isXml, isEditBox: isExecute });
} else {
this.onChange(this.sample(), { isEditBox: isExecute });
}
}
});(0,defineProperty_namespaceObject["default"])(this, "sample",
(xml) => {
let { param, fn } = this.props;
let schema = fn.inferSchema(param.toJS());
return fn.getSampleSchema(schema, xml, {
includeWriteOnly: true
});
});(0,defineProperty_namespaceObject["default"])(this, "onChange",
(value, _ref) => {let { isEditBox, isXml } = _ref;
this.setState({ value, isEditBox });
this._onChange(value, isXml);
});(0,defineProperty_namespaceObject["default"])(this, "_onChange",
(val, isXml) => {(this.props.onChange || NOOP)(val, isXml);});(0,defineProperty_namespaceObject["default"])(this, "handleOnChange",
(e) => {
const { consumesValue } = this.props;
const isXml = /xml/i.test(consumesValue);
const inputValue = e.target.value;
this.onChange(inputValue, { isXml, isEditBox: this.state.isEditBox });
});(0,defineProperty_namespaceObject["default"])(this, "toggleIsEditBox",
() => this.setState((state) => ({ isEditBox: !state.isEditBox })));this.state = { isEditBox: false, value: "" };}componentDidMount() {this.updateValues.call(this, this.props);}UNSAFE_componentWillReceiveProps(nextProps) {this.updateValues.call(this, nextProps);}
render() {
let {
onChangeConsumes,
param,
isExecute,
specSelectors,
pathMethod,
getConfigs,
getComponent
} = this.props;
const Button = getComponent("Button");
const TextArea = getComponent("TextArea");
const HighlightCode = getComponent("highlightCode");
const ContentType = getComponent("contentType");
// for domains where specSelectors not passed
let parameter = specSelectors ? specSelectors.parameterWithMetaByIdentity(pathMethod, param) : param;
let errors = parameter.get("errors", (0,external_immutable_namespaceObject.List)());
let consumesValue = specSelectors.contentTypeValues(pathMethod).get("requestContentType");
let consumes = this.props.consumes && this.props.consumes.size ? this.props.consumes : ParamBody.defaultProp.consumes;
let { value, isEditBox } = this.state;
let language = null;
let testValueForJson = getKnownSyntaxHighlighterLanguage(value);
if (testValueForJson) {
language = "json";
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "body-param", "data-param-name": param.get("name"), "data-param-in": param.get("in") },
isEditBox && isExecute ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(TextArea, { className: "body-param__text" + (errors.count() ? " invalid" : ""), value: value, onChange: this.handleOnChange }) :
value && /*#__PURE__*/external_react_namespaceObject["default"].createElement(HighlightCode, { className: "body-param__example",
language: language,
getConfigs: getConfigs,
value: value }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "body-param-options" },
!isExecute ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "body-param-edit" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Button, { className: isEditBox ? "btn cancel body-param__example-edit" : "btn edit body-param__example-edit",
onClick: this.toggleIsEditBox }, isEditBox ? "Cancel" : "Edit"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", { htmlFor: "" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, "Parameter content type"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ContentType, {
value: consumesValue,
contentTypes: consumes,
onChange: onChangeConsumes,
className: "body-param-content-type",
ariaLabel: "Parameter content type" })
)
)
));
}
}(0,defineProperty_namespaceObject["default"])(ParamBody, "defaultProp", { consumes: (0,external_immutable_namespaceObject.fromJS)(["application/json"]), param: (0,external_immutable_namespaceObject.fromJS)({}), onChange: NOOP, onChangeConsumes: NOOP });
;// CONCATENATED MODULE: ./src/core/components/curl.jsx
class Curl extends external_react_namespaceObject["default"].Component {
render() {
let { request, getConfigs } = this.props;
let curl = requestSnippetGenerator_curl_bash(request);
const config = getConfigs();
const curlBlock = (0,get_namespaceObject["default"])(config, "syntaxHighlight.activated") ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(light_namespaceObject["default"], {
language: "bash",
className: "curl microlight",
style: getStyle((0,get_namespaceObject["default"])(config, "syntaxHighlight.theme")) },
curl
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("textarea", { readOnly: true, className: "curl", value: curl });
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "curl-command" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, "Curl"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "copy-to-clipboard" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_copy_to_clipboard_namespaceObject.CopyToClipboard, { text: curl }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("button", null))
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null,
curlBlock
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/schemes.jsx
class Schemes extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onChange",
(e) => {
this.setScheme(e.target.value);
});(0,defineProperty_namespaceObject["default"])(this, "setScheme",
(value) => {
let { path, method, specActions } = this.props;
specActions.setScheme(value, path, method);
});}UNSAFE_componentWillMount() {let { schemes } = this.props; //fire 'change' event to set default 'value' of select
this.setScheme(schemes.first());}UNSAFE_componentWillReceiveProps(nextProps) {if (!this.props.currentScheme || !nextProps.schemes.includes(this.props.currentScheme)) {// if we don't have a selected currentScheme or if our selected scheme is no longer an option,
// then fire 'change' event and select the first scheme in the list of options
this.setScheme(nextProps.schemes.first());}}render() {let { schemes, currentScheme } = this.props;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("label", { htmlFor: "schemes" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "schemes-title" }, "Schemes"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("select", { onChange: this.onChange, value: currentScheme },
schemes.valueSeq().map(
(scheme) => /*#__PURE__*/external_react_namespaceObject["default"].createElement("option", { value: scheme, key: scheme }, scheme)
).toArray()
)
));
}
}
;// CONCATENATED MODULE: ./src/core/containers/schemes.jsx
class SchemesContainer extends external_react_namespaceObject["default"].Component {
render() {
const { specActions, specSelectors, getComponent } = this.props;
const currentScheme = specSelectors.operationScheme();
const schemes = specSelectors.schemes();
const Schemes = getComponent("schemes");
const schemesArePresent = schemes && schemes.size;
return schemesArePresent ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Schemes, {
currentScheme: currentScheme,
schemes: schemes,
specActions: specActions }
) :
null;
}
}
;// CONCATENATED MODULE: ./src/core/components/model-collapse.jsx
class ModelCollapse extends external_react_namespaceObject.Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "toggleCollapsed",
() => {
if (this.props.onToggle) {
this.props.onToggle(this.props.modelName, !this.state.expanded);
}
this.setState({
expanded: !this.state.expanded
});
});(0,defineProperty_namespaceObject["default"])(this, "onLoad",
(ref) => {
if (ref && this.props.layoutSelectors) {
const scrollToKey = this.props.layoutSelectors.getScrollToKey();
if (external_immutable_namespaceObject["default"].is(scrollToKey, this.props.specPath)) this.toggleCollapsed();
this.props.layoutActions.readyToScroll(this.props.specPath, ref.parentElement);
}
});let { expanded, collapsedContent } = this.props;this.state = { expanded: expanded, collapsedContent: collapsedContent || ModelCollapse.defaultProps.collapsedContent };}componentDidMount() {const { hideSelfOnExpand, expanded, modelName } = this.props;if (hideSelfOnExpand && expanded) {// We just mounted pre-expanded, and we won't be going back..
// So let's give our parent an `onToggle` call..
// Since otherwise it will never be called.
this.props.onToggle(modelName, expanded);}}UNSAFE_componentWillReceiveProps(nextProps) {if (this.props.expanded !== nextProps.expanded) {this.setState({ expanded: nextProps.expanded });}}render() {const { title, classes } = this.props;
if (this.state.expanded) {
if (this.props.hideSelfOnExpand) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: classes || "" },
this.props.children
);
}
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", { className: classes || "", ref: this.onLoad }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", { "aria-expanded": this.state.expanded, className: "model-box-control", onClick: this.toggleCollapsed },
title && /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "pointer" }, title), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "model-toggle" + (this.state.expanded ? "" : " collapsed") }),
!this.state.expanded && /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, this.state.collapsedContent)
),
this.state.expanded && this.props.children
));
}
}(0,defineProperty_namespaceObject["default"])(ModelCollapse, "defaultProps", { collapsedContent: "{...}", expanded: false, title: null, onToggle: () => {}, hideSelfOnExpand: false, specPath: external_immutable_namespaceObject["default"].List([]) });
;// CONCATENATED MODULE: ./src/core/components/model-example.jsx
class ModelExample extends external_react_namespaceObject["default"].Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "activeTab",
(e) => {
let { target: { dataset: { name } } } = e;
this.setState({
activeTab: name
});
});let { getConfigs, isExecute } = this.props;let { defaultModelRendering } = getConfigs();let activeTab = defaultModelRendering;if (defaultModelRendering !== "example" && defaultModelRendering !== "model") {activeTab = "example";}if (isExecute) {activeTab = "example";}this.state = { activeTab };}
UNSAFE_componentWillReceiveProps(nextProps) {
if (
nextProps.isExecute &&
!this.props.isExecute &&
this.props.example)
{
this.setState({ activeTab: "example" });
}
}
render() {
let { getComponent, specSelectors, schema, example, isExecute, getConfigs, specPath, includeReadOnly, includeWriteOnly } = this.props;
let { defaultModelExpandDepth } = getConfigs();
const ModelWrapper = getComponent("ModelWrapper");
const HighlightCode = getComponent("highlightCode");
const exampleTabId = browser_default()(5).toString("base64");
const examplePanelId = browser_default()(5).toString("base64");
const modelTabId = browser_default()(5).toString("base64");
const modelPanelId = browser_default()(5).toString("base64");
let isOAS3 = specSelectors.isOAS3();
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "model-example" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", { className: "tab", role: "tablist" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { className: (0,external_classnames_namespaceObject["default"])("tabitem", { active: this.state.activeTab === "example" }), role: "presentation" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", {
"aria-controls": examplePanelId,
"aria-selected": this.state.activeTab === "example",
className: "tablinks",
"data-name": "example",
id: exampleTabId,
onClick: this.activeTab,
role: "tab" },
isExecute ? "Edit Value" : "Example Value"
)
),
schema && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { className: (0,external_classnames_namespaceObject["default"])("tabitem", { active: this.state.activeTab === "model" }), role: "presentation" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", {
"aria-controls": modelPanelId,
"aria-selected": this.state.activeTab === "model",
className: (0,external_classnames_namespaceObject["default"])("tablinks", { inactive: isExecute }),
"data-name": "model",
id: modelTabId,
onClick: this.activeTab,
role: "tab" },
isOAS3 ? "Schema" : "Model"
)
)
),
this.state.activeTab === "example" && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", {
"aria-hidden": this.state.activeTab !== "example",
"aria-labelledby": exampleTabId,
"data-name": "examplePanel",
id: examplePanelId,
role: "tabpanel",
tabIndex: "0" },
example ? example : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(HighlightCode, { value: "(no example available)", getConfigs: getConfigs })
),
this.state.activeTab === "model" && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", {
"aria-hidden": this.state.activeTab === "example",
"aria-labelledby": modelTabId,
"data-name": "modelPanel",
id: modelPanelId,
role: "tabpanel",
tabIndex: "0" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ModelWrapper, {
schema: schema,
getComponent: getComponent,
getConfigs: getConfigs,
specSelectors: specSelectors,
expandDepth: defaultModelExpandDepth,
specPath: specPath,
includeReadOnly: includeReadOnly,
includeWriteOnly: includeWriteOnly }
)
)
));
}
}
;// CONCATENATED MODULE: ./src/core/components/model-wrapper.jsx
class ModelWrapper extends external_react_namespaceObject.Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onToggle",
(name, isShown) => {
// If this prop is present, we'll have deepLinking for it
if (this.props.layoutActions) {
this.props.layoutActions.show(this.props.fullPath, isShown);
}
});}
render() {
let { getComponent, getConfigs } = this.props;
const Model = getComponent("Model");
let expanded;
if (this.props.layoutSelectors) {
// If this is prop is present, we'll have deepLinking for it
expanded = this.props.layoutSelectors.isShown(this.props.fullPath);
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "model-box" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Model, (0,extends_namespaceObject["default"])({}, this.props, { getConfigs: getConfigs, expanded: expanded, depth: 1, onToggle: this.onToggle, expandDepth: this.props.expandDepth || 0 }))
);
}
}
;// CONCATENATED MODULE: external "react-immutable-pure-component"
var external_react_immutable_pure_component_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_react_immutable_pure_component_y = x => () => x
const external_react_immutable_pure_component_namespaceObject = external_react_immutable_pure_component_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_immutable_pure_component_cbcfaebd__["default"] });
;// CONCATENATED MODULE: ./src/core/components/model.jsx
const decodeRefName = (uri) => {
const unescaped = uri.replace(/~1/g, "/").replace(/~0/g, "~");
try {
return decodeURIComponent(unescaped);
} catch {
return unescaped;
}
};
class Model extends external_react_immutable_pure_component_namespaceObject["default"] {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "getModelName",
(ref) => {
if (ref.indexOf("#/definitions/") !== -1) {
return decodeRefName(ref.replace(/^.*#\/definitions\//, ""));
}
if (ref.indexOf("#/components/schemas/") !== -1) {
return decodeRefName(ref.replace(/^.*#\/components\/schemas\//, ""));
}
});(0,defineProperty_namespaceObject["default"])(this, "getRefSchema",
(model) => {
let { specSelectors } = this.props;
return specSelectors.findDefinition(model);
});}
render() {
let { getComponent, getConfigs, specSelectors, schema, required, name, isRef, specPath, displayName,
includeReadOnly, includeWriteOnly } = this.props;
const ObjectModel = getComponent("ObjectModel");
const ArrayModel = getComponent("ArrayModel");
const PrimitiveModel = getComponent("PrimitiveModel");
let type = "object";
let $$ref = schema && schema.get("$$ref");
// If we weren't passed a `name` but have a ref, grab the name from the ref
if (!name && $$ref) {
name = this.getModelName($$ref);
}
// If we weren't passed a `schema` but have a ref, grab the schema from the ref
if (!schema && $$ref) {
schema = this.getRefSchema(name);
}
if (!schema) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "model model-title" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "model-title__text" }, displayName || name), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("img", { src: rolling_load_namespaceObject, height: "20px", width: "20px" })
);
}
const deprecated = specSelectors.isOAS3() && schema.get("deprecated");
isRef = isRef !== undefined ? isRef : !!$$ref;
type = schema && schema.get("type") || type;
switch (type) {
case "object":
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ObjectModel, (0,extends_namespaceObject["default"])({
className: "object" }, this.props, {
specPath: specPath,
getConfigs: getConfigs,
schema: schema,
name: name,
deprecated: deprecated,
isRef: isRef,
includeReadOnly: includeReadOnly,
includeWriteOnly: includeWriteOnly }));
case "array":
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrayModel, (0,extends_namespaceObject["default"])({
className: "array" }, this.props, {
getConfigs: getConfigs,
schema: schema,
name: name,
deprecated: deprecated,
required: required,
includeReadOnly: includeReadOnly,
includeWriteOnly: includeWriteOnly }));
case "string":
case "number":
case "integer":
case "boolean":
default:
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(PrimitiveModel, (0,extends_namespaceObject["default"])({},
this.props, {
getComponent: getComponent,
getConfigs: getConfigs,
schema: schema,
name: name,
deprecated: deprecated,
required: required }));
}
}
}(0,defineProperty_namespaceObject["default"])(Model, "propTypes", { schema: external_react_immutable_proptypes_namespaceObject["default"].map.isRequired, getComponent: external_prop_types_namespaceObject["default"].func.isRequired, getConfigs: external_prop_types_namespaceObject["default"].func.isRequired, specSelectors: external_prop_types_namespaceObject["default"].object.isRequired, name: external_prop_types_namespaceObject["default"].string, displayName: external_prop_types_namespaceObject["default"].string, isRef: external_prop_types_namespaceObject["default"].bool, required: external_prop_types_namespaceObject["default"].bool, expandDepth: external_prop_types_namespaceObject["default"].number, depth: external_prop_types_namespaceObject["default"].number, specPath: external_react_immutable_proptypes_namespaceObject["default"].list.isRequired, includeReadOnly: external_prop_types_namespaceObject["default"].bool, includeWriteOnly: external_prop_types_namespaceObject["default"].bool });
;// CONCATENATED MODULE: ./src/core/components/models.jsx
class Models extends external_react_namespaceObject.Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "getSchemaBasePath",
() => {
const isOAS3 = this.props.specSelectors.isOAS3();
return isOAS3 ? ["components", "schemas"] : ["definitions"];
});(0,defineProperty_namespaceObject["default"])(this, "getCollapsedContent",
() => {
return " ";
});(0,defineProperty_namespaceObject["default"])(this, "handleToggle",
(name, isExpanded) => {
const { layoutActions } = this.props;
layoutActions.show([...this.getSchemaBasePath(), name], isExpanded);
if (isExpanded) {
this.props.specActions.requestResolvedSubtree([...this.getSchemaBasePath(), name]);
}
});(0,defineProperty_namespaceObject["default"])(this, "onLoadModels",
(ref) => {
if (ref) {
this.props.layoutActions.readyToScroll(this.getSchemaBasePath(), ref);
}
});(0,defineProperty_namespaceObject["default"])(this, "onLoadModel",
(ref) => {
if (ref) {
const name = ref.getAttribute("data-name");
this.props.layoutActions.readyToScroll([...this.getSchemaBasePath(), name], ref);
}
});}
render() {
let { specSelectors, getComponent, layoutSelectors, layoutActions, getConfigs } = this.props;
let definitions = specSelectors.definitions();
let { docExpansion, defaultModelsExpandDepth } = getConfigs();
if (!definitions.size || defaultModelsExpandDepth < 0) return null;
const specPathBase = this.getSchemaBasePath();
let showModels = layoutSelectors.isShown(specPathBase, defaultModelsExpandDepth > 0 && docExpansion !== "none");
const isOAS3 = specSelectors.isOAS3();
const ModelWrapper = getComponent("ModelWrapper");
const Collapse = getComponent("Collapse");
const ModelCollapse = getComponent("ModelCollapse");
const JumpToPath = getComponent("JumpToPath", true);
const ArrowUpIcon = getComponent("ArrowUpIcon");
const ArrowDownIcon = getComponent("ArrowDownIcon");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("section", { className: showModels ? "models is-open" : "models", ref: this.onLoadModels }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", {
"aria-expanded": showModels,
className: "models-control",
onClick: () => layoutActions.show(specPathBase, !showModels) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, isOAS3 ? "Schemas" : "Models"),
showModels ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowUpIcon, null) : /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowDownIcon, null)
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Collapse, { isOpened: showModels },
definitions.entrySeq().map((_ref) => {let [name] = _ref;
const fullPath = [...specPathBase, name];
const specPath = external_immutable_namespaceObject["default"].List(fullPath);
const schemaValue = specSelectors.specResolvedSubtree(fullPath);
const rawSchemaValue = specSelectors.specJson().getIn(fullPath);
const schema = external_immutable_namespaceObject.Map.isMap(schemaValue) ? schemaValue : external_immutable_namespaceObject["default"].Map();
const rawSchema = external_immutable_namespaceObject.Map.isMap(rawSchemaValue) ? rawSchemaValue : external_immutable_namespaceObject["default"].Map();
const displayName = schema.get("title") || rawSchema.get("title") || name;
const isShown = layoutSelectors.isShown(fullPath, false);
if (isShown && schema.size === 0 && rawSchema.size > 0) {
// Firing an action in a container render is not great,
// but it works for now.
this.props.specActions.requestResolvedSubtree(fullPath);
}
const content = /*#__PURE__*/external_react_namespaceObject["default"].createElement(ModelWrapper, { name: name,
expandDepth: defaultModelsExpandDepth,
schema: schema || external_immutable_namespaceObject["default"].Map(),
displayName: displayName,
fullPath: fullPath,
specPath: specPath,
getComponent: getComponent,
specSelectors: specSelectors,
getConfigs: getConfigs,
layoutSelectors: layoutSelectors,
layoutActions: layoutActions,
includeReadOnly: true,
includeWriteOnly: true });
const title = /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "model-box" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "model model-title" },
displayName
)
);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { id: `model-${name}`, className: "model-container", key: `models-section-${name}`,
"data-name": name, ref: this.onLoadModel }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "models-jump-to-path" }, /*#__PURE__*/external_react_namespaceObject["default"].createElement(JumpToPath, { specPath: specPath })), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ModelCollapse, {
classes: "model-box",
collapsedContent: this.getCollapsedContent(name),
onToggle: this.handleToggle,
title: title,
displayName: displayName,
modelName: name,
specPath: specPath,
layoutSelectors: layoutSelectors,
layoutActions: layoutActions,
hideSelfOnExpand: true,
expanded: defaultModelsExpandDepth > 0 && isShown },
content)
);
}).toArray()
)
);
}
}
;// CONCATENATED MODULE: ./src/core/components/enum-model.jsx
const EnumModel = (_ref) => {let { value, getComponent } = _ref;
let ModelCollapse = getComponent("ModelCollapse");
let collapsedContent = /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, "Array [ ", value.count(), " ]");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "prop-enum" }, "Enum:", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("br", null), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ModelCollapse, { collapsedContent: collapsedContent }, "[ ",
value.join(", "), " ]"
)
);
};
/* harmony default export */ const enum_model = (EnumModel);
;// CONCATENATED MODULE: ./src/core/components/object-model.jsx
const object_model_excluded = ["schema", "name", "displayName", "isRef", "getComponent", "getConfigs", "depth", "onToggle", "expanded", "specPath"];
const braceOpen = "{";
const braceClose = "}";
const object_model_propClass = "property";
class ObjectModel extends external_react_namespaceObject.Component {
render() {
let _this$props = this.props,{ schema, name, displayName, isRef, getComponent, getConfigs, depth, onToggle, expanded, specPath } = _this$props,otherProps = (0,objectWithoutProperties_namespaceObject["default"])(_this$props, object_model_excluded);
let { specSelectors, expandDepth, includeReadOnly, includeWriteOnly } = otherProps;
const { isOAS3 } = specSelectors;
if (!schema) {
return null;
}
const { showExtensions } = getConfigs();
let description = schema.get("description");
let properties = schema.get("properties");
let additionalProperties = schema.get("additionalProperties");
let title = schema.get("title") || displayName || name;
let requiredProperties = schema.get("required");
let infoProperties = schema.
filter((v, key) => ["maxProperties", "minProperties", "nullable", "example"].indexOf(key) !== -1);
let deprecated = schema.get("deprecated");
let externalDocsUrl = schema.getIn(["externalDocs", "url"]);
let externalDocsDescription = schema.getIn(["externalDocs", "description"]);
const JumpToPath = getComponent("JumpToPath", true);
const Markdown = getComponent("Markdown", true);
const Model = getComponent("Model");
const ModelCollapse = getComponent("ModelCollapse");
const Property = getComponent("Property");
const Link = getComponent("Link");
const JumpToPathSection = () => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "model-jump-to-path" }, /*#__PURE__*/external_react_namespaceObject["default"].createElement(JumpToPath, { specPath: specPath }));
};
const collapsedContent = /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, braceOpen), "...", /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, braceClose),
isRef ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(JumpToPathSection, null) : ""
);
const anyOf = specSelectors.isOAS3() ? schema.get("anyOf") : null;
const oneOf = specSelectors.isOAS3() ? schema.get("oneOf") : null;
const not = specSelectors.isOAS3() ? schema.get("not") : null;
const titleEl = title && /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "model-title" },
isRef && schema.get("$$ref") && /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "model-hint" }, schema.get("$$ref")), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "model-title__text" }, title)
);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "model" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ModelCollapse, {
modelName: name,
title: titleEl,
onToggle: onToggle,
expanded: expanded ? true : depth <= expandDepth,
collapsedContent: collapsedContent }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "brace-open object" }, braceOpen),
!isRef ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement(JumpToPathSection, null), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "inner-object" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("table", { className: "model" }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("tbody", null,
!description ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement("tr", { className: "description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, "description:"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: description })
)
),
externalDocsUrl && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", { className: "external-docs" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, "externalDocs:"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: sanitizeUrl(externalDocsUrl) }, externalDocsDescription || externalDocsUrl)
)
),
!deprecated ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", { className: "property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, "deprecated:"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, "true"
)
),
!(properties && properties.size) ? null : properties.entrySeq().filter(
(_ref) => {let [, value] = _ref;
return (!value.get("readOnly") || includeReadOnly) && (
!value.get("writeOnly") || includeWriteOnly);
}
).map(
(_ref2) => {let [key, value] = _ref2;
let isDeprecated = isOAS3() && value.get("deprecated");
let isRequired = external_immutable_namespaceObject.List.isList(requiredProperties) && requiredProperties.contains(key);
let classNames = ["property-row"];
if (isDeprecated) {
classNames.push("deprecated");
}
if (isRequired) {
classNames.push("required");
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("tr", { key: key, className: classNames.join(" ") }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null,
key, isRequired && /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "star" }, "*")
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Model, (0,extends_namespaceObject["default"])({ key: `object-${name}-${key}_${value}` }, otherProps, {
required: isRequired,
getComponent: getComponent,
specPath: specPath.push("properties", key),
getConfigs: getConfigs,
schema: value,
depth: depth + 1 }))
)
);
}).toArray(),
// empty row before extensions...
!showExtensions ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement("tr", null, /*#__PURE__*/external_react_namespaceObject["default"].createElement("td", null, "\xA0")),
!showExtensions ? null :
schema.entrySeq().map(
(_ref3) => {let [key, value] = _ref3;
if (key.slice(0, 2) !== "x-") {
return;
}
const normalizedValue = !value ? null : value.toJS ? value.toJS() : value;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("tr", { key: key, className: "extension" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null,
key
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null,
JSON.stringify(normalizedValue)
)
);
}).toArray(),
!additionalProperties || !additionalProperties.size ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, "< * >:"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Model, (0,extends_namespaceObject["default"])({}, otherProps, { required: false,
getComponent: getComponent,
specPath: specPath.push("additionalProperties"),
getConfigs: getConfigs,
schema: additionalProperties,
depth: depth + 1 }))
)
),
!anyOf ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, "anyOf ->"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null,
anyOf.map((schema, k) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { key: k }, /*#__PURE__*/external_react_namespaceObject["default"].createElement(Model, (0,extends_namespaceObject["default"])({}, otherProps, { required: false,
getComponent: getComponent,
specPath: specPath.push("anyOf", k),
getConfigs: getConfigs,
schema: schema,
depth: depth + 1 })));
})
)
),
!oneOf ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, "oneOf ->"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null,
oneOf.map((schema, k) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { key: k }, /*#__PURE__*/external_react_namespaceObject["default"].createElement(Model, (0,extends_namespaceObject["default"])({}, otherProps, { required: false,
getComponent: getComponent,
specPath: specPath.push("oneOf", k),
getConfigs: getConfigs,
schema: schema,
depth: depth + 1 })));
})
)
),
!not ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tr", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, "not ->"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Model, (0,extends_namespaceObject["default"])({}, otherProps, {
required: false,
getComponent: getComponent,
specPath: specPath.push("not"),
getConfigs: getConfigs,
schema: not,
depth: depth + 1 }))
)
)
)
))
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "brace-close" }, braceClose)
),
infoProperties.size ? infoProperties.entrySeq().map((_ref4) => {let [key, v] = _ref4;return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Property, { key: `${key}-${v}`, propKey: key, propVal: v, propClass: object_model_propClass });}) : null
);
}
}
;// CONCATENATED MODULE: ./src/core/components/array-model.jsx
const array_model_propClass = "property";
class ArrayModel extends external_react_namespaceObject.Component {
render() {
let { getComponent, getConfigs, schema, depth, expandDepth, name, displayName, specPath } = this.props;
let description = schema.get("description");
let items = schema.get("items");
let title = schema.get("title") || displayName || name;
let properties = schema.filter((v, key) => ["type", "items", "description", "$$ref", "externalDocs"].indexOf(key) === -1);
let externalDocsUrl = schema.getIn(["externalDocs", "url"]);
let externalDocsDescription = schema.getIn(["externalDocs", "description"]);
const Markdown = getComponent("Markdown", true);
const ModelCollapse = getComponent("ModelCollapse");
const Model = getComponent("Model");
const Property = getComponent("Property");
const Link = getComponent("Link");
const titleEl = title && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "model-title" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "model-title__text" }, title)
);
/*
Note: we set `name={null}` in below because we don't want
the name of the current Model passed (and displayed) as the name of the array element Model
*/
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "model" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ModelCollapse, { title: titleEl, expanded: depth <= expandDepth, collapsedContent: "[...]" }, "[",
properties.size ? properties.entrySeq().map((_ref) => {let [key, v] = _ref;return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Property, { key: `${key}-${v}`, propKey: key, propVal: v, propClass: array_model_propClass });}) : null,
!description ? properties.size ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "markdown" }) : null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: description }),
externalDocsUrl && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "external-docs" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: sanitizeUrl(externalDocsUrl) }, externalDocsDescription || externalDocsUrl)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Model, (0,extends_namespaceObject["default"])({},
this.props, {
getConfigs: getConfigs,
specPath: specPath.push("items"),
name: null,
schema: items,
required: false,
depth: depth + 1 })
)
), "]"
)
);
}
}
;// CONCATENATED MODULE: ./src/core/components/primitive-model.jsx
const primitive_model_propClass = "property primitive";
class Primitive extends external_react_namespaceObject.Component {
render() {
let { schema, getComponent, getConfigs, name, displayName, depth, expandDepth } = this.props;
const { showExtensions } = getConfigs();
if (!schema || !schema.get) {
// don't render if schema isn't correctly formed
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null);
}
let type = schema.get("type");
let format = schema.get("format");
let xml = schema.get("xml");
let enumArray = schema.get("enum");
let title = schema.get("title") || displayName || name;
let description = schema.get("description");
let extensions = getExtensions(schema);
let properties = schema.
filter((_, key) => ["enum", "type", "format", "description", "$$ref", "externalDocs"].indexOf(key) === -1).
filterNot((_, key) => extensions.has(key));
let externalDocsUrl = schema.getIn(["externalDocs", "url"]);
let externalDocsDescription = schema.getIn(["externalDocs", "description"]);
const Markdown = getComponent("Markdown", true);
const EnumModel = getComponent("EnumModel");
const Property = getComponent("Property");
const ModelCollapse = getComponent("ModelCollapse");
const Link = getComponent("Link");
const titleEl = title && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "model-title" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "model-title__text" }, title)
);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "model" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ModelCollapse, { title: titleEl, expanded: depth <= expandDepth, collapsedContent: "[...]", hideSelfOnExpand: expandDepth !== depth }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "prop" },
name && depth > 1 && /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "prop-name" }, title), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "prop-type" }, type),
format && /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "prop-format" }, "($", format, ")"),
properties.size ? properties.entrySeq().map((_ref) => {let [key, v] = _ref;return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Property, { key: `${key}-${v}`, propKey: key, propVal: v, propClass: primitive_model_propClass });}) : null,
showExtensions && extensions.size ? extensions.entrySeq().map((_ref2) => {let [key, v] = _ref2;return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Property, { key: `${key}-${v}`, propKey: key, propVal: v, propClass: primitive_model_propClass });}) : null,
!description ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: description }),
externalDocsUrl && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "external-docs" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: sanitizeUrl(externalDocsUrl) }, externalDocsDescription || externalDocsUrl)
),
xml && xml.size ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, /*#__PURE__*/external_react_namespaceObject["default"].createElement("br", null), /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: primitive_model_propClass }, "xml:"),
xml.entrySeq().map((_ref3) => {let [key, v] = _ref3;return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { key: `${key}-${v}`, className: primitive_model_propClass }, /*#__PURE__*/external_react_namespaceObject["default"].createElement("br", null), "\xA0\xA0\xA0", key, ": ", String(v));}).toArray()
) : null,
enumArray && /*#__PURE__*/external_react_namespaceObject["default"].createElement(EnumModel, { value: enumArray, getComponent: getComponent })
)
)
);
}
}
;// CONCATENATED MODULE: ./src/core/components/property.jsx
const Property = (_ref) => {let { propKey, propVal, propClass } = _ref;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", { className: propClass }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("br", null), propKey, ": ", String(propVal)));
};
/* harmony default export */ const property = (Property);
;// CONCATENATED MODULE: ./src/core/components/try-it-out-button.jsx
class TryItOutButton extends external_react_namespaceObject["default"].Component {
render() {
const { onTryoutClick, onCancelClick, onResetClick, enabled, hasUserEditedBody, isOAS3 } = this.props;
const showReset = isOAS3 && hasUserEditedBody;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: showReset ? "try-out btn-group" : "try-out" },
enabled ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("button", { className: "btn try-out__btn cancel", onClick: onCancelClick }, "Cancel") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", { className: "btn try-out__btn", onClick: onTryoutClick }, "Try it out "),
showReset && /*#__PURE__*/external_react_namespaceObject["default"].createElement("button", { className: "btn try-out__btn reset", onClick: onResetClick }, "Reset")
));
}
}(0,defineProperty_namespaceObject["default"])(TryItOutButton, "defaultProps", { onTryoutClick: Function.prototype, onCancelClick: Function.prototype, onResetClick: Function.prototype, enabled: false, hasUserEditedBody: false, isOAS3: false });
;// CONCATENATED MODULE: ./src/core/components/version-pragma-filter.jsx
class VersionPragmaFilter extends external_react_namespaceObject["default"].PureComponent {
render() {
const { bypass, isSwagger2, isOAS3, alsoShow } = this.props;
if (bypass) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, this.props.children);
}
if (isSwagger2 && isOAS3) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "version-pragma" },
alsoShow, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "version-pragma__message version-pragma__message--ambiguous" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h3", null, "Unable to render this definition"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, "swagger"), " and ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, "openapi"), " fields cannot be present in the same Swagger or OpenAPI definition. Please remove one of the fields."), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "Supported version fields are ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, "swagger: ", "\"2.0\""), " and those that match ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, "openapi: 3.0.n"), " (for example, ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, "openapi: 3.0.0"), ").")
)
)
);
}
if (!isSwagger2 && !isOAS3) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "version-pragma" },
alsoShow, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "version-pragma__message version-pragma__message--missing" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h3", null, "Unable to render this definition"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "The provided definition does not specify a valid version field."), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "Please indicate a valid Swagger or OpenAPI version field. Supported version fields are ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, "swagger: ", "\"2.0\""), " and those that match ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, "openapi: 3.0.n"), " (for example, ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, "openapi: 3.0.0"), ").")
)
)
);
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, this.props.children);
}
}(0,defineProperty_namespaceObject["default"])(VersionPragmaFilter, "defaultProps", { alsoShow: null, children: null, bypass: false });
;// CONCATENATED MODULE: ./src/core/components/version-stamp.jsx
const VersionStamp = (_ref) => {let { version } = _ref;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("small", null, /*#__PURE__*/external_react_namespaceObject["default"].createElement("pre", { className: "version" }, " ", version, " "));
};
/* harmony default export */ const version_stamp = (VersionStamp);
;// CONCATENATED MODULE: ./src/core/components/openapi-version.jsx
const OpenAPIVersion = (_ref) => {let { oasVersion } = _ref;return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("small", { className: "version-stamp" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("pre", { className: "version" }, "OAS ", oasVersion)
));};
/* harmony default export */ const openapi_version = (OpenAPIVersion);
;// CONCATENATED MODULE: ./src/core/components/deep-link.jsx
const DeepLink = (_ref) => {let { enabled, path, text } = _ref;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("a", { className: "nostyle",
onClick: enabled ? (e) => e.preventDefault() : null,
href: enabled ? `#/${path}` : null }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, text)
));
};
/* harmony default export */ const deep_link = (DeepLink);
;// CONCATENATED MODULE: ./src/core/components/svg-assets.jsx
const SvgAssets = () => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", className: "svg-assets" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("defs", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("symbol", { viewBox: "0 0 20 20", id: "unlocked" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z" })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("symbol", { viewBox: "0 0 20 20", id: "locked" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z" })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("symbol", { viewBox: "0 0 20 20", id: "close" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z" })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("symbol", { viewBox: "0 0 20 20", id: "large-arrow" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z" })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("symbol", { viewBox: "0 0 20 20", id: "large-arrow-down" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z" })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("symbol", { viewBox: "0 0 20 20", id: "large-arrow-up" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M 17.418 14.908 C 17.69 15.176 18.127 15.176 18.397 14.908 C 18.667 14.64 18.668 14.207 18.397 13.939 L 10.489 6.109 C 10.219 5.841 9.782 5.841 9.51 6.109 L 1.602 13.939 C 1.332 14.207 1.332 14.64 1.602 14.908 C 1.873 15.176 2.311 15.176 2.581 14.908 L 10 7.767 L 17.418 14.908 Z" })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("symbol", { viewBox: "0 0 24 24", id: "jump-to" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z" })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("symbol", { viewBox: "0 0 24 24", id: "expand" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z" })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("symbol", { viewBox: "0 0 15 16", id: "copy" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("g", { transform: "translate(2, -1)" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { fill: "#ffffff", fillRule: "evenodd", d: "M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z" })
)
)
)
)
);
/* harmony default export */ const svg_assets = (SvgAssets);
;// CONCATENATED MODULE: external "remarkable"
var external_remarkable_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_remarkable_y = x => () => x
const external_remarkable_namespaceObject = external_remarkable_x({ ["Remarkable"]: () => __WEBPACK_EXTERNAL_MODULE_remarkable__.Remarkable });
;// CONCATENATED MODULE: external "remarkable/linkify"
var linkify_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var linkify_y = x => () => x
const linkify_namespaceObject = linkify_x({ ["linkify"]: () => __WEBPACK_EXTERNAL_MODULE_remarkable_linkify_34829ba6__.linkify });
;// CONCATENATED MODULE: external "dompurify"
var external_dompurify_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_dompurify_y = x => () => x
const external_dompurify_namespaceObject = external_dompurify_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_dompurify__["default"] });
;// CONCATENATED MODULE: ./src/core/components/providers/markdown.jsx
if (external_dompurify_namespaceObject["default"].addHook) {
external_dompurify_namespaceObject["default"].addHook("beforeSanitizeElements", function (current) {
// Attach safe `rel` values to all elements that contain an `href`,
// i.e. all anchors that are links.
// We _could_ just look for elements that have a non-self target,
// but applying it more broadly shouldn't hurt anything, and is safer.
if (current.href) {
current.setAttribute("rel", "noopener noreferrer");
}
return current;
});
}
function Markdown(_ref) {let { source, className = "", getConfigs } = _ref;
if (typeof source !== "string") {
return null;
}
const md = new external_remarkable_namespaceObject.Remarkable({
html: true,
typographer: true,
breaks: true,
linkTarget: "_blank"
}).use(linkify_namespaceObject.linkify);
md.core.ruler.disable(["replacements", "smartquotes"]);
const { useUnsafeMarkdown } = getConfigs();
const html = md.render(source);
const sanitized = sanitizer(html, { useUnsafeMarkdown });
if (!source || !html || !sanitized) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: (0,external_classnames_namespaceObject["default"])(className, "markdown"), dangerouslySetInnerHTML: { __html: sanitized } }));
}
Markdown.defaultProps = {
getConfigs: () => ({ useUnsafeMarkdown: false })
};
/* harmony default export */ const markdown = (Markdown);
function sanitizer(str) {let { useUnsafeMarkdown = false } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const ALLOW_DATA_ATTR = useUnsafeMarkdown;
const FORBID_ATTR = useUnsafeMarkdown ? [] : ["style", "class"];
if (useUnsafeMarkdown && !sanitizer.hasWarnedAboutDeprecation) {
console.warn(`useUnsafeMarkdown display configuration parameter is deprecated since >3.26.0 and will be removed in v4.0.0.`);
sanitizer.hasWarnedAboutDeprecation = true;
}
return external_dompurify_namespaceObject["default"].sanitize(str, {
ADD_ATTR: ["target"],
FORBID_TAGS: ["style", "form"],
ALLOW_DATA_ATTR,
FORBID_ATTR
});
}
sanitizer.hasWarnedAboutDeprecation = false;
;// CONCATENATED MODULE: ./src/core/components/layouts/base.jsx
/**
* @prettier
*/
class BaseLayout extends external_react_namespaceObject["default"].Component {
render() {
const { errSelectors, specSelectors, getComponent } = this.props;
const SvgAssets = getComponent("SvgAssets");
const InfoContainer = getComponent("InfoContainer", true);
const VersionPragmaFilter = getComponent("VersionPragmaFilter");
const Operations = getComponent("operations", true);
const Models = getComponent("Models", true);
const Webhooks = getComponent("Webhooks", true);
const Row = getComponent("Row");
const Col = getComponent("Col");
const Errors = getComponent("errors", true);
const ServersContainer = getComponent("ServersContainer", true);
const SchemesContainer = getComponent("SchemesContainer", true);
const AuthorizeBtnContainer = getComponent("AuthorizeBtnContainer", true);
const FilterContainer = getComponent("FilterContainer", true);
const isSwagger2 = specSelectors.isSwagger2();
const isOAS3 = specSelectors.isOAS3();
const isOAS31 = specSelectors.isOAS31();
const isSpecEmpty = !specSelectors.specStr();
const loadingStatus = specSelectors.loadingStatus();
let loadingMessage = null;
if (loadingStatus === "loading") {
loadingMessage = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "info" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "loading-container" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "loading" })
)
);
}
if (loadingStatus === "failed") {
loadingMessage = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "info" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "loading-container" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "title" }, "Failed to load API definition."), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Errors, null)
)
);
}
if (loadingStatus === "failedConfig") {
const lastErr = errSelectors.lastError();
const lastErrMsg = lastErr ? lastErr.get("message") : "";
loadingMessage = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "info failed-config" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "loading-container" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "title" }, "Failed to load remote configuration."), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, lastErrMsg)
)
);
}
if (!loadingMessage && isSpecEmpty) {
loadingMessage = /*#__PURE__*/external_react_namespaceObject["default"].createElement("h4", null, "No API definition provided.");
}
if (loadingMessage) {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "swagger-ui" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "loading-container" }, loadingMessage)
));
}
const servers = specSelectors.servers();
const schemes = specSelectors.schemes();
const hasServers = servers && servers.size;
const hasSchemes = schemes && schemes.size;
const hasSecurityDefinitions = !!specSelectors.securityDefinitions();
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "swagger-ui" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(SvgAssets, null), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(VersionPragmaFilter, {
isSwagger2: isSwagger2,
isOAS3: isOAS3,
alsoShow: /*#__PURE__*/external_react_namespaceObject["default"].createElement(Errors, null) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Errors, null), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, { className: "information-container" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { mobile: 12 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(InfoContainer, null)
)
),
hasServers || hasSchemes || hasSecurityDefinitions ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "scheme-container" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { className: "schemes wrapper", mobile: 12 },
hasServers ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(ServersContainer, null) : null,
hasSchemes ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(SchemesContainer, null) : null,
hasSecurityDefinitions ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(AuthorizeBtnContainer, null) : null
)
) :
null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(FilterContainer, null), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { mobile: 12, desktop: 12 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Operations, null)
)
),
isOAS31 && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, { className: "webhooks-container" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { mobile: 12, desktop: 12 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Webhooks, null)
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, { mobile: 12, desktop: 12 }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Models, null)
)
)
)
));
}
}
;// CONCATENATED MODULE: ./src/core/presets/base/plugins/core-components/index.js
/**
* @prettier
*/
const CoreComponentsPlugin = () => ({
components: {
App: App,
authorizationPopup: AuthorizationPopup,
authorizeBtn: AuthorizeBtn,
AuthorizeBtnContainer: AuthorizeBtnContainer,
authorizeOperationBtn: AuthorizeOperationBtn,
auths: Auths,
AuthItem: auth_item_Auths,
authError: AuthError,
oauth2: Oauth2,
apiKeyAuth: ApiKeyAuth,
basicAuth: BasicAuth,
clear: Clear,
liveResponse: LiveResponse,
InitializedInput: InitializedInput,
info: components_info,
InfoContainer: InfoContainer,
InfoUrl: InfoUrl,
InfoBasePath: InfoBasePath,
Contact: contact,
License: license,
JumpToPath: JumpToPath,
CopyToClipboardBtn: CopyToClipboardBtn,
onlineValidatorBadge: OnlineValidatorBadge,
operations: Operations,
operation: Operation,
OperationSummary: OperationSummary,
OperationSummaryMethod: OperationSummaryMethod,
OperationSummaryPath: OperationSummaryPath,
highlightCode: highlight_code,
responses: Responses,
response: Response,
ResponseExtension: response_extension,
responseBody: ResponseBody,
parameters: Parameters,
parameterRow: ParameterRow,
execute: Execute,
headers: headers_Headers,
errors: Errors,
contentType: ContentType,
overview: Overview,
footer: Footer,
FilterContainer: FilterContainer,
ParamBody: ParamBody,
curl: Curl,
schemes: Schemes,
SchemesContainer: SchemesContainer,
modelExample: ModelExample,
ModelWrapper: ModelWrapper,
ModelCollapse: ModelCollapse,
Model: Model,
Models: Models,
EnumModel: enum_model,
ObjectModel: ObjectModel,
ArrayModel: ArrayModel,
PrimitiveModel: Primitive,
Property: property,
TryItOutButton: TryItOutButton,
Markdown: markdown,
BaseLayout: BaseLayout,
VersionPragmaFilter: VersionPragmaFilter,
VersionStamp: version_stamp,
OperationExt: operation_extensions,
OperationExtRow: operation_extension_row,
ParameterExt: parameter_extension,
ParameterIncludeEmpty: ParameterIncludeEmpty,
OperationTag: OperationTag,
OperationContainer: OperationContainer,
OpenAPIVersion: openapi_version,
DeepLink: deep_link,
SvgAssets: svg_assets,
Example: Example,
ExamplesSelect: ExamplesSelect,
ExamplesSelectValueRetainer: ExamplesSelectValueRetainer
}
});
/* harmony default export */ const core_components = (CoreComponentsPlugin);
;// CONCATENATED MODULE: ./src/core/presets/base/plugins/form-components/index.js
/**
* @prettier
*/
const FormComponentsPlugin = () => ({
components: (0,objectSpread2_namespaceObject["default"])({}, layout_utils_namespaceObject)
});
/* harmony default export */ const form_components = (FormComponentsPlugin);
;// CONCATENATED MODULE: external "react-debounce-input"
var external_react_debounce_input_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var external_react_debounce_input_y = x => () => x
const external_react_debounce_input_namespaceObject = external_react_debounce_input_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_react_debounce_input_7ed3e068__["default"] });
;// CONCATENATED MODULE: ./src/core/components/json-schema-components.jsx
const json_schema_components_noop = () => {};
const JsonSchemaDefaultProps = {
value: "",
onChange: json_schema_components_noop,
schema: {},
keyName: "",
required: false,
errors: (0,external_immutable_namespaceObject.List)()
};
class JsonSchemaForm extends external_react_namespaceObject.Component {
componentDidMount() {
const { dispatchInitialValue, value, onChange } = this.props;
if (dispatchInitialValue) {
onChange(value);
} else if (dispatchInitialValue === false) {
onChange("");
}
}
render() {
let { schema, errors, value, onChange, getComponent, fn, disabled } = this.props;
const format = schema && schema.get ? schema.get("format") : null;
const type = schema && schema.get ? schema.get("type") : null;
let getComponentSilently = (name) => getComponent(name, false, { failSilently: true });
let Comp = type ? format ?
getComponentSilently(`JsonSchema_${type}_${format}`) :
getComponentSilently(`JsonSchema_${type}`) :
getComponent("JsonSchema_string");
if (!Comp) {
Comp = getComponent("JsonSchema_string");
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Comp, (0,extends_namespaceObject["default"])({}, this.props, { errors: errors, fn: fn, getComponent: getComponent, value: value, onChange: onChange, schema: schema, disabled: disabled }));
}
}(0,defineProperty_namespaceObject["default"])(JsonSchemaForm, "defaultProps", JsonSchemaDefaultProps);
class JsonSchema_string extends external_react_namespaceObject.Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onChange",
(e) => {
const value = this.props.schema && this.props.schema.get("type") === "file" ? e.target.files[0] : e.target.value;
this.props.onChange(value, this.props.keyName);
});(0,defineProperty_namespaceObject["default"])(this, "onEnumChange",
(val) => this.props.onChange(val));}
render() {
let { getComponent, value, schema, errors, required, description, disabled } = this.props;
const enumValue = schema && schema.get ? schema.get("enum") : null;
const format = schema && schema.get ? schema.get("format") : null;
const type = schema && schema.get ? schema.get("type") : null;
const schemaIn = schema && schema.get ? schema.get("in") : null;
if (!value) {
value = ""; // value should not be null; this fixes a Debounce error
}
errors = errors.toJS ? errors.toJS() : [];
if (enumValue) {
const Select = getComponent("Select");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Select, { className: errors.length ? "invalid" : "",
title: errors.length ? errors : "",
allowedValues: [...enumValue],
value: value,
allowEmptyValue: !required,
disabled: disabled,
onChange: this.onEnumChange });
}
const isDisabled = disabled || schemaIn && schemaIn === "formData" && !("FormData" in window);
const Input = getComponent("Input");
if (type && type === "file") {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(Input, { type: "file",
className: errors.length ? "invalid" : "",
title: errors.length ? errors : "",
onChange: this.onChange,
disabled: isDisabled }));
} else
{
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(external_react_debounce_input_namespaceObject["default"], {
type: format && format === "password" ? "password" : "text",
className: errors.length ? "invalid" : "",
title: errors.length ? errors : "",
value: value,
minLength: 0,
debounceTimeout: 350,
placeholder: description,
onChange: this.onChange,
disabled: isDisabled }));
}
}
}(0,defineProperty_namespaceObject["default"])(JsonSchema_string, "defaultProps", JsonSchemaDefaultProps);
class JsonSchema_array extends external_react_namespaceObject.PureComponent {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "onChange",
() => {
this.props.onChange(this.state.value);
});(0,defineProperty_namespaceObject["default"])(this, "onItemChange",
(itemVal, i) => {
this.setState((_ref) => {let { value } = _ref;return {
value: value.set(i, itemVal)
};}, this.onChange);
});(0,defineProperty_namespaceObject["default"])(this, "removeItem",
(i) => {
this.setState((_ref2) => {let { value } = _ref2;return {
value: value.delete(i)
};}, this.onChange);
});(0,defineProperty_namespaceObject["default"])(this, "addItem",
() => {
const { fn } = this.props;
let newValue = valueOrEmptyList(this.state.value);
this.setState(() => ({
value: newValue.push(fn.getSampleSchema(this.state.schema.get("items"), false, {
includeWriteOnly: true
}))
}), this.onChange);
});(0,defineProperty_namespaceObject["default"])(this, "onEnumChange",
(value) => {
this.setState(() => ({
value: value
}), this.onChange);
});this.state = { value: valueOrEmptyList(props.value), schema: props.schema };}UNSAFE_componentWillReceiveProps(props) {const value = valueOrEmptyList(props.value);if (value !== this.state.value) this.setState({ value });if (props.schema !== this.state.schema) this.setState({ schema: props.schema });}
render() {
let { getComponent, required, schema, errors, fn, disabled } = this.props;
errors = errors.toJS ? errors.toJS() : Array.isArray(errors) ? errors : [];
const arrayErrors = errors.filter((e) => typeof e === "string");
const needsRemoveError = errors.filter((e) => e.needRemove !== undefined).
map((e) => e.error);
const value = this.state.value; // expect Im List
const shouldRenderValue =
value && value.count && value.count() > 0 ? true : false;
const schemaItemsEnum = schema.getIn(["items", "enum"]);
const schemaItemsType = schema.getIn(["items", "type"]);
const schemaItemsFormat = schema.getIn(["items", "format"]);
const schemaItemsSchema = schema.get("items");
let ArrayItemsComponent;
let isArrayItemText = false;
let isArrayItemFile = schemaItemsType === "file" || schemaItemsType === "string" && schemaItemsFormat === "binary" ? true : false;
if (schemaItemsType && schemaItemsFormat) {
ArrayItemsComponent = getComponent(`JsonSchema_${schemaItemsType}_${schemaItemsFormat}`);
} else if (schemaItemsType === "boolean" || schemaItemsType === "array" || schemaItemsType === "object") {
ArrayItemsComponent = getComponent(`JsonSchema_${schemaItemsType}`);
}
// if ArrayItemsComponent not assigned or does not exist,
// use default schemaItemsType === "string" & JsonSchemaArrayItemText component
if (!ArrayItemsComponent && !isArrayItemFile) {
isArrayItemText = true;
}
if (schemaItemsEnum) {
const Select = getComponent("Select");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Select, { className: errors.length ? "invalid" : "",
title: errors.length ? errors : "",
multiple: true,
value: value,
disabled: disabled,
allowedValues: schemaItemsEnum,
allowEmptyValue: !required,
onChange: this.onEnumChange });
}
const Button = getComponent("Button");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-array" },
shouldRenderValue ?
value.map((item, i) => {
const itemErrors = (0,external_immutable_namespaceObject.fromJS)([
...errors.filter((err) => err.index === i).
map((e) => e.error)]
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { key: i, className: "json-schema-form-item" },
isArrayItemFile ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JsonSchemaArrayItemFile, {
value: item,
onChange: (val) => this.onItemChange(val, i),
disabled: disabled,
errors: itemErrors,
getComponent: getComponent }
) :
isArrayItemText ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JsonSchemaArrayItemText, {
value: item,
onChange: (val) => this.onItemChange(val, i),
disabled: disabled,
errors: itemErrors }
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ArrayItemsComponent, (0,extends_namespaceObject["default"])({}, this.props, {
value: item,
onChange: (val) => this.onItemChange(val, i),
disabled: disabled,
errors: itemErrors,
schema: schemaItemsSchema,
getComponent: getComponent,
fn: fn })
),
!disabled ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Button, {
className: `btn btn-sm json-schema-form-item-remove ${needsRemoveError.length ? "invalid" : null}`,
title: needsRemoveError.length ? needsRemoveError : "",
onClick: () => this.removeItem(i) },
" - ") :
null
));
}) :
null,
!disabled ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Button, {
className: `btn btn-sm json-schema-form-item-add ${arrayErrors.length ? "invalid" : null}`,
title: arrayErrors.length ? arrayErrors : "",
onClick: this.addItem },
"Add ",
schemaItemsType ? `${schemaItemsType} ` : "", "item"
) :
null
));
}
}(0,defineProperty_namespaceObject["default"])(JsonSchema_array, "defaultProps", JsonSchemaDefaultProps);
class JsonSchemaArrayItemText extends external_react_namespaceObject.Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onChange",
(e) => {
const value = e.target.value;
this.props.onChange(value, this.props.keyName);
});}
render() {
let { value, errors, description, disabled } = this.props;
if (!value) {
value = ""; // value should not be null
}
errors = errors.toJS ? errors.toJS() : [];
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(external_react_debounce_input_namespaceObject["default"], {
type: "text",
className: errors.length ? "invalid" : "",
title: errors.length ? errors : "",
value: value,
minLength: 0,
debounceTimeout: 350,
placeholder: description,
onChange: this.onChange,
disabled: disabled });
}
}(0,defineProperty_namespaceObject["default"])(JsonSchemaArrayItemText, "defaultProps", JsonSchemaDefaultProps);
class JsonSchemaArrayItemFile extends external_react_namespaceObject.Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onFileChange",
(e) => {
const value = e.target.files[0];
this.props.onChange(value, this.props.keyName);
});}
render() {
let { getComponent, errors, disabled } = this.props;
const Input = getComponent("Input");
const isDisabled = disabled || !("FormData" in window);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Input, { type: "file",
className: errors.length ? "invalid" : "",
title: errors.length ? errors : "",
onChange: this.onFileChange,
disabled: isDisabled });
}
}(0,defineProperty_namespaceObject["default"])(JsonSchemaArrayItemFile, "defaultProps", JsonSchemaDefaultProps);
class JsonSchema_boolean extends external_react_namespaceObject.Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onEnumChange",
(val) => this.props.onChange(val));}
render() {
let { getComponent, value, errors, schema, required, disabled } = this.props;
errors = errors.toJS ? errors.toJS() : [];
let enumValue = schema && schema.get ? schema.get("enum") : null;
let allowEmptyValue = !enumValue || !required;
let booleanValue = !enumValue && ["true", "false"];
const Select = getComponent("Select");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Select, { className: errors.length ? "invalid" : "",
title: errors.length ? errors : "",
value: String(value),
disabled: disabled,
allowedValues: enumValue ? [...enumValue] : booleanValue,
allowEmptyValue: allowEmptyValue,
onChange: this.onEnumChange });
}
}(0,defineProperty_namespaceObject["default"])(JsonSchema_boolean, "defaultProps", JsonSchemaDefaultProps);
const stringifyObjectErrors = (errors) => {
return errors.map((err) => {
const meta = err.propKey !== undefined ? err.propKey : err.index;
let stringError = typeof err === "string" ? err : typeof err.error === "string" ? err.error : null;
if (!meta && stringError) {
return stringError;
}
let currentError = err.error;
let path = `/${err.propKey}`;
while (typeof currentError === "object") {
const part = currentError.propKey !== undefined ? currentError.propKey : currentError.index;
if (part === undefined) {
break;
}
path += `/${part}`;
if (!currentError.error) {
break;
}
currentError = currentError.error;
}
return `${path}: ${currentError}`;
});
};
class JsonSchema_object extends external_react_namespaceObject.PureComponent {
constructor() {
super();(0,defineProperty_namespaceObject["default"])(this, "onChange",
(value) => {
this.props.onChange(value);
});(0,defineProperty_namespaceObject["default"])(this, "handleOnChange",
(e) => {
const inputValue = e.target.value;
this.onChange(inputValue);
});}
render() {
let {
getComponent,
value,
errors,
disabled
} = this.props;
const TextArea = getComponent("TextArea");
errors = errors.toJS ? errors.toJS() : Array.isArray(errors) ? errors : [];
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(TextArea, {
className: (0,external_classnames_namespaceObject["default"])({ invalid: errors.length }),
title: errors.length ? stringifyObjectErrors(errors).join(", ") : "",
value: stringify(value),
disabled: disabled,
onChange: this.handleOnChange })
));
}
}(0,defineProperty_namespaceObject["default"])(JsonSchema_object, "defaultProps", JsonSchemaDefaultProps);
function valueOrEmptyList(value) {
return external_immutable_namespaceObject.List.isList(value) ? value : Array.isArray(value) ? (0,external_immutable_namespaceObject.fromJS)(value) : (0,external_immutable_namespaceObject.List)();
}
;// CONCATENATED MODULE: ./src/core/presets/base/plugins/json-schema-components/index.js
/**
* @prettier
*/
const JSONSchemaComponentsPlugin = () => ({
components: (0,objectSpread2_namespaceObject["default"])({}, json_schema_components_namespaceObject)
});
/* harmony default export */ const json_schema_components = (JSONSchemaComponentsPlugin);
;// CONCATENATED MODULE: ./src/core/presets/base/index.js
/**
* @prettier
*/
// ad-hoc plugins
const BasePreset = () => [
configsPlugin,
util,
logs,
view,
plugins_spec,
err,
icons,
plugins_layout,
samples,
core_components,
form_components,
swagger_client,
json_schema_components,
auth,
downloadUrlPlugin,
deep_linking,
filter,
on_complete,
plugins_request_snippets,
safe_render()];
/* harmony default export */ const base = (BasePreset);
;// CONCATENATED MODULE: ./src/core/plugins/oas3/spec-extensions/wrap-selectors.js
/**
* @prettier
*/
/**
* Helpers
*/
const map = (0,external_immutable_namespaceObject.Map)();
function onlyOAS3(selector) {
return (ori, system) =>
function () {
if (system.getSystem().specSelectors.isOAS3()) {
const result = selector(...arguments);
return typeof result === "function" ? result(system) : result;
} else {
return ori(...arguments);
}
};
}
const nullSelector = (0,external_reselect_namespaceObject.createSelector)(() => null);
const OAS3NullSelector = onlyOAS3(nullSelector);
/**
* Wrappers
*/
const wrap_selectors_definitions = onlyOAS3(() => (system) => {
const spec = system.getSystem().specSelectors.specJson();
const schemas = spec.getIn(["components", "schemas"]);
return external_immutable_namespaceObject.Map.isMap(schemas) ? schemas : map;
});
const wrap_selectors_hasHost = onlyOAS3(() => (system) => {
const spec = system.getSystem().specSelectors.specJson();
return spec.hasIn(["servers", 0]);
});
const wrap_selectors_securityDefinitions = onlyOAS3(
(0,external_reselect_namespaceObject.createSelector)(
specJsonWithResolvedSubtrees,
(spec) => spec.getIn(["components", "securitySchemes"]) || null
)
);
const wrap_selectors_validOperationMethods =
(oriSelector, system) =>
function (state) {
if (system.specSelectors.isOAS3()) {
return system.oas3Selectors.validOperationMethods();
}for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {args[_key - 1] = arguments[_key];}
return oriSelector(...args);
};
const wrap_selectors_host = OAS3NullSelector;
const wrap_selectors_basePath = OAS3NullSelector;
const wrap_selectors_consumes = OAS3NullSelector;
const wrap_selectors_produces = OAS3NullSelector;
const wrap_selectors_schemes = OAS3NullSelector;
;// CONCATENATED MODULE: ./src/core/plugins/oas3/auth-extensions/wrap-selectors.js
// Helpers
const wrap_selectors_state = (state) => state;
function wrap_selectors_onlyOAS3(selector) {
return (ori, system) => function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}
if (system.getSystem().specSelectors.isOAS3()) {
// Pass the spec plugin state to Reselect to trigger on securityDefinitions update
let resolvedSchemes = system.getState().getIn(["spec", "resolvedSubtrees",
"components", "securitySchemes"]);
return selector(system, resolvedSchemes, ...args);
} else {
return ori(...args);
}
};
}
const wrap_selectors_definitionsToAuthorize = wrap_selectors_onlyOAS3((0,external_reselect_namespaceObject.createSelector)(
wrap_selectors_state,
(_ref) => {let { specSelectors } = _ref;return specSelectors.securityDefinitions();},
(system, definitions) => {
// Coerce our OpenAPI 3.0 definitions into monoflow definitions
// that look like Swagger2 definitions.
let list = (0,external_immutable_namespaceObject.List)();
if (!definitions) {
return list;
}
definitions.entrySeq().forEach((_ref2) => {let [defName, definition] = _ref2;
const type = definition.get("type");
if (type === "oauth2") {
definition.get("flows").entrySeq().forEach((_ref3) => {let [flowKey, flowVal] = _ref3;
let translatedDef = (0,external_immutable_namespaceObject.fromJS)({
flow: flowKey,
authorizationUrl: flowVal.get("authorizationUrl"),
tokenUrl: flowVal.get("tokenUrl"),
scopes: flowVal.get("scopes"),
type: definition.get("type"),
description: definition.get("description")
});
list = list.push(new external_immutable_namespaceObject.Map({
[defName]: translatedDef.filter((v) => {
// filter out unset values, sometimes `authorizationUrl`
// and `tokenUrl` come out as `undefined` in the data
return v !== undefined;
})
}));
});
}
if (type === "http" || type === "apiKey") {
list = list.push(new external_immutable_namespaceObject.Map({
[defName]: definition
}));
}
if (type === "openIdConnect" && definition.get("openIdConnectData")) {
let oidcData = definition.get("openIdConnectData");
let grants = oidcData.get("grant_types_supported") || ["authorization_code", "implicit"];
grants.forEach((grant) => {
// Convert from OIDC list of scopes to the OAS-style map with empty descriptions
let translatedScopes = oidcData.get("scopes_supported") &&
oidcData.get("scopes_supported").reduce((acc, cur) => acc.set(cur, ""), new external_immutable_namespaceObject.Map());
let translatedDef = (0,external_immutable_namespaceObject.fromJS)({
flow: grant,
authorizationUrl: oidcData.get("authorization_endpoint"),
tokenUrl: oidcData.get("token_endpoint"),
scopes: translatedScopes,
type: "oauth2",
openIdConnectUrl: definition.get("openIdConnectUrl")
});
list = list.push(new external_immutable_namespaceObject.Map({
[defName]: translatedDef.filter((v) => {
// filter out unset values, sometimes `authorizationUrl`
// and `tokenUrl` come out as `undefined` in the data
return v !== undefined;
})
}));
});
}
});
return list;
}
));
;// CONCATENATED MODULE: ./src/core/plugins/oas3/helpers.jsx
/**
* @prettier
*/
function isOAS30(jsSpec) {
const oasVersion = jsSpec.get("openapi");
return (
typeof oasVersion === "string" &&
/^3\.0\.([0123])(?:-rc[012])?$/.test(oasVersion));
}
function isSwagger2(jsSpec) {
const swaggerVersion = jsSpec.get("swagger");
return typeof swaggerVersion === "string" && swaggerVersion === "2.0";
}
function OAS3ComponentWrapFactory(Component) {
return (Ori, system) => (props) => {var _system$specSelectors;
if (typeof ((_system$specSelectors = system.specSelectors) === null || _system$specSelectors === void 0 ? void 0 : _system$specSelectors.isOAS3) === "function") {
if (system.specSelectors.isOAS3()) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Component, (0,extends_namespaceObject["default"])({}, props, system, { Ori: Ori }));
} else {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Ori, props);
}
} else {
console.warn("OAS3 wrapper: couldn't get spec");
return null;
}
};
}
function OAS30ComponentWrapFactory(Component) {
return (Ori, system) => (props) => {var _system$specSelectors2;
if (typeof ((_system$specSelectors2 = system.specSelectors) === null || _system$specSelectors2 === void 0 ? void 0 : _system$specSelectors2.isOAS30) === "function") {
if (system.specSelectors.isOAS30()) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Component, (0,extends_namespaceObject["default"])({}, props, system, { Ori: Ori }));
} else {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Ori, props);
}
} else {
console.warn("OAS30 wrapper: couldn't get spec");
return null;
}
};
}
;// CONCATENATED MODULE: ./src/core/plugins/oas3/spec-extensions/selectors.js
/**
* @prettier
*/
/**
* Helpers
*/
const selectors_map = (0,external_immutable_namespaceObject.Map)();
const selectors_isSwagger2 = () => (system) => {
const spec = system.getSystem().specSelectors.specJson();
return isSwagger2(spec);
};
const selectors_isOAS30 = () => (system) => {
const spec = system.getSystem().specSelectors.specJson();
return isOAS30(spec);
};
const selectors_isOAS3 = () => (system) => {
return system.getSystem().specSelectors.isOAS30();
};
function selectors_onlyOAS3(selector) {
return function (state) {for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {args[_key - 1] = arguments[_key];}return (
(system) => {
if (system.specSelectors.isOAS3()) {
const selectedValue = selector(state, ...args);
return typeof selectedValue === "function" ?
selectedValue(system) :
selectedValue;
} else {
return null;
}
});};
}
const servers = selectors_onlyOAS3(() => (system) => {
const spec = system.specSelectors.specJson();
return spec.get("servers", selectors_map);
});
const callbacksOperations = selectors_onlyOAS3(
(state, _ref) => {let { callbacks, specPath } = _ref;return (
(system) => {
const validOperationMethods = system.specSelectors.validOperationMethods();
if (!external_immutable_namespaceObject.Map.isMap(callbacks)) return {};
return callbacks.
reduce((allOperations, callback, callbackName) => {
if (!external_immutable_namespaceObject.Map.isMap(callback)) return allOperations;
return callback.reduce((callbackOperations, pathItem, expression) => {
if (!external_immutable_namespaceObject.Map.isMap(pathItem)) return callbackOperations;
const pathItemOperations = pathItem.
entrySeq().
filter((_ref2) => {let [key] = _ref2;return validOperationMethods.includes(key);}).
map((_ref3) => {let [method, operation] = _ref3;return {
operation: (0,external_immutable_namespaceObject.Map)({ operation }),
method,
path: expression,
callbackName,
specPath: specPath.concat([callbackName, expression, method])
};});
return callbackOperations.concat(pathItemOperations);
}, (0,external_immutable_namespaceObject.List)());
}, (0,external_immutable_namespaceObject.List)()).
groupBy((operationDTO) => operationDTO.callbackName).
map((operations) => operations.toArray()).
toObject();
});}
);
;// CONCATENATED MODULE: ./src/core/plugins/oas3/components/callbacks.jsx
/**
* @prettier
*/
const Callbacks = (_ref) => {let { callbacks, specPath, specSelectors, getComponent } = _ref;
const operationDTOs = specSelectors.callbacksOperations({
callbacks,
specPath
});
const callbackNames = Object.keys(operationDTOs);
const OperationContainer = getComponent("OperationContainer", true);
if (callbackNames.length === 0) return /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, "No callbacks");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null,
callbackNames.map((callbackName) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { key: `${callbackName}` }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h2", null, callbackName),
operationDTOs[callbackName].map((operationDTO) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement(OperationContainer, {
key: `${callbackName}-${operationDTO.path}-${operationDTO.method}`,
op: operationDTO.operation,
tag: "callbacks",
method: operationDTO.method,
path: operationDTO.path,
specPath: operationDTO.specPath,
allowTryItOut: false }
)
)
)
)
));
};
/* harmony default export */ const callbacks = (Callbacks);
;// CONCATENATED MODULE: ./src/core/plugins/oas3/components/request-body.jsx
const getDefaultRequestBodyValue = (requestBody, mediaType, activeExamplesKey, fn) => {var _requestBody$getIn;
const mediaTypeValue = (_requestBody$getIn = requestBody.getIn(["content", mediaType])) !== null && _requestBody$getIn !== void 0 ? _requestBody$getIn : (0,external_immutable_namespaceObject.OrderedMap)();
const schema = mediaTypeValue.get("schema", (0,external_immutable_namespaceObject.OrderedMap)()).toJS();
const hasExamplesKey = mediaTypeValue.get("examples") !== undefined;
const exampleSchema = mediaTypeValue.get("example");
const mediaTypeExample = hasExamplesKey ?
mediaTypeValue.getIn([
"examples",
activeExamplesKey,
"value"]
) :
exampleSchema;
const exampleValue = fn.getSampleSchema(
schema,
mediaType,
{
includeWriteOnly: true
},
mediaTypeExample
);
return stringify(exampleValue);
};
const RequestBody = (_ref) =>
{var _requestBody$get, _requestBody$get2, _requestBodyContent$g;let { userHasEditedBody, requestBody, requestBodyValue, requestBodyInclusionSetting, requestBodyErrors, getComponent, getConfigs, specSelectors, fn, contentType, isExecute, specPath, onChange, onChangeIncludeEmpty, activeExamplesKey, updateActiveExamplesKey, setRetainRequestBodyValueFlag } = _ref;
const handleFile = (e) => {
onChange(e.target.files[0]);
};
const setIsIncludedOptions = (key) => {
let options = {
key,
shouldDispatchInit: false,
defaultValue: true
};
let currentInclusion = requestBodyInclusionSetting.get(key, "no value");
if (currentInclusion === "no value") {
options.shouldDispatchInit = true;
// future: can get/set defaultValue from a config setting
}
return options;
};
const Markdown = getComponent("Markdown", true);
const ModelExample = getComponent("modelExample");
const RequestBodyEditor = getComponent("RequestBodyEditor");
const HighlightCode = getComponent("highlightCode");
const ExamplesSelectValueRetainer = getComponent("ExamplesSelectValueRetainer");
const Example = getComponent("Example");
const ParameterIncludeEmpty = getComponent("ParameterIncludeEmpty");
const { showCommonExtensions } = getConfigs();
const requestBodyDescription = (_requestBody$get = requestBody === null || requestBody === void 0 ? void 0 : requestBody.get("description")) !== null && _requestBody$get !== void 0 ? _requestBody$get : null;
const requestBodyContent = (_requestBody$get2 = requestBody === null || requestBody === void 0 ? void 0 : requestBody.get("content")) !== null && _requestBody$get2 !== void 0 ? _requestBody$get2 : new external_immutable_namespaceObject.OrderedMap();
contentType = contentType || requestBodyContent.keySeq().first() || "";
const mediaTypeValue = (_requestBodyContent$g = requestBodyContent.get(contentType)) !== null && _requestBodyContent$g !== void 0 ? _requestBodyContent$g : (0,external_immutable_namespaceObject.OrderedMap)();
const schemaForMediaType = mediaTypeValue.get("schema", (0,external_immutable_namespaceObject.OrderedMap)());
const rawExamplesOfMediaType = mediaTypeValue.get("examples", null);
const sampleForMediaType = rawExamplesOfMediaType === null || rawExamplesOfMediaType === void 0 ? void 0 : rawExamplesOfMediaType.map((container, key) => {var _container;
const val = (_container = container) === null || _container === void 0 ? void 0 : _container.get("value", null);
if (val) {
container = container.set("value", getDefaultRequestBodyValue(
requestBody,
contentType,
key,
fn
), val);
}
return container;
});
const handleExamplesSelect = (key /*, { isSyntheticChange } */) => {
updateActiveExamplesKey(key);
};
requestBodyErrors = external_immutable_namespaceObject.List.isList(requestBodyErrors) ? requestBodyErrors : (0,external_immutable_namespaceObject.List)();
if (!mediaTypeValue.size) {
return null;
}
const isObjectContent = mediaTypeValue.getIn(["schema", "type"]) === "object";
const isBinaryFormat = mediaTypeValue.getIn(["schema", "format"]) === "binary";
const isBase64Format = mediaTypeValue.getIn(["schema", "format"]) === "base64";
if (
contentType === "application/octet-stream" ||
contentType.indexOf("image/") === 0 ||
contentType.indexOf("audio/") === 0 ||
contentType.indexOf("video/") === 0 ||
isBinaryFormat ||
isBase64Format)
{
const Input = getComponent("Input");
if (!isExecute) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("i", null, "Example values are not available for ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, contentType), " media types."
);
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Input, { type: "file", onChange: handleFile });
}
if (
isObjectContent && (
contentType === "application/x-www-form-urlencoded" ||
contentType.indexOf("multipart/") === 0) &&
schemaForMediaType.get("properties", (0,external_immutable_namespaceObject.OrderedMap)()).size > 0)
{
const JsonSchemaForm = getComponent("JsonSchemaForm");
const ParameterExt = getComponent("ParameterExt");
const bodyProperties = schemaForMediaType.get("properties", (0,external_immutable_namespaceObject.OrderedMap)());
requestBodyValue = external_immutable_namespaceObject.Map.isMap(requestBodyValue) ? requestBodyValue : (0,external_immutable_namespaceObject.OrderedMap)();
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "table-container" },
requestBodyDescription && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: requestBodyDescription }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("table", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tbody", null,
external_immutable_namespaceObject.Map.isMap(bodyProperties) && bodyProperties.entrySeq().map((_ref2) => {let [key, prop] = _ref2;
if (prop.get("readOnly")) return;
let commonExt = showCommonExtensions ? getCommonExtensions(prop) : null;
const required = schemaForMediaType.get("required", (0,external_immutable_namespaceObject.List)()).includes(key);
const type = prop.get("type");
const format = prop.get("format");
const description = prop.get("description");
const currentValue = requestBodyValue.getIn([key, "value"]);
const currentErrors = requestBodyValue.getIn([key, "errors"]) || requestBodyErrors;
const included = requestBodyInclusionSetting.get(key) || false;
const useInitialValFromSchemaSamples = prop.has("default") ||
prop.has("example") ||
prop.hasIn(["items", "example"]) ||
prop.hasIn(["items", "default"]);
const useInitialValFromEnum = prop.has("enum") && (prop.get("enum").size === 1 || required);
const useInitialValue = useInitialValFromSchemaSamples || useInitialValFromEnum;
let initialValue = "";
if (type === "array" && !useInitialValue) {
initialValue = [];
}
if (type === "object" || useInitialValue) {
// TODO: what about example or examples from requestBody could be passed as exampleOverride
initialValue = fn.getSampleSchema(prop, false, {
includeWriteOnly: true
});
}
if (typeof initialValue !== "string" && type === "object") {
initialValue = stringify(initialValue);
}
if (typeof initialValue === "string" && type === "array") {
initialValue = JSON.parse(initialValue);
}
const isFile = type === "string" && (format === "binary" || format === "base64");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("tr", { key: key, className: "parameters", "data-property-name": key }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "parameters-col_name" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: required ? "parameter__name required" : "parameter__name" },
key,
!required ? null : /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", null, "\xA0*")
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "parameter__type" },
type,
format && /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "prop-format" }, "($", format, ")"),
!showCommonExtensions || !commonExt.size ? null : commonExt.entrySeq().map((_ref3) => {let [key, v] = _ref3;return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ParameterExt, { key: `${key}-${v}`, xKey: key, xVal: v });})
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "parameter__deprecated" },
prop.get("deprecated") ? "deprecated" : null
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", { className: "parameters-col_description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: description }),
isExecute ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JsonSchemaForm, {
fn: fn,
dispatchInitialValue: !isFile,
schema: prop,
description: key,
getComponent: getComponent,
value: currentValue === undefined ? initialValue : currentValue,
required: required,
errors: currentErrors,
onChange: (value) => {
onChange(value, [key]);
} }
),
required ? null : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ParameterIncludeEmpty, {
onChange: (value) => onChangeIncludeEmpty(key, value),
isIncluded: included,
isIncludedOptions: setIsIncludedOptions(key),
isDisabled: Array.isArray(currentValue) ? currentValue.length !== 0 : !isEmptyValue(currentValue) }
)
) : null
)
);
})
)
)
);
}
const sampleRequestBody = getDefaultRequestBodyValue(
requestBody,
contentType,
activeExamplesKey,
fn
);
let language = null;
let testValueForJson = getKnownSyntaxHighlighterLanguage(sampleRequestBody);
if (testValueForJson) {
language = "json";
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null,
requestBodyDescription && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: requestBodyDescription }),
sampleForMediaType ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExamplesSelectValueRetainer, {
userHasEditedBody: userHasEditedBody,
examples: sampleForMediaType,
currentKey: activeExamplesKey,
currentUserInputValue: requestBodyValue,
onSelect: handleExamplesSelect,
updateValue: onChange,
defaultToFirstExample: true,
getComponent: getComponent,
setRetainRequestBodyValueFlag: setRetainRequestBodyValueFlag }
) :
null,
isExecute ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(RequestBodyEditor, {
value: requestBodyValue,
errors: requestBodyErrors,
defaultValue: sampleRequestBody,
onChange: onChange,
getComponent: getComponent }
)
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ModelExample, {
getComponent: getComponent,
getConfigs: getConfigs,
specSelectors: specSelectors,
expandDepth: 1,
isExecute: isExecute,
schema: mediaTypeValue.get("schema"),
specPath: specPath.push("content", contentType),
example: /*#__PURE__*/
external_react_namespaceObject["default"].createElement(HighlightCode, {
className: "body-param__example",
getConfigs: getConfigs,
language: language,
value: stringify(requestBodyValue) || sampleRequestBody }
),
includeWriteOnly: true }
),
sampleForMediaType ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Example, {
example: sampleForMediaType.get(activeExamplesKey),
getComponent: getComponent,
getConfigs: getConfigs }
) :
null
);
};
/* harmony default export */ const request_body = (RequestBody);
;// CONCATENATED MODULE: ./src/core/plugins/oas3/components/operation-link.jsx
class operation_link_OperationLink extends external_react_namespaceObject.Component {
render() {
const { link, name, getComponent } = this.props;
const Markdown = getComponent("Markdown", true);
let targetOp = link.get("operationId") || link.get("operationRef");
let parameters = link.get("parameters") && link.get("parameters").toJS();
let description = link.get("description");
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "operation-link" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("b", null, /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, name)),
description ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(Markdown, { source: description }) : null
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("pre", null, "Operation `",
targetOp, "`", /*#__PURE__*/external_react_namespaceObject["default"].createElement("br", null), /*#__PURE__*/external_react_namespaceObject["default"].createElement("br", null), "Parameters ",
padString(0, JSON.stringify(parameters, null, 2)) || "{}", /*#__PURE__*/external_react_namespaceObject["default"].createElement("br", null)
)
);
}
}
function padString(n, string) {
if (typeof string !== "string") {return "";}
return string.
split("\n").
map((line, i) => i > 0 ? Array(n + 1).join(" ") + line : line).
join("\n");
}
/* harmony default export */ const operation_link = (operation_link_OperationLink);
;// CONCATENATED MODULE: ./src/core/plugins/oas3/components/servers.jsx
class Servers extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "onServerChange",
(e) => {
this.setServer(e.target.value);
// set default variable values
});(0,defineProperty_namespaceObject["default"])(this, "onServerVariableValueChange",
(e) => {
let {
setServerVariableValue,
currentServer
} = this.props;
let variableName = e.target.getAttribute("data-variable");
let newVariableValue = e.target.value;
if (typeof setServerVariableValue === "function") {
setServerVariableValue({
server: currentServer,
key: variableName,
val: newVariableValue
});
}
});(0,defineProperty_namespaceObject["default"])(this, "setServer",
(value) => {
let { setSelectedServer } = this.props;
setSelectedServer(value);
});}componentDidMount() {var _servers$first;let { servers, currentServer } = this.props;if (currentServer) {return;} // fire 'change' event to set default 'value' of select
this.setServer((_servers$first = servers.first()) === null || _servers$first === void 0 ? void 0 : _servers$first.get("url"));}UNSAFE_componentWillReceiveProps(nextProps) {let { servers, setServerVariableValue, getServerVariable } = nextProps;if (this.props.currentServer !== nextProps.currentServer || this.props.servers !== nextProps.servers) {// Server has changed, we may need to set default values
let currentServerDefinition = servers.find((v) => v.get("url") === nextProps.currentServer);let prevServerDefinition = this.props.servers.find((v) => v.get("url") === this.props.currentServer) || (0,external_immutable_namespaceObject.OrderedMap)();if (!currentServerDefinition) {return this.setServer(servers.first().get("url"));}let prevServerVariableDefs = prevServerDefinition.get("variables") || (0,external_immutable_namespaceObject.OrderedMap)();let prevServerVariableDefaultKey = prevServerVariableDefs.find((v) => v.get("default")) || (0,external_immutable_namespaceObject.OrderedMap)();let prevServerVariableDefaultValue = prevServerVariableDefaultKey.get("default");let currentServerVariableDefs = currentServerDefinition.get("variables") || (0,external_immutable_namespaceObject.OrderedMap)();let currentServerVariableDefaultKey = currentServerVariableDefs.find((v) => v.get("default")) || (0,external_immutable_namespaceObject.OrderedMap)();let currentServerVariableDefaultValue = currentServerVariableDefaultKey.get("default");currentServerVariableDefs.map((val, key) => {let currentValue = getServerVariable(nextProps.currentServer, key); // note: it is possible for both key/val to be the same across definitions,
// but we will try to detect a change in default values between definitions
// only set the default value if the user hasn't set one yet
// or if the definition appears to have changed
if (!currentValue || prevServerVariableDefaultValue !== currentServerVariableDefaultValue) {setServerVariableValue({ server: nextProps.currentServer, key, val: val.get("default") || "" });}});}}render() {let { servers, currentServer, getServerVariable, getEffectiveServerValue
} = this.props;
let currentServerDefinition = servers.find((s) => s.get("url") === currentServer) || (0,external_immutable_namespaceObject.OrderedMap)();
let currentServerVariableDefs = currentServerDefinition.get("variables") || (0,external_immutable_namespaceObject.OrderedMap)();
let shouldShowVariableUI = currentServerVariableDefs.size !== 0;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "servers" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", { htmlFor: "servers" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("select", { onChange: this.onServerChange, value: currentServer },
servers.valueSeq().map(
(server) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("option", {
value: server.get("url"),
key: server.get("url") },
server.get("url"),
server.get("description") && ` - ${server.get("description")}`
)
).toArray()
)
),
shouldShowVariableUI ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "computed-url" }, "Computed URL:", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null,
getEffectiveServerValue(currentServer)
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, "Server variables"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("table", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("tbody", null,
currentServerVariableDefs.entrySeq().map((_ref) => {let [name, val] = _ref;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("tr", { key: name }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null, name), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("td", null,
val.get("enum") ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("select", { "data-variable": name, onChange: this.onServerVariableValueChange },
val.get("enum").map((enumValue) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("option", {
selected: enumValue === getServerVariable(currentServer, name),
key: enumValue,
value: enumValue },
enumValue
);
})
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("input", {
type: "text",
value: getServerVariable(currentServer, name) || "",
onChange: this.onServerVariableValueChange,
"data-variable": name }
)
)
);
})
)
)
) : null
));
}
}
;// CONCATENATED MODULE: ./src/core/plugins/oas3/components/servers-container.jsx
class ServersContainer extends external_react_namespaceObject["default"].Component {
render() {
const { specSelectors, oas3Selectors, oas3Actions, getComponent } = this.props;
const servers = specSelectors.servers();
const Servers = getComponent("Servers");
return servers && servers.size ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "servers-title" }, "Servers"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Servers, {
servers: servers,
currentServer: oas3Selectors.selectedServer(),
setSelectedServer: oas3Actions.setSelectedServer,
setServerVariableValue: oas3Actions.setServerVariableValue,
getServerVariable: oas3Selectors.serverVariableValue,
getEffectiveServerValue: oas3Selectors.serverEffectiveValue }
)
) : null;
}
}
;// CONCATENATED MODULE: ./src/core/plugins/oas3/components/request-body-editor.jsx
const request_body_editor_NOOP = Function.prototype;
class RequestBodyEditor extends external_react_namespaceObject.PureComponent {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "applyDefaultValue",
(nextProps) => {
const { onChange, defaultValue } = nextProps ? nextProps : this.props;
this.setState({
value: defaultValue
});
return onChange(defaultValue);
});(0,defineProperty_namespaceObject["default"])(this, "onChange",
(value) => {
this.props.onChange(stringify(value));
});(0,defineProperty_namespaceObject["default"])(this, "onDomChange",
(e) => {
const inputValue = e.target.value;
this.setState({
value: inputValue
}, () => this.onChange(inputValue));
});this.state = { value: stringify(props.value) || props.defaultValue }; // this is the glue that makes sure our initial value gets set as the
// current request body value
// TODO: achieve this in a selector instead
props.onChange(props.value);}UNSAFE_componentWillReceiveProps(nextProps) {if (
this.props.value !== nextProps.value &&
nextProps.value !== this.state.value)
{
this.setState({
value: stringify(nextProps.value)
});
}
if (!nextProps.value && nextProps.defaultValue && !!this.state.value) {
// if new value is falsy, we have a default, AND the falsy value didn't
// come from us originally
this.applyDefaultValue(nextProps);
}
}
render() {
let {
getComponent,
errors
} = this.props;
let {
value
} = this.state;
let isInvalid = errors.size > 0 ? true : false;
const TextArea = getComponent("TextArea");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "body-param" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(TextArea, {
className: (0,external_classnames_namespaceObject["default"])("body-param__text", { invalid: isInvalid }),
title: errors.size ? errors.join(", ") : "",
value: value,
onChange: this.onDomChange }
)
));
}
}(0,defineProperty_namespaceObject["default"])(RequestBodyEditor, "defaultProps", { onChange: request_body_editor_NOOP, userHasEditedBody: false });
;// CONCATENATED MODULE: ./src/core/plugins/oas3/components/http-auth.jsx
class HttpAuth extends external_react_namespaceObject["default"].Component {
constructor(props, context) {
super(props, context);(0,defineProperty_namespaceObject["default"])(this, "onChange",
(e) => {
let { onChange } = this.props;
let { value, name } = e.target;
let newValue = Object.assign({}, this.state.value);
if (name) {
newValue[name] = value;
} else {
newValue = value;
}
this.setState({ value: newValue }, () => onChange(this.state));
});let { name: _name, schema } = this.props;let _value = this.getValue();this.state = { name: _name, schema: schema, value: _value };}getValue() {let { name, authorized } = this.props;return authorized && authorized.getIn([name, "value"]);}
render() {
let { schema, getComponent, errSelectors, name } = this.props;
const Input = getComponent("Input");
const Row = getComponent("Row");
const Col = getComponent("Col");
const AuthError = getComponent("authError");
const Markdown = getComponent("Markdown", true);
const JumpToPath = getComponent("JumpToPath", true);
const scheme = (schema.get("scheme") || "").toLowerCase();
let value = this.getValue();
let errors = errSelectors.allErrors().filter((err) => err.get("authId") === name);
if (scheme === "basic") {
let username = value ? value.get("username") : null;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, name || schema.get("name")), "\xA0 (http, Basic)", /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JumpToPath, { path: ["securityDefinitions", name] })
),
username && /*#__PURE__*/external_react_namespaceObject["default"].createElement("h6", null, "Authorized"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: schema.get("description") })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", null, "Username:"),
username ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ", username, " ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, null, /*#__PURE__*/external_react_namespaceObject["default"].createElement(Input, { type: "text", required: "required", name: "username", "aria-label": "auth-basic-username", onChange: this.onChange, autoFocus: true }))
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", null, "Password:"),
username ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ****** ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, null, /*#__PURE__*/external_react_namespaceObject["default"].createElement(Input, { autoComplete: "new-password",
name: "password",
type: "password",
"aria-label": "auth-basic-password",
onChange: this.onChange }))
),
errors.valueSeq().map((error, key) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(AuthError, { error: error,
key: key });
})
);
}
if (scheme === "bearer") {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, name || schema.get("name")), "\xA0 (http, Bearer)", /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JumpToPath, { path: ["securityDefinitions", name] })
),
value && /*#__PURE__*/external_react_namespaceObject["default"].createElement("h6", null, "Authorized"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: schema.get("description") })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Row, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("label", null, "Value:"),
value ? /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, " ****** ") : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Col, null, /*#__PURE__*/external_react_namespaceObject["default"].createElement(Input, { type: "text", "aria-label": "auth-bearer-value", onChange: this.onChange, autoFocus: true }))
),
errors.valueSeq().map((error, key) => {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(AuthError, { error: error,
key: key });
})
));
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("em", null, /*#__PURE__*/external_react_namespaceObject["default"].createElement("b", null, name), " HTTP authentication: unsupported scheme ", `'${scheme}'`)
);
}
}
;// CONCATENATED MODULE: ./src/core/plugins/oas3/components/operation-servers.jsx
class OperationServers extends external_react_namespaceObject["default"].Component {constructor() {super(...arguments);(0,defineProperty_namespaceObject["default"])(this, "setSelectedServer",
(server) => {
const { path, method } = this.props;
// FIXME: we should be keeping up with this in props/state upstream of us
// instead of cheating™ with `forceUpdate`
this.forceUpdate();
return this.props.setSelectedServer(server, `${path}:${method}`);
});(0,defineProperty_namespaceObject["default"])(this, "setServerVariableValue",
(obj) => {
const { path, method } = this.props;
// FIXME: we should be keeping up with this in props/state upstream of us
// instead of cheating™ with `forceUpdate`
this.forceUpdate();
return this.props.setServerVariableValue((0,objectSpread2_namespaceObject["default"])((0,objectSpread2_namespaceObject["default"])({},
obj), {}, {
namespace: `${path}:${method}` })
);
});(0,defineProperty_namespaceObject["default"])(this, "getSelectedServer",
() => {
const { path, method } = this.props;
return this.props.getSelectedServer(`${path}:${method}`);
});(0,defineProperty_namespaceObject["default"])(this, "getServerVariable",
(server, key) => {
const { path, method } = this.props;
return this.props.getServerVariable({
namespace: `${path}:${method}`,
server
}, key);
});(0,defineProperty_namespaceObject["default"])(this, "getEffectiveServerValue",
(server) => {
const { path, method } = this.props;
return this.props.getEffectiveServerValue({
server,
namespace: `${path}:${method}`
});
});}
render() {
const {
// for self
operationServers,
pathServers,
// util
getComponent
} = this.props;
if (!operationServers && !pathServers) {
return null;
}
const Servers = getComponent("Servers");
const serversToDisplay = operationServers || pathServers;
const displaying = operationServers ? "operation" : "path";
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: "opblock-section operation-servers" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-section-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "tab-header" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "opblock-title" }, "Servers")
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "opblock-description-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "message" }, "These ",
displaying, "-level options override the global server options."
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Servers, {
servers: serversToDisplay,
currentServer: this.getSelectedServer(),
setSelectedServer: this.setSelectedServer,
setServerVariableValue: this.setServerVariableValue,
getServerVariable: this.getServerVariable,
getEffectiveServerValue: this.getEffectiveServerValue }
)
)
);
}
}
;// CONCATENATED MODULE: ./src/core/plugins/oas3/components/index.js
/* harmony default export */ const components = ({
Callbacks: callbacks,
HttpAuth: HttpAuth,
RequestBody: request_body,
Servers: Servers,
ServersContainer: ServersContainer,
RequestBodyEditor: RequestBodyEditor,
OperationServers: OperationServers,
operationLink: operation_link
});
;// CONCATENATED MODULE: ./src/core/plugins/oas3/wrap-components/markdown.jsx
const parser = new external_remarkable_namespaceObject.Remarkable("commonmark");
parser.block.ruler.enable(["table"]);
parser.set({ linkTarget: "_blank" });
const markdown_Markdown = (_ref) => {let { source, className = "", getConfigs } = _ref;
if (typeof source !== "string") {
return null;
}
if (source) {
const { useUnsafeMarkdown } = getConfigs();
const html = parser.render(source);
const sanitized = sanitizer(html, { useUnsafeMarkdown });
let trimmed;
if (typeof sanitized === "string") {
trimmed = sanitized.trim();
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", {
dangerouslySetInnerHTML: {
__html: trimmed
},
className: (0,external_classnames_namespaceObject["default"])(className, "renderedMarkdown") }
));
}
return null;
};
markdown_Markdown.defaultProps = {
getConfigs: () => ({ useUnsafeMarkdown: false })
};
/* harmony default export */ const wrap_components_markdown = (OAS3ComponentWrapFactory(markdown_Markdown));
;// CONCATENATED MODULE: ./src/core/plugins/oas3/wrap-components/auth-item.jsx
const auth_item_excluded = ["Ori"];
/* harmony default export */ const auth_item = (OAS3ComponentWrapFactory((_ref) => {let { Ori } = _ref,props = (0,objectWithoutProperties_namespaceObject["default"])(_ref, auth_item_excluded);
const {
schema, getComponent, errSelectors, authorized, onAuthChange, name
} = props;
const HttpAuth = getComponent("HttpAuth");
const type = schema.get("type");
if (type === "http") {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(HttpAuth, { key: name,
schema: schema,
name: name,
errSelectors: errSelectors,
authorized: authorized,
getComponent: getComponent,
onChange: onAuthChange });
} else {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Ori, props);
}
}));
;// CONCATENATED MODULE: ./src/core/plugins/oas3/wrap-components/online-validator-badge.js
// OAS3 spec is now supported by the online validator.
/* harmony default export */ const online_validator_badge = (OAS3ComponentWrapFactory(OnlineValidatorBadge));
;// CONCATENATED MODULE: ./src/core/plugins/oas3/wrap-components/model.jsx
class ModelComponent extends external_react_namespaceObject.Component {
render() {
let { getConfigs, schema } = this.props;
let classes = ["model-box"];
let isDeprecated = schema.get("deprecated") === true;
let message = null;
if (isDeprecated) {
classes.push("deprecated");
message = /*#__PURE__*/external_react_namespaceObject["default"].createElement("span", { className: "model-deprecated-warning" }, "Deprecated:");
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", { className: classes.join(" ") },
message, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Model, (0,extends_namespaceObject["default"])({}, this.props, {
getConfigs: getConfigs,
depth: 1,
expandDepth: this.props.expandDepth || 0 })
)
);
}
}
/* harmony default export */ const model = (OAS3ComponentWrapFactory(ModelComponent));
;// CONCATENATED MODULE: ./src/core/plugins/oas3/wrap-components/json-schema-string.jsx
const json_schema_string_excluded = ["Ori"];
/* harmony default export */ const json_schema_string = (OAS3ComponentWrapFactory((_ref) => {let { Ori } = _ref,props = (0,objectWithoutProperties_namespaceObject["default"])(_ref, json_schema_string_excluded);
const {
schema,
getComponent,
errors,
onChange
} = props;
const format = schema && schema.get ? schema.get("format") : null;
const type = schema && schema.get ? schema.get("type") : null;
const Input = getComponent("Input");
if (type && type === "string" && format && (format === "binary" || format === "base64")) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Input, { type: "file",
className: errors.length ? "invalid" : "",
title: errors.length ? errors : "",
onChange: (e) => {
onChange(e.target.files[0]);
},
disabled: Ori.isDisabled });
} else {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Ori, props);
}
}));
;// CONCATENATED MODULE: ./src/core/plugins/oas3/wrap-components/openapi-version.jsx
/* harmony default export */ const wrap_components_openapi_version = (OAS30ComponentWrapFactory((props) => {
const { Ori } = props;
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Ori, { oasVersion: "3.0" });
}));
;// CONCATENATED MODULE: ./src/core/plugins/oas3/wrap-components/index.js
/* harmony default export */ const wrap_components = ({
Markdown: wrap_components_markdown,
AuthItem: auth_item,
OpenAPIVersion: wrap_components_openapi_version,
JsonSchema_string: json_schema_string,
model: model,
onlineValidatorBadge: online_validator_badge
});
;// CONCATENATED MODULE: ./src/core/plugins/oas3/actions.js
// Actions conform to FSA (flux-standard-actions)
// {type: string,payload: Any|Error, meta: obj, error: bool}
const UPDATE_SELECTED_SERVER = "oas3_set_servers";
const UPDATE_REQUEST_BODY_VALUE = "oas3_set_request_body_value";
const UPDATE_REQUEST_BODY_VALUE_RETAIN_FLAG = "oas3_set_request_body_retain_flag";
const UPDATE_REQUEST_BODY_INCLUSION = "oas3_set_request_body_inclusion";
const UPDATE_ACTIVE_EXAMPLES_MEMBER = "oas3_set_active_examples_member";
const UPDATE_REQUEST_CONTENT_TYPE = "oas3_set_request_content_type";
const UPDATE_RESPONSE_CONTENT_TYPE = "oas3_set_response_content_type";
const UPDATE_SERVER_VARIABLE_VALUE = "oas3_set_server_variable_value";
const SET_REQUEST_BODY_VALIDATE_ERROR = "oas3_set_request_body_validate_error";
const CLEAR_REQUEST_BODY_VALIDATE_ERROR = "oas3_clear_request_body_validate_error";
const CLEAR_REQUEST_BODY_VALUE = "oas3_clear_request_body_value";
function setSelectedServer(selectedServerUrl, namespace) {
return {
type: UPDATE_SELECTED_SERVER,
payload: { selectedServerUrl, namespace }
};
}
function setRequestBodyValue(_ref) {let { value, pathMethod } = _ref;
return {
type: UPDATE_REQUEST_BODY_VALUE,
payload: { value, pathMethod }
};
}
const setRetainRequestBodyValueFlag = (_ref2) => {let { value, pathMethod } = _ref2;
return {
type: UPDATE_REQUEST_BODY_VALUE_RETAIN_FLAG,
payload: { value, pathMethod }
};
};
function setRequestBodyInclusion(_ref3) {let { value, pathMethod, name } = _ref3;
return {
type: UPDATE_REQUEST_BODY_INCLUSION,
payload: { value, pathMethod, name }
};
}
function setActiveExamplesMember(_ref4) {let { name, pathMethod, contextType, contextName } = _ref4;
return {
type: UPDATE_ACTIVE_EXAMPLES_MEMBER,
payload: { name, pathMethod, contextType, contextName }
};
}
function setRequestContentType(_ref5) {let { value, pathMethod } = _ref5;
return {
type: UPDATE_REQUEST_CONTENT_TYPE,
payload: { value, pathMethod }
};
}
function setResponseContentType(_ref6) {let { value, path, method } = _ref6;
return {
type: UPDATE_RESPONSE_CONTENT_TYPE,
payload: { value, path, method }
};
}
function setServerVariableValue(_ref7) {let { server, namespace, key, val } = _ref7;
return {
type: UPDATE_SERVER_VARIABLE_VALUE,
payload: { server, namespace, key, val }
};
}
const setRequestBodyValidateError = (_ref8) => {let { path, method, validationErrors } = _ref8;
return {
type: SET_REQUEST_BODY_VALIDATE_ERROR,
payload: { path, method, validationErrors }
};
};
const clearRequestBodyValidateError = (_ref9) => {let { path, method } = _ref9;
return {
type: CLEAR_REQUEST_BODY_VALIDATE_ERROR,
payload: { path, method }
};
};
const initRequestBodyValidateError = (_ref10) => {let { pathMethod } = _ref10;
return {
type: CLEAR_REQUEST_BODY_VALIDATE_ERROR,
payload: { path: pathMethod[0], method: pathMethod[1] }
};
};
const clearRequestBodyValue = (_ref11) => {let { pathMethod } = _ref11;
return {
type: CLEAR_REQUEST_BODY_VALUE,
payload: { pathMethod }
};
};
;// CONCATENATED MODULE: ./src/core/plugins/oas3/selectors.js
/**
* @prettier
*/
// Helpers
const oas3_selectors_onlyOAS3 =
(selector) =>
function (state) {for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {args[_key - 1] = arguments[_key];}return (
(system) => {
if (system.getSystem().specSelectors.isOAS3()) {
const selectedValue = selector(state, ...args);
return typeof selectedValue === "function" ?
selectedValue(system) :
selectedValue;
} else {
return null;
}
});};
function validateRequestBodyIsRequired(selector) {
return function () {for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {args[_key2] = arguments[_key2];}return (
(system) => {
const specJson = system.getSystem().specSelectors.specJson();
const argsList = [...args];
// expect argsList[0] = state
let pathMethod = argsList[1] || [];
let isOas3RequestBodyRequired = specJson.getIn([
"paths",
...pathMethod,
"requestBody",
"required"]
);
if (isOas3RequestBodyRequired) {
return selector(...args);
} else {
// validation pass b/c not required
return true;
}
});};
}
const validateRequestBodyValueExists = (state, pathMethod) => {
pathMethod = pathMethod || [];
let oas3RequestBodyValue = state.getIn([
"requestData",
...pathMethod,
"bodyValue"]
);
// context: bodyValue can be a String, or a Map
if (!oas3RequestBodyValue) {
return false;
}
// validation pass if String is not empty, or if Map exists
return true;
};
const selectedServer = oas3_selectors_onlyOAS3((state, namespace) => {
const path = namespace ? [namespace, "selectedServer"] : ["selectedServer"];
return state.getIn(path) || "";
});
const requestBodyValue = oas3_selectors_onlyOAS3((state, path, method) => {
return state.getIn(["requestData", path, method, "bodyValue"]) || null;
});
const shouldRetainRequestBodyValue = oas3_selectors_onlyOAS3((state, path, method) => {
return state.getIn(["requestData", path, method, "retainBodyValue"]) || false;
});
const selectDefaultRequestBodyValue =
(state, path, method) => (system) => {
const { oas3Selectors, specSelectors, fn } = system.getSystem();
if (specSelectors.isOAS3()) {
const currentMediaType = oas3Selectors.requestContentType(path, method);
if (currentMediaType) {
return getDefaultRequestBodyValue(
specSelectors.specResolvedSubtree([
"paths",
path,
method,
"requestBody"]
),
currentMediaType,
oas3Selectors.activeExamplesMember(
path,
method,
"requestBody",
"requestBody"
),
fn
);
}
}
return null;
};
const hasUserEditedBody = oas3_selectors_onlyOAS3((state, path, method) => (system) => {
const { oas3Selectors, specSelectors, fn } = system;
let userHasEditedBody = false;
const currentMediaType = oas3Selectors.requestContentType(path, method);
let userEditedRequestBody = oas3Selectors.requestBodyValue(path, method);
const requestBody = specSelectors.specResolvedSubtree([
"paths",
path,
method,
"requestBody"]
);
/**
* The only request body that can currently be edited is for Path Items that are direct values of OpenAPI.paths.
* Path Item contained within the Callback Object or OpenAPI.webhooks (OpenAPI 3.1.0) have `Try it out`
* disabled and thus body cannot be edited.
*/
if (!requestBody) {
return false;
}
if (external_immutable_namespaceObject.Map.isMap(userEditedRequestBody)) {
// context is not application/json media-type
userEditedRequestBody = stringify(
userEditedRequestBody.
mapEntries((kv) =>
external_immutable_namespaceObject.Map.isMap(kv[1]) ? [kv[0], kv[1].get("value")] : kv
).
toJS()
);
}
if (external_immutable_namespaceObject.List.isList(userEditedRequestBody)) {
userEditedRequestBody = stringify(userEditedRequestBody);
}
if (currentMediaType) {
const currentMediaTypeDefaultBodyValue = getDefaultRequestBodyValue(
requestBody,
currentMediaType,
oas3Selectors.activeExamplesMember(
path,
method,
"requestBody",
"requestBody"
),
fn
);
userHasEditedBody =
!!userEditedRequestBody &&
userEditedRequestBody !== currentMediaTypeDefaultBodyValue;
}
return userHasEditedBody;
});
const requestBodyInclusionSetting = oas3_selectors_onlyOAS3((state, path, method) => {
return state.getIn(["requestData", path, method, "bodyInclusion"]) || (0,external_immutable_namespaceObject.Map)();
});
const requestBodyErrors = oas3_selectors_onlyOAS3((state, path, method) => {
return state.getIn(["requestData", path, method, "errors"]) || null;
});
const activeExamplesMember = oas3_selectors_onlyOAS3(
(state, path, method, type, name) => {
return (
state.getIn(["examples", path, method, type, name, "activeExample"]) ||
null);
}
);
const requestContentType = oas3_selectors_onlyOAS3((state, path, method) => {
return (
state.getIn(["requestData", path, method, "requestContentType"]) || null);
});
const responseContentType = oas3_selectors_onlyOAS3((state, path, method) => {
return (
state.getIn(["requestData", path, method, "responseContentType"]) || null);
});
const serverVariableValue = oas3_selectors_onlyOAS3((state, locationData, key) => {
let path;
// locationData may take one of two forms, for backwards compatibility
// Object: ({server, namespace?}) or String:(server)
if (typeof locationData !== "string") {
const { server, namespace } = locationData;
if (namespace) {
path = [namespace, "serverVariableValues", server, key];
} else {
path = ["serverVariableValues", server, key];
}
} else {
const server = locationData;
path = ["serverVariableValues", server, key];
}
return state.getIn(path) || null;
});
const serverVariables = oas3_selectors_onlyOAS3((state, locationData) => {
let path;
// locationData may take one of two forms, for backwards compatibility
// Object: ({server, namespace?}) or String:(server)
if (typeof locationData !== "string") {
const { server, namespace } = locationData;
if (namespace) {
path = [namespace, "serverVariableValues", server];
} else {
path = ["serverVariableValues", server];
}
} else {
const server = locationData;
path = ["serverVariableValues", server];
}
return state.getIn(path) || (0,external_immutable_namespaceObject.OrderedMap)();
});
const serverEffectiveValue = oas3_selectors_onlyOAS3((state, locationData) => {
var varValues, serverValue;
// locationData may take one of two forms, for backwards compatibility
// Object: ({server, namespace?}) or String:(server)
if (typeof locationData !== "string") {
const { server, namespace } = locationData;
serverValue = server;
if (namespace) {
varValues = state.getIn([namespace, "serverVariableValues", serverValue]);
} else {
varValues = state.getIn(["serverVariableValues", serverValue]);
}
} else {
serverValue = locationData;
varValues = state.getIn(["serverVariableValues", serverValue]);
}
varValues = varValues || (0,external_immutable_namespaceObject.OrderedMap)();
let str = serverValue;
varValues.map((val, key) => {
str = str.replace(new RegExp(`{${key}}`, "g"), val);
});
return str;
});
const selectors_validateBeforeExecute = validateRequestBodyIsRequired(
(state, pathMethod) => validateRequestBodyValueExists(state, pathMethod)
);
const validateShallowRequired = (
state, _ref) =>
{let { oas3RequiredRequestBodyContentType, oas3RequestContentType, oas3RequestBodyValue } = _ref;
let missingRequiredKeys = [];
// context: json => String; urlencoded, form-data => Map
if (!external_immutable_namespaceObject.Map.isMap(oas3RequestBodyValue)) {
return missingRequiredKeys;
}
let requiredKeys = [];
// Cycle through list of possible contentTypes for matching contentType and defined requiredKeys
Object.keys(oas3RequiredRequestBodyContentType.requestContentType).forEach(
(contentType) => {
if (contentType === oas3RequestContentType) {
let contentTypeVal =
oas3RequiredRequestBodyContentType.requestContentType[contentType];
contentTypeVal.forEach((requiredKey) => {
if (requiredKeys.indexOf(requiredKey) < 0) {
requiredKeys.push(requiredKey);
}
});
}
}
);
requiredKeys.forEach((key) => {
let requiredKeyValue = oas3RequestBodyValue.getIn([key, "value"]);
if (!requiredKeyValue) {
missingRequiredKeys.push(key);
}
});
return missingRequiredKeys;
};
const selectors_validOperationMethods = (0,external_reselect_namespaceObject.createSelector)(() => [
"get",
"put",
"post",
"delete",
"options",
"head",
"patch",
"trace"]
);
;// CONCATENATED MODULE: ./src/core/plugins/oas3/reducers.js
/* harmony default export */ const oas3_reducers = ({
[UPDATE_SELECTED_SERVER]: (state, _ref) => {let { payload: { selectedServerUrl, namespace } } = _ref;
const path = namespace ? [namespace, "selectedServer"] : ["selectedServer"];
return state.setIn(path, selectedServerUrl);
},
[UPDATE_REQUEST_BODY_VALUE]: (state, _ref2) => {let { payload: { value, pathMethod } } = _ref2;
let [path, method] = pathMethod;
if (!external_immutable_namespaceObject.Map.isMap(value)) {
// context: application/json is always a String (instead of Map)
return state.setIn(["requestData", path, method, "bodyValue"], value);
}
let currentVal = state.getIn(["requestData", path, method, "bodyValue"]) || (0,external_immutable_namespaceObject.Map)();
if (!external_immutable_namespaceObject.Map.isMap(currentVal)) {
// context: user switch from application/json to application/x-www-form-urlencoded
currentVal = (0,external_immutable_namespaceObject.Map)();
}
let newVal;
const [...valueKeys] = value.keys();
valueKeys.forEach((valueKey) => {
let valueKeyVal = value.getIn([valueKey]);
if (!currentVal.has(valueKey)) {
newVal = currentVal.setIn([valueKey, "value"], valueKeyVal);
} else if (!external_immutable_namespaceObject.Map.isMap(valueKeyVal)) {
// context: user input will be received as String
newVal = currentVal.setIn([valueKey, "value"], valueKeyVal);
}
});
return state.setIn(["requestData", path, method, "bodyValue"], newVal);
},
[UPDATE_REQUEST_BODY_VALUE_RETAIN_FLAG]: (state, _ref3) => {let { payload: { value, pathMethod } } = _ref3;
let [path, method] = pathMethod;
return state.setIn(["requestData", path, method, "retainBodyValue"], value);
},
[UPDATE_REQUEST_BODY_INCLUSION]: (state, _ref4) => {let { payload: { value, pathMethod, name } } = _ref4;
let [path, method] = pathMethod;
return state.setIn(["requestData", path, method, "bodyInclusion", name], value);
},
[UPDATE_ACTIVE_EXAMPLES_MEMBER]: (state, _ref5) => {let { payload: { name, pathMethod, contextType, contextName } } = _ref5;
let [path, method] = pathMethod;
return state.setIn(["examples", path, method, contextType, contextName, "activeExample"], name);
},
[UPDATE_REQUEST_CONTENT_TYPE]: (state, _ref6) => {let { payload: { value, pathMethod } } = _ref6;
let [path, method] = pathMethod;
return state.setIn(["requestData", path, method, "requestContentType"], value);
},
[UPDATE_RESPONSE_CONTENT_TYPE]: (state, _ref7) => {let { payload: { value, path, method } } = _ref7;
return state.setIn(["requestData", path, method, "responseContentType"], value);
},
[UPDATE_SERVER_VARIABLE_VALUE]: (state, _ref8) => {let { payload: { server, namespace, key, val } } = _ref8;
const path = namespace ? [namespace, "serverVariableValues", server, key] : ["serverVariableValues", server, key];
return state.setIn(path, val);
},
[SET_REQUEST_BODY_VALIDATE_ERROR]: (state, _ref9) => {let { payload: { path, method, validationErrors } } = _ref9;
let errors = [];
errors.push("Required field is not provided");
if (validationErrors.missingBodyValue) {
// context: is application/json or application/xml, where typeof (missing) bodyValue = String
return state.setIn(["requestData", path, method, "errors"], (0,external_immutable_namespaceObject.fromJS)(errors));
}
if (validationErrors.missingRequiredKeys && validationErrors.missingRequiredKeys.length > 0) {
// context: is application/x-www-form-urlencoded, with list of missing keys
const { missingRequiredKeys } = validationErrors;
return state.updateIn(["requestData", path, method, "bodyValue"], (0,external_immutable_namespaceObject.fromJS)({}), (missingKeyValues) => {
return missingRequiredKeys.reduce((bodyValue, currentMissingKey) => {
return bodyValue.setIn([currentMissingKey, "errors"], (0,external_immutable_namespaceObject.fromJS)(errors));
}, missingKeyValues);
});
}
console.warn("unexpected result: SET_REQUEST_BODY_VALIDATE_ERROR");
return state;
},
[CLEAR_REQUEST_BODY_VALIDATE_ERROR]: (state, _ref10) => {let { payload: { path, method } } = _ref10;
const requestBodyValue = state.getIn(["requestData", path, method, "bodyValue"]);
if (!external_immutable_namespaceObject.Map.isMap(requestBodyValue)) {
return state.setIn(["requestData", path, method, "errors"], (0,external_immutable_namespaceObject.fromJS)([]));
}
const [...valueKeys] = requestBodyValue.keys();
if (!valueKeys) {
return state;
}
return state.updateIn(["requestData", path, method, "bodyValue"], (0,external_immutable_namespaceObject.fromJS)({}), (bodyValues) => {
return valueKeys.reduce((bodyValue, curr) => {
return bodyValue.setIn([curr, "errors"], (0,external_immutable_namespaceObject.fromJS)([]));
}, bodyValues);
});
},
[CLEAR_REQUEST_BODY_VALUE]: (state, _ref11) => {let { payload: { pathMethod } } = _ref11;
let [path, method] = pathMethod;
const requestBodyValue = state.getIn(["requestData", path, method, "bodyValue"]);
if (!requestBodyValue) {
return state;
}
if (!external_immutable_namespaceObject.Map.isMap(requestBodyValue)) {
return state.setIn(["requestData", path, method, "bodyValue"], "");
}
return state.setIn(["requestData", path, method, "bodyValue"], (0,external_immutable_namespaceObject.Map)());
}
});
;// CONCATENATED MODULE: ./src/core/plugins/oas3/index.js
/**
* @prettier
*/
/* harmony default export */ function oas3() {
return {
components: components,
wrapComponents: wrap_components,
statePlugins: {
spec: {
wrapSelectors: wrap_selectors_namespaceObject,
selectors: spec_extensions_selectors_namespaceObject
},
auth: {
wrapSelectors: auth_extensions_wrap_selectors_namespaceObject
},
oas3: {
actions: oas3_actions_namespaceObject,
reducers: oas3_reducers,
selectors: oas3_selectors_namespaceObject
}
}
};
}
;// CONCATENATED MODULE: ./src/core/plugins/oas31/components/webhooks.jsx
/**
* @prettier
*/
const Webhooks = (_ref) => {let { specSelectors, getComponent } = _ref;
const operationDTOs = specSelectors.selectWebhooksOperations();
const pathItemNames = Object.keys(operationDTOs);
const OperationContainer = getComponent("OperationContainer", true);
if (pathItemNames.length === 0) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "webhooks" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h2", null, "Webhooks"),
pathItemNames.map((pathItemName) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { key: `${pathItemName}-webhook` },
operationDTOs[pathItemName].map((operationDTO) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement(OperationContainer, {
key: `${pathItemName}-${operationDTO.method}-webhook`,
op: operationDTO.operation,
tag: "webhooks",
method: operationDTO.method,
path: pathItemName,
specPath: operationDTO.specPath,
allowTryItOut: false }
)
)
)
)
));
};
/* harmony default export */ const webhooks = (Webhooks);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/components/license.jsx
/**
* @prettier
*/
const license_License = (_ref) => {let { getComponent, specSelectors } = _ref;
const name = specSelectors.selectLicenseNameField();
const url = specSelectors.selectLicenseUrl();
const Link = getComponent("Link");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "info__license" },
url ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "info__license__url" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: sanitizeUrl(url) },
name
)
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, name)
));
};
/* harmony default export */ const components_license = (license_License);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/components/contact.jsx
/**
* @prettier
*/
const contact_Contact = (_ref) => {let { getComponent, specSelectors } = _ref;
const name = specSelectors.selectContactNameField();
const url = specSelectors.selectContactUrl();
const email = specSelectors.selectContactEmailField();
const Link = getComponent("Link");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "info__contact" },
url && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { href: sanitizeUrl(url), target: "_blank" },
name, " - Website"
)
),
email && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { href: sanitizeUrl(`mailto:${email}`) },
url ? `Send email to ${name}` : `Contact ${name}`
)
));
};
/* harmony default export */ const components_contact = (contact_Contact);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/components/info.jsx
/**
* @prettier
*/
const info_Info = (_ref) => {let { getComponent, specSelectors } = _ref;
const version = specSelectors.version();
const url = specSelectors.url();
const basePath = specSelectors.basePath();
const host = specSelectors.host();
const summary = specSelectors.selectInfoSummaryField();
const description = specSelectors.selectInfoDescriptionField();
const title = specSelectors.selectInfoTitleField();
const termsOfServiceUrl = specSelectors.selectInfoTermsOfServiceUrl();
const externalDocsUrl = specSelectors.selectExternalDocsUrl();
const externalDocsDesc = specSelectors.selectExternalDocsDescriptionField();
const contact = specSelectors.contact();
const license = specSelectors.license();
const Markdown = getComponent("Markdown", true);
const Link = getComponent("Link");
const VersionStamp = getComponent("VersionStamp");
const OpenAPIVersion = getComponent("OpenAPIVersion");
const InfoUrl = getComponent("InfoUrl");
const InfoBasePath = getComponent("InfoBasePath");
const License = getComponent("License", true);
const Contact = getComponent("Contact", true);
const JsonSchemaDialect = getComponent("JsonSchemaDialect", true);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "info" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("hgroup", { className: "main" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h2", { className: "title" },
title,
version && /*#__PURE__*/external_react_namespaceObject["default"].createElement(VersionStamp, { version: version }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(OpenAPIVersion, { oasVersion: "3.1" })
),
(host || basePath) && /*#__PURE__*/external_react_namespaceObject["default"].createElement(InfoBasePath, { host: host, basePath: basePath }),
url && /*#__PURE__*/external_react_namespaceObject["default"].createElement(InfoUrl, { getComponent: getComponent, url: url })
),
summary && /*#__PURE__*/external_react_namespaceObject["default"].createElement("p", { className: "info__summary" }, summary), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "info__description description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Markdown, { source: description })
),
termsOfServiceUrl && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "info__tos" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: sanitizeUrl(termsOfServiceUrl) }, "Terms of service"
)
),
contact.size > 0 && /*#__PURE__*/external_react_namespaceObject["default"].createElement(Contact, null),
license.size > 0 && /*#__PURE__*/external_react_namespaceObject["default"].createElement(License, null),
externalDocsUrl && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, {
className: "info__extdocs",
target: "_blank",
href: sanitizeUrl(externalDocsUrl) },
externalDocsDesc || externalDocsUrl
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JsonSchemaDialect, null)
));
};
/* harmony default export */ const oas31_components_info = (info_Info);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/components/json-schema-dialect.jsx
/**
* @prettier
*/
const JsonSchemaDialect = (_ref) => {let { getComponent, specSelectors } = _ref;
const jsonSchemaDialect = specSelectors.selectJsonSchemaDialectField();
const jsonSchemaDialectDefault = specSelectors.selectJsonSchemaDialectDefault(); // prettier-ignore
const Link = getComponent("Link");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
jsonSchemaDialect && jsonSchemaDialect === jsonSchemaDialectDefault && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", { className: "info__jsonschemadialect" }, "JSON Schema dialect:",
" ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: sanitizeUrl(jsonSchemaDialect) },
jsonSchemaDialect
)
),
jsonSchemaDialect && jsonSchemaDialect !== jsonSchemaDialectDefault && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "error-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "no-margin" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "errors" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "errors-wrapper" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", { className: "center" }, "Warning"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", { className: "message" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("strong", null, "OpenAPI.jsonSchemaDialect"), " field contains a value different from the default value of",
" ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, { target: "_blank", href: jsonSchemaDialectDefault },
jsonSchemaDialectDefault
), ". Values different from the default one are currently not supported. Please either omit the field or provide it with the default value."
)
)
)
)
)
));
};
/* harmony default export */ const json_schema_dialect = (JsonSchemaDialect);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/components/version-pragma-filter.jsx
const version_pragma_filter_VersionPragmaFilter = (_ref) =>
{let { bypass, isSwagger2, isOAS3, isOAS31, alsoShow, children } = _ref;
if (bypass) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, children);
}
if (isSwagger2 && (isOAS3 || isOAS31)) {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "version-pragma" },
alsoShow, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "version-pragma__message version-pragma__message--ambiguous" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h3", null, "Unable to render this definition"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, "swagger"), " and ", /*#__PURE__*/external_react_namespaceObject["default"].createElement("code", null, "openapi"), " fields cannot be present in the same Swagger or OpenAPI definition. Please remove one of the fields."
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "Supported version fields are ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, "swagger: \"2.0\""), " and those that match ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, "openapi: 3.x.y"), " (for example,", " ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, "openapi: 3.1.0"), ")."
)
)
)
));
}
if (!isSwagger2 && !isOAS3 && !isOAS31) {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "version-pragma" },
alsoShow, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "version-pragma__message version-pragma__message--missing" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h3", null, "Unable to render this definition"), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "The provided definition does not specify a valid version field."
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("p", null, "Please indicate a valid Swagger or OpenAPI version field. Supported version fields are ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, "swagger: \"2.0\""), " and those that match ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, "openapi: 3.x.y"), " (for example,", " ", /*#__PURE__*/
external_react_namespaceObject["default"].createElement("code", null, "openapi: 3.1.0"), ")."
)
)
)
));
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement("div", null, children);
};
/* harmony default export */ const version_pragma_filter = (version_pragma_filter_VersionPragmaFilter);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/components/model/model.jsx
/**
* @prettier
*/
const model_decodeRefName = (uri) => {
const unescaped = uri.replace(/~1/g, "/").replace(/~0/g, "~");
try {
return decodeURIComponent(unescaped);
} catch {
return unescaped;
}
};
const getModelName = (uri) => {
if (typeof uri === "string" && uri.includes("#/components/schemas/")) {
return model_decodeRefName(uri.replace(/^.*#\/components\/schemas\//, ""));
}
return null;
};
const model_Model = /*#__PURE__*/(0,external_react_namespaceObject.forwardRef)((_ref, ref) => {let { schema, getComponent, onToggle } = _ref;
const JSONSchema202012 = getComponent("JSONSchema202012");
const name = getModelName(schema.get("$$ref"));
const handleExpand = (0,external_react_namespaceObject.useCallback)(
(e, expanded) => {
onToggle(name, expanded);
},
[name, onToggle]
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchema202012, {
name: name,
schema: schema.toJS(),
ref: ref,
onExpand: handleExpand }
));
});
model_Model.defaultProps = {
name: "",
displayName: "",
isRef: false,
required: false,
expandDepth: 0,
depth: 1,
includeReadOnly: false,
includeWriteOnly: false,
onToggle: () => {}
};
/* harmony default export */ const model_model = (model_Model);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/components/models/models.jsx
/**
* @prettier
*/
const models_Models = (_ref) =>
{let { specActions, specSelectors, layoutSelectors, layoutActions, getComponent, getConfigs } = _ref;
const schemas = specSelectors.selectSchemas();
const hasSchemas = Object.keys(schemas).length > 0;
const schemasPath = ["components", "schemas"];
const { docExpansion, defaultModelsExpandDepth } = getConfigs();
const isOpenDefault = defaultModelsExpandDepth > 0 && docExpansion !== "none";
const isOpen = layoutSelectors.isShown(schemasPath, isOpenDefault);
const Collapse = getComponent("Collapse");
const JSONSchema202012 = getComponent("JSONSchema202012");
const ArrowUpIcon = getComponent("ArrowUpIcon");
const ArrowDownIcon = getComponent("ArrowDownIcon");
/**
* Effects.
*/
(0,external_react_namespaceObject.useEffect)(() => {
const isOpenAndExpanded = isOpen && defaultModelsExpandDepth > 1;
const isResolved = specSelectors.specResolvedSubtree(schemasPath) != null;
if (isOpenAndExpanded && !isResolved) {
specActions.requestResolvedSubtree(schemasPath);
}
}, [isOpen, defaultModelsExpandDepth]);
/**
* Event handlers.
*/
const handleModelsExpand = (0,external_react_namespaceObject.useCallback)(() => {
layoutActions.show(schemasPath, !isOpen);
}, [isOpen]);
const handleModelsRef = (0,external_react_namespaceObject.useCallback)((node) => {
if (node !== null) {
layoutActions.readyToScroll(schemasPath, node);
}
}, []);
const handleJSONSchema202012Ref = (schemaName) => (node) => {
if (node !== null) {
layoutActions.readyToScroll([...schemasPath, schemaName], node);
}
};
const handleJSONSchema202012Expand = (schemaName) => (e, expanded) => {
if (expanded) {
const schemaPath = [...schemasPath, schemaName];
const isResolved = specSelectors.specResolvedSubtree(schemaPath) != null;
if (!isResolved) {
specActions.requestResolvedSubtree([...schemasPath, schemaName]);
}
}
};
/**
* Rendering.
*/
if (!hasSchemas || defaultModelsExpandDepth < 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("section", {
className: (0,external_classnames_namespaceObject["default"])("models", { "is-open": isOpen }),
ref: handleModelsRef }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("h4", null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("button", {
"aria-expanded": isOpen,
className: "models-control",
onClick: handleModelsExpand }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", null, "Schemas"),
isOpen ? /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowUpIcon, null) : /*#__PURE__*/external_react_namespaceObject["default"].createElement(ArrowDownIcon, null)
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Collapse, { isOpened: isOpen },
Object.entries(schemas).map((_ref2) => {let [schemaName, schema] = _ref2;return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchema202012, {
key: schemaName,
ref: handleJSONSchema202012Ref(schemaName),
schema: schema,
name: schemaName,
onExpand: handleJSONSchema202012Expand(schemaName) }
));}
)
)
));
};
/* harmony default export */ const models = (models_Models);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/fn.js
/**
* @prettier
*/
const isOAS31 = (jsSpec) => {
const oasVersion = jsSpec.get("openapi");
return (
typeof oasVersion === "string" && /^3\.1\.(?:[1-9]\d*|0)$/.test(oasVersion));
};
/**
* Creates selector that returns value of the passed
* selector when spec is OpenAPI 3.1.0., null otherwise.
*
* @param selector
* @returns {function(*, ...[*]): function(*): (*|null)}
*/
const fn_createOnlyOAS31Selector =
(selector) =>
function (state) {for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {args[_key - 1] = arguments[_key];}return (
(system) => {
if (system.getSystem().specSelectors.isOAS31()) {
const selectedValue = selector(state, ...args);
return typeof selectedValue === "function" ?
selectedValue(system) :
selectedValue;
} else {
return null;
}
});};
/**
* Creates selector wrapper that returns value of the passed
* selector when spec is OpenAPI 3.1.0., calls original selector otherwise.
*
*
* @param selector
* @returns {function(*, *): function(*, ...[*]): (*)}
*/
const createOnlyOAS31SelectorWrapper =
(selector) =>
(oriSelector, system) =>
function (state) {for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {args[_key2 - 1] = arguments[_key2];}
if (system.getSystem().specSelectors.isOAS31()) {
const selectedValue = selector(state, ...args);
return typeof selectedValue === "function" ?
selectedValue(oriSelector, system) :
selectedValue;
} else {
return oriSelector(...args);
}
};
/**
* Creates selector that provides system as the
* second argument. This allows to create memoized
* composed selectors from different plugins.
*
* @param selector
* @returns {function(*, ...[*]): function(*): *}
*/
const fn_createSystemSelector =
(selector) =>
function (state) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}return (
(system) => {
const selectedValue = selector(state, system, ...args);
return typeof selectedValue === "function" ?
selectedValue(system) :
selectedValue;
});};
/* eslint-disable react/jsx-filename-extension */
/**
* Creates component wrapper that only wraps the component
* when spec is OpenAPI 3.1.0. Otherwise, returns original
* component with passed props.
*
* @param Component
* @returns {function(*, *): function(*): *}
*/
const createOnlyOAS31ComponentWrapper =
(Component) => (Original, system) => (props) => {
if (system.specSelectors.isOAS31()) {
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(Component, (0,extends_namespaceObject["default"])({},
props, {
originalComponent: Original,
getSystem: system.getSystem })
));
}
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(Original, props);
};
/* eslint-enable react/jsx-filename-extension */
/**
* Runs the fn replacement implementation when spec is OpenAPI 3.1.
* Runs the fn original implementation otherwise.
*
* @param fn
* @param system
* @returns {{[p: string]: function(...[*]): *}}
*/
const wrapOAS31Fn = (fn, system) => {
const { fn: systemFn, specSelectors } = system;
return Object.fromEntries(
Object.entries(fn).map((_ref) => {let [name, newImpl] = _ref;
const oriImpl = systemFn[name];
const impl = function () {return (
specSelectors.isOAS31() ?
newImpl(...arguments) :
typeof oriImpl === "function" ?
oriImpl(...arguments) :
undefined);};
return [name, impl];
})
);
};
;// CONCATENATED MODULE: ./src/core/plugins/oas31/wrap-components/license.jsx
/**
* @prettier
*/
const LicenseWrapper = createOnlyOAS31ComponentWrapper((_ref) => {let { getSystem } = _ref;
const system = getSystem();
const OAS31License = system.getComponent("OAS31License", true);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(OAS31License, null);
});
/* harmony default export */ const wrap_components_license = (LicenseWrapper);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/wrap-components/contact.jsx
/**
* @prettier
*/
const ContactWrapper = createOnlyOAS31ComponentWrapper((_ref) => {let { getSystem } = _ref;
const system = getSystem();
const OAS31Contact = system.getComponent("OAS31Contact", true);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(OAS31Contact, null);
});
/* harmony default export */ const wrap_components_contact = (ContactWrapper);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/wrap-components/info.jsx
/**
* @prettier
*/
const InfoWrapper = createOnlyOAS31ComponentWrapper((_ref) => {let { getSystem } = _ref;
const system = getSystem();
const OAS31Info = system.getComponent("OAS31Info", true);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(OAS31Info, null);
});
/* harmony default export */ const wrap_components_info = (InfoWrapper);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/fn.js
/**
* @prettier
*/
const makeIsExpandable = (original, getSystem) => {
const { fn } = getSystem();
if (typeof original !== "function") {
return null;
}
const { hasKeyword } = fn.jsonSchema202012;
return (schema) =>
original(schema) ||
hasKeyword(schema, "example") || (
schema === null || schema === void 0 ? void 0 : schema.xml) || (
schema === null || schema === void 0 ? void 0 : schema.discriminator) || (
schema === null || schema === void 0 ? void 0 : schema.externalDocs);
};
const getProperties = (
schema, _ref) =>
{let { includeReadOnly, includeWriteOnly } = _ref;
// shortcut
if (!(schema !== null && schema !== void 0 && schema.properties)) return {};
const properties = Object.entries(schema.properties);
const filteredProperties = properties.filter((_ref2) => {let [, value] = _ref2;
const isReadOnly = (value === null || value === void 0 ? void 0 : value.readOnly) === true;
const isWriteOnly = (value === null || value === void 0 ? void 0 : value.writeOnly) === true;
return (
(!isReadOnly || includeReadOnly) && (!isWriteOnly || includeWriteOnly));
});
return Object.fromEntries(filteredProperties);
};
;// CONCATENATED MODULE: ./src/core/plugins/oas31/wrap-components/model.jsx
const model_excluded = ["getSystem"]; /**
* @prettier
*/
const model_ModelWrapper = createOnlyOAS31ComponentWrapper(
(_ref) => {let { getSystem } = _ref,props = (0,objectWithoutProperties_namespaceObject["default"])(_ref, model_excluded);
const system = getSystem();
const { getComponent, fn, getConfigs } = system;
const configs = getConfigs();
const Model = getComponent("OAS31Model");
const JSONSchema = getComponent("JSONSchema202012");
const Keyword$schema = getComponent("JSONSchema202012Keyword$schema");
const Keyword$vocabulary = getComponent(
"JSONSchema202012Keyword$vocabulary"
);
const Keyword$id = getComponent("JSONSchema202012Keyword$id");
const Keyword$anchor = getComponent("JSONSchema202012Keyword$anchor");
const Keyword$dynamicAnchor = getComponent(
"JSONSchema202012Keyword$dynamicAnchor"
);
const Keyword$ref = getComponent("JSONSchema202012Keyword$ref");
const Keyword$dynamicRef = getComponent(
"JSONSchema202012Keyword$dynamicRef"
);
const Keyword$defs = getComponent("JSONSchema202012Keyword$defs");
const Keyword$comment = getComponent("JSONSchema202012Keyword$comment");
const KeywordAllOf = getComponent("JSONSchema202012KeywordAllOf");
const KeywordAnyOf = getComponent("JSONSchema202012KeywordAnyOf");
const KeywordOneOf = getComponent("JSONSchema202012KeywordOneOf");
const KeywordNot = getComponent("JSONSchema202012KeywordNot");
const KeywordIf = getComponent("JSONSchema202012KeywordIf");
const KeywordThen = getComponent("JSONSchema202012KeywordThen");
const KeywordElse = getComponent("JSONSchema202012KeywordElse");
const KeywordDependentSchemas = getComponent(
"JSONSchema202012KeywordDependentSchemas"
);
const KeywordPrefixItems = getComponent(
"JSONSchema202012KeywordPrefixItems"
);
const KeywordItems = getComponent("JSONSchema202012KeywordItems");
const KeywordContains = getComponent("JSONSchema202012KeywordContains");
const KeywordProperties = getComponent("JSONSchema202012KeywordProperties");
const KeywordPatternProperties = getComponent(
"JSONSchema202012KeywordPatternProperties"
);
const KeywordAdditionalProperties = getComponent(
"JSONSchema202012KeywordAdditionalProperties"
);
const KeywordPropertyNames = getComponent(
"JSONSchema202012KeywordPropertyNames"
);
const KeywordUnevaluatedItems = getComponent(
"JSONSchema202012KeywordUnevaluatedItems"
);
const KeywordUnevaluatedProperties = getComponent(
"JSONSchema202012KeywordUnevaluatedProperties"
);
const KeywordType = getComponent("JSONSchema202012KeywordType");
const KeywordEnum = getComponent("JSONSchema202012KeywordEnum");
const KeywordConst = getComponent("JSONSchema202012KeywordConst");
const KeywordConstraint = getComponent("JSONSchema202012KeywordConstraint");
const KeywordDependentRequired = getComponent(
"JSONSchema202012KeywordDependentRequired"
);
const KeywordContentSchema = getComponent(
"JSONSchema202012KeywordContentSchema"
);
const KeywordTitle = getComponent("JSONSchema202012KeywordTitle");
const KeywordDescription = getComponent(
"JSONSchema202012KeywordDescription"
);
const KeywordDefault = getComponent("JSONSchema202012KeywordDefault");
const KeywordDeprecated = getComponent("JSONSchema202012KeywordDeprecated");
const KeywordReadOnly = getComponent("JSONSchema202012KeywordReadOnly");
const KeywordWriteOnly = getComponent("JSONSchema202012KeywordWriteOnly");
const Accordion = getComponent("JSONSchema202012Accordion");
const ExpandDeepButton = getComponent("JSONSchema202012ExpandDeepButton");
const ChevronRightIcon = getComponent("JSONSchema202012ChevronRightIcon");
const withSchemaContext = getComponent("withJSONSchema202012Context");
const ModelWithJSONSchemaContext = withSchemaContext(Model, {
config: {
default$schema: "https://spec.openapis.org/oas/3.1/dialect/base",
defaultExpandedLevels: configs.defaultModelExpandDepth,
includeReadOnly: Boolean(props.includeReadOnly),
includeWriteOnly: Boolean(props.includeWriteOnly)
},
components: {
JSONSchema,
Keyword$schema,
Keyword$vocabulary,
Keyword$id,
Keyword$anchor,
Keyword$dynamicAnchor,
Keyword$ref,
Keyword$dynamicRef,
Keyword$defs,
Keyword$comment,
KeywordAllOf,
KeywordAnyOf,
KeywordOneOf,
KeywordNot,
KeywordIf,
KeywordThen,
KeywordElse,
KeywordDependentSchemas,
KeywordPrefixItems,
KeywordItems,
KeywordContains,
KeywordProperties,
KeywordPatternProperties,
KeywordAdditionalProperties,
KeywordPropertyNames,
KeywordUnevaluatedItems,
KeywordUnevaluatedProperties,
KeywordType,
KeywordEnum,
KeywordConst,
KeywordConstraint,
KeywordDependentRequired,
KeywordContentSchema,
KeywordTitle,
KeywordDescription,
KeywordDefault,
KeywordDeprecated,
KeywordReadOnly,
KeywordWriteOnly,
Accordion,
ExpandDeepButton,
ChevronRightIcon
},
fn: {
upperFirst: fn.upperFirst,
isExpandable: makeIsExpandable(
fn.jsonSchema202012.isExpandable,
getSystem
),
getProperties: getProperties
}
});
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ModelWithJSONSchemaContext, props);
}
);
/* harmony default export */ const wrap_components_model = (model_ModelWrapper);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/wrap-components/models.jsx
/**
* @prettier
*/
const ModelsWrapper = createOnlyOAS31ComponentWrapper((_ref) => {let { getSystem } = _ref;
const { getComponent, fn, getConfigs } = getSystem();
const configs = getConfigs();
if (ModelsWrapper.ModelsWithJSONSchemaContext) {
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ModelsWrapper.ModelsWithJSONSchemaContext, null);
}
const Models = getComponent("OAS31Models", true);
const JSONSchema = getComponent("JSONSchema202012");
const Keyword$schema = getComponent("JSONSchema202012Keyword$schema");
const Keyword$vocabulary = getComponent("JSONSchema202012Keyword$vocabulary");
const Keyword$id = getComponent("JSONSchema202012Keyword$id");
const Keyword$anchor = getComponent("JSONSchema202012Keyword$anchor");
const Keyword$dynamicAnchor = getComponent(
"JSONSchema202012Keyword$dynamicAnchor"
);
const Keyword$ref = getComponent("JSONSchema202012Keyword$ref");
const Keyword$dynamicRef = getComponent("JSONSchema202012Keyword$dynamicRef");
const Keyword$defs = getComponent("JSONSchema202012Keyword$defs");
const Keyword$comment = getComponent("JSONSchema202012Keyword$comment");
const KeywordAllOf = getComponent("JSONSchema202012KeywordAllOf");
const KeywordAnyOf = getComponent("JSONSchema202012KeywordAnyOf");
const KeywordOneOf = getComponent("JSONSchema202012KeywordOneOf");
const KeywordNot = getComponent("JSONSchema202012KeywordNot");
const KeywordIf = getComponent("JSONSchema202012KeywordIf");
const KeywordThen = getComponent("JSONSchema202012KeywordThen");
const KeywordElse = getComponent("JSONSchema202012KeywordElse");
const KeywordDependentSchemas = getComponent(
"JSONSchema202012KeywordDependentSchemas"
);
const KeywordPrefixItems = getComponent("JSONSchema202012KeywordPrefixItems");
const KeywordItems = getComponent("JSONSchema202012KeywordItems");
const KeywordContains = getComponent("JSONSchema202012KeywordContains");
const KeywordProperties = getComponent("JSONSchema202012KeywordProperties");
const KeywordPatternProperties = getComponent(
"JSONSchema202012KeywordPatternProperties"
);
const KeywordAdditionalProperties = getComponent(
"JSONSchema202012KeywordAdditionalProperties"
);
const KeywordPropertyNames = getComponent(
"JSONSchema202012KeywordPropertyNames"
);
const KeywordUnevaluatedItems = getComponent(
"JSONSchema202012KeywordUnevaluatedItems"
);
const KeywordUnevaluatedProperties = getComponent(
"JSONSchema202012KeywordUnevaluatedProperties"
);
const KeywordType = getComponent("JSONSchema202012KeywordType");
const KeywordEnum = getComponent("JSONSchema202012KeywordEnum");
const KeywordConst = getComponent("JSONSchema202012KeywordConst");
const KeywordConstraint = getComponent("JSONSchema202012KeywordConstraint");
const KeywordDependentRequired = getComponent(
"JSONSchema202012KeywordDependentRequired"
);
const KeywordContentSchema = getComponent(
"JSONSchema202012KeywordContentSchema"
);
const KeywordTitle = getComponent("JSONSchema202012KeywordTitle");
const KeywordDescription = getComponent("JSONSchema202012KeywordDescription");
const KeywordDefault = getComponent("JSONSchema202012KeywordDefault");
const KeywordDeprecated = getComponent("JSONSchema202012KeywordDeprecated");
const KeywordReadOnly = getComponent("JSONSchema202012KeywordReadOnly");
const KeywordWriteOnly = getComponent("JSONSchema202012KeywordWriteOnly");
const Accordion = getComponent("JSONSchema202012Accordion");
const ExpandDeepButton = getComponent("JSONSchema202012ExpandDeepButton");
const ChevronRightIcon = getComponent("JSONSchema202012ChevronRightIcon");
const withSchemaContext = getComponent("withJSONSchema202012Context");
// we cache the HOC as recreating it with every re-render is quite expensive
ModelsWrapper.ModelsWithJSONSchemaContext = withSchemaContext(Models, {
config: {
default$schema: "https://spec.openapis.org/oas/3.1/dialect/base",
defaultExpandedLevels: configs.defaultModelsExpandDepth - 1,
includeReadOnly: true,
includeWriteOnly: true
},
components: {
JSONSchema,
Keyword$schema,
Keyword$vocabulary,
Keyword$id,
Keyword$anchor,
Keyword$dynamicAnchor,
Keyword$ref,
Keyword$dynamicRef,
Keyword$defs,
Keyword$comment,
KeywordAllOf,
KeywordAnyOf,
KeywordOneOf,
KeywordNot,
KeywordIf,
KeywordThen,
KeywordElse,
KeywordDependentSchemas,
KeywordPrefixItems,
KeywordItems,
KeywordContains,
KeywordProperties,
KeywordPatternProperties,
KeywordAdditionalProperties,
KeywordPropertyNames,
KeywordUnevaluatedItems,
KeywordUnevaluatedProperties,
KeywordType,
KeywordEnum,
KeywordConst,
KeywordConstraint,
KeywordDependentRequired,
KeywordContentSchema,
KeywordTitle,
KeywordDescription,
KeywordDefault,
KeywordDeprecated,
KeywordReadOnly,
KeywordWriteOnly,
Accordion,
ExpandDeepButton,
ChevronRightIcon
},
fn: {
upperFirst: fn.upperFirst,
isExpandable: fn.jsonSchema202012.isExpandable,
getProperties: fn.jsonSchema202012.getProperties
}
});
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(ModelsWrapper.ModelsWithJSONSchemaContext, null);
});
ModelsWrapper.ModelsWithJSONSchemaContext = null;
/* harmony default export */ const wrap_components_models = (ModelsWrapper);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/wrap-components/version-pragma-filter.jsx
/**
* @prettier
*/
const VersionPragmaFilterWrapper = (Original, system) => (props) => {
const isOAS31 = system.specSelectors.isOAS31();
const OAS31VersionPragmaFilter = system.getComponent(
"OAS31VersionPragmaFilter"
);
return /*#__PURE__*/external_react_namespaceObject["default"].createElement(OAS31VersionPragmaFilter, (0,extends_namespaceObject["default"])({ isOAS31: isOAS31 }, props));
};
/* harmony default export */ const wrap_components_version_pragma_filter = (VersionPragmaFilterWrapper);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/spec-extensions/selectors.js
/**
* @prettier
*/
const spec_extensions_selectors_map = (0,external_immutable_namespaceObject.Map)();
const selectors_isOAS31 = (0,external_reselect_namespaceObject.createSelector)(
(state, system) => system.specSelectors.specJson(),
isOAS31
);
const selectors_webhooks = () => (system) => {
return system.specSelectors.specJson().get("webhooks", spec_extensions_selectors_map);
};
/**
* `specResolvedSubtree` selector is needed as input selector,
* so that we regenerate the selected result whenever the lazy
* resolution happens.
*/
const selectWebhooksOperations = (0,external_reselect_namespaceObject.createSelector)(
(state, system) => system.specSelectors.webhooks(),
(state, system) => system.specSelectors.validOperationMethods(),
(state, system) => system.specSelectors.specResolvedSubtree(["webhooks"]),
(webhooks, validOperationMethods) => {
if (!external_immutable_namespaceObject.Map.isMap(webhooks)) return {};
return webhooks.
reduce((allOperations, pathItem, pathItemName) => {
if (!external_immutable_namespaceObject.Map.isMap(pathItem)) return allOperations;
const pathItemOperations = pathItem.
entrySeq().
filter((_ref) => {let [key] = _ref;return validOperationMethods.includes(key);}).
map((_ref2) => {let [method, operation] = _ref2;return {
operation: (0,external_immutable_namespaceObject.Map)({ operation }),
method,
path: pathItemName,
specPath: (0,external_immutable_namespaceObject.List)(["webhooks", pathItemName, method])
};});
return allOperations.concat(pathItemOperations);
}, (0,external_immutable_namespaceObject.List)()).
groupBy((operationDTO) => operationDTO.path).
map((operations) => operations.toArray()).
toObject();
}
);
const selectors_license = () => (system) => {
return system.specSelectors.info().get("license", spec_extensions_selectors_map);
};
const selectLicenseNameField = () => (system) => {
return system.specSelectors.license().get("name", "License");
};
const selectLicenseUrlField = () => (system) => {
return system.specSelectors.license().get("url");
};
const selectLicenseUrl = (0,external_reselect_namespaceObject.createSelector)(
(state, system) => system.specSelectors.url(),
(state, system) => system.oas3Selectors.selectedServer(),
(state, system) => system.specSelectors.selectLicenseUrlField(),
(specUrl, selectedServer, url) => {
if (url) {
return safeBuildUrl(url, specUrl, { selectedServer });
}
return undefined;
}
);
const selectLicenseIdentifierField = () => (system) => {
return system.specSelectors.license().get("identifier");
};
const selectors_contact = () => (system) => {
return system.specSelectors.info().get("contact", spec_extensions_selectors_map);
};
const selectContactNameField = () => (system) => {
return system.specSelectors.contact().get("name", "the developer");
};
const selectContactEmailField = () => (system) => {
return system.specSelectors.contact().get("email");
};
const selectContactUrlField = () => (system) => {
return system.specSelectors.contact().get("url");
};
const selectContactUrl = (0,external_reselect_namespaceObject.createSelector)(
(state, system) => system.specSelectors.url(),
(state, system) => system.oas3Selectors.selectedServer(),
(state, system) => system.specSelectors.selectContactUrlField(),
(specUrl, selectedServer, url) => {
if (url) {
return safeBuildUrl(url, specUrl, { selectedServer });
}
return undefined;
}
);
const selectInfoTitleField = () => (system) => {
return system.specSelectors.info().get("title");
};
const selectInfoSummaryField = () => (system) => {
return system.specSelectors.info().get("summary");
};
const selectInfoDescriptionField = () => (system) => {
return system.specSelectors.info().get("description");
};
const selectInfoTermsOfServiceField = () => (system) => {
return system.specSelectors.info().get("termsOfService");
};
const selectInfoTermsOfServiceUrl = (0,external_reselect_namespaceObject.createSelector)(
(state, system) => system.specSelectors.url(),
(state, system) => system.oas3Selectors.selectedServer(),
(state, system) => system.specSelectors.selectInfoTermsOfServiceField(),
(specUrl, selectedServer, termsOfService) => {
if (termsOfService) {
return safeBuildUrl(termsOfService, specUrl, { selectedServer });
}
return undefined;
}
);
const selectExternalDocsDescriptionField = () => (system) => {
return system.specSelectors.externalDocs().get("description");
};
const selectExternalDocsUrlField = () => (system) => {
return system.specSelectors.externalDocs().get("url");
};
const selectExternalDocsUrl = (0,external_reselect_namespaceObject.createSelector)(
(state, system) => system.specSelectors.url(),
(state, system) => system.oas3Selectors.selectedServer(),
(state, system) => system.specSelectors.selectExternalDocsUrlField(),
(specUrl, selectedServer, url) => {
if (url) {
return safeBuildUrl(url, specUrl, { selectedServer });
}
return undefined;
}
);
const selectJsonSchemaDialectField = () => (system) => {
return system.specSelectors.specJson().get("jsonSchemaDialect");
};
const selectJsonSchemaDialectDefault = () =>
"https://spec.openapis.org/oas/3.1/dialect/base";
const selectSchemas = (0,external_reselect_namespaceObject.createSelector)(
(state, system) => system.specSelectors.definitions(),
(state, system) =>
system.specSelectors.specResolvedSubtree(["components", "schemas"]),
(rawSchemas, resolvedSchemas) => {
if (!external_immutable_namespaceObject.Map.isMap(rawSchemas)) return {};
if (!external_immutable_namespaceObject.Map.isMap(resolvedSchemas)) return rawSchemas.toJS();
return Object.entries(rawSchemas.toJS()).reduce(
(acc, _ref3) => {let [schemaName, rawSchema] = _ref3;
const resolvedSchema = resolvedSchemas.get(schemaName);
acc[schemaName] = (resolvedSchema === null || resolvedSchema === void 0 ? void 0 : resolvedSchema.toJS()) || rawSchema;
return acc;
},
{}
);
}
);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/spec-extensions/wrap-selectors.js
/**
* @prettier
*/
const wrap_selectors_isOAS3 =
(oriSelector, system) =>
function (state) {
const isOAS31 = system.specSelectors.isOAS31();for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {args[_key - 1] = arguments[_key];}
return isOAS31 || oriSelector(...args);
};
const wrap_selectors_selectLicenseUrl = createOnlyOAS31SelectorWrapper(
() => (oriSelector, system) => {
return system.oas31Selectors.selectLicenseUrl();
}
);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/selectors.js
/**
* @prettier
*/
const selectors_selectLicenseUrl = (0,external_reselect_namespaceObject.createSelector)(
(state, system) => system.specSelectors.url(),
(state, system) => system.oas3Selectors.selectedServer(),
(state, system) => system.specSelectors.selectLicenseUrlField(),
(state, system) => system.specSelectors.selectLicenseIdentifierField(),
(specUrl, selectedServer, url, identifier) => {
if (url) {
return safeBuildUrl(url, specUrl, { selectedServer });
}
if (identifier) {
return `https://spdx.org/licenses/${identifier}.html`;
}
return undefined;
}
);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Example.jsx
/**
* @prettier
*/
const Example_Example = (_ref) => {let { schema, getSystem } = _ref;
const { fn } = getSystem();
const { hasKeyword, stringify } = fn.jsonSchema202012.useFn();
if (!hasKeyword(schema, "example")) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--example" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "Example"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--const" },
stringify(schema.example)
)
));
};
/* harmony default export */ const keywords_Example = (Example_Example);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Xml.jsx
/**
* @prettier
*/
const Xml = (_ref) => {let { schema, getSystem } = _ref;
const xml = (schema === null || schema === void 0 ? void 0 : schema.xml) || {};
const { fn, getComponent } = getSystem();
const { useIsExpandedDeeply, useComponent } = fn.jsonSchema202012;
const isExpandedDeeply = useIsExpandedDeeply();
const isExpandable = !!(xml.name || xml.namespace || xml.prefix);
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(false);
const Accordion = useComponent("Accordion");
const ExpandDeepButton = useComponent("ExpandDeepButton");
const JSONSchemaDeepExpansionContext = getComponent(
"JSONSchema202012DeepExpansionContext"
)();
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)((e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
}, []);
/**
* Rendering.
*/
if (Object.keys(xml).length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--xml" },
isExpandable ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "XML"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, {
expanded: expanded,
onClick: handleExpansionDeep }
)
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "XML"
),
xml.attribute === true && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--muted" }, "attribute"
),
xml.wrapped === true && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--muted" }, "wrapped"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("strong", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--primary" }, "object"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-keyword__children", {
"json-schema-2020-12-keyword__children--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
xml.name && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "name"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
xml.name
)
)
),
xml.namespace && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "namespace"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
xml.namespace
)
)
),
xml.prefix && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "prefix"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
xml.prefix
)
)
)
)
)
)
));
};
/* harmony default export */ const keywords_Xml = (Xml);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/DiscriminatorMapping.jsx
/**
* @prettier
*/
const DiscriminatorMapping = (_ref) => {let { discriminator } = _ref;
const mapping = (discriminator === null || discriminator === void 0 ? void 0 : discriminator.mapping) || {};
if (Object.keys(mapping).length === 0) {
return null;
}
return Object.entries(mapping).map((_ref2) => {let [key, value] = _ref2;return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { key: `${key}-${value}`, className: "json-schema-2020-12-keyword" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" },
key
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
value
)
));}
);
};
DiscriminatorMapping.defaultProps = {
mapping: undefined
};
/* harmony default export */ const Discriminator_DiscriminatorMapping = (DiscriminatorMapping);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/Discriminator.jsx
/**
* @prettier
*/
const Discriminator = (_ref) => {let { schema, getSystem } = _ref;
const discriminator = (schema === null || schema === void 0 ? void 0 : schema.discriminator) || {};
const { fn, getComponent } = getSystem();
const { useIsExpandedDeeply, useComponent } = fn.jsonSchema202012;
const isExpandedDeeply = useIsExpandedDeeply();
const isExpandable = !!discriminator.mapping;
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(false);
const Accordion = useComponent("Accordion");
const ExpandDeepButton = useComponent("ExpandDeepButton");
const JSONSchemaDeepExpansionContext = getComponent(
"JSONSchema202012DeepExpansionContext"
)();
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)((e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
}, []);
/**
* Rendering.
*/
if (Object.keys(discriminator).length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--discriminator" },
isExpandable ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "Discriminator"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, {
expanded: expanded,
onClick: handleExpansionDeep }
)
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "Discriminator"
),
discriminator.propertyName && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--muted" },
discriminator.propertyName
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("strong", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--primary" }, "object"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-keyword__children", {
"json-schema-2020-12-keyword__children--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Discriminator_DiscriminatorMapping, { discriminator: discriminator })
)
)
)
));
};
/* harmony default export */ const Discriminator_Discriminator = (Discriminator);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/ExternalDocs.jsx
/**
* @prettier
*/
const ExternalDocs = (_ref) => {let { schema, getSystem } = _ref;
const externalDocs = (schema === null || schema === void 0 ? void 0 : schema.externalDocs) || {};
const { fn, getComponent } = getSystem();
const { useIsExpandedDeeply, useComponent } = fn.jsonSchema202012;
const isExpandedDeeply = useIsExpandedDeeply();
const isExpandable = !!(externalDocs.description || externalDocs.url);
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(false);
const Accordion = useComponent("Accordion");
const ExpandDeepButton = useComponent("ExpandDeepButton");
const KeywordDescription = getComponent("JSONSchema202012KeywordDescription");
const Link = getComponent("Link");
const JSONSchemaDeepExpansionContext = getComponent(
"JSONSchema202012DeepExpansionContext"
)();
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)((e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
}, []);
/**
* Rendering.
*/
if (Object.keys(externalDocs).length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--externalDocs" },
isExpandable ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "External documentation"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, {
expanded: expanded,
onClick: handleExpansionDeep }
)
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "External documentation"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("strong", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--primary" }, "object"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-keyword__children", {
"json-schema-2020-12-keyword__children--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
externalDocs.description && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordDescription, {
schema: externalDocs,
getSystem: getSystem }
)
),
externalDocs.url && /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "url"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Link, {
target: "_blank",
href: sanitizeUrl(externalDocs.url) },
externalDocs.url
)
)
)
)
)
)
)
));
};
/* harmony default export */ const keywords_ExternalDocs = (ExternalDocs);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Description.jsx
/**
* @prettier
*/
const Description = (_ref) => {let { schema, getSystem } = _ref;
if (!(schema !== null && schema !== void 0 && schema.description)) return null;
const { getComponent } = getSystem();
const MarkDown = getComponent("Markdown");
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-core-keyword__value json-schema-2020-12-core-keyword__value--secondary" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(MarkDown, { source: schema.description })
)
));
};
/* harmony default export */ const keywords_Description = (Description);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Description.jsx
/**
* @prettier
*/
const DescriptionWrapper = createOnlyOAS31ComponentWrapper(keywords_Description);
/* harmony default export */ const wrap_components_keywords_Description = (DescriptionWrapper);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Default.jsx
/**
* @prettier
*/
const DefaultWrapper = createOnlyOAS31ComponentWrapper(
(_ref) => {let { schema, getSystem, originalComponent: KeywordDefault } = _ref;
const { getComponent } = getSystem();
const KeywordDiscriminator = getComponent(
"JSONSchema202012KeywordDiscriminator"
);
const KeywordXml = getComponent("JSONSchema202012KeywordXml");
const KeywordExample = getComponent("JSONSchema202012KeywordExample");
const KeywordExternalDocs = getComponent(
"JSONSchema202012KeywordExternalDocs"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordDefault, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordDiscriminator, { schema: schema, getSystem: getSystem }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordXml, { schema: schema, getSystem: getSystem }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordExternalDocs, { schema: schema, getSystem: getSystem }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordExample, { schema: schema, getSystem: getSystem })
));
}
);
/* harmony default export */ const Default = (DefaultWrapper);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Properties.jsx
/**
* @prettier
*/
const Properties = (_ref) => {let { schema, getSystem } = _ref;
const { fn } = getSystem();
const { useComponent } = fn.jsonSchema202012;
const { getDependentRequired, getProperties } = fn.jsonSchema202012.useFn();
const config = fn.jsonSchema202012.useConfig();
const required = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.required) ? schema.required : [];
const JSONSchema = useComponent("JSONSchema");
const properties = getProperties(schema, config);
/**
* Rendering.
*/
if (Object.keys(properties).length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--properties" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", null,
Object.entries(properties).map((_ref2) => {let [propertyName, propertySchema] = _ref2;
const isRequired = required.includes(propertyName);
const dependentRequired = getDependentRequired(propertyName, schema);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("li", {
key: propertyName,
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-property", {
"json-schema-2020-12-property--required": isRequired
}) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, {
name: propertyName,
schema: propertySchema,
dependentRequired: dependentRequired }
)
));
})
)
));
};
/* harmony default export */ const keywords_Properties = (Properties);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Properties.jsx
/**
* @prettier
*/
const PropertiesWrapper = createOnlyOAS31ComponentWrapper(keywords_Properties);
/* harmony default export */ const wrap_components_keywords_Properties = (PropertiesWrapper);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/after-load.js
/**
* @prettier
*/
function afterLoad(_ref) {let { fn, getSystem } = _ref;
// overrides for fn.jsonSchema202012
if (fn.jsonSchema202012) {
const isExpandable = makeIsExpandable(
fn.jsonSchema202012.isExpandable,
getSystem
);
Object.assign(this.fn.jsonSchema202012, { isExpandable, getProperties: getProperties });
}
// wraps schema generators from samples plugin and make them specific to OpenAPI 3.1 version
if (typeof fn.sampleFromSchema === "function" && fn.jsonSchema202012) {
const wrappedFns = wrapOAS31Fn(
{
sampleFromSchema: fn.jsonSchema202012.sampleFromSchema,
sampleFromSchemaGeneric: fn.jsonSchema202012.sampleFromSchemaGeneric,
createXMLExample: fn.jsonSchema202012.createXMLExample,
memoizedSampleFromSchema: fn.jsonSchema202012.memoizedSampleFromSchema,
memoizedCreateXMLExample: fn.jsonSchema202012.memoizedCreateXMLExample
},
getSystem()
);
Object.assign(this.fn, wrappedFns);
}
}
/* harmony default export */ const after_load = (afterLoad);
;// CONCATENATED MODULE: ./src/core/plugins/oas31/index.js
/**
* @prettier
*/
const OAS31Plugin = (_ref) => {let { fn } = _ref;
const createSystemSelector = fn.createSystemSelector || fn_createSystemSelector;
const createOnlyOAS31Selector = fn.createOnlyOAS31Selector || fn_createOnlyOAS31Selector; // prettier-ignore
return {
afterLoad: after_load,
fn: {
isOAS31: isOAS31,
createSystemSelector: fn_createSystemSelector,
createOnlyOAS31Selector: fn_createOnlyOAS31Selector
},
components: {
Webhooks: webhooks,
JsonSchemaDialect: json_schema_dialect,
OAS31Info: oas31_components_info,
OAS31License: components_license,
OAS31Contact: components_contact,
OAS31VersionPragmaFilter: version_pragma_filter,
OAS31Model: model_model,
OAS31Models: models,
JSONSchema202012KeywordExample: keywords_Example,
JSONSchema202012KeywordXml: keywords_Xml,
JSONSchema202012KeywordDiscriminator: Discriminator_Discriminator,
JSONSchema202012KeywordExternalDocs: keywords_ExternalDocs
},
wrapComponents: {
InfoContainer: wrap_components_info,
License: wrap_components_license,
Contact: wrap_components_contact,
VersionPragmaFilter: wrap_components_version_pragma_filter,
Model: wrap_components_model,
Models: wrap_components_models,
JSONSchema202012KeywordDescription:
wrap_components_keywords_Description,
JSONSchema202012KeywordDefault: Default,
JSONSchema202012KeywordProperties:
wrap_components_keywords_Properties
},
statePlugins: {
spec: {
selectors: {
isOAS31: createSystemSelector(selectors_isOAS31),
license: selectors_license,
selectLicenseNameField: selectLicenseNameField,
selectLicenseUrlField: selectLicenseUrlField,
selectLicenseIdentifierField: createOnlyOAS31Selector(selectLicenseIdentifierField), // prettier-ignore
selectLicenseUrl: createSystemSelector(selectLicenseUrl),
contact: selectors_contact,
selectContactNameField: selectContactNameField,
selectContactEmailField: selectContactEmailField,
selectContactUrlField: selectContactUrlField,
selectContactUrl: createSystemSelector(selectContactUrl),
selectInfoTitleField: selectInfoTitleField,
selectInfoSummaryField: createOnlyOAS31Selector(selectInfoSummaryField), // prettier-ignore
selectInfoDescriptionField: selectInfoDescriptionField,
selectInfoTermsOfServiceField: selectInfoTermsOfServiceField,
selectInfoTermsOfServiceUrl: createSystemSelector(selectInfoTermsOfServiceUrl), // prettier-ignore
selectExternalDocsDescriptionField: selectExternalDocsDescriptionField,
selectExternalDocsUrlField: selectExternalDocsUrlField,
selectExternalDocsUrl: createSystemSelector(selectExternalDocsUrl),
webhooks: createOnlyOAS31Selector(selectors_webhooks),
selectWebhooksOperations: createOnlyOAS31Selector(createSystemSelector(selectWebhooksOperations)), // prettier-ignore
selectJsonSchemaDialectField: selectJsonSchemaDialectField,
selectJsonSchemaDialectDefault: selectJsonSchemaDialectDefault,
selectSchemas: createSystemSelector(selectSchemas)
},
wrapSelectors: {
isOAS3: wrap_selectors_isOAS3,
selectLicenseUrl: wrap_selectors_selectLicenseUrl
}
},
oas31: {
selectors: {
selectLicenseUrl: createOnlyOAS31Selector(createSystemSelector(selectors_selectLicenseUrl)) // prettier-ignore
}
}
}
};
};
/* harmony default export */ const oas31 = (OAS31Plugin);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/prop-types.js
/**
* @prettier
*/
const objectSchema = external_prop_types_namespaceObject["default"].object;
const booleanSchema = external_prop_types_namespaceObject["default"].bool;
const schema = external_prop_types_namespaceObject["default"].oneOfType([objectSchema, booleanSchema]);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/context.js
/**
* @prettier
*/
const JSONSchemaContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)(null);
JSONSchemaContext.displayName = "JSONSchemaContext";
const JSONSchemaLevelContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)(0);
JSONSchemaLevelContext.displayName = "JSONSchemaLevelContext";
const JSONSchemaDeepExpansionContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)(false);
JSONSchemaDeepExpansionContext.displayName = "JSONSchemaDeepExpansionContext";
const JSONSchemaCyclesContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)(new Set());
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/hooks.js
/**
* @prettier
*/
const useConfig = () => {
const { config } = (0,external_react_namespaceObject.useContext)(JSONSchemaContext);
return config;
};
const useComponent = (componentName) => {
const { components } = (0,external_react_namespaceObject.useContext)(JSONSchemaContext);
return components[componentName] || null;
};
const useFn = function () {let fnName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
const { fn } = (0,external_react_namespaceObject.useContext)(JSONSchemaContext);
return typeof fnName !== "undefined" ? fn[fnName] : fn;
};
const useLevel = () => {
const level = (0,external_react_namespaceObject.useContext)(JSONSchemaLevelContext);
return [level, level + 1];
};
const useIsEmbedded = () => {
const [level] = useLevel();
return level > 0;
};
const useIsExpanded = () => {
const [level] = useLevel();
const { defaultExpandedLevels } = useConfig();
return defaultExpandedLevels - level > 0;
};
const useIsExpandedDeeply = () => {
return (0,external_react_namespaceObject.useContext)(JSONSchemaDeepExpansionContext);
};
const useRenderedSchemas = function () {let schema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
if (typeof schema === "undefined") {
return (0,external_react_namespaceObject.useContext)(JSONSchemaCyclesContext);
}
const renderedSchemas = (0,external_react_namespaceObject.useContext)(JSONSchemaCyclesContext);
return new Set([...renderedSchemas, schema]);
};
const useIsCircular = (schema) => {
const renderedSchemas = useRenderedSchemas();
return renderedSchemas.has(schema);
};
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx
/**
* @prettier
*/
const JSONSchema = /*#__PURE__*/(0,external_react_namespaceObject.forwardRef)(
(_ref, ref) => {let { schema, name, dependentRequired, onExpand } = _ref;
const fn = useFn();
const isExpanded = useIsExpanded();
const isExpandedDeeply = useIsExpandedDeeply();
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpanded || isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [level, nextLevel] = useLevel();
const isEmbedded = useIsEmbedded();
const isExpandable = fn.isExpandable(schema) || dependentRequired.length > 0;
const isCircular = useIsCircular(schema);
const renderedSchemas = useRenderedSchemas(schema);
const constraints = fn.stringifyConstraints(schema);
const Accordion = useComponent("Accordion");
const Keyword$schema = useComponent("Keyword$schema");
const Keyword$vocabulary = useComponent("Keyword$vocabulary");
const Keyword$id = useComponent("Keyword$id");
const Keyword$anchor = useComponent("Keyword$anchor");
const Keyword$dynamicAnchor = useComponent("Keyword$dynamicAnchor");
const Keyword$ref = useComponent("Keyword$ref");
const Keyword$dynamicRef = useComponent("Keyword$dynamicRef");
const Keyword$defs = useComponent("Keyword$defs");
const Keyword$comment = useComponent("Keyword$comment");
const KeywordAllOf = useComponent("KeywordAllOf");
const KeywordAnyOf = useComponent("KeywordAnyOf");
const KeywordOneOf = useComponent("KeywordOneOf");
const KeywordNot = useComponent("KeywordNot");
const KeywordIf = useComponent("KeywordIf");
const KeywordThen = useComponent("KeywordThen");
const KeywordElse = useComponent("KeywordElse");
const KeywordDependentSchemas = useComponent("KeywordDependentSchemas");
const KeywordPrefixItems = useComponent("KeywordPrefixItems");
const KeywordItems = useComponent("KeywordItems");
const KeywordContains = useComponent("KeywordContains");
const KeywordProperties = useComponent("KeywordProperties");
const KeywordPatternProperties = useComponent("KeywordPatternProperties");
const KeywordAdditionalProperties = useComponent(
"KeywordAdditionalProperties"
);
const KeywordPropertyNames = useComponent("KeywordPropertyNames");
const KeywordUnevaluatedItems = useComponent("KeywordUnevaluatedItems");
const KeywordUnevaluatedProperties = useComponent(
"KeywordUnevaluatedProperties"
);
const KeywordType = useComponent("KeywordType");
const KeywordEnum = useComponent("KeywordEnum");
const KeywordConst = useComponent("KeywordConst");
const KeywordConstraint = useComponent("KeywordConstraint");
const KeywordDependentRequired = useComponent("KeywordDependentRequired");
const KeywordContentSchema = useComponent("KeywordContentSchema");
const KeywordTitle = useComponent("KeywordTitle");
const KeywordDescription = useComponent("KeywordDescription");
const KeywordDefault = useComponent("KeywordDefault");
const KeywordDeprecated = useComponent("KeywordDeprecated");
const KeywordReadOnly = useComponent("KeywordReadOnly");
const KeywordWriteOnly = useComponent("KeywordWriteOnly");
const ExpandDeepButton = useComponent("ExpandDeepButton");
/**
* Effects handlers.
*/
(0,external_react_namespaceObject.useEffect)(() => {
setExpandedDeeply(isExpandedDeeply);
}, [isExpandedDeeply]);
(0,external_react_namespaceObject.useEffect)(() => {
setExpandedDeeply(expandedDeeply);
}, [expandedDeeply]);
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(
(e, expandedNew) => {
setExpanded(expandedNew);
!expandedNew && setExpandedDeeply(false);
onExpand(e, expandedNew, false);
},
[onExpand]
);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)(
(e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
onExpand(e, expandedDeepNew, true);
},
[onExpand]
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaLevelContext.Provider, { value: nextLevel }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchemaCyclesContext.Provider, { value: renderedSchemas }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("article", {
ref: ref,
"data-json-schema-level": level,
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12", {
"json-schema-2020-12--embedded": isEmbedded,
"json-schema-2020-12--circular": isCircular
}) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-head" },
isExpandable && !isCircular ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordTitle, { title: name, schema: schema })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, {
expanded: expanded,
onClick: handleExpansionDeep }
)
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordTitle, { title: name, schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordDeprecated, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordReadOnly, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordWriteOnly, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordType, { schema: schema, isCircular: isCircular }),
constraints.length > 0 &&
constraints.map((constraint) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordConstraint, {
key: `${constraint.scope}-${constraint.value}`,
constraint: constraint }
)
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-body", {
"json-schema-2020-12-body--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordDescription, { schema: schema }),
!isCircular && isExpandable && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordProperties, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordPatternProperties, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordAdditionalProperties, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordUnevaluatedProperties, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordPropertyNames, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordAllOf, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordAnyOf, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordOneOf, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordNot, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordIf, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordThen, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordElse, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordDependentSchemas, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordPrefixItems, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordItems, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordUnevaluatedItems, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordContains, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordContentSchema, { schema: schema })
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordEnum, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordConst, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordDependentRequired, {
schema: schema,
dependentRequired: dependentRequired }
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordDefault, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Keyword$schema, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Keyword$vocabulary, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Keyword$id, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Keyword$anchor, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Keyword$dynamicAnchor, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Keyword$ref, { schema: schema }),
!isCircular && isExpandable && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Keyword$defs, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Keyword$dynamicRef, { schema: schema }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Keyword$comment, { schema: schema })
)
)
)
)
)
));
}
);
JSONSchema.defaultProps = {
name: "",
dependentRequired: [],
onExpand: () => {}
};
/* harmony default export */ const JSONSchema_JSONSchema = (JSONSchema);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/$schema.jsx
/**
* @prettier
*/
const $schema = (_ref) => {let { schema } = _ref;
if (!(schema !== null && schema !== void 0 && schema.$schema)) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--$schema" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "$schema"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
schema.$schema
)
));
};
/* harmony default export */ const keywords_$schema = ($schema);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/$vocabulary/$vocabulary.jsx
/**
* @prettier
*/
const $vocabulary = (_ref) => {let { schema } = _ref;
const isExpandedDeeply = useIsExpandedDeeply();
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const Accordion = useComponent("Accordion");
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
/**
* Rendering.
*/
if (!(schema !== null && schema !== void 0 && schema.$vocabulary)) return null;
if (typeof schema.$vocabulary !== "object") return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--$vocabulary" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "$vocabulary"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("strong", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--primary" }, "object"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", null,
expanded &&
Object.entries(schema.$vocabulary).map((_ref2) => {let [uri, enabled] = _ref2;return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("li", {
key: uri,
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-$vocabulary-uri", {
"json-schema-2020-12-$vocabulary-uri--disabled": !enabled
}) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
uri
)
));}
)
)
));
};
/* harmony default export */ const $vocabulary_$vocabulary = ($vocabulary);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/$id.jsx
/**
* @prettier
*/
const $id = (_ref) => {let { schema } = _ref;
if (!(schema !== null && schema !== void 0 && schema.$id)) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--$id" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "$id"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
schema.$id
)
));
};
/* harmony default export */ const keywords_$id = ($id);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/$anchor.jsx
/**
* @prettier
*/
const $anchor = (_ref) => {let { schema } = _ref;
if (!(schema !== null && schema !== void 0 && schema.$anchor)) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--$anchor" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "$anchor"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
schema.$anchor
)
));
};
/* harmony default export */ const keywords_$anchor = ($anchor);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/$dynamicAnchor.jsx
/**
* @prettier
*/
const $dynamicAnchor = (_ref) => {let { schema } = _ref;
if (!(schema !== null && schema !== void 0 && schema.$dynamicAnchor)) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--$dynamicAnchor" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "$dynamicAnchor"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
schema.$dynamicAnchor
)
));
};
/* harmony default export */ const keywords_$dynamicAnchor = ($dynamicAnchor);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/$ref.jsx
/**
* @prettier
*/
const $ref = (_ref) => {let { schema } = _ref;
if (!(schema !== null && schema !== void 0 && schema.$ref)) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--$ref" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "$ref"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
schema.$ref
)
));
};
/* harmony default export */ const keywords_$ref = ($ref);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/$dynamicRef.jsx
/**
* @prettier
*/
const $dynamicRef = (_ref) => {let { schema } = _ref;
if (!(schema !== null && schema !== void 0 && schema.$dynamicRef)) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--$dynamicRef" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "$dynamicRef"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
schema.$dynamicRef
)
));
};
/* harmony default export */ const keywords_$dynamicRef = ($dynamicRef);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/$defs.jsx
/**
* @prettier
*/
const $defs = (_ref) => {let { schema } = _ref;
const $defs = (schema === null || schema === void 0 ? void 0 : schema.$defs) || {};
const isExpandedDeeply = useIsExpandedDeeply();
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(false);
const Accordion = useComponent("Accordion");
const ExpandDeepButton = useComponent("ExpandDeepButton");
const JSONSchema = useComponent("JSONSchema");
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)((e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
}, []);
/**
* Rendering.
*/
if (Object.keys($defs).length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--$defs" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "$defs"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, { expanded: expanded, onClick: handleExpansionDeep }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("strong", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--primary" }, "object"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-keyword__children", {
"json-schema-2020-12-keyword__children--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
Object.entries($defs).map((_ref2) => {let [schemaName, schema] = _ref2;return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("li", { key: schemaName, className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: schemaName, schema: schema })
));}
)
)
)
)
));
};
/* harmony default export */ const keywords_$defs = ($defs);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/$comment.jsx
/**
* @prettier
*/
const $comment = (_ref) => {let { schema } = _ref;
if (!(schema !== null && schema !== void 0 && schema.$comment)) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--$comment" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--secondary" }, "$comment"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--secondary" },
schema.$comment
)
));
};
/* harmony default export */ const keywords_$comment = ($comment);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/AllOf.jsx
/**
* @prettier
*/
const AllOf = (_ref) => {let { schema } = _ref;
const allOf = (schema === null || schema === void 0 ? void 0 : schema.allOf) || [];
const fn = useFn();
const isExpandedDeeply = useIsExpandedDeeply();
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(false);
const Accordion = useComponent("Accordion");
const ExpandDeepButton = useComponent("ExpandDeepButton");
const JSONSchema = useComponent("JSONSchema");
const KeywordType = useComponent("KeywordType");
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)((e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
}, []);
/**
* Rendering.
*/
if (!Array.isArray(allOf) || allOf.length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--allOf" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "All of"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, { expanded: expanded, onClick: handleExpansionDeep }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordType, { schema: { allOf } }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-keyword__children", {
"json-schema-2020-12-keyword__children--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
allOf.map((schema, index) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { key: `#${index}`, className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, {
name: `#${index} ${fn.getTitle(schema)}`,
schema: schema }
)
)
)
)
)
)
));
};
/* harmony default export */ const keywords_AllOf = (AllOf);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/AnyOf.jsx
/**
* @prettier
*/
const AnyOf = (_ref) => {let { schema } = _ref;
const anyOf = (schema === null || schema === void 0 ? void 0 : schema.anyOf) || [];
const fn = useFn();
const isExpandedDeeply = useIsExpandedDeeply();
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(false);
const Accordion = useComponent("Accordion");
const ExpandDeepButton = useComponent("ExpandDeepButton");
const JSONSchema = useComponent("JSONSchema");
const KeywordType = useComponent("KeywordType");
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)((e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
}, []);
/**
* Rendering.
*/
if (!Array.isArray(anyOf) || anyOf.length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--anyOf" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Any of"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, { expanded: expanded, onClick: handleExpansionDeep }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordType, { schema: { anyOf } }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-keyword__children", {
"json-schema-2020-12-keyword__children--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
anyOf.map((schema, index) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { key: `#${index}`, className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, {
name: `#${index} ${fn.getTitle(schema)}`,
schema: schema }
)
)
)
)
)
)
));
};
/* harmony default export */ const keywords_AnyOf = (AnyOf);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/OneOf.jsx
/**
* @prettier
*/
const OneOf = (_ref) => {let { schema } = _ref;
const oneOf = (schema === null || schema === void 0 ? void 0 : schema.oneOf) || [];
const fn = useFn();
const isExpandedDeeply = useIsExpandedDeeply();
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(false);
const Accordion = useComponent("Accordion");
const ExpandDeepButton = useComponent("ExpandDeepButton");
const JSONSchema = useComponent("JSONSchema");
const KeywordType = useComponent("KeywordType");
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)((e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
}, []);
/**
* Rendering.
*/
if (!Array.isArray(oneOf) || oneOf.length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--oneOf" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "One of"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, { expanded: expanded, onClick: handleExpansionDeep }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordType, { schema: { oneOf } }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-keyword__children", {
"json-schema-2020-12-keyword__children--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
oneOf.map((schema, index) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { key: `#${index}`, className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, {
name: `#${index} ${fn.getTitle(schema)}`,
schema: schema }
)
)
)
)
)
)
));
};
/* harmony default export */ const keywords_OneOf = (OneOf);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Not.jsx
/**
* @prettier
*/
const Not = (_ref) => {let { schema } = _ref;
const fn = useFn();
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "not")) return null;
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Not"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--not" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: schema.not })
));
};
/* harmony default export */ const keywords_Not = (Not);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/If.jsx
/**
* @prettier
*/
const If = (_ref) => {let { schema } = _ref;
const fn = useFn();
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "if")) return null;
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "If"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--if" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: schema.if })
));
};
/* harmony default export */ const keywords_If = (If);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Then.jsx
/**
* @prettier
*/
const Then = (_ref) => {let { schema } = _ref;
const fn = useFn();
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "then")) return null;
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Then"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--then" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: schema.then })
));
};
/* harmony default export */ const keywords_Then = (Then);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Else.jsx
/**
* @prettier
*/
const Else = (_ref) => {let { schema } = _ref;
const fn = useFn();
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "else")) return null;
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Else"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--if" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: schema.else })
));
};
/* harmony default export */ const keywords_Else = (Else);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/DependentSchemas.jsx
/**
* @prettier
*/
const DependentSchemas = (_ref) => {let { schema } = _ref;
const dependentSchemas = (schema === null || schema === void 0 ? void 0 : schema.dependentSchemas) || [];
const isExpandedDeeply = useIsExpandedDeeply();
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(false);
const Accordion = useComponent("Accordion");
const ExpandDeepButton = useComponent("ExpandDeepButton");
const JSONSchema = useComponent("JSONSchema");
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)((e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
}, []);
/**
* Rendering.
*/
if (typeof dependentSchemas !== "object") return null;
if (Object.keys(dependentSchemas).length === 0) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--dependentSchemas" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Dependent schemas"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, { expanded: expanded, onClick: handleExpansionDeep }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("strong", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--primary" }, "object"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-keyword__children", {
"json-schema-2020-12-keyword__children--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
Object.entries(dependentSchemas).map((_ref2) => {let [schemaName, schema] = _ref2;return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("li", { key: schemaName, className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: schemaName, schema: schema })
));}
)
)
)
)
));
};
/* harmony default export */ const keywords_DependentSchemas = (DependentSchemas);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/PrefixItems.jsx
/**
* @prettier
*/
const PrefixItems = (_ref) => {let { schema } = _ref;
const prefixItems = (schema === null || schema === void 0 ? void 0 : schema.prefixItems) || [];
const fn = useFn();
const isExpandedDeeply = useIsExpandedDeeply();
const [expanded, setExpanded] = (0,external_react_namespaceObject.useState)(isExpandedDeeply);
const [expandedDeeply, setExpandedDeeply] = (0,external_react_namespaceObject.useState)(false);
const Accordion = useComponent("Accordion");
const ExpandDeepButton = useComponent("ExpandDeepButton");
const JSONSchema = useComponent("JSONSchema");
const KeywordType = useComponent("KeywordType");
/**
* Event handlers.
*/
const handleExpansion = (0,external_react_namespaceObject.useCallback)(() => {
setExpanded((prev) => !prev);
}, []);
const handleExpansionDeep = (0,external_react_namespaceObject.useCallback)((e, expandedDeepNew) => {
setExpanded(expandedDeepNew);
setExpandedDeeply(expandedDeepNew);
}, []);
/**
* Rendering.
*/
if (!Array.isArray(prefixItems) || prefixItems.length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement(JSONSchemaDeepExpansionContext.Provider, { value: expandedDeeply }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--prefixItems" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Accordion, { expanded: expanded, onChange: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Prefix items"
)
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ExpandDeepButton, { expanded: expanded, onClick: handleExpansionDeep }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement(KeywordType, { schema: { prefixItems } }), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-keyword__children", {
"json-schema-2020-12-keyword__children--collapsed": !expanded
}) },
expanded && /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
prefixItems.map((schema, index) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { key: `#${index}`, className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, {
name: `#${index} ${fn.getTitle(schema)}`,
schema: schema }
)
)
)
)
)
)
));
};
/* harmony default export */ const keywords_PrefixItems = (PrefixItems);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Items.jsx
/**
* @prettier
*/
const Items = (_ref) => {let { schema } = _ref;
const fn = useFn();
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "items")) return null;
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Items"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--items" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: schema.items })
));
};
/* harmony default export */ const keywords_Items = (Items);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Contains.jsx
/**
* @prettier
*/
const Contains = (_ref) => {let { schema } = _ref;
const fn = useFn();
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "contains")) return null;
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Contains"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--contains" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: schema.contains })
));
};
/* harmony default export */ const keywords_Contains = (Contains);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Properties/Properties.jsx
/**
* @prettier
*/
const Properties_Properties = (_ref) => {let { schema } = _ref;
const fn = useFn();
const properties = (schema === null || schema === void 0 ? void 0 : schema.properties) || {};
const required = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.required) ? schema.required : [];
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (Object.keys(properties).length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--properties" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", null,
Object.entries(properties).map((_ref2) => {let [propertyName, propertySchema] = _ref2;
const isRequired = required.includes(propertyName);
const dependentRequired = fn.getDependentRequired(
propertyName,
schema
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("li", {
key: propertyName,
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-property", {
"json-schema-2020-12-property--required": isRequired
}) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, {
name: propertyName,
schema: propertySchema,
dependentRequired: dependentRequired }
)
));
})
)
));
};
/* harmony default export */ const keywords_Properties_Properties = (Properties_Properties);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/PatternProperties/PatternProperties.jsx
/**
* @prettier
*/
const PatternProperties = (_ref) => {let { schema } = _ref;
const patternProperties = (schema === null || schema === void 0 ? void 0 : schema.patternProperties) || {};
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (Object.keys(patternProperties).length === 0) {
return null;
}
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--patternProperties" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", null,
Object.entries(patternProperties).map((_ref2) => {let [propertyName, schema] = _ref2;return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("li", { key: propertyName, className: "json-schema-2020-12-property" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: propertyName, schema: schema })
));}
)
)
));
};
/* harmony default export */ const PatternProperties_PatternProperties = (PatternProperties);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/AdditionalProperties.jsx
/**
* @prettier
*/
const AdditionalProperties = (_ref) => {let { schema } = _ref;
const fn = useFn();
const { additionalProperties } = schema;
const JSONSchema = useComponent("JSONSchema");
if (!fn.hasKeyword(schema, "additionalProperties")) return null;
/**
* Rendering.
*/
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Additional properties"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--additionalProperties" },
additionalProperties === true ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
name, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--primary" }, "allowed"
)
) :
additionalProperties === false ? /*#__PURE__*/
external_react_namespaceObject["default"].createElement(external_react_namespaceObject["default"].Fragment, null,
name, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--primary" }, "forbidden"
)
) : /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: additionalProperties })
));
};
/* harmony default export */ const keywords_AdditionalProperties = (AdditionalProperties);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/PropertyNames.jsx
/**
* @prettier
*/
const PropertyNames = (_ref) => {let { schema } = _ref;
const fn = useFn();
const { propertyNames } = schema;
const JSONSchema = useComponent("JSONSchema");
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Property names"
);
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "propertyNames")) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--propertyNames" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: propertyNames })
));
};
/* harmony default export */ const keywords_PropertyNames = (PropertyNames);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/UnevaluatedItems.jsx
/**
* @prettier
*/
const UnevaluatedItems = (_ref) => {let { schema } = _ref;
const fn = useFn();
const { unevaluatedItems } = schema;
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "unevaluatedItems")) return null;
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Unevaluated items"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--unevaluatedItems" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: unevaluatedItems })
));
};
/* harmony default export */ const keywords_UnevaluatedItems = (UnevaluatedItems);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/UnevaluatedProperties.jsx
/**
* @prettier
*/
const UnevaluatedProperties = (_ref) => {let { schema } = _ref;
const fn = useFn();
const { unevaluatedProperties } = schema;
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "unevaluatedProperties")) return null;
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Unevaluated properties"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--unevaluatedProperties" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: unevaluatedProperties })
));
};
/* harmony default export */ const keywords_UnevaluatedProperties = (UnevaluatedProperties);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Type.jsx
/**
* @prettier
*/
const Type = (_ref) => {let { schema, isCircular } = _ref;
const fn = useFn();
const type = fn.getType(schema);
const circularSuffix = isCircular ? " [circular]" : "";
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("strong", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--primary" },
`${type}${circularSuffix}`
));
};
Type.defaultProps = {
isCircular: false
};
/* harmony default export */ const keywords_Type = (Type);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Enum/Enum.jsx
/**
* @prettier
*/
const Enum = (_ref) => {let { schema } = _ref;
const fn = useFn();
if (!Array.isArray(schema === null || schema === void 0 ? void 0 : schema.enum)) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--enum" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Allowed values"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", null,
schema.enum.map((element) => {
const strigifiedElement = fn.stringify(element);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("li", { key: strigifiedElement }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--const" },
strigifiedElement
)
));
})
)
));
};
/* harmony default export */ const Enum_Enum = (Enum);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Const.jsx
/**
* @prettier
*/
const Const = (_ref) => {let { schema } = _ref;
const fn = useFn();
if (!fn.hasKeyword(schema, "const")) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--const" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Const"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--const" },
fn.stringify(schema.const)
)
));
};
/* harmony default export */ const keywords_Const = (Const);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Constraint/Constraint.jsx
/**
* @prettier
*/
/**
* This component represents various constraint keywords
* from JSON Schema 2020-12 validation vocabulary.
*/
const Constraint = (_ref) => {let { constraint } = _ref;return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", {
className: `json-schema-2020-12__constraint json-schema-2020-12__constraint--${constraint.scope}` },
constraint.value
));};
/* harmony default export */ const Constraint_Constraint = (/*#__PURE__*/external_react_namespaceObject["default"].memo(Constraint));
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/DependentRequired/DependentRequired.jsx
/**
* @prettier
*/
const DependentRequired = (_ref) => {let { dependentRequired } = _ref;
if (dependentRequired.length === 0) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--dependentRequired" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Required when defined"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("ul", null,
dependentRequired.map((propertyName) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("li", { key: propertyName }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--warning" },
propertyName
)
)
)
)
));
};
/* harmony default export */ const DependentRequired_DependentRequired = (DependentRequired);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/ContentSchema.jsx
/**
* @prettier
*/
const ContentSchema = (_ref) => {let { schema } = _ref;
const fn = useFn();
const JSONSchema = useComponent("JSONSchema");
/**
* Rendering.
*/
if (!fn.hasKeyword(schema, "contentSchema")) return null;
const name = /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Content schema"
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--contentSchema" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchema, { name: name, schema: schema.contentSchema })
));
};
/* harmony default export */ const keywords_ContentSchema = (ContentSchema);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Title/Title.jsx
/**
* @prettier
*/
const Title = (_ref) => {let { title, schema } = _ref;
const fn = useFn();
const renderedTitle = title || fn.getTitle(schema);
if (!renderedTitle) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12__title" },
title || fn.getTitle(schema)
));
};
Title.defaultProps = {
title: ""
};
/* harmony default export */ const Title_Title = (Title);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Description/Description.jsx
/**
* @prettier
*/
const Description_Description = (_ref) => {let { schema } = _ref;
if (!(schema !== null && schema !== void 0 && schema.description)) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--description" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-core-keyword__value json-schema-2020-12-core-keyword__value--secondary" },
schema.description
)
));
};
/* harmony default export */ const keywords_Description_Description = (Description_Description);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Default.jsx
/**
* @prettier
*/
const Default_Default = (_ref) => {let { schema } = _ref;
const fn = useFn();
if (!fn.hasKeyword(schema, "default")) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-keyword json-schema-2020-12-keyword--default" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary" }, "Default"
), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12-keyword__value json-schema-2020-12-keyword__value--const" },
fn.stringify(schema.default)
)
));
};
/* harmony default export */ const keywords_Default = (Default_Default);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/Deprecated.jsx
/**
* @prettier
*/
const Deprecated = (_ref) => {let { schema } = _ref;
if ((schema === null || schema === void 0 ? void 0 : schema.deprecated) !== true) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--warning" }, "deprecated"
));
};
/* harmony default export */ const keywords_Deprecated = (Deprecated);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/ReadOnly.jsx
/**
* @prettier
*/
const ReadOnly = (_ref) => {let { schema } = _ref;
if ((schema === null || schema === void 0 ? void 0 : schema.readOnly) !== true) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--muted" }, "read-only"
));
};
/* harmony default export */ const keywords_ReadOnly = (ReadOnly);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/keywords/WriteOnly.jsx
/**
* @prettier
*/
const WriteOnly = (_ref) => {let { schema } = _ref;
if ((schema === null || schema === void 0 ? void 0 : schema.writeOnly) !== true) return null;
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("span", { className: "json-schema-2020-12__attribute json-schema-2020-12__attribute--muted" }, "write-only"
));
};
/* harmony default export */ const keywords_WriteOnly = (WriteOnly);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/Accordion/Accordion.jsx
/**
* @prettier
*/
const Accordion = (_ref) => {let { expanded, children, onChange } = _ref;
const ChevronRightIcon = useComponent("ChevronRightIcon");
const handleExpansion = (0,external_react_namespaceObject.useCallback)(
(event) => {
onChange(event, !expanded);
},
[expanded, onChange]
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("button", {
type: "button",
className: "json-schema-2020-12-accordion",
onClick: handleExpansion }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("div", { className: "json-schema-2020-12-accordion__children" }, children), /*#__PURE__*/
external_react_namespaceObject["default"].createElement("span", {
className: (0,external_classnames_namespaceObject["default"])("json-schema-2020-12-accordion__icon", {
"json-schema-2020-12-accordion__icon--expanded": expanded,
"json-schema-2020-12-accordion__icon--collapsed": !expanded
}) }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(ChevronRightIcon, null)
)
));
};
Accordion.defaultProps = {
expanded: false
};
/* harmony default export */ const Accordion_Accordion = (Accordion);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/ExpandDeepButton/ExpandDeepButton.jsx
/**
* @prettier
*/
const ExpandDeepButton = (_ref) => {let { expanded, onClick } = _ref;
const handleExpansion = (0,external_react_namespaceObject.useCallback)(
(event) => {
onClick(event, !expanded);
},
[expanded, onClick]
);
return /*#__PURE__*/(
external_react_namespaceObject["default"].createElement("button", {
type: "button",
className: "json-schema-2020-12-expand-deep-button",
onClick: handleExpansion },
expanded ? "Collapse all" : "Expand all"
));
};
/* harmony default export */ const ExpandDeepButton_ExpandDeepButton = (ExpandDeepButton);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/components/icons/ChevronRight.jsx
/**
* @prettier
*/
const ChevronRight = () => /*#__PURE__*/
external_react_namespaceObject["default"].createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
width: "24",
height: "24",
viewBox: "0 0 24 24" }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement("path", { d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" })
);
/* harmony default export */ const icons_ChevronRight = (ChevronRight);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/fn.js
/**
* @prettier
*/
const fn_upperFirst = (value) => {
if (typeof value === "string") {
return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
}
return value;
};
const getTitle = (schema) => {
const fn = useFn();
if (schema !== null && schema !== void 0 && schema.title) return fn.upperFirst(schema.title);
if (schema !== null && schema !== void 0 && schema.$anchor) return fn.upperFirst(schema.$anchor);
if (schema !== null && schema !== void 0 && schema.$id) return schema.$id;
return "";
};
const getType = function (schema) {let processedSchemas = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new WeakSet();
const fn = useFn();
if (schema == null) {
return "any";
}
if (fn.isBooleanJSONSchema(schema)) {
return schema ? "any" : "never";
}
if (typeof schema !== "object") {
return "any";
}
if (processedSchemas.has(schema)) {
return "any"; // detect a cycle
}
processedSchemas.add(schema);
const { type, prefixItems, items } = schema;
const getArrayType = () => {
if (Array.isArray(prefixItems)) {
const prefixItemsTypes = prefixItems.map((itemSchema) =>
getType(itemSchema, processedSchemas)
);
const itemsType = items ? getType(items, processedSchemas) : "any";
return `array<[${prefixItemsTypes.join(", ")}], ${itemsType}>`;
} else if (items) {
const itemsType = getType(items, processedSchemas);
return `array<${itemsType}>`;
} else {
return "array";
}
};
const inferType = () => {
if (
Object.hasOwn(schema, "prefixItems") ||
Object.hasOwn(schema, "items") ||
Object.hasOwn(schema, "contains"))
{
return getArrayType();
} else if (
Object.hasOwn(schema, "properties") ||
Object.hasOwn(schema, "additionalProperties") ||
Object.hasOwn(schema, "patternProperties"))
{
return "object";
} else if (["int32", "int64"].includes(schema.format)) {
// OpenAPI 3.1.0 integer custom formats
return "integer";
} else if (["float", "double"].includes(schema.format)) {
// OpenAPI 3.1.0 number custom formats
return "number";
} else if (
Object.hasOwn(schema, "minimum") ||
Object.hasOwn(schema, "maximum") ||
Object.hasOwn(schema, "exclusiveMinimum") ||
Object.hasOwn(schema, "exclusiveMaximum") ||
Object.hasOwn(schema, "multipleOf"))
{
return "number | integer";
} else if (
Object.hasOwn(schema, "pattern") ||
Object.hasOwn(schema, "format") ||
Object.hasOwn(schema, "minLength") ||
Object.hasOwn(schema, "maxLength"))
{
return "string";
} else if (typeof schema.const !== "undefined") {
if (schema.const === null) {
return "null";
} else if (typeof schema.const === "boolean") {
return "boolean";
} else if (typeof schema.const === "number") {
return Number.isInteger(schema.const) ? "integer" : "number";
} else if (typeof schema.const === "string") {
return "string";
} else if (Array.isArray(schema.const)) {
return "array";
} else if (typeof schema.const === "object") {
return "object";
}
}
return null;
};
if (schema.not && getType(schema.not) === "any") {
return "never";
}
const typeString = Array.isArray(type) ?
type.map((t) => t === "array" ? getArrayType() : t).join(" | ") :
type === "array" ?
getArrayType() :
[
"null",
"boolean",
"object",
"array",
"number",
"integer",
"string"].
includes(type) ?
type :
inferType();
const handleCombiningKeywords = (keyword, separator) => {
if (Array.isArray(schema[keyword])) {
const combinedTypes = schema[keyword].map((subSchema) =>
getType(subSchema, processedSchemas)
);
return `(${combinedTypes.join(separator)})`;
}
return null;
};
const oneOfString = handleCombiningKeywords("oneOf", " | ");
const anyOfString = handleCombiningKeywords("anyOf", " | ");
const allOfString = handleCombiningKeywords("allOf", " & ");
const combinedStrings = [typeString, oneOfString, anyOfString, allOfString].
filter(Boolean).
join(" | ");
processedSchemas.delete(schema);
return combinedStrings || "any";
};
const isBooleanJSONSchema = (schema) => typeof schema === "boolean";
const hasKeyword = (schema, keyword) =>
schema !== null &&
typeof schema === "object" &&
Object.hasOwn(schema, keyword);
const isExpandable = (schema) => {
const fn = useFn();
return (
(schema === null || schema === void 0 ? void 0 : schema.$schema) || (
schema === null || schema === void 0 ? void 0 : schema.$vocabulary) || (
schema === null || schema === void 0 ? void 0 : schema.$id) || (
schema === null || schema === void 0 ? void 0 : schema.$anchor) || (
schema === null || schema === void 0 ? void 0 : schema.$dynamicAnchor) || (
schema === null || schema === void 0 ? void 0 : schema.$ref) || (
schema === null || schema === void 0 ? void 0 : schema.$dynamicRef) || (
schema === null || schema === void 0 ? void 0 : schema.$defs) || (
schema === null || schema === void 0 ? void 0 : schema.$comment) || (
schema === null || schema === void 0 ? void 0 : schema.allOf) || (
schema === null || schema === void 0 ? void 0 : schema.anyOf) || (
schema === null || schema === void 0 ? void 0 : schema.oneOf) ||
fn.hasKeyword(schema, "not") ||
fn.hasKeyword(schema, "if") ||
fn.hasKeyword(schema, "then") ||
fn.hasKeyword(schema, "else") || (
schema === null || schema === void 0 ? void 0 : schema.dependentSchemas) || (
schema === null || schema === void 0 ? void 0 : schema.prefixItems) ||
fn.hasKeyword(schema, "items") ||
fn.hasKeyword(schema, "contains") || (
schema === null || schema === void 0 ? void 0 : schema.properties) || (
schema === null || schema === void 0 ? void 0 : schema.patternProperties) ||
fn.hasKeyword(schema, "additionalProperties") ||
fn.hasKeyword(schema, "propertyNames") ||
fn.hasKeyword(schema, "unevaluatedItems") ||
fn.hasKeyword(schema, "unevaluatedProperties") || (
schema === null || schema === void 0 ? void 0 : schema.description) || (
schema === null || schema === void 0 ? void 0 : schema.enum) ||
fn.hasKeyword(schema, "const") ||
fn.hasKeyword(schema, "contentSchema") ||
fn.hasKeyword(schema, "default"));
};
const fn_stringify = (value) => {
if (
value === null ||
["number", "bigint", "boolean"].includes(typeof value))
{
return String(value);
}
if (Array.isArray(value)) {
return `[${value.map(fn_stringify).join(", ")}]`;
}
return JSON.stringify(value);
};
const stringifyConstraintMultipleOf = (schema) => {
if (typeof (schema === null || schema === void 0 ? void 0 : schema.multipleOf) !== "number") return null;
if (schema.multipleOf <= 0) return null;
if (schema.multipleOf === 1) return null;
const { multipleOf } = schema;
if (Number.isInteger(multipleOf)) {
return `multiple of ${multipleOf}`;
}
const decimalPlaces = multipleOf.toString().split(".")[1].length;
const factor = 10 ** decimalPlaces;
const numerator = multipleOf * factor;
const denominator = factor;
return `multiple of ${numerator}/${denominator}`;
};
const stringifyConstraintNumberRange = (schema) => {
const minimum = schema === null || schema === void 0 ? void 0 : schema.minimum;
const maximum = schema === null || schema === void 0 ? void 0 : schema.maximum;
const exclusiveMinimum = schema === null || schema === void 0 ? void 0 : schema.exclusiveMinimum;
const exclusiveMaximum = schema === null || schema === void 0 ? void 0 : schema.exclusiveMaximum;
const hasMinimum = typeof minimum === "number";
const hasMaximum = typeof maximum === "number";
const hasExclusiveMinimum = typeof exclusiveMinimum === "number";
const hasExclusiveMaximum = typeof exclusiveMaximum === "number";
const isMinExclusive = hasExclusiveMinimum && (!hasMinimum || minimum < exclusiveMinimum); // prettier-ignore
const isMaxExclusive = hasExclusiveMaximum && (!hasMaximum || maximum > exclusiveMaximum); // prettier-ignore
if (
(hasMinimum || hasExclusiveMinimum) && (
hasMaximum || hasExclusiveMaximum))
{
const minSymbol = isMinExclusive ? "(" : "[";
const maxSymbol = isMaxExclusive ? ")" : "]";
const minValue = isMinExclusive ? exclusiveMinimum : minimum;
const maxValue = isMaxExclusive ? exclusiveMaximum : maximum;
return `${minSymbol}${minValue}, ${maxValue}${maxSymbol}`;
}
if (hasMinimum || hasExclusiveMinimum) {
const minSymbol = isMinExclusive ? ">" : "≥";
const minValue = isMinExclusive ? exclusiveMinimum : minimum;
return `${minSymbol} ${minValue}`;
}
if (hasMaximum || hasExclusiveMaximum) {
const maxSymbol = isMaxExclusive ? "<" : "≤";
const maxValue = isMaxExclusive ? exclusiveMaximum : maximum;
return `${maxSymbol} ${maxValue}`;
}
return null;
};
const stringifyConstraintRange = (label, min, max) => {
const hasMin = typeof min === "number";
const hasMax = typeof max === "number";
if (hasMin && hasMax) {
if (min === max) {
return `${min} ${label}`;
} else {
return `[${min}, ${max}] ${label}`;
}
}
if (hasMin) {
return `>= ${min} ${label}`;
}
if (hasMax) {
return `<= ${max} ${label}`;
}
return null;
};
const stringifyConstraints = (schema) => {
const constraints = [];
// validation Keywords for Numeric Instances (number and integer)
const multipleOf = stringifyConstraintMultipleOf(schema);
if (multipleOf !== null) {
constraints.push({ scope: "number", value: multipleOf });
}
const numberRange = stringifyConstraintNumberRange(schema);
if (numberRange !== null) {
constraints.push({ scope: "number", value: numberRange });
}
// vocabularies for Semantic Content With "format"
if (schema !== null && schema !== void 0 && schema.format) {
constraints.push({ scope: "string", value: schema.format });
}
// validation Keywords for Strings
const stringRange = stringifyConstraintRange(
"characters",
schema === null || schema === void 0 ? void 0 : schema.minLength,
schema === null || schema === void 0 ? void 0 : schema.maxLength
);
if (stringRange !== null) {
constraints.push({ scope: "string", value: stringRange });
}
if (schema !== null && schema !== void 0 && schema.pattern) {
constraints.push({ scope: "string", value: `matches ${schema === null || schema === void 0 ? void 0 : schema.pattern}` });
}
// vocabulary for the Contents of String-Encoded Data
if (schema !== null && schema !== void 0 && schema.contentMediaType) {
constraints.push({
scope: "string",
value: `media type: ${schema.contentMediaType}`
});
}
if (schema !== null && schema !== void 0 && schema.contentEncoding) {
constraints.push({
scope: "string",
value: `encoding: ${schema.contentEncoding}`
});
}
// validation Keywords for Arrays
const arrayRange = stringifyConstraintRange(
schema !== null && schema !== void 0 && schema.hasUniqueItems ? "unique items" : "items",
schema === null || schema === void 0 ? void 0 : schema.minItems,
schema === null || schema === void 0 ? void 0 : schema.maxItems
);
if (arrayRange !== null) {
constraints.push({ scope: "array", value: arrayRange });
}
const containsRange = stringifyConstraintRange(
"contained items",
schema === null || schema === void 0 ? void 0 : schema.minContains,
schema === null || schema === void 0 ? void 0 : schema.maxContains
);
if (containsRange !== null) {
constraints.push({ scope: "array", value: containsRange });
}
// validation Keywords for Objects
const objectRange = stringifyConstraintRange(
"properties",
schema === null || schema === void 0 ? void 0 : schema.minProperties,
schema === null || schema === void 0 ? void 0 : schema.maxProperties
);
if (objectRange !== null) {
constraints.push({ scope: "object", value: objectRange });
}
return constraints;
};
const getDependentRequired = (propertyName, schema) => {
if (!(schema !== null && schema !== void 0 && schema.dependentRequired)) return [];
return Array.from(
Object.entries(schema.dependentRequired).reduce((acc, _ref) => {let [prop, list] = _ref;
if (!Array.isArray(list)) return acc;
if (!list.includes(propertyName)) return acc;
acc.add(prop);
return acc;
}, new Set())
);
};
;// CONCATENATED MODULE: external "lodash/isPlainObject"
var isPlainObject_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var isPlainObject_y = x => () => x
const isPlainObject_namespaceObject = isPlainObject_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isPlainObject_116f2243__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/types/array.js
/**
* @prettier
*/
const applyArrayConstraints = function (array) {let constraints = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const { minItems, maxItems, uniqueItems } = constraints;
const { contains, minContains, maxContains } = constraints;
let constrainedArray = [...array];
if (contains != null && typeof contains === "object") {
if (Number.isInteger(minContains) && minContains > 1) {
const containsItem = constrainedArray.at(0);
for (let i = 1; i < minContains; i += 1) {
constrainedArray.unshift(containsItem);
}
}
if (Number.isInteger(maxContains) && maxContains > 0) {
/**
* This is noop. `minContains` already generate minimum required
* number of items that satisfies `contains`. `maxContains` would
* have no effect.
*/}}if (Number.isInteger(maxItems) && maxItems > 0) {constrainedArray = array.slice(0, maxItems);
}
if (Number.isInteger(minItems) && minItems > 0) {
for (let i = 0; constrainedArray.length < minItems; i += 1) {
constrainedArray.push(constrainedArray[i % constrainedArray.length]);
}
}
if (uniqueItems === true) {
/**
* If uniqueItems is true, it implies that every item in the array must be unique.
* This overrides any minItems constraint that cannot be satisfied with unique items.
* So if minItems is greater than the number of unique items,
* it should be reduced to the number of unique items.
*/
constrainedArray = Array.from(new Set(constrainedArray));
}
return constrainedArray;
};
const arrayType = (schema, _ref) => {let { sample } = _ref;
return applyArrayConstraints(sample, schema);
};
/* harmony default export */ const array = (arrayType);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/types/object.js
/**
* @prettier
*/
const objectType = () => {
throw new Error("Not implemented");
};
/* harmony default export */ const object = (objectType);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/core/random.js
/**
* @prettier
*/
/**
* Some of the functions returns constants. This is due to the nature
* of SwaggerUI expectations - provide as stable data as possible.
*
* In future, we may decide to randomize these function and provide
* true random values.
*/
const bytes = (length) => browser_default()(length);
const randexp = (pattern) => {
try {
const randexpInstance = new external_randexp_namespaceObject["default"](pattern);
return randexpInstance.gen();
} catch {
// invalid regex should not cause a crash (regex syntax varies across languages)
return "string";
}
};
const pick = (list) => {
return list.at(0);
};
const string = () => "string";
const number = () => 0;
const integer = () => 0;
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/core/predicates.js
/**
* @prettier
*/
const predicates_isBooleanJSONSchema = (schema) => {
return typeof schema === "boolean";
};
const isJSONSchemaObject = (schema) => {
return (0,isPlainObject_namespaceObject["default"])(schema);
};
const isJSONSchema = (schema) => {
return predicates_isBooleanJSONSchema(schema) || isJSONSchemaObject(schema);
};
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/email.js
/**
* @prettier
*/
const emailGenerator = () => "user@example.com";
/* harmony default export */ const email = (emailGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/idn-email.js
/**
* @prettier
*/
const idnEmailGenerator = () => "실례@example.com";
/* harmony default export */ const idn_email = (idnEmailGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/hostname.js
/**
* @prettier
*/
const hostnameGenerator = () => "example.com";
/* harmony default export */ const hostname = (hostnameGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/idn-hostname.js
/**
* @prettier
*/
const idnHostnameGenerator = () => "실례.com";
/* harmony default export */ const idn_hostname = (idnHostnameGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/ipv4.js
/**
* @prettier
*/
const ipv4Generator = () => "198.51.100.42";
/* harmony default export */ const ipv4 = (ipv4Generator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/ipv6.js
/**
* @prettier
*/
const ipv6Generator = () => "2001:0db8:5b96:0000:0000:426f:8e17:642a";
/* harmony default export */ const ipv6 = (ipv6Generator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/uri.js
/**
* @prettier
*/
const uriGenerator = () => "https://example.com/";
/* harmony default export */ const uri = (uriGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/uri-reference.js
/**
* @prettier
*/
const uriReferenceGenerator = () => "path/index.html";
/* harmony default export */ const uri_reference = (uriReferenceGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/iri.js
/**
* @prettier
*/
const iriGenerator = () => "https://실례.com/";
/* harmony default export */ const iri = (iriGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/iri-reference.js
/**
* @prettier
*/
const iriReferenceGenerator = () => "path/실례.html";
/* harmony default export */ const iri_reference = (iriReferenceGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/uuid.js
/**
* @prettier
*/
const uuidGenerator = () => "3fa85f64-5717-4562-b3fc-2c963f66afa6";
/* harmony default export */ const uuid = (uuidGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/uri-template.js
/**
* @prettier
*/
const uriTemplateGenerator = () =>
"https://example.com/dictionary/{term:1}/{term}";
/* harmony default export */ const uri_template = (uriTemplateGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/json-pointer.js
/**
* @prettier
*/
const jsonPointerGenerator = () => "/a/b/c";
/* harmony default export */ const json_pointer = (jsonPointerGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/relative-json-pointer.js
/**
* @prettier
*/
const relativeJsonPointerGenerator = () => "1/0";
/* harmony default export */ const relative_json_pointer = (relativeJsonPointerGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/date-time.js
/**
* @prettier
*/
const dateTimeGenerator = () => new Date().toISOString();
/* harmony default export */ const date_time = (dateTimeGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/date.js
/**
* @prettier
*/
const dateGenerator = () => new Date().toISOString().substring(0, 10);
/* harmony default export */ const date = (dateGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/time.js
/**
* @prettier
*/
const timeGenerator = () => new Date().toISOString().substring(11);
/* harmony default export */ const time = (timeGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/duration.js
/**
* @prettier
*/
const durationGenerator = () => "P3D"; // expresses a duration of 3 days
/* harmony default export */ const duration = (durationGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/password.js
/**
* @prettier
*/
const passwordGenerator = () => "********";
/* harmony default export */ const generators_password = (passwordGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/regex.js
/**
* @prettier
*/
const regexGenerator = () => "^[a-z]+$";
/* harmony default export */ const regex = (regexGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/class/Registry.js
/**
* @prettier
*/
class Registry {constructor() {(0,defineProperty_namespaceObject["default"])(this, "data",
{});}
register(name, value) {
this.data[name] = value;
}
unregister(name) {
if (typeof name === "undefined") {
this.data = {};
} else {
delete this.data[name];
}
}
get(name) {
return this.data[name];
}
}
/* harmony default export */ const class_Registry = (Registry);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/api/formatAPI.js
/**
* @prettier
*/
const registry = new class_Registry();
const formatAPI = (format, generator) => {
if (typeof generator === "function") {
return registry.register(format, generator);
} else if (generator === null) {
return registry.unregister(format);
}
return registry.get(format);
};
/* harmony default export */ const api_formatAPI = (formatAPI);
;// CONCATENATED MODULE: external "@babel/runtime-corejs3/helpers/classPrivateFieldGet"
var classPrivateFieldGet_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
var classPrivateFieldGet_y = x => () => x
const classPrivateFieldGet_namespaceObject = classPrivateFieldGet_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE__babel_runtime_corejs3_helpers_classPrivateFieldGet_c0aa81e1__["default"] });
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/encoders/7bit.js
/* provided dependency */ var _7bit_Buffer = __webpack_require__(764)["Buffer"];
/**
* @prettier
*/
const encode7bit = (content) => _7bit_Buffer.from(content).toString("ascii");
/* harmony default export */ const _7bit = (encode7bit);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/encoders/8bit.js
/* provided dependency */ var _8bit_Buffer = __webpack_require__(764)["Buffer"];
/**
* @prettier
*/
const encode8bit = (content) => _8bit_Buffer.from(content).toString("utf8");
/* harmony default export */ const _8bit = (encode8bit);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/encoders/binary.js
/* provided dependency */ var binary_Buffer = __webpack_require__(764)["Buffer"];
/**
* @prettier
*/
const encodeBinary = (content) => binary_Buffer.from(content).toString("binary");
/* harmony default export */ const binary = (encodeBinary);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/encoders/quoted-printable.js
/**
* @prettier
*/
const encodeQuotedPrintable = (content) => {
let quotedPrintable = "";
for (let i = 0; i < content.length; i++) {
const charCode = content.charCodeAt(i);
if (charCode === 61) {
// ASCII content of "="
quotedPrintable += "=3D";
} else if (
charCode >= 33 && charCode <= 60 ||
charCode >= 62 && charCode <= 126 ||
charCode === 9 ||
charCode === 32)
{
quotedPrintable += content.charAt(i);
} else if (charCode === 13 || charCode === 10) {
quotedPrintable += "\r\n";
} else if (charCode > 126) {
// convert non-ASCII characters to UTF-8 and encode each byte
const utf8 = unescape(encodeURIComponent(content.charAt(i)));
for (let j = 0; j < utf8.length; j++) {
quotedPrintable +=
"=" + ("0" + utf8.charCodeAt(j).toString(16)).slice(-2).toUpperCase();
}
} else {
quotedPrintable +=
"=" + ("0" + charCode.toString(16)).slice(-2).toUpperCase();
}
}
return quotedPrintable;
};
/* harmony default export */ const quoted_printable = (encodeQuotedPrintable);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/encoders/base16.js
/* provided dependency */ var base16_Buffer = __webpack_require__(764)["Buffer"];
/**
* @prettier
*/
const encodeBase16 = (content) => base16_Buffer.from(content).toString("hex");
/* harmony default export */ const base16 = (encodeBase16);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/encoders/base32.js
/* provided dependency */ var base32_Buffer = __webpack_require__(764)["Buffer"];
/**
* @prettier
*/
const encodeBase32 = (content) => {
const utf8Value = base32_Buffer.from(content).toString("utf8");
const base32Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
let paddingCount = 0;
let base32Str = "";
let buffer = 0;
let bufferLength = 0;
for (let i = 0; i < utf8Value.length; i++) {
buffer = buffer << 8 | utf8Value.charCodeAt(i);
bufferLength += 8;
while (bufferLength >= 5) {
base32Str += base32Alphabet.charAt(buffer >>> bufferLength - 5 & 31);
bufferLength -= 5;
}
}
if (bufferLength > 0) {
base32Str += base32Alphabet.charAt(buffer << 5 - bufferLength & 31);
paddingCount = (8 - utf8Value.length * 8 % 5) % 5;
}
for (let i = 0; i < paddingCount; i++) {
base32Str += "=";
}
return base32Str;
};
/* harmony default export */ const base32 = (encodeBase32);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/encoders/base64.js
/* provided dependency */ var base64_Buffer = __webpack_require__(764)["Buffer"];
/**
* @prettier
*/
const encodeBase64 = (content) => base64_Buffer.from(content).toString("base64");
/* harmony default export */ const base64 = (encodeBase64);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/class/EncoderRegistry.js
function _classPrivateFieldInitSpec(obj, privateMap, value) {_checkPrivateRedeclaration(obj, privateMap);privateMap.set(obj, value);}function _checkPrivateRedeclaration(obj, privateCollection) {if (privateCollection.has(obj)) {throw new TypeError("Cannot initialize the same private elements twice on an object");}} /**
* @prettier
*/
var _defaults = /*#__PURE__*/new WeakMap();
class EncoderRegistry extends class_Registry {constructor() {super(...arguments);_classPrivateFieldInitSpec(this, _defaults, { writable: true, value:
{
"7bit": _7bit,
"8bit": _8bit,
binary: binary,
"quoted-printable": quoted_printable,
base16: base16,
base32: base32,
base64: base64
} });(0,defineProperty_namespaceObject["default"])(this, "data", (0,objectSpread2_namespaceObject["default"])({}, (0,classPrivateFieldGet_namespaceObject["default"])(
this, _defaults)));}
get defaults() {
return (0,objectSpread2_namespaceObject["default"])({}, (0,classPrivateFieldGet_namespaceObject["default"])(this, _defaults));
}
}
/* harmony default export */ const class_EncoderRegistry = (EncoderRegistry);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/api/encoderAPI.js
/**
* @prettier
*/
const encoderAPI_registry = new class_EncoderRegistry();
const encoderAPI = (encodingName, encoder) => {
if (typeof encoder === "function") {
return encoderAPI_registry.register(encodingName, encoder);
} else if (encoder === null) {
return encoderAPI_registry.unregister(encodingName);
}
return encoderAPI_registry.get(encodingName);
};
encoderAPI.getDefaults = () => encoderAPI_registry.defaults;
/* harmony default export */ const api_encoderAPI = (encoderAPI);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/media-types/text.js
/**
* @prettier
*/
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
const textMediaTypesGenerators = {
"text/plain": () => "string",
"text/css": () => ".selector { border: 1px solid red }",
"text/csv": () => "value1,value2,value3",
"text/html": () => "content
",
"text/calendar": () => "BEGIN:VCALENDAR",
"text/javascript": () => "console.dir('Hello world!');",
"text/xml": () => 'John Doe',
"text/*": () => "string"
};
/* harmony default export */ const media_types_text = (textMediaTypesGenerators);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/media-types/image.js
/**
* @prettier
*/
const imageMediaTypesGenerators = {
"image/*": () => bytes(25).toString("binary")
};
/* harmony default export */ const media_types_image = (imageMediaTypesGenerators);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/media-types/audio.js
/**
* @prettier
*/
const audioMediaTypesGenerators = {
"audio/*": () => bytes(25).toString("binary")
};
/* harmony default export */ const audio = (audioMediaTypesGenerators);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/media-types/video.js
/**
* @prettier
*/
const videoMediaTypesGenerators = {
"video/*": () => bytes(25).toString("binary")
};
/* harmony default export */ const video = (videoMediaTypesGenerators);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/media-types/application.js
/**
* @prettier
*/
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
const applicationMediaTypesGenerators = {
"application/json": () => '{"key":"value"}',
"application/ld+json": () => '{"name": "John Doe"}',
"application/x-httpd-php": () => "Hello World!
'; ?>",
"application/rtf": () => String.raw`{\rtf1\adeflang1025\ansi\ansicpg1252\uc1`,
"application/x-sh": () => 'echo "Hello World!"',
"application/xhtml+xml": () => "content
",
"application/*": () => bytes(25).toString("binary")
};
/* harmony default export */ const application = (applicationMediaTypesGenerators);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/class/MediaTypeRegistry.js
function MediaTypeRegistry_classPrivateFieldInitSpec(obj, privateMap, value) {MediaTypeRegistry_checkPrivateRedeclaration(obj, privateMap);privateMap.set(obj, value);}function MediaTypeRegistry_checkPrivateRedeclaration(obj, privateCollection) {if (privateCollection.has(obj)) {throw new TypeError("Cannot initialize the same private elements twice on an object");}} /**
* @prettier
*/
var MediaTypeRegistry_defaults = /*#__PURE__*/new WeakMap();
class MediaTypeRegistry extends class_Registry {constructor() {super(...arguments);MediaTypeRegistry_classPrivateFieldInitSpec(this, MediaTypeRegistry_defaults, { writable: true, value: (0,objectSpread2_namespaceObject["default"])((0,objectSpread2_namespaceObject["default"])((0,objectSpread2_namespaceObject["default"])((0,objectSpread2_namespaceObject["default"])((0,objectSpread2_namespaceObject["default"])({},
media_types_text),
media_types_image),
audio),
video),
application) });(0,defineProperty_namespaceObject["default"])(this, "data", (0,objectSpread2_namespaceObject["default"])({}, (0,classPrivateFieldGet_namespaceObject["default"])(
this, MediaTypeRegistry_defaults)));}
get defaults() {
return (0,objectSpread2_namespaceObject["default"])({}, (0,classPrivateFieldGet_namespaceObject["default"])(this, MediaTypeRegistry_defaults));
}
}
/* harmony default export */ const class_MediaTypeRegistry = (MediaTypeRegistry);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/api/mediaTypeAPI.js
/**
* @prettier
*/
const mediaTypeAPI_registry = new class_MediaTypeRegistry();
const mediaTypeAPI = (mediaType, generator) => {
if (typeof generator === "function") {
return mediaTypeAPI_registry.register(mediaType, generator);
} else if (generator === null) {
return mediaTypeAPI_registry.unregister(mediaType);
}
const mediaTypeNoParams = mediaType.split(";").at(0);
const topLevelMediaType = `${mediaTypeNoParams.split("/").at(0)}/*`;
return (
mediaTypeAPI_registry.get(mediaType) ||
mediaTypeAPI_registry.get(mediaTypeNoParams) ||
mediaTypeAPI_registry.get(topLevelMediaType));
};
mediaTypeAPI.getDefaults = () => mediaTypeAPI_registry.defaults;
/* harmony default export */ const api_mediaTypeAPI = (mediaTypeAPI);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/types/string.js
/**
* @prettier
*/
const generateFormat = (schema) => {
const { format } = schema;
const formatGenerator = api_formatAPI(format);
if (typeof formatGenerator === "function") {
return formatGenerator(schema);
}
switch (format) {
case "email":{
return email();
}
case "idn-email":{
return idn_email();
}
case "hostname":{
return hostname();
}
case "idn-hostname":{
return idn_hostname();
}
case "ipv4":{
return ipv4();
}
case "ipv6":{
return ipv6();
}
case "uri":{
return uri();
}
case "uri-reference":{
return uri_reference();
}
case "iri":{
return iri();
}
case "iri-reference":{
return iri_reference();
}
case "uuid":{
return uuid();
}
case "uri-template":{
return uri_template();
}
case "json-pointer":{
return json_pointer();
}
case "relative-json-pointer":{
return relative_json_pointer();
}
case "date-time":{
return date_time();
}
case "date":{
return date();
}
case "time":{
return time();
}
case "duration":{
return duration();
}
case "password":{
return generators_password();
}
case "regex":{
return regex();
}
}
return string();
};
const applyStringConstraints = function (string) {let constraints = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const { maxLength, minLength } = constraints;
let constrainedString = string;
if (Number.isInteger(maxLength) && maxLength > 0) {
constrainedString = constrainedString.slice(0, maxLength);
}
if (Number.isInteger(minLength) && minLength > 0) {
let i = 0;
while (constrainedString.length < minLength) {
constrainedString += constrainedString[i++ % constrainedString.length];
}
}
return constrainedString;
};
const stringType = function (schema) {let { sample } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const { contentEncoding, contentMediaType, contentSchema } = schema;
const { pattern, format } = schema;
const encode = api_encoderAPI(contentEncoding) || identity_namespaceObject["default"];
let generatedString;
if (typeof pattern === "string") {
generatedString = randexp(pattern);
} else if (typeof format === "string") {
generatedString = generateFormat(schema);
} else if (
isJSONSchema(contentSchema) &&
typeof contentMediaType === "string" &&
typeof sample !== "undefined")
{
if (Array.isArray(sample) || typeof sample === "object") {
generatedString = JSON.stringify(sample);
} else {
generatedString = String(sample);
}
} else if (typeof contentMediaType === "string") {
const mediaTypeGenerator = api_mediaTypeAPI(contentMediaType);
if (typeof mediaTypeGenerator === "function") {
generatedString = mediaTypeGenerator(schema);
}
} else {
generatedString = string();
}
return encode(applyStringConstraints(generatedString, schema));
};
/* harmony default export */ const types_string = (stringType);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/float.js
/**
* @prettier
*/
const floatGenerator = () => 0.1;
/* harmony default export */ const generators_float = (floatGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/double.js
/**
* @prettier
*/
const doubleGenerator = () => 0.1;
/* harmony default export */ const generators_double = (doubleGenerator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/types/number.js
/**
* @prettier
*/
const number_generateFormat = (schema) => {
const { format } = schema;
const formatGenerator = api_formatAPI(format);
if (typeof formatGenerator === "function") {
return formatGenerator(schema);
}
switch (format) {
case "float":{
return generators_float();
}
case "double":{
return generators_double();
}
}
return number();
};
const applyNumberConstraints = function (number) {let constraints = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum } = constraints;
const { multipleOf } = constraints;
const epsilon = Number.isInteger(number) ? 1 : Number.EPSILON;
let minValue = typeof minimum === "number" ? minimum : null;
let maxValue = typeof maximum === "number" ? maximum : null;
let constrainedNumber = number;
if (typeof exclusiveMinimum === "number") {
minValue =
minValue !== null ?
Math.max(minValue, exclusiveMinimum + epsilon) :
exclusiveMinimum + epsilon;
}
if (typeof exclusiveMaximum === "number") {
maxValue =
maxValue !== null ?
Math.min(maxValue, exclusiveMaximum - epsilon) :
exclusiveMaximum - epsilon;
}
constrainedNumber =
minValue > maxValue && number || minValue || maxValue || constrainedNumber;
if (typeof multipleOf === "number" && multipleOf > 0) {
const remainder = constrainedNumber % multipleOf;
constrainedNumber =
remainder === 0 ?
constrainedNumber :
constrainedNumber + multipleOf - remainder;
}
return constrainedNumber;
};
const numberType = (schema) => {
const { format } = schema;
let generatedNumber;
if (typeof format === "string") {
generatedNumber = number_generateFormat(schema);
} else {
generatedNumber = number();
}
return applyNumberConstraints(generatedNumber, schema);
};
/* harmony default export */ const types_number = (numberType);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/int32.js
/**
* @prettier
*/
const int32Generator = () => 2 ** 30 >>> 0;
/* harmony default export */ const int32 = (int32Generator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/generators/int64.js
/**
* @prettier
*/
const int64Generator = () => 2 ** 53 - 1;
/* harmony default export */ const int64 = (int64Generator);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/types/integer.js
/**
* @prettier
*/
const integer_generateFormat = (schema) => {
const { format } = schema;
const formatGenerator = api_formatAPI(format);
if (typeof formatGenerator === "function") {
return formatGenerator(schema);
}
switch (format) {
case "int32":{
return int32();
}
case "int64":{
return int64();
}
}
return integer();
};
const integerType = (schema) => {
const { format } = schema;
if (typeof format === "string") {
return integer_generateFormat(schema);
}
return integer();
};
/* harmony default export */ const types_integer = (integerType);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/types/boolean.js
/**
* @prettier
*/
const booleanType = (schema) => {
return typeof schema.default === "boolean" ? schema.default : true;
};
/* harmony default export */ const types_boolean = (booleanType);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/types/null.js
/**
* @prettier
*/
const nullType = () => {
return null;
};
/* harmony default export */ const types_null = (nullType);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/types/index.js
/**
* @prettier
*/
const typeMap = {
array: array,
object: object,
string: types_string,
number: types_number,
integer: types_integer,
boolean: types_boolean,
null: types_null
};
/* harmony default export */ const types = (new Proxy(typeMap, {
get(target, prop) {
if (typeof prop === "string" && Object.hasOwn(target, prop)) {
return target[prop];
}
return () => `Unknown Type: ${prop}`;
}
}));
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/core/constants.js
/**
* @prettier
*/
const SCALAR_TYPES = ["number", "integer", "string", "boolean", "null"];
const ALL_TYPES = ["array", "object", ...SCALAR_TYPES];
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/core/example.js
/**
* @prettier
*/
/**
* Precedence of keywords that provides author defined values (top of the list = higher priority)
*
* ### examples
* Array containing example values for the item defined by the schema.
* Not guaranteed to be valid or invalid against the schema
*
* ### default
* Default value for an item defined by the schema.
* Is expected to be a valid instance of the schema.
*
* ### example
* Deprecated. Part of OpenAPI 3.1.0 Schema Object dialect.
* Represents single example. Equivalent of `examples` keywords
* with single item.
*/
const hasExample = (schema) => {
if (!isJSONSchemaObject(schema)) return false;
const { examples, example, default: defaultVal } = schema;
if (Array.isArray(examples) && examples.length >= 1) {
return true;
}
if (typeof defaultVal !== "undefined") {
return true;
}
return typeof example !== "undefined";
};
const extractExample = (schema) => {
if (!isJSONSchemaObject(schema)) return null;
const { examples, example, default: defaultVal } = schema;
if (Array.isArray(examples) && examples.length >= 1) {
return examples.at(0);
}
if (typeof defaultVal !== "undefined") {
return defaultVal;
}
if (typeof example !== "undefined") {
return example;
}
return undefined;
};
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/core/type.js
/**
* @prettier
*/
const inferringKeywords = {
array: [
"items",
"prefixItems",
"contains",
"maxContains",
"minContains",
"maxItems",
"minItems",
"uniqueItems",
"unevaluatedItems"],
object: [
"properties",
"additionalProperties",
"patternProperties",
"propertyNames",
"minProperties",
"maxProperties",
"required",
"dependentSchemas",
"dependentRequired",
"unevaluatedProperties"],
string: [
"pattern",
"format",
"minLength",
"maxLength",
"contentEncoding",
"contentMediaType",
"contentSchema"],
integer: [
"minimum",
"maximum",
"exclusiveMinimum",
"exclusiveMaximum",
"multipleOf"]
};
inferringKeywords.number = inferringKeywords.integer;
const fallbackType = "string";
const inferTypeFromValue = (value) => {
if (typeof value === "undefined") return null;
if (value === null) return "null";
if (Array.isArray(value)) return "array";
if (Number.isInteger(value)) return "integer";
return typeof value;
};
const foldType = (type) => {
if (Array.isArray(type) && type.length >= 1) {
if (type.includes("array")) {
return "array";
} else if (type.includes("object")) {
return "object";
} else {
const pickedType = pick(type);
if (ALL_TYPES.includes(pickedType)) {
return pickedType;
}
}
}
if (ALL_TYPES.includes(type)) {
return type;
}
return null;
};
const inferType = function (schema) {let processedSchemas = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new WeakSet();
if (!isJSONSchemaObject(schema)) return fallbackType;
if (processedSchemas.has(schema)) return fallbackType;
processedSchemas.add(schema);
let { type, const: constant } = schema;
type = foldType(type);
// inferring type from inferring keywords
if (typeof type !== "string") {
const inferringTypes = Object.keys(inferringKeywords);
interrupt: for (let i = 0; i < inferringTypes.length; i += 1) {
const inferringType = inferringTypes[i];
const inferringTypeKeywords = inferringKeywords[inferringType];
for (let j = 0; j < inferringTypeKeywords.length; j += 1) {
const inferringKeyword = inferringTypeKeywords[j];
if (Object.hasOwn(schema, inferringKeyword)) {
type = inferringType;
break interrupt;
}
}
}
}
// inferring type from const keyword
if (typeof type !== "string" && typeof constant !== "undefined") {
const constType = inferTypeFromValue(constant);
type = typeof constType === "string" ? constType : type;
}
// inferring type from combining schemas
if (typeof type !== "string") {
const combineTypes = (keyword) => {
if (Array.isArray(schema[keyword])) {
const combinedTypes = schema[keyword].map((subSchema) =>
inferType(subSchema, processedSchemas)
);
return foldType(combinedTypes);
}
return null;
};
const allOf = combineTypes("allOf");
const anyOf = combineTypes("anyOf");
const oneOf = combineTypes("oneOf");
const not = schema.not ? inferType(schema.not, processedSchemas) : null;
if (allOf || anyOf || oneOf || not) {
type = foldType([allOf, anyOf, oneOf, not].filter(Boolean));
}
}
// inferring type from example
if (typeof type !== "string" && hasExample(schema)) {
const example = extractExample(schema);
const exampleType = inferTypeFromValue(example);
type = typeof exampleType === "string" ? exampleType : type;
}
processedSchemas.delete(schema);
return type || fallbackType;
};
const type_getType = (schema) => {
return inferType(schema);
};
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/core/utils.js
/**
* @prettier
*/
const fromJSONBooleanSchema = (schema) => {
if (schema === false) {
return { not: {} };
}
return {};
};
const typeCast = (schema) => {
if (predicates_isBooleanJSONSchema(schema)) {
return fromJSONBooleanSchema(schema);
}
if (!isJSONSchemaObject(schema)) {
return {};
}
return schema;
};
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/core/merge.js
/**
* @prettier
*/
const merge = function (target, source) {let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
if (predicates_isBooleanJSONSchema(target) && target === true) return true;
if (predicates_isBooleanJSONSchema(target) && target === false) return false;
if (predicates_isBooleanJSONSchema(source) && source === true) return true;
if (predicates_isBooleanJSONSchema(source) && source === false) return false;
if (!isJSONSchema(target)) return source;
if (!isJSONSchema(source)) return target;
/**
* Merging properties from the source object into the target object
* only if they do not already exist in the target object.
*/
const merged = (0,objectSpread2_namespaceObject["default"])((0,objectSpread2_namespaceObject["default"])({}, source), target);
// merging the type keyword
if (source.type && target.type) {
if (Array.isArray(source.type) && typeof source.type === "string") {
const mergedType = normalizeArray(source.type).concat(target.type);
merged.type = Array.from(new Set(mergedType));
}
}
// merging required keyword
if (Array.isArray(source.required) && Array.isArray(target.required)) {
merged.required = [...new Set([...target.required, ...source.required])];
}
// merging properties keyword
if (source.properties && target.properties) {
const allPropertyNames = new Set([
...Object.keys(source.properties),
...Object.keys(target.properties)]
);
merged.properties = {};
for (const name of allPropertyNames) {
const sourceProperty = source.properties[name] || {};
const targetProperty = target.properties[name] || {};
if (
sourceProperty.readOnly && !config.includeReadOnly ||
sourceProperty.writeOnly && !config.includeWriteOnly)
{
merged.required = (merged.required || []).filter((p) => p !== name);
} else {
merged.properties[name] = merge(targetProperty, sourceProperty, config);
}
}
}
// merging items keyword
if (isJSONSchema(source.items) && isJSONSchema(target.items)) {
merged.items = merge(target.items, source.items, config);
}
// merging contains keyword
if (isJSONSchema(source.contains) && isJSONSchema(target.contains)) {
merged.contains = merge(target.contains, source.contains, config);
}
// merging contentSchema keyword
if (
isJSONSchema(source.contentSchema) &&
isJSONSchema(target.contentSchema))
{
merged.contentSchema = merge(
target.contentSchema,
source.contentSchema,
config
);
}
return merged;
};
/* harmony default export */ const core_merge = (merge);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/main.js
/**
* @prettier
*/
const main_sampleFromSchemaGeneric = function (
schema)
{var _schema;let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};let exampleOverride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;let respectXML = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if (typeof ((_schema = schema) === null || _schema === void 0 ? void 0 : _schema.toJS) === "function") schema = schema.toJS();
schema = typeCast(schema);
let usePlainValue = exampleOverride !== undefined || hasExample(schema);
// first check if there is the need of combining this schema with others required by allOf
const hasOneOf =
!usePlainValue && Array.isArray(schema.oneOf) && schema.oneOf.length > 0;
const hasAnyOf =
!usePlainValue && Array.isArray(schema.anyOf) && schema.anyOf.length > 0;
if (!usePlainValue && (hasOneOf || hasAnyOf)) {
const schemaToAdd = typeCast(
hasOneOf ? pick(schema.oneOf) : pick(schema.anyOf)
);
schema = core_merge(schema, schemaToAdd, config);
if (!schema.xml && schemaToAdd.xml) {
schema.xml = schemaToAdd.xml;
}
if (hasExample(schema) && hasExample(schemaToAdd)) {
usePlainValue = true;
}
}
const _attr = {};
let { xml, properties, additionalProperties, items, contains } = schema || {};
let type = type_getType(schema);
let { includeReadOnly, includeWriteOnly } = config;
xml = xml || {};
let { name, prefix, namespace } = xml;
let displayName;
let res = {};
if (!Object.hasOwn(schema, "type")) {
schema.type = type;
}
// set xml naming and attributes
if (respectXML) {
name = name || "notagname";
// add prefix to name if exists
displayName = (prefix ? `${prefix}:` : "") + name;
if (namespace) {
//add prefix to namespace if exists
let namespacePrefix = prefix ? `xmlns:${prefix}` : "xmlns";
_attr[namespacePrefix] = namespace;
}
}
// init xml default response sample obj
if (respectXML) {
res[displayName] = [];
}
// add to result helper init for xml or json
const props = objectify(properties);
let addPropertyToResult;
let propertyAddedCounter = 0;
const hasExceededMaxProperties = () =>
Number.isInteger(schema.maxProperties) &&
schema.maxProperties > 0 &&
propertyAddedCounter >= schema.maxProperties;
const requiredPropertiesToAdd = () => {
if (!Array.isArray(schema.required) || schema.required.length === 0) {
return 0;
}
let addedCount = 0;
if (respectXML) {
schema.required.forEach(
(key) => addedCount += res[key] === undefined ? 0 : 1
);
} else {
schema.required.forEach((key) => {var _res$displayName;
addedCount +=
((_res$displayName = res[displayName]) === null || _res$displayName === void 0 ? void 0 : _res$displayName.find((x) => x[key] !== undefined)) === undefined ?
0 :
1;
});
}
return schema.required.length - addedCount;
};
const isOptionalProperty = (propName) => {
if (!Array.isArray(schema.required)) return true;
if (schema.required.length === 0) return true;
return !schema.required.includes(propName);
};
const canAddProperty = (propName) => {
if (!(Number.isInteger(schema.maxProperties) && schema.maxProperties > 0)) {
return true;
}
if (hasExceededMaxProperties()) {
return false;
}
if (!isOptionalProperty(propName)) {
return true;
}
return (
schema.maxProperties - propertyAddedCounter - requiredPropertiesToAdd() >
0);
};
if (respectXML) {
addPropertyToResult = function (propName) {let overrideE = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
if (schema && props[propName]) {
// case it is a xml attribute
props[propName].xml = props[propName].xml || {};
if (props[propName].xml.attribute) {
const enumAttrVal = Array.isArray(props[propName].enum) ?
pick(props[propName].enum) :
undefined;
if (hasExample(props[propName])) {
_attr[props[propName].xml.name || propName] = extractExample(
props[propName]
);
} else if (enumAttrVal !== undefined) {
_attr[props[propName].xml.name || propName] = enumAttrVal;
} else {
const propSchema = typeCast(props[propName]);
const propSchemaType = type_getType(propSchema);
const attrName = props[propName].xml.name || propName;
_attr[attrName] = types[propSchemaType](propSchema);
}
return;
}
props[propName].xml.name = props[propName].xml.name || propName;
} else if (!props[propName] && additionalProperties !== false) {
// case only additionalProperty that is not defined in schema
props[propName] = {
xml: {
name: propName
}
};
}
let t = main_sampleFromSchemaGeneric(
props[propName],
config,
overrideE,
respectXML
);
if (!canAddProperty(propName)) {
return;
}
propertyAddedCounter++;
if (Array.isArray(t)) {
res[displayName] = res[displayName].concat(t);
} else {
res[displayName].push(t);
}
};
} else {
addPropertyToResult = (propName, overrideE) => {var _schema$discriminator;
if (!canAddProperty(propName)) {
return;
}
if (
(0,isPlainObject_namespaceObject["default"])((_schema$discriminator = schema.discriminator) === null || _schema$discriminator === void 0 ? void 0 : _schema$discriminator.mapping) &&
schema.discriminator.propertyName === propName &&
typeof schema.$$ref === "string")
{
for (const pair in schema.discriminator.mapping) {
if (schema.$$ref.search(schema.discriminator.mapping[pair]) !== -1) {
res[propName] = pair;
break;
}
}
} else {
res[propName] = main_sampleFromSchemaGeneric(
props[propName],
config,
overrideE,
respectXML
);
}
propertyAddedCounter++;
};
}
// check for plain value and if found use it to generate sample from it
if (usePlainValue) {
let sample;
if (exampleOverride !== undefined) {
sample = exampleOverride;
} else {
sample = extractExample(schema);
}
// if json just return
if (!respectXML) {
// spacial case yaml parser can not know about
if (typeof sample === "number" && type === "string") {
return `${sample}`;
}
// return if sample does not need any parsing
if (typeof sample !== "string" || type === "string") {
return sample;
}
// check if sample is parsable or just a plain string
try {
return JSON.parse(sample);
} catch {
// sample is just plain string return it
return sample;
}
}
// generate xml sample recursively for array case
if (type === "array") {
if (!Array.isArray(sample)) {
if (typeof sample === "string") {
return sample;
}
sample = [sample];
}
let itemSamples = [];
if (isJSONSchemaObject(items)) {
items.xml = items.xml || xml || {};
items.xml.name = items.xml.name || xml.name;
itemSamples = sample.map((s) =>
main_sampleFromSchemaGeneric(items, config, s, respectXML)
);
}
if (isJSONSchemaObject(contains)) {
contains.xml = contains.xml || xml || {};
contains.xml.name = contains.xml.name || xml.name;
itemSamples = [
main_sampleFromSchemaGeneric(contains, config, undefined, respectXML),
...itemSamples];
}
itemSamples = types.array(schema, { sample: itemSamples });
if (xml.wrapped) {
res[displayName] = itemSamples;
if (!(0,isEmpty_namespaceObject["default"])(_attr)) {
res[displayName].push({ _attr: _attr });
}
} else {
res = itemSamples;
}
return res;
}
// generate xml sample recursively for object case
if (type === "object") {
// case literal example
if (typeof sample === "string") {
return sample;
}
for (const propName in sample) {var _props$propName, _props$propName2, _props$propName3;
if (!Object.hasOwn(sample, propName)) {
continue;
}
if ((_props$propName = props[propName]) !== null && _props$propName !== void 0 && _props$propName.readOnly && !includeReadOnly) {
continue;
}
if ((_props$propName2 = props[propName]) !== null && _props$propName2 !== void 0 && _props$propName2.writeOnly && !includeWriteOnly) {
continue;
}
if ((_props$propName3 = props[propName]) !== null && _props$propName3 !== void 0 && (_props$propName3 = _props$propName3.xml) !== null && _props$propName3 !== void 0 && _props$propName3.attribute) {
_attr[props[propName].xml.name || propName] = sample[propName];
continue;
}
addPropertyToResult(propName, sample[propName]);
}
if (!(0,isEmpty_namespaceObject["default"])(_attr)) {
res[displayName].push({ _attr: _attr });
}
return res;
}
res[displayName] = !(0,isEmpty_namespaceObject["default"])(_attr) ? [{ _attr: _attr }, sample] : sample;
return res;
}
// use schema to generate sample
if (type === "array") {
let sampleArray = [];
if (isJSONSchemaObject(contains)) {
if (respectXML) {
contains.xml = contains.xml || schema.xml || {};
contains.xml.name = contains.xml.name || xml.name;
}
if (Array.isArray(contains.anyOf)) {
sampleArray.push(
...contains.anyOf.map((anyOfSchema) =>
main_sampleFromSchemaGeneric(
core_merge(anyOfSchema, contains, config),
config,
undefined,
respectXML
)
)
);
} else if (Array.isArray(contains.oneOf)) {
sampleArray.push(
...contains.oneOf.map((oneOfSchema) =>
main_sampleFromSchemaGeneric(
core_merge(oneOfSchema, contains, config),
config,
undefined,
respectXML
)
)
);
} else if (!respectXML || respectXML && xml.wrapped) {
sampleArray.push(
main_sampleFromSchemaGeneric(contains, config, undefined, respectXML)
);
} else {
return main_sampleFromSchemaGeneric(contains, config, undefined, respectXML);
}
}
if (isJSONSchemaObject(items)) {
if (respectXML) {
items.xml = items.xml || schema.xml || {};
items.xml.name = items.xml.name || xml.name;
}
if (Array.isArray(items.anyOf)) {
sampleArray.push(
...items.anyOf.map((i) =>
main_sampleFromSchemaGeneric(
core_merge(i, items, config),
config,
undefined,
respectXML
)
)
);
} else if (Array.isArray(items.oneOf)) {
sampleArray.push(
...items.oneOf.map((i) =>
main_sampleFromSchemaGeneric(
core_merge(i, items, config),
config,
undefined,
respectXML
)
)
);
} else if (!respectXML || respectXML && xml.wrapped) {
sampleArray.push(
main_sampleFromSchemaGeneric(items, config, undefined, respectXML)
);
} else {
return main_sampleFromSchemaGeneric(items, config, undefined, respectXML);
}
}
sampleArray = types.array(schema, { sample: sampleArray });
if (respectXML && xml.wrapped) {
res[displayName] = sampleArray;
if (!(0,isEmpty_namespaceObject["default"])(_attr)) {
res[displayName].push({ _attr: _attr });
}
return res;
}
return sampleArray;
}
if (type === "object") {
for (let propName in props) {var _props$propName4, _props$propName5, _props$propName6;
if (!Object.hasOwn(props, propName)) {
continue;
}
if ((_props$propName4 = props[propName]) !== null && _props$propName4 !== void 0 && _props$propName4.deprecated) {
continue;
}
if ((_props$propName5 = props[propName]) !== null && _props$propName5 !== void 0 && _props$propName5.readOnly && !includeReadOnly) {
continue;
}
if ((_props$propName6 = props[propName]) !== null && _props$propName6 !== void 0 && _props$propName6.writeOnly && !includeWriteOnly) {
continue;
}
addPropertyToResult(propName);
}
if (respectXML && _attr) {
res[displayName].push({ _attr: _attr });
}
if (hasExceededMaxProperties()) {
return res;
}
if (predicates_isBooleanJSONSchema(additionalProperties) && additionalProperties) {
if (respectXML) {
res[displayName].push({ additionalProp: "Anything can be here" });
} else {
res.additionalProp1 = {};
}
propertyAddedCounter++;
} else if (isJSONSchemaObject(additionalProperties)) {var _additionalProps$xml, _additionalProps$xml2;
const additionalProps = additionalProperties;
const additionalPropSample = main_sampleFromSchemaGeneric(
additionalProps,
config,
undefined,
respectXML
);
if (
respectXML &&
typeof (additionalProps === null || additionalProps === void 0 || (_additionalProps$xml = additionalProps.xml) === null || _additionalProps$xml === void 0 ? void 0 : _additionalProps$xml.name) === "string" &&
(additionalProps === null || additionalProps === void 0 || (_additionalProps$xml2 = additionalProps.xml) === null || _additionalProps$xml2 === void 0 ? void 0 : _additionalProps$xml2.name) !== "notagname")
{
res[displayName].push(additionalPropSample);
} else {
const toGenerateCount =
Number.isInteger(schema.minProperties) &&
schema.minProperties > 0 &&
propertyAddedCounter < schema.minProperties ?
schema.minProperties - propertyAddedCounter :
3;
for (let i = 1; i <= toGenerateCount; i++) {
if (hasExceededMaxProperties()) {
return res;
}
if (respectXML) {
const temp = {};
temp["additionalProp" + i] = additionalPropSample["notagname"];
res[displayName].push(temp);
} else {
res["additionalProp" + i] = additionalPropSample;
}
propertyAddedCounter++;
}
}
}
return res;
}
let value;
if (typeof schema.const !== "undefined") {
// display const value
value = schema.const;
} else if (schema && Array.isArray(schema.enum)) {
//display enum first value
value = pick(normalizeArray(schema.enum));
} else {
// display schema default
const contentSample = isJSONSchemaObject(schema.contentSchema) ?
main_sampleFromSchemaGeneric(
schema.contentSchema,
config,
undefined,
respectXML
) :
undefined;
value = types[type](schema, { sample: contentSample });
}
if (respectXML) {
res[displayName] = !(0,isEmpty_namespaceObject["default"])(_attr) ? [{ _attr: _attr }, value] : value;
return res;
}
return value;
};
const main_createXMLExample = (schema, config, o) => {
const json = main_sampleFromSchemaGeneric(schema, config, o, true);
if (!json) {
return;
}
if (typeof json === "string") {
return json;
}
return (0,external_xml_namespaceObject["default"])(json, { declaration: true, indent: "\t" });
};
const main_sampleFromSchema = (schema, config, o) => {
return main_sampleFromSchemaGeneric(schema, config, o, false);
};
const main_resolver = (arg1, arg2, arg3) => [
arg1,
JSON.stringify(arg2),
JSON.stringify(arg3)];
const main_memoizedCreateXMLExample = utils_memoizeN(main_createXMLExample, main_resolver);
const main_memoizedSampleFromSchema = utils_memoizeN(main_sampleFromSchema, main_resolver);
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/samples-extensions/fn/index.js
/**
* @prettier
*/
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/hoc.jsx
/**
* @prettier
*/
const withJSONSchemaContext = function (Component) {let overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const value = {
components: (0,objectSpread2_namespaceObject["default"])({
JSONSchema: JSONSchema_JSONSchema,
Keyword$schema: keywords_$schema,
Keyword$vocabulary: $vocabulary_$vocabulary,
Keyword$id: keywords_$id,
Keyword$anchor: keywords_$anchor,
Keyword$dynamicAnchor: keywords_$dynamicAnchor,
Keyword$ref: keywords_$ref,
Keyword$dynamicRef: keywords_$dynamicRef,
Keyword$defs: keywords_$defs,
Keyword$comment: keywords_$comment,
KeywordAllOf: keywords_AllOf,
KeywordAnyOf: keywords_AnyOf,
KeywordOneOf: keywords_OneOf,
KeywordNot: keywords_Not,
KeywordIf: keywords_If,
KeywordThen: keywords_Then,
KeywordElse: keywords_Else,
KeywordDependentSchemas: keywords_DependentSchemas,
KeywordPrefixItems: keywords_PrefixItems,
KeywordItems: keywords_Items,
KeywordContains: keywords_Contains,
KeywordProperties: keywords_Properties_Properties,
KeywordPatternProperties: PatternProperties_PatternProperties,
KeywordAdditionalProperties: keywords_AdditionalProperties,
KeywordPropertyNames: keywords_PropertyNames,
KeywordUnevaluatedItems: keywords_UnevaluatedItems,
KeywordUnevaluatedProperties: keywords_UnevaluatedProperties,
KeywordType: keywords_Type,
KeywordEnum: Enum_Enum,
KeywordConst: keywords_Const,
KeywordConstraint: Constraint_Constraint,
KeywordDependentRequired: DependentRequired_DependentRequired,
KeywordContentSchema: keywords_ContentSchema,
KeywordTitle: Title_Title,
KeywordDescription: keywords_Description_Description,
KeywordDefault: keywords_Default,
KeywordDeprecated: keywords_Deprecated,
KeywordReadOnly: keywords_ReadOnly,
KeywordWriteOnly: keywords_WriteOnly,
Accordion: Accordion_Accordion,
ExpandDeepButton: ExpandDeepButton_ExpandDeepButton,
ChevronRightIcon: icons_ChevronRight },
overrides.components),
config: (0,objectSpread2_namespaceObject["default"])({
default$schema: "https://json-schema.org/draft/2020-12/schema",
/**
* Defines an upper exclusive boundary of the level range for automatic expansion.
*
* 0 -> do nothing
* 1 -> [0]...(1)
* 2 -> [0]...(2)
* 3 -> [0]...(3)
*/
defaultExpandedLevels: 0 },
overrides.config),
fn: (0,objectSpread2_namespaceObject["default"])({
upperFirst: fn_upperFirst,
getTitle: getTitle,
getType: getType,
isBooleanJSONSchema: isBooleanJSONSchema,
hasKeyword: hasKeyword,
isExpandable: isExpandable,
stringify: fn_stringify,
stringifyConstraints: stringifyConstraints,
getDependentRequired: getDependentRequired },
overrides.fn)
};
const HOC = (props) => /*#__PURE__*/
external_react_namespaceObject["default"].createElement(JSONSchemaContext.Provider, { value: value }, /*#__PURE__*/
external_react_namespaceObject["default"].createElement(Component, props)
);
HOC.contexts = {
JSONSchemaContext: JSONSchemaContext
};
HOC.displayName = Component.displayName;
return HOC;
};
;// CONCATENATED MODULE: ./src/core/plugins/json-schema-2020-12/index.js
/**
* @prettier
*/
const JSONSchema202012Plugin = () => ({
components: {
JSONSchema202012: JSONSchema_JSONSchema,
JSONSchema202012Keyword$schema: keywords_$schema,
JSONSchema202012Keyword$vocabulary: $vocabulary_$vocabulary,
JSONSchema202012Keyword$id: keywords_$id,
JSONSchema202012Keyword$anchor: keywords_$anchor,
JSONSchema202012Keyword$dynamicAnchor: keywords_$dynamicAnchor,
JSONSchema202012Keyword$ref: keywords_$ref,
JSONSchema202012Keyword$dynamicRef: keywords_$dynamicRef,
JSONSchema202012Keyword$defs: keywords_$defs,
JSONSchema202012Keyword$comment: keywords_$comment,
JSONSchema202012KeywordAllOf: keywords_AllOf,
JSONSchema202012KeywordAnyOf: keywords_AnyOf,
JSONSchema202012KeywordOneOf: keywords_OneOf,
JSONSchema202012KeywordNot: keywords_Not,
JSONSchema202012KeywordIf: keywords_If,
JSONSchema202012KeywordThen: keywords_Then,
JSONSchema202012KeywordElse: keywords_Else,
JSONSchema202012KeywordDependentSchemas: keywords_DependentSchemas,
JSONSchema202012KeywordPrefixItems: keywords_PrefixItems,
JSONSchema202012KeywordItems: keywords_Items,
JSONSchema202012KeywordContains: keywords_Contains,
JSONSchema202012KeywordProperties: keywords_Properties_Properties,
JSONSchema202012KeywordPatternProperties: PatternProperties_PatternProperties,
JSONSchema202012KeywordAdditionalProperties: keywords_AdditionalProperties,
JSONSchema202012KeywordPropertyNames: keywords_PropertyNames,
JSONSchema202012KeywordUnevaluatedItems: keywords_UnevaluatedItems,
JSONSchema202012KeywordUnevaluatedProperties: keywords_UnevaluatedProperties,
JSONSchema202012KeywordType: keywords_Type,
JSONSchema202012KeywordEnum: Enum_Enum,
JSONSchema202012KeywordConst: keywords_Const,
JSONSchema202012KeywordConstraint: Constraint_Constraint,
JSONSchema202012KeywordDependentRequired: DependentRequired_DependentRequired,
JSONSchema202012KeywordContentSchema: keywords_ContentSchema,
JSONSchema202012KeywordTitle: Title_Title,
JSONSchema202012KeywordDescription: keywords_Description_Description,
JSONSchema202012KeywordDefault: keywords_Default,
JSONSchema202012KeywordDeprecated: keywords_Deprecated,
JSONSchema202012KeywordReadOnly: keywords_ReadOnly,
JSONSchema202012KeywordWriteOnly: keywords_WriteOnly,
JSONSchema202012Accordion: Accordion_Accordion,
JSONSchema202012ExpandDeepButton: ExpandDeepButton_ExpandDeepButton,
JSONSchema202012ChevronRightIcon: icons_ChevronRight,
withJSONSchema202012Context: withJSONSchemaContext,
JSONSchema202012DeepExpansionContext: () => JSONSchemaDeepExpansionContext
},
fn: {
upperFirst: fn_upperFirst,
jsonSchema202012: {
isExpandable: isExpandable,
hasKeyword: hasKeyword,
useFn: useFn,
useConfig: useConfig,
useComponent: useComponent,
useIsExpandedDeeply: useIsExpandedDeeply,
sampleFromSchema: main_sampleFromSchema,
sampleFromSchemaGeneric: main_sampleFromSchemaGeneric,
sampleEncoderAPI: api_encoderAPI,
sampleFormatAPI: api_formatAPI,
sampleMediaTypeAPI: api_mediaTypeAPI,
createXMLExample: main_createXMLExample,
memoizedSampleFromSchema: main_memoizedSampleFromSchema,
memoizedCreateXMLExample: main_memoizedCreateXMLExample
}
}
});
/* harmony default export */ const json_schema_2020_12 = (JSONSchema202012Plugin);
;// CONCATENATED MODULE: ./src/core/presets/apis/index.js
/**
* @prettier
*/
function PresetApis() {
return [base, oas3, json_schema_2020_12, oas31];
}
;// CONCATENATED MODULE: ./src/core/index.js
// presets
// plugins
// eslint-disable-next-line no-undef
const { GIT_DIRTY, GIT_COMMIT, PACKAGE_VERSION, BUILD_TIME } = {"PACKAGE_VERSION":"5.5.0","GIT_COMMIT":"g1ed1332d","GIT_DIRTY":true,"BUILD_TIME":"Mon, 04 Sep 2023 20:05:42 GMT"};
function SwaggerUI(opts) {
core_window.versions = core_window.versions || {};
core_window.versions.swaggerUi = {
version: PACKAGE_VERSION,
gitRevision: GIT_COMMIT,
gitDirty: GIT_DIRTY,
buildTimestamp: BUILD_TIME
};
const defaults = {
// Some general settings, that we floated to the top
dom_id: null, // eslint-disable-line camelcase
domNode: null,
spec: {},
url: "",
urls: null,
layout: "BaseLayout",
docExpansion: "list",
maxDisplayedTags: null,
filter: null,
validatorUrl: "https://validator.swagger.io/validator",
oauth2RedirectUrl: `${window.location.protocol}//${window.location.host}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/"))}/oauth2-redirect.html`,
persistAuthorization: false,
configs: {},
custom: {},
displayOperationId: false,
displayRequestDuration: false,
deepLinking: false,
tryItOutEnabled: false,
requestInterceptor: (a) => a,
responseInterceptor: (a) => a,
showMutatedRequest: true,
defaultModelRendering: "example",
defaultModelExpandDepth: 1,
defaultModelsExpandDepth: 1,
showExtensions: false,
showCommonExtensions: false,
withCredentials: undefined,
requestSnippetsEnabled: false,
requestSnippets: {
generators: {
"curl_bash": {
title: "cURL (bash)",
syntax: "bash"
},
"curl_powershell": {
title: "cURL (PowerShell)",
syntax: "powershell"
},
"curl_cmd": {
title: "cURL (CMD)",
syntax: "bash"
}
},
defaultExpanded: true,
languages: null // e.g. only show curl bash = ["curl_bash"]
},
supportedSubmitMethods: [
"get",
"put",
"post",
"delete",
"options",
"head",
"patch",
"trace"],
queryConfigEnabled: false,
// Initial set of plugins ( TODO rename this, or refactor - we don't need presets _and_ plugins. Its just there for performance.
// Instead, we can compile the first plugin ( it can be a collection of plugins ), then batch the rest.
presets: [
PresetApis],
// Plugins; ( loaded after presets )
plugins: [],
pluginsOptions: {
// Behavior during plugin registration. Can be :
// - legacy (default) : the current behavior for backward compatibility – last plugin takes precedence over the others
// - chain : chain wrapComponents when targeting the same core component
pluginLoadType: "legacy"
},
// Initial state
initialState: {},
// Inline Plugin
fn: {},
components: {},
syntaxHighlight: {
activated: true,
theme: "agate"
}
};
let queryConfig = opts.queryConfigEnabled ? parseSearch() : {};
const domNode = opts.domNode;
delete opts.domNode;
const constructorConfig = deep_extend_default()({}, defaults, opts, queryConfig);
const storeConfigs = {
system: {
configs: constructorConfig.configs
},
plugins: constructorConfig.presets,
pluginsOptions: constructorConfig.pluginsOptions,
state: deep_extend_default()({
layout: {
layout: constructorConfig.layout,
filter: constructorConfig.filter
},
spec: {
spec: "",
url: constructorConfig.url
},
requestSnippets: constructorConfig.requestSnippets
}, constructorConfig.initialState)
};
if (constructorConfig.initialState) {
// if the user sets a key as `undefined`, that signals to us that we
// should delete the key entirely.
// known usage: Swagger-Editor validate plugin tests
for (var key in constructorConfig.initialState) {
if (
Object.prototype.hasOwnProperty.call(constructorConfig.initialState, key) &&
constructorConfig.initialState[key] === undefined)
{
delete storeConfigs.state[key];
}
}
}
let inlinePlugin = () => {
return {
fn: constructorConfig.fn,
components: constructorConfig.components,
state: constructorConfig.state
};
};
var store = new Store(storeConfigs);
store.register([constructorConfig.plugins, inlinePlugin]);
var system = store.getSystem();
const downloadSpec = (fetchedConfig) => {
let localConfig = system.specSelectors.getLocalConfig ? system.specSelectors.getLocalConfig() : {};
let mergedConfig = deep_extend_default()({}, localConfig, constructorConfig, fetchedConfig || {}, queryConfig);
// deep extend mangles domNode, we need to set it manually
if (domNode) {
mergedConfig.domNode = domNode;
}
store.setConfigs(mergedConfig);
system.configsActions.loaded();
if (fetchedConfig !== null) {
if (!queryConfig.url && typeof mergedConfig.spec === "object" && Object.keys(mergedConfig.spec).length) {
system.specActions.updateUrl("");
system.specActions.updateLoadingStatus("success");
system.specActions.updateSpec(JSON.stringify(mergedConfig.spec));
} else if (system.specActions.download && mergedConfig.url && !mergedConfig.urls) {
system.specActions.updateUrl(mergedConfig.url);
system.specActions.download(mergedConfig.url);
}
}
if (mergedConfig.domNode) {
system.render(mergedConfig.domNode, "App");
} else if (mergedConfig.dom_id) {
let domNode = document.querySelector(mergedConfig.dom_id);
system.render(domNode, "App");
} else if (mergedConfig.dom_id === null || mergedConfig.domNode === null) {
// do nothing
// this is useful for testing that does not need to do any rendering
} else {console.error("Skipped rendering: no `dom_id` or `domNode` was specified");}
return system;
};
const configUrl = queryConfig.config || constructorConfig.configUrl;
if (configUrl && system.specActions && system.specActions.getConfigByUrl) {
system.specActions.getConfigByUrl({
url: configUrl,
loadRemoteConfig: true,
requestInterceptor: constructorConfig.requestInterceptor,
responseInterceptor: constructorConfig.responseInterceptor
}, downloadSpec);
} else {
return downloadSpec();
}
return system;
}
SwaggerUI.presets = {
base: base,
apis: PresetApis
};
SwaggerUI.plugins = {
Auth: auth,
Configs: configsPlugin,
DeepLining: deep_linking,
Err: err,
Filter: filter,
Icons: icons,
JSONSchema202012: json_schema_2020_12,
Layout: plugins_layout,
Logs: logs,
OpenAPI30: oas3,
OpenAPI31: oas3,
OnComplete: on_complete,
RequestSnippets: plugins_request_snippets,
Samples: samples,
Spec: plugins_spec,
SwaggerClient: swagger_client,
Util: util,
View: view,
DownloadUrl: downloadUrlPlugin,
SafeRender: safe_render
};
;// CONCATENATED MODULE: ./src/index.js
/* harmony default export */ const src = (SwaggerUI);
})();
var __webpack_exports__default = __webpack_exports__.Z;
export { __webpack_exports__default as default };