!function r(o,i,a){function l(t,e){if(!i[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(s)return s(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}n=i[t]={exports:{}},o[t][0].call(n.exports,function(e){return l(o[t][1][e]||e)},n,n.exports,r,o,i,a)}return i[t].exports}for(var s="function"==typeof require&&require,e=0;e(0,o.ensureArray)(t).map(e=>"@see "+e).join("\n");if(e&&null!=t&&t.length)return e+"\n\n"+n();return e||n()}(e.description,e.see):void 0;return{...t,...e.title?{title:e.title}:{},...n?{description:n}:{},...e.default?{default:e.default}:{},...e.examples?{examples:e.examples}:{},...e.comment?{$comment:e.comment}:{}}},n.annotateCoreTypes=function(e,t){var{description:n,see:r}=function(e){var t=(null!=e?e:"").split("\n"),n=[];for(;0s(e)),e=(0,a.annotateJsonSchema)(e,{anyOf:t});return 1{return e=e,!(1===(e=Object.keys(e).sort()).length&&"type"===e[0]||2===e.length&&"title"===e[0]&&"type"===e[1])})&&(delete e.anyOf,e.type=t.map(({type:e})=>e)),e}function s(t){if("any"===t.type)return(0,a.annotateJsonSchema)(t,u(t,{}));if("null"===t.type)return(0,a.annotateJsonSchema)(t,{type:"null"});if("boolean"===t.type)return(0,a.annotateJsonSchema)(t,u(t,{type:"boolean"}));if("string"===t.type)return(0,a.annotateJsonSchema)(t,u(t,{type:"string"}));if("number"===t.type)return(0,a.annotateJsonSchema)(t,u(t,{type:"number"}));if("integer"===t.type)return(0,a.annotateJsonSchema)(t,u(t,{type:"integer"}));if("and"===t.type)return(0,a.annotateJsonSchema)(t,{allOf:t.and.map(e=>s(e))});if("or"===t.type)return l(t);var e,n,r;if("object"===t.type)return n=(e=Object.keys(t.properties)).filter(e=>t.properties[e].required),r=Object.fromEntries(e.map(e=>[e,s(t.properties[e].node)])),(0,a.annotateJsonSchema)(t,u(t,{type:"object",...0s(e)),...!0===t.additionalItems?{}:t.additionalItems?{additionalItems:s(t.additionalItems)}:{additionalItems:!1},minItems:t.minItems}));if("ref"===t.type)return(0,a.annotateJsonSchema)(t,u(t,{$ref:(0,o.encodeRefNameJsonSchema)(t.ref)}));throw new i.UnsupportedError(`core-types node of type ${t.type} not supported`,t)}function u(e,t){return void 0!==e.const?{...t,const:e.const}:e.enum?{...t,enum:e.enum}:t}n.decorateSchema=r,n.convertCoreTypesToJsonSchema=function(e,t){var{version:e,types:n}=e;if(1!==e)throw new i.UnsupportedError(`core-types version ${e} not supported`);return r(e={definitions:Object.fromEntries(n.map(e=>[e.name,s(e)]))},null!=t?t:{}),{data:e,convertedTypes:n.map(({name:e})=>e),notConvertedTypes:[]}}},{"./annotations":2,"core-types":6,"openapi-json-schema":18}],4:[function(e,t,c){Object.defineProperty(c,"__esModule",{value:!0}),c.complexProps=c.convertJsonSchemaToCoreTypes=void 0;let i=e("jsonpos"),p=e("openapi-json-schema"),O=e("core-types"),f=e("./annotations"),d=(e,t)=>({...e,path:[...e.path,t]});function m(n,l){if("boolean"==typeof n)l.throwUnsupportedError("Boolean JSON Schema definition not supported",{blob:{schema:n}});else if("object"==typeof(e=n)&&Object.keys(e).some(e=>c.complexProps.has(e))){e=function(t,n){let{$ref:r,type:a,enum:l,const:s,items:u,additionalItems:c,required:p,properties:f,additionalProperties:d,then:e,else:o,allOf:i,anyOf:m,oneOf:y}=t;var h=i&&"object"==typeof i?i.filter(e=>e&&"object"==typeof e):null,b=m&&"object"==typeof m?m.filter(e=>e&&"object"==typeof e):null,g=y&&"object"==typeof y?y.filter(e=>e&&"object"==typeof e):null;let v=(e,o)=>{var i=(e,t)=>!(e&&t&&!(0,O.isEqual)(e,t));if(i(r,o.$ref)||n.throwUnsupportedError(`Cannot have $ref in a node *and* in its '${e}'`,{blob:t}),i(a,o.type)||n.throwUnsupportedError(`Cannot have 'type' in a node *and* in its '${e}'`,{blob:t}),l)if(o.enum){var i=(0,O.intersection)(l,o.enum);if(0===i.length)throw new O.MalformedTypeError("Cannot merge types with non-intersecting enums",{path:n.path,blob:{child:[...n.path,e]}});o.enum=i}else o.enum=l;if(void 0!==s)if(void 0!==o.const){if((0,O.isEqual)(s,o.const))throw new O.MalformedTypeError("Cannot merge types with mismatching const",{path:n.path,blob:{child:[...n.path,e]}})}else o.const=s;if(o.items=null!=(i=o.items)?i:u,o.additionalItems=null!=(e=o.additionalItems)?e:c,void 0===p&&void 0===o.required||(o.required=(0,O.union)(null!=(i=o.required)?i:[],null!==p&&void 0!==p?p:[])),void 0===f!=(void 0===o.properties))null!=o.properties||(o.properties=f);else if(void 0!==f){let t=f,n=o.properties;e=Object.keys(t),i=Object.keys(n),e=(0,O.union)(e,i);let r={};e.forEach(e=>{void 0!==t[e]?r[e]=n[e]:void 0!==n[e]?r[e]=t[e]:r[e]={allOf:[t[e],n[e]]}})}void 0===d!=(void 0===o.additionalProperties)?null==o.additionalProperties&&(o.additionalProperties=d):void 0!==d&&(o.additionalProperties={allOf:[o.additionalProperties,d]})};return e&&"object"==typeof e&&v("then",e),o&&"object"==typeof o&&v("else",o),h&&"object"==typeof h&&h.forEach(e=>v("allOf",e)),b&&"object"==typeof b&&b.forEach(e=>v("anyOf",e)),g&&"object"==typeof g&&g.forEach(e=>v("oneOf",e)),{...e&&"object"==typeof e?{then:e}:{},...o&&"object"==typeof o?{else:o}:{},...h&&"object"==typeof h?{allOf:h}:{},...b&&"object"==typeof b?{anyOf:b}:{},...g&&"object"==typeof g?{oneOf:g}:{}}}(n,l);var r=l;var{then:e,else:t,allOf:o,anyOf:i,oneOf:a}=e,e=[...e?[[d(r,"then"),e]]:[],...t?[[d(r,"else"),t]]:[]],t=[...i?i.map((e,t)=>[d(d(r,"anyOf"),t),e]):[],...a?a.map((e,t)=>[d(d(r,"oneOf"),t),e]):[]],i=[...o?o.map((e,t)=>[d(d(r,"allOf"),t),e]):[]];return{type:"and",and:[{type:"or",or:e.map(([e,t])=>m(t,e))},{type:"or",or:t.map(([e,t])=>m(t,e))},{type:"and",and:i.map(([e,t])=>m(t,e))}]};return}void 0===n&&l.throwUnsupportedError("Internal error",{blob:{schema:n}});let s=e=>({type:"ref",ref:(0,p.decodeRefNameJsonSchema)(e)});var a=e=>void 0===n.$ref?e:{type:"and",and:[e,s(n.$ref)]},{const:o,enum:e}=n;let u={...void 0!==o?{const:o}:{},...void 0!==e?{enum:e}:{}};return void 0===n.type?n.$ref?{...s(n.$ref),...u}:{type:"any",...u}:1===(t=(0,O.ensureArray)(n.type).map(e=>{var t,r=n,o=u,i=l;if(y(e))return"null"===e?(0,f.annotateCoreTypes)({type:"null"},r):(0,f.annotateCoreTypes)({type:e,...o},r);if("array"===e)return Array.isArray(r.items)?(0,f.annotateCoreTypes)({type:"tuple",elementTypes:r.items.map(e=>m(e,d(i,"items"))),additionalItems:void 0===r.additionalItems||("boolean"==typeof r.additionalItems?r.additionalItems:m(r.additionalItems,d(i,"additionalItems"))),minItems:null!=(a=r.minItems)?a:0,...o},r):!1===r.items?(0,f.annotateCoreTypes)({type:"tuple",elementTypes:[],additionalItems:!1,minItems:0,...o},r):(0,f.annotateCoreTypes)({type:"array",elementType:void 0===r.items||!0===r.items?{type:"any"}:m(r.items,d(i,"items")),...o},r);if("object"===e){let n=new Set(null!=(a=r.required)?a:[]);var a=null!=(a=r.additionalProperties)?a:i.defaultAdditionalProperties;return(0,f.annotateCoreTypes)({type:"object",properties:Object.fromEntries(Object.entries(null!=(t=r.properties)?t:{}).map(([e,t])=>[e,{node:m(t,d(d(i,"properties"),e)),required:n.has(e)}])),additionalProperties:"boolean"==typeof a?a:m(a,d(i,"additionalProperties")),...o},r)}i.throwUnsupportedError(`Unsupported JSON Schema type "${e}"`,{blob:{schema:r}})})).length?a(t[0]):a({type:"or",or:t})}c.convertJsonSchemaToCoreTypes=function(e,n={}){let r=("string"==typeof e?(0,i.getAstByString):(0,i.getAstByObject))(e),o=(e=r.json)["definitions"];return{data:e={version:1,types:Object.keys(null!==o&&void 0!==o?o:{}).map(e=>{var t;return{...m((null!==o&&void 0!==o?o:{})[e],{locByPath(){return{path:this.path,loc:(0,i.getLocation)(r,{dataPath:this.path,markIdentifier:!0})}},path:["definitions",e],throwUnsupportedError(e,t){throw(t={...t}).path||(t.path=this.path),t.loc||(t.loc=(0,i.getLocation)(r,{dataPath:this.path,markIdentifier:!0})),new O.UnsupportedError(e,t)},defaultAdditionalProperties:null==(t=n.defaultAdditionalProperties)||t}),name:e}})},convertedTypes:e.types.map(({name:e})=>e),notConvertedTypes:[]}},c.complexProps=new Set(["anyOf","allOf","oneOf","then","else"]);let y=e=>["string","number","integer","boolean","null"].includes(e)},{"./annotations":2,"core-types":6,jsonpos:25,"openapi-json-schema":18}],5:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.convertOpenApiToCoreTypes=n.convertCoreTypesToOpenApi=void 0;let o=e("openapi-json-schema"),i=e("./core-types-to-json-schema"),r=e("./json-schema-to-core-types");n.convertCoreTypesToOpenApi=function(e,t){let{data:n,...r}=(0,i.convertCoreTypesToJsonSchema)(e,t);return{...r,data:(0,o.jsonSchemaDocumentToOpenApi)(n,t)}},n.convertOpenApiToCoreTypes=function(e){return e="string"==typeof e?JSON.parse(e):e,e=(0,o.openApiToJsonSchema)(e),(0,r.convertJsonSchemaToCoreTypes)(e)}},{"./core-types-to-json-schema":3,"./json-schema-to-core-types":4,"openapi-json-schema":18}],6:[function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){e[r=void 0===r?n:r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},i=(Object.defineProperty(n,"__esModule",{value:!0}),n.traverse=n.some=n.mergeLocations=n.getPositionOffset=n.locationToLineColumn=n.positionToLineColumn=n.decorateError=n.decorateErrorMeta=n.isCoreTypesError=n.throwRelatedError=n.throwUnsupportedError=n.RelatedError=n.UnsupportedError=n.MissingReferenceError=n.MalformedTypeError=n.formatSee=n.formatDefault=n.formatExamples=n.stringify=n.stripAnnotations=n.stringifyAnnotations=n.extractAnnotations=n.mergeAnnotations=n.isNonNullable=n.union=n.intersection=n.isEqual=n.hasConstEnum=n.isPrimitiveType=n.ensureArray=n.validate=n.simplify=void 0,o(e("./lib/types"),n),e("./lib/simplify")),a=(Object.defineProperty(n,"simplify",{enumerable:!0,get:function(){return i.simplify}}),e("./lib/validate")),l=(Object.defineProperty(n,"validate",{enumerable:!0,get:function(){return a.validate}}),e("./lib/util")),s=(Object.defineProperty(n,"ensureArray",{enumerable:!0,get:function(){return l.ensureArray}}),Object.defineProperty(n,"isPrimitiveType",{enumerable:!0,get:function(){return l.isPrimitiveType}}),Object.defineProperty(n,"hasConstEnum",{enumerable:!0,get:function(){return l.hasConstEnum}}),Object.defineProperty(n,"isEqual",{enumerable:!0,get:function(){return l.isEqual}}),Object.defineProperty(n,"intersection",{enumerable:!0,get:function(){return l.intersection}}),Object.defineProperty(n,"union",{enumerable:!0,get:function(){return l.union}}),Object.defineProperty(n,"isNonNullable",{enumerable:!0,get:function(){return l.isNonNullable}}),e("./lib/annotation")),u=(Object.defineProperty(n,"mergeAnnotations",{enumerable:!0,get:function(){return s.mergeAnnotations}}),Object.defineProperty(n,"extractAnnotations",{enumerable:!0,get:function(){return s.extractAnnotations}}),Object.defineProperty(n,"stringifyAnnotations",{enumerable:!0,get:function(){return s.stringifyAnnotations}}),Object.defineProperty(n,"stripAnnotations",{enumerable:!0,get:function(){return s.stripAnnotations}}),Object.defineProperty(n,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(n,"formatExamples",{enumerable:!0,get:function(){return s.formatExamples}}),Object.defineProperty(n,"formatDefault",{enumerable:!0,get:function(){return s.formatDefault}}),Object.defineProperty(n,"formatSee",{enumerable:!0,get:function(){return s.formatSee}}),e("./lib/error")),c=(Object.defineProperty(n,"MalformedTypeError",{enumerable:!0,get:function(){return u.MalformedTypeError}}),Object.defineProperty(n,"MissingReferenceError",{enumerable:!0,get:function(){return u.MissingReferenceError}}),Object.defineProperty(n,"UnsupportedError",{enumerable:!0,get:function(){return u.UnsupportedError}}),Object.defineProperty(n,"RelatedError",{enumerable:!0,get:function(){return u.RelatedError}}),Object.defineProperty(n,"throwUnsupportedError",{enumerable:!0,get:function(){return u.throwUnsupportedError}}),Object.defineProperty(n,"throwRelatedError",{enumerable:!0,get:function(){return u.throwRelatedError}}),Object.defineProperty(n,"isCoreTypesError",{enumerable:!0,get:function(){return u.isCoreTypesError}}),Object.defineProperty(n,"decorateErrorMeta",{enumerable:!0,get:function(){return u.decorateErrorMeta}}),Object.defineProperty(n,"decorateError",{enumerable:!0,get:function(){return u.decorateError}}),e("./lib/location")),p=(Object.defineProperty(n,"positionToLineColumn",{enumerable:!0,get:function(){return c.positionToLineColumn}}),Object.defineProperty(n,"locationToLineColumn",{enumerable:!0,get:function(){return c.locationToLineColumn}}),Object.defineProperty(n,"getPositionOffset",{enumerable:!0,get:function(){return c.getPositionOffset}}),Object.defineProperty(n,"mergeLocations",{enumerable:!0,get:function(){return c.mergeLocations}}),e("./lib/traverse"));Object.defineProperty(n,"some",{enumerable:!0,get:function(){return p.some}}),Object.defineProperty(n,"traverse",{enumerable:!0,get:function(){return p.traverse}})},{"./lib/annotation":7,"./lib/error":8,"./lib/location":9,"./lib/simplify":13,"./lib/traverse":14,"./lib/types":15,"./lib/util":16,"./lib/validate":17}],7:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.stringify=n.formatSee=n.formatDefault=n.formatExamples=n.arrayOrSingle=n.stripAnnotations=n.stringifyAnnotations=n.wrapWhitespace=n.extractAnnotations=n.mergeAnnotations=void 0;let c=e("./location"),p=e("./util");function l(e){return e.includes("\n")?["*",e.split("\n").map(e=>" * "+e).join("\n")," "].join("\n"):e.startsWith(" ")?e:" "+e}function f(e){return 1===e.length?e[0]:e}function s(e){return e.map(e=>"@example\n"+o(r(e).split("\n"),4)).join("\n").trim()}function u(e){return["@default",o(r(e).split("\n"),4)].join("\n").trim()}function d(e){return e.map(e=>"@see "+r(e)).join("\n").trim()}function r(e){return"string"==typeof e?e:JSON.stringify(e,null,2)}function o(e,n,r=!1){return e.map((e,t)=>{return(0===t&&r?" ".repeat(n-2)+"* ":" ".repeat(n))+e}).join("\n")}n.mergeAnnotations=function(e){let t,n=e=>!!e;var r=(e,t="\n")=>(0,p.uniq)(e.filter(n)).join(t).trim(),o=null==(t=e.find(e=>e.name))?void 0:t.name,i=r(e.map(e=>e.title),", "),a=r(e.map(e=>e.description)),l=(0,p.uniq)([].concat(...e.map(e=>(0,p.ensureArray)(e.examples))).filter(n)),s=r(e.map(e=>e.default)),u=(0,p.uniq)([].concat(...e.map(e=>(0,p.ensureArray)(e.see))).filter(n)),r=r(e.map(e=>e.comment)),e=(0,c.mergeLocations)(e.map(e=>e.loc));return{...o?{name:o}:{},...i?{title:i}:{},...a?{description:a}:{},...0e).join("\n\n").trim().replace(/\*\//g,"*\\/");return n&&e?l(e):e},n.stripAnnotations=function t(e,n=!0){let{comment:r,description:o,default:i,examples:a,see:l,title:s,...u}=e,c=u;if(n){if("and"===c.type)return{...c,and:c.and.map(e=>t(e,!0))};if("or"===c.type)return{...c,or:c.or.map(e=>t(e,!0))};if("array"===c.type)return{...c,elementType:t(c.elementType,!0)};if("tuple"===c.type)return{...c,elementTypes:c.elementTypes.map(e=>t(e,!0)),additionalItems:"object"==typeof c.additionalItems?t(c.additionalItems,!0):c.additionalItems};if("object"===c.type)return{...c,properties:Object.fromEntries(Object.keys(c.properties).map(e=>[e,{...c.properties[e],node:t(c.properties[e].node,!0)}])),additionalProperties:"object"==typeof c.additionalProperties?t(c.additionalProperties,!0):c.additionalProperties}}return c},n.arrayOrSingle=f,n.formatExamples=s,n.formatDefault=u,n.formatSee=d,n.stringify=r},{"./location":9,"./util":16}],8:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.decorateError=n.decorateErrorMeta=n.isCoreTypesError=n.throwRelatedError=n.throwUnsupportedError=n.RelatedError=n.UnsupportedError=n.MissingReferenceError=n.MalformedTypeError=n.CoreTypesError=void 0;class r extends Error{constructor(e,t={}){super(e),Object.setPrototypeOf(this,r.prototype),this.blob=t.blob,this.path=t.path,this.loc=t.loc,this.source=t.source,this.filename=t.filename,this.relatedError=t.relatedError}}n.CoreTypesError=r;class o extends r{constructor(e,t={}){super(e,t),Object.setPrototypeOf(this,o.prototype)}}n.MalformedTypeError=o;class i extends r{constructor(e,t={}){super(`Reference to missing type "${e}"`,t),Object.setPrototypeOf(this,i.prototype)}}n.MissingReferenceError=i;class a extends r{constructor(e,t={}){super(e,t),Object.setPrototypeOf(this,a.prototype)}}n.UnsupportedError=a;class l extends r{constructor(e,t={}){super(e.message,{...t,relatedError:e}),Object.setPrototypeOf(this,l.prototype)}}function s(e){return e instanceof r}function u(e,t){return t.blob&&null==e.blob&&(e.blob=t.blob),t.path&&null==e.path&&(e.path=t.path),t.loc&&null==e.loc&&(e.loc=t.loc),t.source&&null==e.source&&(e.source=t.source),t.filename&&null==e.filename&&(e.filename=t.filename),e}n.RelatedError=l,n.throwUnsupportedError=function(e,t,n){throw new a(e,{blob:t,...t.loc?{loc:t.loc}:{},...n?{path:n}:{}})},n.throwRelatedError=function(e,t){throw new l(e,t)},n.isCoreTypesError=s,n.decorateErrorMeta=u,n.decorateError=function(e,t){return s(e)&&u(e,t),e}},{}],9:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.mergeLocations=n.getPositionOffset=n.locationToLineColumn=n.positionToLineColumn=void 0;let s=e("./util");function r(e,t){var n=e.slice(0,t).split("\n").length,e=e.lastIndexOf("\n",t);return-1===e?{offset:t,line:n,column:t}:{offset:t,line:n,column:t-e}}n.positionToLineColumn=r,n.locationToLineColumn=function(e,t){return"object"==typeof t.start?t:{start:void 0===t.start?void 0:r(e,t.start),...null==t.end?{}:{end:r(e,t.end)}}},n.getPositionOffset=function(e){return void 0===e||"number"==typeof e?e:e.offset},n.mergeLocations=function(e){let t,n,r,o,i,a=e=>"number"==typeof e?e:null==e?void 0:e.offset;e.filter(s.isNonNullable).forEach(({start:e,end:t})=>{var n=a(e),r=a(t);void 0!==n&&(!o||"number"==typeof o.location&&o.location===n||o.offset>n)&&(o={location:e,offset:n}),void 0!==r&&(!i||"number"==typeof i.location&&i.location===n||i.offseti(e))).some(e=>0===e.length)?[]:(0,r.uniq)([].concat(...e))},n.combineConstAndEnum=i},{"../util":16}],11:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.intersectConstEnum=void 0;let r=e("../annotation"),o=e("../util");n.intersectConstEnum=function(e){if(0===e.length)throw new Error("Cannot intersect const and enum from an empty array of nodes");var t;return 1===e.length?e[0]:(t=(t=e.map(e=>void 0!==e.const?[e.const]:void 0!==e.enum?e.enum:void 0).filter(e=>!!e)).slice(1).reduce((e,t)=>(0,o.intersection)(e,t),t[0]),{type:e[0].type,...1===t.length?{const:t[0]}:{},...1!==t.length?{enum:t}:{},...(0,r.mergeAnnotations)(e)})}},{"../annotation":7,"../util":16}],12:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.simplifySingle=void 0;let r=e("./const-enum");n.simplifySingle=function(e){return"boolean"===e.type||"integer"===e.type||"number"===e.type||"string"===e.type?(0,r.simplifyEnumAndConst)(e):e}},{"./const-enum":10}],13:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.simplify=void 0;let a=e("./simplifications/single"),l=e("./simplifications/const-enum"),o=e("./simplifications/intersect-const-enum"),i=e("./error"),s=e("./annotation"),u=e("./util"),c=["any","string","number","integer","boolean"];n.simplify=function r(t){if(Array.isArray(t))return t.map(e=>r(e));if((0,u.isNodeDocument)(t))return{...t,types:r(t.types)};var e,n=e=>(0,u.copyName)(t,e);if("tuple"===t.type)return{...t,elementTypes:t.elementTypes.map(e=>r(e)),...t.additionalItems&&"object"==typeof t.additionalItems?{additionalItems:r(t.additionalItems)}:{}};if("array"===t.type)return{...t,elementType:r(t.elementType)};if("object"===t.type)return{...t,properties:Object.fromEntries(Object.entries(t.properties).map(([e,{node:t,required:n}])=>[e,{node:r(t),required:n}])),...t.additionalProperties&&"object"==typeof t.additionalProperties?{additionalProperties:r(t.additionalProperties)}:{}};if("and"!==t.type&&"or"!==t.type)return n((0,a.simplifySingle)(t));if("and"===t.type)return 1===(e=function(e){if(0<(e=(0,u.splitTypes)(e)).any.length){if(0===e.and.length&&0===e.or.length&&0===e.ref.length&&0===e.null.length&&0===e.string.length&&0===e.number.length&&0===e.integer.length&&0===e.boolean.length&&0===e.object.length&&0===e.array.length&&0===e.tuple.length)return[{type:"any",...(0,s.mergeAnnotations)(e.any.map(({node:e})=>e))}];e.any=[]}var t=e=>e.map(({node:e})=>e);return 1e),...t(e.any)]),order:(0,u.firstSplitTypeIndex)(e.boolean)}]),1e),...t(e.any)]),order:(0,u.firstSplitTypeIndex)(e.string)}]),0e),...t(e.integer),...t(e.any)]),order:(0,u.firstSplitTypeIndex)(e.number)}],e.integer=[]):1e),...t(e.any)]),order:(0,u.firstSplitTypeIndex)(e.number)}]:1e),...t(e.any)]),order:(0,u.firstSplitTypeIndex)(e.integer)}]),000(e=r(e)).and||[e])))).length?n({...e[0],...(0,s.mergeAnnotations)([(0,s.extractAnnotations)(t),e[0]])}):n({type:"and",and:e,...(0,s.extractAnnotations)(t)});if("or"===t.type)return 1===(e=function(e){var t,n,r,o,i=(0,u.splitTypes)(e);if(0e)).length)return[{type:"any",...(0,s.mergeAnnotations)(i.any.map(({node:e})=>e))}];for([t,n]of Object.entries(i))c.includes(t)&&n.length&&(r=n.map(({node:e})=>e),0===(o=(0,l.mergeConstEnumUnion)(r)).length?i[t]=[{node:{type:t,...(0,s.mergeAnnotations)(r)},order:(0,u.firstSplitTypeIndex)(n)}]:i[t]=[{node:(0,a.simplifySingle)({type:t,enum:o,...(0,s.mergeAnnotations)(r)}),order:(0,u.firstSplitTypeIndex)(n)}]);return 000(e=r(e)).or||[e])))).length?n({...e[0],...(0,s.mergeAnnotations)([(0,s.extractAnnotations)(t),e[0]])}):n({type:"or",or:e,...(0,s.extractAnnotations)(t)});throw new i.MalformedTypeError("Invalid node",t)}},{"./annotation":7,"./error":8,"./simplifications/const-enum":10,"./simplifications/intersect-const-enum":11,"./simplifications/single":12,"./util":16}],14:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.some=n.traverse=void 0;class r extends Error{}function o(e,t){function a(e,t,n,r,o,i){var i=void 0!==i?i:void 0===r?t[n]:t[n][r],a=[...e.path,n,...void 0===r?[]:[r]];return Object.assign({},e,{node:i,path:a,parentNode:t,parentProperty:n,index:r,required:o})}!function n(r,o){o(r);let i=r.node;if("array"===i.type)n(a(r,i,"elementType"),o);else if("tuple"===i.type)i.elementTypes.forEach((e,t)=>n(a(r,i,"elementTypes",t),o)),"object"==typeof i.additionalItems&&n(a(r,i,"additionalItems"),o);else if("object"===i.type){for(var e of Object.keys(i.properties))n(a(r,i,"properties",e,i.properties[e].required,i.properties[e].node),o);"object"==typeof i.additionalProperties&&n(a(r,i,"additionalProperties"),o)}else"and"===i.type?i.and.forEach((e,t)=>n(a(r,i,"and",t),o)):"or"===i.type&&i.or.forEach((e,t)=>n(a(r,i,"or",t),o))}({node:e,rootNode:e,path:[]},t)}n.traverse=o,n.some=function(e,t){try{o(e,e=>{if(t(e))throw new r})}catch(e){if(e instanceof r)return!0;throw e}return!1}},{}],15:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0})},{}],16:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.isNodeDocument=n.isNonNullable=n.copyName=n.firstSplitTypeIndex=n.flattenSplitTypeValues=n.splitTypes=n.union=n.intersection=n.isEqual=n.hasConstEnum=n.constEnumTypes=n.isPrimitiveType=n.ensureArray=n.uniq=void 0,n.uniq=function(r){return r.filter((t,n)=>{for(let e=0;e["null","string","number","integer","boolean"].includes(e.type),n.constEnumTypes=new Set(["any","string","number","integer","boolean","object","array","tuple","ref"]);function o(t,n){var e;return typeof t==typeof n&&!(null===t!=(null===n)||null!==t&&(Array.isArray(t)&&Array.isArray(n)?t.length!==n.length||t.some((e,t)=>!o(e,n[t])):Array.isArray(t)!==Array.isArray(n)||("object"==typeof t?!o(e=Object.keys(t).sort(),Object.keys(n).sort())||e.some(e=>!o(t[e],n[e])):t!==n)))}n.hasConstEnum=e=>n.constEnumTypes.has(e.type),n.isEqual=o,n.intersection=function(e,n){let r=[];return e.forEach(t=>{n.forEach(e=>{o(t,e)&&r.push(t)})}),r},n.union=function(e,t){let n=[...e];return t.forEach(t=>{e.some(e=>o(t,e))||n.push(t)}),n},n.splitTypes=function(e){let n={and:[],or:[],ref:[],any:[],null:[],string:[],number:[],integer:[],boolean:[],object:[],array:[],tuple:[]};return e.forEach((e,t)=>{("and"!==e.type&&"or"!==e.type||"and"===e.type&&0e.order-t.order).map(({node:e})=>e))},n.firstSplitTypeIndex=function(e){return Math.min(...e.map(({order:e})=>e))},n.copyName=function(e,t){return void 0===e.name?t:{...t,name:e.name}},n.isNonNullable=function(e){return null!=e},n.isNodeDocument=function(e){return Array.isArray(e.types)}},{}],17:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validate=void 0;let r=e("./error"),o=e("./util");n.validate=function t(e){if((0,o.hasConstEnum)(e)){var n=e;if(n.enum&&0===n.enum.length)throw new r.MalformedTypeError("Empty enum is not allowed",n);if(n.enum&&void 0!==n.const&&!n.enum.some(e=>(0,o.isEqual)(e,n.const)))throw new r.MalformedTypeError("Enum and const are both set, but enum doesn't contain const",n)}"and"===e.type&&e.and.forEach(e=>t(e)),"or"===e.type&&e.or.forEach(e=>t(e))}},{"./error":8,"./util":16}],18:[function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){e[r=void 0===r?n:r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(n,"__esModule",{value:!0}),o(e("./lib"),n),o(e("./lib/types"),n),o(e("./lib/utils"),n)},{"./lib":19,"./lib/types":22,"./lib/utils":23}],19:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.openApiToJsonSchema=n.jsonSchemaDocumentToOpenApi=n.decorateOpenApi=void 0;let o=e("./json-schema-to-openapi"),r=e("./openapi-to-json-schema");function i(e,{title:t,version:n,schemaVersion:r="3.0.0"}){t={title:t,version:n};return e.$id&&(t["x-id"]=e.$id,delete e.$id),e.$comment&&(t["x-comment"]=e.$comment,delete e.$comment),delete e.$schema,{openapi:r,info:t,paths:{},...e}}n.decorateOpenApi=i,n.jsonSchemaDocumentToOpenApi=function(e,t){let{definitions:n={},...r}=e;return i({...r,components:{schemas:Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(0,o.jsonSchemaTypeToOpenApi)(t)]))}},t)},n.openApiToJsonSchema=function(e){let t=e.components.schemas;return{definitions:Object.fromEntries(Object.keys(t).map(e=>[e,(0,r.openApiToJsonSchemaType)(t[e])]))}}},{"./json-schema-to-openapi":20,"./openapi-to-json-schema":21}],20:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.jsonSchemaTypeToOpenApi=void 0;let r=e("./utils");n.jsonSchemaTypeToOpenApi=function e(t){var n;return"boolean"==typeof t?t:(t=function(e){if(void 0===e.type)return e;let{type:t,...n}=e,r=Array.isArray(t)?t.includes("null"):"null"===t;var o=Array.isArray(t)?t.filter(e=>"null"!==e):"null"===t?void 0:t;let i=(e,t)=>"any"!==t&&t?{...e,type:t}:e;return void 0!==e.const&&(n.enum=[e.const],delete n.const),e=e=>r?{...e,nullable:r}:e,Array.isArray(o)?0===o.length?e(n):1===o.length?i(e(n),o[0]):{...e(n),anyOf:o.map(e=>i({},e))}:i(e(n),o)}(t),t=(n=t).$ref?{...n,$ref:(0,r.encodeRefNameOpenApi)((0,r.decodeRefNameJsonSchema)(n.$ref))}:n,(0,r.recurseSchema)(t,e))}},{"./utils":23}],21:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.openApiToJsonSchemaType=void 0;let a=e("./utils");n.openApiToJsonSchemaType=function e(t){if("boolean"==typeof t)return t;let{type:n,nullable:r,...o}=t;var i,t=function(e,t){if(void 0!==e&&"any"!==e)return Array.isArray(e)?e.includes("any")?void 0:(!e.includes("null")&&t&&e.push("null"),1===e.length?e[0]:e):"null"!==e&&t?[e,"null"]:e}(n,r),t={...o,...t?{type:t}:{}},t=(i=t).$ref?{...i,$ref:(0,a.encodeRefNameJsonSchema)((0,a.decodeRefNameOpenApi)(i.$ref))}:i;return(0,a.recurseSchema)(t,e)}},{"./utils":23}],22:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{dup:15}],23:[function(e,t,n){function r(e){return encodeURIComponent(e)}function o(e){return decodeURIComponent(e)}function i(e){return e&&0n(e))}:{items:n(r.items)},..."object"!=typeof r.additionalItems?{}:{additionalItems:n(r.additionalItems)},..."object"!=typeof r.contains?{}:{contains:n(r.contains)},...i(r.properties)?{properties:Object.fromEntries(Object.keys(r.properties).map(e=>{var t;return[e,n(null==(t=r.properties)?void 0:t[e])]}))}:{},...i(r.patternProperties)?{patternProperties:Object.fromEntries(Object.keys(r.patternProperties).map(e=>{var t;return[e,n(null==(t=r.patternProperties)?void 0:t[e])]}))}:{},..."object"!=typeof r.additionalProperties?{}:{additionalProperties:n(r.additionalProperties)},...i(r.dependencies)?{dependencies:Object.fromEntries(Object.keys(r.dependencies).map(e=>{var t;return[e,n(null==(t=r.dependencies)?void 0:t[e])]}))}:{},..."object"!=typeof r.propertyNames?{}:{propertyNames:n(r.propertyNames)},..."object"!=typeof r.if?{}:{if:n(r.if)},..."object"!=typeof r.then?{}:{then:n(r.then)},..."object"!=typeof r.else?{}:{else:n(r.else)},..."object"==typeof r.allOf&&r.allOf.length?{allOf:r.allOf.map(e=>n(e))}:{},..."object"==typeof r.anyOf&&r.anyOf.length?{anyOf:r.anyOf.map(e=>n(e))}:{},..."object"==typeof r.oneOf&&r.oneOf.length?{oneOf:r.oneOf.map(e=>n(e))}:{},..."object"!=typeof r.not?{}:{not:n(r.not)},...i(r.definitions)?{definitions:Object.fromEntries(Object.keys(r.definitions).map(e=>{var t;return[e,n(null==(t=r.definitions)?void 0:t[e])]}))}:{}}}},{}],24:[function(e,n,r){!function(e){!function(){var e,t;e=this,t=function(){function e(e,t){return e(t={exports:{}},t.exports),t.exports}var l=new(e(function(e){function t(){function l(e,t){var n,r,o=e.charCodeAt(t=void 0===t?0:t);return 55296<=o&&o<=56319&&t=e.length-1))for(var n,r=s(l(e,t)),o=[],i=t+1;i=n)return r.substr(0,n);while(n>r.length&&t>1){if(t&1)r+=e;t>>=1;e+=e}r+=e;r=r.substr(0,n);return r}"use strict";var l=function e(t,n,r){if(t==null||n==null)return t;var o=String(t);var i=typeof n==="number"?n:parseInt(n,10);if(isNaN(i)||!isFinite(i))return o;var a=o.length;if(a>=i)return o;var l=r==null?"":String(r);if(l==="")l=" ";var s=i-a;while(l.lengths?l.substr(0,s):l;return u+o},m=Object.assign||function(e){for(var t=1;t at "+n.filter(Boolean).join(":")}},s={unexpectedSymbol:function(e){for(var t=arguments.length,n=Array(1 at "+n.filter(Boolean).join(":")}},d={LEFT_BRACE:0,RIGHT_BRACE:1,LEFT_BRACKET:2,RIGHT_BRACKET:3,COLON:4,COMMA:5,STRING:6,NUMBER:7,TRUE:8,FALSE:9,NULL:10},o={"{":d.LEFT_BRACE,"}":d.RIGHT_BRACE,"[":d.LEFT_BRACKET,"]":d.RIGHT_BRACKET,":":d.COLON,",":d.COMMA},m={true:d.TRUE,false:d.FALSE,null:d.NULL},y={_START_:0,START_QUOTE_OR_CHAR:1,ESCAPE:2},h={'"':0,"\\":1,"/":2,b:3,f:4,n:5,r:6,t:7,u:8},b={_START_:0,MINUS:1,ZERO:2,DIGIT:3,POINT:4,DIGIT_FRACTION:5,EXP:6,EXP_DIGIT_OR_SIGN:7};function g(e){return"1"<=e&&e<="9"}function v(e){return"0"<=e&&e<="9"}function O(e){return"e"===e||"E"===e}function T(e,t,n,r){var o=e.charAt(t);if("\r"===o)n++,r=1,"\n"===e.charAt(++t)&&t++;else if("\n"===o)t++,n++,r=1;else{if("\t"!==o&&" "!==o)return null;t++,r++}return{index:t,line:n,column:r}}function j(e,t,n,r){e=e.charAt(t);return e in o?{type:o[e],line:n,column:r+1,index:t+1,value:null}:null}function A(e,t,n,r){for(var o in m)if(m.hasOwnProperty(o)&&e.substr(t,o.length)===o)return{type:m[o],line:n,column:r+o.length,index:t+o.length,value:o};return null}function E(e,t,n,r){for(var o=t,i=y._START_;te),l=e=>{return e=e,"."+a.slice(0,e).join(".")+` [query: ${a.join(".")}]`};return{start:null==(t=a.reduce((e,t,n)=>{if("Object"===e.type){var r,o=e.children.find(e=>e.key.value===t);if(o)return{key:o,value:r}=o,i&&n===a.length-1?o:r;throw new Error(`No such property ${t} in `+l(n))}if("Array"!==e.type)return e;o=Number(t);if(isNaN(o))throw new Error(`Invalid non-numeric array index "${t}" `+"in array at "+l(n));if(o<0||o>=e.children.length)throw new RangeError(`Index ${o} out-of-bounds in array of `+`size ${e.children.length} at `+l(n));return e.children,e.children[Number(t)]},e).loc)?void 0:t.start,end:null==t?void 0:t.end}}},{}],27:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.getAstByObject=n.getAstByString=void 0;let r=e("json-to-ast");function o(e,t){var n=r(e,{loc:!0});return{json:t||JSON.parse(e),jsonString:e,jsonAST:n}}n.getAstByString=o,n.getAstByObject=function(e,t=4){return o(JSON.stringify(e,null,t))}},{"json-to-ast":24}],28:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});let j=e("core-types-json-schema"),A=e("./utils/sharedUtils"),E=e("./utils/constants"),P=e("./utils/nosqlUtils"),l=e("./utils/constants-nosql");Draw.loadPlugin(function(p){var e=document.createElement("div");e.style.userSelect="none",e.style.overflow="hidden",e.style.padding="10px",e.style.height="100%";let r=document.createElement("textarea"),t=(r.style.height="200px",r.style.width="100%","-- click a nosql type button");r.value=t,mxUtils.br(e),e.appendChild(r);var n=p.menus.get("exportAs");let o="tonosql=To NoSQL",i=(n&&!window.VsCodeApi||(o="tonosql=Export As NoSQL"),mxResources.parse(o),new mxWindow(mxResources.get("tonosql"),e,document.body.offsetWidth-480,140,320,320,!0,!0));i.destroyOnClose=!1,i.setMaximizable(!1),i.setResizable(!1),i.setClosable(!0),mxUtils.br(e);var a=mxUtils.button(mxResources.get("reset"),function(){r.value=t}),a=(a.style.marginTop="8px",a.style.marginRight="4px",a.style.padding="4px",e.appendChild(a),mxUtils.button("OpenAPI",function(){{var t="openapi",n=(0,A.getMermaidDiagramDb)(p,t),n=(0,P.dbToOpenApi)(n);let e="";if("openapi"!=t)throw new Error(`type:${t} is not supported`);e=JSON.stringify(n,null,2),r.value=e}}));a.style.marginTop="8px",a.style.padding="4px",e.appendChild(a),p.actions.addAction("tonosql",function(){i.setVisible(!i.isVisible()),i.isVisible()&&r.focus()});let f,d,m,y=[],h=null,b=null,g=0,v;e=document.createElement("div");e.style.userSelect="none",e.style.overflow="hidden",e.style.padding="10px",e.style.height="100%";let O=document.createElement("textarea"),T=(O.style.height="200px",O.style.width="100%",O.value=l.defaultResetOpenApi,mxUtils.br(e),e.appendChild(O),mxResources.parse("fromNoSql=From NoSQL"),new mxWindow(mxResources.get("fromNoSql"),e,document.body.offsetWidth-480,140,320,320,!0,!0));T.destroyOnClose=!1,T.setMaximizable(!1),T.setResizable(!1),T.setClosable(!0),mxUtils.br(e);a=mxUtils.button("Reset OpenAPI",function(){O.value=l.defaultResetOpenApi}),a.style.marginTop="8px",a.style.marginRight="4px",a.style.padding="4px",e.appendChild(a),a=mxUtils.button("Insert OpenAPI",function(){var t,n=O.value,r="openapi";y=[],h=null,b=null;try{let e=null;var o={title:"nosql default options",version:E.pluginVersion};if("openapi"!=r)throw new Error(`type:${r} is not supported`);var i,a,l=JSON.parse(n),s=(0,j.convertOpenApiToCoreTypes)(l)["data"],u=(0,j.convertCoreTypesToJsonSchema)(s)["data"],c=((0,j.jsonSchemaDocumentToOpenApi)(u,o),null==(t=null===(e=l)||void 0===e?void 0:e.components)?void 0:t.schemas);c&&(i=(0,P.ConvertOpenApiToDatabaseModel)(c),f=i.ForeignKeyList,d=i.PrimaryKeyList,m=i.TableList,v=m.length,a=(0,A.CreateTableUI)(p,T,m,y,b,h,f,g,r))&&(y=a.cells,g=a.dx,h=a.tableCell,b=a.rowCell)}catch(e){console.log("unable to serialize the response:"+r),console.log(e)}}),a.style.marginTop="8px",a.style.padding="4px",e.appendChild(a),p.actions.addAction("fromNoSql",function(){T.setVisible(!T.isVisible()),T.isVisible()&&O.focus()}),e=p.menus.get("insert");if(e){let r=e.funct;e.funct=function(...e){var[t,n]=e;r.apply(this,e),p.menus.addMenuItems(t,["fromNoSql"],n)}}if(n&&!window.VsCodeApi){let r=n.funct;n.funct=function(...e){var[t,n]=e;r.apply(this,e),p.menus.addMenuItems(t,["tonosql"],n)}}else{a=p.menus.get("file");if(a&&a.enabled){let r=a.funct;a.funct=function(...e){var[t,n]=e;r.apply(this,e),p.menus.addMenuItems(t,["tonosql"],n)}}}})},{"./utils/constants":30,"./utils/constants-nosql":29,"./utils/nosqlUtils":31,"./utils/sharedUtils":32,"core-types-json-schema":1}],29:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.validJSONSchemaTypes=n.defaultResetOpenApi=n.defaultReset=void 0;e=e("./constants");n.defaultReset=`/* Drawio default value Plugin: nosql Version: ${e.pluginVersion} */ export interface WeatherForecast { /** @format date-time */ date?: string; /** @format int32 */ temperatureC?: number; /** @format int32 */ temperatureF?: number; summary?: string | null; nestedProp: string[]; children?: Child[]; } export interface Child { name: string } `,n.defaultResetOpenApi=` { "openapi": "3.0.0", "info": { "title": "nosql plugin sample", "version": "${e.pluginVersion}", "x-comment": "Generated by core-types-json-schema (https://github.com/grantila/core-types-json-schema)" }, "paths": {}, "components": { "schemas": { "WeatherForecast": { "properties": { "date": { "title": "WeatherForecast.date", "description": "@format date-time", "type": "string" }, "temperatureC": { "title": "WeatherForecast.temperatureC", "description": "@format int32", "type": "number" }, "temperatureF": { "title": "WeatherForecast.temperatureF", "description": "@format int32", "type": "number" }, "summary": { "title": "WeatherForecast.summary", "nullable": true, "type": "string" }, "nestedProp": { "items": { "title": "WeatherForecast.nestedProp.[]", "type": "string" }, "title": "WeatherForecast.nestedProp", "type": "array" }, "child": { "$ref": "#/components/schemas/Child", "title": "WeatherForecast.child" } }, "required": [ "nestedProp" ], "additionalProperties": false, "title": "WeatherForecast", "type": "object" }, "Child": { "properties": { "name": { "title": "Child.name", "type": "string" } }, "required": [ "name" ], "additionalProperties": false, "title": "Child", "type": "object" } } } } `;n.validJSONSchemaTypes=["string","number","integer","boolean","object","array","null","any"]},{"./constants":30}],30:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.objectKeyword=n.arrayKeyword=n.nullableKeyword=n.enumKeyword=n.formatKeyword=n.commentColumnQuantifiers=n.pluginVersion=void 0,n.pluginVersion="0.0.6",n.commentColumnQuantifiers={Start:"/**",End:"*/"},n.formatKeyword="@format",n.enumKeyword="enum",n.nullableKeyword="nullable",n.arrayKeyword="array",n.objectKeyword="object"},{}],31:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.dbToOpenApi=function(u){var e={openapi:"3.0.0",info:{title:"drawio nosql export",version:g.pluginVersion,"x-comment":"Generated by from drawio uml using plugin nosql"},paths:{},components:{schemas:{}}},c={},r=u.getEntities();for(let s in r)if(Object.prototype.hasOwnProperty.call(r,s)){let l=s;var o=r[s],i=(0,v.getCommentIndexes)(s);let t="",n="";if(-1e.entityA==s);let t=`[${s}.${d}]`;m=h.find(e=>-1!=e.roleA.indexOf(t));m&&(b=(0,v.getCommentIndexes)(m.entityB),m=m.entityB.substring(0,b.beforeStart).trim(),e="#/components/schemas/"+m),e&&("array"==o&&(n={$ref:e}),"object"==o)&&(r={$ref:e})}var b={title:l+"."+d,type:o};r&&(b.additionalProperties=r),n&&(b.items=n),null!=(m=f.attributeType)&&m.includes("nullable")&&(b.nullable=!0),!e||null!==r&&void 0!==r&&r.$ref||null!==n&&void 0!==n&&n.$ref||(b.$ref=e),t&&delete b.type,i.trim()&&!e&&(b.description=i.trim()),a.trim()&&(b.items?b.items.format=a.trim():b.format=a.trim()),c[l].properties[f.attributeName]=b}}}0===Object.keys(c[l].properties).length&&delete c[l].properties}}return e.components.schemas=c,e},n.GeneratePropertyModel=h,n.ConvertOpenApiToDatabaseModel=function(t){var n,r,o;var i={Dialect:"nosql",TableList:[],PrimaryKeyList:[],ForeignKeyList:[]},a={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){var l,s,u,c=t[e],p=(0,v.dbTypeEnds)(e),f={Name:(0,v.dbTypeEnds)(e),Properties:[]};for(u in c.enum?(l=c.enum,s=c.type+" "+g.enumKeyword,l={enum:l},c.description&&(l.description=c.description),c.format&&(l.format=c.format),e=h(e,s,l),f.Properties.push(e)):(s=(0,v.generateComment)(c.description,c.format))&&(f.Name+=" "+s),c.properties)if(Object.prototype.hasOwnProperty.call(c.properties,u)){var d=c.properties[u];let e=null;d.$ref?e=d.$ref.split("/").pop():d.items&&typeof d.items==g.objectKeyword?e=null==(n=d.items.$ref)?void 0:n.split("/").pop():d.additionalProperties&&"object"==typeof d.additionalProperties&&(e=null==(n=d.additionalProperties.$ref)?void 0:n.split("/").pop()),e&&(y=t[e],e=y&&!y.enum&&(y=(0,v.generateComment)(y.description,y.format))?(0,v.dbTypeEnds)(e)+" "+y:(0,v.dbTypeEnds)(e)),e&&!d.type&&(d.type=e);var m,y=h(f.Name,u,d);e&&(d={PrimaryKeyTableName:f.Name,ReferencesTableName:e,PrimaryKeyName:(0,v.dbTypeEnds)(u),ReferencesPropertyName:"",IsDestination:!1},m={ReferencesTableName:f.Name,PrimaryKeyTableName:e,ReferencesPropertyName:(0,v.dbTypeEnds)(u),PrimaryKeyName:"",IsDestination:!0},i.ForeignKeyList.push(m),i.ForeignKeyList.push(d),y.IsForeignKey=!0),f.Properties.push(y)}i.TableList.push(f),a[p]||(a[p]=f)}for(let n=0;ne.Name==t.ReferencesTableName))?void 0:r.Properties[0];(e=e||(null==(r=a[t.ReferencesTableName])?void 0:r.Properties[0]))&&(i.ForeignKeyList[n].ReferencesPropertyName=e.Name)}if(!t.PrimaryKeyName){let e=null==(r=i.TableList.find(e=>e.Name==t.PrimaryKeyTableName))?void 0:r.Properties[0];(e=e||(null==(o=a[t.PrimaryKeyTableName])?void 0:o.Properties[0]))&&(i.ForeignKeyList[n].PrimaryKeyName=e.Name)}}return i};let g=e("./constants"),v=e("./sharedUtils"),O=e("./constants-nosql");function h(e,t,n){let r,o=(null!=(r=n.type)?r:g.objectKeyword).toString();o===g.arrayKeyword&&n.items&&typeof n.items===g.objectKeyword&&(n.items.format&&!n.format&&(n.format=n.items.format),n.items.type)&&(o=n.items.type+"[]"),n.enum?o=""+JSON.stringify(n.enum):n.nullable&&(o+=" "+g.nullableKeyword);n=(0,v.generateComment)(n.description,n.format),n&&(o+=" "+n),n={Name:(0,v.dbTypeEnds)(t),IsPrimaryKey:!1,IsForeignKey:!1,ColumnProperties:o,TableName:(0,v.dbTypeEnds)(e),ForeignKey:[]};return n}},{"./constants":30,"./constants-nosql":29,"./sharedUtils":32}],32:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.GetColumnQuantifiers=P,n.removeHtml=r,n.dbTypeEnds=y,n.RemoveNameQuantifiers=x,n.getDbLabel=S,n.entityName=function(e,t){let n="";e&&(n+=""+e);t&&(n+=` ${E.formatKeyword} `+t);n=n&&`/** ${n=n.trim()} */`;return n},n.getCommentIndexes=C,n.getMermaidDiagramDb=function(e,o){var t=e.editor.graph.getModel(),i={},a=[];for(var l in t.cells)if(Object.hasOwnProperty.call(t.cells,l)){var s=t.cells[l];if(-1!==s.mxObjectId.indexOf("mxCell")&&s.style&&s.style.trim().startsWith("swimlane;")){let t=s.value.toString(),n="",r="";if(null!==t&&void 0!==t&&t.includes(E.commentColumnQuantifiers.Start)&&null!==t&&void 0!==t&&t.includes(E.commentColumnQuantifiers.End)){let e=t.toString();var l=C(e),u=l.start,c=l.end;t=e.substring(0,l.beforeStart),-1!==(e=e.substring(u,c)).indexOf(E.formatKeyword)&&(l=e.indexOf(E.formatKeyword),r=e.substring(l+E.formatKeyword.length).trim(),e=e.substring(0,l)),e&&(n=e)}var p={name:x(t),attributes:[]},u=N(n,r);u&&(p.name+=" "+u);for(let e=0;e-1!==["FK","PK"].findIndex(e=>e==t.value.toUpperCase())||-1!=t.value.toUpperCase().indexOf("PK,"));if(y&&(m.attributeKeyType=y.value,"PK"!=m.attributeKeyType)&&-1!=m.attributeKeyType.indexOf("PK")&&(m.attributeKeyType="PK"),p.attributes.push(m),f.edges&&f.edges.length)for(let e=0;e-1!=t.toLocaleLowerCase().indexOf(e)),b=n&&-1!=b.findIndex(e=>-1!=n.toLocaleLowerCase().indexOf(e));if(!b&&!g||b&&g){if(b&&g){var b=S(h.source.value,d),v=(b.attributeKeyType="PK",j=b.attributeName,x(h.source.parent.value)),O=S(h.target.value,d),T=(O.attributeKeyType="PK",A=O.attributeName,x(h.target.parent.value)),b={name:x(v)+"_"+x(T),attributes:[b,O]};i[b.name]||(i[b.name]=b);let t={entityA:v,entityB:b.name,relSpec:{cardA:"ZERO_OR_MORE",cardB:"ONLY_ONE",relType:"IDENTIFYING"},roleA:`[${v}.${j}] to [${b.name}.${j}]`},n=(-1==a.findIndex(e=>e.entityA==t.entityA&&e.entityB==t.entityB&&e.roleA==t.roleA)&&a.push(t),{entityA:T,entityB:b.name,relSpec:{cardA:"ZERO_OR_MORE",cardB:"ONLY_ONE",relType:"IDENTIFYING"},roleA:`[${T}.${A}] to [${b.name}.${A}]`});-1==a.findIndex(e=>e.entityA==n.entityA&&e.entityB==n.entityB&&e.roleA==n.roleA)&&a.push(n)}}else{O=S(h.source.value,d).attributeName;let e=h.source.parent.value;var j,A,v=C(e),T=(e=-1!=v.start&&-1!=v.end?(j=e.substring(v.start,v.end).trim(),x(e=e.substring(0,v.beforeStart).trim())+" "+N(j)):x(e),h.target.value),b=S(T,d);T=b.attributeName;let t=h.target.parent.value,n=(v=C(t),t=-1!=v.start&&-1!=v.end?(A=t.substring(v.start,v.end).trim(),x(t=t.substring(0,v.beforeStart).trim())+" "+N(A)):x(t),{entityA:g?e:t,entityB:g?t:e,relSpec:{cardA:"ZERO_OR_MORE",cardB:"ONLY_ONE",relType:"IDENTIFYING"},roleA:g?`[${e}.${O}] to [${t}.${T}]`:`[${t}.${T}] to [${e}.${O}]`});-1==a.findIndex(e=>e.entityA==n.entityA&&e.entityB==n.entityB&&e.roleA==n.roleA)&&a.push(n)}}}}}if(i[p.name]){let e=2;for(;i[p.name+e.toString()];)e++;i[p.name+e.toString()]=p}else i[p.name]=p}}e=w(i,a);return e},n.GenerateDatabaseModel=w,n.generateComment=N,n.CreateTableUI=function(r,e,t,o,i,a,n,l,s){if(t.forEach(function(t){var e,n=100+t.Name.length;(a=new mxCell(t.Name,new mxGeometry(l,0,n,26),"swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=default;horizontalStack=0;resizeParent=1;resizeLast=0;collapsible=1;marginBottom=0;swimlaneFillColor=default;align=center;")).vertex=!0,i&&null!==(e=r.editor.graph.getPreferredSizeForCell(i))&&(a.geometry.width=e.width+n),o.push(a),t.Properties.forEach(function(e){e=function(e,t,n,r){var o=t.Name+(t.ColumnProperties?" "+t.ColumnProperties:""),o=((n=new mxCell(o,new mxGeometry(0,0,90,26),"shape=partialRectangle;top=0;left=0;right=0;bottom=0;align=left;verticalAlign=top;spacingTop=-2;fillColor=none;spacingLeft=64;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;dropTarget=0;")).vertex=!0,t.IsPrimaryKey&&t.IsForeignKey?"PK | FK":t.IsPrimaryKey?"PK":t.IsForeignKey?"FK":""),t=sb.cloneCell(n,o),o=(t.connectable=!1,t.style="shape=partialRectangle;top=0;left=0;bottom=0;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=180;points=[];portConstraint=eastwest;part=1;",t.geometry.width=54,t.geometry.height=26,n.insert(t),e.editor.graph.getPreferredSizeForCell(n));r&&(null!==o&&r.geometry.width