@digi-frontend/dgate-api-documentation 1.0.84 → 1.0.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{getDefaultExportFromCjs as o}from"./_commonjsHelpers.js";import{__require as r}from"../node_modules/toposort/index.js";var e=o(r());export{e as default};
1
+ import{__require as e}from"../node_modules/tiny-case/index.js";var r=e();export{r as t};
2
2
  //# sourceMappingURL=index5.js.map
@@ -1,2 +1,2 @@
1
- var e={exports:{}};export{e as __module};
1
+ import{getDefaultExportFromCjs as o}from"./_commonjsHelpers.js";import{__require as r}from"../node_modules/toposort/index.js";var e=o(r());export{e as default};
2
2
  //# sourceMappingURL=index6.js.map
@@ -1,2 +1,2 @@
1
- import{__require as e}from"../node_modules/tiny-case/index.js";var r=e();export{r as t};
1
+ var e={exports:{}};export{e as __module};
2
2
  //# sourceMappingURL=index7.js.map
@@ -1,2 +1,2 @@
1
- import{__module as r}from"../../_virtual/index6.js";var e;function n(){if(e)return r.exports;function n(r,e){var n=r.length,t=new Array(n),o={},a=n,i=function(r){for(var e=new Map,n=0,t=r.length;n<t;n++){var o=r[n];e.has(o[0])||e.set(o[0],new Set),e.has(o[1])||e.set(o[1],new Set),e.get(o[0]).add(o[1])}return e}(e),d=function(r){for(var e=new Map,n=0,t=r.length;n<t;n++)e.set(r[n],n);return e}(r);for(e.forEach((function(r){if(!d.has(r[0])||!d.has(r[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")}));a--;)o[a]||f(r[a],a,new Set);return t;function f(r,e,a){if(a.has(r)){var s;try{s=", node was:"+JSON.stringify(r)}catch(r){s=""}throw new Error("Cyclic dependency"+s)}if(!d.has(r))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(r));if(!o[e]){o[e]=!0;var u=i.get(r)||new Set;if(e=(u=Array.from(u)).length){a.add(r);do{var w=u[--e];f(w,d.get(w),a)}while(e);a.delete(r)}t[--n]=r}}}return e=1,r.exports=function(r){return n(function(r){for(var e=new Set,n=0,t=r.length;n<t;n++){var o=r[n];e.add(o[0]),e.add(o[1])}return Array.from(e)}(r),r)},r.exports.array=n,r.exports}export{n as __require};
1
+ import{__module as r}from"../../_virtual/index7.js";var e;function n(){if(e)return r.exports;function n(r,e){var n=r.length,t=new Array(n),o={},a=n,i=function(r){for(var e=new Map,n=0,t=r.length;n<t;n++){var o=r[n];e.has(o[0])||e.set(o[0],new Set),e.has(o[1])||e.set(o[1],new Set),e.get(o[0]).add(o[1])}return e}(e),d=function(r){for(var e=new Map,n=0,t=r.length;n<t;n++)e.set(r[n],n);return e}(r);for(e.forEach((function(r){if(!d.has(r[0])||!d.has(r[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")}));a--;)o[a]||f(r[a],a,new Set);return t;function f(r,e,a){if(a.has(r)){var s;try{s=", node was:"+JSON.stringify(r)}catch(r){s=""}throw new Error("Cyclic dependency"+s)}if(!d.has(r))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(r));if(!o[e]){o[e]=!0;var u=i.get(r)||new Set;if(e=(u=Array.from(u)).length){a.add(r);do{var w=u[--e];f(w,d.get(w),a)}while(e);a.delete(r)}t[--n]=r}}}return e=1,r.exports=function(r){return n(function(r){for(var e=new Set,n=0,t=r.length;n<t;n++){var o=r[n];e.add(o[0]),e.add(o[1])}return Array.from(e)}(r),r)},r.exports.array=n,r.exports}export{n as __require};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{p as e}from"../../_virtual/index4.js";import{t}from"../../_virtual/index7.js";import s from"../../_virtual/index5.js";const r=Object.prototype.toString,n=Error.prototype.toString,i=RegExp.prototype.toString,a="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",o=/^Symbol\((.*)\)(.*)$/;function l(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const s=typeof e;if("number"===s)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===s)return t?`"${e}"`:e;if("function"===s)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===s)return a.call(e).replace(o,"Symbol($1)");const l=r.call(e).slice(8,-1);return"Date"===l?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===l||e instanceof Error?"["+n.call(e)+"]":"RegExp"===l?i.call(e):null}function u(e,t){let s=l(e,t);return null!==s?s:JSON.stringify(e,(function(e,s){let r=l(this[e],t);return null!==r?r:s}),2)}function c(e){return null==e?[]:[].concat(e)}let h,p,d,f=/\$\{\s*(\w+)\s*\}/g;h=Symbol.toStringTag;class m{constructor(e,t,s,r){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[h]="Error",this.name="ValidationError",this.value=t,this.path=s,this.type=r,this.errors=[],this.inner=[],c(e).forEach((e=>{if(y.isError(e)){this.errors.push(...e.errors);const t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)})),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}p=Symbol.hasInstance,d=Symbol.toStringTag;class y extends Error{static formatError(e,t){const s=t.label||t.path||"this";return t=Object.assign({},t,{path:s,originalPath:t.path}),"string"==typeof e?e.replace(f,((e,s)=>u(t[s]))):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,s,r,n){const i=new m(e,t,s,r);if(n)return i;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[d]="Error",this.name=i.name,this.message=i.message,this.type=i.type,this.value=i.value,this.path=i.path,this.errors=i.errors,this.inner=i.inner,Error.captureStackTrace&&Error.captureStackTrace(this,y)}static[p](e){return m[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let v={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:s,originalValue:r})=>{const n=null!=r&&r!==s?` (cast from the value \`${u(r,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${u(s,!0)}\``+n:`${e} must match the configured type. The validated value was: \`${u(s,!0)}\``+n}},g={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},b={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},F={isValue:"${path} field must be ${value}"},_={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},w={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},x={notType:e=>{const{path:t,value:s,spec:r}=e,n=r.types.length;if(Array.isArray(s)){if(s.length<n)return`${t} tuple value has too few items, expected a length of ${n} but got ${s.length} for value: \`${u(s,!0)}\``;if(s.length>n)return`${t} tuple value has too many items, expected a length of ${n} but got ${s.length} for value: \`${u(s,!0)}\``}return y.formatError(v.notType,e)}};Object.assign(Object.create(null),{mixed:v,string:g,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:b,object:_,array:w,boolean:F,tuple:x});const T=e=>e&&e.__isYupSchema__;class ${static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:r,otherwise:n}=t,i="function"==typeof s?s:(...e)=>e.every((e=>e===s));return new $(e,((e,t)=>{var s;let a=i(...e)?r:n;return null!=(s=null==a?void 0:a(t))?s:t}))}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let s=this.refs.map((e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context))),r=this.fn(s,e,t);if(void 0===r||r===e)return e;if(!T(r))throw new TypeError("conditions must return a schema object");return r.resolve(t)}}const O="$",k=".";class E{constructor(t,s={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof t)throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),""===t)throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===O,this.isValue=this.key[0]===k,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?O:this.isValue?k:"";this.path=this.key.slice(r.length),this.getter=this.path&&e.getter(this.path,!0),this.map=s.map}getValue(e,t,s){let r=this.isContext?s:this.isValue?e:t;return this.getter&&(r=this.getter(r||{})),this.map&&(r=this.map(r)),r}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}E.prototype.__isYupRef=!0;const S=e=>null==e;function j(e){function t({value:t,path:s="",options:r,originalValue:n,schema:i},a,o){const{name:l,test:u,params:c,message:h,skipAbsent:p}=e;let{parent:d,context:f,abortEarly:m=i.spec.abortEarly,disableStackTrace:v=i.spec.disableStackTrace}=r;function g(e){return E.isRef(e)?e.getValue(t,d,f):e}function b(e={}){const r=Object.assign({value:t,originalValue:n,label:i.spec.label,path:e.path||s,spec:i.spec,disableStackTrace:e.disableStackTrace||v},c,e.params);for(const e of Object.keys(r))r[e]=g(r[e]);const a=new y(y.formatError(e.message||h,r),t,r.path,e.type||l,r.disableStackTrace);return a.params=r,a}const F=m?a:o;let _={path:s,parent:d,type:l,from:r.from,createError:b,resolve:g,options:r,originalValue:n,schema:i};const w=e=>{y.isError(e)?F(e):e?o(null):F(b())},x=e=>{y.isError(e)?F(e):a(e)};if(p&&S(t))return w(!0);let T;try{var $;if(T=u.call(_,t,_),"function"==typeof(null==($=T)?void 0:$.then)){if(r.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(T).then(w,x)}}catch(e){return void x(e)}w(T)}return t.OPTIONS=e,t}function A(t,s,r,n=r){let i,a,o;return s?(e.forEach(s,((e,l,u)=>{let c=l?e.slice(1,e.length-1):e,h="tuple"===(t=t.resolve({context:n,parent:i,value:r})).type,p=u?parseInt(c,10):0;if(t.innerType||h){if(h&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(r&&p>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${e}, in the path: ${s}. because there is no value at that index. `);i=r,r=r&&r[p],t=h?t.spec.types[p]:t.innerType}if(!u){if(!t.fields||!t.fields[c])throw new Error(`The schema does not contain the path: ${s}. (failed at: ${o} which is a type: "${t.type}")`);i=r,r=r&&r[c],t=t.fields[c]}a=c,o=l?"["+e+"]":"."+e})),{schema:t,parent:i,parentPath:a}):{parent:i,parentPath:s,schema:t}}class D extends Set{describe(){const e=[];for(const t of this.values())e.push(E.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const s of this.values())t.push(e(s));return t}clone(){return new D(this.values())}merge(e,t){const s=this.clone();return e.forEach((e=>s.add(e))),t.forEach((e=>s.delete(e))),s}}function C(e,t=new Map){if(T(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let s;if(e instanceof Date)s=new Date(e.getTime()),t.set(e,s);else if(e instanceof RegExp)s=new RegExp(e),t.set(e,s);else if(Array.isArray(e)){s=new Array(e.length),t.set(e,s);for(let r=0;r<e.length;r++)s[r]=C(e[r],t)}else if(e instanceof Map){s=new Map,t.set(e,s);for(const[r,n]of e.entries())s.set(r,C(n,t))}else if(e instanceof Set){s=new Set,t.set(e,s);for(const r of e)s.add(C(r,t))}else{if(!(e instanceof Object))throw Error(`Unable to clone ${e}`);s={},t.set(e,s);for(const[r,n]of Object.entries(e))s[r]=C(n,t)}return s}class V{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new D,this._blacklist=new D,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation((()=>{this.typeError(v.notType)})),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation((e=>{e.nonNullable()}))}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=C(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let s=e(this);return this._mutate=t,s}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,s=e.clone();const r=Object.assign({},t.spec,s.spec);return s.spec=r,s.internalTests=Object.assign({},t.internalTests,s.internalTests),s._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),s._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),s.tests=t.tests,s.exclusiveTests=t.exclusiveTests,s.withMutation((t=>{e.tests.forEach((e=>{t.test(e.OPTIONS)}))})),s.transforms=[...t.transforms,...s.transforms],s}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let s=t.conditions;t=t.clone(),t.conditions=[],t=s.reduce(((t,s)=>s.resolve(t,e)),t),t=t.resolve(e)}return t}resolveOptions(e){var t,s,r,n;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(s=e.abortEarly)?s:this.spec.abortEarly,recursive:null!=(r=e.recursive)?r:this.spec.recursive,disableStackTrace:null!=(n=e.disableStackTrace)?n:this.spec.disableStackTrace})}cast(e,t={}){let s=this.resolve(Object.assign({value:e},t)),r="ignore-optionality"===t.assert,n=s._cast(e,t);if(!1!==t.assert&&!s.isType(n)){if(r&&S(n))return n;let i=u(e),a=u(n);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${s.type}". \n\nattempted value: ${i} \n`+(a!==i?`result of cast: ${a}`:""))}return n}_cast(e,t){let s=void 0===e?e:this.transforms.reduce(((t,s)=>s.call(this,t,e,this)),e);return void 0===s&&(s=this.getDefault(t)),s}_validate(e,t={},s,r){let{path:n,originalValue:i=e,strict:a=this.spec.strict}=t,o=e;a||(o=this._cast(o,Object.assign({assert:!1},t)));let l=[];for(let e of Object.values(this.internalTests))e&&l.push(e);this.runTests({path:n,value:o,originalValue:i,options:t,tests:l},s,(e=>{if(e.length)return r(e,o);this.runTests({path:n,value:o,originalValue:i,options:t,tests:this.tests},s,r)}))}runTests(e,t,s){let r=!1,{tests:n,value:i,originalValue:a,path:o,options:l}=e,u=e=>{r||(r=!0,t(e,i))},c=e=>{r||(r=!0,s(e,i))},h=n.length,p=[];if(!h)return c([]);let d={value:i,originalValue:a,path:o,options:l,schema:this};for(let e=0;e<n.length;e++){(0,n[e])(d,u,(function(e){e&&(Array.isArray(e)?p.push(...e):p.push(e)),--h<=0&&c(p)}))}}asNestedTest({key:e,index:t,parent:s,parentPath:r,originalParent:n,options:i}){const a=null!=e?e:t;if(null==a)throw TypeError("Must include `key` or `index` for nested validations");const o="number"==typeof a;let l=s[a];const u=Object.assign({},i,{strict:!0,parent:s,value:l,originalValue:n[a],key:void 0,[o?"index":"key"]:a,path:o||a.includes(".")?`${r||""}[${o?a:`"${a}"`}]`:(r?`${r}.`:"")+e});return(e,t,s)=>this.resolve(u)._validate(l,u,t,s)}validate(e,t){var s;let r=this.resolve(Object.assign({},t,{value:e})),n=null!=(s=null==t?void 0:t.disableStackTrace)?s:r.spec.disableStackTrace;return new Promise(((s,i)=>r._validate(e,t,((e,t)=>{y.isError(e)&&(e.value=t),i(e)}),((e,t)=>{e.length?i(new y(e,t,void 0,void 0,n)):s(t)}))))}validateSync(e,t){var s;let r,n=this.resolve(Object.assign({},t,{value:e})),i=null!=(s=null==t?void 0:t.disableStackTrace)?s:n.spec.disableStackTrace;return n._validate(e,Object.assign({},t,{sync:!0}),((e,t)=>{throw y.isError(e)&&(e.value=t),e}),((t,s)=>{if(t.length)throw new y(t,e,void 0,void 0,i);r=s})),r}isValid(e,t){return this.validate(e,t).then((()=>!0),(e=>{if(y.isError(e))return!1;throw e}))}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(y.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):C(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){if(0===arguments.length)return this._getDefault();return this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const s=this.clone({nullable:e});return s.internalTests.nullable=j({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),s}optionality(e,t){const s=this.clone({optional:e});return s.internalTests.optionality=j({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),s}optional(){return this.optionality(!0)}defined(e=v.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=v.notNull){return this.nullability(!1,e)}required(e=v.required){return this.clone().withMutation((t=>t.nonNullable(e).defined(e)))}notRequired(){return this.clone().withMutation((e=>e.nullable().optional()))}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=v.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let s=this.clone(),r=j(t),n=t.exclusive||t.name&&!0===s.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(s.exclusiveTests[t.name]=!!t.exclusive),s.tests=s.tests.filter((e=>{if(e.OPTIONS.name===t.name){if(n)return!1;if(e.OPTIONS.test===r.OPTIONS.test)return!1}return!0})),s.tests.push(r),s}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let s=this.clone(),r=c(e).map((e=>new E(e)));return r.forEach((e=>{e.isSibling&&s.deps.push(e.key)})),s.conditions.push("function"==typeof t?new $(r,t):$.fromOptions(r,t)),s}typeError(e){let t=this.clone();return t.internalTests.typeError=j({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=v.oneOf){let s=this.clone();return e.forEach((e=>{s._whitelist.add(e),s._blacklist.delete(e)})),s.internalTests.whiteList=j({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,s=t.resolveAll(this.resolve);return!!s.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:s}})}}),s}notOneOf(e,t=v.notOneOf){let s=this.clone();return e.forEach((e=>{s._blacklist.add(e),s._whitelist.delete(e)})),s.internalTests.blacklist=j({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,s=t.resolveAll(this.resolve);return!s.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:s}})}}),s}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:s,meta:r,optional:n,nullable:i}=t.spec;return{meta:r,label:s,optional:n,nullable:i,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map((e=>({name:e.OPTIONS.name,params:e.OPTIONS.params}))).filter(((e,t,s)=>s.findIndex((t=>t.name===e.name))===t))}}}V.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])V.prototype[`${e}At`]=function(t,s,r={}){const{parent:n,parentPath:i,schema:a}=A(this,t,s,r.context);return a[e](n&&n[i],Object.assign({},r,{parent:n,path:t}))};for(const e of["equals","is"])V.prototype[e]=V.prototype.oneOf;for(const e of["not","nope"])V.prototype[e]=V.prototype.notOneOf;const N=()=>!0;function z(e){return new P(e)}class P extends V{constructor(e){super("function"==typeof e?{type:"mixed",check:e}:Object.assign({type:"mixed",check:N},e))}}function q(){return new I}z.prototype=P.prototype;class I extends V{constructor(){super({type:"boolean",check:e=>(e instanceof Boolean&&(e=e.valueOf()),"boolean"==typeof e)}),this.withMutation((()=>{this.transform(((e,t,s)=>{if(s.spec.coerce&&!s.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e}))}))}isTrue(e=F.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test:e=>S(e)||!0===e})}isFalse(e=F.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test:e=>S(e)||!1===e})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}q.prototype=I.prototype;const M=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function R(e){var t,s;const r=M.exec(e);return r?{year:U(r[1]),month:U(r[2],1)-1,day:U(r[3],1),hour:U(r[4]),minute:U(r[5]),second:U(r[6]),millisecond:r[7]?U(r[7].substring(0,3)):0,precision:null!=(t=null==(s=r[7])?void 0:s.length)?t:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:U(r[10]),minuteOffset:U(r[11])}:null}function U(e,t=0){return Number(e)||t}let Z=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Y=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,L=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,K=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),J=e=>S(e)||e===e.trim(),B={}.toString();function G(){return new H}class H extends V{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation((()=>{this.transform(((e,t,s)=>{if(!s.spec.coerce||s.isType(e))return e;if(Array.isArray(e))return e;const r=null!=e&&e.toString?e.toString():e;return r===B?e:r}))}))}required(e){return super.required(e).withMutation((t=>t.test({message:e||v.required,name:"required",skipAbsent:!0,test:e=>!!e.length})))}notRequired(){return super.notRequired().withMutation((e=>(e.tests=e.tests.filter((e=>"required"!==e.OPTIONS.name)),e)))}length(e,t=g.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=g.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=g.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let s,r,n=!1;return t&&("object"==typeof t?({excludeEmptyString:n=!1,message:s,name:r}=t):s=t),this.test({name:r||"matches",message:s||g.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&n||-1!==t.search(e)})}email(e=g.email){return this.matches(Z,{name:"email",message:e,excludeEmptyString:!0})}url(e=g.url){return this.matches(Y,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=g.uuid){return this.matches(L,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,s,r="";return e&&("object"==typeof e?({message:r="",allowOffset:t=!1,precision:s}=e):r=e),this.matches(K,{name:"datetime",message:r||g.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||g.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const s=R(e);return!!s&&!!s.z}}).test({name:"datetime_precision",message:r||g.datetime_precision,params:{precision:s},skipAbsent:!0,test:e=>{if(!e||null==s)return!0;const t=R(e);return!!t&&t.precision===s}})}ensure(){return this.default("").transform((e=>null===e?"":e))}trim(e=g.trim){return this.transform((e=>null!=e?e.trim():e)).test({message:e,name:"trim",test:J})}lowercase(e=g.lowercase){return this.transform((e=>S(e)?e:e.toLowerCase())).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>S(e)||e===e.toLowerCase()})}uppercase(e=g.uppercase){return this.transform((e=>S(e)?e:e.toUpperCase())).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>S(e)||e===e.toUpperCase()})}}G.prototype=H.prototype;let Q=new Date("");class W extends V{constructor(){super({type:"date",check(e){return t=e,"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(e.getTime());var t}}),this.withMutation((()=>{this.transform(((e,t,s)=>!s.spec.coerce||s.isType(e)||null===e?e:(e=function(e){const t=R(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let s=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(s=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(s=0-s)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+s,t.second,t.millisecond)}(e),isNaN(e)?W.INVALID_DATE:new Date(e))))}))}prepareParam(e,t){let s;if(E.isRef(e))s=e;else{let r=this.cast(e);if(!this._typeCheck(r))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);s=r}return s}min(e,t=b.min){let s=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(s)}})}max(e,t=b.max){let s=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(s)}})}}function X(e,t){let s=1/0;return e.some(((e,r)=>{var n;if(null!=(n=t.path)&&n.includes(e))return s=r,!0})),s}function ee(e){return(t,s)=>X(e,t)-X(e,s)}W.INVALID_DATE=Q,W.prototype;const te=(e,t,s)=>{if("string"!=typeof e)return e;let r=e;try{r=JSON.parse(e)}catch(e){}return s.isType(r)?r:e};function se(e){if("fields"in e){const t={};for(const[s,r]of Object.entries(e.fields))t[s]=se(r);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=se(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(se)}):"optional"in e?e.optional():e}let re=e=>"[object Object]"===Object.prototype.toString.call(e);function ne(e,t){let s=Object.keys(e.fields);return Object.keys(t).filter((e=>-1===s.indexOf(e)))}const ie=ee([]);function ae(e){return new oe(e)}class oe extends V{constructor(e){super({type:"object",check:e=>re(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=ie,this._nodes=[],this._excludedEdges=[],this.withMutation((()=>{e&&this.shape(e)}))}_cast(e,t={}){var s;let r=super._cast(e,t);if(void 0===r)return this.getDefault(t);if(!this._typeCheck(r))return r;let n=this.fields,i=null!=(s=t.stripUnknown)?s:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(r).filter((e=>!this._nodes.includes(e)))),o={},l=Object.assign({},t,{parent:o,__validating:t.__validating||!1}),u=!1;for(const e of a){let s=n[e],a=e in r;if(s){let n,i=r[e];l.path=(t.path?`${t.path}.`:"")+e,s=s.resolve({value:i,context:t.context,parent:o});let a=s instanceof V?s.spec:void 0,c=null==a?void 0:a.strict;if(null!=a&&a.strip){u=u||e in r;continue}n=t.__validating&&c?r[e]:s.cast(r[e],l),void 0!==n&&(o[e]=n)}else a&&!i&&(o[e]=r[e]);a===e in o&&o[e]===r[e]||(u=!0)}return u?o:r}_validate(e,t={},s,r){let{from:n=[],originalValue:i=e,recursive:a=this.spec.recursive}=t;t.from=[{schema:this,value:i},...n],t.__validating=!0,t.originalValue=i,super._validate(e,t,s,((e,n)=>{if(!a||!re(n))return void r(e,n);i=i||n;let o=[];for(let e of this._nodes){let s=this.fields[e];s&&!E.isRef(s)&&o.push(s.asNestedTest({options:t,key:e,parent:n,parentPath:t.path,originalParent:i}))}this.runTests({tests:o,value:n,originalValue:i,options:t},s,(t=>{r(t.sort(this._sortErrors).concat(e),n)}))}))}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),s=t.fields;for(let[e,t]of Object.entries(this.fields)){const r=s[e];s[e]=void 0===r?t:r}return t.withMutation((t=>t.setFields(s,[...this._excludedEdges,...e._excludedEdges])))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach((s=>{var r;const n=this.fields[s];let i=e;null!=(r=i)&&r.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[s]})),t[s]=n&&"getDefault"in n?n.getDefault(i):void 0})),t}setFields(t,r){let n=this.clone();return n.fields=t,n._nodes=function(t,r=[]){let n=[],i=new Set,a=new Set(r.map((([e,t])=>`${e}-${t}`)));function o(t,s){let r=e.split(t)[0];i.add(r),a.has(`${s}-${r}`)||n.push([s,r])}for(const e of Object.keys(t)){let s=t[e];i.add(e),E.isRef(s)&&s.isSibling?o(s.path,e):T(s)&&"deps"in s&&s.deps.forEach((t=>o(t,e)))}return s.array(Array.from(i),n).reverse()}(t,r),n._sortErrors=ee(Object.keys(t)),r&&(n._excludedEdges=r),n}shape(e,t=[]){return this.clone().withMutation((s=>{let r=s._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),r=[...s._excludedEdges,...t]),s.setFields(Object.assign(s.fields,e),r)}))}partial(){const e={};for(const[t,s]of Object.entries(this.fields))e[t]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(e)}deepPartial(){return se(this)}pick(e){const t={};for(const s of e)this.fields[s]&&(t[s]=this.fields[s]);return this.setFields(t,this._excludedEdges.filter((([t,s])=>e.includes(t)&&e.includes(s))))}omit(e){const t=[];for(const s of Object.keys(this.fields))e.includes(s)||t.push(s);return this.pick(t)}from(t,s,r){let n=e.getter(t,!0);return this.transform((i=>{if(!i)return i;let a=i;return((t,s)=>{const r=[...e.normalizePath(s)];if(1===r.length)return r[0]in t;let n=r.pop(),i=e.getter(e.join(r),!0)(t);return!(!i||!(n in i))})(i,t)&&(a=Object.assign({},i),r||delete a[t],a[s]=n(i)),a}))}json(){return this.transform(te)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||_.exact,test(e){if(null==e)return!0;const t=ne(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=_.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const s=ne(this.schema,t);return!e||0===s.length||this.createError({params:{unknown:s.join(", ")}})}});return s.spec.noUnknown=e,s}unknown(e=!0,t=_.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform((t=>{if(!t)return t;const s={};for(const r of Object.keys(t))s[e(r)]=t[r];return s}))}camelCase(){return this.transformKeys(t.camelCase)}snakeCase(){return this.transformKeys(t.snakeCase)}constantCase(){return this.transformKeys((e=>t.snakeCase(e).toUpperCase()))}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);s.fields={};for(const[n,i]of Object.entries(t.fields)){var r;let t=e;null!=(r=t)&&r.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[n]})),s.fields[n]=i.describe(t)}return s}}function le(e){return new ue(e)}ae.prototype=oe.prototype;class ue extends V{constructor(e){super({type:"array",spec:{types:e},check:e=>Array.isArray(e)}),this.innerType=void 0,this.innerType=e}_cast(e,t){const s=super._cast(e,t);if(!this._typeCheck(s)||!this.innerType)return s;let r=!1;const n=s.map(((e,s)=>{const n=this.innerType.cast(e,Object.assign({},t,{path:`${t.path||""}[${s}]`}));return n!==e&&(r=!0),n}));return r?n:s}_validate(e,t={},s,r){var n;let i=this.innerType,a=null!=(n=t.recursive)?n:this.spec.recursive;null!=t.originalValue&&t.originalValue,super._validate(e,t,s,((n,o)=>{var l;if(!a||!i||!this._typeCheck(o))return void r(n,o);let u=new Array(o.length);for(let s=0;s<o.length;s++){var c;u[s]=i.asNestedTest({options:t,index:s,parent:o,parentPath:t.path,originalParent:null!=(c=t.originalValue)?c:e})}this.runTests({value:o,tests:u,originalValue:null!=(l=t.originalValue)?l:e,options:t},s,(e=>r(e.concat(n),o)))}))}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(te)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!T(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+u(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=w.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t){return t=t||w.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t){return t=t||w.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}ensure(){return this.default((()=>[])).transform(((e,t)=>this._typeCheck(e)?e:null==t?[]:[].concat(t)))}compact(e){let t=e?(t,s,r)=>!e(t,s,r):e=>!!e;return this.transform((e=>null!=e?e.filter(t):e))}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);if(t.innerType){var r;let n=e;null!=(r=n)&&r.value&&(n=Object.assign({},n,{parent:n.value,value:n.value[0]})),s.innerType=t.innerType.describe(n)}return s}}function ce(e){return new pe(e)}function he(e){try{return e()}catch(e){if(y.isError(e))return Promise.reject(e);throw e}}le.prototype=ue.prototype;class pe{constructor(e){this.type="lazy",this.__isYupSchema__=!0,this.spec=void 0,this._resolve=(e,t={})=>{let s=this.builder(e,t);if(!T(s))throw new TypeError("lazy() functions must return a valid schema");return this.spec.optional&&(s=s.optional()),s.resolve(t)},this.builder=e,this.spec={meta:void 0,optional:!1}}clone(e){const t=new pe(this.builder);return t.spec=Object.assign({},this.spec,e),t}optionality(e){return this.clone({optional:e})}optional(){return this.optionality(!0)}resolve(e){return this._resolve(e.value,e)}cast(e,t){return this._resolve(e,t).cast(e,t)}asNestedTest(e){let{key:t,index:s,parent:r,options:n}=e,i=r[null!=s?s:t];return this._resolve(i,Object.assign({},n,{value:i,parent:r})).asNestedTest(e)}validate(e,t){return he((()=>this._resolve(e,t).validate(e,t)))}validateSync(e,t){return this._resolve(e,t).validateSync(e,t)}validateAt(e,t,s){return he((()=>this._resolve(t,s).validateAt(e,t,s)))}validateSyncAt(e,t,s){return this._resolve(t,s).validateSyncAt(e,t,s)}isValid(e,t){try{return this._resolve(e,t).isValid(e,t)}catch(e){if(y.isError(e))return Promise.resolve(!1);throw e}}isValidSync(e,t){return this._resolve(e,t).isValidSync(e,t)}describe(e){return e?this.resolve(e).describe(e):{type:"lazy",meta:this.spec.meta,label:void 0}}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}}export{ue as ArraySchema,I as BooleanSchema,W as DateSchema,pe as LazySchema,P as MixedSchema,oe as ObjectSchema,V as Schema,H as StringSchema,y as ValidationError,le as array,q as bool,q as boolean,A as getIn,T as isSchema,ce as lazy,z as mixed,ae as object,u as printValue,G as string};
1
+ import{p as e}from"../../_virtual/index4.js";import{t}from"../../_virtual/index5.js";import s from"../../_virtual/index6.js";const r=Object.prototype.toString,n=Error.prototype.toString,i=RegExp.prototype.toString,a="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",o=/^Symbol\((.*)\)(.*)$/;function l(e,t=!1){if(null==e||!0===e||!1===e)return""+e;const s=typeof e;if("number"===s)return function(e){return e!=+e?"NaN":0===e&&1/e<0?"-0":""+e}(e);if("string"===s)return t?`"${e}"`:e;if("function"===s)return"[Function "+(e.name||"anonymous")+"]";if("symbol"===s)return a.call(e).replace(o,"Symbol($1)");const l=r.call(e).slice(8,-1);return"Date"===l?isNaN(e.getTime())?""+e:e.toISOString(e):"Error"===l||e instanceof Error?"["+n.call(e)+"]":"RegExp"===l?i.call(e):null}function u(e,t){let s=l(e,t);return null!==s?s:JSON.stringify(e,(function(e,s){let r=l(this[e],t);return null!==r?r:s}),2)}function c(e){return null==e?[]:[].concat(e)}let h,p,d,f=/\$\{\s*(\w+)\s*\}/g;h=Symbol.toStringTag;class m{constructor(e,t,s,r){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[h]="Error",this.name="ValidationError",this.value=t,this.path=s,this.type=r,this.errors=[],this.inner=[],c(e).forEach((e=>{if(y.isError(e)){this.errors.push(...e.errors);const t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)})),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}p=Symbol.hasInstance,d=Symbol.toStringTag;class y extends Error{static formatError(e,t){const s=t.label||t.path||"this";return t=Object.assign({},t,{path:s,originalPath:t.path}),"string"==typeof e?e.replace(f,((e,s)=>u(t[s]))):"function"==typeof e?e(t):e}static isError(e){return e&&"ValidationError"===e.name}constructor(e,t,s,r,n){const i=new m(e,t,s,r);if(n)return i;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[d]="Error",this.name=i.name,this.message=i.message,this.type=i.type,this.value=i.value,this.path=i.path,this.errors=i.errors,this.inner=i.inner,Error.captureStackTrace&&Error.captureStackTrace(this,y)}static[p](e){return m[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let v={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:s,originalValue:r})=>{const n=null!=r&&r!==s?` (cast from the value \`${u(r,!0)}\`).`:".";return"mixed"!==t?`${e} must be a \`${t}\` type, but the final value was: \`${u(s,!0)}\``+n:`${e} must match the configured type. The validated value was: \`${u(s,!0)}\``+n}},g={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},b={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},F={isValue:"${path} field must be ${value}"},_={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},w={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},x={notType:e=>{const{path:t,value:s,spec:r}=e,n=r.types.length;if(Array.isArray(s)){if(s.length<n)return`${t} tuple value has too few items, expected a length of ${n} but got ${s.length} for value: \`${u(s,!0)}\``;if(s.length>n)return`${t} tuple value has too many items, expected a length of ${n} but got ${s.length} for value: \`${u(s,!0)}\``}return y.formatError(v.notType,e)}};Object.assign(Object.create(null),{mixed:v,string:g,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:b,object:_,array:w,boolean:F,tuple:x});const T=e=>e&&e.__isYupSchema__;class ${static fromOptions(e,t){if(!t.then&&!t.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:s,then:r,otherwise:n}=t,i="function"==typeof s?s:(...e)=>e.every((e=>e===s));return new $(e,((e,t)=>{var s;let a=i(...e)?r:n;return null!=(s=null==a?void 0:a(t))?s:t}))}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let s=this.refs.map((e=>e.getValue(null==t?void 0:t.value,null==t?void 0:t.parent,null==t?void 0:t.context))),r=this.fn(s,e,t);if(void 0===r||r===e)return e;if(!T(r))throw new TypeError("conditions must return a schema object");return r.resolve(t)}}const O="$",k=".";class E{constructor(t,s={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof t)throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),""===t)throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===O,this.isValue=this.key[0]===k,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?O:this.isValue?k:"";this.path=this.key.slice(r.length),this.getter=this.path&&e.getter(this.path,!0),this.map=s.map}getValue(e,t,s){let r=this.isContext?s:this.isValue?e:t;return this.getter&&(r=this.getter(r||{})),this.map&&(r=this.map(r)),r}cast(e,t){return this.getValue(e,null==t?void 0:t.parent,null==t?void 0:t.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}E.prototype.__isYupRef=!0;const S=e=>null==e;function j(e){function t({value:t,path:s="",options:r,originalValue:n,schema:i},a,o){const{name:l,test:u,params:c,message:h,skipAbsent:p}=e;let{parent:d,context:f,abortEarly:m=i.spec.abortEarly,disableStackTrace:v=i.spec.disableStackTrace}=r;function g(e){return E.isRef(e)?e.getValue(t,d,f):e}function b(e={}){const r=Object.assign({value:t,originalValue:n,label:i.spec.label,path:e.path||s,spec:i.spec,disableStackTrace:e.disableStackTrace||v},c,e.params);for(const e of Object.keys(r))r[e]=g(r[e]);const a=new y(y.formatError(e.message||h,r),t,r.path,e.type||l,r.disableStackTrace);return a.params=r,a}const F=m?a:o;let _={path:s,parent:d,type:l,from:r.from,createError:b,resolve:g,options:r,originalValue:n,schema:i};const w=e=>{y.isError(e)?F(e):e?o(null):F(b())},x=e=>{y.isError(e)?F(e):a(e)};if(p&&S(t))return w(!0);let T;try{var $;if(T=u.call(_,t,_),"function"==typeof(null==($=T)?void 0:$.then)){if(r.sync)throw new Error(`Validation test of type: "${_.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(T).then(w,x)}}catch(e){return void x(e)}w(T)}return t.OPTIONS=e,t}function A(t,s,r,n=r){let i,a,o;return s?(e.forEach(s,((e,l,u)=>{let c=l?e.slice(1,e.length-1):e,h="tuple"===(t=t.resolve({context:n,parent:i,value:r})).type,p=u?parseInt(c,10):0;if(t.innerType||h){if(h&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(r&&p>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${e}, in the path: ${s}. because there is no value at that index. `);i=r,r=r&&r[p],t=h?t.spec.types[p]:t.innerType}if(!u){if(!t.fields||!t.fields[c])throw new Error(`The schema does not contain the path: ${s}. (failed at: ${o} which is a type: "${t.type}")`);i=r,r=r&&r[c],t=t.fields[c]}a=c,o=l?"["+e+"]":"."+e})),{schema:t,parent:i,parentPath:a}):{parent:i,parentPath:s,schema:t}}class D extends Set{describe(){const e=[];for(const t of this.values())e.push(E.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(const s of this.values())t.push(e(s));return t}clone(){return new D(this.values())}merge(e,t){const s=this.clone();return e.forEach((e=>s.add(e))),t.forEach((e=>s.delete(e))),s}}function C(e,t=new Map){if(T(e)||!e||"object"!=typeof e)return e;if(t.has(e))return t.get(e);let s;if(e instanceof Date)s=new Date(e.getTime()),t.set(e,s);else if(e instanceof RegExp)s=new RegExp(e),t.set(e,s);else if(Array.isArray(e)){s=new Array(e.length),t.set(e,s);for(let r=0;r<e.length;r++)s[r]=C(e[r],t)}else if(e instanceof Map){s=new Map,t.set(e,s);for(const[r,n]of e.entries())s.set(r,C(n,t))}else if(e instanceof Set){s=new Set,t.set(e,s);for(const r of e)s.add(C(r,t))}else{if(!(e instanceof Object))throw Error(`Unable to clone ${e}`);s={},t.set(e,s);for(const[r,n]of Object.entries(e))s[r]=C(n,t)}return s}class V{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new D,this._blacklist=new D,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation((()=>{this.typeError(v.notType)})),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},null==e?void 0:e.spec),this.withMutation((e=>{e.nonNullable()}))}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=C(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let s=e(this);return this._mutate=t,s}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,s=e.clone();const r=Object.assign({},t.spec,s.spec);return s.spec=r,s.internalTests=Object.assign({},t.internalTests,s.internalTests),s._whitelist=t._whitelist.merge(e._whitelist,e._blacklist),s._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),s.tests=t.tests,s.exclusiveTests=t.exclusiveTests,s.withMutation((t=>{e.tests.forEach((e=>{t.test(e.OPTIONS)}))})),s.transforms=[...t.transforms,...s.transforms],s}isType(e){return null==e?!(!this.spec.nullable||null!==e)||!(!this.spec.optional||void 0!==e):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let s=t.conditions;t=t.clone(),t.conditions=[],t=s.reduce(((t,s)=>s.resolve(t,e)),t),t=t.resolve(e)}return t}resolveOptions(e){var t,s,r,n;return Object.assign({},e,{from:e.from||[],strict:null!=(t=e.strict)?t:this.spec.strict,abortEarly:null!=(s=e.abortEarly)?s:this.spec.abortEarly,recursive:null!=(r=e.recursive)?r:this.spec.recursive,disableStackTrace:null!=(n=e.disableStackTrace)?n:this.spec.disableStackTrace})}cast(e,t={}){let s=this.resolve(Object.assign({value:e},t)),r="ignore-optionality"===t.assert,n=s._cast(e,t);if(!1!==t.assert&&!s.isType(n)){if(r&&S(n))return n;let i=u(e),a=u(n);throw new TypeError(`The value of ${t.path||"field"} could not be cast to a value that satisfies the schema type: "${s.type}". \n\nattempted value: ${i} \n`+(a!==i?`result of cast: ${a}`:""))}return n}_cast(e,t){let s=void 0===e?e:this.transforms.reduce(((t,s)=>s.call(this,t,e,this)),e);return void 0===s&&(s=this.getDefault(t)),s}_validate(e,t={},s,r){let{path:n,originalValue:i=e,strict:a=this.spec.strict}=t,o=e;a||(o=this._cast(o,Object.assign({assert:!1},t)));let l=[];for(let e of Object.values(this.internalTests))e&&l.push(e);this.runTests({path:n,value:o,originalValue:i,options:t,tests:l},s,(e=>{if(e.length)return r(e,o);this.runTests({path:n,value:o,originalValue:i,options:t,tests:this.tests},s,r)}))}runTests(e,t,s){let r=!1,{tests:n,value:i,originalValue:a,path:o,options:l}=e,u=e=>{r||(r=!0,t(e,i))},c=e=>{r||(r=!0,s(e,i))},h=n.length,p=[];if(!h)return c([]);let d={value:i,originalValue:a,path:o,options:l,schema:this};for(let e=0;e<n.length;e++){(0,n[e])(d,u,(function(e){e&&(Array.isArray(e)?p.push(...e):p.push(e)),--h<=0&&c(p)}))}}asNestedTest({key:e,index:t,parent:s,parentPath:r,originalParent:n,options:i}){const a=null!=e?e:t;if(null==a)throw TypeError("Must include `key` or `index` for nested validations");const o="number"==typeof a;let l=s[a];const u=Object.assign({},i,{strict:!0,parent:s,value:l,originalValue:n[a],key:void 0,[o?"index":"key"]:a,path:o||a.includes(".")?`${r||""}[${o?a:`"${a}"`}]`:(r?`${r}.`:"")+e});return(e,t,s)=>this.resolve(u)._validate(l,u,t,s)}validate(e,t){var s;let r=this.resolve(Object.assign({},t,{value:e})),n=null!=(s=null==t?void 0:t.disableStackTrace)?s:r.spec.disableStackTrace;return new Promise(((s,i)=>r._validate(e,t,((e,t)=>{y.isError(e)&&(e.value=t),i(e)}),((e,t)=>{e.length?i(new y(e,t,void 0,void 0,n)):s(t)}))))}validateSync(e,t){var s;let r,n=this.resolve(Object.assign({},t,{value:e})),i=null!=(s=null==t?void 0:t.disableStackTrace)?s:n.spec.disableStackTrace;return n._validate(e,Object.assign({},t,{sync:!0}),((e,t)=>{throw y.isError(e)&&(e.value=t),e}),((t,s)=>{if(t.length)throw new y(t,e,void 0,void 0,i);r=s})),r}isValid(e,t){return this.validate(e,t).then((()=>!0),(e=>{if(y.isError(e))return!1;throw e}))}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(y.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this,e):C(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){if(0===arguments.length)return this._getDefault();return this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){const s=this.clone({nullable:e});return s.internalTests.nullable=j({message:t,name:"nullable",test(e){return null!==e||this.schema.spec.nullable}}),s}optionality(e,t){const s=this.clone({optional:e});return s.internalTests.optionality=j({message:t,name:"optionality",test(e){return void 0!==e||this.schema.spec.optional}}),s}optional(){return this.optionality(!0)}defined(e=v.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=v.notNull){return this.nullability(!1,e)}required(e=v.required){return this.clone().withMutation((t=>t.nonNullable(e).defined(e)))}notRequired(){return this.clone().withMutation((e=>e.nullable().optional()))}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=1===e.length?"function"==typeof e[0]?{test:e[0]}:e[0]:2===e.length?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},void 0===t.message&&(t.message=v.default),"function"!=typeof t.test)throw new TypeError("`test` is a required parameters");let s=this.clone(),r=j(t),n=t.exclusive||t.name&&!0===s.exclusiveTests[t.name];if(t.exclusive&&!t.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(s.exclusiveTests[t.name]=!!t.exclusive),s.tests=s.tests.filter((e=>{if(e.OPTIONS.name===t.name){if(n)return!1;if(e.OPTIONS.test===r.OPTIONS.test)return!1}return!0})),s.tests.push(r),s}when(e,t){Array.isArray(e)||"string"==typeof e||(t=e,e=".");let s=this.clone(),r=c(e).map((e=>new E(e)));return r.forEach((e=>{e.isSibling&&s.deps.push(e.key)})),s.conditions.push("function"==typeof t?new $(r,t):$.fromOptions(r,t)),s}typeError(e){let t=this.clone();return t.internalTests.typeError=j({message:e,name:"typeError",skipAbsent:!0,test(e){return!!this.schema._typeCheck(e)||this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=v.oneOf){let s=this.clone();return e.forEach((e=>{s._whitelist.add(e),s._blacklist.delete(e)})),s.internalTests.whiteList=j({message:t,name:"oneOf",skipAbsent:!0,test(e){let t=this.schema._whitelist,s=t.resolveAll(this.resolve);return!!s.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:s}})}}),s}notOneOf(e,t=v.notOneOf){let s=this.clone();return e.forEach((e=>{s._blacklist.add(e),s._whitelist.delete(e)})),s.internalTests.blacklist=j({message:t,name:"notOneOf",test(e){let t=this.schema._blacklist,s=t.resolveAll(this.resolve);return!s.includes(e)||this.createError({params:{values:Array.from(t).join(", "),resolved:s}})}}),s}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){const t=(e?this.resolve(e):this).clone(),{label:s,meta:r,optional:n,nullable:i}=t.spec;return{meta:r,label:s,optional:n,nullable:i,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map((e=>({name:e.OPTIONS.name,params:e.OPTIONS.params}))).filter(((e,t,s)=>s.findIndex((t=>t.name===e.name))===t))}}}V.prototype.__isYupSchema__=!0;for(const e of["validate","validateSync"])V.prototype[`${e}At`]=function(t,s,r={}){const{parent:n,parentPath:i,schema:a}=A(this,t,s,r.context);return a[e](n&&n[i],Object.assign({},r,{parent:n,path:t}))};for(const e of["equals","is"])V.prototype[e]=V.prototype.oneOf;for(const e of["not","nope"])V.prototype[e]=V.prototype.notOneOf;const N=()=>!0;function z(e){return new P(e)}class P extends V{constructor(e){super("function"==typeof e?{type:"mixed",check:e}:Object.assign({type:"mixed",check:N},e))}}function q(){return new I}z.prototype=P.prototype;class I extends V{constructor(){super({type:"boolean",check:e=>(e instanceof Boolean&&(e=e.valueOf()),"boolean"==typeof e)}),this.withMutation((()=>{this.transform(((e,t,s)=>{if(s.spec.coerce&&!s.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e}))}))}isTrue(e=F.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test:e=>S(e)||!0===e})}isFalse(e=F.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test:e=>S(e)||!1===e})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}}q.prototype=I.prototype;const M=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function R(e){var t,s;const r=M.exec(e);return r?{year:U(r[1]),month:U(r[2],1)-1,day:U(r[3],1),hour:U(r[4]),minute:U(r[5]),second:U(r[6]),millisecond:r[7]?U(r[7].substring(0,3)):0,precision:null!=(t=null==(s=r[7])?void 0:s.length)?t:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:U(r[10]),minuteOffset:U(r[11])}:null}function U(e,t=0){return Number(e)||t}let Z=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Y=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,L=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,K=new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"),J=e=>S(e)||e===e.trim(),B={}.toString();function G(){return new H}class H extends V{constructor(){super({type:"string",check:e=>(e instanceof String&&(e=e.valueOf()),"string"==typeof e)}),this.withMutation((()=>{this.transform(((e,t,s)=>{if(!s.spec.coerce||s.isType(e))return e;if(Array.isArray(e))return e;const r=null!=e&&e.toString?e.toString():e;return r===B?e:r}))}))}required(e){return super.required(e).withMutation((t=>t.test({message:e||v.required,name:"required",skipAbsent:!0,test:e=>!!e.length})))}notRequired(){return super.notRequired().withMutation((e=>(e.tests=e.tests.filter((e=>"required"!==e.OPTIONS.name)),e)))}length(e,t=g.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=g.min){return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=g.max){return this.test({name:"max",exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let s,r,n=!1;return t&&("object"==typeof t?({excludeEmptyString:n=!1,message:s,name:r}=t):s=t),this.test({name:r||"matches",message:s||g.matches,params:{regex:e},skipAbsent:!0,test:t=>""===t&&n||-1!==t.search(e)})}email(e=g.email){return this.matches(Z,{name:"email",message:e,excludeEmptyString:!0})}url(e=g.url){return this.matches(Y,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=g.uuid){return this.matches(L,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let t,s,r="";return e&&("object"==typeof e?({message:r="",allowOffset:t=!1,precision:s}=e):r=e),this.matches(K,{name:"datetime",message:r||g.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:r||g.datetime_offset,params:{allowOffset:t},skipAbsent:!0,test:e=>{if(!e||t)return!0;const s=R(e);return!!s&&!!s.z}}).test({name:"datetime_precision",message:r||g.datetime_precision,params:{precision:s},skipAbsent:!0,test:e=>{if(!e||null==s)return!0;const t=R(e);return!!t&&t.precision===s}})}ensure(){return this.default("").transform((e=>null===e?"":e))}trim(e=g.trim){return this.transform((e=>null!=e?e.trim():e)).test({message:e,name:"trim",test:J})}lowercase(e=g.lowercase){return this.transform((e=>S(e)?e:e.toLowerCase())).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>S(e)||e===e.toLowerCase()})}uppercase(e=g.uppercase){return this.transform((e=>S(e)?e:e.toUpperCase())).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:e=>S(e)||e===e.toUpperCase()})}}G.prototype=H.prototype;let Q=new Date("");class W extends V{constructor(){super({type:"date",check(e){return t=e,"[object Date]"===Object.prototype.toString.call(t)&&!isNaN(e.getTime());var t}}),this.withMutation((()=>{this.transform(((e,t,s)=>!s.spec.coerce||s.isType(e)||null===e?e:(e=function(e){const t=R(e);if(!t)return Date.parse?Date.parse(e):Number.NaN;if(void 0===t.z&&void 0===t.plusMinus)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let s=0;return"Z"!==t.z&&void 0!==t.plusMinus&&(s=60*t.hourOffset+t.minuteOffset,"+"===t.plusMinus&&(s=0-s)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+s,t.second,t.millisecond)}(e),isNaN(e)?W.INVALID_DATE:new Date(e))))}))}prepareParam(e,t){let s;if(E.isRef(e))s=e;else{let r=this.cast(e);if(!this._typeCheck(r))throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);s=r}return s}min(e,t=b.min){let s=this.prepareParam(e,"min");return this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(s)}})}max(e,t=b.max){let s=this.prepareParam(e,"max");return this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(s)}})}}function X(e,t){let s=1/0;return e.some(((e,r)=>{var n;if(null!=(n=t.path)&&n.includes(e))return s=r,!0})),s}function ee(e){return(t,s)=>X(e,t)-X(e,s)}W.INVALID_DATE=Q,W.prototype;const te=(e,t,s)=>{if("string"!=typeof e)return e;let r=e;try{r=JSON.parse(e)}catch(e){}return s.isType(r)?r:e};function se(e){if("fields"in e){const t={};for(const[s,r]of Object.entries(e.fields))t[s]=se(r);return e.setFields(t)}if("array"===e.type){const t=e.optional();return t.innerType&&(t.innerType=se(t.innerType)),t}return"tuple"===e.type?e.optional().clone({types:e.spec.types.map(se)}):"optional"in e?e.optional():e}let re=e=>"[object Object]"===Object.prototype.toString.call(e);function ne(e,t){let s=Object.keys(e.fields);return Object.keys(t).filter((e=>-1===s.indexOf(e)))}const ie=ee([]);function ae(e){return new oe(e)}class oe extends V{constructor(e){super({type:"object",check:e=>re(e)||"function"==typeof e}),this.fields=Object.create(null),this._sortErrors=ie,this._nodes=[],this._excludedEdges=[],this.withMutation((()=>{e&&this.shape(e)}))}_cast(e,t={}){var s;let r=super._cast(e,t);if(void 0===r)return this.getDefault(t);if(!this._typeCheck(r))return r;let n=this.fields,i=null!=(s=t.stripUnknown)?s:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(r).filter((e=>!this._nodes.includes(e)))),o={},l=Object.assign({},t,{parent:o,__validating:t.__validating||!1}),u=!1;for(const e of a){let s=n[e],a=e in r;if(s){let n,i=r[e];l.path=(t.path?`${t.path}.`:"")+e,s=s.resolve({value:i,context:t.context,parent:o});let a=s instanceof V?s.spec:void 0,c=null==a?void 0:a.strict;if(null!=a&&a.strip){u=u||e in r;continue}n=t.__validating&&c?r[e]:s.cast(r[e],l),void 0!==n&&(o[e]=n)}else a&&!i&&(o[e]=r[e]);a===e in o&&o[e]===r[e]||(u=!0)}return u?o:r}_validate(e,t={},s,r){let{from:n=[],originalValue:i=e,recursive:a=this.spec.recursive}=t;t.from=[{schema:this,value:i},...n],t.__validating=!0,t.originalValue=i,super._validate(e,t,s,((e,n)=>{if(!a||!re(n))return void r(e,n);i=i||n;let o=[];for(let e of this._nodes){let s=this.fields[e];s&&!E.isRef(s)&&o.push(s.asNestedTest({options:t,key:e,parent:n,parentPath:t.path,originalParent:i}))}this.runTests({tests:o,value:n,originalValue:i,options:t},s,(t=>{r(t.sort(this._sortErrors).concat(e),n)}))}))}clone(e){const t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),s=t.fields;for(let[e,t]of Object.entries(this.fields)){const r=s[e];s[e]=void 0===r?t:r}return t.withMutation((t=>t.setFields(s,[...this._excludedEdges,...e._excludedEdges])))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};return this._nodes.forEach((s=>{var r;const n=this.fields[s];let i=e;null!=(r=i)&&r.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[s]})),t[s]=n&&"getDefault"in n?n.getDefault(i):void 0})),t}setFields(t,r){let n=this.clone();return n.fields=t,n._nodes=function(t,r=[]){let n=[],i=new Set,a=new Set(r.map((([e,t])=>`${e}-${t}`)));function o(t,s){let r=e.split(t)[0];i.add(r),a.has(`${s}-${r}`)||n.push([s,r])}for(const e of Object.keys(t)){let s=t[e];i.add(e),E.isRef(s)&&s.isSibling?o(s.path,e):T(s)&&"deps"in s&&s.deps.forEach((t=>o(t,e)))}return s.array(Array.from(i),n).reverse()}(t,r),n._sortErrors=ee(Object.keys(t)),r&&(n._excludedEdges=r),n}shape(e,t=[]){return this.clone().withMutation((s=>{let r=s._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),r=[...s._excludedEdges,...t]),s.setFields(Object.assign(s.fields,e),r)}))}partial(){const e={};for(const[t,s]of Object.entries(this.fields))e[t]="optional"in s&&s.optional instanceof Function?s.optional():s;return this.setFields(e)}deepPartial(){return se(this)}pick(e){const t={};for(const s of e)this.fields[s]&&(t[s]=this.fields[s]);return this.setFields(t,this._excludedEdges.filter((([t,s])=>e.includes(t)&&e.includes(s))))}omit(e){const t=[];for(const s of Object.keys(this.fields))e.includes(s)||t.push(s);return this.pick(t)}from(t,s,r){let n=e.getter(t,!0);return this.transform((i=>{if(!i)return i;let a=i;return((t,s)=>{const r=[...e.normalizePath(s)];if(1===r.length)return r[0]in t;let n=r.pop(),i=e.getter(e.join(r),!0)(t);return!(!i||!(n in i))})(i,t)&&(a=Object.assign({},i),r||delete a[t],a[s]=n(i)),a}))}json(){return this.transform(te)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||_.exact,test(e){if(null==e)return!0;const t=ne(this.schema,e);return 0===t.length||this.createError({params:{properties:t.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,t=_.noUnknown){"boolean"!=typeof e&&(t=e,e=!0);let s=this.test({name:"noUnknown",exclusive:!0,message:t,test(t){if(null==t)return!0;const s=ne(this.schema,t);return!e||0===s.length||this.createError({params:{unknown:s.join(", ")}})}});return s.spec.noUnknown=e,s}unknown(e=!0,t=_.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform((t=>{if(!t)return t;const s={};for(const r of Object.keys(t))s[e(r)]=t[r];return s}))}camelCase(){return this.transformKeys(t.camelCase)}snakeCase(){return this.transformKeys(t.snakeCase)}constantCase(){return this.transformKeys((e=>t.snakeCase(e).toUpperCase()))}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);s.fields={};for(const[n,i]of Object.entries(t.fields)){var r;let t=e;null!=(r=t)&&r.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[n]})),s.fields[n]=i.describe(t)}return s}}function le(e){return new ue(e)}ae.prototype=oe.prototype;class ue extends V{constructor(e){super({type:"array",spec:{types:e},check:e=>Array.isArray(e)}),this.innerType=void 0,this.innerType=e}_cast(e,t){const s=super._cast(e,t);if(!this._typeCheck(s)||!this.innerType)return s;let r=!1;const n=s.map(((e,s)=>{const n=this.innerType.cast(e,Object.assign({},t,{path:`${t.path||""}[${s}]`}));return n!==e&&(r=!0),n}));return r?n:s}_validate(e,t={},s,r){var n;let i=this.innerType,a=null!=(n=t.recursive)?n:this.spec.recursive;null!=t.originalValue&&t.originalValue,super._validate(e,t,s,((n,o)=>{var l;if(!a||!i||!this._typeCheck(o))return void r(n,o);let u=new Array(o.length);for(let s=0;s<o.length;s++){var c;u[s]=i.asNestedTest({options:t,index:s,parent:o,parentPath:t.path,originalParent:null!=(c=t.originalValue)?c:e})}this.runTests({value:o,tests:u,originalValue:null!=(l=t.originalValue)?l:e,options:t},s,(e=>r(e.concat(n),o)))}))}clone(e){const t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(te)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!T(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+u(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=w.length){return this.test({message:t,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t){return t=t||w.min,this.test({message:t,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t){return t=t||w.max,this.test({message:t,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}ensure(){return this.default((()=>[])).transform(((e,t)=>this._typeCheck(e)?e:null==t?[]:[].concat(t)))}compact(e){let t=e?(t,s,r)=>!e(t,s,r):e=>!!e;return this.transform((e=>null!=e?e.filter(t):e))}describe(e){const t=(e?this.resolve(e):this).clone(),s=super.describe(e);if(t.innerType){var r;let n=e;null!=(r=n)&&r.value&&(n=Object.assign({},n,{parent:n.value,value:n.value[0]})),s.innerType=t.innerType.describe(n)}return s}}function ce(e){return new pe(e)}function he(e){try{return e()}catch(e){if(y.isError(e))return Promise.reject(e);throw e}}le.prototype=ue.prototype;class pe{constructor(e){this.type="lazy",this.__isYupSchema__=!0,this.spec=void 0,this._resolve=(e,t={})=>{let s=this.builder(e,t);if(!T(s))throw new TypeError("lazy() functions must return a valid schema");return this.spec.optional&&(s=s.optional()),s.resolve(t)},this.builder=e,this.spec={meta:void 0,optional:!1}}clone(e){const t=new pe(this.builder);return t.spec=Object.assign({},this.spec,e),t}optionality(e){return this.clone({optional:e})}optional(){return this.optionality(!0)}resolve(e){return this._resolve(e.value,e)}cast(e,t){return this._resolve(e,t).cast(e,t)}asNestedTest(e){let{key:t,index:s,parent:r,options:n}=e,i=r[null!=s?s:t];return this._resolve(i,Object.assign({},n,{value:i,parent:r})).asNestedTest(e)}validate(e,t){return he((()=>this._resolve(e,t).validate(e,t)))}validateSync(e,t){return this._resolve(e,t).validateSync(e,t)}validateAt(e,t,s){return he((()=>this._resolve(t,s).validateAt(e,t,s)))}validateSyncAt(e,t,s){return this._resolve(t,s).validateSyncAt(e,t,s)}isValid(e,t){try{return this._resolve(e,t).isValid(e,t)}catch(e){if(y.isError(e))return Promise.resolve(!1);throw e}}isValidSync(e,t){return this._resolve(e,t).isValidSync(e,t)}describe(e){return e?this.resolve(e).describe(e):{type:"lazy",meta:this.spec.meta,label:void 0}}meta(...e){if(0===e.length)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}}export{ue as ArraySchema,I as BooleanSchema,W as DateSchema,pe as LazySchema,P as MixedSchema,oe as ObjectSchema,V as Schema,H as StringSchema,y as ValidationError,le as array,q as bool,q as boolean,A as getIn,T as isSchema,ce as lazy,z as mixed,ae as object,u as printValue,G as string};
2
2
  //# sourceMappingURL=index.esm.js.map
@@ -1,2 +1,2 @@
1
- import{j as e}from"../../../_virtual/jsx-runtime.js";import{useState as s,useRef as n,useEffect as o}from"react";import{d as i}from"../../../_virtual/index.js";import l from"../SVGLoader/SVGLoader.js";import r from"../../assets/icons/DownArrow.svg.js";import t from"../../assets/icons/CloseIcon.svg.js";import a from"../../assets/icons/DeleteIcon.svg.js";import d from"../../assets/icons/EditIcon.svg.js";import c from"../../assets/icons/DeleteOutlinedIcon.svg.js";import m from"../../assets/icons/Plus.svg.js";import u from"../../assets/icons/PlusSquare.svg.js";import{httpStatusCodes as p,methodColorMapping as v,paramsTableHeaders as h}from"../../constants/index.js";import j from"../Tooltip/Tooltip.js";import x from"../SimpleLabelValue/SimpleLabelValue.js";import{handleStatusColor as g,capitalize as y}from"../../helpers/methodAccordion.helper.js";import C from"../table/table.js";import b from"../dialog/index.js";import N from"../JsonInput/JsonInput.js";import f from"./MethodAccordion.module.scss.js";import w from"../../constants/regex.js";const D=p.map((s=>({label:e.jsxs("div",{className:f.statusCodeOptionContainer,children:[e.jsx("div",{className:f.statusCodeOptionCircle,style:{backgroundColor:g(s)}}),e.jsx("span",{children:s})]}),value:s}))),T=({method:p,path:g,setFieldValue:T,readOnly:I,tags:S,isOpen:$,setIsOpen:A,errors:B})=>{var k,q,O,E,L,_,F,W;const[H,R]=s({request:!1,response:!1,method:!1}),[V,M]=s(!1),[P,z]=s(!1),[J,G]=s({}),[X,K]=s([]);s([]);const[Q,U]=s(!1),[Y,Z]=s(!1),[ee,se]=s(null),[ne,oe]=s(null),[ie,le]=s(null),[re,te]=s(),[ae,de]=s([]),[ce,me]=s([]),[ue,pe]=s(D[4]),[ve,he]=s([]),[je,xe]=s(null),[ge,ye]=s(-1),Ce=p.responses.find((e=>Number(e.code)===ue.value))||"{}",be=n(-1),Ne=(e,s,n)=>{const o=X.map(((o,i)=>i===n?Object.assign(Object.assign({},o),{[e]:s}):o));K(o)},fe=(s,n)=>Object.keys(s).map(((o,r)=>{var t,c,v,h,x,g,C,b,N,D,S,$,A;const B=s[o];return{id:`header_${r}`,paramName:o,paramType:y("header"),schemaType:`${y(null===(t=null==B?void 0:B.schema)||void 0===t?void 0:t.type)||""} ${"array"==(null===(v=null===(c=null==B?void 0:B.schema)||void 0===c?void 0:c.type)||void 0===v?void 0:v.toLowerCase())&&(null===(h=null==B?void 0:B.schema)||void 0===h?void 0:h.items)&&(null===(g=null===(x=null==B?void 0:B.schema)||void 0===x?void 0:x.items)||void 0===g?void 0:g.type)?` _ ${y(null===(b=null===(C=null==B?void 0:B.schema)||void 0===C?void 0:C.items)||void 0===b?void 0:b.type)}`:""}`,required:e.jsx(e.Fragment,{children:I?B.required?"True":"False":e.jsx(i.Switch,{checked:B.required,onClick:()=>{if(I)return null;T(`responses[${n}].headers[${o}].required`,!B.required)}})}),description:e.jsxs("div",{className:f.paramDescContainer,children:[e.jsx(j,{allowHTML:!0,disabled:(null===(N=p.responses[n].headers[o].description)||void 0===N?void 0:N.length)<=12,content:e.jsx("div",{style:{padding:"0.625rem"},children:p.responses[n].headers[o].description}),arrowWithBorder:!0,placement:"bottom-end",type:"function",delay:[0,0],onShow:()=>{var e;return null===(e=J[r])||void 0===e?void 0:e.hide()},children:e.jsxs("p",{style:{alignSelf:"center"},children:[p.responses[n].headers[o].description?p.responses[n].headers[o].description.substring(0,12):I&&"-",p.responses[n].headers[o].description&&p.responses[n].headers[o].description.length>12?"...":""]})},`${r}-description`),!I&&e.jsx(j,{allowHTML:!0,arrowWithBorder:!0,placement:"bottom-end",type:"function",trigger:"click",delay:[0,0],onCreate:e=>G((s=>Object.assign(Object.assign({},s),{[r]:e}))),content:e.jsxs("div",{className:f.editDescTooltipContent,children:[e.jsx("p",{className:f.editDescTooltipContent_header,children:"Description"}),e.jsx(i.TextArea,{placeholder:"Describe parameter...",value:B.description,disabled:I,maxLength:120,onChange:e=>{(""===e||w.ASCII.test(e))&&T(`responses[${be.current}].headers[${o}].description`,e)}}),!I&&e.jsx(i.Button,{className:f.editDescTooltipContent_btn,variant:"outlined",size:"small",onClick:()=>{var e,s;T(`responses[${n}].headers[${o}].description`,null===(e=B.description)||void 0===e?void 0:e.trim()),null===(s=J[r])||void 0===s||s.hide()},disabled:!(null===(D=B.description)||void 0===D?void 0:D.trim()),children:"Apply"})]}),children:I||(null===(S=p.responses[n].headers[o].description)||void 0===S?void 0:S.length)>0?e.jsx(i.Button,{className:f.editDescBtn,variant:"link",color:"action",endIcon:e.jsx(l,{src:d,width:"1.5rem",height:"1.5rem"})}):e.jsxs(i.Button,{className:f.editDescBtn,variant:"link",color:"action",endIcon:e.jsx(l,{src:d,width:"1.5rem",height:"1.5rem"}),children:[I?"View ":"Add "," Description"]})},`${r}-add-edit-description`),!I&&e.jsx("div",{className:f.paramDescContainer_separator}),!I&&e.jsx(i.Button,{className:f.deleteParamBtn,variant:"link",color:"error",endIcon:e.jsx(l,{src:a,width:"1.125rem",height:"1.125rem"}),onClick:()=>De(r,o)})]}),enum:e.jsx(e.Fragment,{children:I?e.jsx("span",{className:"enumText",children:null===(A=null===($=null==B?void 0:B.schema)||void 0===$?void 0:$.enum)||void 0===A?void 0:A.join("/​")}):e.jsx("div",{"data-id":"TEXT_DESCRIPTION",className:"tableData",children:(()=>{var s,n,r;const t=null===(n=null===(s=null==p?void 0:p.responses[ge])||void 0===s?void 0:s.headers[o])||void 0===n?void 0:n.schema,a=null===(r=null==t?void 0:t.type)||void 0===r?void 0:r.toLowerCase(),d="array"===a||"object"===a,c=(null==t?void 0:t.enum)||[];return!t||d?"-":e.jsx(j,{disabled:d,arrowWithBorder:!0,placement:"bottom-end",type:"function",trigger:"click",delay:[0,0],onCreate:e=>xe(e),content:e.jsxs("div",{className:f.editDescTooltipContent,children:[e.jsx("p",{className:f.editDescTooltipContent_header,children:"Enum"}),c.map(((s,n)=>e.jsx(i.Input,{className:"methodDescForEnum",required:!0,clearable:!1,placeholder:"Enter Enum value...",value:s,onChange:e=>{T(`responses[${ge}].headers["${o}"].schema.enum[${n}]`,e)}},n))),e.jsxs("p",{className:"addEnumButton",onClick:()=>{T(`responses[${ge}].headers["${o}"].schema.enum`,[...c,""])},children:[e.jsx(l,{src:u}),"Add New Enum"]}),!I&&e.jsx(i.Button,{className:f.editDescTooltipContent_btn,variant:"outlined",size:"small",type:"button",onClick:()=>{T(`responses[${ge}].headers["${o}"].schema.enum`,[...c]),he([]),null==je||je.hide()},disabled:0===c.length||c.some((e=>!e)),children:"Apply"})]}),children:c.length>0?e.jsx("span",{className:"enumText",children:c.join("/​")}):e.jsx(i.Button,{className:f.editDescBtn,id:"EnumButton",variant:"link",color:"action",endIcon:e.jsx(l,{id:"enumIcon",src:m,width:"1.5rem",height:"1.5rem"}),children:"Add"})})})()})})}})),we=(e,s)=>{se(e),le(s),U(!0)},De=(e,s)=>{oe(e),le(s),Z(!0)};return o((()=>{var s;te(null==(s=X)?void 0:s.map(((s,n)=>{var o,r,t,c,v,h,x,g,C,b,N,D,S,$,A,B,k,q,O,E,L,_,F,W,H,R,V,M,P,z,X,K,Q,U,Y,Z,ee,se,ne,oe,ie,le,re,te,ae,de,ce,me,ue;return{id:n,paramName:s.name,paramType:y(s.in),schemaType:`${y(null===(o=null==s?void 0:s.schema)||void 0===o?void 0:o.type)||""} ${"array"==(null===(t=null===(r=null==s?void 0:s.schema)||void 0===r?void 0:r.type)||void 0===t?void 0:t.toLowerCase())&&(null===(c=null==s?void 0:s.schema)||void 0===c?void 0:c.items)&&(null===(h=null===(v=null==s?void 0:s.schema)||void 0===v?void 0:v.items)||void 0===h?void 0:h.type)?` _ ${y(null===(g=null===(x=null==s?void 0:s.schema)||void 0===x?void 0:x.items)||void 0===g?void 0:g.type)}`:""}`,required:e.jsx(e.Fragment,{children:I?s.required?"True":"False":e.jsx(i.Switch,{checked:s.required,onClick:()=>{if(I)return null;Ne("required",!s.required,n),T(`parameters[${n}][required]`,!s.required)}})}),description:e.jsxs("div",{className:f.paramDescContainer,children:[e.jsx(j,{allowHTML:!0,disabled:(null===(C=p.parameters[n].description)||void 0===C?void 0:C.length)<=12,content:e.jsx("div",{style:{padding:"0.625rem"},children:p.parameters[n].description}),arrowWithBorder:!0,placement:"bottom-end",type:"function",delay:[0,0],onShow:()=>{var e;return null===(e=J[n])||void 0===e?void 0:e.hide()},children:e.jsxs("p",{style:{alignSelf:"center"},children:[p.parameters[n].description?p.parameters[n].description.substring(0,12):I&&"-",p.parameters[n].description&&p.parameters[n].description.length>12?"...":""]})},`${n}-description`),!I&&e.jsx(j,{allowHTML:!0,arrowWithBorder:!0,placement:"bottom-end",type:"function",trigger:"click",delay:[0,0],onCreate:e=>G((s=>Object.assign(Object.assign({},s),{[n]:e}))),content:e.jsxs("div",{className:f.editDescTooltipContent,children:[e.jsx("p",{className:f.editDescTooltipContent_header,children:"Description"}),e.jsx(i.TextArea,{placeholder:"Describe parameter...",value:s.description,disabled:I,maxLength:120,onChange:e=>{(""===e||w.ASCII.test(e))&&Ne("description",e,n)}}),!I&&e.jsx(i.Button,{className:f.editDescTooltipContent_btn,variant:"outlined",size:"small",onClick:()=>{var e,o;T(`parameters[${n}].description`,null===(e=s.description)||void 0===e?void 0:e.trim()),null===(o=J[n])||void 0===o||o.hide()},disabled:!(null===(b=s.description)||void 0===b?void 0:b.trim()),children:"Apply"})]}),children:I||(null===(N=p.parameters[n].description)||void 0===N?void 0:N.length)>0?e.jsx(i.Button,{className:f.editDescBtn,variant:"link",color:"action",endIcon:e.jsx(l,{src:d,width:"1.5rem",height:"1.5rem"})}):e.jsxs(i.Button,{className:f.editDescBtn,variant:"link",color:"action",endIcon:e.jsx(l,{src:d,width:"1.5rem",height:"1.5rem"}),children:[I?"View ":"Add "," Description"]})},`${n}-add-edit-description`),!I&&e.jsx("div",{className:f.paramDescContainer_separator}),!I&&e.jsx(i.Button,{className:f.deleteParamBtn,variant:"link",color:"error",endIcon:e.jsx(l,{src:a,width:"1.125rem",height:"1.125rem"}),onClick:()=>we(n,s.name)})]}),enum:e.jsx(e.Fragment,{children:I?e.jsx("span",{className:"enumText",children:null===(S=null===(D=null==s?void 0:s.schema)||void 0===D?void 0:D.enum)||void 0===S?void 0:S.join("/​")}):e.jsxs("div",{"data-id":"TEXT_DESCRIPTION",className:"tableData",children:[(null===($=p.parameters[n])||void 0===$?void 0:$.schema)&&"array"!=(null===(k=null===(B=null===(A=p.parameters[n])||void 0===A?void 0:A.schema)||void 0===B?void 0:B.type)||void 0===k?void 0:k.toLowerCase())&&"object"!=(null===(E=null===(O=null===(q=p.parameters[n])||void 0===q?void 0:q.schema)||void 0===O?void 0:O.type)||void 0===E?void 0:E.toLowerCase())?e.jsx(j,{disabled:"array"==(null===(F=null===(_=null===(L=p.parameters[n])||void 0===L?void 0:L.schema)||void 0===_?void 0:_.type)||void 0===F?void 0:F.toLowerCase())||"object"==(null===(R=null===(H=null===(W=p.parameters[n])||void 0===W?void 0:W.schema)||void 0===H?void 0:H.type)||void 0===R?void 0:R.toLowerCase()),arrowWithBorder:!0,placement:"bottom-end",type:"function",trigger:"click",delay:[0,0],onCreate:e=>xe(e),content:e.jsxs("div",{className:f.editDescTooltipContent,children:[e.jsx("p",{className:f.editDescTooltipContent_header,children:"Enum"}),!!(null===(M=null===(V=p.parameters[n])||void 0===V?void 0:V.schema)||void 0===M?void 0:M.enum)&&!!(null===(z=null===(P=p.parameters[n])||void 0===P?void 0:P.schema)||void 0===z?void 0:z.enum.length)&&(null===(Q=null===(K=null===(X=p.parameters[n])||void 0===X?void 0:X.schema)||void 0===K?void 0:K.enum)||void 0===Q?void 0:Q.map(((s,o)=>e.jsx(i.Input,{className:"methodDescForEnum",required:!0,clearable:!1,placeholder:"Enter Enum value...",value:s,onChange:e=>{T(`parameters[${n}].schema.enum[${o}]`,e)}},n)))),e.jsxs("p",{className:"addEnumButton",onClick:()=>{var e,s;T(`parameters[${n}].schema.enum`,[...null===(s=null===(e=p.parameters[n])||void 0===e?void 0:e.schema)||void 0===s?void 0:s.enum,""])},children:[e.jsx(l,{src:u}),"Add New Enum"]}),!I&&e.jsx(i.Button,{className:f.editDescTooltipContent_btn,variant:"outlined",size:"small",type:"button",onClick:()=>{T(`parameters[${n}].schema.enum`,[...p.parameters[n].schema.enum]),he([]),null==je||je.hide()},disabled:ve.length>0&&(null==ve?void 0:ve.filter((e=>!e)).length)||(null===(Y=null===(U=null==p?void 0:p.parameters[n])||void 0===U?void 0:U.schema)||void 0===Y?void 0:Y.enum)&&(null===(se=null===(ee=null===(Z=null==p?void 0:p.parameters[n])||void 0===Z?void 0:Z.schema)||void 0===ee?void 0:ee.enum)||void 0===se?void 0:se.length)>0&&(null===(ie=null===(oe=null===(ne=null==p?void 0:p.parameters[n])||void 0===ne?void 0:ne.schema)||void 0===oe?void 0:oe.enum)||void 0===ie?void 0:ie.filter((e=>!e)).length),children:"Apply"})]}),children:(null===(re=null===(le=p.parameters[n])||void 0===le?void 0:le.schema)||void 0===re?void 0:re.enum)&&(null===(de=null===(ae=null===(te=p.parameters[n])||void 0===te?void 0:te.schema)||void 0===ae?void 0:ae.enum)||void 0===de?void 0:de.length)>0?e.jsx("span",{className:"enumText",children:null===(ue=null===(me=null===(ce=p.parameters[n])||void 0===ce?void 0:ce.schema)||void 0===me?void 0:me.enum)||void 0===ue?void 0:ue.join("/​")}):e.jsx(i.Button,{className:f.editDescBtn,id:"EnumButton",variant:"link",color:"action",endIcon:e.jsx(l,{id:"enumIcon",src:m,width:"1.5rem",height:"1.5rem"}),children:"Add"})}):"-"," "]})})}})))}),[X]),o((()=>{(null==p?void 0:p.parameters)&&K(p.parameters)}),[p,g]),o((()=>{if(ue&&p.responses){let e=p.responses.findIndex((e=>e.code.toString()==ue.value.toString()));if(e<0){const s=structuredClone(p.responses);s.push({code:ue.value.toString(),content:{contentType:"application/json",schema:{}},headers:{}}),T&&(T("responses",s),e=0)}ye(e),be.current=e,e>=0&&de(fe(p.responses[e].headers,e))}}),[ue,p.responses,T]),o((()=>{be.current&&be.current>-1&&de(fe(p.responses[be.current].headers,be.current))}),[p.responses,be.current]),o((()=>{var e;if((null==p?void 0:p.tags.length)||(null==S?void 0:S.length)){const s=[...null===(e=(null==p?void 0:p.tags)||[])||void 0===e?void 0:e.map((e=>({label:y(e),value:e}))),...(S||[]).map((e=>({label:y(e.name),value:e.name})))].filter(((e,s,n)=>s===n.findIndex((s=>s.value===e.value))));me(s)}}),[S,p]),e.jsxs("div",{children:[e.jsx(i.Accordion,{expanded:$,onChange:()=>A(!$),className:`${f.methodAccordion} ${I?f.readOnly:""}`,summary:e.jsxs("div",{className:f.methodSummaryContainer,children:[e.jsxs("div",{className:f.methodSummary,children:[e.jsx("span",{style:{backgroundColor:(null===(k=null==v?void 0:v[null==p?void 0:p.type])||void 0===k?void 0:k.color)||"#3A6CD1"},className:f.methodLabel,children:(null===(q=null==v?void 0:v[null==p?void 0:p.type])||void 0===q?void 0:q.label)||(null==p?void 0:p.type)}),e.jsx("span",{className:f.methodPath,children:g})]}),e.jsx("div",{className:`${f.methodExpandArrowContainer} ${$?f.expanded:""}`,children:e.jsx(l,{src:r,width:"2rem",height:"2rem"})})]}),children:e.jsxs("div",{className:f.methodAccordionContent,children:[I?e.jsx(x,{label:"Endpoint Name: ",value:(null==p?void 0:p.summary)||"-"},"summary"):e.jsx(i.Input,{className:f.methodDesc,label:"Endpoint Name",required:!0,placeholder:"Endpoint name...",value:null==p?void 0:p.summary,onChange:e=>{(""===(e=e||"")||w.ASCII.test(e))&&T("summary",e)},onClear:()=>{T("summary","")},errorMsg:null==B?void 0:B.summary}),e.jsx(i.SelectGroup,{className:f.methodDesc,disabled:I,placeholder:"Select Tags",label:"Tags",value:null===(O=p.tags)||void 0===O?void 0:O.map((e=>({label:y(e),value:e}))),onChange:e=>{T("tags",e.map((e=>e.value)))},options:[{list:ce}],isMultiple:!0,withSearch:!1,clearable:!1}),I?e.jsx(x,{label:"Description: ",value:(null==p?void 0:p.description)||"-",className:f.multiLineText},"description"):e.jsx(i.TextArea,{className:f.methodDesc,label:"Description",placeholder:"Describe the method's purpose and functionality...",maxLength:120,value:null==p?void 0:p.description,onChange:e=>{(""===e||w.ASCII.test(e))&&T("description",e)}}),e.jsxs("div",{className:f.paramsTable,children:[e.jsx("h4",{className:f.paramsTableBodyHead,children:"Request Details"}),e.jsx(C,{id:"paramter-request-table",data:re,headCells:h,isFormOpen:V,setIsFormOpen:M,saveNewRow:e=>{K([...X,e]),T("parameters",[...p.parameters,e])},readOnly:I,isRequest:!0}),"get"!==(null==p?void 0:p.type)&&"delete"!==(null==p?void 0:p.type)&&e.jsx(i.Accordion,{expanded:H.request,onChange:()=>null,className:f.requestAccordion,summary:e.jsx("span",{className:f.requestAccordionSummary,children:e.jsxs("div",{className:f.requestAccordionSummary_title,onClick:()=>R((e=>Object.assign(Object.assign({},e),{request:!e.request}))),children:[e.jsx(l,{className:H.request?f.expanded:"",src:r,width:"2rem",height:"2rem"}),"Request","delete"!==(null==p?void 0:p.type)&&e.jsx("span",{style:{color:"red"},children:"*"})]})}),children:e.jsx(N,{acceptType:"JSON",withFooter:!I,className:"jsonField",placeholder:"Enter your request body as a JSON object....",fieldIsDisabled:I,value:(null===(_=null===(L=null===(E=null==p?void 0:p.requestBody)||void 0===E?void 0:E.content)||void 0===L?void 0:L.schema)||void 0===_?void 0:_.properties)||"{}",onChange:e=>{T("requestBody.content.schema.properties",e)},onValidation:()=>null})})]}),e.jsxs("div",{className:f.paramsTable,children:[e.jsxs("div",{className:f.responseHeader,children:[e.jsx("h4",{className:f.paramsTableBodyHead,children:"Response Details"}),e.jsx(i.SelectGroup,{withSearch:!1,isMultiple:!1,clearable:!1,placeholder:"200",options:[{list:D}],value:ue,onChange:e=>{pe(e)}})]}),e.jsx(C,{id:"paramter-response-table",data:ae,headCells:h,isFormOpen:P,setIsFormOpen:z,saveNewRow:e=>{T(`responses[${be.current}].headers[${e.name}]`,e)},readOnly:I,isRequest:!1}),e.jsx(i.Accordion,{expanded:H.response,onChange:()=>null,className:f.responseAccordion,summary:e.jsx("span",{className:f.responseAccordionSummary,children:e.jsxs("div",{className:f.responseAccordionSummary_title,onClick:()=>R((e=>Object.assign(Object.assign({},e),{response:!e.response}))),children:[e.jsx(l,{className:H.response?f.expanded:"",src:r,width:"2rem",height:"2rem"}),"Response",e.jsx("span",{style:{color:"red"},children:"*"})]})}),children:e.jsx(N,{acceptType:"JSON",withFooter:!I,className:"jsonField",placeholder:"Enter your response as a JSON object...",fieldIsDisabled:I,value:(null===(W=null===(F=null==Ce?void 0:Ce.content)||void 0===F?void 0:F.schema)||void 0===W?void 0:W.properties)||"{}",onChange:e=>{const s=p.responses.findIndex((e=>e.code===Ce.code));if(-1!==s)T(`responses[${s}].content.schema.properties`,e);else{const s=structuredClone(p.responses);s.push({code:ue.value.toString(),content:{contentType:"application/json",schema:{type:"object",properties:e}}}),T("responses",s)}},onValidation:e=>null})})]})]})}),e.jsx(b,{status:"error",content:e.jsxs("p",{style:{textAlign:"center",fontWeight:400,fontSize:"1rem",lineHeight:"1.4375rem"},className:"delete-msg-container",children:["Are you sure you want to delete",e.jsxs("span",{className:"plan-name",children:[" ","Parameter ",e.jsx("strong",{children:ie})]}),"?"]}),onSubmit:{onClick:()=>{var e;null!==ee&&(K((e=>e.filter(((e,s)=>s!==ee)))),T("parameters",null===(e=null==p?void 0:p.parameters)||void 0===e?void 0:e.filter(((e,s)=>s!==ee)))),U(!1),se(null)},text:"Delete",color:"error",fullWidth:!0},onCancel:{text:"Cancel",color:"action",fullWidth:!0,variant:"outlined"},onClose:()=>U(!1),open:Q,icon:e.jsx(l,{src:c,width:"4.0625rem",height:"4.0625rem"}),closeIcon:e.jsx(l,{src:t,width:"1.5rem",height:"1.5rem",onClick:()=>U(!1)})}),e.jsx(b,{status:"error",content:e.jsxs("p",{style:{textAlign:"center",fontWeight:400,fontSize:"1rem",lineHeight:"1.4375rem"},className:"delete-msg-container",children:["Are you sure you want to delete",e.jsxs("span",{className:"plan-name",children:[" ","Header ",e.jsx("strong",{children:ie})]}),"?"]}),onSubmit:{onClick:()=>{if(null!==oe){let e=Object.fromEntries(Object.entries(p.responses[be.current].headers).filter((([e])=>e!=ie)));T(`responses[${be.current}].headers`,e)}Z(!1),oe(null)},text:"Delete",color:"error",fullWidth:!0},onCancel:{text:"Cancel",color:"action",fullWidth:!0,variant:"outlined"},onClose:()=>Z(!1),open:Y,icon:e.jsx(l,{src:c,width:"4.0625rem",height:"4.0625rem"}),closeIcon:e.jsx(l,{src:t,width:"1.5rem",height:"1.5rem",onClick:()=>U(!1)})})]})};export{T as default};
1
+ import{j as e}from"../../../_virtual/jsx-runtime.js";import{useState as s,useRef as n,useEffect as o}from"react";import{d as i}from"../../../_virtual/index.js";import l from"../SVGLoader/SVGLoader.js";import r from"../../assets/icons/DownArrow.svg.js";import t from"../../assets/icons/CloseIcon.svg.js";import a from"../../assets/icons/DeleteIcon.svg.js";import d from"../../assets/icons/EditIcon.svg.js";import c from"../../assets/icons/DeleteOutlinedIcon.svg.js";import m from"../../assets/icons/Plus.svg.js";import u from"../../assets/icons/PlusSquare.svg.js";import{httpStatusCodes as p,methodColorMapping as v,paramsTableHeaders as h}from"../../constants/index.js";import j from"../Tooltip/Tooltip.js";import x from"../SimpleLabelValue/SimpleLabelValue.js";import{handleStatusColor as g,capitalize as y}from"../../helpers/methodAccordion.helper.js";import b from"../table/table.js";import C from"../dialog/index.js";import N from"../JsonInput/JsonInput.js";import f from"./MethodAccordion.module.scss.js";import w from"../../constants/regex.js";const D=p.map((s=>({label:e.jsxs("div",{className:f.statusCodeOptionContainer,children:[e.jsx("div",{className:f.statusCodeOptionCircle,style:{backgroundColor:g(s)}}),e.jsx("span",{children:s})]}),value:s}))),T=({method:p,path:g,setFieldValue:T,readOnly:I,tags:S,isOpen:$,setIsOpen:A,errors:k})=>{var B,q,O,E,L,_,F,W;const[H,R]=s({request:!1,response:!1,method:!1}),[V,M]=s(!1),[P,z]=s(!1),[J,G]=s({}),[X,K]=s([]);s([]);const[Q,U]=s(!1),[Y,Z]=s(!1),[ee,se]=s(null),[ne,oe]=s(null),[ie,le]=s(null),[re,te]=s(),[ae,de]=s([]),[ce,me]=s([]),[ue,pe]=s(D[4]),[ve,he]=s([]),[je,xe]=s(null),[ge,ye]=s(-1),be=n(null),Ce=p.responses.find((e=>Number(e.code)===ue.value))||"{}",Ne=n(-1),fe=(e,s,n)=>{const o=X.map(((o,i)=>i===n?Object.assign(Object.assign({},o),{[e]:s}):o));K(o)};o((()=>{$&&be.current&&be.current.scrollIntoView({behavior:"smooth",block:"start"})}),[$]);const we=(s,n)=>Object.keys(s).map(((o,r)=>{var t,c,v,h,x,g,b,C,N,D,S,$,A;const k=s[o];return{id:`header_${r}`,paramName:o,paramType:y("header"),schemaType:`${y(null===(t=null==k?void 0:k.schema)||void 0===t?void 0:t.type)||""} ${"array"==(null===(v=null===(c=null==k?void 0:k.schema)||void 0===c?void 0:c.type)||void 0===v?void 0:v.toLowerCase())&&(null===(h=null==k?void 0:k.schema)||void 0===h?void 0:h.items)&&(null===(g=null===(x=null==k?void 0:k.schema)||void 0===x?void 0:x.items)||void 0===g?void 0:g.type)?` _ ${y(null===(C=null===(b=null==k?void 0:k.schema)||void 0===b?void 0:b.items)||void 0===C?void 0:C.type)}`:""}`,required:e.jsx(e.Fragment,{children:I?k.required?"True":"False":e.jsx(i.Switch,{checked:k.required,onClick:()=>{if(I)return null;T(`responses[${n}].headers[${o}].required`,!k.required)}})}),description:e.jsxs("div",{className:f.paramDescContainer,children:[e.jsx(j,{allowHTML:!0,disabled:(null===(N=p.responses[n].headers[o].description)||void 0===N?void 0:N.length)<=12,content:e.jsx("div",{style:{padding:"0.625rem"},children:p.responses[n].headers[o].description}),arrowWithBorder:!0,placement:"bottom-end",type:"function",delay:[0,0],onShow:()=>{var e;return null===(e=J[r])||void 0===e?void 0:e.hide()},children:e.jsxs("p",{style:{alignSelf:"center"},children:[p.responses[n].headers[o].description?p.responses[n].headers[o].description.substring(0,12):I&&"-",p.responses[n].headers[o].description&&p.responses[n].headers[o].description.length>12?"...":""]})},`${r}-description`),!I&&e.jsx(j,{allowHTML:!0,arrowWithBorder:!0,placement:"bottom-end",type:"function",trigger:"click",delay:[0,0],onCreate:e=>G((s=>Object.assign(Object.assign({},s),{[r]:e}))),content:e.jsxs("div",{className:f.editDescTooltipContent,children:[e.jsx("p",{className:f.editDescTooltipContent_header,children:"Description"}),e.jsx(i.TextArea,{placeholder:"Describe parameter...",value:k.description,disabled:I,maxLength:120,onChange:e=>{(""===e||w.ASCII.test(e))&&T(`responses[${Ne.current}].headers[${o}].description`,e)}}),!I&&e.jsx(i.Button,{className:f.editDescTooltipContent_btn,variant:"outlined",size:"small",onClick:()=>{var e,s;T(`responses[${n}].headers[${o}].description`,null===(e=k.description)||void 0===e?void 0:e.trim()),null===(s=J[r])||void 0===s||s.hide()},disabled:!(null===(D=k.description)||void 0===D?void 0:D.trim()),children:"Apply"})]}),children:I||(null===(S=p.responses[n].headers[o].description)||void 0===S?void 0:S.length)>0?e.jsx(i.Button,{className:f.editDescBtn,variant:"link",color:"action",endIcon:e.jsx(l,{src:d,width:"1.5rem",height:"1.5rem"})}):e.jsxs(i.Button,{className:f.editDescBtn,variant:"link",color:"action",endIcon:e.jsx(l,{src:d,width:"1.5rem",height:"1.5rem"}),children:[I?"View ":"Add "," Description"]})},`${r}-add-edit-description`),!I&&e.jsx("div",{className:f.paramDescContainer_separator}),!I&&e.jsx(i.Button,{className:f.deleteParamBtn,variant:"link",color:"error",endIcon:e.jsx(l,{src:a,width:"1.125rem",height:"1.125rem"}),onClick:()=>Te(r,o)})]}),enum:e.jsx(e.Fragment,{children:I?e.jsx("span",{className:"enumText",children:null===(A=null===($=null==k?void 0:k.schema)||void 0===$?void 0:$.enum)||void 0===A?void 0:A.join("/​")}):e.jsx("div",{"data-id":"TEXT_DESCRIPTION",className:"tableData",children:(()=>{var s,n,r;const t=null===(n=null===(s=null==p?void 0:p.responses[ge])||void 0===s?void 0:s.headers[o])||void 0===n?void 0:n.schema,a=null===(r=null==t?void 0:t.type)||void 0===r?void 0:r.toLowerCase(),d="array"===a||"object"===a,c=(null==t?void 0:t.enum)||[];return!t||d?"-":e.jsx(j,{disabled:d,arrowWithBorder:!0,placement:"bottom-end",type:"function",trigger:"click",delay:[0,0],onCreate:e=>xe(e),content:e.jsxs("div",{className:f.editDescTooltipContent,children:[e.jsx("p",{className:f.editDescTooltipContent_header,children:"Enum"}),c.map(((s,n)=>e.jsx(i.Input,{className:"methodDescForEnum",required:!0,clearable:!1,placeholder:"Enter Enum value...",value:s,onChange:e=>{T(`responses[${ge}].headers["${o}"].schema.enum[${n}]`,e)}},n))),e.jsxs("p",{className:"addEnumButton",onClick:()=>{T(`responses[${ge}].headers["${o}"].schema.enum`,[...c,""])},children:[e.jsx(l,{src:u}),"Add New Enum"]}),!I&&e.jsx(i.Button,{className:f.editDescTooltipContent_btn,variant:"outlined",size:"small",type:"button",onClick:()=>{T(`responses[${ge}].headers["${o}"].schema.enum`,[...c]),he([]),null==je||je.hide()},disabled:0===c.length||c.some((e=>!e)),children:"Apply"})]}),children:c.length>0?e.jsx("span",{className:"enumText",children:c.join("/​")}):e.jsx(i.Button,{className:f.editDescBtn,id:"EnumButton",variant:"link",color:"action",endIcon:e.jsx(l,{id:"enumIcon",src:m,width:"1.5rem",height:"1.5rem"}),children:"Add"})})})()})})}})),De=(e,s)=>{se(e),le(s),U(!0)},Te=(e,s)=>{oe(e),le(s),Z(!0)};return o((()=>{var s;te(null==(s=X)?void 0:s.map(((s,n)=>{var o,r,t,c,v,h,x,g,b,C,N,D,S,$,A,k,B,q,O,E,L,_,F,W,H,R,V,M,P,z,X,K,Q,U,Y,Z,ee,se,ne,oe,ie,le,re,te,ae,de,ce,me,ue;return{id:n,paramName:s.name,paramType:y(s.in),schemaType:`${y(null===(o=null==s?void 0:s.schema)||void 0===o?void 0:o.type)||""} ${"array"==(null===(t=null===(r=null==s?void 0:s.schema)||void 0===r?void 0:r.type)||void 0===t?void 0:t.toLowerCase())&&(null===(c=null==s?void 0:s.schema)||void 0===c?void 0:c.items)&&(null===(h=null===(v=null==s?void 0:s.schema)||void 0===v?void 0:v.items)||void 0===h?void 0:h.type)?` _ ${y(null===(g=null===(x=null==s?void 0:s.schema)||void 0===x?void 0:x.items)||void 0===g?void 0:g.type)}`:""}`,required:e.jsx(e.Fragment,{children:I?s.required?"True":"False":e.jsx(i.Switch,{checked:s.required,onClick:()=>{if(I)return null;fe("required",!s.required,n),T(`parameters[${n}][required]`,!s.required)}})}),description:e.jsxs("div",{className:f.paramDescContainer,children:[e.jsx(j,{allowHTML:!0,disabled:(null===(b=p.parameters[n].description)||void 0===b?void 0:b.length)<=12,content:e.jsx("div",{style:{padding:"0.625rem"},children:p.parameters[n].description}),arrowWithBorder:!0,placement:"bottom-end",type:"function",delay:[0,0],onShow:()=>{var e;return null===(e=J[n])||void 0===e?void 0:e.hide()},children:e.jsxs("p",{style:{alignSelf:"center"},children:[p.parameters[n].description?p.parameters[n].description.substring(0,12):I&&"-",p.parameters[n].description&&p.parameters[n].description.length>12?"...":""]})},`${n}-description`),!I&&e.jsx(j,{allowHTML:!0,arrowWithBorder:!0,placement:"bottom-end",type:"function",trigger:"click",delay:[0,0],onCreate:e=>G((s=>Object.assign(Object.assign({},s),{[n]:e}))),content:e.jsxs("div",{className:f.editDescTooltipContent,children:[e.jsx("p",{className:f.editDescTooltipContent_header,children:"Description"}),e.jsx(i.TextArea,{placeholder:"Describe parameter...",value:s.description,disabled:I,maxLength:120,onChange:e=>{(""===e||w.ASCII.test(e))&&fe("description",e,n)}}),!I&&e.jsx(i.Button,{className:f.editDescTooltipContent_btn,variant:"outlined",size:"small",onClick:()=>{var e,o;T(`parameters[${n}].description`,null===(e=s.description)||void 0===e?void 0:e.trim()),null===(o=J[n])||void 0===o||o.hide()},disabled:!(null===(C=s.description)||void 0===C?void 0:C.trim()),children:"Apply"})]}),children:I||(null===(N=p.parameters[n].description)||void 0===N?void 0:N.length)>0?e.jsx(i.Button,{className:f.editDescBtn,variant:"link",color:"action",endIcon:e.jsx(l,{src:d,width:"1.5rem",height:"1.5rem"})}):e.jsxs(i.Button,{className:f.editDescBtn,variant:"link",color:"action",endIcon:e.jsx(l,{src:d,width:"1.5rem",height:"1.5rem"}),children:[I?"View ":"Add "," Description"]})},`${n}-add-edit-description`),!I&&e.jsx("div",{className:f.paramDescContainer_separator}),!I&&e.jsx(i.Button,{className:f.deleteParamBtn,variant:"link",color:"error",endIcon:e.jsx(l,{src:a,width:"1.125rem",height:"1.125rem"}),onClick:()=>De(n,s.name)})]}),enum:e.jsx(e.Fragment,{children:I?e.jsx("span",{className:"enumText",children:null===(S=null===(D=null==s?void 0:s.schema)||void 0===D?void 0:D.enum)||void 0===S?void 0:S.join("/​")}):e.jsxs("div",{"data-id":"TEXT_DESCRIPTION",className:"tableData",children:[(null===($=p.parameters[n])||void 0===$?void 0:$.schema)&&"array"!=(null===(B=null===(k=null===(A=p.parameters[n])||void 0===A?void 0:A.schema)||void 0===k?void 0:k.type)||void 0===B?void 0:B.toLowerCase())&&"object"!=(null===(E=null===(O=null===(q=p.parameters[n])||void 0===q?void 0:q.schema)||void 0===O?void 0:O.type)||void 0===E?void 0:E.toLowerCase())?e.jsx(j,{disabled:"array"==(null===(F=null===(_=null===(L=p.parameters[n])||void 0===L?void 0:L.schema)||void 0===_?void 0:_.type)||void 0===F?void 0:F.toLowerCase())||"object"==(null===(R=null===(H=null===(W=p.parameters[n])||void 0===W?void 0:W.schema)||void 0===H?void 0:H.type)||void 0===R?void 0:R.toLowerCase()),arrowWithBorder:!0,placement:"bottom-end",type:"function",trigger:"click",delay:[0,0],onCreate:e=>xe(e),content:e.jsxs("div",{className:f.editDescTooltipContent,children:[e.jsx("p",{className:f.editDescTooltipContent_header,children:"Enum"}),!!(null===(M=null===(V=p.parameters[n])||void 0===V?void 0:V.schema)||void 0===M?void 0:M.enum)&&!!(null===(z=null===(P=p.parameters[n])||void 0===P?void 0:P.schema)||void 0===z?void 0:z.enum.length)&&(null===(Q=null===(K=null===(X=p.parameters[n])||void 0===X?void 0:X.schema)||void 0===K?void 0:K.enum)||void 0===Q?void 0:Q.map(((s,o)=>e.jsx(i.Input,{className:"methodDescForEnum",required:!0,clearable:!1,placeholder:"Enter Enum value...",value:s,onChange:e=>{T(`parameters[${n}].schema.enum[${o}]`,e)}},n)))),e.jsxs("p",{className:"addEnumButton",onClick:()=>{var e,s;T(`parameters[${n}].schema.enum`,[...null===(s=null===(e=p.parameters[n])||void 0===e?void 0:e.schema)||void 0===s?void 0:s.enum,""])},children:[e.jsx(l,{src:u}),"Add New Enum"]}),!I&&e.jsx(i.Button,{className:f.editDescTooltipContent_btn,variant:"outlined",size:"small",type:"button",onClick:()=>{T(`parameters[${n}].schema.enum`,[...p.parameters[n].schema.enum]),he([]),null==je||je.hide()},disabled:ve.length>0&&(null==ve?void 0:ve.filter((e=>!e)).length)||(null===(Y=null===(U=null==p?void 0:p.parameters[n])||void 0===U?void 0:U.schema)||void 0===Y?void 0:Y.enum)&&(null===(se=null===(ee=null===(Z=null==p?void 0:p.parameters[n])||void 0===Z?void 0:Z.schema)||void 0===ee?void 0:ee.enum)||void 0===se?void 0:se.length)>0&&(null===(ie=null===(oe=null===(ne=null==p?void 0:p.parameters[n])||void 0===ne?void 0:ne.schema)||void 0===oe?void 0:oe.enum)||void 0===ie?void 0:ie.filter((e=>!e)).length),children:"Apply"})]}),children:(null===(re=null===(le=p.parameters[n])||void 0===le?void 0:le.schema)||void 0===re?void 0:re.enum)&&(null===(de=null===(ae=null===(te=p.parameters[n])||void 0===te?void 0:te.schema)||void 0===ae?void 0:ae.enum)||void 0===de?void 0:de.length)>0?e.jsx("span",{className:"enumText",children:null===(ue=null===(me=null===(ce=p.parameters[n])||void 0===ce?void 0:ce.schema)||void 0===me?void 0:me.enum)||void 0===ue?void 0:ue.join("/​")}):e.jsx(i.Button,{className:f.editDescBtn,id:"EnumButton",variant:"link",color:"action",endIcon:e.jsx(l,{id:"enumIcon",src:m,width:"1.5rem",height:"1.5rem"}),children:"Add"})}):"-"," "]})})}})))}),[X]),o((()=>{(null==p?void 0:p.parameters)&&K(p.parameters)}),[p,g]),o((()=>{if(ue&&p.responses){let e=p.responses.findIndex((e=>e.code.toString()==ue.value.toString()));if(e<0){const s=structuredClone(p.responses);s.push({code:ue.value.toString(),content:{contentType:"application/json",schema:{}},headers:{}}),T&&(T("responses",s),e=0)}ye(e),Ne.current=e,e>=0&&de(we(p.responses[e].headers,e))}}),[ue,p.responses,T]),o((()=>{Ne.current&&Ne.current>-1&&de(we(p.responses[Ne.current].headers,Ne.current))}),[p.responses,Ne.current]),o((()=>{var e;if((null==p?void 0:p.tags.length)||(null==S?void 0:S.length)){const s=[...null===(e=(null==p?void 0:p.tags)||[])||void 0===e?void 0:e.map((e=>({label:y(e),value:e}))),...(S||[]).map((e=>({label:y(e.name),value:e.name})))].filter(((e,s,n)=>s===n.findIndex((s=>s.value===e.value))));me(s)}}),[S,p]),e.jsxs("div",{ref:be,children:[e.jsx(i.Accordion,{expanded:$,onChange:()=>A(!$),className:`${f.methodAccordion} ${I?f.readOnly:""}`,summary:e.jsxs("div",{className:f.methodSummaryContainer,children:[e.jsxs("div",{className:f.methodSummary,children:[e.jsx("span",{style:{backgroundColor:(null===(B=null==v?void 0:v[null==p?void 0:p.type])||void 0===B?void 0:B.color)||"#3A6CD1"},className:f.methodLabel,children:(null===(q=null==v?void 0:v[null==p?void 0:p.type])||void 0===q?void 0:q.label)||(null==p?void 0:p.type)}),e.jsx("span",{className:f.methodPath,children:g})]}),e.jsx("div",{className:`${f.methodExpandArrowContainer} ${$?f.expanded:""}`,children:e.jsx(l,{src:r,width:"2rem",height:"2rem"})})]}),children:e.jsxs("div",{className:f.methodAccordionContent,children:[I?e.jsx(x,{label:"Endpoint Name: ",value:(null==p?void 0:p.summary)||"-"},"summary"):e.jsx(i.Input,{className:f.methodDesc,label:"Endpoint Name",required:!0,placeholder:"Endpoint name...",value:null==p?void 0:p.summary,onChange:e=>{(""===(e=e||"")||w.ASCII.test(e))&&T("summary",e)},onClear:()=>{T("summary","")},errorMsg:null==k?void 0:k.summary}),e.jsx(i.SelectGroup,{className:f.methodDesc,disabled:I,placeholder:"Select Tags",label:"Tags",value:null===(O=p.tags)||void 0===O?void 0:O.map((e=>({label:y(e),value:e}))),onChange:e=>{T("tags",e.map((e=>e.value)))},options:[{list:ce}],isMultiple:!0,withSearch:!1,clearable:!1}),I?e.jsx(x,{label:"Description: ",value:(null==p?void 0:p.description)||"-",className:f.multiLineText},"description"):e.jsx(i.TextArea,{className:f.methodDesc,label:"Description",placeholder:"Describe the method's purpose and functionality...",maxLength:120,value:null==p?void 0:p.description,onChange:e=>{(""===e||w.ASCII.test(e))&&T("description",e)}}),e.jsxs("div",{className:f.paramsTable,children:[e.jsx("h4",{className:f.paramsTableBodyHead,children:"Request Details"}),e.jsx(b,{id:"paramter-request-table",data:re,headCells:h,isFormOpen:V,setIsFormOpen:M,saveNewRow:e=>{K([...X,e]),T("parameters",[...p.parameters,e])},readOnly:I,isRequest:!0}),"get"!==(null==p?void 0:p.type)&&"delete"!==(null==p?void 0:p.type)&&e.jsx(i.Accordion,{expanded:H.request,onChange:()=>null,className:f.requestAccordion,summary:e.jsx("span",{className:f.requestAccordionSummary,children:e.jsxs("div",{className:f.requestAccordionSummary_title,onClick:()=>R((e=>Object.assign(Object.assign({},e),{request:!e.request}))),children:[e.jsx(l,{className:H.request?f.expanded:"",src:r,width:"2rem",height:"2rem"}),"Request","delete"!==(null==p?void 0:p.type)&&e.jsx("span",{style:{color:"red"},children:"*"})]})}),children:e.jsx(N,{acceptType:"JSON",withFooter:!I,className:"jsonField",placeholder:"Enter your request body as a JSON object....",fieldIsDisabled:I,value:(null===(_=null===(L=null===(E=null==p?void 0:p.requestBody)||void 0===E?void 0:E.content)||void 0===L?void 0:L.schema)||void 0===_?void 0:_.properties)||"{}",onChange:e=>{T("requestBody.content.schema.properties",e)},onValidation:()=>null})})]}),e.jsxs("div",{className:f.paramsTable,children:[e.jsxs("div",{className:f.responseHeader,children:[e.jsx("h4",{className:f.paramsTableBodyHead,children:"Response Details"}),e.jsx(i.SelectGroup,{withSearch:!1,isMultiple:!1,clearable:!1,placeholder:"200",options:[{list:D}],value:ue,onChange:e=>{pe(e)}})]}),e.jsx(b,{id:"paramter-response-table",data:ae,headCells:h,isFormOpen:P,setIsFormOpen:z,saveNewRow:e=>{T(`responses[${Ne.current}].headers[${e.name}]`,e)},readOnly:I,isRequest:!1}),e.jsx(i.Accordion,{expanded:H.response,onChange:()=>null,className:f.responseAccordion,summary:e.jsx("span",{className:f.responseAccordionSummary,children:e.jsxs("div",{className:f.responseAccordionSummary_title,onClick:()=>R((e=>Object.assign(Object.assign({},e),{response:!e.response}))),children:[e.jsx(l,{className:H.response?f.expanded:"",src:r,width:"2rem",height:"2rem"}),"Response",e.jsx("span",{style:{color:"red"},children:"*"})]})}),children:e.jsx(N,{acceptType:"JSON",withFooter:!I,className:"jsonField",placeholder:"Enter your response as a JSON object...",fieldIsDisabled:I,value:(null===(W=null===(F=null==Ce?void 0:Ce.content)||void 0===F?void 0:F.schema)||void 0===W?void 0:W.properties)||"{}",onChange:e=>{const s=p.responses.findIndex((e=>e.code===Ce.code));if(-1!==s)T(`responses[${s}].content.schema.properties`,e);else{const s=structuredClone(p.responses);s.push({code:ue.value.toString(),content:{contentType:"application/json",schema:{type:"object",properties:e}}}),T("responses",s)}},onValidation:e=>null})})]})]})}),e.jsx(C,{status:"error",content:e.jsxs("p",{style:{textAlign:"center",fontWeight:400,fontSize:"1rem",lineHeight:"1.4375rem"},className:"delete-msg-container",children:["Are you sure you want to delete",e.jsxs("span",{className:"plan-name",children:[" ","Parameter ",e.jsx("strong",{children:ie})]}),"?"]}),onSubmit:{onClick:()=>{var e;null!==ee&&(K((e=>e.filter(((e,s)=>s!==ee)))),T("parameters",null===(e=null==p?void 0:p.parameters)||void 0===e?void 0:e.filter(((e,s)=>s!==ee)))),U(!1),se(null)},text:"Delete",color:"error",fullWidth:!0},onCancel:{text:"Cancel",color:"action",fullWidth:!0,variant:"outlined"},onClose:()=>U(!1),open:Q,icon:e.jsx(l,{src:c,width:"4.0625rem",height:"4.0625rem"}),closeIcon:e.jsx(l,{src:t,width:"1.5rem",height:"1.5rem",onClick:()=>U(!1)})}),e.jsx(C,{status:"error",content:e.jsxs("p",{style:{textAlign:"center",fontWeight:400,fontSize:"1rem",lineHeight:"1.4375rem"},className:"delete-msg-container",children:["Are you sure you want to delete",e.jsxs("span",{className:"plan-name",children:[" ","Header ",e.jsx("strong",{children:ie})]}),"?"]}),onSubmit:{onClick:()=>{if(null!==oe){let e=Object.fromEntries(Object.entries(p.responses[Ne.current].headers).filter((([e])=>e!=ie)));T(`responses[${Ne.current}].headers`,e)}Z(!1),oe(null)},text:"Delete",color:"error",fullWidth:!0},onCancel:{text:"Cancel",color:"action",fullWidth:!0,variant:"outlined"},onClose:()=>Z(!1),open:Y,icon:e.jsx(l,{src:c,width:"4.0625rem",height:"4.0625rem"}),closeIcon:e.jsx(l,{src:t,width:"1.5rem",height:"1.5rem",onClick:()=>U(!1)})})]})};export{T as default};
2
2
  //# sourceMappingURL=MethodAccordion.js.map