@api-now/cli 1.7.1 → 1.8.0
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.
- package/dist/index.js +33 -34
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url); import { fileURLToPath } from 'url'; import { dirname } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename);
|
|
3
|
-
var Po=Object.create;var ns=Object.defineProperty;var Ro=Object.getOwnPropertyDescriptor;var Co=Object.getOwnPropertyNames;var Do=Object.getPrototypeOf,Uo=Object.prototype.hasOwnProperty;var Lo=(o,e)=>()=>{try{return e||o((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Ea=(o,e)=>{for(var t in e)ns(o,t,{get:e[t],enumerable:!0})},Mo=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Co(e))!Uo.call(o,r)&&r!==t&&ns(o,r,{get:()=>e[r],enumerable:!(i=Ro(e,r))||i.enumerable});return o};var zo=(o,e,t)=>(t=o!=null?Po(Do(o)):{},Mo(e||!o||!o.__esModule?ns(t,"default",{value:o,enumerable:!0}):t,o));var Bn=Lo((zk,Gn)=>{var ta=Object.defineProperty,td=Object.getOwnPropertyDescriptor,id=Object.getOwnPropertyNames,rd=Object.prototype.hasOwnProperty,sd=(o,e)=>{for(var t in e)ta(o,t,{get:e[t],enumerable:!0})},ad=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of id(e))!rd.call(o,r)&&r!==t&&ta(o,r,{get:()=>e[r],enumerable:!(i=td(e,r))||i.enumerable});return o},nd=o=>ad(ta({},"__esModule",{value:!0}),o),Fn={};sd(Fn,{AmfModelExpander:()=>cd,JsonLd:()=>Rt,JsonLdOptions:()=>qn});Gn.exports=nd(Fn);var od=class Kn{validate(e){if(e===void 0)throw new Error("Node must not be undefined");if(Array.isArray(e))throw new Error("Node must not be an array");if(e["@id"]===void 0)throw new Error("Node must have an @id")}static empty(){return new Kn}withNode(e){this.validate(e);let t=e["@id"];if(this[t]!==void 0)throw new Error(`Cannot add node with duplicate id ${e["@id"]} to dictionary`);return this[t]=e,this}withNodes(e){return e.forEach(t=>this.withNode(t)),this}},Br=class{static targetOrLink(o,e){let t=e[o["@id"]];return t!==void 0?t:o}static isLinkObject(o){let e=typeof o=="object",t=!Array.isArray(o),i=o["@id"]!==void 0,r=Object.keys(o).length===1;return e&&t&&i&&r}static isArrayOfLinks(o){return o.every(e=>this.isLinkObject(e))}},ld=class{static embedNodeLinks(o,e,t){let r=t||(()=>!0);return Object.entries(o).filter(([s,a])=>r(s,a)).forEach(([s,a])=>{typeof a=="object"&&(Br.isLinkObject(a)?o[s]=Br.targetOrLink(a,e):Array.isArray(a)&&Br.isArrayOfLinks(a)&&(o[s]=a.map(n=>Br.targetOrLink(n,e))))}),o}},zn=class ea{static expandIris(e,t){Object.entries(e).forEach(([i,r])=>{delete e[i];let s=ea.expandIri(i,t);e[s]=r})}static compactIris(e,t){Object.entries(e).forEach(([i,r])=>{delete e[i];let s=ea.compactIri(i,t);e[s]=r})}static compactIri(e,t){switch(typeof t){case"string":return e.replace(t,"");case"object":if(Array.isArray(t))throw new Error("Context must be either an object or a string");if(this.isCompacted(e,t))return e;try{let[i,r]=Object.entries(t).find(([s,a])=>e.startsWith(a));return e.replace(r,`${i}:`)}catch{return e}default:throw new Error("Context must be either an object or a string")}}static expandIri(e,t){switch(typeof t){case"string":return`${t}${e}`;case"object":if(Array.isArray(t))throw new Error("Context must be either an object or a string");if(this.isCompacted(e,t))try{let[i,r]=Object.entries(t).find(([s,a])=>e.startsWith(s));return e.replace(`${i}:`,r)}catch{return e}else return e;default:throw new Error("Context must be either an object or a string")}}static isCompacted(e,t){let i=!0;return Object.values(t).forEach(r=>{e.startsWith(r)&&(i=!1)}),i}},Vn=class{static expandStructure(o){return Object.entries(o).forEach(([e,t])=>{switch(e){case"@id":break;case"@type":this.expandType(o,t);break;default:this.expandValue(o,e,t);break}}),o}static expandType(o,e){typeof e=="string"?o["@type"]=[e]:o["@type"]=e}static expandValue(o,e,t){switch(typeof t){case"string":case"number":case"boolean":o[e]=[{"@value":t}];break;case"object":Array.isArray(t)?t.map(r=>{switch(typeof r){case"string":case"number":case"boolean":return[{"@value":t}];default:return r}}):o[e]=[t]}}static compactStructure(o){if(Array.isArray(o)){let[e]=o;return this.compactStructure(e)}else return Object.entries(o).forEach(([e,t])=>{switch(e){case"@id":break;case"@type":this.compactType(o,t);break;default:this.compactValue(o,e,t);break}}),o}static compactType(o,e){Array.isArray(e)&&e.length===1&&(o["@type"]=e[0])}static compactValue(o,e,t){if(t.length===1){let[i]=t;this.isWrappedScalar(i)?o[e]=i["@value"]:o[e]=i}else t.map(i=>this.isWrappedScalar(i)?i["@value"]:i)}static isWrappedScalar(o){return o["@value"]!==void 0}},Rt=class{static process(o,e){let t=this.getGraph(o),i=this.getContext(o),r=od.empty().withNodes(t);t.forEach(a=>{e.embeddedLinks&&ld.embedNodeLinks(a,r,e.linkEmbeddingFilter),i!==void 0&&(e.expandedIris?zn.expandIris(a,i):e.compactedIris&&zn.compactIris(a,i)),e.expandedStructure?Vn.expandStructure(a):e.compactedStructure&&Vn.compactStructure(a)});let s=e.rootNodeId===void 0?{"@graph":t}:this.findNode(t,e.rootNodeId);return i!==void 0&&(s["@context"]=i),e.expandedStructure?[s]:s}static getContext(o){return o["@context"]}static getGraph(o){return o["@graph"]}static findNode(o,e){return o.find(t=>t["@id"]===e)}static stringify(o,e=!1){return JSON.stringify(o,null,e?2:0)}},qn=class Jn{expandedIris;expandedStructure;embeddedLinks;compactedIris;compactedStructure;rootNodeId;linkEmbeddingFilter;static apply(){return new Jn}withCompactedStructure(){return this.expandedStructure=!1,this.compactedStructure=!0,this}withRootNode(e){return this.rootNodeId=e,this}withExpandedStructure(){return this.expandedStructure=!0,this.compactedStructure=!1,this}withExpandedIris(){return this.expandedIris=!0,this.compactedIris=!1,this}withCompactedIris(){return this.expandedIris=!1,this.compactedIris=!0,this}withEmbeddedLinks(e){return this.linkEmbeddingFilter=e,this.embeddedLinks=!0,this}},cd=class{static expand(o){if(this.isInExpandedForm(o))return o;{let e=(r,s)=>!r.endsWith("fixPoint");this.preprocessLegacyRootNodeId(o);let t=this.resolveRootNodeId(o),i=qn.apply().withEmbeddedLinks(e).withCompactedIris().withExpandedStructure().withRootNode(t);return Rt.process(o,i)}}static isInExpandedForm(o){return o["@graph"]===void 0}static preprocessLegacyRootNodeId(o){let e=Rt.getGraph(o);if(e!=null){let t=Rt.findNode(e,"./");t!=null&&(t["@id"]="")}}static resolveRootNodeId(o){let e=Rt.getGraph(o);if(e==null||Rt.findNode(e,"")!=null)return"";let t=Rt.getContext(o);if(t!=null&&t["@base"]!=null){let r=t["@base"];if(Rt.findNode(e,r)!=null)return r}let i=e.find(r=>Object.entries(r).some(([s,a])=>(s==="doc:root"||s==="http://a.ml/vocabularies/document#root")&&a===!0));return i!=null?i["@id"]:""}}});import lp from"update-notifier";import{Command as cp}from"commander";var gi={name:"@api-now/cli",description:"API Now! CLI",version:"1.7.1",private:!1,publishConfig:{registry:"https://registry.npmjs.org/","@api-now:registry":"https://registry.npmjs.org/",access:"public"},files:["dist"],engines:{node:">=22.0.0"},type:"module",bin:{apinow:"dist/index.js"},scripts:{build:"node esbuild.config.js",postbuild:"node dist/index.js --help",dev:"tsx src/index.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts"',format:'prettier --write "src/**/*.ts"',test:"tsx --test tests/**/*.test.ts",prepare:"husky",prepublishOnly:"npm run build",knip:"knip"},dependencies:{"@inquirer/prompts":"^8.5.0",commander:"^15.0.0",nanoid:"^5.1.6",open:"^11.0.0",tslib:"^2.8.1","update-notifier":"^7.3.1",winston:"^3.19.0"},devDependencies:{"@api-now/core":"^1.10.0","@api-now/json":"^1.0.0","@commitlint/cli":"^21.0.1","@commitlint/config-conventional":"^21.0.1","@eslint/js":"^10.0.1","@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@types/node":"^25.9.1","@types/update-notifier":"^6.0.8",esbuild:"^0.28.0",eslint:"^10.4.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.6",globals:"^17.6.0",husky:"^9.1.7",knip:"^6.14.2",prettier:"^3.8.3","semantic-release":"^25.0.3",tsx:"^4.7.1",typescript:"^6.0.3","typescript-eslint":"^8.60.0"}};import os from"node:os";import dt from"node:path";import we from"node:fs";var Zi="https://api.apinow.app",ls="apinow-cli",Fo="config.json",cs=class{_resolved=null;get resolved(){this._resolved||this.load();let e=this._resolved;if(!e)throw new Error("Configuration could not be loaded.");return e}configDir=this.#e();configPath=dt.join(this.configDir,Fo);load(){let e=this.#i(),t=this.#r(),i=process.env.APINOW_API_TOKEN||process.env.APINOW_TOKEN||t.token||e.token,r=process.env.APINOW_API_URL||t.apiUrl||e.apiUrl||Zi,s=t.org||e.org||"";this._resolved={token:i,apiUrl:r,org:s,format:"text"}}saturate(e){this._resolved||this.load();let t=this._resolved;if(!t)throw new Error("Configuration could not be loaded.");this._resolved={token:t.token,apiUrl:e.apiUrl||t.apiUrl,org:t.org,format:e.format==="json"?"json":"text"}}#e(){if(process.platform==="win32"){let e=process.env.APPDATA||dt.join(os.homedir(),"AppData","Roaming");if(!e)throw new Error("Could not determine the configuration directory.");return dt.join(e,ls)}return process.platform==="darwin"?dt.join(os.homedir(),"Library","Preferences",ls):dt.join(process.env.XDG_CONFIG_HOME||dt.join(os.homedir(),".config"),ls)}#t(){let e=process.cwd();for(;;){let t=dt.join(e,"apinow.json");if(we.existsSync(t))try{if(we.statSync(t).isFile())return t}catch{}let i=dt.join(e,".apinowrc.json");if(we.existsSync(i))try{if(we.statSync(i).isFile())return i}catch{}let r=dt.dirname(e);if(r===e)break;e=r}return null}#r(){let e=this.#t();if(!e)return{};try{let t=we.readFileSync(e,"utf8");return JSON.parse(t)}catch{return{}}}#i(){try{if(!we.existsSync(this.configPath))return{apiUrl:Zi};let e=we.readFileSync(this.configPath,"utf8"),t=JSON.parse(e);return{apiUrl:Zi,...t}}catch{return{apiUrl:Zi}}}writeProperty(e,t){let i=this.#i();i[e]=t,this.#s(i)}#s(e){try{let i={...this.#i(),...e};we.existsSync(this.configDir)||we.mkdirSync(this.configDir,{recursive:!0}),we.writeFileSync(this.configPath,JSON.stringify(i,null,2),"utf8")}catch(t){console.error("Failed to write configuration:",t)}}clearConfigKey(e){try{let t=this.#i();delete t[e],we.existsSync(this.configDir)||we.mkdirSync(this.configDir,{recursive:!0}),we.writeFileSync(this.configPath,JSON.stringify(t,null,2),"utf8")}catch(t){console.error(`Failed to clear key ${e} from configuration:`,t)}}reset(){try{we.existsSync(this.configPath)&&we.unlinkSync(this.configPath),we.existsSync(this.configDir)&&we.readdirSync(this.configDir).length===0&&we.rmdirSync(this.configDir),this._resolved=null}catch(e){console.error("Failed to reset configuration:",e)}}},P=new cs;import{styleText as Qt}from"node:util";import Ko from"node:path";import qo from"node:os";import Jo from"node:crypto";import Ke from"winston";var Go=Jo.randomBytes(4).toString("hex"),Bo=Date.now(),Qi=Ko.join(qo.tmpdir(),`apinow-cli-${Bo}-${Go}.log`),Na=new Ke.transports.Console({stderrLevels:Object.keys(Ke.config.cli.levels),level:"info",format:Ke.format.combine(Ke.format.colorize(),Ke.format.simple())}),Wo=new Ke.transports.File({filename:Qi,level:"debug",format:Ke.format.combine(Ke.format.timestamp(),Ke.format.printf(({timestamp:o,level:e,message:t})=>{let i=typeof t=="string"?t.replace(/\u001b\[\d+m/g,""):t;return`${o} [${e.toUpperCase()}]: ${i}`}))}),S=Ke.createLogger({levels:Ke.config.cli.levels,level:"debug",transports:[Na,Wo]});function Ia(o){Na.level=o}var ds=gi.version;var X={green:o=>Qt("green",o),red:o=>Qt("red",o),yellow:o=>Qt("yellow",o),cyan:o=>Qt("cyan",o),dim:o=>Qt("dim",o),bold:o=>Qt("bold",o)};function Ho(o,e,t){if(o.length===0)return"No data available.";let i={},r=t||e;for(let l=0;l<e.length;l++){let c=e[l],p=r[l]||c;i[c]=p.length}for(let l of o)for(let c of e){let p=typeof l[c]=="object"&&l[c]!==null?JSON.stringify(l[c]):String(l[c]??"");p.length>(i[c]||0)&&(i[c]=p.length)}let s=e.map((l,c)=>(r[c]||l).toUpperCase().padEnd(i[l])).join(" "),a=e.map(l=>"-".repeat(i[l])).join(" "),n=o.map(l=>e.map(c=>(typeof l[c]=="object"&&l[c]!==null?JSON.stringify(l[c]):String(l[c]??"")).padEnd(i[c])).join(" "));return[s,a,...n].join(`
|
|
4
|
-
|
|
5
|
-
Validation errors:`);for(let i of e.errors)console.error(` - ${X.yellow(i.field)}: ${i.message}`)}if(console.error(X.dim(`(cli v${ds})`)),console.error(X.dim(`Log file: ${Qi}`)),t==="CLI_ERR_UNKNOWN"){let i="https://github.com/api-now/cli",r=encodeURIComponent(`[BUG] CLI Crash: ${e.message}`),s=encodeURIComponent(`**CLI Version:** ${ds}
|
|
2
|
+
var Eo=Object.create;var ds=Object.defineProperty;var xo=Object.getOwnPropertyDescriptor;var No=Object.getOwnPropertyNames;var $o=Object.getPrototypeOf,jo=Object.prototype.hasOwnProperty;var Io=(o,e)=>()=>{try{return e||o((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},va=(o,e)=>{for(var t in e)ds(o,t,{get:e[t],enumerable:!0})},Po=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of No(e))!jo.call(o,r)&&r!==t&&ds(o,r,{get:()=>e[r],enumerable:!(i=xo(e,r))||i.enumerable});return o};var Oo=(o,e,t)=>(t=o!=null?Eo($o(o)):{},Po(e||!o||!o.__esModule?ds(t,"default",{value:o,enumerable:!0}):t,o));var Rn=Io((fb,Cn)=>{var ra=Object.defineProperty,Dc=Object.getOwnPropertyDescriptor,zc=Object.getOwnPropertyNames,Uc=Object.prototype.hasOwnProperty,Mc=(o,e)=>{for(var t in e)ra(o,t,{get:e[t],enumerable:!0})},Vc=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zc(e))!Uc.call(o,r)&&r!==t&&ra(o,r,{get:()=>e[r],enumerable:!(i=Dc(e,r))||i.enumerable});return o},Lc=o=>Vc(ra({},"__esModule",{value:!0}),o),jn={};Mc(jn,{AmfModelExpander:()=>Jc,JsonLd:()=>Rt,JsonLdOptions:()=>Pn});Cn.exports=Lc(jn);var Kc=class In{validate(e){if(e===void 0)throw new Error("Node must not be undefined");if(Array.isArray(e))throw new Error("Node must not be an array");if(e["@id"]===void 0)throw new Error("Node must have an @id")}static empty(){return new In}withNode(e){this.validate(e);let t=e["@id"];if(this[t]!==void 0)throw new Error(`Cannot add node with duplicate id ${e["@id"]} to dictionary`);return this[t]=e,this}withNodes(e){return e.forEach(t=>this.withNode(t)),this}},Dr=class{static targetOrLink(o,e){let t=e[o["@id"]];return t!==void 0?t:o}static isLinkObject(o){let e=typeof o=="object",t=!Array.isArray(o),i=o["@id"]!==void 0,r=Object.keys(o).length===1;return e&&t&&i&&r}static isArrayOfLinks(o){return o.every(e=>this.isLinkObject(e))}},Fc=class{static embedNodeLinks(o,e,t){let r=t||(()=>!0);return Object.entries(o).filter(([s,a])=>r(s,a)).forEach(([s,a])=>{typeof a=="object"&&(Dr.isLinkObject(a)?o[s]=Dr.targetOrLink(a,e):Array.isArray(a)&&Dr.isArrayOfLinks(a)&&(o[s]=a.map(n=>Dr.targetOrLink(n,e))))}),o}},Nn=class ia{static expandIris(e,t){Object.entries(e).forEach(([i,r])=>{delete e[i];let s=ia.expandIri(i,t);e[s]=r})}static compactIris(e,t){Object.entries(e).forEach(([i,r])=>{delete e[i];let s=ia.compactIri(i,t);e[s]=r})}static compactIri(e,t){switch(typeof t){case"string":return e.replace(t,"");case"object":if(Array.isArray(t))throw new Error("Context must be either an object or a string");if(this.isCompacted(e,t))return e;try{let[i,r]=Object.entries(t).find(([s,a])=>e.startsWith(a));return e.replace(r,`${i}:`)}catch{return e}default:throw new Error("Context must be either an object or a string")}}static expandIri(e,t){switch(typeof t){case"string":return`${t}${e}`;case"object":if(Array.isArray(t))throw new Error("Context must be either an object or a string");if(this.isCompacted(e,t))try{let[i,r]=Object.entries(t).find(([s,a])=>e.startsWith(s));return e.replace(`${i}:`,r)}catch{return e}else return e;default:throw new Error("Context must be either an object or a string")}}static isCompacted(e,t){let i=!0;return Object.values(t).forEach(r=>{e.startsWith(r)&&(i=!1)}),i}},$n=class{static expandStructure(o){return Object.entries(o).forEach(([e,t])=>{switch(e){case"@id":break;case"@type":this.expandType(o,t);break;default:this.expandValue(o,e,t);break}}),o}static expandType(o,e){typeof e=="string"?o["@type"]=[e]:o["@type"]=e}static expandValue(o,e,t){switch(typeof t){case"string":case"number":case"boolean":o[e]=[{"@value":t}];break;case"object":Array.isArray(t)?t.map(r=>{switch(typeof r){case"string":case"number":case"boolean":return[{"@value":t}];default:return r}}):o[e]=[t]}}static compactStructure(o){if(Array.isArray(o)){let[e]=o;return this.compactStructure(e)}else return Object.entries(o).forEach(([e,t])=>{switch(e){case"@id":break;case"@type":this.compactType(o,t);break;default:this.compactValue(o,e,t);break}}),o}static compactType(o,e){Array.isArray(e)&&e.length===1&&(o["@type"]=e[0])}static compactValue(o,e,t){if(t.length===1){let[i]=t;this.isWrappedScalar(i)?o[e]=i["@value"]:o[e]=i}else t.map(i=>this.isWrappedScalar(i)?i["@value"]:i)}static isWrappedScalar(o){return o["@value"]!==void 0}},Rt=class{static process(o,e){let t=this.getGraph(o),i=this.getContext(o),r=Kc.empty().withNodes(t);t.forEach(a=>{e.embeddedLinks&&Fc.embedNodeLinks(a,r,e.linkEmbeddingFilter),i!==void 0&&(e.expandedIris?Nn.expandIris(a,i):e.compactedIris&&Nn.compactIris(a,i)),e.expandedStructure?$n.expandStructure(a):e.compactedStructure&&$n.compactStructure(a)});let s=e.rootNodeId===void 0?{"@graph":t}:this.findNode(t,e.rootNodeId);return i!==void 0&&(s["@context"]=i),e.expandedStructure?[s]:s}static getContext(o){return o["@context"]}static getGraph(o){return o["@graph"]}static findNode(o,e){return o.find(t=>t["@id"]===e)}static stringify(o,e=!1){return JSON.stringify(o,null,e?2:0)}},Pn=class On{expandedIris;expandedStructure;embeddedLinks;compactedIris;compactedStructure;rootNodeId;linkEmbeddingFilter;static apply(){return new On}withCompactedStructure(){return this.expandedStructure=!1,this.compactedStructure=!0,this}withRootNode(e){return this.rootNodeId=e,this}withExpandedStructure(){return this.expandedStructure=!0,this.compactedStructure=!1,this}withExpandedIris(){return this.expandedIris=!0,this.compactedIris=!1,this}withCompactedIris(){return this.expandedIris=!1,this.compactedIris=!0,this}withEmbeddedLinks(e){return this.linkEmbeddingFilter=e,this.embeddedLinks=!0,this}},Jc=class{static expand(o){if(this.isInExpandedForm(o))return o;{let e=(r,s)=>!r.endsWith("fixPoint");this.preprocessLegacyRootNodeId(o);let t=this.resolveRootNodeId(o),i=Pn.apply().withEmbeddedLinks(e).withCompactedIris().withExpandedStructure().withRootNode(t);return Rt.process(o,i)}}static isInExpandedForm(o){return o["@graph"]===void 0}static preprocessLegacyRootNodeId(o){let e=Rt.getGraph(o);if(e!=null){let t=Rt.findNode(e,"./");t!=null&&(t["@id"]="")}}static resolveRootNodeId(o){let e=Rt.getGraph(o);if(e==null||Rt.findNode(e,"")!=null)return"";let t=Rt.getContext(o);if(t!=null&&t["@base"]!=null){let r=t["@base"];if(Rt.findNode(e,r)!=null)return r}let i=e.find(r=>Object.entries(r).some(([s,a])=>(s==="doc:root"||s==="http://a.ml/vocabularies/document#root")&&a===!0));return i!=null?i["@id"]:""}}});import fd from"update-notifier";import{Command as gd}from"commander";var bi={name:"@api-now/cli",description:"API Now! CLI",version:"1.8.0",private:!1,publishConfig:{registry:"https://registry.npmjs.org/","@api-now:registry":"https://registry.npmjs.org/",access:"public"},files:["dist"],engines:{node:">=22.0.0"},type:"module",bin:{apinow:"dist/index.js"},scripts:{build:"node esbuild.config.js",postbuild:"node dist/index.js --help",dev:"tsx src/index.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts"',format:'prettier --write "src/**/*.ts"',test:"tsx --test tests/**/*.test.ts",prepare:"husky",prepublishOnly:"npm run build",knip:"knip"},dependencies:{"@inquirer/prompts":"^8.5.0",commander:"^15.0.0",dompurify:"^3.4.11",jsdom:"^30.0.1",nanoid:"^6.0.1",open:"^11.0.0",tslib:"^2.8.1","update-notifier":"^7.3.1",winston:"^3.19.0"},devDependencies:{"@api-now/core":"^1.10.0","@api-now/json":"^1.0.0","@commitlint/cli":"^21.0.1","@commitlint/config-conventional":"^21.0.1","@eslint/js":"^10.0.1","@semantic-release/changelog":"^7.0.0","@semantic-release/git":"^11.0.1","@types/node":"^26.2.0","@types/update-notifier":"^6.0.8",esbuild:"^0.28.0",eslint:"^10.4.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.6",globals:"^17.6.0",husky:"^9.1.7",knip:"^6.14.2",prettier:"^3.8.3","semantic-release":"^25.0.3",tsx:"^4.7.1",typescript:"^6.0.3","typescript-eslint":"^8.60.0"}};import ps from"node:os";import ut from"node:path";import ve from"node:fs";var Hi="https://api.apinow.app",us="apinow-cli",Ro="config.json",hs=class{_resolved=null;get resolved(){this._resolved||this.load();let e=this._resolved;if(!e)throw new Error("Configuration could not be loaded.");return e}configDir=this.#e();configPath=ut.join(this.configDir,Ro);load(){let e=this.#i(),t=this.#r(),i=process.env.APINOW_API_TOKEN||process.env.APINOW_TOKEN||t.token||e.token,r=process.env.APINOW_API_URL||t.apiUrl||e.apiUrl||Hi,s=t.org||e.org||"";this._resolved={token:i,apiUrl:r,org:s,format:"text"}}saturate(e){this._resolved||this.load();let t=this._resolved;if(!t)throw new Error("Configuration could not be loaded.");this._resolved={token:t.token,apiUrl:e.apiUrl||t.apiUrl,org:t.org,format:e.format==="json"?"json":"text"}}#e(){if(process.platform==="win32"){let e=process.env.APPDATA||ut.join(ps.homedir(),"AppData","Roaming");if(!e)throw new Error("Could not determine the configuration directory.");return ut.join(e,us)}return process.platform==="darwin"?ut.join(ps.homedir(),"Library","Preferences",us):ut.join(process.env.XDG_CONFIG_HOME||ut.join(ps.homedir(),".config"),us)}#t(){let e=process.cwd();for(;;){let t=ut.join(e,"apinow.json");if(ve.existsSync(t))try{if(ve.statSync(t).isFile())return t}catch{}let i=ut.join(e,".apinowrc.json");if(ve.existsSync(i))try{if(ve.statSync(i).isFile())return i}catch{}let r=ut.dirname(e);if(r===e)break;e=r}return null}#r(){let e=this.#t();if(!e)return{};try{let t=ve.readFileSync(e,"utf8");return JSON.parse(t)}catch{return{}}}#i(){try{if(!ve.existsSync(this.configPath))return{apiUrl:Hi};let e=ve.readFileSync(this.configPath,"utf8"),t=JSON.parse(e);return{apiUrl:Hi,...t}}catch{return{apiUrl:Hi}}}writeProperty(e,t){let i=this.#i();i[e]=t,this.#s(i)}#s(e){try{let i={...this.#i(),...e};ve.existsSync(this.configDir)||ve.mkdirSync(this.configDir,{recursive:!0}),ve.writeFileSync(this.configPath,JSON.stringify(i,null,2),"utf8")}catch(t){console.error("Failed to write configuration:",t)}}clearConfigKey(e){try{let t=this.#i();delete t[e],ve.existsSync(this.configDir)||ve.mkdirSync(this.configDir,{recursive:!0}),ve.writeFileSync(this.configPath,JSON.stringify(t,null,2),"utf8")}catch(t){console.error(`Failed to clear key ${e} from configuration:`,t)}}reset(){try{ve.existsSync(this.configPath)&&ve.unlinkSync(this.configPath),ve.existsSync(this.configDir)&&ve.readdirSync(this.configDir).length===0&&ve.rmdirSync(this.configDir),this._resolved=null}catch(e){console.error("Failed to reset configuration:",e)}}},P=new hs;import{styleText as Zt}from"node:util";import To from"node:path";import Do from"node:os";import zo from"node:crypto";import qe from"winston";var Uo=zo.randomBytes(4).toString("hex"),Mo=Date.now(),Wi=To.join(Do.tmpdir(),`apinow-cli-${Mo}-${Uo}.log`),_a=new qe.transports.Console({stderrLevels:Object.keys(qe.config.cli.levels),level:"info",format:qe.format.combine(qe.format.colorize(),qe.format.simple())}),Vo=new qe.transports.File({filename:Wi,level:"debug",format:qe.format.combine(qe.format.timestamp(),qe.format.printf(({timestamp:o,level:e,message:t})=>{let i=typeof t=="string"?t.replace(/\u001b\[\d+m/g,""):t;return`${o} [${e.toUpperCase()}]: ${i}`}))}),_=qe.createLogger({levels:qe.config.cli.levels,level:"debug",transports:[_a,Vo]});function Sa(o){_a.level=o}var ms=bi.version;var Q={green:o=>Zt("green",o),red:o=>Zt("red",o),yellow:o=>Zt("yellow",o),cyan:o=>Zt("cyan",o),dim:o=>Zt("dim",o),bold:o=>Zt("bold",o)};function Lo(o,e,t){if(o.length===0)return"No data available.";let i={},r=t||e;for(let l=0;l<e.length;l++){let c=e[l],p=r[l]||c;i[c]=p.length}for(let l of o)for(let c of e){let p=typeof l[c]=="object"&&l[c]!==null?JSON.stringify(l[c]):String(l[c]??"");p.length>(i[c]||0)&&(i[c]=p.length)}let s=e.map((l,c)=>(r[c]||l).toUpperCase().padEnd(i[l])).join(" "),a=e.map(l=>"-".repeat(i[l])).join(" "),n=o.map(l=>e.map(c=>(typeof l[c]=="object"&&l[c]!==null?JSON.stringify(l[c]):String(l[c]??"")).padEnd(i[c])).join(" "));return[s,a,...n].join(`
|
|
3
|
+
`)}var H=class{format;constructor(e={}){this.format=e.format||"text"}success(e,t){this.format==="json"?console.log(JSON.stringify({success:!0,message:e,data:t},null,2)):(console.log(Q.green(`\u2714 ${e}`)),t!==void 0&&(typeof t=="object"&&t!==null?this.object(t):console.log(t)))}error(e){let t=e.code||"CLI_ERR_UNKNOWN";if(this.format==="json")console.error(JSON.stringify({success:!1,code:t,cliVersion:ms,logFile:Wi,...e},null,2));else{if(console.error(Q.red(`\u2716 Error [${t}]: ${e.message}`)),e.detail&&console.error(Q.dim(e.detail)),e.errors&&e.errors.length>0){console.error(`
|
|
4
|
+
Validation errors:`);for(let i of e.errors)console.error(` - ${Q.yellow(i.field)}: ${i.message}`)}if(console.error(Q.dim(`(cli v${ms})`)),console.error(Q.dim(`Log file: ${Wi}`)),t==="CLI_ERR_UNKNOWN"){let i="https://github.com/api-now/cli",r=encodeURIComponent(`[BUG] CLI Crash: ${e.message}`),s=encodeURIComponent(`**CLI Version:** ${ms}
|
|
6
5
|
**Error Code:** ${t}
|
|
7
6
|
|
|
8
7
|
**Error Message:**
|
|
@@ -13,45 +12,45 @@ ${e.message}
|
|
|
13
12
|
${e.detail||"No stack trace available"}
|
|
14
13
|
\`\`\`
|
|
15
14
|
`),a=`${i}/issues/new?title=${r}&body=${s}`;console.error(`
|
|
16
|
-
Please report this bug: ${a}`)}}}list(e,t,i={}){if(this.format==="json")console.log(JSON.stringify(e,null,2));else{if(e.length===0){console.log("No records found.");return}console.log(
|
|
17
|
-
`)}*keys(){let e=Object.keys(this._map);for(let t of e)this._map[t].enabled&&(yield this._map[t].name)}*values(){let e=Object.keys(this._map);for(let t of e)this._map[t].enabled&&(yield this._map[t].value)}*entries(){let e=Object.keys(this._map);for(let t of e)this._map[t].enabled&&(yield[this._map[t].name,this._map[t].value])}*[Symbol.iterator](){let e=Object.keys(this._map);for(let t of e)this._map[t].enabled&&(yield[this._map[t].name,this._map[t].value])}};function us(o,e){let t=o.toLowerCase();return t==="authorization"||t==="proxy-authorization"?e.toLowerCase().startsWith("bearer ")?"Bearer **********":"**********":t==="cookie"||t==="set-cookie"||t==="x-api-key"||t==="api-key"?"**********":e}function ps(o){if(o==null)return o;if(Array.isArray(o))return o.map(e=>ps(e));if(typeof o=="object"){let e={};for(let[t,i]of Object.entries(o)){let r=t.toLowerCase();r.includes("token")||r.includes("password")||r.includes("secret")||r.includes("key")?e[t]="**********":e[t]=ps(i)}return e}return o}function ms(o){if(!o)return o;try{let e=JSON.parse(o),t=ps(e);return JSON.stringify(t,null,2)}catch{return o}}var g=class extends Error{name;status;static fromRawException(e,t){let i=e,r={};if(i.code!==void 0&&(r.code=String(i.code)),i.status!==void 0){let n=Number(i.status);isNaN(n)||(r.status=n)}i.help!==void 0&&(r.help=String(i.help));let s=i.message!==void 0?String(i.message):t,a=new this(s,r);return i.name!==void 0&&(a.name=String(i.name)),a}constructor(e,t){super(e,t);let i=this.constructor;this.name=i.name,this.message=e??i.message??"",this.status=t?.status??i.status??500;let r=t?.code??i.code;r!==void 0&&(this.code=r);let s=t?.help??i.help;s!==void 0&&(this.help=s),Error.captureStackTrace(this,i)}setHelp(e){return this.help=e,this}setCode(e){return this.code=e,this}setStatus(e){return this.status=e,this}get[Symbol.toStringTag](){return this.constructor.name}toString(){return this.code?`${this.name} [${this.code}]: ${this.message}`:`${this.name}: ${this.message}`}toJSON(){let e={name:this.name,message:this.message};return this.status&&(e.status=this.status),this.code&&(e.code=this.code),this.help&&(e.help=this.help),e}};var U="Invalid JSON response.",C="The response has no value.",N="Invalid response status: ",z="Unknown response from the server.";var Q=class{sdk;constructor(e){this.sdk=e}logInvalidResponse(e){if(!this.sdk.silent&&e.body)try{let t=JSON.parse(e.body);t.message&&console.warn(`[Store message]: ${t.message}`)}catch{}}inspectCommonStatusCodes(e){let{status:t,body:i}=e;if(t===404){let r=this.createApiError("Not found",i);throw r.status!==404&&r.setStatus(404),r.code!=="E_NOT_FOUND"&&r.setCode("E_NOT_FOUND"),r}if(t===403){let r=this.createApiError("You have no access to this resource",i);throw r.status!==403&&r.setStatus(403),r.code!=="E_FORBIDDEN"&&r.setCode("E_FORBIDDEN"),r}if(t===401){this.sdk.dispatchEvent(new Event("unauthorized"));let r=this.createApiError("Not authorized",i);throw r.status!==401&&r.setStatus(401),r.code!=="E_UNAUTHORIZED"&&r.setCode("E_UNAUTHORIZED"),r}}createApiError(e,t){if(!t)return new g(e);let i;try{i=JSON.parse(t)}catch{return new g(e)}return!i||typeof i!="object"||!i.message?new g(e):g.fromRawException(i,e)}async genericBatchDelete(e,t,i={}){let{token:r}=i,s=await this.sdk.http.post(e.toString(),{token:r,body:JSON.stringify(t)});this.inspectCommonStatusCodes(s);let a="Unable to delete in batch. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${N}${s.status}`,s.body);if(!s.body)throw new g(`${a}${C}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body)}catch{throw new g(`${a}${U}`,{code:"E_INVALID_JSON",status:s.status})}if(!Array.isArray(n.data))throw new g(`${a}${z}`,{code:"E_RESPONSE_UNKNOWN",status:s.status});return n}async genericDelete(e,t={}){let{token:i}=t,r=await this.sdk.http.delete(e.toString(),{token:i});this.inspectCommonStatusCodes(r);let s="Unable to delete the object. ";if(r.status!==204)throw this.logInvalidResponse(r),this.createApiError(`${s}${N}${r.status}`,r.body)}async genericList(e,t,i={}){let{token:r}=i;this.sdk.appendListOptions(e,t);let s=await this.sdk.http.get(e.toString(),{token:r});this.inspectCommonStatusCodes(s);let a="Unable to list revisions for a file. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${N}${s.status}`,s.body);if(!s.body)throw new g(`${a}${C}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body)}catch{throw new g(`${a}${U}`,{code:"E_INVALID_JSON",status:s.status})}if(!Array.isArray(n.data))throw new g(`${a}${z}`,{code:"E_RESPONSE_UNKNOWN",status:s.status});return n}readResponseBody(e,t){if(![200,202].includes(e.status))throw this.logInvalidResponse(e),this.createApiError(`${t}${N}${e.status}`,e.body);if(!e.body)throw new g(`${t}${C}`,{code:"E_RESPONSE_NO_VALUE",status:e.status});return e.body}readResponseJSON(e,t){let i=this.readResponseBody(e,t),r;try{r=JSON.parse(i)}catch{throw new g(`${t}${U}`,{code:"E_INVALID_JSON",status:e.status})}return r}processListResponse(e,t){this.inspectCommonStatusCodes(e);let i=this.readResponseJSON(e,t);if(!Array.isArray(i.data))throw new g(`${t}${z}`,{code:"E_RESPONSE_UNKNOWN",status:e.status});return i}assertObjectKind(e,t,i){if(t!==i)throw new g(`${e}${z}`,{code:"E_RESPONSE_UNKNOWN",status:500})}};var Ut=class extends Error{status;response;constructor(e,t){super(`HTTP Error: ${e}`),this.status=e,this.response=t}},er=class extends Q{logRequest(e,t,i){if(!this.sdk.logger)return;let r=i?.headers||{},s={};for(let[c,p]of Object.entries(r))s[c]=us(c,p);(i?.token||this.sdk.token)&&!s.authorization&&!s.Authorization&&(s.Authorization="Bearer **********");let n=i?.body,l=ms(n);this.sdk.logger.log("debug",`--> HTTP ${e} ${t}`),Object.keys(s).length>0&&this.sdk.logger.log("debug",`Headers: ${JSON.stringify(s,null,2)}`),l&&this.sdk.logger.log("debug",`Body: ${l}`)}logResponse(e,t,i){if(!this.sdk.logger)return;let r=i.headers?i.headers.toJSON():{},s={};for(let[n,l]of Object.entries(r))s[n]=us(n,l);let a=ms(i.body);this.sdk.logger.log("debug",`<-- HTTP ${i.status} ${e} ${t}`),Object.keys(s).length>0&&this.sdk.logger.log("debug",`Headers: ${JSON.stringify(s,null,2)}`),a&&this.sdk.logger.log("debug",`Body: ${a}`)}logError(e,t,i){if(!this.sdk.logger)return;let r=i instanceof Error?i.message:String(i);this.sdk.logger.log("debug",`<-- HTTP ${e} ${t} Failed: ${r}`)}};function Xo(o,e=1e3){return globalThis.__MOCK_RETRY_DELAY_MS__!==void 0?globalThis.__MOCK_RETRY_DELAY_MS__:o<=0?e:e*Math.pow(2,o-1)}function Zo(o){let{status:e}=o;return!(typeof e=="number"&&e>=400&&e<500)}async function hs(o,e={}){let{retries:t=3,delayMs:i=Xo,shouldRetry:r=Zo}=e,s;for(let n=0;n<t;n++)try{return await o()}catch(l){if(s=l,!r(s)||n===t-1)throw s;let c=typeof i=="function"?i(n+1):i;c>0&&await new Promise(p=>setTimeout(p,c))}throw s||new Error("Retry operation failed without a specific error.")}var tr=class extends er{async get(e,t={}){let i=async()=>{this.logRequest("GET",e,t);try{let r=await this._get(e,t);if(this.logResponse("GET",e,r),[301,302,308,307].includes(r.status)){let s=r.headers.get("location");if(!s)throw new Error('Expected redirection but no "location" header.');let a=new URL(s,e);return this.get(a.toString(),t)}if(t.retry&&r.status>=400)throw new Ut(r.status,r);return r}catch(r){throw this.logError("GET",e,r),r}};if(t.retry)try{let r=typeof t.retry=="object"?t.retry:{};return await hs(i,r)}catch(r){if(r instanceof Ut)return r.response;throw r}return i()}_get(e,t={}){return new Promise((i,r)=>{let{method:s="GET",headers:a={},token:n=this.sdk.token}=t,l={...a};n&&(l.authorization=`Bearer ${n}`);let u=(e.startsWith("https:")?Ta:Oa).request(e,{method:s,headers:l,rejectUnauthorized:!1});u.on("response",m=>{let h={status:m.statusCode,headers:new bi(m.headers),body:""};m.on("data",f=>{h.body+=f}),m.on("end",()=>i(h))}),u.on("error",m=>r(m)),u.end()})}async post(e,t={}){let i=t.method||"POST",r=async()=>{this.logRequest(i,e,t);let s=await new Promise((a,n)=>{let{headers:l={},token:c=this.sdk.token}=t,p={...l};c&&(p.authorization=`Bearer ${c}`),t.body&&!p["content-type"]&&!p["Content-Type"]&&(p["content-type"]="application/json");let h=(e.startsWith("https:")?Ta:Oa).request(e,{method:i,headers:p});h.on("response",f=>{let k={status:f.statusCode,headers:new bi(f.headers),body:""};f.on("data",w=>{k.body+=w}),f.on("end",()=>{this.logResponse(i,e,k),a(k)})}),h.on("error",f=>{this.logError(i,e,f),n(f)}),t.body&&h.write(t.body),h.end()});if(t.retry&&s.status>=400)throw new Ut(s.status,s);return s};if(t.retry)try{let s=typeof t.retry=="object"?t.retry:{};return await hs(r,s)}catch(s){if(s instanceof Ut)return s.response;throw s}return r()}patch(e,t={}){let i={...t,method:"PATCH"};return this.post(e,i)}put(e,t={}){let i={...t,method:"PUT"};return this.post(e,i)}delete(e,t={}){let i={...t,method:"DELETE"};return this.post(e,i)}};var A=class o{static folders(e){return`/v1/orgs/${e}/folders`}static files(e){return`/v1/orgs/${e}/files`}static filesSearch(e){return`${o.files(e)}/search`}static filesAccess(e,t){return`${o.file(e,t)}/access`}static filesBatch(e){return`${o.files(e)}/batch/read-meta`}static file(e,t){return`${o.files(e)}/${t}`}static fileMedia(e,t){return`${o.file(e,t)}/media`}static fileUsers(e,t){return`${o.file(e,t)}/users`}static fileRevisions(e,t){return`${o.file(e,t)}/revisions`}static fileBreadcrumbs(e,t){return`${o.file(e,t)}/breadcrumbs`}static fileRename(e,t){return`${o.file(e,t)}/rename`}static history(){return"/history"}static historyBatchCreate(){return"/history/batch/create"}static historyBatchDelete(){return"/history/batch/delete"}static historyItem(e){return`/history/${e}`}static historyClear(e,...t){return`/history/clear/${e}/${t.join("/")}`}static shared(e){return`/v1/orgs/${e}/shared`}static trash(e){return`/v1/orgs/${e}/trash`}static trashItem(e,t){return`${o.trash(e)}/${t}`}static trashRestore(e,t){return`${o.trashItem(e,t)}/restore`}static trashEmpty(e){return`${o.trash(e)}/empty`}static trashBatchRestore(e){return`${o.trash(e)}/restore`}static trashBatchDelete(e){return`${o.trash(e)}/delete`}static projectExecutions(){return"/project/execution"}static projectExecution(e){return`/project/execution/${e}`}static projectExecutionBulkDelete(){return"/project/execution/delete"}static projectExecutionClear(e){return`/project/execution/clear/${e}`}static organizations(){return"/v1/orgs"}static organization(e){return`/v1/orgs/${e}`}static organizationUsers(e){return`${this.organization(e)}/users`}static organizationUserBatch(e){return`${this.organization(e)}/users/batch/read`}static organizationUser(e,t){return`${this.organization(e)}/users/${t}`}static organizationUserDeactivate(e,t){return`${this.organization(e)}/users/${t}/deactivate`}static organizationUserActivate(e,t){return`${this.organization(e)}/users/${t}/activate`}static invitations(e){return`${this.organization(e)}/invitations`}static invitation(e,t){return`${this.invitations(e)}/${t}`}static findInvitation(){return`${this.organizations()}/find-invitation`}static declineInvitation(e,t){return`${this.invitation(e,t)}/decline`}static resendInvitation(e,t){return`${this.invitation(e,t)}/resend`}static authGoogle(){return"/auth/google"}static authLogout(){return"/auth/logout"}static usersMe(){return"/v1/users/me"}static usersMeTokens(){return`${o.usersMe()}/tokens`}static usersMeToken(e){return`${o.usersMeTokens()}/${e}`}static dataCatalog(){return"/v1/datacatalog"}static dataCatalogStatus(e){return`${o.dataCatalog()}/status/${e}`}static dataCatalogEntry(e){return`${o.dataCatalog()}/${e}`}static dataCatalogEntryVersions(e){return`${o.dataCatalogEntry(e)}/versions`}static dataCatalogDependencies(){return`${o.dataCatalog()}/dependencies`}static dataCatalogUpdates(){return`${o.dataCatalog()}/updates`}static dataCatalogVersion(e,t){return`${o.dataCatalogEntry(e)}/${t}`}static dataCatalogDeprecate(e){return`${o.dataCatalogEntry(e)}/deprecate`}static dataCatalogUnpublish(e){return`${o.dataCatalogEntry(e)}/unpublish`}static dataCatalogVersionDeprecate(e,t){return`${o.dataCatalogVersion(e,t)}/deprecate`}static dataCatalogVersionUnpublish(e,t){return`${o.dataCatalogVersion(e,t)}/unpublish`}static groups(e){return`/v1/orgs/${e}/groups`}static group(e,t){return`/v1/orgs/${e}/groups/${t}`}static groupUsers(e,t){return`/v1/orgs/${e}/groups/${t}/users`}static aiModifyDomain(e,t){return`${this.organization(e)}/ai/domains/${t}/modify/stream`}static aiModifyApi(e,t){return`${this.organization(e)}/ai/apis/${t}/modify/stream`}static aiSessions(e,t){return`${this.organization(e)}/ai/sessions/${t}`}static aiSession(e,t,i){return`${o.aiSessions(e,t)}/${i}`}static aiMessages(e,t){return`${this.organization(e)}/ai/messages/${t}`}static aiMessage(e,t,i){return`${o.aiMessages(e,t)}/${i}`}static orgSlugGenerate(){return"/v1/orgs/slugs/generate"}static orgSlugValidate(){return"/v1/orgs/slugs/validate"}static deployments(e){return`/v1/orgs/${e}/deployments`}static deploymentsApis(e){return`${o.deployments(e)}/apis`}static deployment(e,t){return`${o.deployments(e)}/${t}`}static deploymentsForApi(e,t){return`${o.deploymentsApis(e)}/${t}`}static deploymentsApisByEnvLatest(e,t){return`${o.deploymentsApis(e)}/${t}/environments/latest`}static rollback(e,t){return`${o.deployment(e,t)}/rollback`}static deploymentsApiRuntimeUsersUpdate(e,t){return`${o.deploymentsApis(e)}/${t}/runtime/users/update`}static job(e,t){return`/v1/orgs/${e}/jobs/${t}`}};var ir=class extends Q{oauthRedirect(e,t={}){let{redirect:i,token:r,type:s="redirect"}=t,a=new URL(this.sdk.baseUri);if(!["google","github","linkedin"].includes(e))throw new Error(`Invalid provider: ${e}`);let n=new URL(`/auth/${e}/redirect`,a);return i&&n.searchParams.set("r",i),r&&n.searchParams.set("token",r),s==="redirect"?(window.location.href=n.toString(),null):window.open(n.toString(),"_blank")}async logout(e={}){let{token:t,retry:i=!0}=e,r=this.sdk.getUrl(A.authLogout()),s=await this.sdk.http.post(r.toString(),{token:t,retry:i});this.inspectCommonStatusCodes(s);let a="Unable to log out. ";if(s.status!==204)throw this.logInvalidResponse(s),this.createApiError(`${a}${N}${s.status}`,s.body)}};import{customAlphabet as Qo}from"nanoid";var F=Qo("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_",21);var Ye="Core#Permission",He=["reader","commenter","writer","owner"],xt=class o{kind=Ye;key="";type="user";granteeId="";role="reader";displayName;expirationTime;addingUser="";itemId="";depth=0;sourceRule="direct_user_grant";static fromUserRole(e,t,i,r){let s={key:F(),kind:Ye,itemId:t,granteeId:i,role:e,type:"user",addingUser:r,depth:0,sourceRule:"direct_user_grant"};return new o(s)}static fromGroupRole(e,t,i,r){let s={key:F(),kind:Ye,itemId:t,granteeId:i,role:e,type:"group",addingUser:r,depth:0,sourceRule:"direct_user_grant"};return new o(s)}static fromOrganizationRole(e,t,i,r){let s={key:F(),kind:Ye,itemId:t,granteeId:i,role:e,type:"organization",addingUser:r,depth:0,sourceRule:"direct_user_grant"};return new o(s)}static fromValues(e){return new o({...e,key:F(),kind:Ye})}constructor(e){let t;typeof e=="string"?t=JSON.parse(e):typeof e=="object"?t=e:t={kind:Ye,key:F(),granteeId:"",itemId:"",role:"reader",type:"user",addingUser:"",depth:0,sourceRule:"direct_user_grant"},this.new(t)}new(e){if(!o.isPermission(e))throw new Error("Not a permission.");let{key:t=F(),granteeId:i,role:r,type:s,displayName:a,expirationTime:n,addingUser:l,itemId:c,depth:p,sourceRule:u}=e;this.kind=Ye,this.key=t,this.granteeId=i,this.itemId=c,this.role=r,this.type=s,this.addingUser=l,this.depth=p||0,this.sourceRule=u||"direct_user_grant",a?this.displayName=a:this.displayName=void 0,typeof n=="number"?this.expirationTime=n:this.expirationTime=void 0}static isPermission(e){return!(!e||e.kind!==Ye)}static hasRole(e,t){if(!t)return!1;let i=He.indexOf(t),r=He.indexOf(e);return i>=r}static isHigherRole(e,t){let i=He.indexOf(e),r=He.indexOf(t);return i>r}hasRole(e){return o.hasRole(e,this.role)}static hasRoleIn(e,t){if(!t||!t.length)return!1;let i=[...t].sort((l,c)=>l.depth-c.depth),r=i[0].depth,s=i.filter(l=>l.depth===r),a,n=s.filter(l=>l.type==="user");if(n.length)a=n.sort((l,c)=>He.indexOf(c.role)-He.indexOf(l.role))[0];else{let l=s.filter(c=>c.type==="group");if(l.length)a=l.sort((c,p)=>He.indexOf(p.role)-He.indexOf(c.role))[0];else{let c=s.filter(p=>p.type==="organization");c.length&&(a=c.sort((p,u)=>He.indexOf(u.role)-He.indexOf(p.role))[0])}}return a?o.hasRole(e,a.role):!1}toJSON(){let e={kind:Ye,key:this.key,role:this.role,type:this.type,addingUser:this.addingUser,granteeId:this.granteeId,itemId:this.itemId,depth:this.depth,sourceRule:this.sourceRule};return this.displayName&&(e.displayName=this.displayName),this.expirationTime&&(e.expirationTime=this.expirationTime),e}};var At="Core#Thing",Re="Core#Folder";var wi="Core#User",ut="Data#DomainFile",Ce="Data#Domain",ye="Domain#Namespace",de="Domain#Model",H="Domain#Entity",fe="Domain#Association",ne="Domain#Property",mt="Core#DataCatalog",ht="Core#DataCatalogVersion";var ei="Core#Deployment",Ae="Core#ApiModel",Et="Core#ExposedEntity",fs="Core#ApiFile";var ki="Core#AiSession",gs="Core#AiMessage",ys="Core#Job";var ee=class o{kind=At;name;displayName;description;version;static fromName(e){return new o({name:e,kind:At})}static fromJSON(e={},t={}){let i=new o,{name:r,displayName:s,description:a,version:n}=e||{};return typeof r=="string"?i.name=r:typeof t.name=="string"&&(i.name=t.name),typeof s=="string"?i.displayName=s:typeof t.displayName=="string"&&(i.displayName=t.displayName),a?i.description=a:typeof t.description=="string"&&(i.description=t.description),n?i.version=n:typeof t.version=="string"&&(i.version=t.version),i}constructor(e){let t;typeof e=="string"?t=JSON.parse(e):typeof e=="object"?t=e:t={kind:At},this.new(t)}new(e){if(!o.isThing(e))throw new Error("Not a thing.");let{description:t,name:i,version:r,displayName:s}=e;this.kind=At,this.name=i,this.displayName=s,this.description=t,this.version=r}static validate(e,t={}){let{strict:i}=t;return e&&typeof e=="object"?!(i&&e.kind!==At):!1}static isThing(e){return!!(e&&e.kind===At)}toJSON(){let e={kind:At};return typeof this.name=="string"&&(e.name=this.name),typeof this.displayName=="string"&&(e.displayName=this.displayName),this.description&&(e.description=this.description),this.version&&(e.version=this.version),e}getLabel(e){return this.displayName||this.name||e||"Unnamed object"}};var bs=Symbol("parents"),rr=Symbol("deleted"),sr=Symbol("deletedInfo"),ar=Symbol("lastModified"),ws=Symbol("capabilities"),ks=Symbol("permissions"),vs=Symbol("permissionIds"),Ss=Symbol("shortcutTarget"),vi=class{kind="";key="";info=ee.fromName("");iconColor;get isShortcut(){return!!this.shortcutTarget}[Ss];get shortcutTarget(){return this[Ss]}set shortcutTarget(e){this[Ss]=e}static createSchema(e={}){let{key:t=F(),kind:i,iconColor:r,shortcutTarget:s}=e,a={key:t,kind:i||"",info:ee.fromJSON(e.info,{name:"Unnamed file"}).toJSON()};return r&&(a.iconColor=r),s&&(a.isShortcut=!0,a.shortcutTarget=s),a}constructor(e){this.kind=e.kind,this.key=e.key,this.info=new ee(e.info),e.iconColor&&(this.iconColor=e.iconColor),e.shortcutTarget&&(this.shortcutTarget=e.shortcutTarget)}toJSON(){let e={key:this.key,kind:this.kind,info:this.info.toJSON()};return this.iconColor&&(e.iconColor=this.iconColor),this.shortcutTarget&&(e.isShortcut=!0,e.shortcutTarget=this.shortcutTarget),e}static createFileCapabilities(e,t){let i=xt.hasRole("commenter",t),r=xt.hasRole("owner",t),s=xt.hasRole("reader",t),a=xt.hasRole("writer",t),n=e.kind===Re;return{canReadMedia:!n&&s,canListChildren:n&&s,canComment:!n&&i,canEditMedia:!n&&a,canEditMeta:a,canReadRevisions:a,canAddChildren:n&&a,canDelete:r,canTrash:r,canUntrash:r,canShare:a,canMove:a}}createFileCapabilities(e){return qe.createFileCapabilities(this,e)}static updateByMeMeta(e,t){e.deletedInfo&&(e.deletedInfo.byMe=e.deletedInfo.user===t),e.lastModified&&(e.lastModified.byMe=e.lastModified.user===t)}static setLastModified(e,t){if(!e)throw new Error("The file is required.");if(!t)throw new Error("The user is required.");if(t.kind!==wi)throw new Error('Invalid value for the user when setting "lastModified".');return e.lastModified={byMe:!1,time:Date.now(),user:t.key,name:t.name},e}static setDeleted(e,t){if(!e)throw new Error("The file is required.");if(!t)throw new Error("The user is required.");if(t.kind!==wi)throw new Error('Invalid value for the user when setting "deletedInfo".');return e.deleted=!0,e.deletedInfo={byMe:!1,time:Date.now(),user:t.key,name:t.name},e}},qe=class o extends vi{[bs]=[];get parents(){return this[bs]}[vs]=[];get permissionIds(){return this[vs]}[rr];get deleted(){return this[rr]||!1}[sr];get deletedInfo(){return this[sr]}[ar]={user:"",time:0,byMe:!1};get lastModified(){return this[ar]}labels;[ws];get capabilities(){return this[ws]}[ks]=[];get permissions(){return this[ks]}static createSchema(e={}){let t=vi.createSchema(e);return Array.isArray(e.parents)?t.parents=[...e.parents]:t.parents=[],Array.isArray(e.permissionIds)?t.permissionIds=[...e.permissionIds]:t.permissionIds=[],Array.isArray(e.permissions)?t.permissions=e.permissions.map(i=>({...i})):t.permissions=[],e.capabilities&&(t.capabilities={...e.capabilities}),e.lastModified?t.lastModified={...e.lastModified}:t.lastModified={user:"",time:0,byMe:!1},typeof e.deleted=="boolean"&&(t.deleted=e.deleted,t.deletedInfo=e.deletedInfo?{...e.deletedInfo}:void 0),Array.isArray(e.labels)&&(t.labels=[...e.labels]),typeof e.shortcutTarget=="string"&&(t.shortcutTarget=e.shortcutTarget),t}constructor(e){let t=o.createSchema(e);super(t),this[bs]=[...t.parents],this[vs]=[...t.permissionIds],this[ks]=t.permissions.map(i=>({...i})),this[ws]=t.capabilities?{...t.capabilities}:void 0,this[ar]=Object.freeze({...t.lastModified}),typeof t.deleted=="boolean"&&(this[rr]=t.deleted,this[sr]=t.deletedInfo?Object.freeze({...t.deletedInfo}):void 0),Array.isArray(t.labels)&&(this.labels=[...t.labels])}toJSON(){let e={...super.toJSON(),parents:[...this.parents],permissionIds:[...this.permissionIds],lastModified:{...this.lastModified},permissions:[...this.permissions]};return this.deleted&&(e.deleted=this.deleted,e.deletedInfo={...this.deletedInfo}),Array.isArray(this.labels)&&(e.labels=[...this.labels]),e}static fromName(e,t){return new o({kind:t,info:{name:e}})}shortcutTo(e){return this.shortcutTarget=e,this}setLastModified(e){if(!e)throw new Error("The user is required.");if(e.kind!==wi)throw new Error('Invalid value for the user when setting "lastModified".');this[ar]={byMe:!1,time:Date.now(),user:e.key,name:e.name}}addLabel(e){if(typeof e!="string")throw new Error("The label must be a string.");if(!e.trim())throw new Error("The label is required.");Array.isArray(this.labels)||(this.labels=[]),!this.labels.includes(e)&&this.labels.push(e)}setDeleted(e){if(!e)throw new Error("The user is required.");if(e.kind!==wi)throw new Error('Invalid value for the user when setting "deletedInfo".');this[rr]=!0,this[sr]={byMe:!1,time:Date.now(),user:e.key,name:e.name}}isFile(){return this.kind!==Re}isFolder(){return this.kind===Re}};var Si=class extends qe{kind=Re;static fromName(e){return super.fromName(e,Re)}constructor(e){let t=qe.createSchema(e);t.kind=Re,super(t)}static isFolder(e){return!(!e||e.kind!==Re)}toJSON(){return{...super.toJSON(),kind:Re}}};var nr=class extends Q{async list(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a={...t},n=this.sdk.getUrl(A.files(e));this.sdk.appendListOptions(n,a);let l=await this.sdk.http.get(n.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(l);let c="Unable to list files. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}async search(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.filesSearch(e)),{searchParams:n}=a;if(t.cursor&&n.set("cursor",t.cursor),typeof t.limit=="number"&&n.set("limit",String(t.limit)),t.parent&&n.set("parent",t.parent),t.kind)for(let c of t.kind)n.append("kind",c);if(t.query)for(let c of t.query)n.append("query",c);let l=await this.sdk.http.get(a.toString(),{token:r,retry:s});return this.processListResponse(l,"Unable to search files. ")}async create(e,t,i,r={},s={}){let a=await this.createMeta(e,i,r,s);return await this.createMedia(t,i,a.key,r,s),a}async createMeta(e,t,i={},r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.files(t));i.parent&&n.searchParams.set("parent",i.parent);let l=JSON.stringify(e),c=await this.sdk.http.post(n.toString(),{token:s,body:l,retry:a,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(c);let p="Unable to create a file. ";if(c.status!==201)throw this.logInvalidResponse(c),this.createApiError(`${p}${N}${c.status}`,c.body);if(!c.body)throw new g(`${p}${C}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${U}`,{code:"E_INVALID_JSON",status:c.status})}if(!u.key)throw new g(`${p}${z}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}async createMedia(e,t,i,r={},s={}){let{token:a=this.sdk.token,retry:n=!0}=s,l=A.fileMedia(t,i),c=this.sdk.getUrl(l),p=r.mime||"application/json",u;p.includes("json")?u=JSON.stringify(e):u=String(e);let m=await this.sdk.http.put(c.toString(),{token:a,body:u,retry:n,headers:{"content-type":p}});this.inspectCommonStatusCodes(m);let h="Unable to create a file. ";if(m.status!==200)throw this.logInvalidResponse(m),this.createApiError(`${h}${N}${m.status}`,m.body)}async createFolder(e,t,i={},r={}){let s=Si.fromName(e),{token:a=this.sdk.token,retry:n=!0}=r,l=this.sdk.getUrl(A.files(t));i.parent&&l.searchParams.set("parent",i.parent);let c=JSON.stringify(s),p=await this.sdk.http.post(l.toString(),{token:a,body:c,retry:n,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(p);let u="Unable to create a file. ";if(p.status!==201)throw this.logInvalidResponse(p),this.createApiError(`${u}${N}${p.status}`,p.body);if(!p.body)throw new g(`${u}${C}`,{code:"E_RESPONSE_NO_VALUE",status:p.status});let m;try{m=JSON.parse(p.body).data}catch{throw new g(`${u}${U}`,{code:"E_INVALID_JSON",status:p.status})}if(!m.key)throw new g(`${u}${z}`,{code:"E_RESPONSE_UNKNOWN",status:p.status});return m}async read(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.file(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read a file. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.kind)throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}async readMedia(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.fileMedia(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read a file media. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!c||typeof c!="object"||!("data"in c)||!("meta"in c))throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});let{data:p,meta:u}=c;if(!u||typeof u!="object"||typeof u.version!="number"||typeof u.updated!="number"||isNaN(u.version)||isNaN(u.updated))throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return{media:p,meta:u}}async readBulk(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.filesBatch(e)),n=JSON.stringify({ids:t}),l=await this.sdk.http.post(a.toString(),{token:r,body:n,retry:s});this.inspectCommonStatusCodes(l);let c="Unable to read files in bulk. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}async patch(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=A.file(e,t),l=this.sdk.getUrl(n),c=JSON.stringify(i),p=await this.sdk.http.patch(l.toString(),{token:s,body:c,retry:a});this.inspectCommonStatusCodes(p);let u="Unable to patch a file. ";if(p.status!==200)throw this.logInvalidResponse(p),this.createApiError(`${u}${N}${p.status}`,p.body);if(!p.body)throw new g(`${u}${C}`,{code:"E_RESPONSE_NO_VALUE",status:p.status});let m;try{m=JSON.parse(p.body).data}catch{throw new g(`${u}${U}`,{code:"E_INVALID_JSON",status:p.status})}if(!m.kind)throw new g(`${u}${z}`,{code:"E_RESPONSE_UNKNOWN",status:p.status});return m}async patchMedia(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=A.fileMedia(e,t),l=this.sdk.getUrl(n),c=JSON.stringify(i),p=await this.sdk.http.patch(l.toString(),{token:s,body:c,retry:a});this.inspectCommonStatusCodes(p);let u="Unable to patch a file contents. ";if(p.status!==200)throw this.logInvalidResponse(p),this.createApiError(`${u}${N}${p.status}`,p.body);if(!p.body)throw new g(`${u}${C}`,{code:"E_RESPONSE_NO_VALUE",status:p.status});let m;try{m=JSON.parse(p.body).data}catch{throw new g(`${u}${U}`,{code:"E_INVALID_JSON",status:p.status})}return m}async delete(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.file(e,t)),n=await this.sdk.http.delete(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to trash a file. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body)}async deleteBulk(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.files(e)),n=await this.sdk.http.delete(a.toString(),{token:r,body:JSON.stringify({ids:t}),retry:s});this.inspectCommonStatusCodes(n);let l="Unable to trash files. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body)}async patchUsers(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.filesAccess(e,t)),l=JSON.stringify(i),c=await this.sdk.http.patch(n.toString(),{token:s,body:l,retry:a});this.inspectCommonStatusCodes(c);let p="Unable to patch the file. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${N}${c.status}`,c.body);if(!c.body)throw new g(`${p}${C}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${U}`,{code:"E_INVALID_JSON",status:c.status})}if(!u.key)throw new g(`${p}${z}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}async addUser(e,t,i,r,s,a){let n={op:"add",type:"user",value:r,id:i};typeof s=="number"&&(n.expirationTime=s);let l={patch:[n],id:F()};return this.patchUsers(e,t,l,a)}async removeUser(e,t,i,r){let a={patch:[{op:"remove",type:"user",id:i}],id:F()};return this.patchUsers(e,t,a,r)}async listUsers(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.fileUsers(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to list users in the file. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}async breadcrumbs(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.fileBreadcrumbs(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read breadcrumbs. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}async rename(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.fileRename(e,t)),l=await this.sdk.http.put(n.toString(),{token:s,body:JSON.stringify({name:i}),retry:a});this.inspectCommonStatusCodes(l);let c="Unable to rename file. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}return p}};var or=class extends Q{async me(e={}){let{token:t=this.sdk.token,retry:i=!0}=e,r=this.sdk.getUrl(A.usersMe()),s=await this.sdk.http.get(r.toString(),{token:t,retry:i});this.inspectCommonStatusCodes(s);let a="Unable to read a user. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${N}${s.status}`,s.body);if(!s.body)throw new g(`${a}${C}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body).data}catch{throw new g(`${a}${U}`,{code:"E_INVALID_JSON",status:s.status})}if(!n.key)throw new g(`${a}${z}`,{code:"E_RESPONSE_UNKNOWN",status:s.status});return n}async listTokens(e={}){let{token:t=this.sdk.token,retry:i=!0}=e,r=this.sdk.getUrl(A.usersMeTokens()),s=await this.sdk.http.get(r.toString(),{token:t,retry:i});this.inspectCommonStatusCodes(s);let a="Unable to list tokens. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${N}${s.status}`,s.body);if(!s.body)throw new g(`${a}${C}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body).data}catch{throw new g(`${a}${U}`,{code:"E_INVALID_JSON",status:s.status})}return n}async createToken(e={},t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.usersMeTokens()),a=JSON.stringify(e),n=await this.sdk.http.post(s.toString(),{token:i,body:a,retry:r,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(n);let l="Unable to create a token. ";if(n.status!==200&&n.status!==201)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}return c}async deleteToken(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.usersMeToken(e)),a=await this.sdk.http.delete(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to delete a token. ";if(a.status!==204)throw this.logInvalidResponse(a),this.createApiError(`${n}${N}${a.status}`,a.body)}};var lr=class extends Q{async list(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.shared(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to list shared files. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}};var cr=class extends Q{async list(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.fileRevisions(e,t));this.sdk.appendListOptions(n,i);let l=await this.sdk.http.get(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to list revisions for a file. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}};var dr=class extends Q{async list(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.trash(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to list trash. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}async delete(e,t,i={}){let r=A.trashBatchDelete(e),s=this.sdk.getUrl(r),{token:a=this.sdk.token,retry:n=!0}=i,l=await this.sdk.http.delete(s.toString(),{token:a,body:JSON.stringify({ids:t}),retry:n});this.inspectCommonStatusCodes(l);let c="Unable to delete trash. ";if(l.status!==204)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body)}async restore(e,t,i={}){let r=this.sdk.getUrl(A.trashBatchRestore(e)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.post(r.toString(),{token:s,body:JSON.stringify({ids:t}),retry:a});this.inspectCommonStatusCodes(n);let l="Unable to restore from trash. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body)}async empty(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.trashEmpty(e)),a=await this.sdk.http.delete(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to empty trash. ";if(a.status!==204)throw this.logInvalidResponse(a),this.createApiError(`${n}${N}${a.status}`,a.body)}};var pr=class extends Q{async list(e={}){let{token:t=this.sdk.token,retry:i=!0}=e,r=this.sdk.getUrl(A.organizations()),s=await this.sdk.http.get(r.toString(),{token:t,retry:i});this.inspectCommonStatusCodes(s);let a="Unable to list your organizations. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${N}${s.status}`,s.body);if(!s.body)throw new g(`${a}${C}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body)}catch{throw new g(`${a}${U}`,{code:"E_INVALID_JSON",status:s.status})}if(!Array.isArray(n.data))throw new g(`${a}${z}`,{code:"E_RESPONSE_UNKNOWN",status:s.status});return n}async create(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizations()),n={name:e,slug:t},l=await this.sdk.http.post(a.toString(),{body:JSON.stringify(n),token:r,headers:{"Content-Type":"application/json"},retry:s});this.inspectCommonStatusCodes(l);let c="Unable to create an organization. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!p.kind)throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}invitations={list:async(e,t={})=>{let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.invitations(e)),a=await this.sdk.http.get(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to list organization invitations. ";if(a.status!==200)throw this.logInvalidResponse(a),this.createApiError(`${n}${N}${a.status}`,a.body);if(!a.body)throw new g(`${n}${C}`,{code:"E_RESPONSE_NO_VALUE",status:a.status});let l;try{l=JSON.parse(a.body)}catch{throw new g(`${n}${U}`,{code:"E_INVALID_JSON",status:a.status})}if(!Array.isArray(l.data))throw new g(`${n}${z}`,{code:"E_RESPONSE_UNKNOWN",status:a.status});return l},create:async(e,t,i,r,s={})=>{let{token:a=this.sdk.token,retry:n=!0}=s,l=this.sdk.getUrl(A.invitations(e)),c={email:t,name:r,grant_type:i},p=await this.sdk.http.post(l.toString(),{body:JSON.stringify(c),token:a,headers:{"Content-Type":"application/json"},retry:n});this.inspectCommonStatusCodes(p);let u="Unable to create an invitation. ";if(p.status!==200)throw this.logInvalidResponse(p),this.createApiError(`${u}${N}${p.status}`,p.body);if(!p.body)throw new g(`${u}${C}`,{code:"E_RESPONSE_NO_VALUE",status:p.status});let m;try{m=JSON.parse(p.body).data}catch{throw new g(`${u}${U}`,{code:"E_INVALID_JSON",status:p.status})}if(!m.kind)throw new g(`${u}${z}`,{code:"E_RESPONSE_UNKNOWN",status:p.status});return m},findByToken:async(e,t={})=>{let i=this.sdk.getUrl(A.findInvitation());i.searchParams.append("token",e);let{retry:r=!0,token:s}=t,a=await this.sdk.http.get(i.toString(),{token:s,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to find invitation by token. ";if(a.status!==200)throw this.logInvalidResponse(a),this.createApiError(`${n}${N}${a.status}`,a.body);if(!a.body)throw new g(`${n}${C}`,{code:"E_RESPONSE_NO_VALUE",status:a.status});let l;try{l=JSON.parse(a.body).data}catch{throw new g(`${n}${U}`,{code:"E_INVALID_JSON",status:a.status})}if(!l.kind)throw new g(`${n}${z}`,{code:"E_RESPONSE_UNKNOWN",status:a.status});return l},decline:async(e,t,i={})=>{let r=this.sdk.getUrl(A.declineInvitation(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.post(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to decline invitation. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.kind)throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c},delete:async(e,t,i={})=>{let r=this.sdk.getUrl(A.invitation(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.delete(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to delete invitation. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.kind)throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c},patch:async(e,t,i,r={})=>{let s=this.sdk.getUrl(A.invitation(e,t)),{token:a=this.sdk.token,retry:n=!0}=r,l=await this.sdk.http.patch(s.toString(),{body:JSON.stringify(i),token:a,headers:{"Content-Type":"application/json"},retry:n});this.inspectCommonStatusCodes(l);let c="Unable to update invitation. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!p.kind)throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},resend:async(e,t,i={})=>{let r=this.sdk.getUrl(A.resendInvitation(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.put(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to resend invitation. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.kind)throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}};users={list:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUsers(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to list projects. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c},read:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUser(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read the user info. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}return c},readBatch:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUserBatch(e)),n={ids:t},l=await this.sdk.http.post(a.toString(),{body:JSON.stringify(n),token:r,retry:s});this.inspectCommonStatusCodes(l);let c="Unable to read the user batch info. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},activate:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUserActivate(e,t)),n=await this.sdk.http.post(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to activate the user. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}return c},deactivate:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUserDeactivate(e,t)),n=await this.sdk.http.post(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to deactivate the user. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}return c},delete:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUser(e,t)),n=await this.sdk.http.delete(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to delete the user. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body)}};slugs={generate:async(e,t={})=>{let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.orgSlugGenerate()).toString(),a={name:e},n=await this.sdk.http.post(s,{body:JSON.stringify(a),token:i,retry:r});this.inspectCommonStatusCodes(n);let l="Unable to generate the slug. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.slug)throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c.slug},validate:async(e,t={})=>{let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.orgSlugValidate()).toString(),a={slug:e},n=await this.sdk.http.post(s,{body:JSON.stringify(a),token:i,retry:r});this.inspectCommonStatusCodes(n);let l="Unable to validate the slug. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);if(!n.body)throw new g(`${l}${C}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${U}`,{code:"E_INVALID_JSON",status:n.status})}if(typeof c.valid!="boolean")throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}}};var ur=class extends Q{async list(e={},t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s={...e},a=this.sdk.getUrl(A.dataCatalog());this.sdk.appendListOptions(a,s),s.scope&&a.searchParams.set("scope",s.scope);let n=await this.sdk.http.get(a.toString(),{token:i,retry:r});return this.processListResponse(n,"Unable to list data domains. ")}async listVersions(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalogEntryVersions(e)),a=await this.sdk.http.get(s.toString(),{token:i,retry:r});return this.processListResponse(a,"Unable to list data domain versions. ")}async publish(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalog()),a=JSON.stringify(e),n=await this.sdk.http.post(s.toString(),{token:i,body:a,retry:r,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(n);let l="Unable to publish data domain. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,mt,c.kind),c}async read(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalogEntry(e)),a=await this.sdk.http.get(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to read data domain. ";if(a.status!==200)throw this.logInvalidResponse(a),this.createApiError(`${n}${N}${a.status}`,a.body);let l=this.readResponseJSON(a,n).data;return this.assertObjectKind(n,mt,l.kind),l}async deprecate(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogDeprecate(e)),n=JSON.stringify({reason:t}),l=await this.sdk.http.put(a.toString(),{token:r,body:n,retry:s,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(l);let c="Unable to deprecate data domain. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);let p=this.readResponseJSON(l,c).data;return this.assertObjectKind(c,mt,p.kind),p}async unpublish(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalogUnpublish(e)),a=await this.sdk.http.put(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to unpublish data domain. ";if(a.status!==200)throw this.logInvalidResponse(a),this.createApiError(`${n}${N}${a.status}`,a.body);let l=this.readResponseJSON(a,n).data;return this.assertObjectKind(n,mt,l.kind),l}async publishVersion(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogEntryVersions(e)),n=JSON.stringify(t),l=await this.sdk.http.post(a.toString(),{token:r,body:n,retry:s,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(l);let c="Unable to publish data domain version. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);let p=this.readResponseJSON(l,c).data;return this.assertObjectKind(c,ht,p.kind),p}async readVersion(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogVersion(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read data domain version. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ht,c.kind),c}async listDependencies(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalogDependencies()),a=JSON.stringify({items:e}),n=await this.sdk.http.post(s.toString(),{token:i,body:a,retry:r,headers:{"content-type":"application/json"}});return this.processListResponse(n,"Unable to list data domain dependencies. ")}async checkUpdates(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=e.map(c=>({fid:c.key,version:c.version})),a=this.sdk.getUrl(A.dataCatalogUpdates()),n=JSON.stringify({dependencies:s}),l=await this.sdk.http.post(a.toString(),{token:i,body:n,retry:r,headers:{"content-type":"application/json"}});return this.processListResponse(l,"Unable to check for data domain updates. ")}async deprecateVersion(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.dataCatalogVersionDeprecate(e,t)),l=JSON.stringify({reason:i}),c=await this.sdk.http.put(n.toString(),{token:s,body:l,retry:a,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(c);let p="Unable to deprecate data domain version. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${N}${c.status}`,c.body);let u=this.readResponseJSON(c,p).data;return this.assertObjectKind(p,ht,u.kind),u}async unpublishVersion(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogVersionUnpublish(e,t)),n=await this.sdk.http.put(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to unpublish data domain version. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ht,c.kind),c}async checkPublicationStatus(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogStatus(e));t&&a.searchParams.set("oid",t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to check data domain publication status. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,mt,c.kind),c}};var mr=class extends Q{async create(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.groups(e)),n=JSON.stringify(t),l=await this.sdk.http.post(a.toString(),{token:r,body:n,headers:{"content-type":"application/json"},retry:s});this.inspectCommonStatusCodes(l);let c="Unable to create a group. ";if(l.status!==201)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!p.key)throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}async list(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.groups(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to create a group. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(l+N+n.status,n.body);if(!n.body)throw new g(l+C,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(l+U,{code:"E_INVALID_JSON",status:n.status})}return c}async update(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.group(e,t.key)),n=JSON.stringify(t),l=await this.sdk.http.put(a.toString(),{token:r,body:n,headers:{"content-type":"application/json"},retry:s});this.inspectCommonStatusCodes(l);let c="Unable to update a group. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!p.key)throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}async delete(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.group(e,t)),n=await this.sdk.http.delete(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to delete a group. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body)}async addUsers(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.groupUsers(e,t)),l=JSON.stringify({ids:i}),c=await this.sdk.http.post(n.toString(),{token:s,body:l,headers:{"content-type":"application/json"},retry:a});this.inspectCommonStatusCodes(c);let p="Unable to add users to a group. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${N}${c.status}`,c.body);if(!c.body)throw new g(`${p}${C}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${U}`,{code:"E_INVALID_JSON",status:c.status})}if(!u.key)throw new g(`${p}${z}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}async removeUsers(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.groupUsers(e,t)),l=JSON.stringify({ids:i}),c=await this.sdk.http.delete(n.toString(),{token:s,body:l,headers:{"content-type":"application/json"},retry:a});this.inspectCommonStatusCodes(c);let p="Unable to remove users from a group. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${N}${c.status}`,c.body);if(!c.body)throw new g(`${p}${C}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${U}`,{code:"E_INVALID_JSON",status:c.status})}if(!u.key)throw new g(`${p}${z}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}};var hr=class extends Q{async*modifyDomain(e,t,i,r,s={}){let{token:a=this.sdk.token,signal:n}=s,l=this.sdk.getUrl(A.aiModifyDomain(e,t)),c=JSON.stringify({goal:i,sid:r}),p={method:"POST",headers:{"content-type":"application/json",accept:"text/event-stream",authorization:`Bearer ${a}`},redirect:"follow",credentials:"include",body:c,signal:n},u=await fetch(l,p);if(!u.ok){let k=await u.text();throw new g(`Failed to modify domain: ${u.status} ${k}`)}let m=u.body?.getReader();if(!m)throw new g("Failed to get reader from response");let h=new TextDecoder,f="";for(;;){let{done:k,value:w}=await m.read();if(k)return;f+=h.decode(w,{stream:!0});let b;for(;(b=f.indexOf(`
|
|
15
|
+
Please report this bug: ${a}`)}}}list(e,t,i={}){if(this.format==="json")console.log(JSON.stringify(e,null,2));else{if(e.length===0){console.log("No records found.");return}console.log(Lo(e,t,i.headers))}}object(e){let t=e;if(this.format==="json")console.log(JSON.stringify(t,null,2));else for(let[i,r]of Object.entries(t)){let s=typeof r=="object"&&r!==null?JSON.stringify(r):String(r);console.log(`${Q.bold(i)}: ${s}`)}}};function Aa(o){let e=o.command("config").description("Manage CLI configuration settings");e.command("get <key>").description("Get a configuration value").action(t=>{let i=new H({format:P.resolved.format});_.debug(`[config:get] Retrieving configuration key '${t}'...`);let r=P.resolved;if(t in r){let s=r[t];_.debug(`[config:get] Key found. Value: ${t==="token"?"**********":s}`),P.resolved.format==="json"?i.object({[t]:s}):console.log(s)}else _.debug(`[config:get] Configuration key '${t}' not found.`),i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Configuration key '${t}' not found.`,detail:`Run \`apinow config set ${t} <value>\` to define it.`}),process.exit(1)}),e.command("set <key> <value>").description("Set a configuration value").action((t,i)=>{let r=new H({format:P.resolved.format});_.debug(`[config:set] Setting configuration key '${t}' to '${t==="token"?"**********":i}'...`);let s=["apiUrl","token","org"];s.includes(t)||(_.debug(`[config:set] Invalid configuration key '${t}' rejected.`),r.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Invalid configuration key '${t}'.`,detail:`Allowed keys: ${s.join(", ")}`}),process.exit(1)),P.writeProperty(t,i),_.debug("[config:set] Configuration property written successfully."),r.success(`Configuration '${t}' set to '${i}'.`)}),e.command("reset").description("Reset all configuration settings and remove stored files").action(()=>{let t=new H({format:P.resolved.format});_.debug("[config:reset] Resetting CLI configuration..."),P.reset(),_.debug("[config:reset] Configuration reset completed successfully."),t.success("Configuration has been reset successfully.")})}import{Argument as Xo}from"commander";import Yo from"node:http";import Zo from"open";import xa from"http";import Na from"https";function ki(o){return typeof o!="string"&&(o=String(o)),o.toLowerCase()}function Ea(o){return typeof o!="string"&&(o=String(o)),o}function*Ko(o){if(!o||o.trim()==="")return[];let e=o.split(/\n(?=[^ \t]+)/gim);for(let t=0,i=e.length;t<i;t++){let r=e[t].trim();if(r==="")continue;let s=r.startsWith("#");s&&(r=r.replace("#","").trim());let a=r.indexOf(":");if(a===-1)yield{name:r,value:"",enabled:!s};else{let n=r.substring(0,a),l=r.substring(a+1).trim();yield{name:n,value:l,enabled:!s}}}}var wi=class o{_map={};constructor(e){if(e instanceof o)e.forEach((t,i)=>this.append(i,t));else if(typeof e=="string")for(let t of Ko(e))this.append(t.name,t.value,t.enabled);else e&&Object.keys(e).forEach(t=>this.append(t,e[t]))}append(e,t,i=!0){if(Array.isArray(t)){t.forEach(a=>this.append(e,a));return}let r=ki(e);t=t?Ea(t):"";let s=this._map[r];if(s){let a=s.value;s.value=a?`${a},${t}`:t}else s={name:e,value:t,enabled:i};this._map[r]=s}delete(e){delete this._map[ki(e)]}get(e){if(e=ki(e),!!this.has(e)&&this._map[e].enabled)return this._map[e].value}has(e){let t=ki(e);return Object.prototype.hasOwnProperty.call(this._map,t)&&this._map[t].enabled}set(e,t,i=!0){let r=ki(e);this._map[r]={value:Ea(t),name:e,enabled:i}}forEach(e,t){Object.keys(this._map).forEach(r=>{let s=this._map[r];e.call(t,s.value,s.name,s.enabled,this)})}map(e,t){let i=Object.keys(this._map),r=[];for(let s of i){let a=this._map[s],n=e.call(t,a.value,a.name,a.enabled);r.push(n)}return r}toString(){return this._generateString()}toRawString(){return this._generateString(!0)}toJSON(){let e={};for(let[t,i]of this.entries())e[t]=i;return e}_generateString(e=!1){let t=[],i=Object.keys(this._map);for(let r of i){let s=this._map[r],a="";if(!s.enabled)if(e)a+="# ";else continue;a+=`${s.name}: `,s.value&&(a+=s.value),t.push(a)}return t.join(`
|
|
16
|
+
`)}*keys(){let e=Object.keys(this._map);for(let t of e)this._map[t].enabled&&(yield this._map[t].name)}*values(){let e=Object.keys(this._map);for(let t of e)this._map[t].enabled&&(yield this._map[t].value)}*entries(){let e=Object.keys(this._map);for(let t of e)this._map[t].enabled&&(yield[this._map[t].name,this._map[t].value])}*[Symbol.iterator](){let e=Object.keys(this._map);for(let t of e)this._map[t].enabled&&(yield[this._map[t].name,this._map[t].value])}};function gs(o,e){let t=o.toLowerCase();return t==="authorization"||t==="proxy-authorization"?e.toLowerCase().startsWith("bearer ")?"Bearer **********":"**********":t==="cookie"||t==="set-cookie"||t==="x-api-key"||t==="api-key"?"**********":e}function fs(o){if(o==null)return o;if(Array.isArray(o))return o.map(e=>fs(e));if(typeof o=="object"){let e={};for(let[t,i]of Object.entries(o)){let r=t.toLowerCase();r.includes("token")||r.includes("password")||r.includes("secret")||r.includes("key")?e[t]="**********":e[t]=fs(i)}return e}return o}function ys(o){if(!o)return o;try{let e=JSON.parse(o),t=fs(e);return JSON.stringify(t,null,2)}catch{return o}}var g=class extends Error{name;status;static fromRawException(e,t){let i=e,r={};if(i.code!==void 0&&(r.code=String(i.code)),i.status!==void 0){let n=Number(i.status);isNaN(n)||(r.status=n)}i.help!==void 0&&(r.help=String(i.help));let s=i.message!==void 0?String(i.message):t,a=new this(s,r);return i.name!==void 0&&(a.name=String(i.name)),a}constructor(e,t){super(e,t);let i=this.constructor;this.name=i.name,this.message=e??i.message??"",this.status=t?.status??i.status??500;let r=t?.code??i.code;r!==void 0&&(this.code=r);let s=t?.help??i.help;s!==void 0&&(this.help=s),Error.captureStackTrace(this,i)}setHelp(e){return this.help=e,this}setCode(e){return this.code=e,this}setStatus(e){return this.status=e,this}get[Symbol.toStringTag](){return this.constructor.name}toString(){return this.code?`${this.name} [${this.code}]: ${this.message}`:`${this.name}: ${this.message}`}toJSON(){let e={name:this.name,message:this.message};return this.status&&(e.status=this.status),this.code&&(e.code=this.code),this.help&&(e.help=this.help),e}};var V="Invalid JSON response.",U="The response has no value.",x="Invalid response status: ",F="Unknown response from the server.";var te=class{sdk;constructor(e){this.sdk=e}logInvalidResponse(e){if(!this.sdk.silent&&e.body)try{let t=JSON.parse(e.body);t.message&&console.warn(`[Store message]: ${t.message}`)}catch{}}inspectCommonStatusCodes(e){let{status:t,body:i}=e;if(t===404){let r=this.createApiError("Not found",i);throw r.status!==404&&r.setStatus(404),r.code!=="E_NOT_FOUND"&&r.setCode("E_NOT_FOUND"),r}if(t===403){let r=this.createApiError("You have no access to this resource",i);throw r.status!==403&&r.setStatus(403),r.code!=="E_FORBIDDEN"&&r.setCode("E_FORBIDDEN"),r}if(t===401){this.sdk.dispatchEvent(new Event("unauthorized"));let r=this.createApiError("Not authorized",i);throw r.status!==401&&r.setStatus(401),r.code!=="E_UNAUTHORIZED"&&r.setCode("E_UNAUTHORIZED"),r}}createApiError(e,t){if(!t)return new g(e);let i;try{i=JSON.parse(t)}catch{return new g(e)}return!i||typeof i!="object"||!i.message?new g(e):g.fromRawException(i,e)}async genericBatchDelete(e,t,i={}){let{token:r}=i,s=await this.sdk.http.post(e.toString(),{token:r,body:JSON.stringify(t)});this.inspectCommonStatusCodes(s);let a="Unable to delete in batch. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${x}${s.status}`,s.body);if(!s.body)throw new g(`${a}${U}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body)}catch{throw new g(`${a}${V}`,{code:"E_INVALID_JSON",status:s.status})}if(!Array.isArray(n.data))throw new g(`${a}${F}`,{code:"E_RESPONSE_UNKNOWN",status:s.status});return n}async genericDelete(e,t={}){let{token:i}=t,r=await this.sdk.http.delete(e.toString(),{token:i});this.inspectCommonStatusCodes(r);let s="Unable to delete the object. ";if(r.status!==204)throw this.logInvalidResponse(r),this.createApiError(`${s}${x}${r.status}`,r.body)}async genericList(e,t,i={}){let{token:r}=i;this.sdk.appendListOptions(e,t);let s=await this.sdk.http.get(e.toString(),{token:r});this.inspectCommonStatusCodes(s);let a="Unable to list revisions for a file. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${x}${s.status}`,s.body);if(!s.body)throw new g(`${a}${U}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body)}catch{throw new g(`${a}${V}`,{code:"E_INVALID_JSON",status:s.status})}if(!Array.isArray(n.data))throw new g(`${a}${F}`,{code:"E_RESPONSE_UNKNOWN",status:s.status});return n}readResponseBody(e,t){if(![200,202].includes(e.status))throw this.logInvalidResponse(e),this.createApiError(`${t}${x}${e.status}`,e.body);if(!e.body)throw new g(`${t}${U}`,{code:"E_RESPONSE_NO_VALUE",status:e.status});return e.body}readResponseJSON(e,t){let i=this.readResponseBody(e,t),r;try{r=JSON.parse(i)}catch{throw new g(`${t}${V}`,{code:"E_INVALID_JSON",status:e.status})}return r}processListResponse(e,t){this.inspectCommonStatusCodes(e);let i=this.readResponseJSON(e,t);if(!Array.isArray(i.data))throw new g(`${t}${F}`,{code:"E_RESPONSE_UNKNOWN",status:e.status});return i}assertObjectKind(e,t,i){if(t!==i)throw new g(`${e}${F}`,{code:"E_RESPONSE_UNKNOWN",status:500})}};var Vt=class extends Error{status;response;constructor(e,t){super(`HTTP Error: ${e}`),this.status=e,this.response=t}},Xi=class extends te{logRequest(e,t,i){if(!this.sdk.logger)return;let r=i?.headers||{},s={};for(let[c,p]of Object.entries(r))s[c]=gs(c,p);(i?.token||this.sdk.token)&&!s.authorization&&!s.Authorization&&(s.Authorization="Bearer **********");let n=i?.body,l=ys(n);this.sdk.logger.log("debug",`--> HTTP ${e} ${t}`),Object.keys(s).length>0&&this.sdk.logger.log("debug",`Headers: ${JSON.stringify(s,null,2)}`),l&&this.sdk.logger.log("debug",`Body: ${l}`)}logResponse(e,t,i){if(!this.sdk.logger)return;let r=i.headers?i.headers.toJSON():{},s={};for(let[n,l]of Object.entries(r))s[n]=gs(n,l);let a=ys(i.body);this.sdk.logger.log("debug",`<-- HTTP ${i.status} ${e} ${t}`),Object.keys(s).length>0&&this.sdk.logger.log("debug",`Headers: ${JSON.stringify(s,null,2)}`),a&&this.sdk.logger.log("debug",`Body: ${a}`)}logError(e,t,i){if(!this.sdk.logger)return;let r=i instanceof Error?i.message:String(i);this.sdk.logger.log("debug",`<-- HTTP ${e} ${t} Failed: ${r}`)}};function Fo(o,e=1e3){return globalThis.__MOCK_RETRY_DELAY_MS__!==void 0?globalThis.__MOCK_RETRY_DELAY_MS__:o<=0?e:e*Math.pow(2,o-1)}function Jo(o){let{status:e}=o;return!(typeof e=="number"&&e>=400&&e<500)}async function bs(o,e={}){let{retries:t=3,delayMs:i=Fo,shouldRetry:r=Jo}=e,s;for(let n=0;n<t;n++)try{return await o()}catch(l){if(s=l,!r(s)||n===t-1)throw s;let c=typeof i=="function"?i(n+1):i;c>0&&await new Promise(p=>setTimeout(p,c))}throw s||new Error("Retry operation failed without a specific error.")}var Yi=class extends Xi{async get(e,t={}){let i=async()=>{this.logRequest("GET",e,t);try{let r=await this._get(e,t);if(this.logResponse("GET",e,r),[301,302,308,307].includes(r.status)){let s=r.headers.get("location");if(!s)throw new Error('Expected redirection but no "location" header.');let a=new URL(s,e);return this.get(a.toString(),t)}if(t.retry&&r.status>=400)throw new Vt(r.status,r);return r}catch(r){throw this.logError("GET",e,r),r}};if(t.retry)try{let r=typeof t.retry=="object"?t.retry:{};return await bs(i,r)}catch(r){if(r instanceof Vt)return r.response;throw r}return i()}_get(e,t={}){return new Promise((i,r)=>{let{method:s="GET",headers:a={},token:n=this.sdk.token}=t,l={...a};n&&(l.authorization=`Bearer ${n}`);let u=(e.startsWith("https:")?Na:xa).request(e,{method:s,headers:l,rejectUnauthorized:!1});u.on("response",h=>{let m={status:h.statusCode,headers:new wi(h.headers),body:""};h.on("data",f=>{m.body+=f}),h.on("end",()=>i(m))}),u.on("error",h=>r(h)),u.end()})}async post(e,t={}){let i=t.method||"POST",r=async()=>{this.logRequest(i,e,t);let s=await new Promise((a,n)=>{let{headers:l={},token:c=this.sdk.token}=t,p={...l};c&&(p.authorization=`Bearer ${c}`),t.body&&!p["content-type"]&&!p["Content-Type"]&&(p["content-type"]="application/json");let m=(e.startsWith("https:")?Na:xa).request(e,{method:i,headers:p});m.on("response",f=>{let b={status:f.statusCode,headers:new wi(f.headers),body:""};f.on("data",k=>{b.body+=k}),f.on("end",()=>{this.logResponse(i,e,b),a(b)})}),m.on("error",f=>{this.logError(i,e,f),n(f)}),t.body&&m.write(t.body),m.end()});if(t.retry&&s.status>=400)throw new Vt(s.status,s);return s};if(t.retry)try{let s=typeof t.retry=="object"?t.retry:{};return await bs(r,s)}catch(s){if(s instanceof Vt)return s.response;throw s}return r()}patch(e,t={}){let i={...t,method:"PATCH"};return this.post(e,i)}put(e,t={}){let i={...t,method:"PUT"};return this.post(e,i)}delete(e,t={}){let i={...t,method:"DELETE"};return this.post(e,i)}};var A=class o{static folders(e){return`/v1/orgs/${e}/folders`}static files(e){return`/v1/orgs/${e}/files`}static filesSearch(e){return`${o.files(e)}/search`}static filesAccess(e,t){return`${o.file(e,t)}/access`}static filesBatch(e){return`${o.files(e)}/batch/read-meta`}static file(e,t){return`${o.files(e)}/${t}`}static fileMedia(e,t){return`${o.file(e,t)}/media`}static fileUsers(e,t){return`${o.file(e,t)}/users`}static fileRevisions(e,t){return`${o.file(e,t)}/revisions`}static fileBreadcrumbs(e,t){return`${o.file(e,t)}/breadcrumbs`}static fileRename(e,t){return`${o.file(e,t)}/rename`}static history(){return"/history"}static historyBatchCreate(){return"/history/batch/create"}static historyBatchDelete(){return"/history/batch/delete"}static historyItem(e){return`/history/${e}`}static historyClear(e,...t){return`/history/clear/${e}/${t.join("/")}`}static shared(e){return`/v1/orgs/${e}/shared`}static trash(e){return`/v1/orgs/${e}/trash`}static trashItem(e,t){return`${o.trash(e)}/${t}`}static trashRestore(e,t){return`${o.trashItem(e,t)}/restore`}static trashEmpty(e){return`${o.trash(e)}/empty`}static trashBatchRestore(e){return`${o.trash(e)}/restore`}static trashBatchDelete(e){return`${o.trash(e)}/delete`}static projectExecutions(){return"/project/execution"}static projectExecution(e){return`/project/execution/${e}`}static projectExecutionBulkDelete(){return"/project/execution/delete"}static projectExecutionClear(e){return`/project/execution/clear/${e}`}static organizations(){return"/v1/orgs"}static organization(e){return`/v1/orgs/${e}`}static organizationUsers(e){return`${this.organization(e)}/users`}static organizationUserBatch(e){return`${this.organization(e)}/users/batch/read`}static organizationUser(e,t){return`${this.organization(e)}/users/${t}`}static organizationUserDeactivate(e,t){return`${this.organization(e)}/users/${t}/deactivate`}static organizationUserActivate(e,t){return`${this.organization(e)}/users/${t}/activate`}static invitations(e){return`${this.organization(e)}/invitations`}static invitation(e,t){return`${this.invitations(e)}/${t}`}static findInvitation(){return`${this.organizations()}/find-invitation`}static declineInvitation(e,t){return`${this.invitation(e,t)}/decline`}static resendInvitation(e,t){return`${this.invitation(e,t)}/resend`}static authGoogle(){return"/auth/google"}static authLogout(){return"/auth/logout"}static usersMe(){return"/v1/users/me"}static usersMeTokens(){return`${o.usersMe()}/tokens`}static usersMeToken(e){return`${o.usersMeTokens()}/${e}`}static dataCatalog(){return"/v1/datacatalog"}static dataCatalogStatus(e){return`${o.dataCatalog()}/status/${e}`}static dataCatalogEntry(e){return`${o.dataCatalog()}/${e}`}static dataCatalogEntryVersions(e){return`${o.dataCatalogEntry(e)}/versions`}static dataCatalogDependencies(){return`${o.dataCatalog()}/dependencies`}static dataCatalogUpdates(){return`${o.dataCatalog()}/updates`}static dataCatalogVersion(e,t){return`${o.dataCatalogEntry(e)}/${t}`}static dataCatalogDeprecate(e){return`${o.dataCatalogEntry(e)}/deprecate`}static dataCatalogUnpublish(e){return`${o.dataCatalogEntry(e)}/unpublish`}static dataCatalogVersionDeprecate(e,t){return`${o.dataCatalogVersion(e,t)}/deprecate`}static dataCatalogVersionUnpublish(e,t){return`${o.dataCatalogVersion(e,t)}/unpublish`}static dataCatalogUsage(e){return`${o.dataCatalogEntry(e)}/apis`}static dataCatalogVersionUsage(e,t){return`${o.dataCatalogVersion(e,t)}/apis`}static groups(e){return`/v1/orgs/${e}/groups`}static group(e,t){return`/v1/orgs/${e}/groups/${t}`}static groupUsers(e,t){return`/v1/orgs/${e}/groups/${t}/users`}static aiModifyDomain(e,t){return`${this.organization(e)}/ai/domains/${t}/modify/stream`}static aiModifyApi(e,t){return`${this.organization(e)}/ai/apis/${t}/modify/stream`}static aiSessions(e,t){return`${this.organization(e)}/ai/sessions/${t}`}static aiSession(e,t,i){return`${o.aiSessions(e,t)}/${i}`}static aiMessages(e,t){return`${this.organization(e)}/ai/messages/${t}`}static aiMessage(e,t,i){return`${o.aiMessages(e,t)}/${i}`}static orgSlugGenerate(){return"/v1/orgs/slugs/generate"}static orgSlugValidate(){return"/v1/orgs/slugs/validate"}static deployments(e){return`/v1/orgs/${e}/deployments`}static deploymentsApis(e){return`${o.deployments(e)}/apis`}static deployment(e,t){return`${o.deployments(e)}/${t}`}static deploymentsForApi(e,t){return`${o.deploymentsApis(e)}/${t}`}static deploymentsApisByEnvLatest(e,t){return`${o.deploymentsApis(e)}/${t}/environments/latest`}static rollback(e,t){return`${o.deployment(e,t)}/rollback`}static deploymentsApiRuntimeUsersUpdate(e,t){return`${o.deploymentsApis(e)}/${t}/runtime/users/update`}static job(e,t){return`/v1/orgs/${e}/jobs/${t}`}};var Zi=class extends te{oauthRedirect(e,t={}){let{redirect:i,token:r,type:s="redirect"}=t,a=new URL(this.sdk.baseUri);if(!["google","github","linkedin"].includes(e))throw new Error(`Invalid provider: ${e}`);let n=new URL(`/auth/${e}/redirect`,a);return i&&n.searchParams.set("r",i),r&&n.searchParams.set("token",r),s==="redirect"?(window.location.href=n.toString(),null):window.open(n.toString(),"_blank")}async logout(e={}){let{token:t,retry:i=!0}=e,r=this.sdk.getUrl(A.authLogout()),s=await this.sdk.http.post(r.toString(),{token:t,retry:i});this.inspectCommonStatusCodes(s);let a="Unable to log out. ";if(s.status!==204)throw this.logInvalidResponse(s),this.createApiError(`${a}${x}${s.status}`,s.body)}};import{customAlphabet as qo}from"nanoid";var q=qo("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_",21);var Qe="Core#Permission",Ze=["reader","commenter","writer","owner"],St=class o{kind=Qe;key="";type="user";granteeId="";role="reader";displayName;expirationTime;addingUser="";itemId="";depth=0;sourceRule="direct_user_grant";static fromUserRole(e,t,i,r){let s={key:q(),kind:Qe,itemId:t,granteeId:i,role:e,type:"user",addingUser:r,depth:0,sourceRule:"direct_user_grant"};return new o(s)}static fromGroupRole(e,t,i,r){let s={key:q(),kind:Qe,itemId:t,granteeId:i,role:e,type:"group",addingUser:r,depth:0,sourceRule:"direct_user_grant"};return new o(s)}static fromOrganizationRole(e,t,i,r){let s={key:q(),kind:Qe,itemId:t,granteeId:i,role:e,type:"organization",addingUser:r,depth:0,sourceRule:"direct_user_grant"};return new o(s)}static fromValues(e){return new o({...e,key:q(),kind:Qe})}constructor(e){let t;typeof e=="string"?t=JSON.parse(e):typeof e=="object"?t=e:t={kind:Qe,key:q(),granteeId:"",itemId:"",role:"reader",type:"user",addingUser:"",depth:0,sourceRule:"direct_user_grant"},this.new(t)}new(e){if(!o.isPermission(e))throw new Error("Not a permission.");let{key:t=q(),granteeId:i,role:r,type:s,displayName:a,expirationTime:n,addingUser:l,itemId:c,depth:p,sourceRule:u}=e;this.kind=Qe,this.key=t,this.granteeId=i,this.itemId=c,this.role=r,this.type=s,this.addingUser=l,this.depth=p||0,this.sourceRule=u||"direct_user_grant",a?this.displayName=a:this.displayName=void 0,typeof n=="number"?this.expirationTime=n:this.expirationTime=void 0}static isPermission(e){return!(!e||e.kind!==Qe)}static hasRole(e,t){if(!t)return!1;let i=Ze.indexOf(t),r=Ze.indexOf(e);return i>=r}static isHigherRole(e,t){let i=Ze.indexOf(e),r=Ze.indexOf(t);return i>r}hasRole(e){return o.hasRole(e,this.role)}static hasRoleIn(e,t){if(!t||!t.length)return!1;let i=[...t].sort((l,c)=>l.depth-c.depth),r=i[0].depth,s=i.filter(l=>l.depth===r),a,n=s.filter(l=>l.type==="user");if(n.length)a=n.sort((l,c)=>Ze.indexOf(c.role)-Ze.indexOf(l.role))[0];else{let l=s.filter(c=>c.type==="group");if(l.length)a=l.sort((c,p)=>Ze.indexOf(p.role)-Ze.indexOf(c.role))[0];else{let c=s.filter(p=>p.type==="organization");c.length&&(a=c.sort((p,u)=>Ze.indexOf(u.role)-Ze.indexOf(p.role))[0])}}return a?o.hasRole(e,a.role):!1}toJSON(){let e={kind:Qe,key:this.key,role:this.role,type:this.type,addingUser:this.addingUser,granteeId:this.granteeId,itemId:this.itemId,depth:this.depth,sourceRule:this.sourceRule};return this.displayName&&(e.displayName=this.displayName),this.expirationTime&&(e.expirationTime=this.expirationTime),e}};var At="Core#Thing",De="Core#Folder";var vi="Core#User",Et="Data#DomainFile",ze="Data#Domain",ke="Domain#Namespace",ye="Domain#Model",N="Domain#Entity",ae="Domain#Association",ne="Domain#Property",mt="Core#DataCatalog",ft="Core#DataCatalogVersion";var Qt="Core#Deployment",$e="Core#ApiModel",xt="Core#ExposedEntity",$a="Core#ApiFile";var _i="Core#AiSession",ks="Core#AiMessage",ws="Core#Job";var ie=class o{kind=At;name;displayName;description;version;static fromName(e){return new o({name:e,kind:At})}static fromJSON(e={},t={}){let i=new o,{name:r,displayName:s,description:a,version:n}=e||{};return typeof r=="string"?i.name=r:typeof t.name=="string"&&(i.name=t.name),typeof s=="string"?i.displayName=s:typeof t.displayName=="string"&&(i.displayName=t.displayName),a?i.description=a:typeof t.description=="string"&&(i.description=t.description),n?i.version=n:typeof t.version=="string"&&(i.version=t.version),i}constructor(e){let t;typeof e=="string"?t=JSON.parse(e):typeof e=="object"?t=e:t={kind:At},this.new(t)}new(e){if(!o.isThing(e))throw new Error("Not a thing.");let{description:t,name:i,version:r,displayName:s}=e;this.kind=At,this.name=i,this.displayName=s,this.description=t,this.version=r}static validate(e,t={}){let{strict:i}=t;return e&&typeof e=="object"?!(i&&e.kind!==At):!1}static isThing(e){return!!(e&&e.kind===At)}toJSON(){let e={kind:At};return typeof this.name=="string"&&(e.name=this.name),typeof this.displayName=="string"&&(e.displayName=this.displayName),this.description&&(e.description=this.description),this.version&&(e.version=this.version),e}getLabel(e){return this.displayName||this.name||e||"Unnamed object"}};var vs=Symbol("parents"),Qi=Symbol("deleted"),er=Symbol("deletedInfo"),tr=Symbol("lastModified"),_s=Symbol("capabilities"),Ss=Symbol("permissions"),As=Symbol("permissionIds"),Es=Symbol("shortcutTarget"),Si=class{kind="";key="";info=ie.fromName("");iconColor;get isShortcut(){return!!this.shortcutTarget}[Es];get shortcutTarget(){return this[Es]}set shortcutTarget(e){this[Es]=e}static createSchema(e={}){let{key:t=q(),kind:i,iconColor:r,shortcutTarget:s}=e,a={key:t,kind:i||"",info:ie.fromJSON(e.info,{name:"Unnamed file"}).toJSON()};return r&&(a.iconColor=r),s&&(a.isShortcut=!0,a.shortcutTarget=s),a}constructor(e){this.kind=e.kind,this.key=e.key,this.info=new ie(e.info),e.iconColor&&(this.iconColor=e.iconColor),e.shortcutTarget&&(this.shortcutTarget=e.shortcutTarget)}toJSON(){let e={key:this.key,kind:this.kind,info:this.info.toJSON()};return this.iconColor&&(e.iconColor=this.iconColor),this.shortcutTarget&&(e.isShortcut=!0,e.shortcutTarget=this.shortcutTarget),e}static createFileCapabilities(e,t){let i=St.hasRole("commenter",t),r=St.hasRole("owner",t),s=St.hasRole("reader",t),a=St.hasRole("writer",t),n=e.kind===De;return{canReadMedia:!n&&s,canListChildren:n&&s,canComment:!n&&i,canEditMedia:!n&&a,canEditMeta:a,canReadRevisions:a,canAddChildren:n&&a,canDelete:r,canTrash:r,canUntrash:r,canShare:a,canMove:a}}createFileCapabilities(e){return gt.createFileCapabilities(this,e)}static updateByMeMeta(e,t){e.deletedInfo&&(e.deletedInfo.byMe=e.deletedInfo.user===t),e.lastModified&&(e.lastModified.byMe=e.lastModified.user===t)}static setLastModified(e,t){if(!e)throw new Error("The file is required.");if(!t)throw new Error("The user is required.");if(t.kind!==vi)throw new Error('Invalid value for the user when setting "lastModified".');return e.lastModified={byMe:!1,time:Date.now(),user:t.key,name:t.name},e}static setDeleted(e,t){if(!e)throw new Error("The file is required.");if(!t)throw new Error("The user is required.");if(t.kind!==vi)throw new Error('Invalid value for the user when setting "deletedInfo".');return e.deleted=!0,e.deletedInfo={byMe:!1,time:Date.now(),user:t.key,name:t.name},e}},gt=class o extends Si{[vs]=[];get parents(){return this[vs]}[As]=[];get permissionIds(){return this[As]}[Qi];get deleted(){return this[Qi]||!1}[er];get deletedInfo(){return this[er]}[tr]={user:"",time:0,byMe:!1};get lastModified(){return this[tr]}labels;[_s];get capabilities(){return this[_s]}[Ss]=[];get permissions(){return this[Ss]}static createSchema(e={}){let t=Si.createSchema(e);return Array.isArray(e.parents)?t.parents=[...e.parents]:t.parents=[],Array.isArray(e.permissionIds)?t.permissionIds=[...e.permissionIds]:t.permissionIds=[],Array.isArray(e.permissions)?t.permissions=e.permissions.map(i=>({...i})):t.permissions=[],e.capabilities&&(t.capabilities={...e.capabilities}),e.lastModified?t.lastModified={...e.lastModified}:t.lastModified={user:"",time:0,byMe:!1},typeof e.deleted=="boolean"&&(t.deleted=e.deleted,t.deletedInfo=e.deletedInfo?{...e.deletedInfo}:void 0),Array.isArray(e.labels)&&(t.labels=[...e.labels]),typeof e.shortcutTarget=="string"&&(t.shortcutTarget=e.shortcutTarget),t}constructor(e){let t=o.createSchema(e);super(t),this[vs]=[...t.parents],this[As]=[...t.permissionIds],this[Ss]=t.permissions.map(i=>({...i})),this[_s]=t.capabilities?{...t.capabilities}:void 0,this[tr]=Object.freeze({...t.lastModified}),typeof t.deleted=="boolean"&&(this[Qi]=t.deleted,this[er]=t.deletedInfo?Object.freeze({...t.deletedInfo}):void 0),Array.isArray(t.labels)&&(this.labels=[...t.labels])}toJSON(){let e={...super.toJSON(),parents:[...this.parents],permissionIds:[...this.permissionIds],lastModified:{...this.lastModified},permissions:[...this.permissions]};return this.deleted&&(e.deleted=this.deleted,e.deletedInfo={...this.deletedInfo}),Array.isArray(this.labels)&&(e.labels=[...this.labels]),e}static fromName(e,t){return new o({kind:t,info:{name:e}})}shortcutTo(e){return this.shortcutTarget=e,this}setLastModified(e){if(!e)throw new Error("The user is required.");if(e.kind!==vi)throw new Error('Invalid value for the user when setting "lastModified".');this[tr]={byMe:!1,time:Date.now(),user:e.key,name:e.name}}addLabel(e){if(typeof e!="string")throw new Error("The label must be a string.");if(!e.trim())throw new Error("The label is required.");Array.isArray(this.labels)||(this.labels=[]),!this.labels.includes(e)&&this.labels.push(e)}setDeleted(e){if(!e)throw new Error("The user is required.");if(e.kind!==vi)throw new Error('Invalid value for the user when setting "deletedInfo".');this[Qi]=!0,this[er]={byMe:!1,time:Date.now(),user:e.key,name:e.name}}isFile(){return this.kind!==De}isFolder(){return this.kind===De}};var Ai=class extends gt{kind=De;static fromName(e){return super.fromName(e,De)}constructor(e){let t=gt.createSchema(e);t.kind=De,super(t)}static isFolder(e){return!(!e||e.kind!==De)}toJSON(){return{...super.toJSON(),kind:De}}};var ir=class extends te{async list(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a={...t},n=this.sdk.getUrl(A.files(e));this.sdk.appendListOptions(n,a);let l=await this.sdk.http.get(n.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(l);let c="Unable to list files. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}async search(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.filesSearch(e)),{searchParams:n}=a;if(t.cursor&&n.set("cursor",t.cursor),typeof t.limit=="number"&&n.set("limit",String(t.limit)),t.parent&&n.set("parent",t.parent),t.kind)for(let c of t.kind)n.append("kind",c);if(t.query)for(let c of t.query)n.append("query",c);let l=await this.sdk.http.get(a.toString(),{token:r,retry:s});return this.processListResponse(l,"Unable to search files. ")}async create(e,t,i,r={},s={}){let a=await this.createMeta(e,i,r,s);return await this.createMedia(t,i,a.key,r,s),a}async createMeta(e,t,i={},r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.files(t));i.parent&&n.searchParams.set("parent",i.parent);let l=JSON.stringify(e),c=await this.sdk.http.post(n.toString(),{token:s,body:l,retry:a,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(c);let p="Unable to create a file. ";if(c.status!==201)throw this.logInvalidResponse(c),this.createApiError(`${p}${x}${c.status}`,c.body);if(!c.body)throw new g(`${p}${U}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${V}`,{code:"E_INVALID_JSON",status:c.status})}if(!u.key)throw new g(`${p}${F}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}async createMedia(e,t,i,r={},s={}){let{token:a=this.sdk.token,retry:n=!0}=s,l=A.fileMedia(t,i),c=this.sdk.getUrl(l),p=r.mime||"application/json",u;p.includes("json")?u=JSON.stringify(e):u=String(e);let h=await this.sdk.http.put(c.toString(),{token:a,body:u,retry:n,headers:{"content-type":p}});this.inspectCommonStatusCodes(h);let m="Unable to create a file. ";if(h.status!==200)throw this.logInvalidResponse(h),this.createApiError(`${m}${x}${h.status}`,h.body)}async createFolder(e,t,i={},r={}){let s=Ai.fromName(e),{token:a=this.sdk.token,retry:n=!0}=r,l=this.sdk.getUrl(A.files(t));i.parent&&l.searchParams.set("parent",i.parent);let c=JSON.stringify(s),p=await this.sdk.http.post(l.toString(),{token:a,body:c,retry:n,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(p);let u="Unable to create a file. ";if(p.status!==201)throw this.logInvalidResponse(p),this.createApiError(`${u}${x}${p.status}`,p.body);if(!p.body)throw new g(`${u}${U}`,{code:"E_RESPONSE_NO_VALUE",status:p.status});let h;try{h=JSON.parse(p.body).data}catch{throw new g(`${u}${V}`,{code:"E_INVALID_JSON",status:p.status})}if(!h.key)throw new g(`${u}${F}`,{code:"E_RESPONSE_UNKNOWN",status:p.status});return h}async read(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.file(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read a file. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.kind)throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}async readMedia(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.fileMedia(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read a file media. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!c||typeof c!="object"||!("data"in c)||!("meta"in c))throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});let{data:p,meta:u}=c;if(!u||typeof u!="object"||typeof u.version!="number"||typeof u.updated!="number"||isNaN(u.version)||isNaN(u.updated))throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return{media:p,meta:u}}async readBulk(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.filesBatch(e)),n=JSON.stringify({ids:t}),l=await this.sdk.http.post(a.toString(),{token:r,body:n,retry:s});this.inspectCommonStatusCodes(l);let c="Unable to read files in bulk. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}async patch(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=A.file(e,t),l=this.sdk.getUrl(n),c=JSON.stringify(i),p=await this.sdk.http.patch(l.toString(),{token:s,body:c,retry:a});this.inspectCommonStatusCodes(p);let u="Unable to patch a file. ";if(p.status!==200)throw this.logInvalidResponse(p),this.createApiError(`${u}${x}${p.status}`,p.body);if(!p.body)throw new g(`${u}${U}`,{code:"E_RESPONSE_NO_VALUE",status:p.status});let h;try{h=JSON.parse(p.body).data}catch{throw new g(`${u}${V}`,{code:"E_INVALID_JSON",status:p.status})}if(!h.kind)throw new g(`${u}${F}`,{code:"E_RESPONSE_UNKNOWN",status:p.status});return h}async patchMedia(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=A.fileMedia(e,t),l=this.sdk.getUrl(n),c=JSON.stringify(i),p=await this.sdk.http.patch(l.toString(),{token:s,body:c,retry:a});this.inspectCommonStatusCodes(p);let u="Unable to patch a file contents. ";if(p.status!==200)throw this.logInvalidResponse(p),this.createApiError(`${u}${x}${p.status}`,p.body);if(!p.body)throw new g(`${u}${U}`,{code:"E_RESPONSE_NO_VALUE",status:p.status});let h;try{h=JSON.parse(p.body).data}catch{throw new g(`${u}${V}`,{code:"E_INVALID_JSON",status:p.status})}return h}async delete(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.file(e,t)),n=await this.sdk.http.delete(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to trash a file. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body)}async deleteBulk(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.files(e)),n=await this.sdk.http.delete(a.toString(),{token:r,body:JSON.stringify({ids:t}),retry:s});this.inspectCommonStatusCodes(n);let l="Unable to trash files. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body)}async patchUsers(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.filesAccess(e,t)),l=JSON.stringify(i),c=await this.sdk.http.patch(n.toString(),{token:s,body:l,retry:a});this.inspectCommonStatusCodes(c);let p="Unable to patch the file. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${x}${c.status}`,c.body);if(!c.body)throw new g(`${p}${U}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${V}`,{code:"E_INVALID_JSON",status:c.status})}if(!u.key)throw new g(`${p}${F}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}async addUser(e,t,i,r,s,a){let n={op:"add",type:"user",value:r,id:i};typeof s=="number"&&(n.expirationTime=s);let l={patch:[n],id:q()};return this.patchUsers(e,t,l,a)}async removeUser(e,t,i,r){let a={patch:[{op:"remove",type:"user",id:i}],id:q()};return this.patchUsers(e,t,a,r)}async listUsers(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.fileUsers(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to list users in the file. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}async breadcrumbs(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.fileBreadcrumbs(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read breadcrumbs. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}async rename(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.fileRename(e,t)),l=await this.sdk.http.put(n.toString(),{token:s,body:JSON.stringify({name:i}),retry:a});this.inspectCommonStatusCodes(l);let c="Unable to rename file. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}return p}};var rr=class extends te{async me(e={}){let{token:t=this.sdk.token,retry:i=!0}=e,r=this.sdk.getUrl(A.usersMe()),s=await this.sdk.http.get(r.toString(),{token:t,retry:i});this.inspectCommonStatusCodes(s);let a="Unable to read a user. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${x}${s.status}`,s.body);if(!s.body)throw new g(`${a}${U}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body).data}catch{throw new g(`${a}${V}`,{code:"E_INVALID_JSON",status:s.status})}if(!n.key)throw new g(`${a}${F}`,{code:"E_RESPONSE_UNKNOWN",status:s.status});return n}async listTokens(e={}){let{token:t=this.sdk.token,retry:i=!0}=e,r=this.sdk.getUrl(A.usersMeTokens()),s=await this.sdk.http.get(r.toString(),{token:t,retry:i});this.inspectCommonStatusCodes(s);let a="Unable to list tokens. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${x}${s.status}`,s.body);if(!s.body)throw new g(`${a}${U}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body).data}catch{throw new g(`${a}${V}`,{code:"E_INVALID_JSON",status:s.status})}return n}async createToken(e={},t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.usersMeTokens()),a=JSON.stringify(e),n=await this.sdk.http.post(s.toString(),{token:i,body:a,retry:r,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(n);let l="Unable to create a token. ";if(n.status!==200&&n.status!==201)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}return c}async deleteToken(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.usersMeToken(e)),a=await this.sdk.http.delete(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to delete a token. ";if(a.status!==204)throw this.logInvalidResponse(a),this.createApiError(`${n}${x}${a.status}`,a.body)}};var sr=class extends te{async list(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.shared(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to list shared files. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}};var ar=class extends te{async list(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.fileRevisions(e,t));this.sdk.appendListOptions(n,i);let l=await this.sdk.http.get(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to list revisions for a file. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}};var nr=class extends te{async list(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.trash(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to list trash. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}async delete(e,t,i={}){let r=A.trashBatchDelete(e),s=this.sdk.getUrl(r),{token:a=this.sdk.token,retry:n=!0}=i,l=await this.sdk.http.delete(s.toString(),{token:a,body:JSON.stringify({ids:t}),retry:n});this.inspectCommonStatusCodes(l);let c="Unable to delete trash. ";if(l.status!==204)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body)}async restore(e,t,i={}){let r=this.sdk.getUrl(A.trashBatchRestore(e)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.post(r.toString(),{token:s,body:JSON.stringify({ids:t}),retry:a});this.inspectCommonStatusCodes(n);let l="Unable to restore from trash. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body)}async empty(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.trashEmpty(e)),a=await this.sdk.http.delete(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to empty trash. ";if(a.status!==204)throw this.logInvalidResponse(a),this.createApiError(`${n}${x}${a.status}`,a.body)}};var or=class extends te{async list(e={}){let{token:t=this.sdk.token,retry:i=!0}=e,r=this.sdk.getUrl(A.organizations()),s=await this.sdk.http.get(r.toString(),{token:t,retry:i});this.inspectCommonStatusCodes(s);let a="Unable to list your organizations. ";if(s.status!==200)throw this.logInvalidResponse(s),this.createApiError(`${a}${x}${s.status}`,s.body);if(!s.body)throw new g(`${a}${U}`,{code:"E_RESPONSE_NO_VALUE",status:s.status});let n;try{n=JSON.parse(s.body)}catch{throw new g(`${a}${V}`,{code:"E_INVALID_JSON",status:s.status})}if(!Array.isArray(n.data))throw new g(`${a}${F}`,{code:"E_RESPONSE_UNKNOWN",status:s.status});return n}async create(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizations()),n={name:e,slug:t},l=await this.sdk.http.post(a.toString(),{body:JSON.stringify(n),token:r,headers:{"Content-Type":"application/json"},retry:s});this.inspectCommonStatusCodes(l);let c="Unable to create an organization. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!p.kind)throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}invitations={list:async(e,t={})=>{let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.invitations(e)),a=await this.sdk.http.get(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to list organization invitations. ";if(a.status!==200)throw this.logInvalidResponse(a),this.createApiError(`${n}${x}${a.status}`,a.body);if(!a.body)throw new g(`${n}${U}`,{code:"E_RESPONSE_NO_VALUE",status:a.status});let l;try{l=JSON.parse(a.body)}catch{throw new g(`${n}${V}`,{code:"E_INVALID_JSON",status:a.status})}if(!Array.isArray(l.data))throw new g(`${n}${F}`,{code:"E_RESPONSE_UNKNOWN",status:a.status});return l},create:async(e,t,i,r,s={})=>{let{token:a=this.sdk.token,retry:n=!0}=s,l=this.sdk.getUrl(A.invitations(e)),c={email:t,name:r,grant_type:i},p=await this.sdk.http.post(l.toString(),{body:JSON.stringify(c),token:a,headers:{"Content-Type":"application/json"},retry:n});this.inspectCommonStatusCodes(p);let u="Unable to create an invitation. ";if(p.status!==200)throw this.logInvalidResponse(p),this.createApiError(`${u}${x}${p.status}`,p.body);if(!p.body)throw new g(`${u}${U}`,{code:"E_RESPONSE_NO_VALUE",status:p.status});let h;try{h=JSON.parse(p.body).data}catch{throw new g(`${u}${V}`,{code:"E_INVALID_JSON",status:p.status})}if(!h.kind)throw new g(`${u}${F}`,{code:"E_RESPONSE_UNKNOWN",status:p.status});return h},findByToken:async(e,t={})=>{let i=this.sdk.getUrl(A.findInvitation());i.searchParams.append("token",e);let{retry:r=!0,token:s}=t,a=await this.sdk.http.get(i.toString(),{token:s,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to find invitation by token. ";if(a.status!==200)throw this.logInvalidResponse(a),this.createApiError(`${n}${x}${a.status}`,a.body);if(!a.body)throw new g(`${n}${U}`,{code:"E_RESPONSE_NO_VALUE",status:a.status});let l;try{l=JSON.parse(a.body).data}catch{throw new g(`${n}${V}`,{code:"E_INVALID_JSON",status:a.status})}if(!l.kind)throw new g(`${n}${F}`,{code:"E_RESPONSE_UNKNOWN",status:a.status});return l},decline:async(e,t,i={})=>{let r=this.sdk.getUrl(A.declineInvitation(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.post(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to decline invitation. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.kind)throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c},delete:async(e,t,i={})=>{let r=this.sdk.getUrl(A.invitation(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.delete(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to delete invitation. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.kind)throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c},patch:async(e,t,i,r={})=>{let s=this.sdk.getUrl(A.invitation(e,t)),{token:a=this.sdk.token,retry:n=!0}=r,l=await this.sdk.http.patch(s.toString(),{body:JSON.stringify(i),token:a,headers:{"Content-Type":"application/json"},retry:n});this.inspectCommonStatusCodes(l);let c="Unable to update invitation. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!p.kind)throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},resend:async(e,t,i={})=>{let r=this.sdk.getUrl(A.resendInvitation(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.put(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to resend invitation. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.kind)throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}};users={list:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUsers(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to list projects. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!Array.isArray(c.data))throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c},read:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUser(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read the user info. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}return c},readBatch:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUserBatch(e)),n={ids:t},l=await this.sdk.http.post(a.toString(),{body:JSON.stringify(n),token:r,retry:s});this.inspectCommonStatusCodes(l);let c="Unable to read the user batch info. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},activate:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUserActivate(e,t)),n=await this.sdk.http.post(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to activate the user. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}return c},deactivate:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUserDeactivate(e,t)),n=await this.sdk.http.post(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to deactivate the user. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}return c},delete:async(e,t,i={})=>{let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.organizationUser(e,t)),n=await this.sdk.http.delete(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to delete the user. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body)}};slugs={generate:async(e,t={})=>{let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.orgSlugGenerate()).toString(),a={name:e},n=await this.sdk.http.post(s,{body:JSON.stringify(a),token:i,retry:r});this.inspectCommonStatusCodes(n);let l="Unable to generate the slug. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(!c.slug)throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c.slug},validate:async(e,t={})=>{let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.orgSlugValidate()).toString(),a={slug:e},n=await this.sdk.http.post(s,{body:JSON.stringify(a),token:i,retry:r});this.inspectCommonStatusCodes(n);let l="Unable to validate the slug. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);if(!n.body)throw new g(`${l}${U}`,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body).data}catch{throw new g(`${l}${V}`,{code:"E_INVALID_JSON",status:n.status})}if(typeof c.valid!="boolean")throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c}}};var lr=class extends te{async list(e={},t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s={...e},a=this.sdk.getUrl(A.dataCatalog());this.sdk.appendListOptions(a,s),s.scope&&a.searchParams.set("scope",s.scope);let n=await this.sdk.http.get(a.toString(),{token:i,retry:r});return this.processListResponse(n,"Unable to list data domains. ")}async listVersions(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalogEntryVersions(e)),a=await this.sdk.http.get(s.toString(),{token:i,retry:r});return this.processListResponse(a,"Unable to list data domain versions. ")}async publish(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalog()),a=JSON.stringify(e),n=await this.sdk.http.post(s.toString(),{token:i,body:a,retry:r,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(n);let l="Unable to publish data domain. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,mt,c.kind),c}async read(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalogEntry(e)),a=await this.sdk.http.get(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to read data domain. ";if(a.status!==200)throw this.logInvalidResponse(a),this.createApiError(`${n}${x}${a.status}`,a.body);let l=this.readResponseJSON(a,n).data;return this.assertObjectKind(n,mt,l.kind),l}async deprecate(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogDeprecate(e)),n=JSON.stringify({reason:t}),l=await this.sdk.http.put(a.toString(),{token:r,body:n,retry:s,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(l);let c="Unable to deprecate data domain. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);let p=this.readResponseJSON(l,c).data;return this.assertObjectKind(c,mt,p.kind),p}async unpublish(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalogUnpublish(e)),a=await this.sdk.http.put(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to unpublish data domain. ";if(a.status!==200)throw this.logInvalidResponse(a),this.createApiError(`${n}${x}${a.status}`,a.body);let l=this.readResponseJSON(a,n).data;return this.assertObjectKind(n,mt,l.kind),l}async publishVersion(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogEntryVersions(e)),n=JSON.stringify(t),l=await this.sdk.http.post(a.toString(),{token:r,body:n,retry:s,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(l);let c="Unable to publish data domain version. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);let p=this.readResponseJSON(l,c).data;return this.assertObjectKind(c,ft,p.kind),p}async readVersion(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogVersion(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to read data domain version. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ft,c.kind),c}async listDependencies(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalogDependencies()),a=JSON.stringify({items:e}),n=await this.sdk.http.post(s.toString(),{token:i,body:a,retry:r,headers:{"content-type":"application/json"}});return this.processListResponse(n,"Unable to list data domain dependencies. ")}async checkUpdates(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=e.map(c=>({fid:c.key,version:c.version})),a=this.sdk.getUrl(A.dataCatalogUpdates()),n=JSON.stringify({dependencies:s}),l=await this.sdk.http.post(a.toString(),{token:i,body:n,retry:r,headers:{"content-type":"application/json"}});return this.processListResponse(l,"Unable to check for data domain updates. ")}async deprecateVersion(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.dataCatalogVersionDeprecate(e,t)),l=JSON.stringify({reason:i}),c=await this.sdk.http.put(n.toString(),{token:s,body:l,retry:a,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(c);let p="Unable to deprecate data domain version. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${x}${c.status}`,c.body);let u=this.readResponseJSON(c,p).data;return this.assertObjectKind(p,ft,u.kind),u}async unpublishVersion(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogVersionUnpublish(e,t)),n=await this.sdk.http.put(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to unpublish data domain version. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ft,c.kind),c}async checkPublicationStatus(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogStatus(e));t&&a.searchParams.set("oid",t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to check data domain publication status. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,mt,c.kind),c}async getUsageFiles(e,t={}){let{token:i=this.sdk.token,retry:r=!0}=t,s=this.sdk.getUrl(A.dataCatalogUsage(e)),a=await this.sdk.http.get(s.toString(),{token:i,retry:r});this.inspectCommonStatusCodes(a);let n="Unable to get data catalog usage files. ";if(a.status!==200)throw this.logInvalidResponse(a),this.createApiError(`${n}${x}${a.status}`,a.body);return this.processListResponse(a,n)}async getVersionUsageFiles(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.dataCatalogVersionUsage(e,t)),n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to get data catalog version usage files. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);return this.processListResponse(n,l)}};var cr=class extends te{async create(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.groups(e)),n=JSON.stringify(t),l=await this.sdk.http.post(a.toString(),{token:r,body:n,headers:{"content-type":"application/json"},retry:s});this.inspectCommonStatusCodes(l);let c="Unable to create a group. ";if(l.status!==201)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!p.key)throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}async list(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.groups(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to create a group. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(l+x+n.status,n.body);if(!n.body)throw new g(l+U,{code:"E_RESPONSE_NO_VALUE",status:n.status});let c;try{c=JSON.parse(n.body)}catch{throw new g(l+V,{code:"E_INVALID_JSON",status:n.status})}return c}async update(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.group(e,t.key)),n=JSON.stringify(t),l=await this.sdk.http.put(a.toString(),{token:r,body:n,headers:{"content-type":"application/json"},retry:s});this.inspectCommonStatusCodes(l);let c="Unable to update a group. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!p.key)throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p}async delete(e,t,i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.group(e,t)),n=await this.sdk.http.delete(a.toString(),{token:r,retry:s});this.inspectCommonStatusCodes(n);let l="Unable to delete a group. ";if(n.status!==204)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body)}async addUsers(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.groupUsers(e,t)),l=JSON.stringify({ids:i}),c=await this.sdk.http.post(n.toString(),{token:s,body:l,headers:{"content-type":"application/json"},retry:a});this.inspectCommonStatusCodes(c);let p="Unable to add users to a group. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${x}${c.status}`,c.body);if(!c.body)throw new g(`${p}${U}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${V}`,{code:"E_INVALID_JSON",status:c.status})}if(!u.key)throw new g(`${p}${F}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}async removeUsers(e,t,i,r={}){let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.groupUsers(e,t)),l=JSON.stringify({ids:i}),c=await this.sdk.http.delete(n.toString(),{token:s,body:l,headers:{"content-type":"application/json"},retry:a});this.inspectCommonStatusCodes(c);let p="Unable to remove users from a group. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${x}${c.status}`,c.body);if(!c.body)throw new g(`${p}${U}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${V}`,{code:"E_INVALID_JSON",status:c.status})}if(!u.key)throw new g(`${p}${F}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}};var dr=class extends te{async*modifyDomain(e,t,i,r,s={}){let{token:a=this.sdk.token,signal:n}=s,l=this.sdk.getUrl(A.aiModifyDomain(e,t)),c=JSON.stringify({goal:i,sid:r}),p={method:"POST",headers:{"content-type":"application/json",accept:"text/event-stream",authorization:`Bearer ${a}`},redirect:"follow",credentials:"include",body:c,signal:n},u=await fetch(l,p);if(!u.ok){let b=await u.text();throw new g(`Failed to modify domain: ${u.status} ${b}`)}let h=u.body?.getReader();if(!h)throw new g("Failed to get reader from response");let m=new TextDecoder,f="";for(;;){let{done:b,value:k}=await h.read();if(b)return;f+=m.decode(k,{stream:!0});let S;for(;(S=f.indexOf(`
|
|
18
17
|
|
|
19
|
-
`))>=0;){let
|
|
20
|
-
`),x="message",I="";for(let L of E)L.startsWith("event:")?x=L.substring(6).trim():L.startsWith("data:")&&(I+=L.substring(5).trim());if(!I)continue;let j;try{j=JSON.parse(I)}catch{console.error("Failed to parse SSE JSON data:",I);continue}switch(x){case"user-message":yield{event:x,data:j};break;case"agent-message":yield{event:x,data:j};break;case"thought-chunk":case"text-chunk":yield{event:x,data:j};break;case"done":yield{event:x,data:j};return;case"error":yield{event:x,data:g.fromRawException(j,"Failed to generate results")};break;case"session-updated":yield{event:x,data:j};break;default:console.warn(`Unknown SSE event: ${x}`)}}}}sessions={list:async(e,t,i={},r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSessions(e,t));this.sdk.appendListOptions(n,i);let l=await this.sdk.http.get(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to list sessions. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},read:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSession(e,t,i)),l=await this.sdk.http.get(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to read session. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(p.kind!==ki)throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},create:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSessions(e,t)),l=JSON.stringify(i),c=await this.sdk.http.post(n.toString(),{token:s,body:l,retry:a});this.inspectCommonStatusCodes(c);let p="Unable to create session. ";if(c.status!==201)throw this.logInvalidResponse(c),this.createApiError(`${p}${N}${c.status}`,c.body);if(!c.body)throw new g(`${p}${C}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${U}`,{code:"E_INVALID_JSON",status:c.status})}if(u.kind!==ki)throw new g(`${p}${z}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u},delete:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSession(e,t,i)),l=await this.sdk.http.delete(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to delete session. ";if(l.status!==204)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body)},update:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSession(e,t,i.key)),l=JSON.stringify(i),c=await this.sdk.http.put(n.toString(),{token:s,body:l,retry:a});this.inspectCommonStatusCodes(c);let p="Unable to update session. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${N}${c.status}`,c.body);if(!c.body)throw new g(`${p}${C}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${U}`,{code:"E_INVALID_JSON",status:c.status})}if(u.kind!==ki)throw new g(`${p}${z}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}};messages={list:async(e,t,i={},r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiMessages(e,t));this.sdk.appendListOptions(n,i);let l=await this.sdk.http.get(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to list messages. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body);if(!l.body)throw new g(`${c}${C}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${U}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${z}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},delete:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiMessage(e,t,i)),l=await this.sdk.http.delete(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to delete message. ";if(l.status!==204)throw this.logInvalidResponse(l),this.createApiError(`${c}${N}${l.status}`,l.body)},update:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiMessage(e,t,i.key)),l=JSON.stringify(i),c=await this.sdk.http.put(n.toString(),{token:s,body:l,retry:a});this.inspectCommonStatusCodes(c);let p="Unable to update message. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${N}${c.status}`,c.body);if(!c.body)throw new g(`${p}${C}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${U}`,{code:"E_INVALID_JSON",status:c.status})}if(u.kind!==gs)throw new g(`${p}${z}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}}};var _s;(function(o){o.Pending="pending",o.Active="active",o.Inactive="inactive",o.Failed="failed"})(_s||(_s={}));var ti;(function(o){o.PROD="prod",o.STAGING="staging",o.DEV="dev"})(ti||(ti={}));var fr=class extends Q{async list(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.deployments(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});return this.processListResponse(n,"Unable to list deployments. ")}async create(e,t,i={}){if(t.env===ti.PROD&&!t.version)throw new g(`Version must not be empty for production environment: ${t.env}`,{code:"INVALID_DEPLOYMENT_VERSION",help:"Please provide a version for production environment",status:400});if(t.env!==ti.PROD&&t.version)throw new g(`Version must not be present for non-production environment: ${t.env}`,{code:"INVALID_DEPLOYMENT_VERSION",help:"Please remove the version for non-production environment",status:400});let r=this.sdk.getUrl(A.deployments(e)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.post(r.toString(),{token:s,body:JSON.stringify(t),retry:a,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(n);let l="Unable to create a deployment. ";if(n.status!==202)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ei,c.kind),c}async read(e,t,i={}){let r=this.sdk.getUrl(A.deployment(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.get(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to read a deployment. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ei,c.kind),c}async deactivate(e,t,i={}){let r=this.sdk.getUrl(A.deployment(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.delete(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to deactivate a deployment. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ei,c.kind),c}async rollback(e,t,i={}){let r=this.sdk.getUrl(A.rollback(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.post(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to rollback a deployment. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ei,c.kind),c}apis={getLatestPerEnvironment:async(e,t,i={})=>{let r=this.sdk.getUrl(A.deploymentsApisByEnvLatest(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.get(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to list latest deployments for an API. ",c=this.readResponseJSON(n,l);if(!c.data)throw new g(`${l}${z}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c},list:async(e,t={})=>{let i=this.sdk.getUrl(A.deploymentsApis(e)),{token:r=this.sdk.token,retry:s=!0}=t,a=await this.sdk.http.get(i.toString(),{token:r,retry:s});return this.processListResponse(a,"Unable to list APIs. ")},listDeployments:async(e,t,i={},r={})=>{let s=this.sdk.getUrl(A.deploymentsForApi(e,t));this.sdk.appendListOptions(s,i);let{token:a=this.sdk.token,retry:n=!0}=r,l=await this.sdk.http.get(s.toString(),{token:a,retry:n});return this.processListResponse(l,"Unable to list deployments. ")},updateRuntimeUser:async(e,t,i,r,s="production",a={})=>{let n=this.sdk.getUrl(A.deploymentsApiRuntimeUsersUpdate(e,t)),{token:l=this.sdk.token,retry:c=!0}=a,p=JSON.stringify({userId:i,properties:r,env:s}),u=await this.sdk.http.post(n.toString(),{token:l,body:p,retry:c,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(u);let m="Unable to update runtime user. ";if(u.status!==200)throw this.logInvalidResponse(u),this.createApiError(`${m}${N}${u.status}`,u.body);if(!u.body)throw new g(`${m}${C}`,{code:"E_RESPONSE_NO_VALUE",status:u.status});return this.readResponseJSON(u,m)}}};var xs;(function(o){o.Pending="pending",o.Running="running",o.Completed="completed",o.Failed="failed"})(xs||(xs={}));var gr=class extends Q{async checkStatus(e,t,i={}){let r=this.sdk.getUrl(A.job(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.get(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to check job status. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${N}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ys,c.kind),c}};var As=Symbol("baseUri"),yr=class extends EventTarget{basePath;#e;logger;get token(){return this.#e}set token(e){this.#e=e}auth=new ir(this);files=new nr(this);users=new or(this);shared=new lr(this);revisions=new cr(this);trash=new dr(this);organizations=new pr(this);dataCatalog=new ur(this);groups=new mr(this);ai=new hr(this);deployments=new fr(this);jobs=new gr(this);silent=!1;[As]="";get baseUri(){return this[As]}set baseUri(e){if(!e)throw new Error("Invalid value for the baseUri");let t;try{t=new URL(e)}catch{throw new Error("Invalid baseUri: Not an URL")}this[As]=t.origin;let{pathname:i}=t;i&&i!=="/"?this.basePath=i:this.basePath=void 0}constructor(e,t){super(),this.basePath=t,this.baseUri=e}getUrl(e="/"){if(e.startsWith("http:")||e.startsWith("https:"))return new URL(e);let{baseUri:t,basePath:i=""}=this,r=e;return i&&r.startsWith(i)&&(r=r.substring(i.length)),new URL(`${i}${r}`,t)}appendListOptions(e,t={}){let{searchParams:i}=e;if(t.cursor&&i.set("cursor",t.cursor),typeof t.limit=="number"&&i.set("limit",String(t.limit)),t.parent&&i.set("parent",t.parent),t.since&&i.set("since",String(t.since)),t.sort&&i.set("sort",String(t.sort)),t.order&&i.set("order",String(t.order)),t.oid&&i.set("oid",String(t.oid)),t.uid&&i.set("uid",String(t.uid)),t.filter){let r=new TextEncoder().encode(JSON.stringify(t.filter)),s=Array.from(r,a=>String.fromCodePoint(a)).join("");i.set("filter",btoa(s))}}};var br=class extends yr{http=new tr(this)};function te(o={}){let e=P.resolved,t=o.apiUrl||e.apiUrl,i=new br(t);return e.token&&(i.token=e.token),i.logger=S,i}function se(o){if(o&&typeof o=="object"){let t=o,i=t.status,r=t.code,s=t.message||"An unknown error occurred.",a=t.help;return i===401?(s="Unauthorized. Please login using `auth login`.",{message:s,status:i,code:"CLI_ERR_UNAUTHORIZED",help:a}):{message:s,status:i,code:r||"CLI_ERR_API_FAILURE",help:a}}return{message:o?.message||"An unknown error occurred.",code:"CLI_ERR_UNKNOWN"}}function Nt(o,e){return o.token||(e.error({code:"CLI_ERR_UNAUTHORIZED",message:"Not logged in.",detail:"Use `apinow auth login <provider>` to authenticate."}),process.exit(1)),o.token}import{input as el,confirm as tl,select as il}from"@inquirer/prompts";async function Je(o,e){return(await el({message:o,default:e})).trim()}async function Pa(o,e=!0){return tl({message:o,default:e})}async function ft(o,e){return il({message:o,choices:e})}async function Es(o,e){let t;try{t=(await o.organizations.list({token:o.token})).data||[]}catch{return}if(t.length>0){if(!P.resolved.org){let a=t[0],n=a.key;P.writeProperty("org",n),e.format!=="json"&&console.log(`
|
|
21
|
-
`+
|
|
22
|
-
`+
|
|
18
|
+
`))>=0;){let I=f.slice(0,S);if(f=f.slice(S+2),!I.trim())continue;let D=I.split(`
|
|
19
|
+
`),w="message",v="";for(let R of D)R.startsWith("event:")?w=R.substring(6).trim():R.startsWith("data:")&&(v+=R.substring(5).trim());if(!v)continue;let E;try{E=JSON.parse(v)}catch{console.error("Failed to parse SSE JSON data:",v);continue}switch(w){case"user-message":yield{event:w,data:E};break;case"agent-message":yield{event:w,data:E};break;case"thought-chunk":case"text-chunk":yield{event:w,data:E};break;case"done":yield{event:w,data:E};return;case"error":yield{event:w,data:g.fromRawException(E,"Failed to generate results")};break;case"session-updated":yield{event:w,data:E};break;default:console.warn(`Unknown SSE event: ${w}`)}}}}sessions={list:async(e,t,i={},r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSessions(e,t));this.sdk.appendListOptions(n,i);let l=await this.sdk.http.get(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to list sessions. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},read:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSession(e,t,i)),l=await this.sdk.http.get(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to read session. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body).data}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(p.kind!==_i)throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},create:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSessions(e,t)),l=JSON.stringify(i),c=await this.sdk.http.post(n.toString(),{token:s,body:l,retry:a});this.inspectCommonStatusCodes(c);let p="Unable to create session. ";if(c.status!==201)throw this.logInvalidResponse(c),this.createApiError(`${p}${x}${c.status}`,c.body);if(!c.body)throw new g(`${p}${U}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${V}`,{code:"E_INVALID_JSON",status:c.status})}if(u.kind!==_i)throw new g(`${p}${F}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u},delete:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSession(e,t,i)),l=await this.sdk.http.delete(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to delete session. ";if(l.status!==204)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body)},update:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiSession(e,t,i.key)),l=JSON.stringify(i),c=await this.sdk.http.put(n.toString(),{token:s,body:l,retry:a});this.inspectCommonStatusCodes(c);let p="Unable to update session. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${x}${c.status}`,c.body);if(!c.body)throw new g(`${p}${U}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${V}`,{code:"E_INVALID_JSON",status:c.status})}if(u.kind!==_i)throw new g(`${p}${F}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}};messages={list:async(e,t,i={},r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiMessages(e,t));this.sdk.appendListOptions(n,i);let l=await this.sdk.http.get(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to list messages. ";if(l.status!==200)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body);if(!l.body)throw new g(`${c}${U}`,{code:"E_RESPONSE_NO_VALUE",status:l.status});let p;try{p=JSON.parse(l.body)}catch{throw new g(`${c}${V}`,{code:"E_INVALID_JSON",status:l.status})}if(!Array.isArray(p.data))throw new g(`${c}${F}`,{code:"E_RESPONSE_UNKNOWN",status:l.status});return p},delete:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiMessage(e,t,i)),l=await this.sdk.http.delete(n.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(l);let c="Unable to delete message. ";if(l.status!==204)throw this.logInvalidResponse(l),this.createApiError(`${c}${x}${l.status}`,l.body)},update:async(e,t,i,r={})=>{let{token:s=this.sdk.token,retry:a=!0}=r,n=this.sdk.getUrl(A.aiMessage(e,t,i.key)),l=JSON.stringify(i),c=await this.sdk.http.put(n.toString(),{token:s,body:l,retry:a});this.inspectCommonStatusCodes(c);let p="Unable to update message. ";if(c.status!==200)throw this.logInvalidResponse(c),this.createApiError(`${p}${x}${c.status}`,c.body);if(!c.body)throw new g(`${p}${U}`,{code:"E_RESPONSE_NO_VALUE",status:c.status});let u;try{u=JSON.parse(c.body).data}catch{throw new g(`${p}${V}`,{code:"E_INVALID_JSON",status:c.status})}if(u.kind!==ks)throw new g(`${p}${F}`,{code:"E_RESPONSE_UNKNOWN",status:c.status});return u}}};var xs;(function(o){o.Pending="pending",o.Active="active",o.Inactive="inactive",o.Failed="failed"})(xs||(xs={}));var ei;(function(o){o.PROD="prod",o.STAGING="staging",o.DEV="dev"})(ei||(ei={}));var pr=class extends te{async list(e,t={},i={}){let{token:r=this.sdk.token,retry:s=!0}=i,a=this.sdk.getUrl(A.deployments(e));this.sdk.appendListOptions(a,t);let n=await this.sdk.http.get(a.toString(),{token:r,retry:s});return this.processListResponse(n,"Unable to list deployments. ")}async create(e,t,i={}){if(t.env===ei.PROD&&!t.version)throw new g(`Version must not be empty for production environment: ${t.env}`,{code:"INVALID_DEPLOYMENT_VERSION",help:"Please provide a version for production environment",status:400});if(t.env!==ei.PROD&&t.version)throw new g(`Version must not be present for non-production environment: ${t.env}`,{code:"INVALID_DEPLOYMENT_VERSION",help:"Please remove the version for non-production environment",status:400});let r=this.sdk.getUrl(A.deployments(e)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.post(r.toString(),{token:s,body:JSON.stringify(t),retry:a,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(n);let l="Unable to create a deployment. ";if(n.status!==202)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,Qt,c.kind),c}async read(e,t,i={}){let r=this.sdk.getUrl(A.deployment(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.get(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to read a deployment. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,Qt,c.kind),c}async deactivate(e,t,i={}){let r=this.sdk.getUrl(A.deployment(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.delete(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to deactivate a deployment. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,Qt,c.kind),c}async rollback(e,t,i={}){let r=this.sdk.getUrl(A.rollback(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.post(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to rollback a deployment. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,Qt,c.kind),c}apis={getLatestPerEnvironment:async(e,t,i={})=>{let r=this.sdk.getUrl(A.deploymentsApisByEnvLatest(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.get(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to list latest deployments for an API. ",c=this.readResponseJSON(n,l);if(!c.data)throw new g(`${l}${F}`,{code:"E_RESPONSE_UNKNOWN",status:n.status});return c},list:async(e,t={})=>{let i=this.sdk.getUrl(A.deploymentsApis(e)),{token:r=this.sdk.token,retry:s=!0}=t,a=await this.sdk.http.get(i.toString(),{token:r,retry:s});return this.processListResponse(a,"Unable to list APIs. ")},listDeployments:async(e,t,i={},r={})=>{let s=this.sdk.getUrl(A.deploymentsForApi(e,t));this.sdk.appendListOptions(s,i);let{token:a=this.sdk.token,retry:n=!0}=r,l=await this.sdk.http.get(s.toString(),{token:a,retry:n});return this.processListResponse(l,"Unable to list deployments. ")},updateRuntimeUser:async(e,t,i,r,s="production",a={})=>{let n=this.sdk.getUrl(A.deploymentsApiRuntimeUsersUpdate(e,t)),{token:l=this.sdk.token,retry:c=!0}=a,p=JSON.stringify({userId:i,properties:r,env:s}),u=await this.sdk.http.post(n.toString(),{token:l,body:p,retry:c,headers:{"content-type":"application/json"}});this.inspectCommonStatusCodes(u);let h="Unable to update runtime user. ";if(u.status!==200)throw this.logInvalidResponse(u),this.createApiError(`${h}${x}${u.status}`,u.body);if(!u.body)throw new g(`${h}${U}`,{code:"E_RESPONSE_NO_VALUE",status:u.status});return this.readResponseJSON(u,h)}}};var Ns;(function(o){o.Pending="pending",o.Running="running",o.Completed="completed",o.Failed="failed"})(Ns||(Ns={}));var ur=class extends te{async checkStatus(e,t,i={}){let r=this.sdk.getUrl(A.job(e,t)),{token:s=this.sdk.token,retry:a=!0}=i,n=await this.sdk.http.get(r.toString(),{token:s,retry:a});this.inspectCommonStatusCodes(n);let l="Unable to check job status. ";if(n.status!==200)throw this.logInvalidResponse(n),this.createApiError(`${l}${x}${n.status}`,n.body);let c=this.readResponseJSON(n,l).data;return this.assertObjectKind(l,ws,c.kind),c}};var $s=Symbol("baseUri"),hr=class extends EventTarget{basePath;#e;logger;get token(){return this.#e}set token(e){this.#e=e}auth=new Zi(this);files=new ir(this);users=new rr(this);shared=new sr(this);revisions=new ar(this);trash=new nr(this);organizations=new or(this);dataCatalog=new lr(this);groups=new cr(this);ai=new dr(this);deployments=new pr(this);jobs=new ur(this);silent=!1;[$s]="";get baseUri(){return this[$s]}set baseUri(e){if(!e)throw new Error("Invalid value for the baseUri");let t;try{t=new URL(e)}catch{throw new Error("Invalid baseUri: Not an URL")}this[$s]=t.origin;let{pathname:i}=t;i&&i!=="/"?this.basePath=i:this.basePath=void 0}constructor(e,t){super(),this.basePath=t,this.baseUri=e}getUrl(e="/"){if(e.startsWith("http:")||e.startsWith("https:"))return new URL(e);let{baseUri:t,basePath:i=""}=this,r=e;return i&&r.startsWith(i)&&(r=r.substring(i.length)),new URL(`${i}${r}`,t)}appendListOptions(e,t={}){let{searchParams:i}=e;if(t.cursor&&i.set("cursor",t.cursor),typeof t.limit=="number"&&i.set("limit",String(t.limit)),t.parent&&i.set("parent",t.parent),t.since&&i.set("since",String(t.since)),t.sort&&i.set("sort",String(t.sort)),t.order&&i.set("order",String(t.order)),t.oid&&i.set("oid",String(t.oid)),t.uid&&i.set("uid",String(t.uid)),t.filter){let r=new TextEncoder().encode(JSON.stringify(t.filter)),s=Array.from(r,a=>String.fromCodePoint(a)).join("");i.set("filter",btoa(s))}}};var mr=class extends hr{http=new Yi(this)};function X(o={}){let e=P.resolved,t=o.apiUrl||e.apiUrl,i=new mr(t);return e.token&&(i.token=e.token),i.logger=_,i}function Z(o){if(o&&typeof o=="object"){let t=o,i=t.status,r=t.code,s=t.message||"An unknown error occurred.",a=t.help;return i===401?(s="Unauthorized. Please login using `auth login`.",{message:s,status:i,code:"CLI_ERR_UNAUTHORIZED",help:a}):{message:s,status:i,code:r||"CLI_ERR_API_FAILURE",help:a}}return{message:o?.message||"An unknown error occurred.",code:"CLI_ERR_UNKNOWN"}}function Nt(o,e){return o.token||(e.error({code:"CLI_ERR_UNAUTHORIZED",message:"Not logged in.",detail:"Use `apinow auth login <provider>` to authenticate."}),process.exit(1)),o.token}import{input as Bo,confirm as Go,select as Ho}from"@inquirer/prompts";async function Ue(o,e){return(await Bo({message:o,default:e})).trim()}async function ja(o,e=!0){return Go({message:o,default:e})}async function yt(o,e){return Ho({message:o,choices:e})}async function js(o,e){let t;try{t=(await o.organizations.list({token:o.token})).data||[]}catch{return}if(t.length>0){if(!P.resolved.org){let a=t[0],n=a.key;P.writeProperty("org",n),e.format!=="json"&&console.log(`
|
|
20
|
+
`+Q.cyan(`\u2139 Automatically set default organization to "${a.name}" (${n}).`))}return}if(e.format==="json")return;console.log(`
|
|
21
|
+
`+Q.yellow("\u26A0 It looks like you do not have any organizations yet.")),console.log("Let's set up your first organization now.");let i="";for(;!i;)i=await Ue("Enter organization name:"),i||console.log(Q.red("Error: Organization name cannot be empty."));let r;try{r=await o.organizations.slugs.generate(i,{token:o.token})}catch{r=i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}if(!await ja(`Use suggested organization slug "${r}"?`,!0)){let a=!1;for(;!a;){let n=await Ue("Enter organization slug:");if(!n){console.log(Q.red("Error: Slug cannot be empty."));continue}try{let l=await o.organizations.slugs.validate(n,{token:o.token});l.valid?(r=n,a=!0):console.log(Q.red(`Error: ${l.reason||"Invalid slug"}`))}catch{console.log(Q.red("Error validating slug with server. Please try another slug."))}}}console.log(`
|
|
23
22
|
Creating organization "${i}" with slug "${r}"...`);try{let n=(await o.organizations.create(i,r,{token:o.token})).key;P.writeProperty("org",n),console.log(`
|
|
24
|
-
`+
|
|
25
|
-
`+
|
|
26
|
-
`),console.log(`${
|
|
27
|
-
`))}catch(r){let s=
|
|
28
|
-
${m}`));try{await nl(m)}catch{}})})}function Da(o){let e=o.command("orgs").description("Manage organization configurations");e.command("list").description("List all organizations you belong to").action(async()=>{let t=new B({format:P.resolved.format});S.debug("[orgs:list] Listing all authorized organizations...");try{let i=te(),s=(await i.organizations.list({token:i.token})).data||[];S.debug(`[orgs:list] Found ${s.length} organizations.`);let a=P.resolved,n=s.map(l=>({id:l.key,name:l.name,slug:l.slug,isDefault:l.key===a.org?"Yes":"No"}));t.list(n,["id","name","slug","isDefault"],{headers:["ID","NAME","SLUG","DEFAULT"]})}catch(i){let r=se(i);t.error(r),process.exit(1)}}),e.command("set-default <oid>").description("Set your default organization ID").action(async t=>{let i=new B({format:P.resolved.format});S.debug(`[orgs:set-default] Setting default organization ID to '${t}'...`);try{let r=te();S.debug("[orgs:set-default] Validating organization ID in user's authorized list..."),((await r.organizations.list({token:r.token})).data||[]).some(l=>l.key===t)||(S.debug(`[orgs:set-default] Organization ID '${t}' not found.`),i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Organization ID '${t}' not found in your authorized list.`,detail:"Run `apinow orgs list` to see all authorized organizations and their IDs."}),process.exit(1)),S.debug(`[orgs:set-default] Organization ID validated. Writing 'org' property as '${t}'...`),P.writeProperty("org",t),S.debug("[orgs:set-default] Configuration property written successfully."),i.success(`Default organization ID set to '${t}'.`)}catch(r){let s=se(r);i.error(s),process.exit(1)}}),e.command("default").alias("get-default").description("Get the default configured organization").action(async()=>{let t=new B({format:P.resolved.format});S.debug("[orgs:default] Retrieving the default configured organization...");try{let i=P.resolved;i.org||(S.debug("[orgs:default] No default organization configured in local settings."),t.error({code:"CLI_ERR_MISSING_REQUIRED",message:"No default organization configured.",detail:"Set one using `apinow orgs set-default <oid>`. Run `apinow orgs list` to list available organizations."}),process.exit(1));let r=te();S.debug(`[orgs:default] Fetching organization list to validate configured org '${i.org}'...`);let n=((await r.organizations.list({token:r.token})).data||[]).find(l=>l.key===i.org);n||(S.debug(`[orgs:default] Configured org '${i.org}' not found in authorized list.`),t.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Default organization ID '${i.org}' not found in your authorized list.`,detail:"Run `apinow orgs set-default <oid>` to configure a valid default organization."}),process.exit(1)),S.debug(`[orgs:default] Default organization validated successfully: ${n.name}`),t.object({id:n.key,name:n.name,slug:n.slug})}catch(i){let r=se(i);t.error(r),process.exit(1)}})}import Ka from"node:fs";import gl from"node:path";var _i=class o{key;get kind(){return ht}catalogKey;scope;lifecycle;version;publishedBy;unpublishedAt;deprecated;deprecatedAt;deprecatedBy;deprecationReason;createdAt;updatedAt;changelog;static createSchema(e){let{key:t="",scope:i="private",publishedBy:r="",createdAt:s=0,updatedAt:a=0,catalogKey:n="",lifecycle:l="stable",version:c=""}=e;if(["public","private","organization"].indexOf(i)===-1)throw new Error(`Invalid scope: ${i}`);let p={key:t,kind:ht,scope:i,publishedBy:r,createdAt:s,updatedAt:a,catalogKey:n,lifecycle:l,version:c};return typeof e.deprecated=="boolean"&&(p.deprecated=e.deprecated),typeof e.deprecatedAt=="number"&&(p.deprecatedAt=e.deprecatedAt),typeof e.deprecatedBy=="string"&&(p.deprecatedBy=e.deprecatedBy),typeof e.changelog=="string"&&(p.changelog=e.changelog),typeof e.deprecationReason=="string"&&(p.deprecationReason=e.deprecationReason),typeof e.unpublishedAt=="number"&&(p.unpublishedAt=e.unpublishedAt),p}constructor(e={}){let t=o.createSchema(e);this.key=t.key,this.catalogKey=t.catalogKey,this.lifecycle=t.lifecycle,this.scope=t.scope,this.version=t.version,this.publishedBy=t.publishedBy,this.createdAt=t.createdAt,this.updatedAt=t.updatedAt,typeof t.changelog=="string"&&(this.changelog=t.changelog),typeof t.deprecated=="boolean"&&(this.deprecated=t.deprecated),typeof t.deprecatedAt=="number"&&(this.deprecatedAt=t.deprecatedAt),typeof t.deprecatedBy=="string"&&(this.deprecatedBy=t.deprecatedBy),typeof t.deprecationReason=="string"&&(this.deprecationReason=t.deprecationReason),typeof t.unpublishedAt=="number"&&(this.unpublishedAt=t.unpublishedAt)}toJSON(){let e={key:this.key,kind:ht,scope:this.scope,publishedBy:this.publishedBy,createdAt:this.createdAt,updatedAt:this.updatedAt,catalogKey:this.catalogKey,lifecycle:this.lifecycle,version:this.version};return typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),typeof this.deprecatedAt=="number"&&(e.deprecatedAt=this.deprecatedAt),typeof this.deprecatedBy=="string"&&(e.deprecatedBy=this.deprecatedBy),typeof this.deprecationReason=="string"&&(e.deprecationReason=this.deprecationReason),typeof this.unpublishedAt=="number"&&(e.unpublishedAt=this.unpublishedAt),typeof this.changelog=="string"&&this.changelog&&(e.changelog=this.changelog),e}};var y;(function(o){o.User="Semantic#User",o.Address="Semantic#Address",o.Password="Semantic#Password",o.Username="Semantic#Username",o.CreatedTimestamp="Semantic#CreatedTimestamp",o.UpdatedTimestamp="Semantic#UpdatedTimestamp",o.DeletedTimestamp="Semantic#DeletedTimestamp",o.DeletedFlag="Semantic#DeletedFlag",o.PublicUniqueName="Semantic#PublicUniqueName",o.Title="Semantic#Title",o.Name="Semantic#Name",o.UserRole="Semantic#UserRole",o.Status="Semantic#Status",o.Version="Semantic#Version",o.ImageURL="Semantic#ImageURL",o.FileURL="Semantic#FileURL",o.Markdown="Semantic#Markdown",o.HTML="Semantic#HTML",o.GeospatialCoordinates="Semantic#GeospatialCoordinates",o.Email="Semantic#Email",o.Phone="Semantic#Phone",o.Currency="Semantic#Currency",o.URL="Semantic#URL",o.SKU="Semantic#SKU",o.Description="Semantic#Description",o.Summary="Semantic#Summary",o.Calculated="Semantic#Calculated",o.Derived="Semantic#Derived",o.ClientIPAddress="Semantic#ClientIPAddress",o.StreetAddress="Semantic#StreetAddress",o.StreetAddressSupplemental="Semantic#StreetAddressSupplemental",o.City="Semantic#City",o.PostalCode="Semantic#PostalCode",o.Country="Semantic#Country",o.Region="Semantic#Region",o.ResourceOwnerIdentifier="Semantic#ResourceOwnerIdentifier",o.RelationalResourceOwner="Semantic#RelationalResourceOwner",o.CreatedBy="Semantic#CreatedBy",o.UpdatedBy="Semantic#UpdatedBy",o.DeletedBy="Semantic#DeletedBy",o.Tags="Semantic#Tags",o.Categories="Semantic#Categories"})(y||(y={}));var V;(function(o){o.Entity="Entity",o.Property="Property",o.Association="Association"})(V||(V={}));var K;(function(o){o.Identity="Identity & Authentication",o.Lifecycle="Timestamps & Versioning",o.Content="Content & Media",o.Business="Business Data",o.Organization="Classification & Organization",o.Location="Location & Geography",o.Contact="Contact Information",o.Computed="Computed Values"})(K||(K={}));var Ua=o=>o.scope===V.Entity,wr=o=>o.scope===V.Property,La=o=>o.scope===V.Association,Xe={[y.User]:{id:y.User,displayName:"User Entity",scope:V.Entity,description:"System users and accounts",category:K.Identity,hasConfig:!1},[y.Password]:{id:y.Password,displayName:"User Password",scope:V.Property,description:"Secure password field",category:K.Identity,applicableDataTypes:["string"],hasConfig:!0},[y.Username]:{id:y.Username,displayName:"Username",scope:V.Property,description:"User authentication identifier",category:K.Identity,applicableDataTypes:["string"],hasConfig:!1},[y.UserRole]:{id:y.UserRole,displayName:"User Role Field",scope:V.Property,description:"User permissions and access level",category:K.Identity,applicableDataTypes:["string"],hasConfig:!0},[y.ResourceOwnerIdentifier]:{id:y.ResourceOwnerIdentifier,displayName:"Resource Owner Identifier",scope:V.Association,description:"Links record to owner user",category:K.Identity,hasConfig:!1},[y.RelationalResourceOwner]:{id:y.RelationalResourceOwner,displayName:"Relational Resource Owner",scope:V.Association,description:"Specifies that the target entity of this association acts as the relational owner context for ownership verification.",category:K.Identity,hasConfig:!1},[y.CreatedBy]:{id:y.CreatedBy,displayName:"Created By",scope:V.Association,description:"Links record to the user who created it",category:K.Identity,hasConfig:!1},[y.UpdatedBy]:{id:y.UpdatedBy,displayName:"Updated By",scope:V.Association,description:"Links record to the user who last updated it",category:K.Identity,hasConfig:!1},[y.DeletedBy]:{id:y.DeletedBy,displayName:"Deleted By",scope:V.Association,description:"Links record to the user who soft-deleted it",category:K.Identity,hasConfig:!1},[y.CreatedTimestamp]:{id:y.CreatedTimestamp,displayName:"Creation Timestamp",scope:V.Property,description:"When record was created",category:K.Lifecycle,applicableDataTypes:["datetime"],hasConfig:!1},[y.UpdatedTimestamp]:{id:y.UpdatedTimestamp,displayName:"Update Timestamp",scope:V.Property,description:"When record was last modified",category:K.Lifecycle,applicableDataTypes:["datetime"],hasConfig:!1},[y.DeletedTimestamp]:{id:y.DeletedTimestamp,displayName:"Soft Delete Timestamp",scope:V.Property,description:"When record was marked deleted",category:K.Lifecycle,applicableDataTypes:["datetime"],hasConfig:!1},[y.DeletedFlag]:{id:y.DeletedFlag,displayName:"Soft Delete Flag",scope:V.Property,description:"Mark record as deleted",category:K.Lifecycle,applicableDataTypes:["boolean"],hasConfig:!1},[y.Address]:{id:y.Address,displayName:"Address Entity",scope:V.Entity,description:"Physical address entity",category:K.Contact,hasConfig:!1},[y.StreetAddress]:{id:y.StreetAddress,displayName:"Street Address",scope:V.Property,description:"Street address line",category:K.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.StreetAddressSupplemental]:{id:y.StreetAddressSupplemental,displayName:"Street Address Supplemental",scope:V.Property,description:"Supplemental street address line (e.g., Unit, Suite, Apartment, Floor)",category:K.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.City]:{id:y.City,displayName:"City",scope:V.Property,description:"City or locality",category:K.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.PostalCode]:{id:y.PostalCode,displayName:"Postal Code",scope:V.Property,description:"Postal or zip code",category:K.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.Country]:{id:y.Country,displayName:"Country",scope:V.Property,description:"Country name or code",category:K.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.Region]:{id:y.Region,displayName:"Region",scope:V.Property,description:"State, province, or region",category:K.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.Version]:{id:y.Version,displayName:"Version Number",scope:V.Property,description:"Auto-incrementing version counter",category:K.Lifecycle,applicableDataTypes:["number"],hasConfig:!1},[y.Title]:{id:y.Title,displayName:"Record Title",scope:V.Property,description:"Main title or heading",category:K.Content,applicableDataTypes:["string"],hasConfig:!1},[y.Name]:{id:y.Name,displayName:"Name",scope:V.Property,description:"A person or pet name",category:K.Content,applicableDataTypes:["string"],hasConfig:!1},[y.Description]:{id:y.Description,displayName:"Description",scope:V.Property,description:"Detailed description text",category:K.Content,applicableDataTypes:["string"],hasConfig:!1},[y.Summary]:{id:y.Summary,displayName:"Summary",scope:V.Property,description:"Brief summary text",category:K.Content,applicableDataTypes:["string"],hasConfig:!1},[y.Markdown]:{id:y.Markdown,displayName:"Markdown Content",scope:V.Property,description:"Formatted text content",category:K.Content,applicableDataTypes:["string"],hasConfig:!0},[y.HTML]:{id:y.HTML,displayName:"HTML Content",scope:V.Property,description:"Rich HTML content",category:K.Content,applicableDataTypes:["string"],hasConfig:!0},[y.ImageURL]:{id:y.ImageURL,displayName:"Image URL",scope:V.Property,description:"Link to image file",category:K.Content,applicableDataTypes:["string"],hasConfig:!0},[y.FileURL]:{id:y.FileURL,displayName:"File URL",scope:V.Property,description:"Link to file attachment",category:K.Content,applicableDataTypes:["string"],hasConfig:!0},[y.Status]:{id:y.Status,displayName:"Record Status",scope:V.Property,description:"Current state of record",category:K.Business,applicableDataTypes:["string"],hasConfig:!0},[y.Currency]:{id:y.Currency,displayName:"Currency",scope:V.Property,description:"Monetary value with currency",category:K.Business,applicableDataTypes:["number","string"],hasConfig:!0},[y.SKU]:{id:y.SKU,displayName:"SKU",scope:V.Property,description:"Product identification code",category:K.Business,applicableDataTypes:["string"],hasConfig:!0},[y.Email]:{id:y.Email,displayName:"Email",scope:V.Property,description:"Email address",category:K.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.Phone]:{id:y.Phone,displayName:"Phone",scope:V.Property,description:"Phone number",category:K.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.URL]:{id:y.URL,displayName:"URL",scope:V.Property,description:"Web address or link",category:K.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.ClientIPAddress]:{id:y.ClientIPAddress,displayName:"Client IP Address",scope:V.Property,description:"Automatically populated client IP address",category:K.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.PublicUniqueName]:{id:y.PublicUniqueName,displayName:"Public Unique Name (Slug)",scope:V.Property,description:"URL-friendly unique identifier",category:K.Organization,applicableDataTypes:["string"],hasConfig:!0},[y.Tags]:{id:y.Tags,displayName:"Tags",scope:V.Association,description:"Enable tagging functionality",category:K.Organization,hasConfig:!0},[y.Categories]:{id:y.Categories,displayName:"Categories",scope:V.Association,description:"Enable categorization functionality",category:K.Organization,hasConfig:!0},[y.GeospatialCoordinates]:{id:y.GeospatialCoordinates,displayName:"Geospatial Coordinates",scope:V.Property,description:"Location coordinates",category:K.Location,applicableDataTypes:["string"],hasConfig:!0},[y.Calculated]:{id:y.Calculated,displayName:"Calculated",scope:V.Property,description:"Auto-calculated field value",category:K.Computed,applicableDataTypes:["string","number","boolean","date","datetime","time","binary"],hasConfig:!0},[y.Derived]:{id:y.Derived,displayName:"Derived",scope:V.Property,description:"Value derived from other fields",category:K.Computed,applicableDataTypes:["string"],hasConfig:!0}};var Ns;(function(o){o[o.Initializing=0]="Initializing",o[o.PendingDns=1]="PendingDns",o[o.Issuing=2]="Issuing",o[o.Active=3]="Active",o[o.Error=4]="Error"})(Ns||(Ns={}));var pe=class o extends Error{static E_VALIDATION_ERROR="E_VALIDATION_ERROR";code=o.E_VALIDATION_ERROR;issues;constructor(e,t){let i=e[0];super(t??`Validation failed: ${i?.path??""} - ${i?.message??""}`),this.name="OperationValidationException",this.issues=e,Error.captureStackTrace&&Error.captureStackTrace(this,o)}};function kr(o,e){if(o==="-")return;let t=new pe([{message:"Invalid pointer",path:`/${o}`}]),{length:i}=o;if(i>1&&o[0]==="0")throw t;let r=+o;if(Number.isNaN(r)||Math.abs(r).toString()!==o||r<0||r>e)throw t}function ii(o,e){let{length:t}=e,i=o,r;for(let s=0;s<t-1;s++){if(r=e[s],Array.isArray(i))kr(r,i.length);else if(typeof i!="object"||i===null)throw new Error("Cannot be walked");i instanceof Map?i=i.get(r):i instanceof Set?i=Array.from(i)[+r]:i=i[r]}if(r=e[t-1],Array.isArray(i))kr(r,i.length);else if(typeof i!="object"||i===null)throw new Error("Invalid target");return{token:r,parent:i}}function Ge(o,e){let t=e.tokens,i=t.length;if(i===0||i===1&&t[0]==="")throw new pe([{message:"Cannot walk empty path.",path:e.raw}]);try{let r=ii(o,t);return{token:r.token,parent:r.parent}}catch{throw new pe([{message:"Path not found.",path:e.raw}])}}var ul=["boolean","string","number","null"];function It(o){let e=typeof o;if(e==="boolean"||e==="string")return e;if(e==="number"&&Number.isFinite(o))return"number";if(e==="object"){if(Array.isArray(o)||o instanceof Set)return"array";if(o instanceof Map)return"object";if(o===null)return"null";if(e==="object")return"object"}}function vr(o){return o===void 0?!0:ul.includes(o)}function Ma(o,e="/"){return o.replace(/~0/g,"~").replace(/~1/g,e)}function Is(o,e="/"){let t="",i=o;typeof i=="number"&&(i=String(i));for(let r=0,s=i.length;r<s;r++){let a=i.charAt(r);a==="~"?t+="~0":a===e?t+="~1":t+=a}return t}function ue(o,e="/"){let t="";for(let i=0,r=o.length;i<r;i++)t+=e+Is(o[i],e);return t}function Be(o,e="/"){if(Array.isArray(o))return o;if(o.length===0)return[];if(o.charAt(0)!==e)throw new pe([{message:"Invalid pointer.",path:o}]);let t=[""],i=0;for(let r=1,s=o.length;r<s;r++){let a=o.charAt(r);if(a===e){let n=t[t.length-1];if(n==="constructor"||n==="__proto__")throw new Error("Prototype pollution attempt");t.push(""),i++}else a==="~"?o.charAt(r+1)==="1"?(t[i]+=e,r++):o.charAt(r+1)==="0"?(t[i]+="~",r++):t[i]+=a:t[i]+=a}return t}function Sr(o,e,t){let i,r;return typeof o=="string"?i=Be(o,t):i=o,typeof e=="string"?r=[e]:r=e,ue(i.concat(r),t)}function ml(o,e){if(o instanceof Set){let t=0;for(let i of o)e(i,t+=1)}else if(Array.isArray(o)||o instanceof Map)o.forEach(e);else if(typeof o=="object"&&o!==null)Object.keys(o).forEach(t=>{e(o[t],t)});else throw new TypeError(`${o} is not a structure`)}function za(o,e,t,i){i(o,e,t),!(o===null||typeof o!="object")&&ml(o,(r,s)=>{za(r,s,o,i)})}function _r(o,e){let t=Object.create(null);function i(s){for(let a in t)if(t[a]===s)return a}function r(s,a,n){let l=Sr(n&&i(n),a);t[l]=s}za(o,void 0,void 0,(s,a,n)=>{if(s!==null&&typeof s=="object"&&(n===void 0||a===void 0?r(s,[],""):r(s,a.toString(),n)),a===void 0||n===void 0)e(s,"");else{let l=i(n);e(s,Sr(l,a.toString()),n,l)}})}var ie=class o{_raw="";_tokens=[];_separator;_index;_parent;constructor(e,t="/"){if(e instanceof o&&e.separator===t)return e;this._separator=t,Array.isArray(e)?(this._tokens=e,this._raw=ue(e,this._separator)):typeof e=="string"?(this._raw=e,this._tokens=Be(e,this._separator)):(this._raw=e._raw,this._tokens=e._tokens)}get raw(){return this._raw}get tokens(){return[...this._tokens]}get separator(){return this._separator}getToken(e){return e<0||e>=this._tokens.length?null:this._tokens[e]}getParent(){return this._parent!==void 0?this._parent:(this._tokens.length===0||this._tokens.length===1&&this._tokens[0]===""?this._parent=null:this._parent=new o(this._tokens.slice(0,-1),this._separator),this._parent)}isRoot(){return this._tokens.length===0||this._tokens[0]===""}append(e){return new o([...this._tokens,String(e)],this._separator)}prefix(e){if(e<0||e>this._tokens.length)throw new Error("Levels out of bound.");return new o(this._tokens.slice(0,e),this._separator)}escape(e){return Is(e,this._separator)}unescape(e){return Ma(e,this._separator)}static encode(e,t="/"){return ue(e,t)}encode(e=this._separator){return ue(this._tokens,e)}static decode(e,t="/"){return Be(e,t)}find(e){let{tokens:t}=this;if(t.length===0)return e;let i;try{i=ii(e,t)}catch{return}let{token:r,parent:s}=i;return s[r]}findValue(e){return this.isRoot()?e:this.find(e)}findParentValue(e){return this.isRoot()?e:this.getParent().find(e)}static find(e,t){return new o(t).find(e)}findAndTest(e,t){let i=this.find(e);return{found:i!==void 0,value:i,equal:i===t}}static isValidArrayToken(e,t){if(e==="-")return;let i=new pe([{message:"Invalid pointer.",path:`/${e}`}]),{length:r}=e;if(r>1&&e[0]==="0")throw i;let s=+e;if(Number.isNaN(s)||Math.abs(s).toString()!==e||s<0||s>t)throw i}getIndex(){if(this._index!==void 0)return this._index;let e=this._tokens;if(e.length===0)return null;let t=e[e.length-1];if(t==="-")return-1;let i=parseInt(t,10);return isNaN(i)?null:i}static getIndex(e){return new o(e).getIndex()}setIndex(e){let t=this._tokens,i=t[t.length-1];if(i===void 0)return new o(`/${e}`,this._separator);if(isNaN(+i))return new o([...t,e.toString()],this._separator);let r=Array.from(t);return r[r.length-1]=e.toString(),new o(r,this._separator)}static index(e){let t=Object.create(null);return _r(e,(i,r)=>{t[r]=i}),t}static join(e,t,i){let r,s;if(typeof e=="string"?r=Be(e,i):r=e,typeof t=="string"){if(!t)return ue(r,i);let a=t,n=i||"/";a.startsWith(n)||(a=`${n}${a}`),s=Be(a,i)}else s=t;return ue(r.concat(s),i)}static unflatten(e){let t=Object.keys(e),i=e[""];for(let r of t){if(r==="")continue;let s=Be(r),a=ii(i,s),{parent:n,token:l}=a;n instanceof Map?n.set(l,e[r]):n instanceof Set?n.add(e[r]):Array.isArray(n)?n.push(e[r]):n[l]=e[r]}return i}static flatten(e){let t=Object.create(null);return _r(e,(i,r)=>{let s;Array.isArray(i)?s=[]:i instanceof Map?s=new Map:i instanceof Set?s=new Set:typeof i=="object"&&i!==null?s={}:s=i,t[r]=s}),t}equals(e){return e?["","/"].includes(this._raw)&&["/",""].includes(e._raw)?!0:this.raw===e.raw:!1}isAfter(e){let t=e.getIndex(),i=this.getIndex();return t===null||i===null||t===-1||i===-1?!1:t<i}isAfterOrAt(e){let t=e.getIndex(),i=this.getIndex();return t===null||i===null||t===-1||i===-1?!1:t!==null&&i!==null&&t<=i}contains(e){if(this.isRoot())return!0;let t=e.tokens;if(t.length<=this._tokens.length)return!1;for(let i=0;i<this._tokens.length;i++)if(this._tokens[i]!==t[i])return!1;return!0}parentEquals(e){let t=this.getParent();return t&&e?t.equals(e):t===e}};function Lt(o,e){let t=new ie(e);if(t.tokens.length===0||t.tokens.length===1&&t.tokens[0]==="")return o;let{parent:i,token:r}=Ge(o,t);if(Array.isArray(i))ie.isValidArrayToken(r,i.length);else if(typeof i=="object"&&i!==null&&!(r in i))throw new pe([{path:`/${r}`,message:"The target does not exists."}]);return i[r]}function Ze(o,e,t){let i=new ie(e),r=structuredClone(t);if(i.tokens.length===0||i.tokens.length===1&&i.tokens[0]==="")return{doc:r,previous:o};let{token:s,parent:a}=Ge(o,i),n,l;if(Array.isArray(a))s==="-"?(a.push(r),l=a.length-1):a.splice(parseInt(s,10),0,r);else{n=a[s];let c=a;c[s]=r}return{doc:o,previous:n,idx:l}}function gt(o,e){let t=new ie(e);if(t.tokens.length===0||t.tokens.length===1&&t.tokens[0]==="")return{doc:void 0,previous:o};let{parent:i,token:r}=Ge(o,t),s=i[r];if(s===void 0)throw new pe([{message:"Parent does not exists.",path:t.raw}]);return Array.isArray(i)?i.splice(parseInt(r,10),1):delete i[r],{doc:o,previous:s}}function ri(o,e,t){let i=new ie(e),r=structuredClone(t);if(i.tokens.length===0||i.tokens.length===1&&i.tokens[0]==="")return{doc:r,previous:o};let{parent:s,token:a}=Ge(o,i),n=s[a];if(n===void 0)throw new pe([{message:"Location not found.",path:i.raw}]);return s[a]=r,{doc:o,previous:n}}function xi(o,e,t){let i=new ie(e),r=new ie(t);if(i.tokens.length===0||i.tokens.length===1&&i.tokens[0]==="")return{doc:gt(o,i).previous,previous:o};let s=gt(o,i);return Ze(s.doc,r,s.previous)}function si(o,e,t){let i=new ie(e),r=new ie(t),s=Lt(o,i);return e===""||e==="/"?{doc:s,previous:o}:Ze(o,r,s)}function Va(o){let e=[];return o.forEach(t=>{e.push(t)}),e}function Fa(o){let e=Object.create(null);return o.forEach((t,i)=>{e[i]=t}),e}function js(o,e,t,i){let r=It(o),s=It(e);if(r!==s)return!1;switch(r){case"number":return o===0&&1/o===-1/0?e===0&&1/e===-1/0:o===e;case"string":case"null":case"boolean":return o===e;default:}let a,n,l=t.indexOf(o);if(l!==-1)return i[l]===e;if(t.push(o),i.push(e),r==="array"){o instanceof Set&&(o=Va(o)),e instanceof Set&&(e=Va(e));let c=o,p=e;if(c.length!==p.length)return t.pop(),i.pop(),!1;for(a=0,n=c.length;a<n;a++)if(!js(c[a],p[a],t,i))return t.pop(),i.pop(),!1;return!0}if(r==="object"){o instanceof Map&&(o=Fa(o)),e instanceof Map&&(e=Fa(e));let c=o,p=e,u=Object.keys(c),m=Object.keys(p);if(u.length!==m.length)return t.pop(),i.pop(),!1;for(u.sort(),m.sort(),a=0,n=u.length;a<n;a++){let h=u[a],f=m[a];if(h!==f||!Object.prototype.hasOwnProperty.call(p,h)||!js(c[h],p[h],t,i))return t.pop(),i.pop(),!1}return t.pop(),i.pop(),!0}return t.pop(),i.pop(),!0}function Qe(o,e){return js(o,e,[],[])}function Ja(o){let e=o.command("files").description("Manage files and metadata");e.command("list").description("List files in an organization").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--kind <kind>","Filter by file kind (e.g. domain, api, folder)").option("--parent <parent>","Filter by parent folder ID").action(async t=>{let i=new B({format:P.resolved.format}),r=P.resolved,s=t.org||r.org;S.debug(`[files:list] Listing files for org: ${s}, kind: ${t.kind||"all"}, parent: ${t.parent||"root"}`),s||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1));try{let a=te(),n={};if(t.parent&&(n.parent=t.parent),t.kind){let u=qa(t.kind);n.filter={field:"kind",operator:"eq",value:u}}let c=(await a.files.list(s,n,{token:a.token})).data||[];S.debug(`[files:list] Found ${c.length} files.`);let p=c.map(u=>({id:u.key,name:u.info?.name||"",kind:u.kind,isShortcut:u.isShortcut?"Yes":"No"}));i.list(p,["id","name","kind","isShortcut"],{headers:["ID","NAME","KIND","SHORTCUT"]})}catch(a){let n=se(a);i.error(n),process.exit(1)}}),e.command("create").description("Create a new file metadata record (and optionally upload media)").option("--name <name>","Name of the file").option("--kind <kind>","Kind of the file (e.g., domain, api)").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--parent <parent>","Parent folder ID").option("--media <path>","Local path to the file content/media to upload").option("--stdin","Read media content from STDIN").action(async t=>{let i=new B({format:P.resolved.format}),r=P.resolved,s=t.org||r.org;S.debug(`[files:create] Creating file with options: name=${t.name}, kind=${t.kind}, org=${s}, parent=${t.parent}, media=${t.media}, stdin=${t.stdin}`),s||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1)),t.media&&t.stdin&&(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:"Cannot specify both --media <path> and --stdin"}),process.exit(1));let a=t.name;!a&&process.stdout.isTTY&&(a=await Je("Enter file name:")),a||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Name is required.",detail:"Specify --name <name>."}),process.exit(1));let n=t.kind;!n&&process.stdout.isTTY&&(n=await ft("Select file kind:",[{name:"API Domain / Schema (domain)",value:"domain"},{name:"API Schema (api)",value:"api"},{name:"Folder (folder)",value:"folder"}])),n||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Kind is required.",detail:"Specify --kind <kind> (allowed: api, domain, folder)."}),process.exit(1));try{let l;if(t.media){let w=gl.resolve(t.media);S.debug(`[files:create] Reading local media file from path: ${w}`),Ka.existsSync(w)||(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Media file not found at path: ${w}`}),process.exit(1)),l=Ka.readFileSync(w,"utf8")}else t.stdin&&(S.debug("[files:create] Reading media content from STDIN..."),l=await yl());let c,p;if(l!==void 0){try{p=JSON.parse(l)}catch{throw new Error("invalid API now platform file")}if(!p||typeof p!="object"||Array.isArray(p)||!("key"in p)||typeof p.key!="string"||!p.key.trim())throw new Error("invalid API now platform file");c=p.key}let u=te(),m=qe.createSchema({kind:qa(n),info:{name:a},key:c}),h={};t.parent&&(h.parent=t.parent),S.debug("[files:create] Sending request to create file metadata...");let f=await u.files.createMeta(m,s,h,{token:u.token}),k=f.key;S.debug(`[files:create] Created file metadata successfully. Key: ${k}`),l!==void 0&&(S.debug("[files:create] Uploading file media..."),await u.files.createMedia(p,s,k,{},{token:u.token}),S.debug("[files:create] Media uploaded successfully.")),i.success("File created successfully!",f)}catch(l){let c=se(l);i.error({code:"CLI_ERR_API_FAILURE",...c}),process.exit(1)}}),e.command("read").description("Read file metadata or media content").option("--id <fid>","File ID").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--meta","Read file metadata (default)").option("--media","Read file media/content").action(async t=>{let i=new B({format:P.resolved.format}),r=P.resolved,s=t.org||r.org;S.debug(`[files:read] Reading file with options: id=${t.id}, org=${s}, meta=${t.meta}, media=${t.media}`),s||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1));let a=t.id;if(!a&&process.stdout.isTTY){S.debug("[files:read] ID not provided, fetching files list for interactive selection...");try{let n=te(),c=(await n.files.list(s,{},{token:n.token})).data||[];c.length>0&&(a=await ft("Select a file to read:",c.map(p=>({name:`${p.info?.name||"Unnamed"} (${p.kind})`,value:p.key}))))}catch{}}a||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"File ID is required.",detail:"Specify --id <fid>."}),process.exit(1));try{let n=te();if(t.media){S.debug(`[files:read] Fetching media content for file ID '${a}'...`);let c=(await n.files.readMedia(s,a,{token:n.token})).media;S.debug("[files:read] Media retrieved successfully."),r.format==="json"?console.log(JSON.stringify(c,null,2)):console.log(typeof c=="object"&&c!==null?JSON.stringify(c,null,2):c)}else{S.debug(`[files:read] Fetching metadata for file ID '${a}'...`);let l=await n.files.read(s,a,{token:n.token});S.debug("[files:read] Metadata retrieved successfully."),i.object(l)}}catch(n){let l=se(n);i.error(l),process.exit(1)}})}function qa(o){let e=o.toLowerCase();if(e==="api")return fs;if(e==="domain")return ut;if(e==="folder")return Re;throw new Error(`Unsupported file kind "${o}". Allowed: api, domain, folder`)}async function yl(){return new Promise((o,e)=>{let t="";process.stdin.setEncoding("utf8"),process.stdin.on("data",i=>{t+=i}),process.stdin.on("end",()=>{o(t)}),process.stdin.on("error",i=>{e(i)})})}function Ga(o){let e=o.command("catalog").description("Manage Data Catalog items");e.command("publish").description("Publish a data domain file to the data catalog").option("--file <fid>","File ID of the data domain").option("--name <name>","Name for the catalog entry").option("--description <desc>","Description of the catalog entry").option("--scope <scope>","Publish scope: public, organization, private").option("-v, --catalog-version <ver>","Semantic version (e.g. 1.0.0)").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--lifecycle <lifecycle>","Version lifecycle status (dev, beta, stable)","stable").option("--changelog <changelog>","Changelog description for this version").action(async t=>{let i=new B({format:P.resolved.format}),r=P.resolved;S.debug(`[catalog:publish] Starting publish flow with options: file=${t.file}, name=${t.name}, scope=${t.scope}, version=${t.catalogVersion}, org=${t.org||r.org}, lifecycle=${t.lifecycle}`);let s=t.org||r.org;s||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1));let a=t.file;if(!a&&process.stdout.isTTY){S.debug("[catalog:publish] File ID not provided; listing data domain files for selection...");try{let h=te(),k=(await h.files.list(s,{filter:{field:"kind",operator:"eq",value:ut}},{token:h.token})).data||[];k.length>0&&(a=await ft("Select a data domain file to publish:",k.map(w=>({name:`${w.info?.name||"Unnamed"} (${w.key})`,value:w.key}))))}catch{}}a||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"File ID is required.",detail:"Specify --file <fid>."}),process.exit(1));let n=t.name;!n&&process.stdout.isTTY&&(n=await Je("Enter catalog entry name:")),n||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Name is required.",detail:"Specify --name <name>."}),process.exit(1));let l=t.description;!l&&process.stdout.isTTY&&(l=await Je("Enter catalog entry description:")),l||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Description is required.",detail:"Specify --description <desc>."}),process.exit(1));let c=t.scope;!c&&process.stdout.isTTY&&(c=await ft("Select publish scope:",[{name:"Public (public)",value:"public"},{name:"Organization (organization)",value:"organization"},{name:"Private (private)",value:"private"}])),c||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Scope is required.",detail:"Specify --scope <scope> (allowed: public, organization, private)."}),process.exit(1));let p=["public","organization","private"];p.includes(c)||(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Invalid scope '${c}'.`,detail:`Allowed: ${p.join(", ")}`}),process.exit(1));let u=t.catalogVersion;!u&&process.stdout.isTTY&&(u=await Je("Enter semantic version:","1.0.0")),u||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Version is required.",detail:"Specify --catalog-version <ver> or -v <ver>."}),process.exit(1));let m=["dev","beta","stable"];m.includes(t.lifecycle)||(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Invalid lifecycle '${t.lifecycle}'.`,detail:`Allowed: ${m.join(", ")}`}),process.exit(1));try{let h=te(),f=null;S.debug(`[catalog:publish] Checking publication status for file ID '${a}' in organization '${s}'...`);try{f=(await h.dataCatalog.checkPublicationStatus(a,s,{token:h.token})).key,S.debug(`[catalog:publish] Found existing catalog entry key: ${f}`)}catch(b){if(se(b).status!==404)throw b;S.debug("[catalog:publish] Catalog entry does not exist yet.")}if(f)S.debug(`[catalog:publish] Using existing catalog entry key: ${f}`),P.resolved.format!=="json"&&console.log(`Catalog entry already exists (ID: ${f}). Publishing new version...`);else{S.debug("[catalog:publish] Creating a new catalog entry..."),P.resolved.format!=="json"&&console.log("Catalog entry does not exist. Creating new catalog entry...");let b={key:"",kind:mt,organization:s,file:a,scope:c,name:n,description:l,publishedBy:"",publishedAt:0,createdAt:0,updatedAt:0,tags:[]};f=(await h.dataCatalog.publish(b,{token:h.token})).key,S.debug(`[catalog:publish] Created new catalog entry with key: ${f}`)}let k=_i.createSchema({scope:c,lifecycle:t.lifecycle,version:u,changelog:t.changelog||void 0});S.debug(`[catalog:publish] Publishing version '${u}' for catalog key '${f}'...`);let w=await h.dataCatalog.publishVersion(f,k,{token:h.token});S.debug(`[catalog:publish] Version published successfully. Version key: ${w.key}`),i.success(`Successfully published version '${u}' to the data catalog!`,w)}catch(h){let f=se(h);i.error(f),process.exit(1)}}),e.command("list").description("List published data catalog items or versions of a specific catalog entry").option("--scope <scope>","Filter by scope: all, public, organization, private","all").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--key <key>","Data catalog item key to list all versions of a specific data domain").action(async t=>{let i=new B({format:P.resolved.format}),r=P.resolved,s=t.org||r.org;S.debug(`[catalog:list] Listing catalog with options: scope=${t.scope}, org=${s}, key=${t.key}`);let a=["all","public","organization","private"];a.includes(t.scope)||(i.error({message:`Invalid scope '${t.scope}'. Allowed: ${a.join(", ")}`}),process.exit(1)),["organization","private"].includes(t.scope)&&!s&&(i.error({message:`Organization ID (--org <oid>) is required when filtering by scope '${t.scope}'.`}),process.exit(1));try{let n=te();if(t.key){S.debug(`[catalog:list] Fetching versions for catalog entry key '${t.key}'...`);let c=(await n.dataCatalog.listVersions(t.key,{token:n.token})).data||[];S.debug(`[catalog:list] Found ${c.length} versions.`);let p=c.map(u=>({key:u.key,version:u.version,published:new Date(u.published).toLocaleString()}));i.list(p,["key","version","published"],{headers:["VERSION KEY","VERSION","PUBLISHED AT"]})}else{let l=[];if(t.scope==="all"){S.debug("[catalog:list] Fetching public catalog entries...");let m=await n.dataCatalog.list({scope:"public",oid:s},{token:n.token});if(l.push(...m.data||[]),s){S.debug(`[catalog:list] Fetching organization catalog entries for org '${s}'...`);try{let h=await n.dataCatalog.list({scope:"organization",oid:s},{token:n.token});l.push(...h.data||[])}catch{S.debug("[catalog:list] Failed to fetch organization catalog entries.")}S.debug(`[catalog:list] Fetching private catalog entries for org '${s}'...`);try{let h=await n.dataCatalog.list({scope:"private",oid:s},{token:n.token});l.push(...h.data||[])}catch{S.debug("[catalog:list] Failed to fetch private catalog entries.")}}}else{S.debug(`[catalog:list] Fetching catalog entries for scope '${t.scope}' and org '${s}'...`);let m=await n.dataCatalog.list({scope:t.scope,oid:s},{token:n.token});l.push(...m.data||[])}S.debug(`[catalog:list] Total raw catalog entries fetched: ${l.length}`);let c=new Set,p=l.filter(m=>{let h=m.key;return c.has(h)?!1:(c.add(h),!0)});S.debug(`[catalog:list] Total unique catalog entries: ${p.length}`);let u=p.map(m=>{let h=m.versions&&m.versions[0]?m.versions[0].version:"N/A";return{key:m.key,name:m.name,scope:m.scope,lastVersion:h,organization:m.organization||"N/A"}});i.list(u,["key","name","scope","lastVersion","organization"],{headers:["KEY","NAME","SCOPE","LAST VERSION","ORGANIZATION"]})}}catch(n){let l=se(n);i.error(l),process.exit(1)}})}import rs from"node:fs";import xo from"node:path";var Ai=class o{description;key;rate;interval;burst;constructor(e={}){this.description=e.description,this.key=o.isRateLimitRuleKey(e.key)?structuredClone(e.key):void 0,this.rate=typeof e.rate=="number"?e.rate:void 0,this.interval=o.isRateLimitRuleInterval(e.interval)?e.interval:void 0,this.burst=typeof e.burst=="number"?e.burst:void 0}toJSON(){let e={};return this.description&&(e.description=this.description),o.isRateLimitRuleKey(this.key)&&(e.key=structuredClone(this.key)),typeof this.rate=="number"&&(e.rate=this.rate),o.isRateLimitRuleInterval(this.interval)&&(e.interval=this.interval),typeof this.burst=="number"&&(e.burst=this.burst),e}static isRateLimitRuleInterval(e){return typeof e!="string"?!1:["second","minute","hour","day"].includes(e)}static isRateLimitRuleKey(e){if(typeof e!="object"||e===null)return!1;let t=e;return"type"in t&&(t.type==="ip"||t.type==="userId"||t.type==="role")}};var yt=class{rules;constructor(e={}){this.rules=e.rules?.map(t=>new Ai(t))||[]}toJSON(){return{rules:this.rules.map(e=>e.toJSON())}}};var D;(function(o){o.PRE_FETCH="pre-fetch",o.FETCH="fetch",o.POST_FETCH="post-fetch"})(D||(D={}));var be=class{type;parent;inheritable=!0;mandatory;#e;get metadata(){if(!this.#e)throw new Error("Metadata not set for access rule "+this.type);return this.#e}constructor(e,t,i={}){this.parent=e,this.type=i.type??"",this.mandatory=i.mandatory??!1,this.#e={...t,...i.metadata}}toJSON(){let e={type:this.type};return this.mandatory&&(e.mandatory=!0),this.#e&&(e.metadata=this.#e),e}};var xr=class extends be{type;constructor(e,t={}){super(e,{list:D.PRE_FETCH,create:D.PRE_FETCH,search:D.PRE_FETCH,read:D.PRE_FETCH,update:D.PRE_FETCH,delete:D.PRE_FETCH},t),this.type="allowAuthenticated"}};var Ar=class extends be{type;constructor(e,t={}){super(e,{list:D.PRE_FETCH,create:D.PRE_FETCH,search:D.PRE_FETCH,read:D.PRE_FETCH,update:D.PRE_FETCH,delete:D.PRE_FETCH},t),this.type="allowPublic"}};var Er=class extends be{type;domains;constructor(e,t={}){super(e,{list:D.PRE_FETCH,create:D.PRE_FETCH,search:D.PRE_FETCH,read:D.PRE_FETCH,update:D.PRE_FETCH,delete:D.PRE_FETCH},t),this.type="matchEmailDomain",this.domains=t.domains?[...t.domains]:[]}toJSON(){return{...super.toJSON(),domains:structuredClone(this.domains)}}};var Nr=class extends be{type;inheritable=!1;property;target;constructor(e,t={}){super(e,{list:D.FETCH,search:D.FETCH,create:D.POST_FETCH,read:D.POST_FETCH,update:D.POST_FETCH,delete:D.POST_FETCH},t),this.type="matchResourceOwner",this.property=t.property,this.target=t.target??"property"}toJSON(){let e={...super.toJSON(),target:this.target};return this.property&&(e.property=this.property),e}};var Ir=class extends be{type;inheritable=!1;attribute;value;operator;constructor(e,t={}){super(e,{list:D.FETCH,search:D.FETCH,read:D.POST_FETCH,update:D.POST_FETCH,delete:D.POST_FETCH},t),this.type="matchResourceAttribute",this.attribute=t.attribute??"",this.value=t.value??"",this.operator=t.operator??"equal"}toJSON(){let e={...super.toJSON(),attribute:this.attribute,value:this.value};return this.operator&&(e.operator=this.operator),e}};var jr=class extends be{type;inheritable=!1;allowedStatuses;deniedStatuses;constructor(e,t={}){super(e,{list:D.FETCH,search:D.FETCH,read:D.POST_FETCH,update:D.POST_FETCH,delete:D.POST_FETCH},t),this.type="lifecycleStatus",this.allowedStatuses=t.allowedStatuses?[...t.allowedStatuses]:[],this.deniedStatuses=t.deniedStatuses?[...t.deniedStatuses]:[]}toJSON(){let e={...super.toJSON()};return this.allowedStatuses.length>0&&(e.allowedStatuses=structuredClone(this.allowedStatuses)),this.deniedStatuses.length>0&&(e.deniedStatuses=structuredClone(this.deniedStatuses)),e}};var $r=class extends be{type;property;value;constructor(e,t={}){super(e,{list:D.PRE_FETCH,create:D.PRE_FETCH,search:D.PRE_FETCH,read:D.PRE_FETCH,update:D.PRE_FETCH,delete:D.PRE_FETCH},t),this.type="matchUserProperty",this.property=t.property??"",this.value=t.value??""}toJSON(){return{...super.toJSON(),property:this.property,value:this.value}}};var Or=class extends be{type;role;constructor(e,t={}){super(e,{list:D.PRE_FETCH,create:D.PRE_FETCH,search:D.PRE_FETCH,read:D.PRE_FETCH,update:D.PRE_FETCH,delete:D.PRE_FETCH},t),this.type="matchUserRole",this.role=t.role?[...t.role]:[]}toJSON(){return{...super.toJSON(),role:structuredClone(this.role)}}};function ai(o,e){switch(e.type){case"allowAuthenticated":return new xr(o,e);case"allowPublic":return new Ar(o,e);case"matchEmailDomain":return new Er(o,e);case"matchResourceOwner":return new Nr(o,e);case"matchResourceAttribute":return new Ir(o,e);case"lifecycleStatus":return new jr(o,e);case"matchUserProperty":return new $r(o,e);case"matchUserRole":return new Or(o,e);default:throw new g("Unknown access rule kind",{code:"E_UNKNOWN_ACCESS_RULE_KIND",status:422})}}var Se=class{kind;accessRules;rateLimiting;projection;parent;constructor(e,t={}){this.parent=e,this.kind=t.kind||"",this.accessRules=t.accessRules?t.accessRules.map(i=>ai(this,i)):[],this.rateLimiting=t.rateLimiting?new yt(t.rateLimiting):void 0,t.projection&&(this.projection=structuredClone(t.projection))}toJSON(){let e={kind:this.kind};return this.accessRules.length&&(e.accessRules=this.accessRules.map(t=>t.toJSON())),this.rateLimiting&&(e.rateLimiting=this.rateLimiting.toJSON()),this.projection&&(e.projection=structuredClone(this.projection)),e}getAllRules(){return[...this.parent.getAllRules(),...this.accessRules]}getAllRateLimiters(){let e=this.parent.getAllRateLimiters();return this.rateLimiting&&e.push(this.rateLimiting),e}};var Ei=class extends Se{kind;constructor(e,t={}){super(e,t),this.kind="create"}toJSON(){return{...super.toJSON(),kind:"create"}}static isCreateAction(e){return e.kind==="create"}static isCreateActionSchema(e){return e.kind==="create"}};var Mt=class extends Se{kind;strategy;retentionPeriod;constructor(e,t={}){super(e,t),this.kind="delete",this.strategy=t.strategy||"soft",this.retentionPeriod=t.retentionPeriod??30}toJSON(){return{...super.toJSON(),kind:"delete",strategy:this.strategy,retentionPeriod:this.retentionPeriod}}static isDeleteAction(e){return e.kind==="delete"}static isDeleteActionSchema(e){return e.kind==="delete"}};var bt=class extends Se{kind;cacheTtl;constructor(e,t={}){super(e,t),this.kind="list",this.cacheTtl=t.cacheTtl}toJSON(){let e={...super.toJSON(),kind:"list"};return this.cacheTtl!==void 0&&(e.cacheTtl=this.cacheTtl),e}static isListAction(e){return e.kind==="list"}static isListActionSchema(e){return e.kind==="list"}};var zt=class extends Se{kind;constructor(e,t={}){super(e,t),this.kind="read"}toJSON(){return{...super.toJSON(),kind:"read"}}static isReadAction(e){return e.kind==="read"}static isReadActionSchema(e){return e.kind==="read"}};var wt=class extends Se{kind;maxAstDepth;constructor(e,t={}){super(e,t),this.kind="search",this.maxAstDepth=t.maxAstDepth}toJSON(){let e={...super.toJSON(),kind:"search"};return this.maxAstDepth!==void 0&&(e.maxAstDepth=this.maxAstDepth),e}static isSearchActionSchema(e){return e.kind==="search"}static isSearchAction(e){return e.kind==="search"}};var Vt=class extends Se{kind;allowedMethods;constructor(e,t={}){super(e,t),this.kind="update",this.allowedMethods=t.allowedMethods?[...t.allowedMethods]:["PATCH"]}toJSON(){return{...super.toJSON(),kind:"update",allowedMethods:structuredClone(this.allowedMethods)}}static isUpdateAction(e){return e.kind==="update"}static isUpdateActionSchema(e){return e.kind==="update"}};function $s(o,e){switch(e.kind){case"list":return new bt(o,e);case"read":return new zt(o,e);case"create":return new Ei(o,e);case"update":return new Vt(o,e);case"delete":return new Mt(o,e);case"search":return new wt(o,e);default:throw new g("Unknown action kind",{code:"E_UNKNOWN_ACTION_KIND",status:422})}}function Ba(o,e){switch(e){case"list":return new bt(o);case"read":return new zt(o);case"create":return new Ei(o);case"update":return new Vt(o);case"delete":return new Mt(o);case"search":return new wt(o);default:throw new g("Unknown action kind",{code:"E_UNKNOWN_ACTION_KIND",status:422})}}var v;(function(o){o.TYPE_UNSPECIFIED="TYPE_UNSPECIFIED",o.STRING="STRING",o.NUMBER="NUMBER",o.INTEGER="INTEGER",o.BOOLEAN="BOOLEAN",o.ARRAY="ARRAY",o.OBJECT="OBJECT",o.NULL="NULL"})(v||(v={}));var Wa={[y.Address]:{type:"object",properties:{}},[y.Calculated]:{type:"object",description:"Use Calculated when you need mathematical operations, aggregations, or complex business logic.",properties:{formula:{type:"string",description:'Formula to calculate the value (e.g., "price * quantity").'},dependencies:{type:"array",items:{type:"string"},description:"List of field keys this calculation depends on."},recalculateOnUpdate:{type:"boolean",default:!0,description:"Whether to automatically recalculate when source fields change."},allowManualOverride:{type:"boolean",default:!1,description:"Whether users can manually override the calculated value."}}},[y.Categories]:{type:"object",description:"Controls allowed categories, hierarchy, and formatting for associations.",properties:{allowedCategories:{type:"array",items:{type:"string"},description:"Pre-defined list of allowed categories."},allowCustomCategories:{type:"boolean",default:!0,description:"Whether users can create new categories not in the allowed list."},allowHierarchy:{type:"boolean",default:!0,description:"Whether categories can have sub-categories (parent-child relationship)."},maxDepth:{type:"number",description:"Maximum nesting depth for category hierarchies."},caseSensitive:{type:"boolean",default:!1},allowUnicode:{type:"boolean",default:!1}}},[y.City]:{type:"object",properties:{}},[y.ClientIPAddress]:{type:"object",properties:{}},[y.Country]:{type:"object",properties:{format:{type:"string",enum:["ISO_3166_Alpha_2","ISO_3166_Alpha_3","Name"],default:"ISO_3166_Alpha_2",description:"Format to store the country in. Alpha_2 is standard 2-letter code (e.g. US), Alpha_3 is 3-letter (e.g. USA), Name is full name."},allowedCountries:{type:"array",items:{type:"string"},description:"List of allowed countries in the specified format. If empty, all are allowed."},disallowedCountries:{type:"array",items:{type:"string"},description:"List of explicitly forbidden countries."}}},[y.CreatedTimestamp]:{type:"object",properties:{}},[y.Currency]:{type:"object",description:"Controls monetary value storage, validation, currency handling, and precision.",properties:{storageFormat:{type:"string",enum:["decimal","integer_cents","complex_object"],default:"decimal",description:"Format to store currency. decimal relies on decimal floating points, integer_cents stores values as an integer of cents, and complex_object stores both amount and currency code."},defaultCurrency:{type:"string",default:"USD",description:"Default ISO 4217 currency code if none is provided."},allowedCurrencies:{type:"array",items:{type:"string"},description:"List of allowed ISO 4217 currency codes. If empty, all are allowed."},decimalPlaces:{type:"number",default:2,description:"Number of decimal places to enforce/round to."},allowNegative:{type:"boolean",default:!1,description:"Whether to allow negative currency values."},validateCurrencyCode:{type:"boolean",default:!0,description:"Whether to validate the currency code against standard ISO codes."}}},[y.DeletedFlag]:{type:"object",properties:{}},[y.DeletedTimestamp]:{type:"object",properties:{}},[y.Derived]:{type:"object",description:"Use Derived when you need to combine, format, or transform existing field values",properties:{sourceFields:{type:"array",items:{type:"string"},description:"Array of field keys that this derived field depends on."},transformation:{type:"string",description:"Name of a transformation function to apply to the source fields."},recalculateOnUpdate:{type:"boolean",default:!0,description:"Whether to automatically recalculate when source fields change."},allowManualOverride:{type:"boolean",default:!1,description:"Whether users can manually override the derived value."}}},[y.Description]:{type:"object",description:"The description field doesn't have any configuration options.",properties:{}},[y.Email]:{type:"object",properties:{allowedDomains:{type:"array",items:{type:"string"},description:"List of allowed domains (e.g. example.com). If empty, all valid domains are permitted."},disallowedDomains:{type:"array",items:{type:"string"},description:"List of disallowed domains (e.g. example.com)."},requireVerification:{type:"boolean",default:!0,description:"Whether the email address requires a verification confirm loop."},allowSubaddressing:{type:"boolean",default:!0,description:"Whether to allow plus addressing e.g. user+tag@example.com"},allowInternational:{type:"boolean",default:!0,description:"Whether to allow internationalized domain names and characters in the local part."}}},[y.FileURL]:{type:"object",properties:{}},[y.GeospatialCoordinates]:{type:"object",properties:{format:{type:"string",enum:["lat,lon","lon,lat","postgis","degree","wkt","geojson"],default:"lat,lon"},spatialReferenceSystem:{type:"string",enum:["EPSG:4326","EPSG:3857","EPSG:4269","EPSG:4267"],default:"EPSG:4326",description:"The spatial reference system (SRS) for the coordinates. Defaults to WGS84 (EPSG:4326)."},defaultDistanceUnit:{type:"string",enum:["meters","kilometers","miles","feet","yards","nautical_miles"],default:"meters",description:"The default distance unit for spatial queries."},enableSpatialIndexing:{type:"boolean",default:!0},enableValidation:{type:"boolean",default:!0},validationBounds:{type:"object",properties:{minLatitude:{type:"number"},maxLatitude:{type:"number"},minLongitude:{type:"number"},maxLongitude:{type:"number"}},description:"Custom validation rules for coordinate bounds in decimal degrees."},enablePostGISIntegration:{type:"boolean",default:!0},postGISGeometryType:{type:"string",enum:["POINT","LINESTRING","POLYGON","MULTIPOINT","MULTILINESTRING","MULTIPOLYGON"],default:"POINT",description:"The PostGIS geometry type to use for storage. Defines the shape of the data and the types of queries."},enableDistanceQueries:{type:"boolean",default:!0},maxQueryDistance:{type:"number",default:1e5},enableBoundingBoxQueries:{type:"boolean",default:!0},enablePolygonQueries:{type:"boolean",default:!1},enableGeoClustering:{type:"boolean",default:!1},maxClusterPrecision:{type:"number"},apiEndpointPrefix:{type:"string",default:"/nearby"},includeElevation:{type:"boolean",default:!1},coordinatePrecision:{type:"number",default:6},enableReverseGeocoding:{type:"boolean",default:!1}}},[y.HTML]:{type:"object",properties:{allowedTags:{type:"array",items:{type:"string"},description:"List of allowed HTML tags. Tags not in this list will be stripped."},sanitizeLevel:{type:"string",enum:["strict","moderate","none"],default:"strict",description:"Sanitization level. Strict removes almost all styling and scripts. Moderate allows some unsafe constructs like scripts. None bypasses sanitization."},allowImages:{type:"boolean",default:!0},allowLinks:{type:"boolean",default:!0},allowTables:{type:"boolean",default:!0},allowForms:{type:"boolean",default:!1},allowScripts:{type:"boolean",default:!1},allowIframes:{type:"boolean",default:!1},allowEmbedded:{type:"boolean",default:!1},allowStyles:{type:"boolean",default:!1},allowDataAttributes:{type:"boolean",default:!1}}},[y.ImageURL]:{type:"object",properties:{}},[y.Markdown]:{type:"object",properties:{allowedTags:{type:"array",items:{type:"string"},description:"Allowed HTML tags within the Markdown."},sanitizeLevel:{type:"string",enum:["strict","moderate","none"],default:"strict",description:"Sanitization level for HTML within Markdown. Strict removes all. Moderate allows basic formatting tags. None bypasses sanitization."},allowImages:{type:"boolean",default:!0},allowLinks:{type:"boolean",default:!0},allowTables:{type:"boolean",default:!0},allowHtml:{type:"boolean",default:!1},allowFootnotes:{type:"boolean",default:!1},allowTaskLists:{type:"boolean",default:!1},allowStrikethrough:{type:"boolean",default:!0},allowMath:{type:"boolean",default:!1}}},[y.Name]:{type:"object",properties:{}},[y.Password]:{type:"object",properties:{requireSpecialChars:{type:"boolean",default:!1},requireNumbers:{type:"boolean",default:!1},requireUppercase:{type:"boolean",default:!1},requireLowercase:{type:"boolean",default:!1},encryptionAlgorithm:{type:"string",enum:["bcrypt","argon2","scrypt"],default:"bcrypt",description:"The algorithm used to hash the password before storage."},saltRounds:{type:"number",default:12,description:"Work factor for hashing algorithms like bcrypt or argon2."},maxAge:{type:"number",description:"Maximum age in days before the password expires."},preventReuse:{type:"boolean",default:!1,description:"Whether to prevent reuse of previous passwords."},preventReuseCount:{type:"number",default:5,description:"Number of previous passwords to remember and prevent reuse of."},customPattern:{type:"string",description:"Custom regex pattern for password validation."},customErrorMessage:{type:"string"},allowCommonPasswords:{type:"boolean",default:!1,description:"Whether to check against dictionaries of common/compromised passwords."}}},[y.Phone]:{type:"object",properties:{allowedCountries:{type:"array",items:{type:"string"},description:"List of allowed country codes (ISO 3166-1 alpha-2 format)."},requireCountryCode:{type:"boolean",default:!0,description:"Whether the phone number must include a country code."},format:{type:"string",enum:["national","international","custom"],default:"international",description:"Format for phone validation and display. national omits country code, international uses E.164 (+1...), custom uses customFormat pattern."},customFormat:{type:"string",description:'Custom pattern like "(###) ###-####"; only used when format is custom.'},allowExtension:{type:"boolean",default:!1},requireVerification:{type:"boolean",default:!1},verificationMethod:{type:"string",enum:["sms","call"],default:"sms"}}},[y.PostalCode]:{type:"object",properties:{validate:{type:"boolean",default:!1,description:"Whether to validate the postal code format."},allowedPostalCodes:{type:"array",items:{type:"string"},description:"List of exactly allowed postal codes."},disallowedPostalCodes:{type:"array",items:{type:"string"},description:"List of explicitly forbidden postal codes."}}},[y.PublicUniqueName]:{type:"object",properties:{sourceField:{type:"string",description:"The field to derive the public unique name from."},separator:{type:"string",default:"-",description:'Character used to replace spaces or combine multiple words (e.g. "-" for slugs).'},caseSensitive:{type:"boolean",default:!1},allowUnicode:{type:"boolean",default:!1,description:"Whether to allow non-ASCII characters."},allowDuplicates:{type:"boolean",default:!1,description:"Whether to append random suffix if the name is already taken. Defaults to failing uniqueness."},fallbackField:{type:"string",description:"A field to use if the source field is empty."}}},[y.Region]:{type:"object",properties:{}},[y.ResourceOwnerIdentifier]:{type:"object",properties:{}},[y.RelationalResourceOwner]:{type:"object",properties:{}},[y.CreatedBy]:{type:"object",description:"Links the record to the user who created it (automatically populated on creation, read-only after).",properties:{}},[y.UpdatedBy]:{type:"object",description:"Links the record to the user who last updated it (automatically populated on every update).",properties:{}},[y.DeletedBy]:{type:"object",description:"Links the record to the user who soft-deleted it (automatically populated when soft-deleted).",properties:{}},[y.SKU]:{type:"object",properties:{validationMode:{type:"string",enum:["strict","lenient","custom"],default:"strict",description:"Validation strictness. strict enforces alphanumeric + hyphens/underscores. lenient allows more special chars. custom uses customPattern."},customPattern:{type:"string",description:"Regex pattern applied when validationMode is custom."},caseMode:{type:"string",enum:["uppercase","lowercase","preserve"],default:"uppercase"},prefix:{type:"string",description:"Required prefix for all SKUs."},enforceUniqueness:{type:"boolean",default:!0},autoGenerate:{type:"boolean",default:!1,description:"Whether to automatically generate the SKU."},autoGenerateSource:{type:"string",description:"Field to derive the SKU from, if autoGenerate is true."},validateReservedWords:{type:"boolean",default:!0},reservedValues:{type:"array",items:{type:"string"},description:"Specific SKUs that are not permitted to be used."}}},[y.Status]:{type:"object",properties:{allowedStates:{type:"array",items:{type:"string"},description:"Pre-defined list of valid states (e.g., draft, published, archived)."},defaultState:{type:"string",description:"The initial state assigned when an entity is created."},transitions:{type:"object",additionalProperties:{type:"array",items:{type:"string"}},description:"Map representing allowed state transitions. Key is current state and value is array of valid next states."},stateBehaviors:{type:"object",additionalProperties:{type:"object",properties:{isPublic:{type:"boolean",default:!0},isEditable:{type:"boolean",default:!0},isDeletable:{type:"boolean",default:!1},requiresApproval:{type:"boolean",default:!1},displayName:{type:"string"},description:{type:"string"},color:{type:"string"},icon:{type:"string"}}}},workflow:{type:"object",properties:{requiresApproval:{type:"boolean",default:!1},approvalRoles:{type:"array",items:{type:"string"}},sendNotifications:{type:"boolean",default:!1},notificationChannels:{type:"array",items:{type:"string",enum:["email","sms","push","webhook"]}},logHistory:{type:"boolean",default:!0},allowBulkChanges:{type:"boolean",default:!1}}},autoTransitions:{type:"array",items:{type:"object",properties:{from:{type:"string"},to:{type:"string"},condition:{type:"string"},requiresApproval:{type:"boolean",default:!1}},required:["from","to","condition"]}}}},[y.StreetAddress]:{type:"object",properties:{}},[y.StreetAddressSupplemental]:{type:"object",properties:{}},[y.Summary]:{type:"object",properties:{}},[y.Tags]:{type:"object",properties:{allowedTags:{type:"array",items:{type:"string"}},allowCustomTags:{type:"boolean",default:!0},caseSensitive:{type:"boolean",default:!1},allowUnicode:{type:"boolean",default:!1}}},[y.Title]:{type:"object",properties:{}},[y.UpdatedTimestamp]:{type:"object",properties:{}},[y.URL]:{type:"object",properties:{requireHttps:{type:"boolean",default:!1},allowQueryParams:{type:"boolean",default:!0},allowFragments:{type:"boolean",default:!0},allowInternational:{type:"boolean",default:!0},allowIP:{type:"boolean",default:!0},allowPort:{type:"boolean",default:!0},allowAuthentication:{type:"boolean",default:!1}}},[y.User]:{type:"object",properties:{}},[y.Username]:{type:"object",properties:{}},[y.UserRole]:{type:"object",properties:{}},[y.Version]:{type:"object",properties:{}}};var wl=[{functionDeclarations:[{name:"list_semantics",description:"List all available data semantics, their scopes, and whether they have configuration options.",parametersJsonSchema:{type:v.OBJECT,properties:{},required:[]}},{name:"get_semantic_details",description:"Get detailed information about a specific data semantic, notably its JSON configuration schema properties, to determine what additional config you might want to provide.",parametersJsonSchema:{type:v.OBJECT,properties:{semanticId:{type:v.STRING,description:"The exact ID of the semantic (e.g. Semantic#Password, Semantic#Tags)"}},required:["semanticId"]}},{name:"get_entity_details",description:"Get the full details of an entity given its key, including properties, associations, and tags.",parametersJsonSchema:{type:v.OBJECT,properties:{entityKey:{type:v.STRING,description:"The exact key/ID of the entity to fetch details for."}},required:["entityKey"]}},{name:"explain_schema",description:"Explains the schema of a data type.",parametersJsonSchema:{type:v.OBJECT,properties:{dataType:{type:v.STRING,description:"The data type (e.g. string, number, boolean, date, datetime, time, binary)"}},required:["dataType"]}}]}];var kt={type:v.OBJECT,properties:{id:{type:v.STRING},config:{type:v.OBJECT}},required:["id"]},Ya={type:v.OBJECT,properties:{key:{type:v.STRING,description:"The key of the target entity."},domain:{type:v.STRING,description:"The key of the target data domain. Only set when the target is in a different data domain."}},required:["key"]},kl={type:v.OBJECT,properties:{type:{type:v.STRING,description:"Enum: literal, function"},value:{type:v.STRING,description:"The default value of the property"}},required:["type"]},Xa={type:v.OBJECT,properties:{minimum:{type:v.NUMBER,nullable:!0},maximum:{type:v.NUMBER,nullable:!0},exclusiveMinimum:{type:v.BOOLEAN,nullable:!0},exclusiveMaximum:{type:v.BOOLEAN,nullable:!0},multipleOf:{type:v.NUMBER,nullable:!0},enum:{type:v.ARRAY,items:{type:v.STRING},nullable:!0},examples:{type:v.ARRAY,items:{type:v.STRING},nullable:!0},defaultValue:{...kl,nullable:!0},pattern:{type:v.STRING,nullable:!0}}},Za={type:v.OBJECT,properties:{required:{type:v.BOOLEAN,nullable:!0},unique:{type:v.BOOLEAN,nullable:!0},index:{type:v.BOOLEAN,nullable:!0},primary:{type:v.BOOLEAN,nullable:!0},multiple:{type:v.BOOLEAN,nullable:!0},readOnly:{type:v.BOOLEAN,nullable:!0},writeOnly:{type:v.BOOLEAN,nullable:!0}}},Qa={type:v.OBJECT,properties:{key:{type:v.STRING},name:{type:v.STRING},displayName:{type:v.STRING},description:{type:v.STRING},type:{type:v.STRING,description:"Enum: string, number, boolean, date, datetime, time, binary"},constraints:Za,deprecated:{type:v.BOOLEAN},schema:Xa,semantics:{type:v.ARRAY,items:kt,description:"List of semantics applied to this property. Note: ONLY use semantics with scope='property'."},tags:{type:v.ARRAY,items:{type:v.STRING},nullable:!0}},required:["key","name","type","displayName","description"]},vl={type:v.OBJECT,properties:{embedded:{type:v.BOOLEAN,description:"Whether the association should be embedded in the target entity"},unionType:{type:v.STRING,description:"Enum: allOf, anyOf, oneOf, not"}}},en={type:v.OBJECT,properties:{key:{type:v.STRING},name:{type:v.STRING},displayName:{type:v.STRING},description:{type:v.STRING},targets:{type:v.ARRAY,items:Ya},required:{type:v.BOOLEAN},multiple:{type:v.BOOLEAN,description:"Whether the association can have multiple targets (like User has multiple addresses)"},onDelete:{type:v.STRING,description:"Enum: restrict, cascade, setNull, doNothing"},semantics:{type:v.ARRAY,items:kt,description:"List of semantics applied to this association. Note: ONLY use semantics with scope='association'."},schema:vl},required:["key","name","targets","displayName","description"]},Ha={type:v.OBJECT,properties:{key:{type:v.STRING},name:{type:v.STRING},description:{type:v.STRING}},required:["key","name"]},Sl={type:v.OBJECT,properties:{key:{type:v.STRING},modelKey:{type:v.STRING,description:'The Domain Model this entity belongs to (e.g. "users", "shipping")'},name:{type:v.STRING},displayName:{type:v.STRING},description:{type:v.STRING},tags:{type:v.ARRAY,items:{type:v.STRING}},semantics:{type:v.ARRAY,items:kt,description:"List of semantics applied to this entity. Note: ONLY use semantics with scope='entity'."},properties:{type:v.ARRAY,items:Qa},associations:{type:v.ARRAY,items:en}},required:["key","name","modelKey","displayName","description"]},_l={type:v.OBJECT,properties:{key:{type:v.STRING},name:{type:v.STRING},displayName:{type:v.STRING},description:{type:v.STRING},type:{type:v.STRING,description:"Enum: string, number, boolean, date, datetime, time, binary"},constraints:{...Za,nullable:!0},deprecated:{type:v.BOOLEAN,nullable:!0},schema:{...Xa,nullable:!0},addedSemantics:{type:v.ARRAY,items:kt,description:"Semantics to add. Note: ONLY use semantics with scope='property'."},modifiedSemantics:{type:v.ARRAY,items:kt},deletedSemanticIds:{type:v.ARRAY,items:{type:v.STRING}}},required:["key"]},xl={type:v.OBJECT,properties:{key:{type:v.STRING},name:{type:v.STRING},displayName:{type:v.STRING},description:{type:v.STRING},targets:{type:v.ARRAY,items:Ya},required:{type:v.BOOLEAN,nullable:!0},multiple:{type:v.BOOLEAN,nullable:!0,description:"Whether the association can have multiple targets (like User has multiple addresses)"},onDelete:{type:v.STRING,nullable:!0,description:"Enum: restrict, cascade, setNull, doNothing"},addedSemantics:{type:v.ARRAY,items:kt,description:"Semantics to add. Note: ONLY use semantics with scope='association'."},modifiedSemantics:{type:v.ARRAY,items:kt},deletedSemanticIds:{type:v.ARRAY,items:{type:v.STRING}}},required:["key"]},Al={type:v.OBJECT,properties:{sessionTitle:{type:v.STRING,description:"A short, 3-to-5 word descriptive title for this data modeling session."},reasoning:{type:v.STRING,description:"Conversational response analyzing the request or explaining changes, in markdown format"},delta:{type:v.OBJECT,properties:{addedModels:{type:v.ARRAY,items:Ha,description:"Brand new models to create"},deletedModelKeys:{type:v.ARRAY,items:{type:v.STRING},description:"Keys of completely removed models. This also removes all entities and associations in the model."},modifiedModels:{type:v.ARRAY,items:Ha,description:"Models to modify in the domain"},addedEntities:{type:v.ARRAY,items:Sl,description:"Brand new entities to create"},deletedEntityKeys:{type:v.ARRAY,items:{type:v.STRING},description:"Keys of completely removed entities"},modifiedEntities:{type:v.ARRAY,items:{type:v.OBJECT,properties:{key:{type:v.STRING,description:"The original key of the existing entity being modified"},modelKey:{type:v.STRING,description:"Change this to migrate the entity to a different model (boundary)"},name:{type:v.STRING},displayName:{type:v.STRING},description:{type:v.STRING},tags:{type:v.ARRAY,items:{type:v.STRING},nullable:!0},addedSemantics:{type:v.ARRAY,items:kt,description:"Semantics to add. Note: ONLY use semantics with scope='entity'."},modifiedSemantics:{type:v.ARRAY,items:kt},deletedSemanticIds:{type:v.ARRAY,items:{type:v.STRING}},addedProperties:{type:v.ARRAY,items:Qa},modifiedProperties:{type:v.ARRAY,items:_l},deletedPropertyKeys:{type:v.ARRAY,items:{type:v.STRING}},addedAssociations:{type:v.ARRAY,items:en},modifiedAssociations:{type:v.ARRAY,items:xl},deletedAssociationKeys:{type:v.ARRAY,items:{type:v.STRING}}},required:["key"]},description:"Modifications to existing entities like adding, removing, or changing properties/associations"}},required:["addedModels","deletedModelKeys","modifiedModels","addedEntities","deletedEntityKeys","modifiedEntities"]}},required:["reasoning","delta"]};var El="http://a.ml/",vt=`${El}vocabularies/`,q=`${vt}document#`,oe=`${vt}core#`,Y=`${vt}security#`,T=`${vt}apiContract#`,Ni=`${vt}apiBinding#`,M=`${vt}shapes#`,me=`${vt}data#`,We=`${vt}document-source-maps#`,Ii="http://www.w3.org/",re=`${Ii}ns/shacl#`,Ee=`${Ii}2001/XMLSchema#`,Tr=`${Ii}1999/02/22-rdf-syntax-ns#`,Os=`${Ii}2000/01/rdf-schema#`,d={aml:{key:"http://a.ml/",vocabularies:{key:vt,document:{key:q,Module:`${q}Module`,Document:`${q}Document`,Fragment:`${q}Fragment`,Unit:`${q}Unit`,SecuritySchemeFragment:`${q}SecuritySchemeFragment`,UserDocumentation:`${q}UserDocumentation`,DataType:`${q}DataType`,NamedExamples:`${q}NamedExamples`,DomainElement:`${q}DomainElement`,DomainProperty:`${q}DomainProperty`,ParametrizedDeclaration:`${q}ParametrizedDeclaration`,AbstractDeclaration:`${q}AbstractDeclaration`,VariableValue:`${q}VariableValue`,ExternalFragment:`${q}ExternalFragment`,ExternalDomainElement:`${q}ExternalDomainElement`,RootDomainElement:`${q}RootDomainElement`,APIContractProcessingData:`${q}APIContractProcessingData`,BaseUnitProcessingData:`${q}BaseUnitProcessingData`,customDomainProperties:`${q}customDomainProperties`,encodes:`${q}encodes`,declares:`${q}declares`,references:`${q}references`,examples:`${q}examples`,linkTarget:`${q}link-target`,linkLabel:`${q}link-label`,referenceId:`${q}reference-id`,structuredValue:`${q}structuredValue`,raw:`${q}raw`,extends:`${q}extends`,value:`${q}value`,name:`${q}name`,strict:`${q}strict`,deprecated:`${q}deprecated`,location:`${q}location`,variable:`${q}variable`,target:`${q}target`,dataNode:`${q}dataNode`,root:`${q}root`,usage:`${q}usage`,version:`${q}version`},core:{key:oe,CreativeWork:`${oe}CreativeWork`,Parameter:`${oe}Parameter`,Organization:`${oe}Organization`,License:`${oe}License`,Operation:`${oe}Operation`,Response:`${oe}Response`,Payload:`${oe}Payload`,Request:`${oe}Request`,version:`${oe}version`,urlTemplate:`${oe}urlTemplate`,displayName:`${oe}displayName`,title:`${oe}title`,name:`${oe}name`,description:`${oe}description`,documentation:`${oe}documentation`,summary:`${oe}summary`,provider:`${oe}provider`,email:`${oe}email`,url:`${oe}url`,termsOfService:`${oe}termsOfService`,license:`${oe}license`,mediaType:`${oe}mediaType`,extensionName:`${oe}extensionName`,deprecated:`${oe}deprecated`},security:{key:Y,ParametrizedSecurityScheme:`${Y}ParametrizedSecurityScheme`,SecuritySchemeFragment:`${Y}SecuritySchemeFragment`,SecurityScheme:`${Y}SecurityScheme`,OAuth1Settings:`${Y}OAuth1Settings`,OAuth2Settings:`${Y}OAuth2Settings`,OAuth2Flow:`${Y}OAuth2Flow`,Scope:`${Y}Scope`,Settings:`${Y}Settings`,HttpSettings:`${Y}HttpSettings`,ApiKeySettings:`${Y}ApiKeySettings`,OpenIdConnectSettings:`${Y}OpenIdConnectSettings`,SecurityRequirement:`${Y}SecurityRequirement`,security:`${Y}security`,scheme:`${Y}scheme`,schemes:`${Y}schemes`,settings:`${Y}settings`,name:`${Y}name`,type:`${Y}type`,scope:`${Y}scope`,accessTokenUri:`${Y}accessTokenUri`,authorizationUri:`${Y}authorizationUri`,authorizationGrant:`${Y}authorizationGrant`,flows:`${Y}flows`,flow:`${Y}flow`,signature:`${Y}signature`,tokenCredentialsUri:`${Y}tokenCredentialsUri`,requestTokenUri:`${Y}requestTokenUri`,refreshUri:`${Y}refreshUri`,securityRequirement:`${Y}SecurityRequirement`,openIdConnectUrl:`${Y}openIdConnectUrl`,bearerFormat:`${Y}bearerFormat`,in:`${Y}in`},apiContract:{key:T,Payload:`${T}Payload`,Request:`${T}Request`,Response:`${T}Response`,EndPoint:`${T}EndPoint`,Parameter:`${T}Parameter`,Operation:`${T}Operation`,WebAPI:`${T}WebAPI`,API:`${T}API`,AsyncAPI:`${T}AsyncAPI`,UserDocumentationFragment:`${T}UserDocumentationFragment`,Example:`${T}Example`,Server:`${T}Server`,ResourceType:`${T}ResourceType`,Trait:`${T}Trait`,TraitFragment:`${T}TraitFragment`,ParametrizedResourceType:`${T}ParametrizedResourceType`,ParametrizedTrait:`${T}ParametrizedTrait`,Callback:`${T}Callback`,TemplatedLink:`${T}TemplatedLink`,IriTemplateMapping:`${T}IriTemplateMapping`,Tag:`${T}Tag`,Message:`${T}Message`,DomainExtension:`${T}DomainExtension`,Encoding:`${T}Encoding`,header:`${T}header`,parameter:`${T}parameter`,paramName:`${T}paramName`,uriParameter:`${T}uriParameter`,cookieParameter:`${T}cookieParameter`,variable:`${T}variable`,payload:`${T}payload`,server:`${T}server`,path:`${T}path`,url:`${T}url`,scheme:`${T}scheme`,endpoint:`${T}endpoint`,queryString:`${T}queryString`,accepts:`${T}accepts`,guiSummary:`${T}guiSummary`,binding:`${T}binding`,response:`${T}response`,returns:`${T}returns`,expects:`${T}expects`,examples:`${T}examples`,supportedOperation:`${T}supportedOperation`,messageId:`${T}messageId`,statusCode:`${T}statusCode`,method:`${T}method`,required:`${T}required`,callback:`${T}callback`,expression:`${T}expression`,link:`${T}link`,linkExpression:`${T}linkExpression`,templateVariable:`${T}templateVariable`,mapping:`${T}mapping`,operationId:`${T}operationId`,protocol:`${T}protocol`,protocolVersion:`${T}protocolVersion`,headerSchema:`${T}headerSchema`,contentType:`${T}contentType`,allowEmptyValue:`${T}allowEmptyValue`,style:`${T}style`,explode:`${T}explode`,allowReserved:`${T}allowReserved`,tag:`${T}tag`,tags:`${T}tags`},apiBinding:{key:Ni,binding:`${Ni}binding`,bindings:`${Ni}bindings`,messageKey:`${Ni}messageKey`,type:`${Ni}type`},shapes:{key:M,Shape:`${M}Shape`,ScalarShape:`${M}ScalarShape`,ArrayShape:`${M}ArrayShape`,UnionShape:`${M}UnionShape`,NilShape:`${M}NilShape`,FileShape:`${M}FileShape`,AnyShape:`${M}AnyShape`,SchemaShape:`${M}SchemaShape`,MatrixShape:`${M}MatrixShape`,TupleShape:`${M}TupleShape`,RecursiveShape:`${M}RecursiveShape`,DataTypeFragment:`${M}DataTypeFragment`,XMLSerializer:`${M}XMLSerializer`,number:`${M}number`,integer:`${M}integer`,long:`${M}long`,double:`${M}double`,boolean:`${M}boolean`,float:`${M}float`,nil:`${M}nil`,password:`${M}password`,int32:`${M}int32`,int64:`${M}int64`,uint32:`${M}uint32`,uint64:`${M}uint64`,sint32:`${M}sint32`,sint64:`${M}sint64`,fixed32:`${M}fixed32`,fixed64:`${M}fixed64`,sfixed32:`${M}sfixed32`,sfixed64:`${M}sfixed64`,dateTimeOnly:`${M}dateTimeOnly`,range:`${M}range`,items:`${M}items`,anyOf:`${M}anyOf`,fileType:`${M}fileType`,schema:`${M}schema`,xmlSerialization:`${M}xmlSerialization`,xmlName:`${M}xmlName`,xmlAttribute:`${M}xmlAttribute`,xmlWrapped:`${M}xmlWrapped`,xmlNamespace:`${M}xmlNamespace`,xmlPrefix:`${M}xmlPrefix`,readOnly:`${M}readOnly`,writeOnly:`${M}writeOnly`,deprecated:`${M}deprecated`,fixPoint:`${M}fixPoint`,discriminator:`${M}discriminator`,discriminatorValue:`${M}discriminatorValue`,format:`${M}format`,multipleOf:`${M}multipleOf`,uniqueItems:`${M}uniqueItems`},data:{key:me,Scalar:`${me}Scalar`,Object:`${me}Object`,Array:`${me}Array`,Node:`${me}Node`,value:`${me}value`,type:`${me}type`,description:`${me}description`,required:`${me}required`,displayName:`${me}displayName`,minLength:`${me}minLength`,maxLength:`${me}maxLength`,default:`${me}default`,multipleOf:`${me}multipleOf`,minimum:`${me}minimum`,maximum:`${me}maximum`,enum:`${me}enum`,pattern:`${me}pattern`,items:`${me}items`,format:`${me}format`,example:`${me}example`,examples:`${me}examples`},docSourceMaps:{key:We,SourceMap:`${We}SourceMap`,sources:`${We}sources`,element:`${We}element`,value:`${We}value`,declaredElement:`${We}declared-element`,trackedElement:`${We}tracked-element`,parsedJsonSchema:`${We}parsed-json-schema`,autoGeneratedName:`${We}auto-generated-name`,lexical:`${We}lexical`,synthesizedField:`${We}synthesized-field`}}},w3:{key:Ii,shacl:{key:re,Shape:`${re}Shape`,NodeShape:`${re}NodeShape`,SchemaShape:`${re}SchemaShape`,PropertyShape:`${re}PropertyShape`,in:`${re}in`,defaultValue:`${re}defaultValue`,defaultValueStr:`${re}defaultValueStr`,pattern:`${re}pattern`,minInclusive:`${re}minInclusive`,maxInclusive:`${re}maxInclusive`,multipleOf:`${re}multipleOf`,minLength:`${re}minLength`,maxLength:`${re}maxLength`,fileType:`${re}fileType`,and:`${re}and`,property:`${re}property`,name:`${re}name`,raw:`${re}raw`,datatype:`${re}datatype`,minCount:`${re}minCount`,maxCount:`${re}maxCount`,xone:`${re}xone`,not:`${re}not`,or:`${re}or`,closed:`${re}closed`,path:`${re}path`,additionalPropertiesSchema:`${re}additionalPropertiesSchema`},xmlSchema:{key:Ee,boolean:`${Ee}boolean`,string:`${Ee}string`,number:`${Ee}number`,integer:`${Ee}integer`,long:`${Ee}long`,double:`${Ee}double`,float:`${Ee}float`,nil:`${Ee}nil`,dateTime:`${Ee}dateTime`,time:`${Ee}time`,date:`${Ee}date`,base64Binary:`${Ee}base64Binary`,byte:`${Ee}byte`},rdfSyntax:{key:Tr,Seq:`${Tr}Seq`,Property:`${Tr}Property`,member:`${Tr}member`},rdfSchema:{key:Os,Seq:`${Os}Seq`,member:`${Os}member`}}};function ni(o,e=0){if(typeof o!="object")return o;let t="",i=new Array(e).fill(" ").join("");return Object.keys(o).forEach(r=>{t+=Array.isArray(o[r])?"":`${i}<${r}>`,Array.isArray(o[r])?o[r].forEach(s=>{t+=i,t+=`<${r}>
|
|
29
|
-
`,t+=
|
|
23
|
+
`+Q.green(`\u2714 Organization "${i}" created successfully!`)),console.log(`Set as default organization: ${Q.cyan(n)}`)}catch(a){let n=Z(a);console.log(Q.red(`Error creating organization: ${n.message}`))}}function Wo(){let o=P.resolved.token;if(!o)return null;try{let e=o.split(".");if(e.length===3){let t=e[1],i=Buffer.from(t,"base64url").toString("utf8"),r=JSON.parse(i);if(r&&typeof r=="object")return r.jti||r.id||null}}catch{}return null}function Ia(o){let e=o.command("tokens").description("Manage personal access tokens");e.command("list").description("List all personal access tokens").action(async()=>{let t=new H({format:P.resolved.format});try{_.debug("[auth:tokens] Listing personal access tokens...");let i=X();Nt(i,t);let r=await i.users.listTokens({token:i.token});_.debug(`[auth:tokens] Retrieved ${r.length} personal access token(s)`);let s=Wo(),a=r.map(n=>({id:n.id,name:n.name||"N/A",lastUsedAt:n.lastUsedAt||"Never",expiresAt:n.expiresAt||"Never",active:n.id===s?"Yes":"No"}));t.list(a,["id","name","lastUsedAt","expiresAt","active"],{headers:["ID","NAME","LAST USED","EXPIRES","ACTIVE"]})}catch(i){let r=Z(i);t.error(r),process.exit(1)}}),e.command("create").description("Create a new personal access token").option("--name <name>","Optional name to identify the token").option("--expires-at <expires>",'Optional expiration time (e.g. "30 days", "10 minutes", or timestamp)').action(async t=>{let i=new H({format:P.resolved.format});try{_.debug(`[auth:tokens] Creating personal access token with name="${t.name||"default"}"`);let r=X();Nt(r,i);let s={};t.name&&(s.name=t.name),t.expiresAt&&(/^\d+$/.test(t.expiresAt)?s.expiresAt=parseInt(t.expiresAt,10):s.expiresAt=t.expiresAt);let a=await r.users.createToken(s,{token:r.token});_.debug(`[auth:tokens] Token created successfully with ID="${a.id}"`),P.resolved.format==="json"?i.success("Token created successfully!",a):(i.success("Token created successfully!"),console.log(`
|
|
24
|
+
`+Q.yellow("\u26A0 WARNING: Make sure to copy your personal access token now. You will NOT be able to see it again!")+`
|
|
25
|
+
`),console.log(`${Q.bold("Raw Token")}: ${Q.cyan(a.token)}`),console.log(`${Q.bold("ID")}: ${a.id}`),console.log(`${Q.bold("Name")}: ${a.name||"N/A"}`),console.log(`${Q.bold("Type")}: ${a.type}`),console.log(`${Q.bold("Expires At")}: ${a.expiresAt||"Never"}
|
|
26
|
+
`))}catch(r){let s=Z(r);i.error(s),process.exit(1)}}),e.command("delete <id>").description("Delete a personal access token by ID").action(async t=>{let i=new H({format:P.resolved.format});try{_.debug(`[auth:tokens] Deleting personal access token with ID="${t}"`);let r=X();Nt(r,i),await r.users.deleteToken(t,{token:r.token}),_.debug(`[auth:tokens] Successfully deleted token ID="${t}"`),i.success(`Token '${t}' deleted successfully.`)}catch(r){let s=Z(r);i.error(s),process.exit(1)}})}import{readFileSync as Qo}from"node:fs";function Pa(o){let e=o.command("auth").description("Manage CLI authentication");Ia(e),e.command("login").description("Authenticate with the API platform using OAuth2 (google, github, or linkedin)").addArgument(new Xo("provider","Authentication provider").choices(["google","github","linkedin"])).action(async t=>{let i=new H({format:P.resolved.format});_.debug(`[auth] Initiating authentication flow for provider '${t}'...`);let r=["google","github","linkedin"];r.includes(t)||(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Invalid provider '${t}'. Allowed: ${r.join(", ")}`}),process.exit(1));let s=P.resolved.apiUrl;P.resolved.format!=="json"&&console.log(`Starting authentication flow using provider '${t}'...`);try{await el(s,t,i),_.debug("[auth] Login server callback received token successfully."),i.success("Successfully authenticated!");let a=X();_.debug("[auth] Checking/setting up first organization for authenticated user..."),await js(a,i)}catch(a){a instanceof Error?i.error({code:"CLI_ERR_UNAUTHORIZED",message:a.message}):i.error({code:"CLI_ERR_UNAUTHORIZED",message:"Authentication failed."}),process.exit(1)}}),e.command("logout").description("Log out and clear the stored token").action(()=>{let t=new H({format:P.resolved.format});_.debug("[auth] Executing logout command, clearing configuration token..."),P.clearConfigKey("token"),_.debug("[auth] Token cleared successfully."),t.success("Logged out successfully.")}),e.command("status").description("Check current authentication status").action(async()=>{let t=new H({format:P.resolved.format}),i=P.resolved;_.debug("[auth] Checking current authentication status...");let r=X();Nt(r,t);try{_.debug("[auth] Retrieving user profile details from platform...");let s=await r.users.me({token:r.token});if(_.debug(`[auth] User retrieved successfully: ${s.name}`),i.format==="json")t.object({authenticated:!0,user:s});else{console.log(Q.green("\u2714 Authenticated successfully!"));let a="",n=s.email;if(Array.isArray(n)){let l=n[0];l&&typeof l=="object"&&"email"in l&&(a=String(l.email||""))}else typeof n=="string"&&(a=n);console.log(`User: ${s.name} (${a})`),console.log(`Default Org: ${i.org||"None"}`)}_.debug("[auth] Checking default organization status..."),await js(r,t)}catch(s){let a=Z(s);t.error({code:a.code||"CLI_ERR_UNAUTHORIZED",message:"Authentication token is invalid or expired.",detail:a.message}),process.exit(1)}})}function el(o,e,t){return new Promise((i,r)=>{let s=Yo.createServer((c,p)=>{if(c.method==="GET"&&c.url?.startsWith("/callback")){_.debug(`[auth] Received request for callback: ${c.url}`),p.writeHead(200,{"Content-Type":"text/html"});let u=new URL("./templates/login.html",import.meta.url),m=Qo(u,"utf8").replaceAll("{{API_URL}}",o);p.end(m);return}if(c.method==="POST"&&c.url==="/token"){let u="";c.on("data",h=>{u+=h}),c.on("end",()=>{try{let h=JSON.parse(u);h.token?(_.debug("[auth] Storing retrieved token to CLI configuration..."),P.writeProperty("token",h.token),p.writeHead(200,{"Content-Type":"application/json"}),p.end(JSON.stringify({success:!0})),i(h.token)):(p.writeHead(400,{"Content-Type":"application/json"}),p.end(JSON.stringify({error:"Token missing"})),r(new Error("Token missing from browser callback.")))}catch(h){h instanceof Error?(p.writeHead(400,{"Content-Type":"application/json"}),p.end(JSON.stringify({error:h.message})),r(new Error("Invalid body received: "+h.message))):(p.writeHead(400,{"Content-Type":"application/json"}),p.end(JSON.stringify({error:"Invalid body received"})),r(new Error("Invalid body received")))}finally{l()}});return}if(c.method==="POST"&&c.url==="/error"){let u="";c.on("data",h=>{u+=h}),c.on("end",()=>{try{let h=JSON.parse(u);_.debug(`[auth] Received login error from browser callback: ${h.message}`),r(new Error(h.message||"Browser login failed"))}catch{r(new Error("Browser login failed"))}finally{l()}});return}p.writeHead(404),p.end()}),a=()=>{l(),process.exit(130)};process.on("SIGINT",a),process.on("SIGTERM",a);let n=setTimeout(()=>{r(new Error("Authentication timed out.")),l()},3e5);function l(){clearTimeout(n),process.off("SIGINT",a),process.off("SIGTERM",a),s.close()}s.listen(0,"127.0.0.1",async()=>{let c=s.address().port,u=new URL(o).hostname==="localhost"?"localhost":"127.0.0.1",h=`${o}/auth/${e}/redirect?r=http://${u}:${c}/callback`;_.debug(`[auth] Ephemeral loopback server listening on http://127.0.0.1:${c}`),_.debug(`[auth] Browser callback origin configured to http://${u}:${c}`),t.format!=="json"&&(console.log("Opening browser to log in..."),console.log(`If it doesn't open automatically, navigate to:
|
|
27
|
+
${h}`));try{await Zo(h)}catch{}})})}function Oa(o){let e=o.command("orgs").description("Manage organization configurations");e.command("list").description("List all organizations you belong to").action(async()=>{let t=new H({format:P.resolved.format});_.debug("[orgs:list] Listing all authorized organizations...");try{let i=X(),s=(await i.organizations.list({token:i.token})).data||[];_.debug(`[orgs:list] Found ${s.length} organizations.`);let a=P.resolved,n=s.map(l=>({id:l.key,name:l.name,slug:l.slug,isDefault:l.key===a.org?"Yes":"No"}));t.list(n,["id","name","slug","isDefault"],{headers:["ID","NAME","SLUG","DEFAULT"]})}catch(i){let r=Z(i);t.error(r),process.exit(1)}}),e.command("set-default <oid>").description("Set your default organization ID").action(async t=>{let i=new H({format:P.resolved.format});_.debug(`[orgs:set-default] Setting default organization ID to '${t}'...`);try{let r=X();_.debug("[orgs:set-default] Validating organization ID in user's authorized list..."),((await r.organizations.list({token:r.token})).data||[]).some(l=>l.key===t)||(_.debug(`[orgs:set-default] Organization ID '${t}' not found.`),i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Organization ID '${t}' not found in your authorized list.`,detail:"Run `apinow orgs list` to see all authorized organizations and their IDs."}),process.exit(1)),_.debug(`[orgs:set-default] Organization ID validated. Writing 'org' property as '${t}'...`),P.writeProperty("org",t),_.debug("[orgs:set-default] Configuration property written successfully."),i.success(`Default organization ID set to '${t}'.`)}catch(r){let s=Z(r);i.error(s),process.exit(1)}}),e.command("default").alias("get-default").description("Get the default configured organization").action(async()=>{let t=new H({format:P.resolved.format});_.debug("[orgs:default] Retrieving the default configured organization...");try{let i=P.resolved;i.org||(_.debug("[orgs:default] No default organization configured in local settings."),t.error({code:"CLI_ERR_MISSING_REQUIRED",message:"No default organization configured.",detail:"Set one using `apinow orgs set-default <oid>`. Run `apinow orgs list` to list available organizations."}),process.exit(1));let r=X();_.debug(`[orgs:default] Fetching organization list to validate configured org '${i.org}'...`);let n=((await r.organizations.list({token:r.token})).data||[]).find(l=>l.key===i.org);n||(_.debug(`[orgs:default] Configured org '${i.org}' not found in authorized list.`),t.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Default organization ID '${i.org}' not found in your authorized list.`,detail:"Run `apinow orgs set-default <oid>` to configure a valid default organization."}),process.exit(1)),_.debug(`[orgs:default] Default organization validated successfully: ${n.name}`),t.object({id:n.key,name:n.name,slug:n.slug})}catch(i){let r=Z(i);t.error(r),process.exit(1)}})}import Ca from"node:fs";import tl from"node:path";function Ta(o){let e=o.command("files").description("Manage files and metadata");e.command("list").description("List files in an organization").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--kind <kind>","Filter by file kind (e.g. domain, api, folder)").option("--parent <parent>","Filter by parent folder ID").action(async t=>{let i=new H({format:P.resolved.format}),r=P.resolved,s=t.org||r.org;_.debug(`[files:list] Listing files for org: ${s}, kind: ${t.kind||"all"}, parent: ${t.parent||"root"}`),s||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1));try{let a=X(),n={};if(t.parent&&(n.parent=t.parent),t.kind){let u=Ra(t.kind);n.filter={field:"kind",operator:"eq",value:u}}let c=(await a.files.list(s,n,{token:a.token})).data||[];_.debug(`[files:list] Found ${c.length} files.`);let p=c.map(u=>({id:u.key,name:u.info?.name||"",kind:u.kind,isShortcut:u.isShortcut?"Yes":"No"}));i.list(p,["id","name","kind","isShortcut"],{headers:["ID","NAME","KIND","SHORTCUT"]})}catch(a){let n=Z(a);i.error(n),process.exit(1)}}),e.command("create").description("Create a new file metadata record (and optionally upload media)").option("--name <name>","Name of the file").option("--kind <kind>","Kind of the file (e.g., domain, api)").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--parent <parent>","Parent folder ID").option("--media <path>","Local path to the file content/media to upload").option("--stdin","Read media content from STDIN").action(async t=>{let i=new H({format:P.resolved.format}),r=P.resolved,s=t.org||r.org;_.debug(`[files:create] Creating file with options: name=${t.name}, kind=${t.kind}, org=${s}, parent=${t.parent}, media=${t.media}, stdin=${t.stdin}`),s||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1)),t.media&&t.stdin&&(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:"Cannot specify both --media <path> and --stdin"}),process.exit(1));let a=t.name;!a&&process.stdout.isTTY&&(a=await Ue("Enter file name:")),a||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Name is required.",detail:"Specify --name <name>."}),process.exit(1));let n=t.kind;!n&&process.stdout.isTTY&&(n=await yt("Select file kind:",[{name:"API Domain / Schema (domain)",value:"domain"},{name:"API Schema (api)",value:"api"},{name:"Folder (folder)",value:"folder"}])),n||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Kind is required.",detail:"Specify --kind <kind> (allowed: api, domain, folder)."}),process.exit(1));try{let l;if(t.media){let k=tl.resolve(t.media);_.debug(`[files:create] Reading local media file from path: ${k}`),Ca.existsSync(k)||(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Media file not found at path: ${k}`}),process.exit(1)),l=Ca.readFileSync(k,"utf8")}else t.stdin&&(_.debug("[files:create] Reading media content from STDIN..."),l=await il());let c,p;if(l!==void 0){try{p=JSON.parse(l)}catch{throw new Error("invalid API now platform file")}if(!p||typeof p!="object"||Array.isArray(p)||!("key"in p)||typeof p.key!="string"||!p.key.trim())throw new Error("invalid API now platform file");c=p.key}let u=X(),h=gt.createSchema({kind:Ra(n),info:{name:a},key:c}),m={};t.parent&&(m.parent=t.parent),_.debug("[files:create] Sending request to create file metadata...");let f=await u.files.createMeta(h,s,m,{token:u.token}),b=f.key;_.debug(`[files:create] Created file metadata successfully. Key: ${b}`),l!==void 0&&(_.debug("[files:create] Uploading file media..."),await u.files.createMedia(p,s,b,{},{token:u.token}),_.debug("[files:create] Media uploaded successfully.")),i.success("File created successfully!",f)}catch(l){let c=Z(l);i.error({code:"CLI_ERR_API_FAILURE",...c}),process.exit(1)}}),e.command("read").description("Read file metadata or media content").option("--id <fid>","File ID").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--meta","Read file metadata (default)").option("--media","Read file media/content").action(async t=>{let i=new H({format:P.resolved.format}),r=P.resolved,s=t.org||r.org;_.debug(`[files:read] Reading file with options: id=${t.id}, org=${s}, meta=${t.meta}, media=${t.media}`),s||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1));let a=t.id;if(!a&&process.stdout.isTTY){_.debug("[files:read] ID not provided, fetching files list for interactive selection...");try{let n=X(),c=(await n.files.list(s,{},{token:n.token})).data||[];c.length>0&&(a=await yt("Select a file to read:",c.map(p=>({name:`${p.info?.name||"Unnamed"} (${p.kind})`,value:p.key}))))}catch{}}a||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"File ID is required.",detail:"Specify --id <fid>."}),process.exit(1));try{let n=X();if(t.media){_.debug(`[files:read] Fetching media content for file ID '${a}'...`);let c=(await n.files.readMedia(s,a,{token:n.token})).media;_.debug("[files:read] Media retrieved successfully."),r.format==="json"?console.log(JSON.stringify(c,null,2)):console.log(typeof c=="object"&&c!==null?JSON.stringify(c,null,2):c)}else{_.debug(`[files:read] Fetching metadata for file ID '${a}'...`);let l=await n.files.read(s,a,{token:n.token});_.debug("[files:read] Metadata retrieved successfully."),i.object(l)}}catch(n){let l=Z(n);i.error(l),process.exit(1)}})}function Ra(o){let e=o.toLowerCase();if(e==="api")return $a;if(e==="domain")return Et;if(e==="folder")return De;throw new Error(`Unsupported file kind "${o}". Allowed: api, domain, folder`)}async function il(){return new Promise((o,e)=>{let t="";process.stdin.setEncoding("utf8"),process.stdin.on("data",i=>{t+=i}),process.stdin.on("end",()=>{o(t)}),process.stdin.on("error",i=>{e(i)})})}var Ei=class o{key;get kind(){return ft}catalogKey;scope;lifecycle;version;publishedBy;unpublishedAt;deprecated;deprecatedAt;deprecatedBy;deprecationReason;createdAt;updatedAt;changelog;static createSchema(e){let{key:t="",scope:i="private",publishedBy:r="",createdAt:s=0,updatedAt:a=0,catalogKey:n="",lifecycle:l="stable",version:c=""}=e;if(["public","private","organization"].indexOf(i)===-1)throw new Error(`Invalid scope: ${i}`);let p={key:t,kind:ft,scope:i,publishedBy:r,createdAt:s,updatedAt:a,catalogKey:n,lifecycle:l,version:c};return typeof e.deprecated=="boolean"&&(p.deprecated=e.deprecated),typeof e.deprecatedAt=="number"&&(p.deprecatedAt=e.deprecatedAt),typeof e.deprecatedBy=="string"&&(p.deprecatedBy=e.deprecatedBy),typeof e.changelog=="string"&&(p.changelog=e.changelog),typeof e.deprecationReason=="string"&&(p.deprecationReason=e.deprecationReason),typeof e.unpublishedAt=="number"&&(p.unpublishedAt=e.unpublishedAt),p}constructor(e={}){let t=o.createSchema(e);this.key=t.key,this.catalogKey=t.catalogKey,this.lifecycle=t.lifecycle,this.scope=t.scope,this.version=t.version,this.publishedBy=t.publishedBy,this.createdAt=t.createdAt,this.updatedAt=t.updatedAt,typeof t.changelog=="string"&&(this.changelog=t.changelog),typeof t.deprecated=="boolean"&&(this.deprecated=t.deprecated),typeof t.deprecatedAt=="number"&&(this.deprecatedAt=t.deprecatedAt),typeof t.deprecatedBy=="string"&&(this.deprecatedBy=t.deprecatedBy),typeof t.deprecationReason=="string"&&(this.deprecationReason=t.deprecationReason),typeof t.unpublishedAt=="number"&&(this.unpublishedAt=t.unpublishedAt)}toJSON(){let e={key:this.key,kind:ft,scope:this.scope,publishedBy:this.publishedBy,createdAt:this.createdAt,updatedAt:this.updatedAt,catalogKey:this.catalogKey,lifecycle:this.lifecycle,version:this.version};return typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),typeof this.deprecatedAt=="number"&&(e.deprecatedAt=this.deprecatedAt),typeof this.deprecatedBy=="string"&&(e.deprecatedBy=this.deprecatedBy),typeof this.deprecationReason=="string"&&(e.deprecationReason=this.deprecationReason),typeof this.unpublishedAt=="number"&&(e.unpublishedAt=this.unpublishedAt),typeof this.changelog=="string"&&this.changelog&&(e.changelog=this.changelog),e}};var y;(function(o){o.User="Semantic#User",o.Address="Semantic#Address",o.Organization="Semantic#Organization",o.Project="Semantic#Project",o.AbstractManyToMany="Semantic#AbstractManyToMany",o.Password="Semantic#Password",o.Username="Semantic#Username",o.CreatedTimestamp="Semantic#CreatedTimestamp",o.UpdatedTimestamp="Semantic#UpdatedTimestamp",o.DeletedTimestamp="Semantic#DeletedTimestamp",o.DeletedFlag="Semantic#DeletedFlag",o.PublicUniqueName="Semantic#PublicUniqueName",o.Title="Semantic#Title",o.Name="Semantic#Name",o.UserRole="Semantic#UserRole",o.OrganizationRole="Semantic#OrganizationRole",o.ProjectRole="Semantic#ProjectRole",o.AssociationRole="Semantic#AssociationRole",o.Status="Semantic#Status",o.Version="Semantic#Version",o.ImageURL="Semantic#ImageURL",o.FileURL="Semantic#FileURL",o.Markdown="Semantic#Markdown",o.HTML="Semantic#HTML",o.GeospatialCoordinates="Semantic#GeospatialCoordinates",o.Email="Semantic#Email",o.Phone="Semantic#Phone",o.Currency="Semantic#Currency",o.URL="Semantic#URL",o.SKU="Semantic#SKU",o.Description="Semantic#Description",o.Summary="Semantic#Summary",o.Calculated="Semantic#Calculated",o.Derived="Semantic#Derived",o.ClientIPAddress="Semantic#ClientIPAddress",o.StreetAddress="Semantic#StreetAddress",o.StreetAddressSupplemental="Semantic#StreetAddressSupplemental",o.City="Semantic#City",o.PostalCode="Semantic#PostalCode",o.Country="Semantic#Country",o.Region="Semantic#Region",o.ResourceOwnerIdentifier="Semantic#ResourceOwnerIdentifier",o.RelationalResourceOwner="Semantic#RelationalResourceOwner",o.OrganizationMembers="Semantic#OrganizationMembers",o.ProjectMembers="Semantic#ProjectMembers",o.OrganizationResource="Semantic#OrganizationResource",o.ProjectResource="Semantic#ProjectResource",o.CreatedBy="Semantic#CreatedBy",o.UpdatedBy="Semantic#UpdatedBy",o.DeletedBy="Semantic#DeletedBy",o.Tags="Semantic#Tags",o.Categories="Semantic#Categories"})(y||(y={}));var M;(function(o){o.Entity="Entity",o.Property="Property",o.Association="Association"})(M||(M={}));var L;(function(o){o.Identity="Identity & Authentication",o.Lifecycle="Timestamps & Versioning",o.Content="Content & Media",o.Business="Business Data",o.Organization="Classification & Organization",o.Location="Location & Geography",o.Contact="Contact Information",o.Computed="Computed Values"})(L||(L={}));var Da=o=>o.scope===M.Entity,fr=o=>o.scope===M.Property,gr=o=>o.scope===M.Association,Be={[y.User]:{id:y.User,displayName:"User Entity",scope:M.Entity,description:"System users and accounts",category:L.Identity,hasConfig:!1},[y.Password]:{id:y.Password,displayName:"User Password",scope:M.Property,description:"Secure password field",category:L.Identity,applicableDataTypes:["string"],hasConfig:!0},[y.Username]:{id:y.Username,displayName:"Username",scope:M.Property,description:"User authentication identifier",category:L.Identity,applicableDataTypes:["string"],hasConfig:!1},[y.UserRole]:{id:y.UserRole,displayName:"User Role Field",scope:M.Property,description:"User permissions and access level",category:L.Identity,applicableDataTypes:["string"],hasConfig:!0},[y.ResourceOwnerIdentifier]:{id:y.ResourceOwnerIdentifier,displayName:"Resource Owner Identifier",scope:M.Association,description:"Links record to owner user",category:L.Identity,hasConfig:!1},[y.RelationalResourceOwner]:{id:y.RelationalResourceOwner,displayName:"Relational Resource Owner",scope:M.Association,description:"Specifies that the target entity of this association acts as the relational owner context for ownership verification.",category:L.Identity,hasConfig:!1},[y.Organization]:{id:y.Organization,displayName:"Organization Entity",scope:M.Entity,description:"Applied to the top-level Organization entity",category:L.Identity,hasConfig:!1},[y.AbstractManyToMany]:{id:y.AbstractManyToMany,displayName:"Abstract Many-To-Many",scope:M.Association,description:"Hidden parent semantic for all M:N relationships",category:L.Organization,hasConfig:!1,isHidden:!0,isManyToMany:!0},[y.OrganizationMembers]:{id:y.OrganizationMembers,displayName:"Organization Members",scope:M.Association,description:"Applied to the association pointing from Organization to User",category:L.Identity,hasConfig:!0,isManyToMany:!0,inheritsFrom:y.AbstractManyToMany,preconditions:[{kind:"associationMultiple",multiple:!0,unmetMessage:"Organization Members semantic can only be applied to multi-valued (array) associations."},{kind:"entityPairs",entityPairs:[{parent:y.Organization,target:y.User},{parent:y.User,target:y.Organization}],unmetMessage:"Organization Members semantic can only be applied to an association connecting an Organization entity and a User entity."}],properties:[{meta:{required:!0},value:{info:{name:"role",displayName:"Role",description:"The role of the user in the organization"},semantics:[{id:y.OrganizationRole}],type:"string",index:!0,required:!0,schema:{enum:["owner","admin","editor","viewer"],defaultValue:{type:"literal",value:"viewer"}}}},{meta:{required:!1},value:{info:{name:"status",displayName:"Status",description:"The status of the user in the organization"},semantics:[{id:y.Status}],type:"string",index:!0,required:!0,schema:{enum:["active","inactive","invited"],defaultValue:{type:"literal",value:"invited"}}}}]},[y.Project]:{id:y.Project,displayName:"Project Entity",scope:M.Entity,description:"Applied to a Project entity",category:L.Identity,hasConfig:!1},[y.ProjectMembers]:{id:y.ProjectMembers,displayName:"Project Members",scope:M.Association,description:"Applied to the association pointing from Project to User",category:L.Identity,hasConfig:!0,isManyToMany:!0,inheritsFrom:y.AbstractManyToMany,preconditions:[{kind:"associationMultiple",multiple:!0,unmetMessage:"Project Members semantic can only be applied to multi-valued (array) associations."},{kind:"entityPairs",entityPairs:[{parent:y.Project,target:y.User},{parent:y.User,target:y.Project}],unmetMessage:"Project Members semantic can only be applied to an association connecting a Project entity and a User entity."}],properties:[{meta:{required:!0},value:{info:{name:"role",displayName:"Role",description:"The role of the user in the project"},semantics:[{id:y.ProjectRole}],type:"string",index:!0,required:!0,schema:{enum:["owner","admin","editor","viewer"],defaultValue:{type:"literal",value:"viewer"}}}},{meta:{required:!1},value:{info:{name:"status",displayName:"Status",description:"The status of the user in the project"},semantics:[{id:y.Status}],type:"string",index:!0,required:!0,schema:{enum:["active","inactive","invited"],defaultValue:{type:"literal",value:"invited"}}}}]},[y.OrganizationRole]:{id:y.OrganizationRole,displayName:"Organization Role Property",scope:M.Property,description:"Represents a membership role inside an organization",category:L.Identity,applicableDataTypes:["string"],hasConfig:!1},[y.ProjectRole]:{id:y.ProjectRole,displayName:"Project Role Property",scope:M.Property,description:"Represents a membership role inside a project",category:L.Identity,applicableDataTypes:["string"],hasConfig:!1},[y.AssociationRole]:{id:y.AssociationRole,displayName:"Association Role Property",scope:M.Property,description:"Represents a membership access role on a many-to-many association",category:L.Identity,applicableDataTypes:["string"],hasConfig:!1},[y.OrganizationResource]:{id:y.OrganizationResource,displayName:"Organization Resources",scope:M.Association,description:"Represents resources owned by an organization",category:L.Identity,hasConfig:!1},[y.ProjectResource]:{id:y.ProjectResource,displayName:"Project Resources",scope:M.Association,description:"Represents resources owned by a project",category:L.Identity,hasConfig:!1},[y.CreatedBy]:{id:y.CreatedBy,displayName:"Created By",scope:M.Association,description:"Links record to the user who created it",category:L.Identity,hasConfig:!1},[y.UpdatedBy]:{id:y.UpdatedBy,displayName:"Updated By",scope:M.Association,description:"Links record to the user who last updated it",category:L.Identity,hasConfig:!1},[y.DeletedBy]:{id:y.DeletedBy,displayName:"Deleted By",scope:M.Association,description:"Links record to the user who soft-deleted it",category:L.Identity,hasConfig:!1},[y.CreatedTimestamp]:{id:y.CreatedTimestamp,displayName:"Creation Timestamp",scope:M.Property,description:"When record was created",category:L.Lifecycle,applicableDataTypes:["datetime"],hasConfig:!1},[y.UpdatedTimestamp]:{id:y.UpdatedTimestamp,displayName:"Update Timestamp",scope:M.Property,description:"When record was last modified",category:L.Lifecycle,applicableDataTypes:["datetime"],hasConfig:!1},[y.DeletedTimestamp]:{id:y.DeletedTimestamp,displayName:"Soft Delete Timestamp",scope:M.Property,description:"When record was marked deleted",category:L.Lifecycle,applicableDataTypes:["datetime"],hasConfig:!1},[y.DeletedFlag]:{id:y.DeletedFlag,displayName:"Soft Delete Flag",scope:M.Property,description:"Mark record as deleted",category:L.Lifecycle,applicableDataTypes:["boolean"],hasConfig:!1},[y.Address]:{id:y.Address,displayName:"Address Entity",scope:M.Entity,description:"Physical address entity",category:L.Contact,hasConfig:!1},[y.StreetAddress]:{id:y.StreetAddress,displayName:"Street Address",scope:M.Property,description:"Street address line",category:L.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.StreetAddressSupplemental]:{id:y.StreetAddressSupplemental,displayName:"Street Address Supplemental",scope:M.Property,description:"Supplemental street address line (e.g., Unit, Suite, Apartment, Floor)",category:L.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.City]:{id:y.City,displayName:"City",scope:M.Property,description:"City or locality",category:L.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.PostalCode]:{id:y.PostalCode,displayName:"Postal Code",scope:M.Property,description:"Postal or zip code",category:L.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.Country]:{id:y.Country,displayName:"Country",scope:M.Property,description:"Country name or code",category:L.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.Region]:{id:y.Region,displayName:"Region",scope:M.Property,description:"State, province, or region",category:L.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.Version]:{id:y.Version,displayName:"Version Number",scope:M.Property,description:"Auto-incrementing version counter",category:L.Lifecycle,applicableDataTypes:["number"],hasConfig:!1},[y.Title]:{id:y.Title,displayName:"Record Title",scope:M.Property,description:"Main title or heading",category:L.Content,applicableDataTypes:["string"],hasConfig:!1},[y.Name]:{id:y.Name,displayName:"Name",scope:M.Property,description:"A person or pet name",category:L.Content,applicableDataTypes:["string"],hasConfig:!1},[y.Description]:{id:y.Description,displayName:"Description",scope:M.Property,description:"Detailed description text",category:L.Content,applicableDataTypes:["string"],hasConfig:!1},[y.Summary]:{id:y.Summary,displayName:"Summary",scope:M.Property,description:"Brief summary text",category:L.Content,applicableDataTypes:["string"],hasConfig:!1},[y.Markdown]:{id:y.Markdown,displayName:"Markdown Content",scope:M.Property,description:"Formatted text content",category:L.Content,applicableDataTypes:["string"],hasConfig:!0},[y.HTML]:{id:y.HTML,displayName:"HTML Content",scope:M.Property,description:"Rich HTML content",category:L.Content,applicableDataTypes:["string"],hasConfig:!0},[y.ImageURL]:{id:y.ImageURL,displayName:"Image URL",scope:M.Property,description:"Link to image file",category:L.Content,applicableDataTypes:["string"],hasConfig:!0},[y.FileURL]:{id:y.FileURL,displayName:"File URL",scope:M.Property,description:"Link to file attachment",category:L.Content,applicableDataTypes:["string"],hasConfig:!0},[y.Status]:{id:y.Status,displayName:"Record Status",scope:M.Property,description:"Current state of record",category:L.Business,applicableDataTypes:["string"],hasConfig:!0},[y.Currency]:{id:y.Currency,displayName:"Currency",scope:M.Property,description:"Monetary value with currency",category:L.Business,applicableDataTypes:["number","string"],hasConfig:!0},[y.SKU]:{id:y.SKU,displayName:"SKU",scope:M.Property,description:"Product identification code",category:L.Business,applicableDataTypes:["string"],hasConfig:!0},[y.Email]:{id:y.Email,displayName:"Email",scope:M.Property,description:"Email address",category:L.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.Phone]:{id:y.Phone,displayName:"Phone",scope:M.Property,description:"Phone number",category:L.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.URL]:{id:y.URL,displayName:"URL",scope:M.Property,description:"Web address or link",category:L.Contact,applicableDataTypes:["string"],hasConfig:!0},[y.ClientIPAddress]:{id:y.ClientIPAddress,displayName:"Client IP Address",scope:M.Property,description:"Automatically populated client IP address",category:L.Contact,applicableDataTypes:["string"],hasConfig:!1},[y.PublicUniqueName]:{id:y.PublicUniqueName,displayName:"Public Unique Name (Slug)",scope:M.Property,description:"URL-friendly unique identifier",category:L.Organization,applicableDataTypes:["string"],hasConfig:!0},[y.Tags]:{id:y.Tags,displayName:"Tags",scope:M.Association,description:"Enable tagging functionality",category:L.Organization,hasConfig:!0,isManyToMany:!0,inheritsFrom:y.AbstractManyToMany},[y.Categories]:{id:y.Categories,displayName:"Categories",scope:M.Association,description:"Enable categorization functionality",category:L.Organization,hasConfig:!0,isManyToMany:!0,inheritsFrom:y.AbstractManyToMany},[y.GeospatialCoordinates]:{id:y.GeospatialCoordinates,displayName:"Geospatial Coordinates",scope:M.Property,description:"Location coordinates",category:L.Location,applicableDataTypes:["string"],hasConfig:!0},[y.Calculated]:{id:y.Calculated,displayName:"Calculated",scope:M.Property,description:"Auto-calculated field value",category:L.Computed,applicableDataTypes:["string","number","boolean","date","datetime","time","binary"],hasConfig:!0},[y.Derived]:{id:y.Derived,displayName:"Derived",scope:M.Property,description:"Value derived from other fields",category:L.Computed,applicableDataTypes:["string"],hasConfig:!0}};var Is;(function(o){o[o.Initializing=0]="Initializing",o[o.PendingDns=1]="PendingDns",o[o.Issuing=2]="Issuing",o[o.Active=3]="Active",o[o.Error=4]="Error"})(Is||(Is={}));var ue=class o extends Error{static E_VALIDATION_ERROR="E_VALIDATION_ERROR";code=o.E_VALIDATION_ERROR;issues;constructor(e,t){let i=e[0];super(t??`Validation failed: ${i?.path??""} - ${i?.message??""}`),this.name="OperationValidationException",this.issues=e,Error.captureStackTrace&&Error.captureStackTrace(this,o)}};function yr(o,e){if(o==="-")return;let t=new ue([{message:"Invalid pointer",path:`/${o}`}]),{length:i}=o;if(i>1&&o[0]==="0")throw t;let r=+o;if(Number.isNaN(r)||Math.abs(r).toString()!==o||r<0||r>e)throw t}function ti(o,e){let{length:t}=e,i=o,r;for(let s=0;s<t-1;s++){if(r=e[s],Array.isArray(i))yr(r,i.length);else if(typeof i!="object"||i===null)throw new Error("Cannot be walked");i instanceof Map?i=i.get(r):i instanceof Set?i=Array.from(i)[+r]:i=i[r]}if(r=e[t-1],Array.isArray(i))yr(r,i.length);else if(typeof i!="object"||i===null)throw new Error("Invalid target");return{token:r,parent:i}}function Ge(o,e){let t=e.tokens,i=t.length;if(i===0||i===1&&t[0]==="")throw new ue([{message:"Cannot walk empty path.",path:e.raw}]);try{let r=ti(o,t);return{token:r.token,parent:r.parent}}catch{throw new ue([{message:"Path not found.",path:e.raw}])}}var rl=["boolean","string","number","null"];function $t(o){let e=typeof o;if(e==="boolean"||e==="string")return e;if(e==="number"&&Number.isFinite(o))return"number";if(e==="object"){if(Array.isArray(o)||o instanceof Set)return"array";if(o instanceof Map)return"object";if(o===null)return"null";if(e==="object")return"object"}}function br(o){return o===void 0?!0:rl.includes(o)}function za(o,e="/"){return o.replace(/~0/g,"~").replace(/~1/g,e)}function Ps(o,e="/"){let t="",i=o;typeof i=="number"&&(i=String(i));for(let r=0,s=i.length;r<s;r++){let a=i.charAt(r);a==="~"?t+="~0":a===e?t+="~1":t+=a}return t}function he(o,e="/"){let t="";for(let i=0,r=o.length;i<r;i++)t+=e+Ps(o[i],e);return t}function He(o,e="/"){if(Array.isArray(o))return o;if(o.length===0)return[];if(o.charAt(0)!==e)throw new ue([{message:"Invalid pointer.",path:o}]);let t=[""],i=0;for(let r=1,s=o.length;r<s;r++){let a=o.charAt(r);if(a===e){let n=t[t.length-1];if(n==="constructor"||n==="__proto__")throw new Error("Prototype pollution attempt");t.push(""),i++}else a==="~"?o.charAt(r+1)==="1"?(t[i]+=e,r++):o.charAt(r+1)==="0"?(t[i]+="~",r++):t[i]+=a:t[i]+=a}return t}function kr(o,e,t){let i,r;return typeof o=="string"?i=He(o,t):i=o,typeof e=="string"?r=[e]:r=e,he(i.concat(r),t)}function sl(o,e){if(o instanceof Set){let t=0;for(let i of o)e(i,t+=1)}else if(Array.isArray(o)||o instanceof Map)o.forEach(e);else if(typeof o=="object"&&o!==null)Object.keys(o).forEach(t=>{e(o[t],t)});else throw new TypeError(`${o} is not a structure`)}function Ua(o,e,t,i){i(o,e,t),!(o===null||typeof o!="object")&&sl(o,(r,s)=>{Ua(r,s,o,i)})}function wr(o,e){let t=Object.create(null);function i(s){for(let a in t)if(t[a]===s)return a}function r(s,a,n){let l=kr(n&&i(n),a);t[l]=s}Ua(o,void 0,void 0,(s,a,n)=>{if(s!==null&&typeof s=="object"&&(n===void 0||a===void 0?r(s,[],""):r(s,a.toString(),n)),a===void 0||n===void 0)e(s,"");else{let l=i(n);e(s,kr(l,a.toString()),n,l)}})}var re=class o{_raw="";_tokens=[];_separator;_index;_parent;constructor(e,t="/"){if(e instanceof o&&e.separator===t)return e;this._separator=t,Array.isArray(e)?(this._tokens=e,this._raw=he(e,this._separator)):typeof e=="string"?(this._raw=e,this._tokens=He(e,this._separator)):(this._raw=e._raw,this._tokens=e._tokens)}get raw(){return this._raw}get tokens(){return[...this._tokens]}get separator(){return this._separator}getToken(e){return e<0||e>=this._tokens.length?null:this._tokens[e]}getParent(){return this._parent!==void 0?this._parent:(this._tokens.length===0||this._tokens.length===1&&this._tokens[0]===""?this._parent=null:this._parent=new o(this._tokens.slice(0,-1),this._separator),this._parent)}isRoot(){return this._tokens.length===0||this._tokens[0]===""}append(e){return new o([...this._tokens,String(e)],this._separator)}prefix(e){if(e<0||e>this._tokens.length)throw new Error("Levels out of bound.");return new o(this._tokens.slice(0,e),this._separator)}escape(e){return Ps(e,this._separator)}unescape(e){return za(e,this._separator)}static encode(e,t="/"){return he(e,t)}encode(e=this._separator){return he(this._tokens,e)}static decode(e,t="/"){return He(e,t)}find(e){let{tokens:t}=this;if(t.length===0)return e;let i;try{i=ti(e,t)}catch{return}let{token:r,parent:s}=i;return s[r]}findValue(e){return this.isRoot()?e:this.find(e)}findParentValue(e){return this.isRoot()?e:this.getParent().find(e)}static find(e,t){return new o(t).find(e)}findAndTest(e,t){let i=this.find(e);return{found:i!==void 0,value:i,equal:i===t}}static isValidArrayToken(e,t){if(e==="-")return;let i=new ue([{message:"Invalid pointer.",path:`/${e}`}]),{length:r}=e;if(r>1&&e[0]==="0")throw i;let s=+e;if(Number.isNaN(s)||Math.abs(s).toString()!==e||s<0||s>t)throw i}getIndex(){if(this._index!==void 0)return this._index;let e=this._tokens;if(e.length===0)return null;let t=e[e.length-1];if(t==="-")return-1;let i=parseInt(t,10);return isNaN(i)?null:i}static getIndex(e){return new o(e).getIndex()}setIndex(e){let t=this._tokens,i=t[t.length-1];if(i===void 0)return new o(`/${e}`,this._separator);if(isNaN(+i))return new o([...t,e.toString()],this._separator);let r=Array.from(t);return r[r.length-1]=e.toString(),new o(r,this._separator)}static index(e){let t=Object.create(null);return wr(e,(i,r)=>{t[r]=i}),t}static join(e,t,i){let r,s;if(typeof e=="string"?r=He(e,i):r=e,typeof t=="string"){if(!t)return he(r,i);let a=t,n=i||"/";a.startsWith(n)||(a=`${n}${a}`),s=He(a,i)}else s=t;return he(r.concat(s),i)}static unflatten(e){let t=Object.keys(e),i=e[""];for(let r of t){if(r==="")continue;let s=He(r),a=ti(i,s),{parent:n,token:l}=a;n instanceof Map?n.set(l,e[r]):n instanceof Set?n.add(e[r]):Array.isArray(n)?n.push(e[r]):n[l]=e[r]}return i}static flatten(e){let t=Object.create(null);return wr(e,(i,r)=>{let s;Array.isArray(i)?s=[]:i instanceof Map?s=new Map:i instanceof Set?s=new Set:typeof i=="object"&&i!==null?s={}:s=i,t[r]=s}),t}equals(e){return e?["","/"].includes(this._raw)&&["/",""].includes(e._raw)?!0:this.raw===e.raw:!1}isAfter(e){let t=e.getIndex(),i=this.getIndex();return t===null||i===null||t===-1||i===-1?!1:t<i}isAfterOrAt(e){let t=e.getIndex(),i=this.getIndex();return t===null||i===null||t===-1||i===-1?!1:t!==null&&i!==null&&t<=i}contains(e){if(this.isRoot())return!0;let t=e.tokens;if(t.length<=this._tokens.length)return!1;for(let i=0;i<this._tokens.length;i++)if(this._tokens[i]!==t[i])return!1;return!0}parentEquals(e){let t=this.getParent();return t&&e?t.equals(e):t===e}};function Lt(o,e){let t=new re(e);if(t.tokens.length===0||t.tokens.length===1&&t.tokens[0]==="")return o;let{parent:i,token:r}=Ge(o,t);if(Array.isArray(i))re.isValidArrayToken(r,i.length);else if(typeof i=="object"&&i!==null&&!(r in i))throw new ue([{path:`/${r}`,message:"The target does not exists."}]);return i[r]}function et(o,e,t){let i=new re(e),r=structuredClone(t);if(i.tokens.length===0||i.tokens.length===1&&i.tokens[0]==="")return{doc:r,previous:o};let{token:s,parent:a}=Ge(o,i),n,l;if(Array.isArray(a))s==="-"?(a.push(r),l=a.length-1):a.splice(parseInt(s,10),0,r);else{n=a[s];let c=a;c[s]=r}return{doc:o,previous:n,idx:l}}function bt(o,e){let t=new re(e);if(t.tokens.length===0||t.tokens.length===1&&t.tokens[0]==="")return{doc:void 0,previous:o};let{parent:i,token:r}=Ge(o,t),s=i[r];if(s===void 0)throw new ue([{message:"Parent does not exists.",path:t.raw}]);return Array.isArray(i)?i.splice(parseInt(r,10),1):delete i[r],{doc:o,previous:s}}function ii(o,e,t){let i=new re(e),r=structuredClone(t);if(i.tokens.length===0||i.tokens.length===1&&i.tokens[0]==="")return{doc:r,previous:o};let{parent:s,token:a}=Ge(o,i),n=s[a];if(n===void 0)throw new ue([{message:"Location not found.",path:i.raw}]);return s[a]=r,{doc:o,previous:n}}function xi(o,e,t){let i=new re(e),r=new re(t);if(i.tokens.length===0||i.tokens.length===1&&i.tokens[0]==="")return{doc:bt(o,i).previous,previous:o};let s=bt(o,i);return et(s.doc,r,s.previous)}function ri(o,e,t){let i=new re(e),r=new re(t),s=Lt(o,i);return e===""||e==="/"?{doc:s,previous:o}:et(o,r,s)}function Ma(o){let e=[];return o.forEach(t=>{e.push(t)}),e}function Va(o){let e=Object.create(null);return o.forEach((t,i)=>{e[i]=t}),e}function Os(o,e,t,i){let r=$t(o),s=$t(e);if(r!==s)return!1;switch(r){case"number":return o===0&&1/o===-1/0?e===0&&1/e===-1/0:o===e;case"string":case"null":case"boolean":return o===e;default:}let a,n,l=t.indexOf(o);if(l!==-1)return i[l]===e;if(t.push(o),i.push(e),r==="array"){o instanceof Set&&(o=Ma(o)),e instanceof Set&&(e=Ma(e));let c=o,p=e;if(c.length!==p.length)return t.pop(),i.pop(),!1;for(a=0,n=c.length;a<n;a++)if(!Os(c[a],p[a],t,i))return t.pop(),i.pop(),!1;return!0}if(r==="object"){o instanceof Map&&(o=Va(o)),e instanceof Map&&(e=Va(e));let c=o,p=e,u=Object.keys(c),h=Object.keys(p);if(u.length!==h.length)return t.pop(),i.pop(),!1;for(u.sort(),h.sort(),a=0,n=u.length;a<n;a++){let m=u[a],f=h[a];if(m!==f||!Object.prototype.hasOwnProperty.call(p,m)||!Os(c[m],p[m],t,i))return t.pop(),i.pop(),!1}return t.pop(),i.pop(),!0}return t.pop(),i.pop(),!0}function tt(o,e){return Os(o,e,[],[])}function La(o){let e=o.command("catalog").description("Manage Data Catalog items");e.command("publish").description("Publish a data domain file to the data catalog").option("--file <fid>","File ID of the data domain").option("--name <name>","Name for the catalog entry").option("--description <desc>","Description of the catalog entry").option("--scope <scope>","Publish scope: public, organization, private").option("--catalog-version <ver>","Semantic version (e.g. 1.0.0)").option("--ver <ver>","Semantic version alias (e.g. 1.0.0)").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--lifecycle <lifecycle>","Version lifecycle status (dev, beta, stable)","stable").option("--changelog <changelog>","Changelog description for this version").action(async t=>{let i=new H({format:P.resolved.format}),r=P.resolved,s=t.catalogVersion||t.ver;_.debug(`[catalog:publish] Starting publish flow with options: file=${t.file}, name=${t.name}, scope=${t.scope}, version=${s}, org=${t.org||r.org}, lifecycle=${t.lifecycle}`);let a=t.org||r.org;a||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1));let n=t.file;if(!n&&process.stdout.isTTY){_.debug("[catalog:publish] File ID not provided; listing data domain files for selection...");try{let f=X(),k=(await f.files.list(a,{filter:{field:"kind",operator:"eq",value:Et}},{token:f.token})).data||[];k.length>0&&(n=await yt("Select a data domain file to publish:",k.map(S=>({name:`${S.info?.name||"Unnamed"} (${S.key})`,value:S.key}))))}catch{}}n||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"File ID is required.",detail:"Specify --file <fid>."}),process.exit(1));let l=t.name;!l&&process.stdout.isTTY&&(l=await Ue("Enter catalog entry name:")),l||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Name is required.",detail:"Specify --name <name>."}),process.exit(1));let c=t.description;!c&&process.stdout.isTTY&&(c=await Ue("Enter catalog entry description:")),c||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Description is required.",detail:"Specify --description <desc>."}),process.exit(1));let p=t.scope;!p&&process.stdout.isTTY&&(p=await yt("Select publish scope:",[{name:"Public (public)",value:"public"},{name:"Organization (organization)",value:"organization"},{name:"Private (private)",value:"private"}])),p||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Scope is required.",detail:"Specify --scope <scope> (allowed: public, organization, private)."}),process.exit(1));let u=["public","organization","private"];u.includes(p)||(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Invalid scope '${p}'.`,detail:`Allowed: ${u.join(", ")}`}),process.exit(1));let h=s;!h&&process.stdout.isTTY&&(h=await Ue("Enter semantic version:","1.0.0")),h||(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Version is required.",detail:"Specify --catalog-version <ver> or --ver <ver>."}),process.exit(1));let m=["dev","beta","stable"];m.includes(t.lifecycle)||(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Invalid lifecycle '${t.lifecycle}'.`,detail:`Allowed: ${m.join(", ")}`}),process.exit(1));try{let f=X(),b=null;_.debug(`[catalog:publish] Checking publication status for file ID '${n}' in organization '${a}'...`);try{b=(await f.dataCatalog.checkPublicationStatus(n,a,{token:f.token})).key,_.debug(`[catalog:publish] Found existing catalog entry key: ${b}`)}catch(I){if(Z(I).status!==404)throw I;_.debug("[catalog:publish] Catalog entry does not exist yet.")}if(b)_.debug(`[catalog:publish] Using existing catalog entry key: ${b}`),P.resolved.format!=="json"&&console.log(`Catalog entry already exists (ID: ${b}). Publishing new version...`);else{_.debug("[catalog:publish] Creating a new catalog entry..."),P.resolved.format!=="json"&&console.log("Catalog entry does not exist. Creating new catalog entry...");let I={key:"",kind:mt,organization:a,file:n,scope:p,name:l,description:c,publishedBy:"",publishedAt:0,createdAt:0,updatedAt:0,tags:[]};b=(await f.dataCatalog.publish(I,{token:f.token})).key,_.debug(`[catalog:publish] Created new catalog entry with key: ${b}`)}let k=Ei.createSchema({scope:p,lifecycle:t.lifecycle,version:h,changelog:t.changelog||void 0});_.debug(`[catalog:publish] Publishing version '${h}' for catalog key '${b}'...`);let S=await f.dataCatalog.publishVersion(b,k,{token:f.token});_.debug(`[catalog:publish] Version published successfully. Version key: ${S.key}`),i.success(`Successfully published version '${h}' to the data catalog!`,S)}catch(f){let b=Z(f);i.error(b),process.exit(1)}}),e.command("list").description("List published data catalog items or versions of a specific catalog entry").option("--scope <scope>","Filter by scope: all, public, organization, private","all").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--key <key>","Data catalog item key to list all versions of a specific data domain").action(async t=>{let i=new H({format:P.resolved.format}),r=P.resolved,s=t.org||r.org;_.debug(`[catalog:list] Listing catalog with options: scope=${t.scope}, org=${s}, key=${t.key}`);let a=["all","public","organization","private"];a.includes(t.scope)||(i.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Invalid scope '${t.scope}'. Allowed: ${a.join(", ")}`}),process.exit(1)),["organization","private"].includes(t.scope)&&!s&&(i.error({code:"CLI_ERR_MISSING_REQUIRED",message:`Organization ID (--org <oid>) is required when filtering by scope '${t.scope}'.`}),process.exit(1));try{let n=X();if(t.key){_.debug(`[catalog:list] Fetching versions for catalog entry key '${t.key}'...`);let c=(await n.dataCatalog.listVersions(t.key,{token:n.token})).data||[];_.debug(`[catalog:list] Found ${c.length} versions.`);let p=c.map(u=>({key:u.key,version:u.version,published:new Date(u.published).toLocaleString()}));i.list(p,["key","version","published"],{headers:["VERSION KEY","VERSION","PUBLISHED AT"]})}else{let l=[];if(t.scope==="all"){_.debug("[catalog:list] Fetching public catalog entries...");let h=await n.dataCatalog.list({scope:"public",oid:s},{token:n.token});if(l.push(...h.data||[]),s){_.debug(`[catalog:list] Fetching organization catalog entries for org '${s}'...`);try{let m=await n.dataCatalog.list({scope:"organization",oid:s},{token:n.token});l.push(...m.data||[])}catch{_.debug("[catalog:list] Failed to fetch organization catalog entries.")}_.debug(`[catalog:list] Fetching private catalog entries for org '${s}'...`);try{let m=await n.dataCatalog.list({scope:"private",oid:s},{token:n.token});l.push(...m.data||[])}catch{_.debug("[catalog:list] Failed to fetch private catalog entries.")}}}else{_.debug(`[catalog:list] Fetching catalog entries for scope '${t.scope}' and org '${s}'...`);let h=await n.dataCatalog.list({scope:t.scope,oid:s},{token:n.token});l.push(...h.data||[])}_.debug(`[catalog:list] Total raw catalog entries fetched: ${l.length}`);let c=new Set,p=l.filter(h=>{let m=h.key;return c.has(m)?!1:(c.add(m),!0)});_.debug(`[catalog:list] Total unique catalog entries: ${p.length}`);let u=p.map(h=>{let m=h.versions&&h.versions[0]?h.versions[0].version:"N/A";return{key:h.key,name:h.name,scope:h.scope,lastVersion:m,organization:h.organization||"N/A"}});i.list(u,["key","name","scope","lastVersion","organization"],{headers:["KEY","NAME","SCOPE","LAST VERSION","ORGANIZATION"]})}}catch(n){let l=Z(n);i.error(l),process.exit(1)}}),e.command("show <key>").alias("read").description("Show details of a data catalog entry or a specific version").option("--catalog-version <ver>","Semantic version to read").option("--ver <ver>","Semantic version alias").option("--org <oid>","Organization ID (optional, defaults to configured default org)").action(async(t,i)=>{let r=new H({format:P.resolved.format}),s=X(),a=i.catalogVersion||i.ver;_.debug(`[catalog:show] Reading catalog entry key='${t}', version='${a||"latest"}'`);try{if(a){let n=await s.dataCatalog.readVersion(t,a,{token:s.token});r.object(n)}else{let n=await s.dataCatalog.read(t,{token:s.token});r.object(n)}}catch(n){let l=Z(n);r.error(l),process.exit(1)}}),e.command("deprecate <key>").description("Mark a data catalog entry or specific version as deprecated").option("--catalog-version <ver>","Version string to deprecate").option("--ver <ver>","Version string alias").option("--reason <reason>","Reason for deprecating this catalog entry or version").option("--org <oid>","Organization ID (optional, defaults to configured default org)").action(async(t,i)=>{let r=new H({format:P.resolved.format}),s=i.catalogVersion||i.ver,a=i.reason;!a&&process.stdout.isTTY&&(a=await Ue("Enter reason for deprecation:")),a||(r.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Deprecation reason is required.",detail:"Specify --reason <reason>."}),process.exit(1));try{let n=X();if(s){_.debug(`[catalog:deprecate] Deprecating version '${s}' of catalog entry '${t}'...`);let l=await n.dataCatalog.deprecateVersion(t,s,a,{token:n.token});r.success(`Successfully deprecated version '${s}' of data catalog entry '${t}'.`,l)}else{_.debug(`[catalog:deprecate] Deprecating catalog entry '${t}'...`);let l=await n.dataCatalog.deprecate(t,a,{token:n.token});r.success(`Successfully deprecated data catalog entry '${t}'.`,l)}}catch(n){let l=Z(n);r.error(l),process.exit(1)}}),e.command("unpublish <key>").description("Unpublish (mark as private) a data catalog entry or specific version").option("--catalog-version <ver>","Version string to unpublish").option("--ver <ver>","Version string alias").option("--org <oid>","Organization ID (optional, defaults to configured default org)").action(async(t,i)=>{let r=new H({format:P.resolved.format}),s=i.catalogVersion||i.ver;try{let a=X();if(s){_.debug(`[catalog:unpublish] Unpublishing version '${s}' of catalog entry '${t}'...`);let n=await a.dataCatalog.unpublishVersion(t,s,{token:a.token});r.success(`Successfully unpublished version '${s}' of data catalog entry '${t}'.`,n)}else{_.debug(`[catalog:unpublish] Unpublishing catalog entry '${t}'...`);let n=await a.dataCatalog.unpublish(t,{token:a.token});r.success(`Successfully unpublished data catalog entry '${t}'.`,n)}}catch(a){let n=Z(a);r.error(n),process.exit(1)}}),e.command("dependent-apis <key>").alias("usage").description("List all APIs referencing a published data catalog item or version").option("--catalog-version <ver>","Filter usage by a specific version").option("--ver <ver>","Filter usage by a specific version alias").option("--org <oid>","Organization ID (optional, defaults to configured default org)").action(async(t,i)=>{let r=new H({format:P.resolved.format}),s=i.catalogVersion||i.ver;try{let a=X(),n;s?(_.debug(`[catalog:dependent-apis] Fetching usage files for catalog entry '${t}' version '${s}'`),n=await a.dataCatalog.getVersionUsageFiles(t,s,{token:a.token})):(_.debug(`[catalog:dependent-apis] Fetching usage files for catalog entry '${t}'`),n=await a.dataCatalog.getUsageFiles(t,{token:a.token}));let c=(n.data||[]).map(p=>({fileId:p.value.key,name:p.value.info?.name||"Unnamed",version:p.meta?.version||"N/A"}));r.list(c,["fileId","name","version"],{headers:["FILE ID","NAME","VERSION USED"]})}catch(a){let n=Z(a);r.error(n),process.exit(1)}}),e.command("status <fid>").description("Check the publication status and versions of a data domain file").option("--org <oid>","Organization ID (optional, defaults to configured default org)").action(async(t,i)=>{let r=new H({format:P.resolved.format}),s=P.resolved,a=i.org||s.org;try{let n=X();_.debug(`[catalog:status] Checking publication status for file '${t}' in org '${a||"N/A"}'`);let l=await n.dataCatalog.checkPublicationStatus(t,a,{token:n.token});r.object(l)}catch(n){let l=Z(n);r.error(l),process.exit(1)}})}import os from"node:fs";import go from"node:path";var Me=class{root;get domain(){return this.root}#e;get key(){return this.#e}#t;get namespace(){return this.#t}constructor(e,t){this.root=e,this.#e=t,this.#t=e.key}};var ol="http://a.ml/",kt=`${ol}vocabularies/`,B=`${kt}document#`,de=`${kt}core#`,Y=`${kt}security#`,T=`${kt}apiContract#`,Ni=`${kt}apiBinding#`,K=`${kt}shapes#`,me=`${kt}data#`,We=`${kt}document-source-maps#`,$i="http://www.w3.org/",se=`${$i}ns/shacl#`,je=`${$i}2001/XMLSchema#`,vr=`${$i}1999/02/22-rdf-syntax-ns#`,Cs=`${$i}2000/01/rdf-schema#`,d={aml:{key:"http://a.ml/",vocabularies:{key:kt,document:{key:B,Module:`${B}Module`,Document:`${B}Document`,Fragment:`${B}Fragment`,Unit:`${B}Unit`,SecuritySchemeFragment:`${B}SecuritySchemeFragment`,UserDocumentation:`${B}UserDocumentation`,DataType:`${B}DataType`,NamedExamples:`${B}NamedExamples`,DomainElement:`${B}DomainElement`,DomainProperty:`${B}DomainProperty`,ParametrizedDeclaration:`${B}ParametrizedDeclaration`,AbstractDeclaration:`${B}AbstractDeclaration`,VariableValue:`${B}VariableValue`,ExternalFragment:`${B}ExternalFragment`,ExternalDomainElement:`${B}ExternalDomainElement`,RootDomainElement:`${B}RootDomainElement`,APIContractProcessingData:`${B}APIContractProcessingData`,BaseUnitProcessingData:`${B}BaseUnitProcessingData`,customDomainProperties:`${B}customDomainProperties`,encodes:`${B}encodes`,declares:`${B}declares`,references:`${B}references`,examples:`${B}examples`,linkTarget:`${B}link-target`,linkLabel:`${B}link-label`,referenceId:`${B}reference-id`,structuredValue:`${B}structuredValue`,raw:`${B}raw`,extends:`${B}extends`,value:`${B}value`,name:`${B}name`,strict:`${B}strict`,deprecated:`${B}deprecated`,location:`${B}location`,variable:`${B}variable`,target:`${B}target`,dataNode:`${B}dataNode`,root:`${B}root`,usage:`${B}usage`,version:`${B}version`},core:{key:de,CreativeWork:`${de}CreativeWork`,Parameter:`${de}Parameter`,Organization:`${de}Organization`,License:`${de}License`,Operation:`${de}Operation`,Response:`${de}Response`,Payload:`${de}Payload`,Request:`${de}Request`,version:`${de}version`,urlTemplate:`${de}urlTemplate`,displayName:`${de}displayName`,title:`${de}title`,name:`${de}name`,description:`${de}description`,documentation:`${de}documentation`,summary:`${de}summary`,provider:`${de}provider`,email:`${de}email`,url:`${de}url`,termsOfService:`${de}termsOfService`,license:`${de}license`,mediaType:`${de}mediaType`,extensionName:`${de}extensionName`,deprecated:`${de}deprecated`},security:{key:Y,ParametrizedSecurityScheme:`${Y}ParametrizedSecurityScheme`,SecuritySchemeFragment:`${Y}SecuritySchemeFragment`,SecurityScheme:`${Y}SecurityScheme`,OAuth1Settings:`${Y}OAuth1Settings`,OAuth2Settings:`${Y}OAuth2Settings`,OAuth2Flow:`${Y}OAuth2Flow`,Scope:`${Y}Scope`,Settings:`${Y}Settings`,HttpSettings:`${Y}HttpSettings`,ApiKeySettings:`${Y}ApiKeySettings`,OpenIdConnectSettings:`${Y}OpenIdConnectSettings`,SecurityRequirement:`${Y}SecurityRequirement`,security:`${Y}security`,scheme:`${Y}scheme`,schemes:`${Y}schemes`,settings:`${Y}settings`,name:`${Y}name`,type:`${Y}type`,scope:`${Y}scope`,accessTokenUri:`${Y}accessTokenUri`,authorizationUri:`${Y}authorizationUri`,authorizationGrant:`${Y}authorizationGrant`,flows:`${Y}flows`,flow:`${Y}flow`,signature:`${Y}signature`,tokenCredentialsUri:`${Y}tokenCredentialsUri`,requestTokenUri:`${Y}requestTokenUri`,refreshUri:`${Y}refreshUri`,securityRequirement:`${Y}SecurityRequirement`,openIdConnectUrl:`${Y}openIdConnectUrl`,bearerFormat:`${Y}bearerFormat`,in:`${Y}in`},apiContract:{key:T,Payload:`${T}Payload`,Request:`${T}Request`,Response:`${T}Response`,EndPoint:`${T}EndPoint`,Parameter:`${T}Parameter`,Operation:`${T}Operation`,WebAPI:`${T}WebAPI`,API:`${T}API`,AsyncAPI:`${T}AsyncAPI`,UserDocumentationFragment:`${T}UserDocumentationFragment`,Example:`${T}Example`,Server:`${T}Server`,ResourceType:`${T}ResourceType`,Trait:`${T}Trait`,TraitFragment:`${T}TraitFragment`,ParametrizedResourceType:`${T}ParametrizedResourceType`,ParametrizedTrait:`${T}ParametrizedTrait`,Callback:`${T}Callback`,TemplatedLink:`${T}TemplatedLink`,IriTemplateMapping:`${T}IriTemplateMapping`,Tag:`${T}Tag`,Message:`${T}Message`,DomainExtension:`${T}DomainExtension`,Encoding:`${T}Encoding`,header:`${T}header`,parameter:`${T}parameter`,paramName:`${T}paramName`,uriParameter:`${T}uriParameter`,cookieParameter:`${T}cookieParameter`,variable:`${T}variable`,payload:`${T}payload`,server:`${T}server`,path:`${T}path`,url:`${T}url`,scheme:`${T}scheme`,endpoint:`${T}endpoint`,queryString:`${T}queryString`,accepts:`${T}accepts`,guiSummary:`${T}guiSummary`,binding:`${T}binding`,response:`${T}response`,returns:`${T}returns`,expects:`${T}expects`,examples:`${T}examples`,supportedOperation:`${T}supportedOperation`,messageId:`${T}messageId`,statusCode:`${T}statusCode`,method:`${T}method`,required:`${T}required`,callback:`${T}callback`,expression:`${T}expression`,link:`${T}link`,linkExpression:`${T}linkExpression`,templateVariable:`${T}templateVariable`,mapping:`${T}mapping`,operationId:`${T}operationId`,protocol:`${T}protocol`,protocolVersion:`${T}protocolVersion`,headerSchema:`${T}headerSchema`,contentType:`${T}contentType`,allowEmptyValue:`${T}allowEmptyValue`,style:`${T}style`,explode:`${T}explode`,allowReserved:`${T}allowReserved`,tag:`${T}tag`,tags:`${T}tags`},apiBinding:{key:Ni,binding:`${Ni}binding`,bindings:`${Ni}bindings`,messageKey:`${Ni}messageKey`,type:`${Ni}type`},shapes:{key:K,Shape:`${K}Shape`,ScalarShape:`${K}ScalarShape`,ArrayShape:`${K}ArrayShape`,UnionShape:`${K}UnionShape`,NilShape:`${K}NilShape`,FileShape:`${K}FileShape`,AnyShape:`${K}AnyShape`,SchemaShape:`${K}SchemaShape`,MatrixShape:`${K}MatrixShape`,TupleShape:`${K}TupleShape`,RecursiveShape:`${K}RecursiveShape`,DataTypeFragment:`${K}DataTypeFragment`,XMLSerializer:`${K}XMLSerializer`,number:`${K}number`,integer:`${K}integer`,long:`${K}long`,double:`${K}double`,boolean:`${K}boolean`,float:`${K}float`,nil:`${K}nil`,password:`${K}password`,int32:`${K}int32`,int64:`${K}int64`,uint32:`${K}uint32`,uint64:`${K}uint64`,sint32:`${K}sint32`,sint64:`${K}sint64`,fixed32:`${K}fixed32`,fixed64:`${K}fixed64`,sfixed32:`${K}sfixed32`,sfixed64:`${K}sfixed64`,dateTimeOnly:`${K}dateTimeOnly`,range:`${K}range`,items:`${K}items`,anyOf:`${K}anyOf`,fileType:`${K}fileType`,schema:`${K}schema`,xmlSerialization:`${K}xmlSerialization`,xmlName:`${K}xmlName`,xmlAttribute:`${K}xmlAttribute`,xmlWrapped:`${K}xmlWrapped`,xmlNamespace:`${K}xmlNamespace`,xmlPrefix:`${K}xmlPrefix`,readOnly:`${K}readOnly`,writeOnly:`${K}writeOnly`,deprecated:`${K}deprecated`,fixPoint:`${K}fixPoint`,discriminator:`${K}discriminator`,discriminatorValue:`${K}discriminatorValue`,format:`${K}format`,multipleOf:`${K}multipleOf`,uniqueItems:`${K}uniqueItems`},data:{key:me,Scalar:`${me}Scalar`,Object:`${me}Object`,Array:`${me}Array`,Node:`${me}Node`,value:`${me}value`,type:`${me}type`,description:`${me}description`,required:`${me}required`,displayName:`${me}displayName`,minLength:`${me}minLength`,maxLength:`${me}maxLength`,default:`${me}default`,multipleOf:`${me}multipleOf`,minimum:`${me}minimum`,maximum:`${me}maximum`,enum:`${me}enum`,pattern:`${me}pattern`,items:`${me}items`,format:`${me}format`,example:`${me}example`,examples:`${me}examples`},docSourceMaps:{key:We,SourceMap:`${We}SourceMap`,sources:`${We}sources`,element:`${We}element`,value:`${We}value`,declaredElement:`${We}declared-element`,trackedElement:`${We}tracked-element`,parsedJsonSchema:`${We}parsed-json-schema`,autoGeneratedName:`${We}auto-generated-name`,lexical:`${We}lexical`,synthesizedField:`${We}synthesized-field`}}},w3:{key:$i,shacl:{key:se,Shape:`${se}Shape`,NodeShape:`${se}NodeShape`,SchemaShape:`${se}SchemaShape`,PropertyShape:`${se}PropertyShape`,in:`${se}in`,defaultValue:`${se}defaultValue`,defaultValueStr:`${se}defaultValueStr`,pattern:`${se}pattern`,minInclusive:`${se}minInclusive`,maxInclusive:`${se}maxInclusive`,multipleOf:`${se}multipleOf`,minLength:`${se}minLength`,maxLength:`${se}maxLength`,fileType:`${se}fileType`,and:`${se}and`,property:`${se}property`,name:`${se}name`,raw:`${se}raw`,datatype:`${se}datatype`,minCount:`${se}minCount`,maxCount:`${se}maxCount`,xone:`${se}xone`,not:`${se}not`,or:`${se}or`,closed:`${se}closed`,path:`${se}path`,additionalPropertiesSchema:`${se}additionalPropertiesSchema`},xmlSchema:{key:je,boolean:`${je}boolean`,string:`${je}string`,number:`${je}number`,integer:`${je}integer`,long:`${je}long`,double:`${je}double`,float:`${je}float`,nil:`${je}nil`,dateTime:`${je}dateTime`,time:`${je}time`,date:`${je}date`,base64Binary:`${je}base64Binary`,byte:`${je}byte`},rdfSyntax:{key:vr,Seq:`${vr}Seq`,Property:`${vr}Property`,member:`${vr}member`},rdfSchema:{key:Cs,Seq:`${Cs}Seq`,member:`${Cs}member`}}};function si(o,e=0){if(typeof o!="object")return o;let t="",i=new Array(e).fill(" ").join("");return Object.keys(o).forEach(r=>{t+=Array.isArray(o[r])?"":`${i}<${r}>`,Array.isArray(o[r])?o[r].forEach(s=>{t+=i,t+=`<${r}>
|
|
28
|
+
`,t+=si({...s},e+1),t+=i,t+=`</${r}>
|
|
30
29
|
`}):typeof o[r]=="object"?(t+=`
|
|
31
|
-
`,t+=
|
|
32
|
-
`}),t=t.replace(/<\/?[0-9]{1,}>/g,""),t}function
|
|
30
|
+
`,t+=si({...o[r]},e+1),t+=i):t+=`${o[r]}`,t+=Array.isArray(o[r])?"":`</${r}>
|
|
31
|
+
`}),t=t.replace(/<\/?[0-9]{1,}>/g,""),t}function _r(o,e){return String(e).split(`
|
|
33
32
|
`).filter(s=>!!s).map(s=>`${o}${s}`).join(`
|
|
34
|
-
`)}function
|
|
35
|
-
`):`${ni({[t]:r})}`:`${ni(r,s)}`}};var Ne={};Ea(Ne,{anyShape:()=>$t,arrayShape:()=>Ec,fileShape:()=>Ac,nodeShape:()=>Sc,propertyShape:()=>Ic,recursiveShape:()=>jc,scalarShape:()=>_c,shape:()=>Ws,tupleShape:()=>Nc,unionShape:()=>xc,xmlSerializer:()=>tn});var ji={};Ea(ji,{IAmfAPIContractProcessingDataTypes:()=>nc,IAmfAnyTypes:()=>Vs,IAmfApiKeySettingsTypes:()=>Bl,IAmfArrayNodeTypes:()=>Gs,IAmfArrayTypes:()=>Ds,IAmfAsyncApiTypes:()=>vc,IAmfBaseUnitProcessingDataTypes:()=>kc,IAmfCallbackTypes:()=>Yl,IAmfCreativeWorkTypes:()=>sc,IAmfDataTypeFragmentTypes:()=>hc,IAmfDocumentTypes:()=>rc,IAmfDomainExtensionTypes:()=>tc,IAmfDomainPropertyTypes:()=>bc,IAmfEncodingTypes:()=>ac,IAmfEndpointType:()=>Cl,IAmfExampleTypes:()=>jl,IAmfExternalDomainElementTypes:()=>wc,IAmfExternalFragmentTypes:()=>fc,IAmfFileTypes:()=>zs,IAmfHttpSettingsTypes:()=>Gl,IAmfIriTemplateMappingTypes:()=>Zl,IAmfLicenseTypes:()=>Rl,IAmfMessageTypes:()=>ec,IAmfModuleTypes:()=>mc,IAmfNilTypes:()=>Nl,IAmfNodeTypes:()=>Us,IAmfOAuth1SettingsTypes:()=>Jl,IAmfOAuth2FlowTypes:()=>ql,IAmfOAuth2SettingsTypes:()=>Kl,IAmfObjectNodeTypes:()=>Bs,IAmfOpenIdConnectSettingsTypes:()=>Wl,IAmfParameterTypes:()=>Tl,IAmfParametrizedResourceTypeTypes:()=>lc,IAmfParametrizedSecuritySchemeTypes:()=>Vl,IAmfParametrizedTraitTypes:()=>cc,IAmfPayloadTypes:()=>Ml,IAmfPropertyTypes:()=>Ls,IAmfProviderTypes:()=>Pl,IAmfRdfsSeqType:()=>oc,IAmfRecursiveTypes:()=>Ks,IAmfRequestTypes:()=>Ul,IAmfResourceTypeTypes:()=>dc,IAmfResponseTypes:()=>Ll,IAmfScalarNodeTypes:()=>Js,IAmfScalarTypes:()=>Cs,IAmfSchemaTypes:()=>Il,IAmfScopeTypes:()=>Hl,IAmfSecurityRequirementTypes:()=>zl,IAmfSecuritySchemeFragmentTypes:()=>yc,IAmfSecuritySchemeTypes:()=>Fl,IAmfServerType:()=>Ol,IAmfSourceMapTypes:()=>ic,IAmfSupportedOperationTypes:()=>Dl,IAmfTagTypes:()=>Ql,IAmfTemplatedLinkTypes:()=>Xl,IAmfTraitFragmentTypes:()=>gc,IAmfTraitTypes:()=>pc,IAmfTupleTypes:()=>Fs,IAmfUnionTypes:()=>Ms,IAmfVariableValueTypes:()=>uc,IAmfWebApiType:()=>$l,IAmfXmlSerializationTypes:()=>qs});var Cs=[d.aml.vocabularies.shapes.ScalarShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Ds=[d.aml.vocabularies.shapes.ArrayShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Us=[d.w3.shacl.NodeShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Ls=[d.w3.shacl.PropertyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Nl=[d.aml.vocabularies.shapes.NilShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Ms=[d.aml.vocabularies.shapes.UnionShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],zs=[d.aml.vocabularies.shapes.FileShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Vs=[d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Il=[d.aml.vocabularies.shapes.SchemaShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Fs=[d.aml.vocabularies.shapes.TupleShape,d.aml.vocabularies.shapes.ArrayShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Ks=[d.aml.vocabularies.shapes.RecursiveShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],qs=[d.aml.vocabularies.shapes.XMLSerializer,d.aml.vocabularies.document.DomainElement],Js=[d.aml.vocabularies.data.Scalar,d.aml.vocabularies.data.Node,d.aml.vocabularies.document.DomainElement],Gs=[d.aml.vocabularies.data.Array,d.w3.rdfSyntax.Seq,d.aml.vocabularies.data.Node,d.aml.vocabularies.document.DomainElement],Bs=[d.aml.vocabularies.data.Object,d.aml.vocabularies.data.Node,d.aml.vocabularies.document.DomainElement],jl=[d.aml.vocabularies.apiContract.Example,d.aml.vocabularies.document.DomainElement],$l=[d.aml.vocabularies.apiContract.WebAPI,d.aml.vocabularies.apiContract.API,d.aml.vocabularies.document.RootDomainElement,d.aml.vocabularies.document.DomainElement],Ol=[d.aml.vocabularies.apiContract.Server,d.aml.vocabularies.document.DomainElement],Tl=[d.aml.vocabularies.apiContract.Parameter,d.aml.vocabularies.core.Parameter,d.aml.vocabularies.document.DomainElement],Pl=[d.aml.vocabularies.core.Organization,d.aml.vocabularies.document.DomainElement],Rl=[d.aml.vocabularies.core.License,d.aml.vocabularies.document.DomainElement],Cl=[d.aml.vocabularies.apiContract.EndPoint,d.aml.vocabularies.document.DomainElement],Dl=[d.aml.vocabularies.apiContract.Operation,d.aml.vocabularies.core.Operation,d.aml.vocabularies.document.DomainElement],Ul=[d.aml.vocabularies.apiContract.Request,d.aml.vocabularies.core.Request,d.aml.vocabularies.apiContract.Message,d.aml.vocabularies.document.DomainElement],Ll=[d.aml.vocabularies.apiContract.Response,d.aml.vocabularies.core.Response,d.aml.vocabularies.apiContract.Message,d.aml.vocabularies.document.DomainElement],Ml=[d.aml.vocabularies.apiContract.Payload,d.aml.vocabularies.core.Payload,d.aml.vocabularies.document.DomainElement],zl=[d.aml.vocabularies.security.SecurityRequirement,d.aml.vocabularies.document.DomainElement],Vl=[d.aml.vocabularies.security.ParametrizedSecurityScheme,d.aml.vocabularies.document.DomainElement],Fl=[d.aml.vocabularies.security.SecurityScheme,d.aml.vocabularies.document.DomainElement],Kl=[d.aml.vocabularies.security.OAuth2Settings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],ql=[d.aml.vocabularies.security.OAuth2Flow,d.aml.vocabularies.document.DomainElement],Jl=[d.aml.vocabularies.security.OAuth1Settings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],Gl=[d.aml.vocabularies.security.HttpSettings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],Bl=[d.aml.vocabularies.security.ApiKeySettings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],Wl=[d.aml.vocabularies.security.OpenIdConnectSettings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],Hl=[d.aml.vocabularies.security.Scope,d.aml.vocabularies.document.DomainElement],Yl=[d.aml.vocabularies.apiContract.Callback,d.aml.vocabularies.document.DomainElement],Xl=[d.aml.vocabularies.apiContract.TemplatedLink,d.aml.vocabularies.document.DomainElement],Zl=[d.aml.vocabularies.apiContract.IriTemplateMapping,d.aml.vocabularies.document.DomainElement],Ql=[d.aml.vocabularies.apiContract.Tag,d.aml.vocabularies.document.DomainElement],ec=[d.aml.vocabularies.apiContract.Message,d.aml.vocabularies.document.DomainElement],tc=[d.aml.vocabularies.apiContract.DomainExtension,d.aml.vocabularies.document.DomainElement],ic=[d.aml.vocabularies.docSourceMaps.SourceMap],rc=[d.aml.vocabularies.document.Document,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Module,d.aml.vocabularies.document.Unit],sc=[d.aml.vocabularies.core.CreativeWork,d.aml.vocabularies.document.DomainElement],ac=[d.aml.vocabularies.apiContract.Encoding,d.aml.vocabularies.document.DomainElement],nc=[d.aml.vocabularies.document.APIContractProcessingData],oc=[d.w3.rdfSchema.Seq],lc=[d.aml.vocabularies.apiContract.ParametrizedResourceType,d.aml.vocabularies.document.ParametrizedDeclaration,d.aml.vocabularies.document.DomainElement],cc=[d.aml.vocabularies.apiContract.ParametrizedTrait,d.aml.vocabularies.document.ParametrizedDeclaration,d.aml.vocabularies.document.DomainElement],dc=[d.aml.vocabularies.apiContract.ResourceType,d.aml.vocabularies.document.AbstractDeclaration,d.aml.vocabularies.document.DomainElement],pc=[d.aml.vocabularies.apiContract.Trait,d.aml.vocabularies.document.AbstractDeclaration,d.aml.vocabularies.document.DomainElement],uc=[d.aml.vocabularies.document.VariableValue,d.aml.vocabularies.document.DomainElement],mc=[d.aml.vocabularies.document.Module,d.aml.vocabularies.document.Unit],hc=[d.aml.vocabularies.shapes.DataTypeFragment,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Unit],fc=[d.aml.vocabularies.document.ExternalFragment,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Unit],gc=[d.aml.vocabularies.apiContract.TraitFragment,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Unit],yc=[d.aml.vocabularies.security.SecuritySchemeFragment,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Unit],bc=[d.aml.vocabularies.document.DomainProperty,d.w3.rdfSyntax.Property,d.aml.vocabularies.document.DomainElement],wc=[d.aml.vocabularies.document.ExternalDomainElement,d.aml.vocabularies.document.DomainElement],kc=[d.aml.vocabularies.document.BaseUnitProcessingData],vc=[d.aml.vocabularies.apiContract.AsyncAPI,d.aml.vocabularies.apiContract.API,d.aml.vocabularies.document.RootDomainElement,d.aml.vocabularies.document.DomainElement];function tn(o){return{id:`xml-serializer-${o}`,types:qs,customDomainProperties:[]}}function Ws(o){return{id:o,types:[],values:[],inherits:[],or:[],and:[],xone:[],customDomainProperties:[]}}function $t(o){return{...Ws(o),types:Vs,examples:[],xmlSerialization:tn(o)}}function Sc(o){let e=$t(o);return e.types=Us,e.id=`node-shape-${o}`,{...e,properties:[],dependencies:[],customShapeProperties:[],customShapePropertyDefinitions:[]}}function _c(o){let e=$t(o);return e.id=`scalar-shape-${o}`,e.types=Cs,e}function xc(o){let e=$t(o);return e.id=`union-shape-${o}`,e.types=Ms,{...e,anyOf:[]}}function Ac(o){let e=$t(o);return e.id=`file-shape-${o}`,e.types=zs,e}function Ec(o){let e=$t(o);return e.id=`array-shape-${o}`,e.types=Ds,e}function Nc(o){let e=$t(o);return e.id=`tuple-shape-${o}`,e.types=Fs,{...e,items:[]}}function Ic(o){let e=$t(o);return e.types=Ls,e}function jc(o,e){return{...Ws(o),id:`recursive-${o}`,types:Ks,fixPoint:e||""}}import{customAlphabet as $c}from"nanoid";var rn=$c("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_",21);var et=class o{id=rn();types;name;properties;value;dataType;members;customDomainProperties=[];static scalar(e,t){let i=new o("scalar");return i.value=e,i.dataType=t,i}constructor(e){if(typeof e=="string"){if(e==="scalar")this.types=Js;else if(e==="array")this.types=Gs;else if(e==="object")this.types=Bs;else throw new Error(`Invalid data node init option: ${e}`);return}if(!e)throw new Error("Expected an initialization option.");let t=e,{id:i,types:r,customDomainProperties:s}=t;if(this.id=i,this.types=r,this.customDomainProperties=s,r.includes(d.aml.vocabularies.data.Scalar)){let a=t;this.value=a.value,this.dataType=a.dataType}else if(r.includes(d.aml.vocabularies.data.Object)){let a=t,n={};this.properties=n,Object.keys(a.properties).forEach(l=>{let c=new o(a.properties[l]);n[l]=c})}else if(r.includes(d.aml.vocabularies.data.Array)){let a=t,n=[];this.members=n,Array.isArray(a.members)&&a.members.forEach(l=>{let c=new o(l);n.push(c)})}}toJSON(){let{id:e,customDomainProperties:t,types:i,name:r}=this,s={id:e,types:i,customDomainProperties:t};if(r&&(s.name=r),i.includes(d.aml.vocabularies.data.Scalar)){let a=s;a.dataType=this.dataType,a.value=this.value}else if(i.includes(d.aml.vocabularies.data.Object)){let a=s;a.properties={};let n=this.properties;n&&Object.keys(n).forEach(l=>{a.properties[l]=n[l].toJSON()})}else if(i.includes(d.aml.vocabularies.data.Array)){let a=s;a.members=[],this.members&&this.members.forEach(n=>{a.members.push(n.toJSON())})}return s}addMember(e){if(!this.types.includes(d.aml.vocabularies.data.Array))throw new Error("Not an ArrayNode.");this.members||(this.members=[]),this.members.push(e)}removeMember(e){if(!this.types.includes(d.aml.vocabularies.data.Array))throw new Error("Not an ArrayNode.");if(!this.members)return;let t=this.members.findIndex(i=>i.id===e);t>=0&&this.members.splice(t,1)}addProperty(e,t){if(!this.types.includes(d.aml.vocabularies.data.Object))throw new Error("Not an ObjectNode.");this.properties||(this.properties={}),this.properties[e]=t}removeProperty(e){if(!this.types.includes(d.aml.vocabularies.data.Object))throw new Error("Not an ObjectNode.");this.properties&&delete this.properties[e]}};var ke=Symbol("nValue"),$i=Symbol("mValue"),sn=Symbol("matrixAValue"),Dr=Symbol("upperMaskValue"),Ur=Symbol("lowerMaskValue"),W=Symbol("mtValue"),Te=Symbol("mtiValue"),Lr=Symbol("instancesValue"),Ot=class o{static[Lr]=new Map;[ke]=624;[$i]=397;[sn]=2567483615;[Dr]=2147483648;[Ur]=2147483647;[W]=new Array(this[ke]);[Te]=this[ke]+1;constructor(e=o.seedFn()){this.initGenRand(e)}static seedFn(){return Math.floor(Math.random()*10**13)}static fromSeed(e=o.seedFn()){if(this[Lr].has(e))return this[Lr].get(e);let t=new o(e);return this[Lr].set(e,t),t}initGenRand(e){let t=e;for(this[W][0]=t>>>0,this[Te]=1;this[Te]<this[ke];this[Te]++)t=this[W][this[Te]-1]^this[W][this[Te]-1]>>>30,this[W][this[Te]]=(((t&4294901760)>>>16)*1812433253<<16)+(t&65535)*1812433253+this[Te],this[W][this[Te]]>>>=0}initByArray(e,t){let i=1,r=0,s;this.initGenRand(19650218);let a=this[ke]>t?this[ke]:t;for(;a;a--)s=this[W][i-1]^this[W][i-1]>>>30,this[W][i]=(this[W][i]^(((s&4294901760)>>>16)*1664525<<16)+(s&65535)*1664525)+e[r]+r,this[W][i]>>>=0,i++,r++,i>=this[ke]&&(this[W][0]=this[W][this[ke]-1],i=1),r>=t&&(r=0);for(a=this[ke]-1;a;a--)s=this[W][i-1]^this[W][i-1]>>>30,this[W][i]=(this[W][i]^(((s&4294901760)>>>16)*1566083941<<16)+(s&65535)*1566083941)-i,this[W][i]>>>=0,i++,i>=this[ke]&&(this[W][0]=this[W][this[ke]-1],i=1);this[W][0]=2147483648}int32(){let e,t=[0,this[sn]];if(this[Te]>=this[ke]){let i;for(this[Te]===this[ke]+1&&this.initGenRand(5489),i=0;i<this[ke]-this[$i];i++)e=this[W][i]&this[Dr]|this[W][i+1]&this[Ur],this[W][i]=this[W][i+this[$i]]^e>>>1^t[e&1];for(;i<this[ke]-1;i++)e=this[W][i]&this[Dr]|this[W][i+1]&this[Ur],this[W][i]=this[W][i+(this[$i]-this[ke])]^e>>>1^t[e&1];e=this[W][this[ke]-1]&this[Dr]|this[W][0]&this[Ur],this[W][this[ke]-1]=this[W][this[$i]-1]^e>>>1^t[e&1],this[Te]=0}return e=this[W][this[Te]++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0}int31(){return this.int32()>>>1}real1(){return this.int32()*(1/4294967295)}random(e=32768,t=0){return Math.floor(this.real2()*(e-t)+t)}real2(){return this.int32()*(1/4294967296)}real3(){return(this.int32()+.5)*(1/4294967296)}res53(){let e=this.int32()>>>5,t=this.int32()>>>6;return(e*67108864+t)*(1/9007199254740992)}};var Mr="0123456789",Oi="abcdefghijklmnopqrstuvwxyz",zr=Oi.toUpperCase(),Hs=`${Mr}abcdef`;function an(o=""){return o.replace(/ /g,"-").replace(/[^一-龠ぁ-ゔァ-ヴー\w.-]+/g,"")}function tt(o,e={}){let t={};typeof e=="number"?t.max=e:typeof e=="object"&&(t={...e}),typeof t.min!="number"&&(t.min=0),typeof t.max!="number"&&(t.max=99999),typeof t.precision!="number"&&(t.precision=1),t.max>0&&(t.max+=t.precision);let i=Math.floor(o.random(t.max/t.precision,t.min/t.precision));return t.precision===1||(i/=1/t.precision),i}function Vr(o,e={}){let t={};return typeof e=="number"?t.precision=e:typeof e=="object"&&(t={...e}),typeof t.precision!="number"&&(t.precision=.01),tt(o,t)}function nn(o,e=10,t){let i=typeof t=="string"?t:zr+Oi,r={min:0,max:i.length-1};return new Array(e).fill("").map(()=>i[tt(o,r)]).join("")}function on(o,e={}){let t={...e},i;switch(t.casing){case"lower":i=Oi;break;case"upper":i=zr;break;default:i=Oi+zr}if(!t.pool){t.pool="";let r="!@#$%^&*()[]";t.alpha&&(t.pool+=i),t.numeric&&(t.pool+=Mr),t.symbols&&(t.pool+=r),t.pool||(t.pool=`${i}${Mr}${r}`)}return t.pool.charAt(tt(o,t.pool.length-1))}function ln(o,e={}){let t={};typeof e=="number"?t.max=e:typeof e=="object"&&(t={...e});let i=864e13;(typeof t.min!="number"||t.min<i*-1)&&(t.min=new Date().setFullYear(1970,1,1)),(typeof t.max!="number"||t.max>i)&&(t.max=new Date().setFullYear(2100,1,1));let r=tt(o,t);return new Date(r)}var oi=Symbol("mtValue"),Tt=class{[oi];constructor(e){this[oi]=Ot.fromSeed(e)}seed(e){this[oi]=Ot.fromSeed(e)}pick(e,t){let i=t;typeof i!="number"?i=tt(this[oi],{min:1,max:e.length}):i>e.length?i=e.length:i<0&&(i=0);let r=[...e],s=r.length,a=s-i,n,l;for(;s-- >a;)l=Math.floor((s+1)*Vr(this[oi],{min:0,max:.99})),n=r[l],r[l]=r[s],r[s]=n;return r.slice(a)}pickOne(e){let t=tt(this[oi],{max:e.length-1});return e[t]}};var Ti=Symbol("randomValue"),it=Symbol("mtValue"),De=class{[it];[Ti];constructor(e){this[it]=Ot.fromSeed(e),this[Ti]=new Tt(e)}seed(e){this[it]=Ot.fromSeed(e),this[Ti].seed(e)}number(e={}){return tt(this[it],e)}float(e={}){return Vr(this[it],e)}datetime(e={}){return ln(this[it],e)}string(e=10,t){return nn(this[it],e,t)}character(e={}){return on(this[it],e)}uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let i=this.number({min:0,max:15});return(t==="x"?i:i&3|8).toString(16)})}hash(e={}){let{length:t=40,casing:i="lower"}=e,r=i==="upper"?Hs.toUpperCase():Hs;return this.string(t,r)}boolean(e={}){let t={};if(typeof e=="number"?t.likelihood=e:typeof e=="object"&&(t={...e}),typeof t.likelihood>"u"&&(t.likelihood=tt(this[it],{min:0,max:100})),t.likelihood<0||t.likelihood>100)throw new RangeError("Invalid likelihood range. Accepted range is [0, 100].");return this[it].real2()*100<t.likelihood}falsy(e={}){let t=e.pool||[!1,null,0,NaN,""];return this[Ti].pickOne(t)}hexaDecimal(e=1){let t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","A","B","C","D","E","F"];return`0x${this[Ti].pick(t,e).join("")}`}};var Oc={names:["January","February","March","April","May","June","July","August","September","October","November","December"],abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},dn=Oc;var Tc={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},pn=Tc;var Pc={month:dn,weekday:pn},un=Pc;var Rc=Object.freeze({consonants:"bcdfghjklmnprstvwz",vowels:"aeiou"}),mn=Rc;var Cc={free:["gmail.com","yahoo.com","hotmail.com"],example:["example.org","example.com","example.net"]},hn=Cc;var Dc={suffix:["com","biz","info","name","net","org"]},fn=Dc;var Uc=["0therplanet_128.jpg","1markiz_128.jpg","2fockus_128.jpg","8d3k_128.jpg","91bilal_128.jpg","9lessons_128.jpg","AM_Kn2_128.jpg","AlbertoCococi_128.jpg","BenouarradeM_128.jpg","BillSKenney_128.jpg","BrianPurkiss_128.jpg","BroumiYoussef_128.jpg","BryanHorsey_128.jpg","Chakintosh_128.jpg","ChrisFarina78_128.jpg","Elt_n_128.jpg","GavicoInd_128.jpg","HenryHoffman_128.jpg","IsaryAmairani_128.jpg","Karimmove_128.jpg","LucasPerdidao_128.jpg","ManikRathee_128.jpg","RussellBishop_128.jpg","S0ufi4n3_128.jpg","SULiik_128.jpg","Shriiiiimp_128.jpg","Silveredge9_128.jpg","Skyhartman_128.jpg","SlaapMe_128.jpg","Stievius_128.jpg","Talbi_ConSept_128.jpg","VMilescu_128.jpg","VinThomas_128.jpg","YoungCutlass_128.jpg","ZacharyZorbas_128.jpg","_dwite__128.jpg","_kkga_128.jpg","_pedropinho_128.jpg","_ragzor_128.jpg","_scottburgess_128.jpg","_shahedk_128.jpg","_victa_128.jpg","_vojto_128.jpg","_williamguerra_128.jpg","_yardenoon_128.jpg","a1chapone_128.jpg","a_brixen_128.jpg","a_harris88_128.jpg","aaronalfred_128.jpg","aaroni_128.jpg","aaronkwhite_128.jpg","abdots_128.jpg","abdulhyeuk_128.jpg","abdullindenis_128.jpg","abelcabans_128.jpg","abotap_128.jpg","abovefunction_128.jpg","adamawesomeface_128.jpg","adammarsbar_128.jpg","adamnac_128.jpg","adamsxu_128.jpg","adellecharles_128.jpg","ademilter_128.jpg","adhamdannaway_128.jpg","adhiardana_128.jpg","adityasutomo_128.jpg","adobi_128.jpg","adrienths_128.jpg","aeon56_128.jpg","afusinatto_128.jpg","agromov_128.jpg","agustincruiz_128.jpg","ah_lice_128.jpg","ahmadajmi_128.jpg","ahmetalpbalkan_128.jpg","ahmetsulek_128.jpg","aiiaiiaii_128.jpg","ainsleywagon_128.jpg","aio____128.jpg","airskylar_128.jpg","aislinnkelly_128.jpg","ajaxy_ru_128.jpg","aka_james_128.jpg","akashsharma39_128.jpg","akmalfikri_128.jpg","akmur_128.jpg","al_li_128.jpg","alagoon_128.jpg","alan_zhang__128.jpg","albertaugustin_128.jpg","alecarpentier_128.jpg","aleclarsoniv_128.jpg","aleinadsays_128.jpg","alek_djuric_128.jpg","aleksitappura_128.jpg","alessandroribe_128.jpg","alevizio_128.jpg","alexandermayes_128.jpg","alexivanichkin_128.jpg","algunsanabria_128.jpg","allagringaus_128.jpg","allfordesign_128.jpg","allthingssmitty_128.jpg","alsobrooks_128.jpg","alterchuca_128.jpg","aluisio_azevedo_128.jpg","alxleroydeval_128.jpg","alxndrustinov_128.jpg","amandabuzard_128.jpg","amanruzaini_128.jpg","amayvs_128.jpg","amywebbb_128.jpg","anaami_128.jpg","anasnakawa_128.jpg","anatolinicolae_128.jpg","andrea211087_128.jpg","andreas_pr_128.jpg","andresdjasso_128.jpg","andresenfredrik_128.jpg","andrewabogado_128.jpg","andrewarrow_128.jpg","andrewcohen_128.jpg","andrewofficer_128.jpg","andyisonline_128.jpg","andysolomon_128.jpg","andytlaw_128.jpg","angelceballos_128.jpg","angelcolberg_128.jpg","angelcreative_128.jpg","anjhero_128.jpg","ankitind_128.jpg","anoff_128.jpg","anthonysukow_128.jpg","antjanus_128.jpg","antongenkin_128.jpg","antonyryndya_128.jpg","antonyzotov_128.jpg","aoimedia_128.jpg","apriendeau_128.jpg","arashmanteghi_128.jpg","areandacom_128.jpg","areus_128.jpg","ariffsetiawan_128.jpg","ariil_128.jpg","arindam__128.jpg","arishi__128.jpg","arkokoley_128.jpg","aroon_sharma_128.jpg","arpitnj_128.jpg","artd_sign_128.jpg","artem_kostenko_128.jpg","arthurholcombe1_128.jpg","artvavs_128.jpg","ashernatali_128.jpg","ashocka18_128.jpg","atanism_128.jpg","atariboy_128.jpg","ateneupopular_128.jpg","attacks_128.jpg","aviddayentonbay_128.jpg","axel_128.jpg","badlittleduck_128.jpg","bagawarman_128.jpg","baires_128.jpg","balakayuriy_128.jpg","balintorosz_128.jpg","baliomega_128.jpg","baluli_128.jpg","bargaorobalo_128.jpg","barputro_128.jpg","bartjo_128.jpg","bartoszdawydzik_128.jpg","bassamology_128.jpg","batsirai_128.jpg","baumann_alex_128.jpg","baumannzone_128.jpg","bboy1895_128.jpg","bcrad_128.jpg","begreative_128.jpg","belyaev_rs_128.jpg","benefritz_128.jpg","benjamin_knight_128.jpg","bennyjien_128.jpg","benoitboucart_128.jpg","bereto_128.jpg","bergmartin_128.jpg","bermonpainter_128.jpg","bertboerland_128.jpg","besbujupi_128.jpg","beshur_128.jpg","betraydan_128.jpg","beweinreich_128.jpg","bfrohs_128.jpg","bighanddesign_128.jpg","bigmancho_128.jpg","billyroshan_128.jpg","bistrianiosip_128.jpg","blakehawksworth_128.jpg","blakesimkins_128.jpg","bluefx__128.jpg","bluesix_128.jpg","bobbytwoshoes_128.jpg","bobwassermann_128.jpg","bolzanmarco_128.jpg","borantula_128.jpg","borges_marcos_128.jpg","bowbrick_128.jpg","boxmodel_128.jpg","bpartridge_128.jpg","bradenhamm_128.jpg","brajeshwar_128.jpg","brandclay_128.jpg","brandonburke_128.jpg","brandonflatsoda_128.jpg","brandonmorreale_128.jpg","brenmurrell_128.jpg","brenton_clarke_128.jpg","bruno_mart_128.jpg","brunodesign1206_128.jpg","bryan_topham_128.jpg","bu7921_128.jpg","bublienko_128.jpg","buddhasource_128.jpg","buleswapnil_128.jpg","bungiwan_128.jpg","buryaknick_128.jpg","buzzusborne_128.jpg","byrnecore_128.jpg","byryan_128.jpg","cadikkara_128.jpg","calebjoyce_128.jpg","calebogden_128.jpg","canapud_128.jpg","carbontwelve_128.jpg","carlfairclough_128.jpg","carlosblanco_eu_128.jpg","carlosgavina_128.jpg","carlosjgsousa_128.jpg","carlosm_128.jpg","carlyson_128.jpg","caseycavanagh_128.jpg","caspergrl_128.jpg","catadeleon_128.jpg","catarino_128.jpg","cboller1_128.jpg","cbracco_128.jpg","ccinojasso1_128.jpg","cdavis565_128.jpg","cdharrison_128.jpg","ceekaytweet_128.jpg","cemshid_128.jpg","cggaurav_128.jpg","chaabane_wail_128.jpg","chacky14_128.jpg","chadami_128.jpg","chadengle_128.jpg","chaensel_128.jpg","chandlervdw_128.jpg","chanpory_128.jpg","charlesrpratt_128.jpg","charliecwaite_128.jpg","charliegann_128.jpg","chatyrko_128.jpg","cherif_b_128.jpg","chris_frees_128.jpg","chris_witko_128.jpg","chrismj83_128.jpg","chrisslowik_128.jpg","chrisstumph_128.jpg","christianoliff_128.jpg","chrisvanderkooi_128.jpg","ciaranr_128.jpg","cicerobr_128.jpg","claudioguglieri_128.jpg","cloudstudio_128.jpg","clubb3rry_128.jpg","cocolero_128.jpg","codepoet_ru_128.jpg","coderdiaz_128.jpg","codysanfilippo_128.jpg","cofla_128.jpg","colgruv_128.jpg","colirpixoil_128.jpg","collegeman_128.jpg","commadelimited_128.jpg","conspirator_128.jpg","constantx_128.jpg","coreyginnivan_128.jpg","coreyhaggard_128.jpg","coreyweb_128.jpg","craigelimeliah_128.jpg","craighenneberry_128.jpg","craigrcoles_128.jpg","creartinc_128.jpg","croakx_128.jpg","curiousoffice_128.jpg","curiousonaut_128.jpg","cybind_128.jpg","cynthiasavard_128.jpg","cyril_gaillard_128.jpg","d00maz_128.jpg","d33pthought_128.jpg","d_kobelyatsky_128.jpg","d_nny_m_cher_128.jpg","dactrtr_128.jpg","dahparra_128.jpg","dallasbpeters_128.jpg","damenleeturks_128.jpg","danillos_128.jpg","daniloc_128.jpg","danmartin70_128.jpg","dannol_128.jpg","danpliego_128.jpg","danro_128.jpg","dansowter_128.jpg","danthms_128.jpg","danvernon_128.jpg","danvierich_128.jpg","darcystonge_128.jpg","darylws_128.jpg","davecraige_128.jpg","davidbaldie_128.jpg","davidcazalis_128.jpg","davidhemphill_128.jpg","davidmerrique_128.jpg","davidsasda_128.jpg","dawidwu_128.jpg","daykiine_128.jpg","dc_user_128.jpg","dcalonaci_128.jpg","ddggccaa_128.jpg","de_ascanio_128.jpg","deeenright_128.jpg","demersdesigns_128.jpg","denisepires_128.jpg","depaulawagner_128.jpg","derekcramer_128.jpg","derekebradley_128.jpg","derienzo777_128.jpg","desastrozo_128.jpg","designervzm_128.jpg","dev_essentials_128.jpg","devankoshal_128.jpg","deviljho__128.jpg","devinhalladay_128.jpg","dgajjar_128.jpg","dgclegg_128.jpg","dhilipsiva_128.jpg","dhoot_amit_128.jpg","dhooyenga_128.jpg","dhrubo_128.jpg","diansigitp_128.jpg","dicesales_128.jpg","diesellaws_128.jpg","digitalmaverick_128.jpg","dimaposnyy_128.jpg","dingyi_128.jpg","divya_128.jpg","dixchen_128.jpg","djsherman_128.jpg","dmackerman_128.jpg","dmitriychuta_128.jpg","dnezkumar_128.jpg","dnirmal_128.jpg","donjain_128.jpg","doooon_128.jpg","doronmalki_128.jpg","dorphern_128.jpg","dotgridline_128.jpg","dparrelli_128.jpg","dpmachado_128.jpg","dreizle_128.jpg","drewbyreese_128.jpg","dshster_128.jpg","dss49_128.jpg","dudestein_128.jpg","duivvv_128.jpg","dutchnadia_128.jpg","dvdwinden_128.jpg","dzantievm_128.jpg","ecommerceil_128.jpg","eddiechen_128.jpg","edgarchris99_128.jpg","edhenderson_128.jpg","edkf_128.jpg","edobene_128.jpg","eduardostuart_128.jpg","ehsandiary_128.jpg","eitarafa_128.jpg","el_fuertisimo_128.jpg","elbuscainfo_128.jpg","elenadissi_128.jpg","elisabethkjaer_128.jpg","elliotlewis_128.jpg","elliotnolten_128.jpg","embrcecreations_128.jpg","emileboudeling_128.jpg","emmandenn_128.jpg","emmeffess_128.jpg","emsgulam_128.jpg","enda_128.jpg","enjoythetau_128.jpg","enricocicconi_128.jpg","envex_128.jpg","ernestsemerda_128.jpg","erwanhesry_128.jpg","estebanuribe_128.jpg","eugeneeweb_128.jpg","evandrix_128.jpg","evanshajed_128.jpg","exentrich_128.jpg","eyronn_128.jpg","fabbianz_128.jpg","fabbrucci_128.jpg","faisalabid_128.jpg","falconerie_128.jpg","falling_soul_128.jpg","falvarad_128.jpg","felipeapiress_128.jpg","felipecsl_128.jpg","ffbel_128.jpg","finchjke_128.jpg","findingjenny_128.jpg","fiterik_128.jpg","fjaguero_128.jpg","flashmurphy_128.jpg","flexrs_128.jpg","foczzi_128.jpg","fotomagin_128.jpg","fran_mchamy_128.jpg","francis_vega_128.jpg","franciscoamk_128.jpg","frankiefreesbie_128.jpg","fronx_128.jpg","funwatercat_128.jpg","g3d_128.jpg","gaborenton_128.jpg","gabrielizalo_128.jpg","gabrielrosser_128.jpg","ganserene_128.jpg","garand_128.jpg","gauchomatt_128.jpg","gauravjassal_128.jpg","gavr1l0_128.jpg","gcmorley_128.jpg","gearpixels_128.jpg","geneseleznev_128.jpg","geobikas_128.jpg","geran7_128.jpg","geshan_128.jpg","giancarlon_128.jpg","gipsy_raf_128.jpg","giuliusa_128.jpg","gizmeedevil1991_128.jpg","gkaam_128.jpg","gmourier_128.jpg","goddardlewis_128.jpg","gofrasdesign_128.jpg","gojeanyn_128.jpg","gonzalorobaina_128.jpg","grahamkennery_128.jpg","greenbes_128.jpg","gregkilian_128.jpg","gregrwilkinson_128.jpg","gregsqueeb_128.jpg","grrr_nl_128.jpg","gseguin_128.jpg","gt_128.jpg","gu5taf_128.jpg","guiiipontes_128.jpg","guillemboti_128.jpg","guischmitt_128.jpg","gusoto_128.jpg","h1brd_128.jpg","hafeeskhan_128.jpg","hai_ninh_nguyen_128.jpg","haligaliharun_128.jpg","hanna_smi_128.jpg","happypeter1983_128.jpg","harry_sistalam_128.jpg","haruintesettden_128.jpg","hasslunsford_128.jpg","haydn_woods_128.jpg","helderleal_128.jpg","hellofeverrrr_128.jpg","her_ruu_128.jpg","herbigt_128.jpg","herkulano_128.jpg","hermanobrother_128.jpg","herrhaase_128.jpg","heycamtaylor_128.jpg","heyimjuani_128.jpg","heykenneth_128.jpg","hfalucas_128.jpg","hgharrygo_128.jpg","hiemil_128.jpg","hjartstrorn_128.jpg","hoangloi_128.jpg","holdenweb_128.jpg","homka_128.jpg","horaciobella_128.jpg","hota_v_128.jpg","hsinyo23_128.jpg","hugocornejo_128.jpg","hugomano_128.jpg","iamgarth_128.jpg","iamglimy_128.jpg","iamjdeleon_128.jpg","iamkarna_128.jpg","iamkeithmason_128.jpg","iamsteffen_128.jpg","id835559_128.jpg","idiot_128.jpg","iduuck_128.jpg","ifarafonow_128.jpg","igorgarybaldi_128.jpg","illyzoren_128.jpg","ilya_pestov_128.jpg","imammuht_128.jpg","imcoding_128.jpg","imomenui_128.jpg","imsoper_128.jpg","increase_128.jpg","incubo82_128.jpg","instalox_128.jpg","ionuss_128.jpg","ipavelek_128.jpg","iqbalperkasa_128.jpg","iqonicd_128.jpg","irae_128.jpg","isaacfifth_128.jpg","isacosta_128.jpg","ismail_biltagi_128.jpg","isnifer_128.jpg","itolmach_128.jpg","itsajimithing_128.jpg","itskawsar_128.jpg","itstotallyamy_128.jpg","ivanfilipovbg_128.jpg","j04ntoh_128.jpg","j2deme_128.jpg","j_drake__128.jpg","jackiesaik_128.jpg","jacksonlatka_128.jpg","jacobbennett_128.jpg","jagan123_128.jpg","jakemoore_128.jpg","jamiebrittain_128.jpg","janpalounek_128.jpg","jarjan_128.jpg","jarsen_128.jpg","jasonmarkjones_128.jpg","javorszky_128.jpg","jay_wilburn_128.jpg","jayphen_128.jpg","jayrobinson_128.jpg","jcubic_128.jpg","jedbridges_128.jpg","jefffis_128.jpg","jeffgolenski_128.jpg","jehnglynn_128.jpg","jennyshen_128.jpg","jennyyo_128.jpg","jeremery_128.jpg","jeremiaha_128.jpg","jeremiespoken_128.jpg","jeremymouton_128.jpg","jeremyshimko_128.jpg","jeremyworboys_128.jpg","jerrybai1907_128.jpg","jervo_128.jpg","jesseddy_128.jpg","jffgrdnr_128.jpg","jghyllebert_128.jpg","jimmuirhead_128.jpg","jitachi_128.jpg","jjshaw14_128.jpg","jjsiii_128.jpg","jlsolerdeltoro_128.jpg","jm_denis_128.jpg","jmfsocial_128.jpg","jmillspaysbills_128.jpg","jnmnrd_128.jpg","joannefournier_128.jpg","joaoedumedeiros_128.jpg","jodytaggart_128.jpg","joe_black_128.jpg","joelcipriano_128.jpg","joelhelin_128.jpg","joemdesign_128.jpg","joetruesdell_128.jpg","joeymurdah_128.jpg","johannesneu_128.jpg","johncafazza_128.jpg","johndezember_128.jpg","johnriordan_128.jpg","johnsmithagency_128.jpg","joki4_128.jpg","jomarmen_128.jpg","jonathansimmons_128.jpg","jonkspr_128.jpg","jonsgotwood_128.jpg","jordyvdboom_128.jpg","joreira_128.jpg","josecarlospsh_128.jpg","josemarques_128.jpg","josep_martins_128.jpg","josevnclch_128.jpg","joshaustin_128.jpg","joshhemsley_128.jpg","joshmedeski_128.jpg","joshuaraichur_128.jpg","joshuasortino_128.jpg","jpenico_128.jpg","jpscribbles_128.jpg","jqiuss_128.jpg","juamperro_128.jpg","juangomezw_128.jpg","juanmamartinez_128.jpg","juaumlol_128.jpg","judzhin_miles_128.jpg","justinrgraham_128.jpg","justinrhee_128.jpg","justinrob_128.jpg","justme_timothyg_128.jpg","jwalter14_128.jpg","jydesign_128.jpg","kaelifa_128.jpg","kalmerrautam_128.jpg","kamal_chaneman_128.jpg","kanickairaj_128.jpg","kapaluccio_128.jpg","karalek_128.jpg","karlkanall_128.jpg","karolkrakowiak__128.jpg","karsh_128.jpg","karthipanraj_128.jpg","kaspernordkvist_128.jpg","katiemdaly_128.jpg","kaysix_dizzy_128.jpg","kazaky999_128.jpg","kennyadr_128.jpg","kerem_128.jpg","kerihenare_128.jpg","keryilmaz_128.jpg","kevinjohndayy_128.jpg","kevinoh_128.jpg","kevka_128.jpg","keyuri85_128.jpg","kianoshp_128.jpg","kijanmaharjan_128.jpg","kikillo_128.jpg","kimcool_128.jpg","kinday_128.jpg","kirangopal_128.jpg","kiwiupover_128.jpg","kkusaa_128.jpg","klefue_128.jpg","klimmka_128.jpg","knilob_128.jpg","kohette_128.jpg","kojourin_128.jpg","kolage_128.jpg","kolmarlopez_128.jpg","kolsvein_128.jpg","konus_128.jpg","koridhandy_128.jpg","kosmar_128.jpg","kostaspt_128.jpg","krasnoukhov_128.jpg","krystalfister_128.jpg","kucingbelang4_128.jpg","kudretkeskin_128.jpg","kuldarkalvik_128.jpg","kumarrajan12123_128.jpg","kurafire_128.jpg","kurtinc_128.jpg","kushsolitary_128.jpg","kvasnic_128.jpg","ky_128.jpg","kylefoundry_128.jpg","kylefrost_128.jpg","laasli_128.jpg","lanceguyatt_128.jpg","langate_128.jpg","larrybolt_128.jpg","larrygerard_128.jpg","laurengray_128.jpg","lawlbwoy_128.jpg","layerssss_128.jpg","leandrovaranda_128.jpg","lebinoclard_128.jpg","lebronjennan_128.jpg","leehambley_128.jpg","leeiio_128.jpg","leemunroe_128.jpg","leonfedotov_128.jpg","lepetitogre_128.jpg","lepinski_128.jpg","levisan_128.jpg","lewisainslie_128.jpg","lhausermann_128.jpg","liminha_128.jpg","lingeswaran_128.jpg","linkibol_128.jpg","linux29_128.jpg","lisovsky_128.jpg","llun_128.jpg","lmjabreu_128.jpg","loganjlambert_128.jpg","logorado_128.jpg","lokesh_coder_128.jpg","lonesomelemon_128.jpg","longlivemyword_128.jpg","looneydoodle_128.jpg","lososina_128.jpg","louis_currie_128.jpg","low_res_128.jpg","lowie_128.jpg","lu4sh1i_128.jpg","ludwiczakpawel_128.jpg","luxe_128.jpg","lvovenok_128.jpg","m4rio_128.jpg","m_kalibry_128.jpg","ma_tiax_128.jpg","mactopus_128.jpg","macxim_128.jpg","madcampos_128.jpg","madebybrenton_128.jpg","madebyvadim_128.jpg","madewulf_128.jpg","madshensel_128.jpg","madysondesigns_128.jpg","magoo04_128.jpg","magugzbrand2d_128.jpg","mahdif_128.jpg","mahmoudmetwally_128.jpg","maikelk_128.jpg","maiklam_128.jpg","malgordon_128.jpg","malykhinv_128.jpg","mandalareopens_128.jpg","manekenthe_128.jpg","mangosango_128.jpg","manigm_128.jpg","marakasina_128.jpg","marciotoledo_128.jpg","marclgonzales_128.jpg","marcobarbosa_128.jpg","marcomano__128.jpg","marcoramires_128.jpg","marcusgorillius_128.jpg","markjenkins_128.jpg","marklamb_128.jpg","markolschesky_128.jpg","markretzloff_128.jpg","markwienands_128.jpg","marlinjayakody_128.jpg","marosholly_128.jpg","marrimo_128.jpg","marshallchen__128.jpg","martinansty_128.jpg","martip07_128.jpg","mashaaaaal_128.jpg","mastermindesign_128.jpg","matbeedotcom_128.jpg","mateaodviteza_128.jpg","matkins_128.jpg","matt3224_128.jpg","mattbilotti_128.jpg","mattdetails_128.jpg","matthewkay__128.jpg","mattlat_128.jpg","mattsapii_128.jpg","mauriolg_128.jpg","maximseshuk_128.jpg","maximsorokin_128.jpg","maxlinderman_128.jpg","maz_128.jpg","mbilalsiddique1_128.jpg","mbilderbach_128.jpg","mcflydesign_128.jpg","mds_128.jpg","mdsisto_128.jpg","meelford_128.jpg","megdraws_128.jpg","mekal_128.jpg","meln1ks_128.jpg","melvindidit_128.jpg","mfacchinello_128.jpg","mgonto_128.jpg","mhaligowski_128.jpg","mhesslow_128.jpg","mhudobivnik_128.jpg","michaelabehsera_128.jpg","michaelbrooksjr_128.jpg","michaelcolenso_128.jpg","michaelcomiskey_128.jpg","michaelkoper_128.jpg","michaelmartinho_128.jpg","michalhron_128.jpg","michigangraham_128.jpg","michzen_128.jpg","mighty55_128.jpg","miguelkooreman_128.jpg","miguelmendes_128.jpg","mikaeljorhult_128.jpg","mikebeecham_128.jpg","mikemai2awesome_128.jpg","millinet_128.jpg","mirfanqureshi_128.jpg","missaaamy_128.jpg","mizhgan_128.jpg","mizko_128.jpg","mkginfo_128.jpg","mocabyte_128.jpg","mohanrohith_128.jpg","moscoz_128.jpg","motionthinks_128.jpg","moynihan_128.jpg","mr_shiznit_128.jpg","mr_subtle_128.jpg","mrebay007_128.jpg","mrjamesnoble_128.jpg","mrmartineau_128.jpg","mrxloka_128.jpg","mslarkina_128.jpg","msveet_128.jpg","mtolokonnikov_128.jpg","mufaddal_mw_128.jpg","mugukamil_128.jpg","muridrahhal_128.jpg","muringa_128.jpg","murrayswift_128.jpg","mutlu82_128.jpg","mutu_krish_128.jpg","mvdheuvel_128.jpg","mwarkentin_128.jpg","myastro_128.jpg","mylesb_128.jpg","mymyboy_128.jpg","n1ght_coder_128.jpg","n3dmax_128.jpg","n_tassone_128.jpg","nacho_128.jpg","naitanamoreno_128.jpg","namankreative_128.jpg","nandini_m_128.jpg","nasirwd_128.jpg","nastya_mane_128.jpg","nateschulte_128.jpg","nathalie_fs_128.jpg","naupintos_128.jpg","nbirckel_128.jpg","nckjrvs_128.jpg","necodymiconer_128.jpg","nehfy_128.jpg","nellleo_128.jpg","nelshd_128.jpg","nelsonjoyce_128.jpg","nemanjaivanovic_128.jpg","nepdud_128.jpg","nerdgr8_128.jpg","nerrsoft_128.jpg","nessoila_128.jpg","netonet_il_128.jpg","newbrushes_128.jpg","nfedoroff_128.jpg","nickfratter_128.jpg","nicklacke_128.jpg","nicolai_larsen_128.jpg","nicolasfolliot_128.jpg","nicoleglynn_128.jpg","nicollerich_128.jpg","nilshelmersson_128.jpg","nilshoenson_128.jpg","ninjad3m0_128.jpg","nitinhayaran_128.jpg","nomidesigns_128.jpg","normanbox_128.jpg","notbadart_128.jpg","noufalibrahim_128.jpg","noxdzine_128.jpg","nsamoylov_128.jpg","ntfblog_128.jpg","nutzumi_128.jpg","nvkznemo_128.jpg","nwdsha_128.jpg","nyancecom_128.jpg","oaktreemedia_128.jpg","okandungel_128.jpg","okansurreel_128.jpg","okcoker_128.jpg","oksanafrewer_128.jpg","okseanjay_128.jpg","oktayelipek_128.jpg","olaolusoga_128.jpg","olgary_128.jpg","omnizya_128.jpg","ooomz_128.jpg","operatino_128.jpg","opnsrce_128.jpg","orkuncaylar_128.jpg","oscarowusu_128.jpg","oskamaya_128.jpg","oskarlevinson_128.jpg","osmanince_128.jpg","osmond_128.jpg","ostirbu_128.jpg","osvaldas_128.jpg","otozk_128.jpg","ovall_128.jpg","overcloacked_128.jpg","overra_128.jpg","panchajanyag_128.jpg","panghal0_128.jpg","patrickcoombe_128.jpg","paulfarino_128.jpg","pcridesagain_128.jpg","peachananr_128.jpg","pechkinator_128.jpg","peejfancher_128.jpg","pehamondello_128.jpg","perfectflow_128.jpg","perretmagali_128.jpg","petar_prog_128.jpg","petebernardo_128.jpg","peter576_128.jpg","peterlandt_128.jpg","petrangr_128.jpg","phillapier_128.jpg","picard102_128.jpg","pierre_nel_128.jpg","pierrestoffe_128.jpg","pifagor_128.jpg","pixage_128.jpg","plasticine_128.jpg","plbabin_128.jpg","pmeissner_128.jpg","polarity_128.jpg","ponchomendivil_128.jpg","poormini_128.jpg","popey_128.jpg","posterjob_128.jpg","praveen_vijaya_128.jpg","prheemo_128.jpg","primozcigler_128.jpg","prinzadi_128.jpg","privetwagner_128.jpg","prrstn_128.jpg","psaikali_128.jpg","psdesignuk_128.jpg","puzik_128.jpg","pyronite_128.jpg","quailandquasar_128.jpg","r_garcia_128.jpg","r_oy_128.jpg","rachelreveley_128.jpg","rahmeen_128.jpg","ralph_lam_128.jpg","ramanathan_pdy_128.jpg","randomlies_128.jpg","rangafangs_128.jpg","raphaelnikson_128.jpg","raquelwilson_128.jpg","ratbus_128.jpg","rawdiggie_128.jpg","rdbannon_128.jpg","rdsaunders_128.jpg","reabo101_128.jpg","reetajayendra_128.jpg","rehatkathuria_128.jpg","reideiredale_128.jpg","renbyrd_128.jpg","rez___a_128.jpg","ricburton_128.jpg","richardgarretts_128.jpg","richwild_128.jpg","rickdt_128.jpg","rickyyean_128.jpg","rikas_128.jpg","ripplemdk_128.jpg","rmlewisuk_128.jpg","rob_thomas10_128.jpg","robbschiller_128.jpg","robergd_128.jpg","robinclediere_128.jpg","robinlayfield_128.jpg","robturlinckx_128.jpg","rodnylobos_128.jpg","rohixx_128.jpg","romanbulah_128.jpg","roxanejammet_128.jpg","roybarberuk_128.jpg","rpatey_128.jpg","rpeezy_128.jpg","rtgibbons_128.jpg","rtyukmaev_128.jpg","rude_128.jpg","ruehldesign_128.jpg","runningskull_128.jpg","russell_baylis_128.jpg","russoedu_128.jpg","ruzinav_128.jpg","rweve_128.jpg","ryandownie_128.jpg","ryanjohnson_me_128.jpg","ryankirkman_128.jpg","ryanmclaughlin_128.jpg","ryhanhassan_128.jpg","ryuchi311_128.jpg","s4f1_128.jpg","saarabpreet_128.jpg","sachacorazzi_128.jpg","sachingawas_128.jpg","safrankov_128.jpg","sainraja_128.jpg","salimianoff_128.jpg","salleedesign_128.jpg","salvafc_128.jpg","samgrover_128.jpg","samihah_128.jpg","samscouto_128.jpg","samuelkraft_128.jpg","sandywoodruff_128.jpg","sangdth_128.jpg","santi_urso_128.jpg","saschadroste_128.jpg","saschamt_128.jpg","sasha_shestakov_128.jpg","saulihirvi_128.jpg","sawalazar_128.jpg","sawrb_128.jpg","sbtransparent_128.jpg","scips_128.jpg","scott_riley_128.jpg","scottfeltham_128.jpg","scottgallant_128.jpg","scottiedude_128.jpg","scottkclark_128.jpg","scrapdnb_128.jpg","sdidonato_128.jpg","sebashton_128.jpg","sementiy_128.jpg","serefka_128.jpg","sergeyalmone_128.jpg","sergeysafonov_128.jpg","sethlouey_128.jpg","seyedhossein1_128.jpg","sgaurav_baghel_128.jpg","shadeed9_128.jpg","shalt0ni_128.jpg","shaneIxD_128.jpg","shanehudson_128.jpg","sharvin_128.jpg","shesgared_128.jpg","shinze_128.jpg","shoaib253_128.jpg","shojberg_128.jpg","shvelo96_128.jpg","silv3rgvn_128.jpg","silvanmuhlemann_128.jpg","simobenso_128.jpg","sindresorhus_128.jpg","sircalebgrove_128.jpg","skkirilov_128.jpg","slowspock_128.jpg","smaczny_128.jpg","smalonso_128.jpg","smenov_128.jpg","snowshade_128.jpg","snowwrite_128.jpg","sokaniwaal_128.jpg","solid_color_128.jpg","souperphly_128.jpg","souuf_128.jpg","sovesove_128.jpg","soyjavi_128.jpg","spacewood__128.jpg","spbroma_128.jpg","spedwig_128.jpg","sprayaga_128.jpg","sreejithexp_128.jpg","ssbb_me_128.jpg","ssiskind_128.jpg","sta1ex_128.jpg","stalewine_128.jpg","stan_128.jpg","stayuber_128.jpg","stefanotirloni_128.jpg","stefanozoffoli_128.jpg","stefooo_128.jpg","stefvdham_128.jpg","stephcoue_128.jpg","sterlingrules_128.jpg","stevedesigner_128.jpg","steynviljoen_128.jpg","strikewan_128.jpg","stushona_128.jpg","sulaqo_128.jpg","sunlandictwin_128.jpg","sunshinedgirl_128.jpg","superoutman_128.jpg","supervova_128.jpg","supjoey_128.jpg","suprb_128.jpg","sur4dye_128.jpg","surgeonist_128.jpg","suribbles_128.jpg","svenlen_128.jpg","swaplord_128.jpg","sweetdelisa_128.jpg","switmer777_128.jpg","swooshycueb_128.jpg","sydlawrence_128.jpg","syropian_128.jpg","tanveerrao_128.jpg","taybenlor_128.jpg","taylorling_128.jpg","tbakdesigns_128.jpg","teddyzetterlund_128.jpg","teeragit_128.jpg","tereshenkov_128.jpg","terpimost_128.jpg","terrorpixel_128.jpg","terryxlife_128.jpg","teylorfeliz_128.jpg","tgerken_128.jpg","tgormtx_128.jpg","thaisselenator__128.jpg","thaodang17_128.jpg","thatonetommy_128.jpg","the_purplebunny_128.jpg","the_winslet_128.jpg","thedamianhdez_128.jpg","thedjpetersen_128.jpg","thehacker_128.jpg","thekevinjones_128.jpg","themadray_128.jpg","themikenagle_128.jpg","themrdave_128.jpg","theonlyzeke_128.jpg","therealmarvin_128.jpg","thewillbeard_128.jpg","thiagovernetti_128.jpg","thibaut_re_128.jpg","thierrykoblentz_128.jpg","thierrymeier__128.jpg","thimo_cz_128.jpg","thinkleft_128.jpg","thomasgeisen_128.jpg","thomasschrijer_128.jpg","timgthomas_128.jpg","timmillwood_128.jpg","timothycd_128.jpg","timpetricola_128.jpg","tjrus_128.jpg","to_soham_128.jpg","tobysaxon_128.jpg","toddrew_128.jpg","tom_even_128.jpg","tomas_janousek_128.jpg","tonymillion_128.jpg","traneblow_128.jpg","travis_arnold_128.jpg","travishines_128.jpg","tristanlegros_128.jpg","trubeatto_128.jpg","trueblood_33_128.jpg","tumski_128.jpg","tur8le_128.jpg","turkutuuli_128.jpg","tweetubhai_128.jpg","twittypork_128.jpg","txcx_128.jpg","uberschizo_128.jpg","ultragex_128.jpg","umurgdk_128.jpg","unterdreht_128.jpg","urrutimeoli_128.jpg","uxalex_128.jpg","uxpiper_128.jpg","uxward_128.jpg","vanchesz_128.jpg","vaughanmoffitt_128.jpg","vc27_128.jpg","vicivadeline_128.jpg","victorDubugras_128.jpg","victor_haydin_128.jpg","victordeanda_128.jpg","victorerixon_128.jpg","victorquinn_128.jpg","victorstuber_128.jpg","vigobronx_128.jpg","vijaykarthik_128.jpg","vikashpathak18_128.jpg","vikasvinfotech_128.jpg","vimarethomas_128.jpg","vinciarts_128.jpg","vitor376_128.jpg","vitorleal_128.jpg","vivekprvr_128.jpg","vj_demien_128.jpg","vladarbatov_128.jpg","vladimirdevic_128.jpg","vladyn_128.jpg","vlajki_128.jpg","vm_f_128.jpg","vocino_128.jpg","vonachoo_128.jpg","vovkasolovev_128.jpg","vytautas_a_128.jpg","waghner_128.jpg","wake_gs_128.jpg","we_social_128.jpg","wearesavas_128.jpg","weavermedia_128.jpg","webtanya_128.jpg","weglov_128.jpg","wegotvices_128.jpg","wesleytrankin_128.jpg","wikiziner_128.jpg","wiljanslofstra_128.jpg","wim1k_128.jpg","wintopia_128.jpg","woodsman001_128.jpg","woodydotmx_128.jpg","wtrsld_128.jpg","xadhix_128.jpg","xalionmalik_128.jpg","xamorep_128.jpg","xiel_128.jpg","xilantra_128.jpg","xravil_128.jpg","xripunov_128.jpg","xtopherpaul_128.jpg","y2graphic_128.jpg","yalozhkin_128.jpg","yassiryahya_128.jpg","yayteejay_128.jpg","yecidsm_128.jpg","yehudab_128.jpg","yesmeck_128.jpg","yigitpinarbasi_128.jpg","zackeeler_128.jpg","zaki3d_128.jpg","zauerkraut_128.jpg","zforrester_128.jpg","zvchkelly_128.jpg"],gn=Uc;var Lc={email:hn,domain:fn,avatar:gn},yn=Lc;var Mc={female:["Mary","Patricia","Linda","Barbara","Elizabeth","Jennifer","Maria","Susan","Margaret","Dorothy","Lisa","Nancy","Karen","Betty","Helen","Sandra","Donna","Carol","Ruth","Sharon","Michelle","Laura","Sarah","Kimberly","Deborah","Jessica","Shirley","Cynthia","Angela","Melissa","Brenda","Amy","Anna","Rebecca","Virginia","Kathleen","Pamela","Martha","Debra","Amanda","Stephanie","Carolyn","Christine","Marie","Janet","Catherine","Frances","Ann","Joyce","Diane","Alice","Julie","Heather","Teresa","Doris","Gloria","Evelyn","Jean","Cheryl","Mildred","Katherine","Joan","Ashley","Judith","Rose","Janice","Kelly","Nicole","Judy","Christina","Kathy","Theresa","Beverly","Denise","Tammy","Irene","Jane","Lori","Rachel","Marilyn","Andrea","Kathryn","Louise","Sara","Anne","Jacqueline","Wanda","Bonnie","Julia","Ruby","Lois","Tina","Phyllis","Norma","Paula","Diana","Annie","Lillian","Emily","Robin","Peggy","Crystal","Gladys","Rita","Dawn","Connie","Florence","Tracy","Edna","Tiffany","Carmen","Rosa","Cindy","Grace","Wendy","Victoria","Edith","Kim","Sherry","Sylvia","Josephine","Thelma","Shannon","Sheila","Ethel","Ellen","Elaine","Marjorie","Carrie","Charlotte","Monica","Esther","Pauline","Emma","Juanita","Anita","Rhonda","Hazel","Amber","Eva","Debbie","April","Leslie","Clara","Lucille","Jamie","Joanne","Eleanor","Valerie","Danielle","Megan","Alicia","Suzanne","Michele","Gail","Bertha","Darlene","Veronica","Jill","Erin","Geraldine","Lauren","Cathy","Joann","Lorraine","Lynn","Sally","Regina","Erica","Beatrice","Dolores","Bernice","Audrey","Yvonne","Annette","June","Samantha","Marion","Dana","Stacy","Ana","Renee","Ida","Vivian","Roberta","Holly","Brittany","Melanie","Loretta","Yolanda","Jeanette","Laurie","Katie","Kristen","Vanessa","Alma","Sue","Elsie","Beth","Jeanne","Vicki","Carla","Tara","Rosemary","Eileen","Terri","Gertrude","Lucy","Tonya","Ella","Stacey","Wilma","Gina","Kristin","Jessie","Natalie","Agnes","Vera","Willie","Charlene","Bessie","Delores","Melinda","Pearl","Arlene","Maureen","Colleen","Allison","Tamara","Joy","Georgia","Constance","Lillie","Claudia","Jackie","Marcia","Tanya","Nellie","Minnie","Marlene","Heidi","Glenda","Lydia","Viola","Courtney","Marian","Stella","Caroline","Dora","Jo","Vickie","Mattie","Terry","Maxine","Irma","Mabel","Marsha","Myrtle","Lena","Christy","Deanna","Patsy","Hilda","Gwendolyn","Jennie","Nora","Margie","Nina","Cassandra","Leah","Penny","Kay","Priscilla","Naomi","Carole","Brandy","Olga","Billie","Dianne","Tracey","Leona","Jenny","Felicia","Sonia","Miriam","Velma","Becky","Bobbie","Violet","Kristina","Toni","Misty","Mae","Shelly","Daisy","Ramona","Sherri","Erika","Katrina","Claire","Lindsey","Lindsay","Geneva","Guadalupe","Belinda","Margarita","Sheryl","Cora","Faye","Ada","Natasha","Sabrina","Isabel","Marguerite","Hattie","Harriet","Molly","Cecilia","Kristi","Brandi","Blanche","Sandy","Rosie","Joanna","Iris","Eunice","Angie","Inez","Lynda","Madeline","Amelia","Alberta","Genevieve","Monique","Jodi","Janie","Maggie","Kayla","Sonya","Jan","Lee","Kristine","Candace","Fannie","Maryann","Opal","Alison","Yvette","Melody","Luz","Susie","Olivia","Flora","Shelley","Kristy","Mamie","Lula","Lola","Verna","Beulah","Antoinette","Candice","Juana","Jeannette","Pam","Kelli","Hannah","Whitney","Bridget","Karla","Celia","Latoya","Patty","Shelia","Gayle","Della","Vicky","Lynne","Sheri","Marianne","Kara","Jacquelyn","Erma","Blanca","Myra","Leticia","Pat","Krista","Roxanne","Angelica","Johnnie","Robyn","Francis","Adrienne","Rosalie","Alexandra","Brooke","Bethany","Sadie","Bernadette","Traci","Jody","Kendra","Jasmine","Nichole","Rachael","Chelsea","Mable","Ernestine","Muriel","Marcella","Elena","Krystal","Angelina","Nadine","Kari","Estelle","Dianna","Paulette","Lora","Mona","Doreen","Rosemarie","Angel","Desiree","Antonia","Hope","Ginger","Janis","Betsy","Christie","Freda","Mercedes","Meredith","Lynette","Teri","Cristina","Eula","Leigh","Meghan","Sophia","Eloise","Rochelle","Gretchen","Cecelia","Raquel","Henrietta","Alyssa","Jana","Kelley","Gwen","Kerry","Jenna","Tricia","Laverne","Olive","Alexis","Tasha","Silvia","Elvira","Casey","Delia","Sophie","Kate","Patti","Lorena","Kellie","Sonja","Lila","Lana","Darla","May","Mindy","Essie","Mandy","Lorene","Elsa","Josefina","Jeannie","Miranda","Dixie","Lucia","Marta","Faith","Lela","Johanna","Shari","Camille","Tami","Shawna","Elisa","Ebony","Melba","Ora","Nettie","Tabitha","Ollie","Jaime","Winifred","Kristie"],male:["James","John","Robert","Michael","William","David","Richard","Charles","Joseph","Thomas","Christopher","Daniel","Paul","Mark","Donald","George","Kenneth","Steven","Edward","Brian","Ronald","Anthony","Kevin","Jason","Matthew","Gary","Timothy","Jose","Larry","Jeffrey","Frank","Scott","Eric","Stephen","Andrew","Raymond","Gregory","Joshua","Jerry","Dennis","Walter","Patrick","Peter","Harold","Douglas","Henry","Carl","Arthur","Ryan","Roger","Joe","Juan","Jack","Albert","Jonathan","Justin","Terry","Gerald","Keith","Samuel","Willie","Ralph","Lawrence","Nicholas","Roy","Benjamin","Bruce","Brandon","Adam","Harry","Fred","Wayne","Billy","Steve","Louis","Jeremy","Aaron","Randy","Howard","Eugene","Carlos","Russell","Bobby","Victor","Martin","Ernest","Phillip","Todd","Jesse","Craig","Alan","Shawn","Clarence","Sean","Philip","Chris","Johnny","Earl","Jimmy","Antonio","Danny","Bryan","Tony","Luis","Mike","Stanley","Leonard","Nathan","Dale","Manuel","Rodney","Curtis","Norman","Allen","Marvin","Vincent","Glenn","Jeffery","Travis","Jeff","Chad","Jacob","Lee","Melvin","Alfred","Kyle","Francis","Bradley","Jesus","Herbert","Frederick","Ray","Joel","Edwin","Don","Eddie","Ricky","Troy","Randall","Barry","Alexander","Bernard","Mario","Leroy","Francisco","Marcus","Micheal","Theodore","Clifford","Miguel","Oscar","Jay","Jim","Tom","Calvin","Alex","Jon","Ronnie","Bill","Lloyd","Tommy","Leon","Derek","Warren","Darrell","Jerome","Floyd","Leo","Alvin","Tim","Wesley","Gordon","Dean","Greg","Jorge","Dustin","Pedro","Derrick","Dan","Lewis","Zachary","Corey","Herman","Maurice","Vernon","Roberto","Clyde","Glen","Hector","Shane","Ricardo","Sam","Rick","Lester","Brent","Ramon","Charlie","Tyler","Gilbert","Gene","Marc","Reginald","Ruben","Brett","Angel","Nathaniel","Rafael","Leslie","Edgar","Milton","Raul","Ben","Chester","Cecil","Duane","Franklin","Andre","Elmer","Brad","Gabriel","Ron","Mitchell","Roland","Arnold","Harvey","Jared","Adrian","Karl","Cory","Claude","Erik","Darryl","Jamie","Neil","Jessie","Christian","Javier","Fernando","Clinton","Ted","Mathew","Tyrone","Darren","Lonnie","Lance","Cody","Julio","Kelly","Kurt","Allan","Nelson","Guy","Clayton","Hugh","Max","Dwayne","Dwight","Armando","Felix","Jimmie","Everett","Jordan","Ian","Wallace","Ken","Bob","Jaime","Casey","Alfredo","Alberto","Dave","Ivan","Johnnie","Sidney","Byron","Julian","Isaac","Morris","Clifton","Willard","Daryl","Ross","Virgil","Andy","Marshall","Salvador","Perry","Kirk","Sergio","Marion","Tracy","Seth","Kent","Terrance","Rene","Eduardo","Terrence","Enrique","Freddie","Wade","Austin","Stuart","Fredrick","Arturo","Alejandro","Jackie","Joey","Nick","Luther","Wendell","Jeremiah","Evan","Julius","Dana","Donnie","Otis","Shannon","Trevor","Oliver","Luke","Homer","Gerard","Doug","Kenny","Hubert","Angelo","Shaun","Lyle","Matt","Lynn","Alfonso","Orlando","Rex","Carlton","Ernesto","Cameron","Neal","Pablo","Lorenzo","Omar","Wilbur","Blake","Grant","Horace","Roderick","Kerry","Abraham","Willis","Rickey","Jean","Ira","Andres","Cesar","Johnathan","Malcolm","Rudolph","Damon","Kelvin","Rudy","Preston","Alton","Archie","Marco","Wm","Pete","Randolph","Garry","Geoffrey","Jonathon","Felipe","Bennie","Gerardo","Ed","Dominic","Robin","Loren","Delbert","Colin","Guillermo","Earnest","Lucas","Benny","Noel","Spencer","Rodolfo","Myron","Edmund","Garrett","Salvatore","Cedric","Lowell","Gregg","Sherman","Wilson","Devin","Sylvester","Kim","Roosevelt","Israel","Jermaine","Forrest","Wilbert","Leland","Simon","Guadalupe","Clark","Irving","Carroll","Bryant","Owen","Rufus","Woodrow","Sammy","Kristopher","Mack","Levi","Marcos","Gustavo","Jake","Lionel","Marty","Taylor","Ellis","Dallas","Gilberto","Clint","Nicolas","Laurence","Ismael","Orville","Drew","Jody","Ervin","Dewey","Al","Wilfred","Josh","Hugo","Ignacio","Caleb","Tomas","Sheldon","Erick","Frankie","Stewart","Doyle","Darrel","Rogelio","Terence","Santiago","Alonzo","Elias","Bert","Elbert","Ramiro","Conrad","Pat","Noah","Grady","Phil","Cornelius","Lamar","Rolando","Clay","Percy","Dexter","Bradford","Merle","Darin","Amos","Terrell","Moses","Irvin","Saul","Roman","Darnell","Randal","Tommie","Timmy","Darrin","Winston","Brendan","Toby","Van","Abel","Dominick","Boyd","Courtney","Jan","Emilio","Elijah","Cary","Domingo","Santos","Aubrey","Emmett","Marlon","Emanuel","Jerald","Edmond"]},bn=Mc;var Ys=["Abbott","Abernathy","Abshire","Adams","Altenwerth","Anderson","Ankunding","Armstrong","Auer","Aufderhar","Bahringer","Bailey","Balistreri","Barrows","Bartell","Bartoletti","Barton","Bashirian","Batz","Bauch","Baumbach","Bayer","Beahan","Beatty","Bechtelar","Becker","Bednar","Beer","Beier","Berge","Bergnaum","Bergstrom","Bernhard","Bernier","Bins","Blanda","Blick","Block","Bode","Boehm","Bogan","Bogisich","Borer","Bosco","Botsford","Boyer","Boyle","Bradtke","Brakus","Braun","Breitenberg","Brekke","Brown","Bruen","Buckridge","Carroll","Carter","Cartwright","Casper","Cassin","Champlin","Christiansen","Cole","Collier","Collins","Conn","Connelly","Conroy","Considine","Corkery","Cormier","Corwin","Cremin","Crist","Crona","Cronin","Crooks","Cruickshank","Cummerata","Cummings","Dach","D'Amore","Daniel","Dare","Daugherty","Davis","Deckow","Denesik","Dibbert","Dickens","Dicki","Dickinson","Dietrich","Donnelly","Dooley","Douglas","Doyle","DuBuque","Durgan","Ebert","Effertz","Emard","Emmerich","Erdman","Ernser","Fadel","Fahey","Farrell","Fay","Feeney","Feest","Feil","Ferry","Fisher","Flatley","Frami","Franecki","Friesen","Fritsch","Funk","Gaylord","Gerhold","Gerlach","Gibson","Gislason","Gleason","Gleichner","Glover","Goldner","Goodwin","Gorczany","Gottlieb","Goyette","Grady","Graham","Grant","Green","Greenfelder","Greenholt","Grimes","Gulgowski","Gusikowski","Gutkowski","Gutmann","Haag","Hackett","Hagenes","Hahn","Haley","Halvorson","Hamill","Hammes","Hand","Hane","Hansen","Harber","Harris","Hartmann","Harvey","Hauck","Hayes","Heaney","Heathcote","Hegmann","Heidenreich","Heller","Herman","Hermann","Hermiston","Herzog","Hessel","Hettinger","Hickle","Hilll","Hills","Hilpert","Hintz","Hirthe","Hodkiewicz","Hoeger","Homenick","Hoppe","Howe","Howell","Hudson","Huel","Huels","Hyatt","Jacobi","Jacobs","Jacobson","Jakubowski","Jaskolski","Jast","Jenkins","Jerde","Johns","Johnson","Johnston","Jones","Kassulke","Kautzer","Keebler","Keeling","Kemmer","Kerluke","Kertzmann","Kessler","Kiehn","Kihn","Kilback","King","Kirlin","Klein","Kling","Klocko","Koch","Koelpin","Koepp","Kohler","Konopelski","Koss","Kovacek","Kozey","Krajcik","Kreiger","Kris","Kshlerin","Kub","Kuhic","Kuhlman","Kuhn","Kulas","Kunde","Kunze","Kuphal","Kutch","Kuvalis","Labadie","Lakin","Lang","Langosh","Langworth","Larkin","Larson","Leannon","Lebsack","Ledner","Leffler","Legros","Lehner","Lemke","Lesch","Leuschke","Lind","Lindgren","Littel","Little","Lockman","Lowe","Lubowitz","Lueilwitz","Luettgen","Lynch","Macejkovic","MacGyver","Maggio","Mann","Mante","Marks","Marquardt","Marvin","Mayer","Mayert","McClure","McCullough","McDermott","McGlynn","McKenzie","McLaughlin","Medhurst","Mertz","Metz","Miller","Mills","Mitchell","Moen","Mohr","Monahan","Moore","Morar","Morissette","Mosciski","Mraz","Mueller","Muller","Murazik","Murphy","Murray","Nader","Nicolas","Nienow","Nikolaus","Nitzsche","Nolan","Oberbrunner","O'Connell","O'Conner","O'Hara","O'Keefe","O'Kon","Okuneva","Olson","Ondricka","O'Reilly","Orn","Ortiz","Osinski","Pacocha","Padberg","Pagac","Parisian","Parker","Paucek","Pfannerstill","Pfeffer","Pollich","Pouros","Powlowski","Predovic","Price","Prohaska","Prosacco","Purdy","Quigley","Quitzon","Rath","Ratke","Rau","Raynor","Reichel","Reichert","Reilly","Reinger","Rempel","Renner","Reynolds","Rice","Rippin","Ritchie","Robel","Roberts","Rodriguez","Rogahn","Rohan","Rolfson","Romaguera","Roob","Rosenbaum","Rowe","Ruecker","Runolfsdottir","Runolfsson","Runte","Russel","Rutherford","Ryan","Sanford","Satterfield","Sauer","Sawayn","Schaden","Schaefer","Schamberger","Schiller","Schimmel","Schinner","Schmeler","Schmidt","Schmitt","Schneider","Schoen","Schowalter","Schroeder","Schulist","Schultz","Schumm","Schuppe","Schuster","Senger","Shanahan","Shields","Simonis","Sipes","Skiles","Smith","Smitham","Spencer","Spinka","Sporer","Stamm","Stanton","Stark","Stehr","Steuber","Stiedemann","Stokes","Stoltenberg","Stracke","Streich","Stroman","Strosin","Swaniawski","Swift","Terry","Thiel","Thompson","Tillman","Torp","Torphy","Towne","Toy","Trantow","Tremblay","Treutel","Tromp","Turcotte","Turner","Ullrich","Upton","Vandervort","Veum","Volkman","Von","VonRueden","Waelchi","Walker","Walsh","Walter","Ward","Waters","Watsica","Weber","Wehner","Weimann","Weissnat","Welch","West","White","Wiegand","Wilderman","Wilkinson","Will","Williamson","Willms","Windler","Wintheiser","Wisoky","Wisozk","Witting","Wiza","Wolf","Wolff","Wuckert","Wunsch","Wyman","Yost","Yundt","Zboncak","Zemlak","Ziemann","Zieme","Zulauf"],zc={general:Ys,female:Ys,male:Ys},wn=zc;var Vc={binary:["Female","Male"],pool:["Asexual","Female to male trans man","Female to male transgender man","Female to male transsexual man","F2M","Gender neutral","Hermaphrodite","Intersex man","Intersex person","Intersex woman","Male to female trans woman","Male to female transgender woman","Male to female transsexual woman","Man","M2F","Polygender","T* man","T* woman","Two* person","Two-spirit person","Woman","Agender","Androgyne","Androgynes","Androgynous","Bigender","Cis","Cis Female","Cis Male","Cis Man","Cis Woman","Cisgender","Cisgender Female","Cisgender Male","Cisgender Man","Cisgender Woman","Female to Male","FTM","Gender Fluid","Gender Nonconforming","Gender Questioning","Gender Variant","Genderqueer","Intersex","Male to Female","MTF","Neither","Neutrois","Non-binary","Other","Pangender","Trans","Trans Female","Trans Male","Trans Man","Trans Person","Trans*Female","Trans*Male","Trans*Man","Trans*Person","Trans*Woman","Transexual","Transexual Female","Transexual Male","Transexual Man","Transexual Person","Transexual Woman","Transgender Female","Transgender Person","Transmasculine","Two-spirit"]},kn=Vc;var Fc={descriptor:["Lead","Senior","Direct","Corporate","Dynamic","Future","Product","National","Regional","District","Central","Global","Customer","Investor","Dynamic","International","Legacy","Forward","Internal","Human","Chief","Principal"],level:["Solutions","Program","Brand","Security","Research","Marketing","Directives","Implementation","Integration","Functionality","Response","Paradigm","Tactics","Identity","Markets","Group","Division","Applications","Optimization","Operations","Infrastructure","Intranet","Communications","Web","Branding","Quality","Assurance","Mobility","Accounts","Data","Creative","Configuration","Accountability","Interactions","Factors","Usability","Metrics"],job:["Supervisor","Associate","Executive","Liaison","Officer","Manager","Engineer","Specialist","Director","Coordinator","Administrator","Architect","Analyst","Designer","Planner","Orchestrator","Technician","Developer","Producer","Consultant","Assistant","Facilitator","Agent","Representative","Strategist"]},vn=Fc;var Xs=["Jr.","Sr.","I","II","III","IV","V","MD","DDS","PhD","DVM"],Kc={gender:kn,firstName:bn,lastName:wn,title:vn,suffix:{general:Xs,female:Xs,male:Xs},prefix:{general:["Mr.","Mrs.","Ms.","Miss","Dr."],female:["Mrs.","Ms.","Miss"],male:["Mr.","Dr."]},templates:["#{prefix} #{first_name} #{last_name}","#{first_name} #{last_name} #{suffix}","#{first_name} #{last_name}","#{first_name} #{last_name}","#{male_first_name} #{last_name}","#{female_first_name} #{last_name}"]},Sn=Kc;var _n=["abandoned","able","absolute","adorable","adventurous","academic","acceptable","acclaimed","accomplished","accurate","aching","acidic","acrobatic","active","actual","adept","admirable","admired","adolescent","adorable","adored","advanced","afraid","affectionate","aged","aggravating","aggressive","agile","agitated","agonizing","agreeable","ajar","alarmed","alarming","alert","alienated","alive","all","altruistic","amazing","ambitious","ample","amused","amusing","anchored","ancient","angelic","angry","anguished","animated","annual","another","antique","anxious","any","apprehensive","appropriate","apt","arctic","arid","aromatic","artistic","ashamed","assured","astonishing","athletic","attached","attentive","attractive","austere","authentic","authorized","automatic","avaricious","average","aware","awesome","awful","awkward","babyish","bad","back","baggy","bare","barren","basic","beautiful","belated","beloved","beneficial","better","best","bewitched","big","big-hearted","biodegradable","bite-sized","bitter","black","black-and-white","bland","blank","blaring","bleak","blind","blissful","blond","blue","blushing","bogus","boiling","bold","bony","boring","bossy","both","bouncy","bountiful","bowed","brave","breakable","brief","bright","brilliant","brisk","broken","bronze","brown","bruised","bubbly","bulky","bumpy","buoyant","burdensome","burly","bustling","busy","buttery","buzzing","calculating","calm","candid","canine","capital","carefree","careful","careless","caring","cautious","cavernous","celebrated","charming","cheap","cheerful","cheery","chief","chilly","chubby","circular","classic","clean","clear","clear-cut","clever","close","closed","cloudy","clueless","clumsy","cluttered","coarse","cold","colorful","colorless","colossal","comfortable","common","compassionate","competent","complete","complex","complicated","composed","concerned","concrete","confused","conscious","considerate","constant","content","conventional","cooked","cool","cooperative","coordinated","corny","corrupt","costly","courageous","courteous","crafty","crazy","creamy","creative","creepy","criminal","crisp","critical","crooked","crowded","cruel","crushing","cuddly","cultivated","cultured","cumbersome","curly","curvy","cute","cylindrical","damaged","damp","dangerous","dapper","daring","darling","dark","dazzling","dead","deadly","deafening","dear","dearest","decent","decimal","decisive","deep","defenseless","defensive","defiant","deficient","definite","definitive","delayed","delectable","delicious","delightful","delirious","demanding","dense","dental","dependable","dependent","descriptive","deserted","detailed","determined","devoted","different","difficult","digital","diligent","dim","dimpled","dimwitted","direct","disastrous","discrete","disfigured","disgusting","disloyal","dismal","distant","downright","dreary","dirty","disguised","dishonest","dismal","distant","distinct","distorted","dizzy","dopey","doting","double","downright","drab","drafty","dramatic","dreary","droopy","dry","dual","dull","dutiful","each","eager","earnest","early","easy","easy-going","ecstatic","edible","educated","elaborate","elastic","elated","elderly","electric","elegant","elementary","elliptical","embarrassed","embellished","eminent","emotional","empty","enchanted","enchanting","energetic","enlightened","enormous","enraged","entire","envious","equal","equatorial","essential","esteemed","ethical","euphoric","even","evergreen","everlasting","every","evil","exalted","excellent","exemplary","exhausted","excitable","excited","exciting","exotic","expensive","experienced","expert","extraneous","extroverted","extra-large","extra-small","fabulous","failing","faint","fair","faithful","fake","false","familiar","famous","fancy","fantastic","far","faraway","far-flung","far-off","fast","fat","fatal","fatherly","favorable","favorite","fearful","fearless","feisty","feline","female","feminine","few","fickle","filthy","fine","finished","firm","first","firsthand","fitting","fixed","flaky","flamboyant","flashy","flat","flawed","flawless","flickering","flimsy","flippant","flowery","fluffy","fluid","flustered","focused","fond","foolhardy","foolish","forceful","forked","formal","forsaken","forthright","fortunate","fragrant","frail","frank","frayed","free","french","fresh","frequent","friendly","frightened","frightening","frigid","frilly","frizzy","frivolous","front","frosty","frozen","frugal","fruitful","full","fumbling","functional","funny","fussy","fuzzy","gargantuan","gaseous","general","generous","gentle","genuine","giant","giddy","gigantic","gifted","giving","glamorous","glaring","glass","gleaming","gleeful","glistening","glittering","gloomy","glorious","glossy","glum","golden","good","good-natured","gorgeous","graceful","gracious","grand","grandiose","granular","grateful","grave","gray","great","greedy","green","gregarious","grim","grimy","gripping","grizzled","gross","grotesque","grouchy","grounded","growing","growling","grown","grubby","gruesome","grumpy","guilty","gullible","gummy","hairy","half","handmade","handsome","handy","happy","happy-go-lucky","hard","hard-to-find","harmful","harmless","harmonious","harsh","hasty","hateful","haunting","healthy","heartfelt","hearty","heavenly","heavy","hefty","helpful","helpless","hidden","hideous","high","high-level","hilarious","hoarse","hollow","homely","honest","honorable","honored","hopeful","horrible","hospitable","hot","huge","humble","humiliating","humming","humongous","hungry","hurtful","husky","icky","icy","ideal","idealistic","identical","idle","idiotic","idolized","ignorant","ill","illegal","ill-fated","ill-informed","illiterate","illustrious","imaginary","imaginative","immaculate","immaterial","immediate","immense","impassioned","impeccable","impartial","imperfect","imperturbable","impish","impolite","important","impossible","impractical","impressionable","impressive","improbable","impure","inborn","incomparable","incompatible","incomplete","inconsequential","incredible","indelible","inexperienced","indolent","infamous","infantile","infatuated","inferior","infinite","informal","innocent","insecure","insidious","insignificant","insistent","instructive","insubstantial","intelligent","intent","intentional","interesting","internal","international","intrepid","ironclad","irresponsible","irritating","itchy","jaded","jagged","jam-packed","jaunty","jealous","jittery","joint","jolly","jovial","joyful","joyous","jubilant","judicious","juicy","jumbo","junior","jumpy","juvenile","kaleidoscopic","keen","key","kind","kindhearted","kindly","klutzy","knobby","knotty","knowledgeable","knowing","known","kooky","kosher","lame","lanky","large","last","lasting","late","lavish","lawful","lazy","leading","lean","leafy","left","legal","legitimate","light","lighthearted","likable","likely","limited","limp","limping","linear","lined","liquid","little","live","lively","livid","loathsome","lone","lonely","long","long-term","loose","lopsided","lost","loud","lovable","lovely","loving","low","loyal","lucky","lumbering","luminous","lumpy","lustrous","luxurious","mad","made-up","magnificent","majestic","major","male","mammoth","married","marvelous","masculine","massive","mature","meager","mealy","mean","measly","meaty","medical","mediocre","medium","meek","mellow","melodic","memorable","menacing","merry","messy","metallic","mild","milky","mindless","miniature","minor","minty","miserable","miserly","misguided","misty","mixed","modern","modest","moist","monstrous","monthly","monumental","moral","mortified","motherly","motionless","mountainous","muddy","muffled","multicolored","mundane","murky","mushy","musty","muted","mysterious","naive","narrow","nasty","natural","naughty","nautical","near","neat","necessary","needy","negative","neglected","negligible","neighboring","nervous","new","next","nice","nifty","nimble","nippy","nocturnal","noisy","nonstop","normal","notable","noted","noteworthy","novel","noxious","numb","nutritious","nutty","obedient","obese","oblong","oily","oblong","obvious","occasional","odd","oddball","offbeat","offensive","official","old","old-fashioned","only","open","optimal","optimistic","opulent","orange","orderly","organic","ornate","ornery","ordinary","original","other","our","outlying","outgoing","outlandish","outrageous","outstanding","oval","overcooked","overdue","overjoyed","overlooked","palatable","pale","paltry","parallel","parched","partial","passionate","past","pastel","peaceful","peppery","perfect","perfumed","periodic","perky","personal","pertinent","pesky","pessimistic","petty","phony","physical","piercing","pink","pitiful","plain","plaintive","plastic","playful","pleasant","pleased","pleasing","plump","plush","polished","polite","political","pointed","pointless","poised","poor","popular","portly","posh","positive","possible","potable","powerful","powerless","practical","precious","present","prestigious","pretty","precious","previous","pricey","prickly","primary","prime","pristine","private","prize","probable","productive","profitable","profuse","proper","proud","prudent","punctual","pungent","puny","pure","purple","pushy","putrid","puzzled","puzzling","quaint","qualified","quarrelsome","quarterly","queasy","querulous","questionable","quick","quick-witted","quiet","quintessential","quirky","quixotic","quizzical","radiant","ragged","rapid","rare","rash","raw","recent","reckless","rectangular","ready","real","realistic","reasonable","red","reflecting","regal","regular","reliable","relieved","remarkable","remorseful","remote","repentant","required","respectful","responsible","repulsive","revolving","rewarding","rich","rigid","right","ringed","ripe","roasted","robust","rosy","rotating","rotten","rough","round","rowdy","royal","rubbery","rundown","ruddy","rude","runny","rural","rusty","sad","safe","salty","same","sandy","sane","sarcastic","sardonic","satisfied","scaly","scarce","scared","scary","scented","scholarly","scientific","scornful","scratchy","scrawny","second","secondary","second-hand","secret","self-assured","self-reliant","selfish","sentimental","separate","serene","serious","serpentine","several","severe","shabby","shadowy","shady","shallow","shameful","shameless","sharp","shimmering","shiny","shocked","shocking","shoddy","short","short-term","showy","shrill","shy","sick","silent","silky","silly","silver","similar","simple","simplistic","sinful","single","sizzling","skeletal","skinny","sleepy","slight","slim","slimy","slippery","slow","slushy","small","smart","smoggy","smooth","smug","snappy","snarling","sneaky","sniveling","snoopy","sociable","soft","soggy","solid","somber","some","spherical","sophisticated","sore","sorrowful","soulful","soupy","sour","spanish","sparkling","sparse","specific","spectacular","speedy","spicy","spiffy","spirited","spiteful","splendid","spotless","spotted","spry","square","squeaky","squiggly","stable","staid","stained","stale","standard","starchy","stark","starry","steep","sticky","stiff","stimulating","stingy","stormy","straight","strange","steel","strict","strident","striking","striped","strong","studious","stunning","stupendous","stupid","sturdy","stylish","subdued","submissive","substantial","subtle","suburban","sudden","sugary","sunny","super","superb","superficial","superior","supportive","sure-footed","surprised","suspicious","svelte","sweaty","sweet","sweltering","swift","sympathetic","tall","talkative","tame","tan","tangible","tart","tasty","tattered","taut","tedious","teeming","tempting","tender","tense","tepid","terrible","terrific","testy","thankful","that","these","thick","thin","third","thirsty","this","thorough","thorny","those","thoughtful","threadbare","thrifty","thunderous","tidy","tight","timely","tinted","tiny","tired","torn","total","tough","traumatic","treasured","tremendous","tragic","trained","tremendous","triangular","tricky","trifling","trim","trivial","troubled","true","trusting","trustworthy","trusty","truthful","tubby","turbulent","twin","ugly","ultimate","unacceptable","unaware","uncomfortable","uncommon","unconscious","understated","unequaled","uneven","unfinished","unfit","unfolded","unfortunate","unhappy","unhealthy","uniform","unimportant","unique","united","unkempt","unknown","unlawful","unlined","unlucky","unnatural","unpleasant","unrealistic","unripe","unruly","unselfish","unsightly","unsteady","unsung","untidy","untimely","untried","untrue","unused","unusual","unwelcome","unwieldy","unwilling","unwitting","unwritten","upbeat","upright","upset","urban","usable","used","useful","useless","utilized","utter","vacant","vague","vain","valid","valuable","vapid","variable","vast","velvety","venerated","vengeful","verifiable","vibrant","vicious","victorious","vigilant","vigorous","villainous","violet","violent","virtual","virtuous","visible","vital","vivacious","vivid","voluminous","wan","warlike","warm","warmhearted","warped","wary","wasteful","watchful","waterlogged","watery","wavy","wealthy","weak","weary","webbed","wee","weekly","weepy","weighty","weird","welcome","well-documented","well-groomed","well-informed","well-lit","well-made","well-off","well-to-do","well-worn","wet","which","whimsical","whirlwind","whispered","white","whole","whopping","wicked","wide","wide-eyed","wiggly","wild","willing","wilted","winding","windy","winged","wiry","wise","witty","wobbly","woeful","wonderful","wooden","woozy","wordy","worldly","worn","worried","worrisome","worse","worst","worthless","worthwhile","worthy","wrathful","wretched","writhing","wrong","wry","yawning","yearly","yellow","yellowish","young","youthful","yummy","zany","zealous","zesty","zigzag"];var xn=["abnormally","absentmindedly","accidentally","acidly","actually","adventurously","afterwards","almost","always","angrily","annually","anxiously","arrogantly","awkwardly","badly","bashfully","beautifully","bitterly","bleakly","blindly","blissfully","boastfully","boldly","bravely","briefly","brightly","briskly","broadly","busily","calmly","carefully","carelessly","cautiously","certainly","cheerfully","clearly","cleverly","closely","coaxingly","colorfully","commonly","continually","coolly","correctly","courageously","crossly","cruelly","curiously","daily","daintily","dearly","deceivingly","deeply","defiantly","deliberately","delightfully","diligently","dimly","doubtfully","dreamily","easily","elegantly","energetically","enormously","enthusiastically","equally","especially","even","evenly","eventually","exactly","excitedly","extremely","fairly","faithfully","famously","far","fast","fatally","ferociously","fervently","fiercely","fondly","foolishly","fortunately","frankly","frantically","freely","frenetically","frightfully","fully","furiously","generally","generously","gently","gladly","gleefully","gracefully","gratefully","greatly","greedily","happily","hastily","healthily","heavily","helpfully","helplessly","highly","honestly","hopelessly","hourly","hungrily","immediately","innocently","inquisitively","instantly","intensely","intently","interestingly","inwardly","irritably","jaggedly","jealously","joshingly","jovially","joyfully","joyously","jubilantly","judgementally","justly","keenly","kiddingly","kindheartedly","kindly","kissingly","knavishly","knottily","knowingly","knowledgeably","kookily","lazily","less","lightly","likely","limply","lively","loftily","longingly","loosely","loudly","lovingly","loyally","madly","majestically","meaningfully","mechanically","merrily","miserably","mockingly","monthly","more","mortally","mostly","mysteriously","naturally","nearly","neatly","needily","nervously","never","nicely","noisily","not","obediently","obnoxiously","oddly","offensively","officially","often","only","openly","optimistically","overconfidently","owlishly","painfully","partially","patiently","perfectly","physically","playfully","politely","poorly","positively","potentially","powerfully","promptly","properly","punctually","quaintly","quarrelsomely","queasily","queerly","questionably","questioningly","quicker","quickly","quietly","quirkily","quizzically","rapidly","rarely","readily","really","reassuringly","recklessly","regularly","reluctantly","repeatedly","reproachfully","restfully","righteously","rightfully","rigidly","roughly","rudely","sadly","safely","scarcely","scarily","searchingly","sedately","seemingly","seldom","selfishly","separately","seriously","shakily","sharply","sheepishly","shrilly","shyly","silently","sleepily","slowly","smoothly","softly","solemnly","solidly","sometimes","soon","speedily","stealthily","sternly","strictly","successfully","suddenly","surprisingly","suspiciously","sweetly","swiftly","sympathetically","tenderly","tensely","terribly","thankfully","thoroughly","thoughtfully","tightly","tomorrow","too","tremendously","triumphantly","truly","truthfully","ultimately","unabashedly","unaccountably","unbearably","unethically","unexpectedly","unfortunately","unimpressively","unnaturally","unnecessarily","upbeat","upliftingly","upright","upside-down","upward","upwardly","urgently","usefully","uselessly","usually","utterly","vacantly","vaguely","vainly","valiantly","vastly","verbally","very","viciously","victoriously","violently","vivaciously","voluntarily","warmly","weakly","wearily","well","wetly","wholly","wildly","willfully","wisely","woefully","wonderfully","worriedly","wrongly","yawningly","yearly","yearningly","yesterday","yieldingly","youthfully"];var An=["after","after all","although","and","as","as a result","as if","as long as","as much as","as soon as","as though","because","before","but","consequently","even","even if","even though","finally","for","for example","furthermore","hence","however","if","if only","if then","if when","in addition","in fact","in order that","inasmuch","incidentally","indeed","instead","just as","lest","likewise","meanwhile","nor","now","now since","now that","now when","once","or","provided","provided that","rather than","since","so","so that","supposing","that","though","until","whenever","whereas","wherever","which","who","yet"];var En=["yuck","oh","phooey","blah","boo","whoa","yowza","huzzah","boo hoo","fooey","geez","pfft","ew","ah","yum","brr","hm","yahoo","aha","woot","drat","gah","meh","psst","aw","ugh","yippee","eek","gee","bah","gadzooks","duh","ha","mmm","tsk tsk","ouch","phew","ack","uh-huh","gosh","hmph","pish","zowie","er","ick","oof","um"];var Nn=["ATM","CD","SUV","TV","aardvark","abacus","abbey","abbreviation","abdomen","ability","abnormality","abolishment","abortion","abrogation","absence","abundance","abuse","academics","academy","accelerant","accelerator","accent","acceptance","access","accessory","accident","accommodation","accompanist","accomplishment","accord","accordance","accordion","account","accountability","accountant","accounting","accuracy","accusation","acetate","achievement","achiever","acid","acknowledgment","acorn","acoustics","acquaintance","acquisition","acre","acrylic","act","action","activation","activist","activity","actor","actress","acupuncture","ad","adaptation","adapter","addiction","addition","address","adjective","adjustment","admin","administration","administrator","admire","admission","adobe","adoption","adrenalin","adrenaline","adult","adulthood","advance","advancement","advantage","advent","adverb","advertisement","advertising","advice","adviser","advocacy","advocate","affair","affect","affidavit","affiliate","affinity","afoul","afterlife","aftermath","afternoon","aftershave","aftershock","afterthought","age","agency","agenda","agent","aggradation","aggression","aglet","agony","agreement","agriculture","aid","aide","aim","air","airbag","airbus","aircraft","airfare","airfield","airforce","airline","airmail","airman","airplane","airport","airship","airspace","alarm","alb","albatross","album","alcohol","alcove","alder","ale","alert","alfalfa","algebra","algorithm","alias","alibi","alien","allegation","allergist","alley","alliance","alligator","allocation","allowance","alloy","alluvium","almanac","almighty","almond","alpaca","alpenglow","alpenhorn","alpha","alphabet","altar","alteration","alternative","altitude","alto","aluminium","aluminum","amazement","amazon","ambassador","amber","ambience","ambiguity","ambition","ambulance","amendment","amenity","ammunition","amnesty","amount","amusement","anagram","analgesia","analog","analogue","analogy","analysis","analyst","analytics","anarchist","anarchy","anatomy","ancestor","anchovy","android","anesthesiologist","anesthesiology","angel","anger","angina","angiosperm","angle","angora","angstrom","anguish","animal","anime","anise","ankle","anklet","anniversary","announcement","annual","anorak","answer","ant","anteater","antecedent","antechamber","antelope","antennae","anterior","anthropology","antibody","anticipation","anticodon","antigen","antique","antiquity","antler","antling","anxiety","anybody","anyone","anything","anywhere","apartment","ape","aperitif","apology","app","apparatus","apparel","appeal","appearance","appellation","appendix","appetiser","appetite","appetizer","applause","apple","applewood","appliance","application","appointment","appreciation","apprehension","approach","appropriation","approval","apricot","apron","apse","aquarium","aquifer","arcade","arch","arch-rival","archaeologist","archaeology","archeology","archer","architect","architecture","archives","area","arena","argument","arithmetic","ark","arm","arm-rest","armadillo","armament","armchair","armoire","armor","armour","armpit","armrest","army","arrangement","array","arrest","arrival","arrogance","arrow","art","artery","arthur","artichoke","article","artifact","artificer","artist","ascend","ascent","ascot","ash","ashram","ashtray","aside","asparagus","aspect","asphalt","aspic","ass","assassination","assault","assembly","assertion","assessment","asset","assignment","assist","assistance","assistant","associate","association","assumption","assurance","asterisk","astrakhan","astrolabe","astrologer","astrology","astronomy","asymmetry","atelier","atheist","athlete","athletics","atmosphere","atom","atrium","attachment","attack","attacker","attainment","attempt","attendance","attendant","attention","attenuation","attic","attitude","attorney","attraction","attribute","auction","audience","audit","auditorium","aunt","authentication","authenticity","author","authorisation","authority","authorization","auto","autoimmunity","automation","automaton","autumn","availability","avalanche","avenue","average","avocado","award","awareness","awe","axis","azimuth","babe","baboon","babushka","baby","bachelor","back","back-up","backbone","backburn","backdrop","background","backpack","backup","backyard","bacon","bacterium","badge","badger","bafflement","bag","bagel","baggage","baggie","baggy","bagpipe","bail","bait","bake","baker","bakery","bakeware","balaclava","balalaika","balance","balcony","ball","ballet","balloon","balloonist","ballot","ballpark","bamboo","ban","banana","band","bandana","bandanna","bandolier","bandwidth","bangle","banjo","bank","bankbook","banker","banking","bankruptcy","banner","banquette","banyan","baobab","bar","barbecue","barbeque","barber","barbiturate","bargain","barge","baritone","barium","bark","barley","barn","barometer","barracks","barrage","barrel","barrier","barstool","bartender","base","baseball","baseboard","baseline","basement","basics","basil","basin","basis","basket","basketball","bass","bassinet","bassoon","bat","bath","bather","bathhouse","bathrobe","bathroom","bathtub","battalion","batter","battery","batting","battle","battleship","bay","bayou","beach","bead","beak","beam","bean","beancurd","beanie","beanstalk","bear","beard","beast","beastie","beat","beating","beauty","beaver","beck","bed","bedrock","bedroom","bee","beech","beef","beer","beet","beetle","beggar","beginner","beginning","begonia","behalf","behavior","behaviour","beheading","behest","behold","being","belfry","belief","believer","bell","belligerency","bellows","belly","belt","bench","bend","beneficiary","benefit","beret","berry","best-seller","bestseller","bet","beverage","beyond","bias","bibliography","bicycle","bid","bidder","bidding","bidet","bifocals","bijou","bike","bikini","bill","billboard","billing","billion","bin","binoculars","biology","biopsy","biosphere","biplane","birch","bird","bird-watcher","birdbath","birdcage","birdhouse","birth","birthday","biscuit","bit","bite","bitten","bitter","black","blackberry","blackbird","blackboard","blackfish","blackness","bladder","blade","blame","blank","blanket","blast","blazer","blend","blessing","blight","blind","blinker","blister","blizzard","block","blocker","blog","blogger","blood","bloodflow","bloom","bloomer","blossom","blouse","blow","blowgun","blowhole","blue","blueberry","blush","boar","board","boat","boatload","boatyard","bob","bobcat","body","bog","bolero","bolt","bomb","bomber","bombing","bond","bonding","bondsman","bone","bonfire","bongo","bonnet","bonsai","bonus","boogeyman","book","bookcase","bookend","booking","booklet","bookmark","boolean","boom","boon","boost","booster","boot","bootee","bootie","booty","border","bore","borrower","borrowing","bosom","boss","botany","bother","bottle","bottling","bottom","bottom-line","boudoir","bough","boulder","boulevard","boundary","bouquet","bourgeoisie","bout","boutique","bow","bower","bowl","bowler","bowling","bowtie","box","boxer","boxspring","boy","boycott","boyfriend","boyhood","boysenberry","bra","brace","bracelet","bracket","brain","brake","bran","branch","brand","brandy","brass","brassiere","bratwurst","bread","breadcrumb","breadfruit","break","breakdown","breakfast","breakpoint","breakthrough","breast","breastplate","breath","breeze","brewer","bribery","brick","bricklaying","bride","bridge","brief","briefing","briefly","briefs","brilliant","brink","brisket","broad","broadcast","broccoli","brochure","brocolli","broiler","broker","bronchitis","bronco","bronze","brooch","brood","brook","broom","brother","brother-in-law","brow","brown","brownie","browser","browsing","brunch","brush","brushfire","brushing","bubble","buck","bucket","buckle","buckwheat","bud","buddy","budget","buffalo","buffer","buffet","bug","buggy","bugle","builder","building","bulb","bulk","bull","bull-fighter","bulldozer","bullet","bump","bumper","bun","bunch","bungalow","bunghole","bunkhouse","burden","bureau","burglar","burial","burlesque","burn","burn-out","burning","burrito","burro","burrow","burst","bus","bush","business","businessman","bust","bustle","butane","butcher","butler","butter","butterfly","button","buy","buyer","buying","buzz","buzzard","c-clamp","cabana","cabbage","cabin","cabinet","cable","caboose","cacao","cactus","caddy","cadet","cafe","caffeine","caftan","cage","cake","calcification","calculation","calculator","calculus","calendar","calf","caliber","calibre","calico","call","calm","calorie","camel","cameo","camera","camp","campaign","campaigning","campanile","camper","campus","can","canal","cancer","candelabra","candidacy","candidate","candle","candy","cane","cannibal","cannon","canoe","canon","canopy","cantaloupe","canteen","canvas","cap","capability","capacity","cape","caper","capital","capitalism","capitulation","capon","cappelletti","cappuccino","captain","caption","captor","car","carabao","caramel","caravan","carbohydrate","carbon","carboxyl","card","cardboard","cardigan","care","career","cargo","caribou","carload","carnation","carnival","carol","carotene","carp","carpenter","carpet","carpeting","carport","carriage","carrier","carrot","carry","cart","cartel","carter","cartilage","cartload","cartoon","cartridge","carving","cascade","case","casement","cash","cashew","cashier","casino","casket","cassava","casserole","cassock","cast","castanet","castle","casualty","cat","catacomb","catalogue","catalysis","catalyst","catamaran","catastrophe","catch","catcher","category","caterpillar","cathedral","cation","catsup","cattle","cauliflower","causal","cause","causeway","caution","cave","caviar","cayenne","ceiling","celebration","celebrity","celeriac","celery","cell","cellar","cello","celsius","cement","cemetery","cenotaph","census","cent","center","centimeter","centre","centurion","century","cephalopod","ceramic","ceramics","cereal","ceremony","certainty","certificate","certification","cesspool","chafe","chain","chainstay","chair","chairlift","chairman","chairperson","chaise","chalet","chalice","chalk","challenge","chamber","champagne","champion","championship","chance","chandelier","change","channel","chaos","chap","chapel","chaplain","chapter","character","characteristic","characterization","chard","charge","charger","charity","charlatan","charm","charset","chart","charter","chasm","chassis","chastity","chasuble","chateau","chatter","chauffeur","chauvinist","check","checkbook","checking","checkout","checkroom","cheddar","cheek","cheer","cheese","cheesecake","cheetah","chef","chem","chemical","chemistry","chemotaxis","cheque","cherry","chess","chest","chestnut","chick","chicken","chicory","chief","chiffonier","child","childbirth","childhood","chili","chill","chime","chimpanzee","chin","chinchilla","chino","chip","chipmunk","chit-chat","chivalry","chive","chives","chocolate","choice","choir","choker","cholesterol","choosing","chop","chops","chopstick","chopsticks","chord","chorus","chow","chowder","chrome","chromolithograph","chronicle","chronograph","chronometer","chrysalis","chub","chuck","chug","church","churn","chutney","cicada","cigarette","cilantro","cinder","cinema","cinnamon","circadian","circle","circuit","circulation","circumference","circumstance","cirrhosis","cirrus","citizen","citizenship","citron","citrus","city","civilian","civilisation","civilization","claim","clam","clamp","clan","clank","clapboard","clarification","clarinet","clarity","clasp","class","classic","classification","classmate","classroom","clause","clave","clavicle","clavier","claw","clay","cleaner","clearance","clearing","cleat","cleavage","clef","cleft","clergyman","cleric","clerk","click","client","cliff","climate","climb","clinic","clip","clipboard","clipper","cloak","cloakroom","clock","clockwork","clogs","cloister","clone","close","closet","closing","closure","cloth","clothes","clothing","cloud","cloudburst","clove","clover","cloves","club","clue","cluster","clutch","co-producer","coach","coal","coalition","coast","coaster","coat","cob","cobbler","cobweb","cock","cockpit","cockroach","cocktail","cocoa","coconut","cod","code","codepage","codling","codon","codpiece","coevolution","cofactor","coffee","coffin","cohesion","cohort","coil","coin","coincidence","coinsurance","coke","cold","coleslaw","coliseum","collaboration","collagen","collapse","collar","collard","collateral","colleague","collection","collectivisation","collectivization","collector","college","collision","colloquy","colon","colonial","colonialism","colonisation","colonization","colony","color","colorlessness","colt","column","columnist","comb","combat","combination","combine","comeback","comedy","comestible","comfort","comfortable","comic","comics","comma","command","commander","commandment","comment","commerce","commercial","commission","commitment","committee","commodity","common","commonsense","commotion","communicant","communication","communion","communist","community","commuter","company","comparison","compass","compassion","compassionate","compensation","competence","competition","competitor","complaint","complement","completion","complex","complexity","compliance","complication","complicity","compliment","component","comportment","composer","composite","composition","compost","comprehension","compress","compromise","comptroller","compulsion","computer","comradeship","con","concentrate","concentration","concept","conception","concern","concert","conclusion","concrete","condition","conditioner","condominium","condor","conduct","conductor","cone","confectionery","conference","confidence","confidentiality","configuration","confirmation","conflict","conformation","confusion","conga","congo","congregation","congress","congressman","congressperson","conifer","connection","connotation","conscience","consciousness","consensus","consent","consequence","conservation","conservative","consideration","consignment","consist","consistency","console","consonant","conspiracy","conspirator","constant","constellation","constitution","constraint","construction","consul","consulate","consulting","consumer","consumption","contact","contact lens","contagion","container","content","contention","contest","context","continent","contingency","continuity","contour","contract","contractor","contrail","contrary","contrast","contribution","contributor","control","controller","controversy","convection","convenience","convention","conversation","conversion","convert","convertible","conviction","cook","cookbook","cookie","cooking","coonskin","cooperation","coordination","coordinator","cop","cop-out","cope","copper","copy","copying","copyright","copywriter","coral","cord","corduroy","core","cork","cormorant","corn","corner","cornerstone","cornet","cornflakes","cornmeal","corporal","corporation","corporatism","corps","corral","correspondence","correspondent","corridor","corruption","corsage","cosset","cost","costume","cot","cottage","cotton","couch","cougar","cough","council","councilman","councilor","councilperson","counsel","counseling","counselling","counsellor","counselor","count","counter","counter-force","counterpart","counterterrorism","countess","country","countryside","county","couple","coupon","courage","course","court","courthouse","courtroom","cousin","covariate","cover","coverage","coverall","cow","cowbell","cowboy","coyote","crab","crack","cracker","crackers","cradle","craft","craftsman","cranberry","crane","cranky","crap","crash","crate","cravat","craw","crawdad","crayfish","crayon","crazy","cream","creation","creationism","creationist","creative","creativity","creator","creature","creche","credential","credenza","credibility","credit","creditor","creek","creme brulee","crepe","crest","crew","crewman","crewmate","crewmember","crewmen","cria","crib","cribbage","cricket","cricketer","crime","criminal","crinoline","crisis","crisp","criteria","criterion","critic","criticism","crocodile","crocus","croissant","crook","crop","cross","cross-contamination","cross-stitch","crotch","croup","crow","crowd","crown","crucifixion","crude","cruelty","cruise","crumb","crunch","crusader","crush","crust","cry","crystal","crystallography","cub","cube","cuckoo","cucumber","cue","cuff-link","cuisine","cultivar","cultivator","culture","culvert","cummerbund","cup","cupboard","cupcake","cupola","curd","cure","curio","curiosity","curl","curler","currant","currency","current","curriculum","curry","curse","cursor","curtailment","curtain","curve","cushion","custard","custody","custom","customer","cut","cuticle","cutlet","cutover","cutting","cyclamen","cycle","cyclone","cyclooxygenase","cygnet","cylinder","cymbal","cynic","cyst","cytokine","cytoplasm","dad","daddy","daffodil","dagger","dahlia","daikon","daily","dairy","daisy","dam","damage","dame","damn","dance","dancer","dancing","dandelion","danger","dare","dark","darkness","darn","dart","dash","dashboard","data","database","date","daughter","dawn","day","daybed","daylight","dead","deadline","deal","dealer","dealing","dearest","death","deathwatch","debate","debris","debt","debtor","decade","decadence","decency","decimal","decision","decision-making","deck","declaration","declination","decline","decoder","decongestant","decoration","decrease","decryption","dedication","deduce","deduction","deed","deep","deer","default","defeat","defendant","defender","defense","deficit","definition","deformation","degradation","degree","delay","deliberation","delight","delivery","demand","democracy","democrat","demon","demur","den","denim","denominator","density","dentist","deodorant","department","departure","dependency","dependent","deployment","deposit","deposition","depot","depression","depressive","depth","deputy","derby","derivation","derivative","derrick","descendant","descent","description","desert","design","designation","designer","desire","desk","desktop","dessert","destination","destiny","destroyer","destruction","detail","detainee","detainment","detection","detective","detector","detention","determination","detour","devastation","developer","developing","development","developmental","deviance","deviation","device","devil","dew","dhow","diabetes","diadem","diagnosis","diagram","dial","dialect","dialogue","diam","diamond","diaper","diaphragm","diarist","diary","dibble","dick","dickey","dictaphone","dictator","diction","dictionary","die","diesel","diet","difference","differential","difficulty","diffuse","dig","digestion","digestive","digger","digging","digit","dignity","dilapidation","dill","dilution","dime","dimension","dimple","diner","dinghy","dining","dinner","dinosaur","dioxide","dip","diploma","diplomacy","dipstick","direction","directive","director","directory","dirndl","dirt","disability","disadvantage","disagreement","disappointment","disarmament","disaster","discharge","discipline","disclaimer","disclosure","disco","disconnection","discount","discourse","discovery","discrepancy","discretion","discrimination","discussion","disdain","disease","disembodiment","disengagement","disguise","disgust","dish","dishwasher","disk","disparity","dispatch","displacement","display","disposal","disposer","disposition","dispute","disregard","disruption","dissemination","dissonance","distance","distinction","distortion","distribution","distributor","district","divalent","divan","diver","diversity","divide","dividend","divider","divine","diving","division","divorce","doc","dock","doctor","doctorate","doctrine","document","documentary","documentation","doe","dog","doggie","dogsled","dogwood","doing","doll","dollar","dollop","dolman","dolor","dolphin","domain","dome","domination","donation","donkey","donor","donut","door","doorbell","doorknob","doorpost","doorway","dory","dose","dot","double","doubling","doubt","doubter","dough","doughnut","down","downfall","downforce","downgrade","download","downstairs","downtown","downturn","dozen","draft","drag","dragon","dragonfly","dragonfruit","dragster","drain","drainage","drake","drama","dramaturge","drapes","draw","drawbridge","drawer","drawing","dream","dreamer","dredger","dress","dresser","dressing","drill","drink","drinking","drive","driver","driveway","driving","drizzle","dromedary","drop","drudgery","drug","drum","drummer","drunk","dryer","duck","duckling","dud","dude","due","duel","dueling","duffel","dugout","dulcimer","dumbwaiter","dump","dump truck","dune","dune buggy","dungarees","dungeon","duplexer","duration","durian","dusk","dust","dust storm","duster","duty","dwarf","dwell","dwelling","dynamics","dynamite","dynamo","dynasty","dysfunction","e-book","e-mail","e-reader","eagle","eaglet","ear","eardrum","earmuffs","earnings","earplug","earring","earrings","earth","earthquake","earthworm","ease","easel","east","eating","eaves","eavesdropper","ecclesia","echidna","eclipse","ecliptic","ecology","economics","economy","ecosystem","ectoderm","ectodermal","ecumenist","eddy","edge","edger","edible","editing","edition","editor","editorial","education","eel","effacement","effect","effective","effectiveness","effector","efficacy","efficiency","effort","egg","egghead","eggnog","eggplant","ego","eicosanoid","ejector","elbow","elderberry","election","electricity","electrocardiogram","electronics","element","elephant","elevation","elevator","eleventh","elf","elicit","eligibility","elimination","elite","elixir","elk","ellipse","elm","elongation","elver","email","emanate","embarrassment","embassy","embellishment","embossing","embryo","emerald","emergence","emergency","emergent","emery","emission","emitter","emotion","emphasis","empire","employ","employee","employer","employment","empowerment","emu","enactment","encirclement","enclave","enclosure","encounter","encouragement","encyclopedia","end","endive","endoderm","endorsement","endothelium","endpoint","enemy","energy","enforcement","engagement","engine","engineer","engineering","enigma","enjoyment","enquiry","enrollment","enterprise","entertainment","enthusiasm","entirety","entity","entrance","entree","entrepreneur","entry","envelope","environment","envy","enzyme","epauliere","epee","ephemera","ephemeris","ephyra","epic","episode","epithelium","epoch","eponym","epoxy","equal","equality","equation","equinox","equipment","equity","equivalent","era","eraser","erection","erosion","error","escalator","escape","escort","espadrille","espalier","essay","essence","essential","establishment","estate","estimate","estrogen","estuary","eternity","ethernet","ethics","ethnicity","ethyl","euphonium","eurocentrism","evaluation","evaluator","evaporation","eve","evening","evening-wear","event","everybody","everyone","everything","eviction","evidence","evil","evocation","evolution","ex-husband","ex-wife","exaggeration","exam","examination","examiner","example","exasperation","excellence","exception","excerpt","excess","exchange","excitement","exclamation","excursion","excuse","execution","executive","executor","exercise","exhaust","exhaustion","exhibit","exhibition","exile","existence","exit","exocrine","expansion","expansionism","expectancy","expectation","expedition","expense","experience","experiment","experimentation","expert","expertise","explanation","exploration","explorer","explosion","export","expose","exposition","exposure","expression","extension","extent","exterior","external","extinction","extreme","extremist","eye","eyeball","eyebrow","eyebrows","eyeglasses","eyelash","eyelashes","eyelid","eyelids","eyeliner","eyestrain","eyrie","fabric","face","facelift","facet","facility","facsimile","fact","factor","factory","faculty","fahrenheit","fail","failure","fairness","fairy","faith","faithful","fall","fallacy","falling-out","fame","familiar","familiarity","family","fan","fang","fanlight","fanny","fanny-pack","fantasy","farm","farmer","farming","farmland","farrow","fascia","fashion","fat","fate","father","father-in-law","fatigue","fatigues","faucet","fault","fav","fava","favor","favorite","fawn","fax","fear","feast","feather","feature","fedelini","federation","fedora","fee","feed","feedback","feeding","feel","feeling","fellow","felony","female","fen","fence","fencing","fender","feng","fennel","ferret","ferry","ferryboat","fertilizer","festival","fetus","few","fiber","fiberglass","fibre","fibroblast","fibrosis","ficlet","fiction","fiddle","field","fiery","fiesta","fifth","fig","fight","fighter","figure","figurine","file","filing","fill","fillet","filly","film","filter","filth","final","finance","financing","finding","fine","finer","finger","fingerling","fingernail","finish","finisher","fir","fire","fireman","fireplace","firewall","firm","first","fish","fishbone","fisherman","fishery","fishing","fishmonger","fishnet","fisting","fit","fitness","fix","fixture","flag","flair","flame","flan","flanker","flare","flash","flat","flatboat","flavor","flax","fleck","fledgling","fleece","flesh","flexibility","flick","flicker","flight","flint","flintlock","flip-flops","flock","flood","floodplain","floor","floozie","flour","flow","flower","flu","flugelhorn","fluke","flume","flung","flute","fly","flytrap","foal","foam","fob","focus","fog","fold","folder","folk","folklore","follower","following","fondue","font","food","foodstuffs","fool","foot","footage","football","footnote","footprint","footrest","footstep","footstool","footwear","forage","forager","foray","force","ford","forearm","forebear","forecast","forehead","foreigner","forelimb","forest","forestry","forever","forgery","fork","form","formal","formamide","format","formation","former","formicarium","formula","fort","forte","fortnight","fortress","fortune","forum","foundation","founder","founding","fountain","fourths","fowl","fox","foxglove","fraction","fragrance","frame","framework","fratricide","fraud","fraudster","freak","freckle","freedom","freelance","freezer","freezing","freight","freighter","frenzy","freon","frequency","fresco","friction","fridge","friend","friendship","fries","frigate","fright","fringe","fritter","frock","frog","front","frontier","frost","frosting","frown","fruit","frustration","fry","fuck","fuel","fugato","fulfillment","full","fun","function","functionality","fund","funding","fundraising","funeral","fur","furnace","furniture","furry","fusarium","futon","future","gadget","gaffe","gaffer","gain","gaiters","gale","gall-bladder","gallery","galley","gallon","galoshes","gambling","game","gamebird","gaming","gamma-ray","gander","gang","gap","garage","garb","garbage","garden","garlic","garment","garter","gas","gasket","gasoline","gasp","gastronomy","gastropod","gate","gateway","gather","gathering","gator","gauge","gauntlet","gavel","gazebo","gazelle","gear","gearshift","geek","gel","gelatin","gelding","gem","gemsbok","gender","gene","general","generation","generator","generosity","genetics","genie","genius","genocide","genre","gentleman","geography","geology","geometry","geranium","gerbil","gesture","geyser","gherkin","ghost","giant","gift","gig","gigantism","giggle","ginger","gingerbread","ginseng","giraffe","girdle","girl","girlfriend","git","glacier","gladiolus","glance","gland","glass","glasses","glee","glen","glider","gliding","glimpse","globe","glockenspiel","gloom","glory","glove","glow","glucose","glue","glut","glutamate","gnat","gnu","go-kart","goal","goat","gobbler","god","goddess","godfather","godmother","godparent","goggles","going","gold","goldfish","golf","gondola","gong","good","good-bye","goodbye","goodie","goodness","goodnight","goodwill","goose","gopher","gorilla","gosling","gossip","governance","government","governor","gown","grab-bag","grace","grade","gradient","graduate","graduation","graffiti","graft","grain","gram","grammar","gran","grand","grandchild","granddaughter","grandfather","grandma","grandmom","grandmother","grandpa","grandparent","grandson","granny","granola","grant","grape","grapefruit","graph","graphic","grasp","grass","grasshopper","grassland","gratitude","gravel","gravitas","gravity","gravy","gray","grease","great-grandfather","great-grandmother","greatness","greed","green","greenhouse","greens","grenade","grey","grid","grief","grill","grin","grip","gripper","grit","grocery","ground","group","grouper","grouse","grove","growth","grub","guacamole","guarantee","guard","guava","guerrilla","guess","guest","guestbook","guidance","guide","guideline","guilder","guilt","guilty","guinea","guitar","guitarist","gum","gumshoe","gun","gunpowder","gutter","guy","gym","gymnast","gymnastics","gynaecology","gyro","habit","habitat","hacienda","hacksaw","hackwork","hail","hair","haircut","hake","half","half-brother","half-sister","halibut","hall","halloween","hallway","halt","ham","hamburger","hammer","hammock","hamster","hand","hand-holding","handball","handful","handgun","handicap","handle","handlebar","handmaiden","handover","handrail","handsaw","hanger","happening","happiness","harald","harbor","harbour","hard-hat","hardboard","hardcover","hardening","hardhat","hardship","hardware","hare","harm","harmonica","harmonise","harmonize","harmony","harp","harpooner","harpsichord","harvest","harvester","hash","hashtag","hassock","haste","hat","hatbox","hatchet","hatchling","hate","hatred","haunt","haven","haversack","havoc","hawk","hay","haze","hazel","hazelnut","head","headache","headlight","headline","headphones","headquarters","headrest","health","health-care","hearing","hearsay","heart","heart-throb","heartache","heartbeat","hearth","hearthside","heartwood","heat","heater","heating","heaven","heavy","hectare","hedge","hedgehog","heel","heifer","height","heir","heirloom","helicopter","helium","hell","hellcat","hello","helmet","helo","help","hemisphere","hemp","hen","hepatitis","herb","herbs","heritage","hermit","hero","heroine","heron","herring","hesitation","heterosexual","hexagon","heyday","hiccups","hide","hierarchy","high","high-rise","highland","highlight","highway","hike","hiking","hill","hint","hip","hippodrome","hippopotamus","hire","hiring","historian","history","hit","hive","hobbit","hobby","hockey","hoe","hog","hold","holder","hole","holiday","home","homeland","homeownership","hometown","homework","homicide","homogenate","homonym","homosexual","homosexuality","honesty","honey","honeybee","honeydew","honor","honoree","hood","hoof","hook","hop","hope","hops","horde","horizon","hormone","horn","hornet","horror","horse","horseradish","horst","hose","hosiery","hospice","hospital","hospitalisation","hospitality","hospitalization","host","hostel","hostess","hotdog","hotel","hound","hour","hourglass","house","houseboat","household","housewife","housework","housing","hovel","hovercraft","howard","howitzer","hub","hubcap","hubris","hug","hugger","hull","human","humanity","humidity","hummus","humor","humour","hunchback","hundred","hunger","hunt","hunter","hunting","hurdle","hurdler","hurricane","hurry","hurt","husband","hut","hutch","hyacinth","hybridisation","hybridization","hydrant","hydraulics","hydrocarb","hydrocarbon","hydrofoil","hydrogen","hydrolyse","hydrolysis","hydrolyze","hydroxyl","hyena","hygienic","hype","hyphenation","hypochondria","hypothermia","hypothesis","ice","ice-cream","iceberg","icebreaker","icecream","icicle","icing","icon","icy","id","idea","ideal","identification","identity","ideology","idiom","idiot","igloo","ignorance","ignorant","ikebana","illegal","illiteracy","illness","illusion","illustration","image","imagination","imbalance","imitation","immigrant","immigration","immortal","impact","impairment","impala","impediment","implement","implementation","implication","import","importance","impostor","impress","impression","imprisonment","impropriety","improvement","impudence","impulse","in-joke","in-laws","inability","inauguration","inbox","incandescence","incarnation","incense","incentive","inch","incidence","incident","incision","inclusion","income","incompetence","inconvenience","increase","incubation","independence","independent","index","indication","indicator","indigence","individual","industrialisation","industrialization","industry","inequality","inevitable","infancy","infant","infarction","infection","infiltration","infinite","infix","inflammation","inflation","influence","influx","info","information","infrastructure","infusion","inglenook","ingrate","ingredient","inhabitant","inheritance","inhibition","inhibitor","initial","initialise","initialize","initiative","injunction","injury","injustice","ink","inlay","inn","innervation","innocence","innocent","innovation","input","inquiry","inscription","insect","insectarium","insert","inside","insight","insolence","insomnia","inspection","inspector","inspiration","installation","instance","instant","instinct","institute","institution","instruction","instructor","instrument","instrumentalist","instrumentation","insulation","insurance","insurgence","insurrection","integer","integral","integration","integrity","intellect","intelligence","intensity","intent","intention","intentionality","interaction","interchange","interconnection","intercourse","interest","interface","interferometer","interior","interject","interloper","internet","interpretation","interpreter","interval","intervenor","intervention","interview","interviewer","intestine","introduction","intuition","invader","invasion","invention","inventor","inventory","inverse","inversion","investigation","investigator","investment","investor","invitation","invite","invoice","involvement","iridescence","iris","iron","ironclad","irony","irrigation","ischemia","island","isogloss","isolation","issue","item","itinerary","ivory","jack","jackal","jacket","jackfruit","jade","jaguar","jail","jailhouse","jalape\xC3\xB1o","jam","jar","jasmine","jaw","jazz","jealousy","jeans","jeep","jelly","jellybeans","jellyfish","jerk","jet","jewel","jeweller","jewellery","jewelry","jicama","jiffy","job","jockey","jodhpurs","joey","jogging","joint","joke","jot","journal","journalism","journalist","journey","joy","judge","judgment","judo","jug","juggernaut","juice","julienne","jumbo","jump","jumper","jumpsuit","jungle","junior","junk","junker","junket","jury","justice","justification","jute","kale","kamikaze","kangaroo","karate","kayak","kazoo","kebab","keep","keeper","kendo","kennel","ketch","ketchup","kettle","kettledrum","key","keyboard","keyboarding","keystone","kick","kick-off","kid","kidney","kielbasa","kill","killer","killing","kilogram","kilometer","kilt","kimono","kinase","kind","kindness","king","kingdom","kingfish","kiosk","kiss","kit","kitchen","kite","kitsch","kitten","kitty","kiwi","knee","kneejerk","knickers","knife","knife-edge","knight","knitting","knock","knot","know-how","knowledge","knuckle","koala","kohlrabi","kumquat","lab","label","labor","laboratory","laborer","labour","labourer","lace","lack","lacquerware","lad","ladder","ladle","lady","ladybug","lag","lake","lamb","lambkin","lament","lamp","lanai","land","landform","landing","landmine","landscape","lane","language","lantern","lap","laparoscope","lapdog","laptop","larch","lard","larder","lark","larva","laryngitis","lasagna","lashes","last","latency","latex","lathe","latitude","latte","latter","laugh","laughter","laundry","lava","law","lawmaker","lawn","lawsuit","lawyer","lay","layer","layout","lead","leader","leadership","leading","leaf","league","leaker","leap","learning","leash","leather","leave","leaver","lecture","leek","leeway","left","leg","legacy","legal","legend","legging","legislation","legislator","legislature","legitimacy","legume","leisure","lemon","lemonade","lemur","lender","lending","length","lens","lentil","leopard","leprosy","leptocephalus","lesbian","lesson","letter","lettuce","level","lever","leverage","leveret","liability","liar","liberty","libido","library","licence","license","licensing","licorice","lid","lie","lieu","lieutenant","life","lifestyle","lifetime","lift","ligand","light","lighting","lightning","lightscreen","ligula","likelihood","likeness","lilac","lily","limb","lime","limestone","limit","limitation","limo","line","linen","liner","linguist","linguistics","lining","link","linkage","linseed","lion","lip","lipid","lipoprotein","lipstick","liquid","liquidity","liquor","list","listening","listing","literate","literature","litigation","litmus","litter","littleneck","liver","livestock","living","lizard","llama","load","loading","loaf","loafer","loan","lobby","lobotomy","lobster","local","locality","location","lock","locker","locket","locomotive","locust","lode","loft","log","loggia","logic","login","logistics","logo","loincloth","lollipop","loneliness","longboat","longitude","look","lookout","loop","loophole","loquat","lord","loss","lot","lotion","lottery","lounge","louse","lout","love","lover","lox","loyalty","luck","luggage","lumber","lumberman","lunch","luncheonette","lunchmeat","lunchroom","lung","lunge","lust","lute","luxury","lychee","lycra","lye","lymphocyte","lynx","lyocell","lyre","lyrics","lysine","mRNA","macadamia","macaroni","macaroon","macaw","machine","machinery","macrame","macro","macrofauna","madam","maelstrom","maestro","magazine","maggot","magic","magnet","magnitude","maid","maiden","mail","mailbox","mailer","mailing","mailman","main","mainland","mainstream","maintainer","maintenance","maize","major","major-league","majority","makeover","maker","makeup","making","male","malice","mall","mallard","mallet","malnutrition","mama","mambo","mammoth","man","manacle","management","manager","manatee","mandarin","mandate","mandolin","mangle","mango","mangrove","manhunt","maniac","manicure","manifestation","manipulation","mankind","manner","manor","mansard","manservant","mansion","mantel","mantle","mantua","manufacturer","manufacturing","many","map","maple","mapping","maracas","marathon","marble","march","mare","margarine","margin","mariachi","marimba","marines","marionberry","mark","marker","market","marketer","marketing","marketplace","marksman","markup","marmalade","marriage","marsh","marshland","marshmallow","marten","marxism","mascara","mask","masonry","mass","massage","mast","master","masterpiece","mastication","mastoid","mat","match","matchmaker","mate","material","maternity","math","mathematics","matrix","matter","mattock","mattress","max","maximum","maybe","mayonnaise","mayor","meadow","meal","mean","meander","meaning","means","meantime","measles","measure","measurement","meat","meatball","meatloaf","mecca","mechanic","mechanism","med","medal","media","median","medication","medicine","medium","meet","meeting","melatonin","melody","melon","member","membership","membrane","meme","memo","memorial","memory","men","menopause","menorah","mention","mentor","menu","merchandise","merchant","mercury","meridian","meringue","merit","mesenchyme","mess","message","messenger","messy","metabolite","metal","metallurgist","metaphor","meteor","meteorology","meter","methane","method","methodology","metric","metro","metronome","mezzanine","microlending","micronutrient","microphone","microwave","mid-course","midden","middle","middleman","midline","midnight","midwife","might","migrant","migration","mile","mileage","milepost","milestone","military","milk","milkshake","mill","millennium","millet","millimeter","million","millisecond","millstone","mime","mimosa","min","mincemeat","mind","mine","mineral","mineshaft","mini","mini-skirt","minibus","minimalism","minimum","mining","minion","minister","mink","minnow","minor","minor-league","minority","mint","minute","miracle","mirror","miscarriage","miscommunication","misfit","misnomer","misogyny","misplacement","misreading","misrepresentation","miss","missile","mission","missionary","mist","mistake","mister","misunderstand","miter","mitten","mix","mixer","mixture","moai","moat","mob","mobile","mobility","mobster","moccasins","mocha","mochi","mode","model","modeling","modem","modernist","modernity","modification","molar","molasses","molding","mole","molecule","mom","moment","monastery","monasticism","money","monger","monitor","monitoring","monk","monkey","monocle","monopoly","monotheism","monsoon","monster","month","monument","mood","moody","moon","moonlight","moonscape","moonshine","moose","mop","morale","morbid","morbidity","morning","moron","morphology","morsel","mortal","mortality","mortgage","mortise","mosque","mosquito","most","motel","moth","mother","mother-in-law","motion","motivation","motive","motor","motorboat","motorcar","motorcycle","mound","mountain","mouse","mouser","mousse","moustache","mouth","mouton","movement","mover","movie","mower","mozzarella","mud","muffin","mug","mukluk","mule","multimedia","murder","muscat","muscatel","muscle","musculature","museum","mushroom","music","music-box","music-making","musician","muskrat","mussel","mustache","mustard","mutation","mutt","mutton","mycoplasma","mystery","myth","mythology","nail","name","naming","nanoparticle","napkin","narrative","nasal","nation","nationality","native","naturalisation","nature","navigation","necessity","neck","necklace","necktie","nectar","nectarine","need","needle","neglect","negligee","negotiation","neighbor","neighborhood","neighbour","neighbourhood","neologism","neon","neonate","nephew","nerve","nest","nestling","nestmate","net","netball","netbook","netsuke","network","networking","neurobiologist","neuron","neuropathologist","neuropsychiatry","news","newsletter","newspaper","newsprint","newsstand","nexus","nibble","nicety","niche","nick","nickel","nickname","niece","night","nightclub","nightgown","nightingale","nightlife","nightlight","nightmare","ninja","nit","nitrogen","nobody","nod","node","noir","noise","nonbeliever","nonconformist","nondisclosure","nonsense","noodle","noodles","noon","norm","normal","normalisation","normalization","north","nose","notation","note","notebook","notepad","nothing","notice","notion","notoriety","nougat","noun","nourishment","novel","nucleotidase","nucleotide","nudge","nuke","number","numeracy","numeric","numismatist","nun","nurse","nursery","nursing","nurture","nut","nutmeg","nutrient","nutrition","nylon","nymph","oak","oar","oasis","oat","oatmeal","oats","obedience","obesity","obi","object","objection","objective","obligation","oboe","observation","observatory","obsession","obsidian","obstacle","occasion","occupation","occurrence","ocean","ocelot","octagon","octave","octavo","octet","octopus","odometer","odyssey","oeuvre","off-ramp","offence","offense","offer","offering","office","officer","official","offset","oil","okra","oldie","oleo","olive","omega","omelet","omission","omnivore","oncology","onion","online","onset","opening","opera","operating","operation","operator","ophthalmologist","opinion","opium","opossum","opponent","opportunist","opportunity","opposite","opposition","optimal","optimisation","optimist","optimization","option","orange","orangutan","orator","orchard","orchestra","orchid","order","ordinary","ordination","ore","oregano","organ","organisation","organising","organization","organizing","orient","orientation","origin","original","originality","ornament","osmosis","osprey","ostrich","other","otter","ottoman","ounce","outback","outcome","outfielder","outfit","outhouse","outlaw","outlay","outlet","outline","outlook","output","outrage","outrigger","outrun","outset","outside","oval","ovary","oven","overcharge","overclocking","overcoat","overexertion","overflight","overhead","overheard","overload","overnighter","overshoot","oversight","overview","overweight","owl","owner","ownership","ox","oxford","oxygen","oyster","ozone","pace","pacemaker","pack","package","packaging","packet","pad","paddle","paddock","pagan","page","pagoda","pail","pain","paint","painter","painting","paintwork","pair","pajamas","palace","palate","palm","pamphlet","pan","pancake","pancreas","panda","panel","panic","pannier","panpipe","pansy","panther","panties","pantologist","pantology","pantry","pants","pantsuit","panty","pantyhose","papa","papaya","paper","paperback","paperwork","parable","parachute","parade","paradise","paragraph","parallelogram","paramecium","paramedic","parameter","paranoia","parcel","parchment","pard","pardon","parent","parenthesis","parenting","park","parka","parking","parliament","parole","parrot","parser","parsley","parsnip","part","participant","participation","particle","particular","partner","partnership","partridge","party","pass","passage","passbook","passenger","passing","passion","passive","passport","password","past","pasta","paste","pastor","pastoralist","pastry","pasture","pat","patch","pate","patent","patentee","path","pathogenesis","pathology","pathway","patience","patient","patina","patio","patriarch","patrimony","patriot","patrol","patroller","patrolling","patron","pattern","patty","pattypan","pause","pavement","pavilion","paw","pawnshop","pay","payee","payment","payoff","pea","peace","peach","peacoat","peacock","peak","peanut","pear","pearl","peasant","pecan","pecker","pedal","peek","peen","peer","peer-to-peer","pegboard","pelican","pelt","pen","penalty","pence","pencil","pendant","pendulum","penguin","penicillin","peninsula","penis","pennant","penny","pension","pentagon","peony","people","pepper","pepperoni","percent","percentage","perception","perch","perennial","perfection","performance","perfume","period","periodical","peripheral","permafrost","permission","permit","perp","perpendicular","persimmon","person","personal","personality","personnel","perspective","pest","pet","petal","petition","petitioner","petticoat","pew","pharmacist","pharmacopoeia","phase","pheasant","phenomenon","phenotype","pheromone","philanthropy","philosopher","philosophy","phone","phosphate","photo","photodiode","photograph","photographer","photography","photoreceptor","phrase","phrasing","physical","physics","physiology","pianist","piano","piccolo","pick","pickax","pickaxe","picket","pickle","pickup","picnic","picture","picturesque","pie","piece","pier","piety","pig","pigeon","piglet","pigpen","pigsty","pike","pilaf","pile","pilgrim","pilgrimage","pill","pillar","pillbox","pillow","pilot","pimp","pimple","pin","pinafore","pince-nez","pine","pineapple","pinecone","ping","pink","pinkie","pinot","pinstripe","pint","pinto","pinworm","pioneer","pipe","pipeline","piracy","pirate","piss","pistol","pit","pita","pitch","pitcher","pitching","pith","pizza","place","placebo","placement","placode","plagiarism","plain","plaintiff","plan","plane","planet","planning","plant","plantation","planter","planula","plaster","plasterboard","plastic","plate","platelet","platform","platinum","platter","platypus","play","player","playground","playroom","playwright","plea","pleasure","pleat","pledge","plenty","plier","pliers","plight","plot","plough","plover","plow","plowman","plug","plugin","plum","plumber","plume","plunger","plywood","pneumonia","pocket","pocket-watch","pocketbook","pod","podcast","poem","poet","poetry","poignance","point","poison","poisoning","poker","polarisation","polarization","pole","polenta","police","policeman","policy","polish","politician","politics","poll","polliwog","pollutant","pollution","polo","polyester","polyp","pomegranate","pomelo","pompom","poncho","pond","pony","pool","poor","pop","popcorn","poppy","popsicle","popularity","population","populist","porcelain","porch","porcupine","pork","porpoise","port","porter","portfolio","porthole","portion","portrait","position","possession","possibility","possible","post","postage","postbox","poster","posterior","postfix","pot","potato","potential","pottery","potty","pouch","poultry","pound","pounding","poverty","powder","power","practice","practitioner","prairie","praise","pray","prayer","precedence","precedent","precipitation","precision","predecessor","preface","preference","prefix","pregnancy","prejudice","prelude","premeditation","premier","premise","premium","preoccupation","preparation","prescription","presence","present","presentation","preservation","preserves","presidency","president","press","pressroom","pressure","pressurisation","pressurization","prestige","presume","pretzel","prevalence","prevention","prey","price","pricing","pride","priest","priesthood","primary","primate","prince","princess","principal","principle","print","printer","printing","prior","priority","prison","prisoner","privacy","private","privilege","prize","prizefight","probability","probation","probe","problem","procedure","proceedings","process","processing","processor","proctor","procurement","produce","producer","product","production","productivity","profession","professional","professor","profile","profit","progenitor","program","programme","programming","progress","progression","prohibition","project","proliferation","promenade","promise","promotion","prompt","pronoun","pronunciation","proof","proof-reader","propaganda","propane","property","prophet","proponent","proportion","proposal","proposition","proprietor","prose","prosecution","prosecutor","prospect","prosperity","prostacyclin","prostanoid","prostrate","protection","protein","protest","protocol","providence","provider","province","provision","prow","proximal","proximity","prune","pruner","pseudocode","pseudoscience","psychiatrist","psychoanalyst","psychologist","psychology","ptarmigan","pub","public","publication","publicity","publisher","publishing","pudding","puddle","puffin","pug","puggle","pulley","pulse","puma","pump","pumpernickel","pumpkin","pumpkinseed","pun","punch","punctuation","punishment","pup","pupa","pupil","puppet","puppy","purchase","puritan","purity","purple","purpose","purr","purse","pursuit","push","pusher","put","puzzle","pyramid","pyridine","quadrant","quail","qualification","quality","quantity","quart","quarter","quartet","quartz","queen","query","quest","question","questioner","questionnaire","quiche","quicksand","quiet","quill","quilt","quince","quinoa","quit","quiver","quota","quotation","quote","rabbi","rabbit","raccoon","race","racer","racing","racism","racist","rack","radar","radiator","radio","radiosonde","radish","raffle","raft","rag","rage","raid","rail","railing","railroad","railway","raiment","rain","rainbow","raincoat","rainmaker","rainstorm","rainy","raise","raisin","rake","rally","ram","rambler","ramen","ramie","ranch","rancher","randomisation","randomization","range","ranger","rank","rap","rape","raspberry","rat","rate","ratepayer","rating","ratio","rationale","rations","raven","ravioli","rawhide","ray","rayon","razor","reach","reactant","reaction","read","reader","readiness","reading","real","reality","realization","realm","reamer","rear","reason","reasoning","rebel","rebellion","reboot","recall","recapitulation","receipt","receiver","reception","receptor","recess","recession","recipe","recipient","reciprocity","reclamation","recliner","recognition","recollection","recommendation","reconsideration","record","recorder","recording","recovery","recreation","recruit","rectangle","red","redesign","redhead","redirect","rediscovery","reduction","reef","refectory","reference","referendum","reflection","reform","refreshments","refrigerator","refuge","refund","refusal","refuse","regard","regime","region","regionalism","register","registration","registry","regret","regulation","regulator","rehospitalisation","rehospitalization","reindeer","reinscription","reject","relation","relationship","relative","relaxation","relay","release","reliability","relief","religion","relish","reluctance","remains","remark","reminder","remnant","remote","removal","renaissance","rent","reorganisation","reorganization","repair","reparation","repayment","repeat","replacement","replica","replication","reply","report","reporter","reporting","repository","representation","representative","reprocessing","republic","republican","reputation","request","requirement","resale","rescue","research","researcher","resemblance","reservation","reserve","reservoir","reset","residence","resident","residue","resist","resistance","resolution","resolve","resort","resource","respect","respite","response","responsibility","rest","restaurant","restoration","restriction","restroom","restructuring","result","resume","retailer","retention","rethinking","retina","retirement","retouching","retreat","retrospect","retrospective","retrospectivity","return","reunion","revascularisation","revascularization","reveal","revelation","revenant","revenge","revenue","reversal","reverse","review","revitalisation","revitalization","revival","revolution","revolver","reward","rhetoric","rheumatism","rhinoceros","rhubarb","rhyme","rhythm","rib","ribbon","rice","riddle","ride","rider","ridge","riding","rifle","right","rim","ring","ringworm","riot","rip","ripple","rise","riser","risk","rite","ritual","river","riverbed","rivulet","road","roadway","roar","roast","robe","robin","robot","robotics","rock","rocker","rocket","rocket-ship","rod","role","roll","roller","romaine","romance","roof","room","roommate","rooster","root","rope","rose","rosemary","roster","rostrum","rotation","round","roundabout","route","router","routine","row","rowboat","rowing","rubber","rubbish","rubric","ruby","ruckus","rudiment","ruffle","rug","rugby","ruin","rule","ruler","ruling","rum","rumor","run","runaway","runner","running","runway","rush","rust","rutabaga","rye","sabre","sac","sack","saddle","sadness","safari","safe","safeguard","safety","saffron","sage","sail","sailboat","sailing","sailor","saint","sake","salad","salami","salary","sale","salesman","salmon","salon","saloon","salsa","salt","salute","samovar","sampan","sample","samurai","sanction","sanctity","sanctuary","sand","sandal","sandbar","sandpaper","sandwich","sanity","sardine","sari","sarong","sash","satellite","satin","satire","satisfaction","sauce","saucer","sauerkraut","sausage","savage","savannah","saving","savings","savior","saviour","savory","saw","saxophone","scaffold","scale","scallion","scallops","scalp","scam","scanner","scarecrow","scarf","scarification","scenario","scene","scenery","scent","schedule","scheduling","schema","scheme","schizophrenic","schnitzel","scholar","scholarship","school","schoolhouse","schooner","science","scientist","scimitar","scissors","scooter","scope","score","scorn","scorpion","scotch","scout","scow","scrambled","scrap","scraper","scratch","screamer","screen","screening","screenwriting","screw","screw-up","screwdriver","scrim","scrip","script","scripture","scrutiny","sculpting","sculptural","sculpture","sea","seabass","seafood","seagull","seal","seaplane","search","seashore","seaside","season","seat","seaweed","second","secrecy","secret","secretariat","secretary","secretion","section","sectional","sector","security","sediment","seed","seeder","seeker","seep","segment","seizure","selection","self","self-confidence","self-control","self-esteem","seller","selling","semantics","semester","semicircle","semicolon","semiconductor","seminar","senate","senator","sender","senior","sense","sensibility","sensitive","sensitivity","sensor","sentence","sentencing","sentiment","sepal","separation","septicaemia","sequel","sequence","serial","series","sermon","serum","serval","servant","server","service","servitude","sesame","session","set","setback","setting","settlement","settler","severity","sewer","sex","sexuality","shack","shackle","shade","shadow","shadowbox","shakedown","shaker","shallot","shallows","shame","shampoo","shanty","shape","share","shareholder","shark","shaw","shawl","shear","shearling","sheath","shed","sheep","sheet","shelf","shell","shelter","sherbet","sherry","shield","shift","shin","shine","shingle","ship","shipper","shipping","shipyard","shirt","shirtdress","shit","shoat","shock","shoe","shoe-horn","shoehorn","shoelace","shoemaker","shoes","shoestring","shofar","shoot","shootdown","shop","shopper","shopping","shore","shoreline","short","shortage","shorts","shortwave","shot","shoulder","shout","shovel","show","show-stopper","shower","shred","shrimp","shrine","shutdown","sibling","sick","sickness","side","sideboard","sideburns","sidecar","sidestream","sidewalk","siding","siege","sigh","sight","sightseeing","sign","signal","signature","signet","significance","signify","signup","silence","silica","silicon","silk","silkworm","sill","silly","silo","silver","similarity","simple","simplicity","simplification","simvastatin","sin","singer","singing","singular","sink","sinuosity","sip","sir","sister","sister-in-law","sitar","site","situation","size","skate","skating","skean","skeleton","ski","skiing","skill","skin","skirt","skull","skullcap","skullduggery","skunk","sky","skylight","skyline","skyscraper","skywalk","slang","slapstick","slash","slate","slave","slavery","slaw","sled","sledge","sleep","sleepiness","sleeping","sleet","sleuth","slice","slide","slider","slime","slip","slipper","slippers","slope","slot","sloth","slump","smell","smelting","smile","smith","smock","smog","smoke","smoking","smolt","smuggling","snack","snail","snake","snakebite","snap","snarl","sneaker","sneakers","sneeze","sniffle","snob","snorer","snow","snowboarding","snowflake","snowman","snowmobiling","snowplow","snowstorm","snowsuit","snuck","snug","snuggle","soap","soccer","socialism","socialist","society","sociology","sock","socks","soda","sofa","softball","softdrink","softening","software","soil","soldier","sole","solicitation","solicitor","solidarity","solidity","soliloquy","solitaire","solution","solvency","sombrero","somebody","someone","someplace","somersault","something","somewhere","son","sonar","sonata","song","songbird","sonnet","soot","sophomore","soprano","sorbet","sorghum","sorrel","sorrow","sort","soul","soulmate","sound","soundness","soup","source","sourwood","sousaphone","south","southeast","souvenir","sovereignty","sow","soy","soybean","space","spacing","spade","spaghetti","span","spandex","spank","sparerib","spark","sparrow","spasm","spat","spatula","spawn","speaker","speakerphone","speaking","spear","spec","special","specialist","specialty","species","specification","spectacle","spectacles","spectrograph","spectrum","speculation","speech","speed","speedboat","spell","spelling","spelt","spending","sphere","sphynx","spice","spider","spiderling","spike","spill","spinach","spine","spiral","spirit","spiritual","spirituality","spit","spite","spleen","splendor","split","spokesman","spokeswoman","sponge","sponsor","sponsorship","spool","spoon","spork","sport","sportsman","spot","spotlight","spouse","sprag","sprat","spray","spread","spreadsheet","spree","spring","sprinkles","sprinter","sprout","spruce","spud","spume","spur","spy","spyglass","square","squash","squatter","squeegee","squid","squirrel","stab","stability","stable","stack","stacking","stadium","staff","stag","stage","stain","stair","staircase","stake","stalk","stall","stallion","stamen","stamina","stamp","stance","stand","standard","standardisation","standardization","standing","standoff","standpoint","star","starboard","start","starter","state","statement","statin","station","station-wagon","statistic","statistics","statue","status","statute","stay","steak","stealth","steam","steamroller","steel","steeple","stem","stench","stencil","step","step-aunt","step-brother","step-daughter","step-father","step-grandfather","step-grandmother","step-mother","step-sister","step-son","step-uncle","stepdaughter","stepmother","stepping-stone","stepson","stereo","stew","steward","stick","sticker","stiletto","still","stimulation","stimulus","sting","stinger","stir-fry","stitch","stitcher","stock","stock-in-trade","stockings","stole","stomach","stone","stonework","stool","stop","stopsign","stopwatch","storage","store","storey","storm","story","story-telling","storyboard","stot","stove","strait","strand","stranger","strap","strategy","straw","strawberry","strawman","stream","street","streetcar","strength","stress","stretch","strife","strike","string","strip","stripe","strobe","stroke","structure","strudel","struggle","stucco","stud","student","studio","study","stuff","stumbling","stump","stupidity","sturgeon","sty","style","styling","stylus","sub","subcomponent","subconscious","subcontractor","subexpression","subgroup","subject","submarine","submitter","subprime","subroutine","subscription","subsection","subset","subsidence","subsidiary","subsidy","substance","substitution","subtitle","suburb","subway","success","succotash","suck","sucker","suede","suet","suffocation","sugar","suggestion","suicide","suit","suitcase","suite","sulfur","sultan","sum","summary","summer","summit","sun","sunbeam","sunbonnet","sundae","sunday","sundial","sunflower","sunglasses","sunlamp","sunlight","sunrise","sunroom","sunset","sunshine","superiority","supermarket","supernatural","supervision","supervisor","supper","supplement","supplier","supply","support","supporter","suppression","supreme","surface","surfboard","surge","surgeon","surgery","surname","surplus","surprise","surround","surroundings","surrounds","survey","survival","survivor","sushi","suspect","suspenders","suspension","sustainment","sustenance","swallow","swamp","swan","swanling","swath","sweat","sweater","sweatshirt","sweatshop","sweatsuit","sweets","swell","swim","swimming","swimsuit","swine","swing","switch","switchboard","switching","swivel","sword","swordfight","swordfish","sycamore","symbol","symmetry","sympathy","symptom","syndicate","syndrome","synergy","synod","synonym","synthesis","syrup","system","t-shirt","tab","tabby","tabernacle","table","tablecloth","tablet","tabletop","tachometer","tackle","taco","tactics","tactile","tadpole","tag","tail","tailbud","tailor","tailspin","take-out","takeover","tale","talent","talk","talking","tam-o'-shanter","tamale","tambour","tambourine","tan","tandem","tangerine","tank","tank-top","tanker","tankful","tap","tape","tapioca","target","taro","tarragon","tart","task","tassel","taste","tatami","tattler","tattoo","tavern","tax","taxi","taxicab","taxpayer","tea","teacher","teaching","team","teammate","teapot","tear","tech","technician","technique","technologist","technology","tectonics","teen","teenager","teepee","telephone","telescreen","teletype","television","tell","teller","temp","temper","temperature","temple","tempo","temporariness","temporary","temptation","temptress","tenant","tendency","tender","tenement","tenet","tennis","tenor","tension","tensor","tent","tentacle","tenth","tepee","teriyaki","term","terminal","termination","terminology","termite","terrace","terracotta","terrapin","terrarium","territory","terror","terrorism","terrorist","test","testament","testimonial","testimony","testing","text","textbook","textual","texture","thanks","thaw","theater","theft","theism","theme","theology","theory","therapist","therapy","thermals","thermometer","thermostat","thesis","thickness","thief","thigh","thing","thinking","thirst","thistle","thong","thongs","thorn","thought","thousand","thread","threat","threshold","thrift","thrill","throat","throne","thrush","thrust","thug","thumb","thump","thunder","thunderbolt","thunderhead","thunderstorm","thyme","tiara","tic","tick","ticket","tide","tie","tiger","tights","tile","till","tilt","timbale","timber","time","timeline","timeout","timer","timetable","timing","timpani","tin","tinderbox","tinkle","tintype","tip","tire","tissue","titanium","title","toad","toast","toaster","tobacco","today","toe","toenail","toffee","tofu","tog","toga","toilet","tolerance","tolerant","toll","tom-tom","tomatillo","tomato","tomb","tomography","tomorrow","ton","tonality","tone","tongue","tonic","tonight","tool","toot","tooth","toothbrush","toothpaste","toothpick","top","top-hat","topic","topsail","toque","toreador","tornado","torso","torte","tortellini","tortilla","tortoise","tosser","total","tote","touch","tough-guy","tour","tourism","tourist","tournament","tow-truck","towel","tower","town","townhouse","township","toy","trace","trachoma","track","tracking","tracksuit","tract","tractor","trade","trader","trading","tradition","traditionalism","traffic","trafficker","tragedy","trail","trailer","trailpatrol","train","trainer","training","trait","tram","tramp","trance","transaction","transcript","transfer","transformation","transit","transition","translation","transmission","transom","transparency","transplantation","transport","transportation","trap","trapdoor","trapezium","trapezoid","trash","travel","traveler","tray","treasure","treasury","treat","treatment","treaty","tree","trek","trellis","tremor","trench","trend","triad","trial","triangle","tribe","tributary","trick","trigger","trigonometry","trillion","trim","trinket","trip","tripod","tritone","triumph","trolley","trombone","troop","trooper","trophy","trouble","trousers","trout","trove","trowel","truck","trumpet","trunk","trust","trustee","truth","try","tsunami","tub","tuba","tube","tuber","tug","tugboat","tuition","tulip","tumbler","tummy","tuna","tune","tune-up","tunic","tunnel","turban","turf","turkey","turmeric","turn","turning","turnip","turnover","turnstile","turret","turtle","tusk","tussle","tutu","tuxedo","tweet","tweezers","twig","twilight","twine","twins","twist","twister","twitter","type","typeface","typewriter","typhoon","ukulele","ultimatum","umbrella","unblinking","uncertainty","uncle","underclothes","underestimate","underground","underneath","underpants","underpass","undershirt","understanding","understatement","undertaker","underwear","underweight","underwire","underwriting","unemployment","unibody","uniform","uniformity","union","unique","unit","unity","universe","university","update","upgrade","uplift","upper","upstairs","upward","urge","urgency","urn","usage","use","user","usher","usual","utensil","utilisation","utility","utilization","vacation","vaccine","vacuum","vagrant","valance","valentine","validate","validity","valley","valuable","value","vampire","van","vanadyl","vane","vanilla","vanity","variability","variable","variant","variation","variety","vascular","vase","vault","vaulting","veal","vector","vegetable","vegetarian","vegetarianism","vegetation","vehicle","veil","vein","veldt","vellum","velocity","velodrome","velvet","vendor","veneer","vengeance","venison","venom","venti","venture","venue","veranda","verb","verdict","verification","vermicelli","vernacular","verse","version","vertigo","verve","vessel","vest","vestment","vet","veteran","veterinarian","veto","viability","vibe","vibraphone","vibration","vibrissae","vice","vicinity","victim","victory","video","view","viewer","vignette","villa","village","vine","vinegar","vineyard","vintage","vintner","vinyl","viola","violation","violence","violet","violin","virginal","virtue","virus","visa","viscose","vise","vision","visit","visitor","visor","vista","visual","vitality","vitamin","vitro","vivo","vixen","vodka","vogue","voice","void","vol","volatility","volcano","volleyball","volume","volunteer","volunteering","vomit","vote","voter","voting","voyage","vulture","wad","wafer","waffle","wage","wagon","waist","waistband","wait","waiter","waiting","waitress","waiver","wake","walk","walker","walking","walkway","wall","wallaby","wallet","walnut","walrus","wampum","wannabe","want","war","warden","wardrobe","warfare","warlock","warlord","warm-up","warming","warmth","warning","warrant","warren","warrior","wasabi","wash","washbasin","washcloth","washer","washtub","wasp","waste","wastebasket","wasting","watch","watcher","watchmaker","water","waterbed","watercress","waterfall","waterfront","watermelon","waterskiing","waterspout","waterwheel","wave","waveform","wax","way","weakness","wealth","weapon","wear","weasel","weather","web","webinar","webmail","webpage","website","wedding","wedge","weed","weeder","weedkiller","week","weekend","weekender","weight","weird","welcome","welfare","well","well-being","west","western","wet-bar","wetland","wetsuit","whack","whale","wharf","wheat","wheel","whelp","whey","whip","whirlpool","whirlwind","whisker","whiskey","whisper","whistle","white","whole","wholesale","wholesaler","whorl","wick","widget","widow","width","wife","wifi","wild","wildebeest","wilderness","wildlife","will","willingness","willow","win","wind","wind-chime","windage","window","windscreen","windshield","wine","winery","wing","wingman","wingtip","wink","winner","winter","wire","wiretap","wiring","wisdom","wiseguy","wish","wisteria","wit","witch","witch-hunt","withdrawal","witness","wok","wolf","woman","wombat","wonder","wont","wood","woodchuck","woodland","woodshed","woodwind","wool","woolens","word","wording","work","workbench","worker","workforce","workhorse","working","workout","workplace","workshop","world","worm","worry","worship","worshiper","worth","wound","wrap","wraparound","wrapper","wrapping","wreck","wrecker","wren","wrench","wrestler","wriggler","wrinkle","wrist","writer","writing","wrong","xylophone","yacht","yahoo","yak","yam","yang","yard","yarmulke","yarn","yawl","year","yeast","yellow","yellowjacket","yesterday","yew","yin","yoga","yogurt","yoke","yolk","young","youngster","yourself","youth","yoyo","yurt","zampone","zebra","zebrafish","zen","zephyr","zero","ziggurat","zinc","zipper","zither","zombie","zone","zoo","zoologist","zoology","zoot-suit","zucchini"];var In=["a","abaft","aboard","about","above","absent","across","afore","after","against","along","alongside","amid","amidst","among","amongst","an","anenst","anti","apropos","apud","around","as","aside","astride","at","athwart","atop","barring","before","behind","below","beneath","beside","besides","between","beyond","but","by","circa","concerning","considering","despite","down","during","except","excepting","excluding","failing","following","for","forenenst","from","given","in","including","inside","into","lest","like","mid","midst","minus","modulo","near","next","notwithstanding","of","off","on","onto","opposite","out","outside","over","pace","past","per","plus","pro","qua","regarding","round","sans","save","since","than","the","through","throughout","till","times","to","toward","towards","under","underneath","unlike","until","unto","up","upon","versus","via","vice","with","within","without","worth"];var jn=["abandon","abase","abate","abbreviate","abdicate","abduct","abet","abhor","abide","abjure","abnegate","abolish","abominate","abort","abound","abrade","abridge","abrogate","abscond","abseil","absent","absolve","absorb","abstain","abstract","abuse","abut","accede","accelerate","accent","accentuate","accept","access","accessorise","accessorize","acclaim","acclimate","acclimatise","acclimatize","accommodate","accompany","accomplish","accord","accost","account","accouter","accoutre","accredit","accrue","acculturate","accumulate","accuse","accustom","ace","ache","achieve","acidify","acknowledge","acquaint","acquiesce","acquire","acquit","act","action","activate","actualise","actualize","actuate","adapt","add","addle","address","adduce","adhere","adjoin","adjourn","adjudge","adjudicate","adjure","adjust","administer","admire","admit","admonish","adopt","adore","adorn","adsorb","adulterate","adumbrate","advance","advantage","advertise","advise","advocate","aerate","affect","affiliate","affirm","affix","afflict","afford","afforest","affront","age","agglomerate","aggravate","aggregate","agitate","agonise","agonize","agree","aid","ail","aim","air","airbrush","airdrop","airfreight","airlift","alarm","alert","alienate","alight","align","allay","allege","alleviate","allocate","allot","allow","alloy","allude","ally","alphabetise","alphabetize","alter","alternate","amalgamate","amass","amaze","amble","ambush","ameliorate","amend","amortise","amortize","amount","amplify","amputate","amuse","anaesthetise","anaesthetize","analyse","anchor","anesthetize","anger","angle","anglicise","anglicize","animate","anneal","annex","annihilate","annotate","announce","annoy","annul","anodise","anodize","anoint","anonymise","anonymize","answer","antagonise","antagonize","antedate","anthologise","anthologize","anticipate","ape","apologise","apologize","apostrophise","apostrophize","appal","appall","appeal","appear","appease","append","appertain","applaud","apply","appoint","apportion","appraise","appreciate","apprehend","apprentice","apprise","approach","appropriate","approve","approximate","aquaplane","arbitrate","arc","arch","archive","argue","arise","arm","arouse","arraign","arrange","array","arrest","arrive","arrogate","arse","art","articulate","ascend","ascertain","ascribe","ask","asphyxiate","aspirate","aspire","assail","assassinate","assault","assay","assemble","assent","assert","assess","assign","assimilate","assist","associate","assuage","assume","assure","asterisk","astonish","astound","atomise","atomize","atone","atrophy","attach","attack","attain","attempt","attend","attenuate","attest","attract","attribute","auction","audit","audition","augment","augur","authenticate","author","authorise","authorize","autograph","automate","autosave","autowind","avail","avenge","aver","average","avert","avoid","avow","await","awake","awaken","award","awe","ax","axe","baa","babble","baby","babysit","back","backcomb","backdate","backfill","backfire","backlight","backpack","backspace","backtrack","badger","baffle","bag","bail","bait","bake","balance","bale","ball","balloon","ballot","balls","bamboozle","ban","band","bandage","bandy","bang","bangs","banish","bank","bankroll","bankrupt","banter","baptise","baptize","bar","barbecue","bare","barf","bargain","barge","bark","barnstorm","barrack","barrel","barricade","barter","base","bash","bask","bastardise","bastardize","baste","bat","batch","bath","bathe","batten","batter","battle","baulk","bawl","bay","bayonet","be","beach","beam","bean","bear","beard","beat","beatbox","beatboxer","beatify","beautify","beaver","beckon","become","bed","bedazzle","bedeck","bedevil","beef","beep","beetle","befall","befit","befog","befriend","beg","beget","beggar","begin","begrudge","beguile","behave","behead","behold","behoove","behove","belabor","belabour","belay","belch","belie","believe","belittle","bellow","belly","bellyache","belong","belt","bemoan","bemuse","benchmark","bend","benefit","bequeath","berate","bereave","berth","beseech","beset","besiege","besmirch","bespatter","bespeak","best","bestir","bestow","bestride","bet","betake","betide","betoken","betray","better","bewail","beware","bewilder","bewitch","bias","bicker","bicycle","bid","bide","biff","bifurcate","big","bike","bilk","bill","billet","billow","bin","bind","binge","biodegrade","bird","bisect","bitch","bite","bitmap","bivouac","bivvy","blab","blabber","black","blackball","blacken","blacklist","blackmail","blag","blame","blanch","blank","blanket","blare","blaspheme","blast","blather","blaze","blazon","bleach","bleat","bleed","bleep","blemish","blench","blend","bless","blight","blind","blindfold","blindfolded","blindside","blink","bliss","blister","blitz","bloat","block","blockade","blog","blood","bloom","bloop","blossom","blot","blow","blub","blubber","bludge","bludgeon","bluff","blunder","blunt","blur","blurt","blush","bluster","board","boast","bob","bobble","bode","bodge","bog","boggle","boil","bolster","bolt","bomb","bombard","bond","bone","bonk","boo","boob","boogie","book","bookmark","boom","boomerang","boost","boot","bootleg","booze","bop","border","bore","born","borrow","boss","botch","bother","bottle","bottleful","bottom","bounce","bound","bow","bowdlerise","bowdlerize","bowl","bowlful","box","boycott","braai","brace","braces","bracket","brag","braid","brain","brainstorm","brainwash","braise","brake","branch","brand","brandish","brave","brawl","bray","brazen","breach","break","breakfast","breast","breastfeed","breathalyse","breathalyze","breathe","breed","breeze","brew","bribe","brick","bridge","bridle","brief","brighten","brim","bring","bristle","broach","broadcast","broaden","broadside","broil","broker","brood","brook","browbeat","brown","browse","bruise","bruit","brush","brutalise","brutalize","bubble","buck","bucket","bucketful","buckle","bud","buddy","budge","budget","buff","buffer","buffet","bug","bugger","build","bulge","bulk","bulldoze","bullshit","bully","bum","bumble","bump","bunch","bundle","bung","bungle","bunk","bunker","bunt","buoy","burble","burden","burgeon","burglarize","burgle","burn","burnish","burp","burrow","burst","bury","bus","bushwhack","busk","bust","bustle","busy","butcher","butt","butter","button","buttonhole","buttress","buy","buzz","buzzing","bypass","cable","cache","cackle","caddie","cadge","cage","cajole","cake","calcify","calculate","calibrate","call","calm","calve","camouflage","camp","campaign","can","canalise","canalize","cancel","cane","cannibalise","cannibalize","cannon","cannulate","canoe","canonise","canonize","canoodle","canst","cant","canter","canvass","cap","caper","capitalise","capitalize","capitulate","capsize","captain","caption","captivate","capture","caramelise","caramelize","carbonise","carbonize","carburise","carburize","card","care","careen","career","caress","caricature","carjack","carol","carom","carouse","carp","carpet","carpool","carry","cart","cartwheel","carve","cascade","case","cash","cashier","casserole","cast","castigate","castrate","catalog","catalogue","catalyse","catalyze","catapult","catch","categorise","categorize","cater","caterwaul","catnap","caucus","caulk","cause","cauterise","cauterize","caution","cave","cavil","cavort","caw","cc","cease","cede","celebrate","cement","censor","censure","centralise","centralize","centre","certificate","certify","chafe","chaff","chain","chair","chalk","challenge","champ","champion","chance","change","channel","chant","chaperon","chaperone","char","characterise","characterize","charbroil","charge","chargesheet","chargrill","charm","chart","charter","chase","chasten","chastise","chat","chatter","chauffeur","cheapen","cheat","cheater","check","checkmate","cheek","cheep","cheer","cherish","chew","chicken","chide","chill","chillax","chime","chink","chip","chirp","chisel","chivvy","chlorinate","choke","chomp","choose","chop","choreograph","chortle","chorus","christen","chromakey","chronicle","chuck","chuckle","chug","chunder","chunter","churn","cinch","circle","circulate","circumcise","circumnavigate","circumscribe","circumvent","cite","civilise","civilize","clack","claim","clam","clamber","clamor","clamour","clamp","clang","clank","clap","clarify","clash","clasp","class","classify","clatter","claw","clean","cleanse","clear","cleave","clench","clerk","click","climax","climb","clinch","cling","clink","clinking","clip","cloak","clobber","clock","clog","clone","clonk","close","closet","clot","clothe","cloud","clout","clown","club","cluck","clue","clump","clunk","cluster","clutch","clutter","coach","coagulate","coalesce","coarsen","coast","coat","coax","cobble","cock","cocoon","coddle","code","codify","coerce","coexist","cogitate","cohabit","cohere","coil","coin","coincide","collaborate","collapse","collar","collate","collect","collectivise","collectivize","collide","colligate","collocate","collude","colonise","colonize","colorize","colour","comb","combat","combine","combust","come","comfort","command","commandeer","commemorate","commence","commend","comment","commentate","commercialise","commercialize","commingle","commiserate","commission","commit","commune","communicate","commute","compact","compare","compartmentalise","compartmentalize","compel","compensate","compete","compile","complain","complement","complete","complicate","compliment","comply","comport","compose","compost","compound","comprehend","compress","comprise","compromise","compute","computerise","computerize","con","conceal","concede","conceive","concentrate","conceptualise","conceptualize","concern","concertina","conciliate","conclude","concoct","concrete","concur","concuss","condemn","condense","condescend","condition","condone","conduct","cone","confer","confess","confide","configure","confine","confirm","confiscate","conflate","conflict","conform","confound","confront","confuse","confute","congeal","congratulate","congregate","conjecture","conjoin","conjugate","conjure","conk","connect","connive","connote","conquer","conscientise","conscientize","conscript","consecrate","consent","conserve","consider","consign","consist","console","consolidate","consort","conspire","constitute","constrain","constrict","construct","construe","consult","consume","consummate","contact","contain","contaminate","contemplate","contend","content","contest","contextualise","contextualize","continue","contort","contract","contradict","contraindicate","contrast","contravene","contribute","contrive","control","controvert","convalesce","convene","converge","converse","convert","convey","convict","convince","convoke","convulse","coo","cook","cool","coop","cooperate","coordinate","cop","cope","coppice","copulate","copy","copyright","cordon","core","cork","corkscrew","corner","corral","correct","correlate","correspond","corrode","corrupt","coruscate","cosh","cosset","cost","cosy","cotton","couch","cough","counsel","count","countenance","counter","counteract","counterbalance","counterfeit","countermand","counterpoint","countersign","couple","courier","course","court","covenant","cover","covet","cow","cower","cox","cozy","crack","crackle","cradle","craft","cram","cramp","crane","crank","crap","crash","crate","crave","crawl","crayon","creak","creaking","cream","crease","create","credential","credit","creep","cremate","creolise","creolize","creosote","crest","crew","crib","crick","criminalise","criminalize","crimp","cringe","crinkle","cripple","crisp","criticise","criticize","critique","croak","crochet","crook","croon","crop","cross","crouch","crow","crowd","crown","crucify","cruise","crumble","crumple","crunch","crusade","crush","cry","crystallise","crystallize","cube","cuckold","cuddle","cudgel","cue","cuff","cull","culminate","cultivate","culture","cup","curate","curb","curdle","cure","curl","curry","curse","curtail","curtain","curtsy","curve","cushion","cuss","customise","customize","cut","cwtch","cycle","dab","dabble","dally","dam","damage","dammit","damn","damp","dampen","dance","dandle","dangle","dare","darken","darn","dart","dash","date","daub","daunt","dawdle","dawn","daydream","dazzle","deactivate","deaden","deadhead","deafen","deal","debar","debase","debate","debilitate","debit","debrief","debug","debunk","debut","decamp","decant","decapitate","decay","deceive","decelerate","decentralise","decentralize","decide","decimalise","decimalize","decimate","decipher","deck","declaim","declare","declassify","decline","declutter","decode","decommission","decompose","decompress","deconsecrate","deconstruct","decontaminate","decontrol","decorate","decouple","decoy","decrease","decree","decriminalise","decriminalize","decry","decrypt","dedicate","deduce","deduct","deejay","deem","deepen","deface","defame","default","defeat","defecate","defect","defend","defer","defile","define","deflate","deflect","deflower","defog","defoliate","deforest","deform","defrag","defragment","defraud","defray","defrock","defrost","defuse","defy","degenerate","deglaze","degrade","degrease","dehumanise","dehumanize","dehydrate","deify","deign","delay","delegate","delete","deliberate","delight","delimit","delineate","deliquesce","deliver","delouse","delude","deluge","delve","demand","demarcate","demean","demerge","demilitarise","demilitarize","demineralise","demineralize","demist","demo","demob","demobilise","demobilize","democratise","democratize","demolish","demonise","demonize","demonstrate","demoralise","demoralize","demote","demotivate","demur","demystify","denationalise","denationalize","denigrate","denitrify","denominate","denote","denounce","dent","denude","deny","depart","depend","depersonalise","depersonalize","depict","deplane","deplete","deplore","deploy","depopulate","deport","depose","deposit","deprave","deprecate","depreciate","depress","depressurise","depressurize","deprive","depute","deputise","deputize","deracinate","derail","dereference","deregulate","deride","derive","derogate","descale","descend","describe","descry","desecrate","desegregate","deselect","desensitise","desensitize","desert","deserve","design","designate","desire","desist","deskill","desolate","despair","despise","despoil","destabilise","destabilize","destock","destroy","detach","detail","detain","detect","deter","deteriorate","determine","detest","dethrone","detonate","detour","detoxify","detract","detrain","devalue","devastate","develop","deviate","devise","devoice","devolve","devote","devour","diagnose","dial","dice","dicker","dictate","diddle","die","diet","differ","differentiate","diffract","diffuse","dig","digest","digitalise","digitalize","digitise","digitize","dignify","digress","dilate","dilute","diluted","dim","diminish","dimple","dine","ding","dink","dip","diphthongise","diphthongize","direct","dirty","dis","disable","disabuse","disadvantage","disaffiliate","disafforest","disagree","disallow","disambiguate","disappear","disappoint","disapprove","disarm","disarrange","disassemble","disassociate","disavow","disband","disbar","disbelieve","disburse","discard","discern","discharge","discipline","disclaim","disclose","discolor","discolour","discomfit","discomfort","discompose","disconcert","disconnect","discontinue","discount","discourage","discourse","discover","discredit","discriminate","discuss","disdain","disembark","disembowel","disenfranchise","disengage","disentangle","disestablish","disfigure","disgorge","disgrace","disguise","disgust","dish","dishearten","dishonor","dishonour","disillusion","disincentivise","disincentivize","disinfect","disinherit","disinhibit","disintegrate","disinter","disinvest","dislike","dislocate","dislodge","dismantle","dismay","dismember","dismiss","dismount","disobey","disorient","disorientate","disown","disparage","dispatch","dispel","dispense","disperse","displace","display","displease","disport","dispose","dispossess","disprove","dispute","disqualify","disregard","disrespect","disrobe","disrupt","dissect","dissemble","disseminate","dissent","dissimulate","dissipate","dissociate","dissolve","dissuade","distance","distend","distil","distill","distinguish","distort","distract","distress","distribute","distrust","disturb","disunite","ditch","dither","dive","diverge","diversify","divert","divest","divide","divine","divorce","divulge","divvy","do","dob","dock","doctor","document","dodge","doff","dog","dole","doll","dollarise","dollarize","domesticate","dominate","don","donate","doodle","doom","doorstep","dop","dope","dose","doss","dot","dote","double","doubt","douche","douse","dovetail","down","downchange","downgrade","downlink","download","downplay","downshift","downsize","dowse","doze","draft","drag","dragoon","drain","dramatise","dramatize","drape","draught","draw","drawl","dread","dream","dredge","drench","dress","dribble","drift","drill","drink","drip","drive","drivel","drizzle","drone","drool","droop","drop","drown","drowse","drug","drum","dry","dub","duck","duckie","ducks","duel","duff","dull","dumb","dumbfound","dummy","dump","dunk","dunt","dupe","duplicate","dust","dwarf","dwell","dwindle","dye","dynamite","earmark","earn","earth","ease","eat","eavesdrop","ebb","echo","eclipse","economise","economize","eddy","edge","edify","edit","editorialise","editorialize","educate","eff","efface","effect","effectuate","egg","ejaculate","eject","eke","elaborate","elapse","elbow","elect","electrify","electrocute","electroplate","elevate","elicit","elide","eliminate","elongate","elope","elucidate","elude","email","emanate","emancipate","emasculate","embalm","embargo","embark","embarrass","embed","embellish","embezzle","embitter","emblazon","embody","embolden","emboss","embrace","embroider","embroil","emcee","emend","emerge","emigrate","emit","emote","empathise","empathize","emphasise","emphasize","employ","empower","empty","emulate","emulsify","enable","enact","encamp","encapsulate","encase","encash","enchant","encircle","enclose","encode","encompass","encounter","encourage","encroach","encrypt","encumber","end","endanger","endear","endeavor","endeavour","endorse","endow","endure","energise","energize","enervate","enfeeble","enfold","enforce","enfranchise","engage","engender","engineer","engorge","engrave","engross","engulf","enhance","enjoin","enjoy","enlarge","enlighten","enlist","enliven","enmesh","ennoble","enquire","enrage","enrapture","enrich","enrol","enroll","ensconce","enshrine","enshroud","enslave","ensnare","ensue","ensure","entail","entangle","enter","entertain","enthral","enthrall","enthrone","enthuse","entice","entitle","entomb","entrance","entrap","entreat","entrench","entrust","entwine","enumerate","enunciate","envelop","envisage","envision","envy","epitomise","epitomize","equal","equalise","equalize","equate","equip","equivocate","eradicate","erase","erect","erode","err","erupt","escalate","escape","eschew","escort","espouse","espy","essay","establish","esteem","estimate","etch","eulogise","eulogize","euthanise","euthanize","evacuate","evade","evaluate","evangelise","evangelize","evaporate","even","eventuate","evict","evidence","evince","eviscerate","evoke","evolve","exacerbate","exact","exaggerate","exalt","examine","exasperate","excavate","exceed","excel","except","excerpt","exchange","excise","excite","exclaim","exclude","excommunicate","excoriate","excrete","exculpate","excuse","execute","exemplify","exempt","exercise","exert","exeunt","exfoliate","exhale","exhaust","exhibit","exhilarate","exhort","exhume","exile","exist","exit","exonerate","exorcise","exorcize","expand","expatiate","expect","expectorate","expedite","expel","expend","experience","experiment","expiate","expire","explain","explicate","explode","exploit","explore","export","expose","expostulate","expound","express","expropriate","expunge","expurgate","extemporise","extemporize","extend","exterminate","externalise","externalize","extinguish","extirpate","extol","extort","extract","extradite","extrapolate","extricate","extrude","exude","exult","eye","eyeball","eyeglasses","fabricate","face","facilitate","factor","factorise","factorize","fade","faff","fail","faint","fake","fall","falsify","falter","familiarise","familiarize","fan","fancy","fantasise","fantasize","fare","farewell","farm","farrow","fart","fascinate","fashion","fast","fasten","father","fathom","fatten","fault","favor","favour","fawn","fax","faze","fear","feast","feather","feature","federate","feed","feel","feign","feint","fell","fellate","feminise","feminize","fence","fend","ferment","ferret","ferry","fertilise","fertilize","fess","fester","festoon","fetch","fete","fetishise","fetishize","fetter","feud","fib","fictionalise","fictionalize","fiddle","fidget","field","fight","figure","filch","file","filibuster","fill","fillet","film","filter","finagle","finalise","finalize","finance","find","fine","finesse","finger","fingerprint","finish","fire","firebomb","firm","fish","fishtail","fit","fix","fizz","fizzle","flag","flagellate","flail","flake","flame","flank","flap","flare","flash","flat","flatline","flatten","flatter","flaunt","flavour","flay","fleck","flee","fleece","flesh","flex","flick","flicker","flight","flinch","fling","flip","flirt","flit","float","flock","flog","flood","floodlight","floor","flop","floss","flounce","flounder","flour","flourish","flout","flow","flower","flub","fluctuate","fluff","flummox","flunk","flush","fluster","flutter","fly","foal","foam","fob","focalise","focalize","focus","fog","foil","foist","fold","follow","foment","fondle","fool","foot","forage","forbear","forbid","force","ford","forearm","forecast","foreclose","foregather","foreground","foresee","foreshadow","foreshorten","forestall","foretell","forewarn","forfeit","forfend","forgather","forge","forget","forgive","forgo","fork","form","formalise","formalize","format","formulate","fornicate","forsake","forswear","fortify","forward","forwards","fossick","fossilise","fossilize","foster","foul","found","founder","fox","fracture","fragment","frame","franchise","frank","fraternise","fraternize","fray","freak","free","freelance","freeload","freestyle","freewheel","freeze","freight","frequent","freshen","fret","frighten","fringe","frisk","fritter","frizz","frizzle","frogmarch","frolic","front","frost","froth","frown","fruit","frustrate","fry","fuck","fudge","fuel","fulfil","fulfill","fulminate","fumble","fume","fumigate","function","fund","funk","funnel","furl","furlough","furnish","furrow","further","fuse","fuss","gab","gabble","gad","gag","gain","gainsay","gall","gallivant","gallop","galumph","galvanise","galvanize","gamble","gambol","gang","gape","garage","garden","gargle","garland","garner","garnish","garrison","garrote","garrotte","gas","gash","gasp","gatecrash","gather","gauge","gawk","gawp","gaze","gazump","gazunder","gear","gee","gel","geld","gen","generalise","generalize","generate","gentrify","genuflect","germinate","gerrymander","gestate","gesticulate","gesture","get","ghost","ghostwrite","gibber","gift","giggle","gild","ginger","gird","girdle","give","gladden","glamorise","glamorize","glance","glare","glass","glaze","gleam","glean","glide","glimmer","glimmering","glimpse","glint","glisten","glister","glitter","gloat","globalise","globalize","glom","glorify","glory","gloss","glow","glower","glue","glug","glut","gnash","gnaw","go","goad","gob","gobble","goggle","goldbrick","goof","google","goose","gore","gorge","gossip","gouge","govern","grab","grace","grade","graduate","graft","grant","grapple","grasp","grass","grate","gratify","gravitate","graze","grease","green","greet","grey","grieve","grill","grimace","grin","grind","grip","gripe","grit","grizzle","groan","grok","groom","grope","gross","grouch","ground","group","grouse","grout","grovel","grow","growl","grub","grudge","grumble","grunt","guarantee","guard","guess","guest","guffaw","guide","guillotine","guilt","gulp","gum","gun","gurgle","gurn","gush","gussy","gust","gut","gutter","guzzle","gybe","gyp","gyrate","hack","haemorrhage","haggle","hail","hallmark","halloo","hallucinate","halt","halve","ham","hammer","hamper","hamstring","hand","handcuff","handicap","handle","hang","hanker","happen","harangue","harass","harbor","harbour","harden","hare","hark","harm","harmonise","harmonize","harness","harp","harpoon","harrow","harrumph","harry","harvest","hash","hassle","hasten","hatch","hate","haul","haunt","have","haw","hawk","hazard","haze","head","headbutt","headhunt","headline","heal","heap","hear","hearken","hearten","heat","heave","heckle","hector","hedge","heed","heel","heft","heighten","heist","help","hem","hemorrhage","herald","herd","hesitate","hew","hex","hibernate","hiccough","hiccup","hide","hie","highball","highlight","hightail","hijack","hike","hinder","hinge","hint","hire","hiss","hit","hitch","hitchhike","hive","hoard","hoax","hobble","hobnob","hock","hoe","hog","hoick","hoist","hold","hole","holiday","holler","hollow","holster","home","homeschool","homestead","hone","honeymoon","honk","honour","hoodwink","hoof","hook","hoon","hoot","hoover","hop","hope","horn","horrify","horse","horsewhip","hose","hosepipe","hospitalise","hospitalize","host","hot","hotfoot","hound","house","hover","howl","huddle","huff","hug","hull","hum","humanise","humanize","humble","humiliate","humour","hump","hunch","hunger","hunker","hunt","hurdle","hurl","hurry","hurt","hurtle","husband","hush","husk","hustle","hybridise","hybridize","hydrate","hydroplane","hype","hyperventilate","hyphenate","hypnotise","hypnotize","hypothesise","hypothesize","ice","iconify","idealise","idealize","ideate","identify","idle","idolise","idolize","ignite","ignore","illuminate","illumine","illustrate","imagine","imagineer","imbibe","imbue","imitate","immerse","immigrate","immobilise","immobilize","immolate","immortalise","immortalize","immunise","immunize","immure","impact","impair","impale","impanel","impart","impeach","impede","impel","imperil","impersonate","impinge","implant","implement","implicate","implode","implore","imply","import","importune","impose","impound","impoverish","impregnate","impress","imprint","imprison","improve","improvise","impugn","inactivate","inaugurate","incapacitate","incarcerate","incarnate","incense","incentivise","incentivize","inch","incinerate","incise","incite","incline","include","incommode","inconvenience","incorporate","increase","incriminate","incubate","inculcate","incur","indemnify","indent","index","indicate","indict","individualise","individualize","individuate","indoctrinate","induce","induct","indulge","industrialise","industrialize","infantilise","infantilize","infect","infer","infest","infill","infiltrate","inflame","inflate","inflect","inflict","influence","inform","infringe","infuriate","infuse","ingest","ingratiate","inhabit","inhale","inhere","inherit","inhibit","initial","initialise","initialize","initiate","inject","injure","ink","inlay","innovate","inoculate","input","inscribe","inseminate","insert","inset","insinuate","insist","inspect","inspire","install","instance","instigate","instil","instill","institute","institutionalise","institutionalize","instruct","insulate","insult","insure","integrate","intend","intensify","inter","interact","interbreed","intercede","intercept","interchange","interconnect","intercut","interest","interface","interfere","interject","interlace","interleave","interlink","interlock","intermarry","intermesh","intermingle","intermix","intern","internalise","internalize","internationalise","internationalize","interpenetrate","interpolate","interpose","interpret","interrelate","interrogate","interrupt","intersect","intersperse","intertwine","intervene","interview","interweave","interwork","intimate","intimidate","intone","intoxicate","intrigue","introduce","intrude","intubate","intuit","inundate","inure","invade","invalid","invalidate","inveigh","inveigle","invent","inventory","invert","invest","investigate","invigilate","invigorate","invite","invoice","invoke","involve","ionise","ionize","irk","iron","irradiate","irrigate","irritate","irrupt","isolate","issue","italicise","italicize","itch","itemise","itemize","iterate","jab","jabber","jack","jackknife","jail","jam","jangle","jar","jaw","jaywalk","jazz","jeer","jell","jeopardise","jeopardize","jerk","jest","jet","jettison","jib","jibe","jig","jiggle","jilt","jingle","jink","jinx","jive","jockey","jog","joggle","join","joint","joke","jol","jolly","jolt","josh","jostle","jot","journey","joust","judder","judge","juggle","juice","jumble","jump","junk","justify","jut","juxtapose","keel","keelhaul","keen","keep","ken","key","keyboard","kibitz","kick","kid","kidnap","kill","kindle","kink","kip","kiss","kit","kite","klap","kludge","knacker","knead","knee","kneecap","kneel","knife","knight","knit","knock","knot","know","knuckle","kowtow","kvetch","label","labour","lace","lacerate","lack","lacquer","lactate","ladder","ladle","lag","lam","lamb","lambast","lambaste","lament","lamp","lampoon","lance","land","lands","landscape","languish","lap","lapse","lard","large","lark","lash","lasso","last","latch","lather","laud","laugh","launch","launder","lavish","lay","layer","laze","leach","lead","leaf","leaflet","leak","lean","leap","leapfrog","learn","lease","leash","leave","leaven","lech","lecture","leer","leg","legalise","legalize","legislate","legitimise","legitimize","lend","lengthen","lessen","let","letter","letterbox","level","lever","leverage","levitate","levy","liaise","libel","liberalise","liberalize","liberate","license","lick","lie","lift","ligate","light","lighten","like","liken","limber","lime","limit","limp","line","linger","link","lionise","lionize","liquefy","liquidate","liquidise","liquidize","lisp","list","listen","litigate","litter","live","liven","load","loads","loaf","loan","loathe","lob","lobby","lobotomise","lobotomize","localise","localize","locate","lock","lodge","loft","log","loiter","loll","lollop","long","look","looks","loom","loop","loose","loosen","loot","lop","lope","lord","lose","lounge","lour","louse","love","low","lowball","lower","lubricate","luck","lug","lull","lumber","lump","lunch","lunge","lurch","lure","lurk","lust","luxuriate","lynch","macerate","machine","madden","magic","magnetise","magnetize","magnify","mail","maim","mainline","mainstream","maintain","major","make","malfunction","malign","malinger","maltreat","man","manacle","manage","mandate","mangle","manhandle","manicure","manifest","manipulate","manoeuvre","mantle","manufacture","manure","map","mar","march","marginalise","marginalize","marinate","mark","market","maroon","marry","marshal","martyr","marvel","masculinise","masculinize","mash","mask","masquerade","mass","massacre","massage","master","mastermind","masticate","masturbate","match","mate","materialise","materialize","matriculate","matter","mature","maul","maunder","max","maximise","maximize","mean","meander","measure","mechanise","mechanize","medal","meddle","mediate","medicate","meditate","meet","meld","mellow","melt","memorialise","memorialize","memorise","memorize","menace","mend","menstruate","mention","meow","mercerise","mercerize","merchandise","merge","merit","mesh","mesmerise","mesmerize","mess","message","metabolise","metabolize","metamorphose","mete","meter","methinks","mew","mewl","miaow","microblog","microchip","micromanage","microwave","micturate","migrate","militarise","militarize","militate","milk","mill","mime","mimic","mince","mind","mine","mingle","miniaturise","miniaturize","minimise","minimize","minister","minor","mint","minute","mirror","misapply","misappropriate","misbehave","miscalculate","miscarry","miscast","misconceive","misconstrue","miscount","misdiagnose","misdial","misdirect","misfile","misfire","misgovern","mishandle","mishear","mishit","misinform","misinterpret","misjudge","miskey","mislay","mislead","mismanage","mismatch","misname","misplace","misplay","mispronounce","misquote","misread","misreport","misrepresent","miss","mission","misspell","misspend","mist","mistake","mistime","mistreat","mistrust","misunderstand","misuse","mitigate","mitre","mix","moan","mob","mobilise","mobilize","mock","mod","model","moderate","modernise","modernize","modify","modulate","moisten","moisturise","moisturize","mold","molder","molest","mollify","mollycoddle","molt","monitor","monopolise","monopolize","moo","mooch","moon","moonlight","moonwalk","moor","moot","mop","mope","moralise","moralize","morph","mortar","mortgage","mortify","mosey","mosh","mothball","mother","motion","motivate","motor","mould","moulder","moult","mount","mourn","mouse","mouth","move","movies","mow","muck","muddle","muddy","muff","muffle","mug","mulch","mull","multicast","multiply","multitask","mumble","mumbling","mummify","munch","murder","murmur","murmuring","murmurings","muscle","muse","mushroom","muss","muster","mutate","mute","mutilate","mutiny","mutter","muzzle","mystify","nab","nag","nail","name","namecheck","nap","narrate","narrow","narrowcast","nasalise","nasalize","nationalise","nationalize","natter","naturalise","naturalize","nauseate","navigate","near","nearer","nearest","neaten","necessitate","neck","necklace","need","needle","negate","negative","neglect","negotiate","neigh","nerve","nest","nestle","net","nettle","network","neuter","neutralise","neutralize","nibble","nick","nickname","niggle","nip","nitrify","nix","nobble","nod","nominalize","nominate","norm","normalise","normalize","nose","nosedive","nosh","notarise","notarize","notch","note","notice","notify","nourish","nudge","nuke","nullify","numb","number","nurse","nurture","nut","nuzzle","obey","obfuscate","object","objectify","oblige","obliterate","obscure","observe","obsess","obstruct","obtain","obtrude","obviate","occasion","occlude","occupy","occur","off","offend","offer","officiate","offload","offset","offshore","ogle","oil","okay","omit","ooze","open","operate","opine","oppose","oppress","opt","optimise","optimize","option","orbit","orchestrate","ordain","order","organise","organize","orient","orientate","originate","ornament","orphan","oscillate","ossify","ostracise","ostracize","oust","out","outbid","outclass","outdistance","outdo","outface","outfit","outflank","outfox","outgrow","outgun","outlast","outlaw","outline","outlive","outmaneuver","outmanoeuvre","outnumber","outpace","outperform","outplay","outpoint","output","outrage","outrank","outrun","outsell","outshine","outsmart","outsource","outstay","outstrip","outvote","outweigh","outwit","overachieve","overact","overawe","overbalance","overbook","overburden","overcharge","overcome","overcompensate","overcook","overdevelop","overdo","overdose","overdraw","overdub","overeat","overemphasize","overestimate","overexpose","overextend","overfeed","overflow","overfly","overgeneralise","overgeneralize","overgraze","overhang","overhaul","overhear","overheat","overindulge","overlap","overlay","overlie","overload","overlook","overpay","overplay","overpower","overprint","overproduce","overrate","overreach","overreact","override","overrule","overrun","oversee","oversell","overshadow","overshoot","oversimplify","oversleep","overspend","overstate","overstay","overstep","overstock","overstretch","overtake","overtax","overthrow","overtrain","overturn","overuse","overvalue","overwhelm","overwinter","overwork","overwrite","ovulate","owe","own","oxidise","oxidize","oxygenate","pace","pacify","pack","package","packetise","packetize","pad","paddle","padlock","page","paginate","pailful","pain","paint","pair","pal","palatalise","palatalize","pale","pall","palliate","palm","palpate","palpitate","pamper","pan","pander","panel","panhandle","panic","pant","paper","parachute","parade","parallel","paralyse","paralyze","paraphrase","parboil","parcel","parch","pardon","pare","park","parlay","parley","parody","parole","parrot","parry","parse","part","partake","participate","particularise","particularize","partition","partner","party","pass","passivise","passivize","paste","pasteurise","pasteurize","pasture","pat","patch","patent","patrol","patronise","patronize","patter","pattern","pause","pave","paw","pawn","pay","peak","peal","peck","pedal","peddle","pedestrianise","pedestrianize","pee","peek","peel","peep","peer","peg","pelt","pen","penalise","penalize","pencil","penetrate","pension","people","pep","pepper","perambulate","perceive","perch","percolate","perfect","perforate","perform","perfume","perish","perjure","perk","perm","permeate","permit","perpetrate","perpetuate","perplex","persecute","persevere","persist","personalise","personalize","personify","perspire","persuade","pertain","perturb","peruse","pervade","pervert","pester","pet","peter","petition","petrify","phase","philosophise","philosophize","phone","photocopy","photograph","photoshop","photosynthesise","photosynthesize","phrase","pick","picket","pickle","picnic","picture","picturise","picturize","piddle","piece","pierce","pig","pigeonhole","piggyback","pike","pile","pilfer","pill","pillage","pillory","pillow","pilot","pimp","pin","pinch","pine","ping","pinion","pink","pinpoint","pioneer","pip","pipe","pique","pirate","pirouette","piss","pit","pitch","pity","pivot","pixelate","pixellate","placate","place","plagiarise","plagiarize","plague","plait","plan","plane","plant","plaster","plasticise","plasticize","plate","plateau","play","plead","please","pledge","plight","plod","plonk","plop","plot","plough","pluck","plug","plumb","plummet","plump","plunder","plunge","plunk","pluralise","pluralize","ply","poach","pocket","point","poise","poison","poke","polarise","polarize","pole","poleax","poleaxe","police","polish","politicise","politicize","poll","pollard","pollinate","pollute","polymerise","polymerize","ponce","ponder","pong","pontificate","pony","poo","pooh","pool","poop","pootle","pop","popularise","popularize","populate","pore","port","portend","portion","portray","pose","posit","position","possess","posset","post","postmark","postpone","postulate","posture","pot","potter","pounce","pound","pour","pout","powder","power","practice","practise","praise","praises","prance","prang","prate","prattle","pray","preach","precede","precipitate","precis","preclude","predate","predecease","predetermine","predicate","predict","predispose","predominate","preen","preface","prefer","prefigure","prefix","preheat","prejudge","prejudice","preload","premaster","premiere","preoccupy","prep","prepare","prepone","preregister","presage","prescind","prescribe","preselect","presell","present","preserve","preset","preside","press","pressure","pressurise","pressurize","presume","presuppose","pretend","pretest","prettify","prevail","prevaricate","prevent","preview","prey","price","prick","prickle","pride","prime","primp","print","prioritise","prioritize","prise","privatise","privatize","privilege","prize","probate","probe","proceed","process","proclaim","procrastinate","procreate","proctor","procure","prod","produce","profane","profess","professionalise","professionalize","proffer","profile","profit","program","programme","progress","prohibit","project","proliferate","prolong","promenade","promise","promote","prompt","promulgate","pronounce","proof","proofread","prop","propagandise","propagandize","propagate","propel","prophesy","propitiate","propose","proposition","propound","proscribe","prosecute","proselytise","proselytize","prospect","prosper","prostitute","prostrate","protect","protest","protrude","prove","provide","provision","provoke","prowl","prune","pry","psych","psychoanalyse","publicise","publicize","publish","pucker","puff","puke","pull","pullulate","pulp","pulsate","pulse","pulverise","pulverize","pummel","pump","pun","punch","punctuate","puncture","punish","punt","pupate","purchase","purge","purify","purl","purloin","purport","purr","purse","pursue","purvey","push","pussyfoot","put","putrefy","putt","putter","puzzle","quack","quadruple","quaff","quail","quake","qualify","quantify","quarantine","quarrel","quarry","quarter","quarterback","quash","quaver","queer","quell","quench","query","quest","question","queue","quibble","quicken","quiet","quieten","quintuple","quip","quirk","quit","quiver","quiz","quote","quoth","rabbit","race","rack","radiate","radicalise","radicalize","radio","raffle","rag","rage","raid","rail","railroad","rain","raise","rake","rally","ram","ramble","ramp","rampage","randomise","randomize","range","rank","rankle","ransack","ransom","rant","rap","rape","rappel","rasp","rasterise","rasterize","rat","ratchet","rate","ratify","ration","rationalise","rationalize","rattle","ravage","rave","ravel","ravish","raze","razz","reach","reacquaint","react","reactivate","read","readdress","readies","readjust","readmit","ready","reaffirm","realign","realise","realize","reallocate","ream","reanimate","reap","reappear","reapply","reappoint","reappraise","rear","rearm","rearrange","reason","reassemble","reassert","reassess","reassign","reassure","reawaken","rebel","reboot","reborn","rebound","rebrand","rebuff","rebuild","rebuke","rebut","recall","recant","recap","recapitulate","recapture","recast","recede","receive","recess","recharge","reciprocate","recite","reckon","reclaim","reclassify","recline","recognise","recognize","recoil","recollect","recommence","recommend","recompense","reconcile","recondition","reconfigure","reconfirm","reconnect","reconnoitre","reconquer","reconsider","reconstitute","reconstruct","reconvene","record","recount","recoup","recover","recreate","recrudesce","recruit","rectify","recuperate","recur","recycle","redact","redden","redecorate","redeem","redefine","redeploy","redesign","redevelop","redial","redirect","rediscover","redistribute","redistrict","redo","redouble","redound","redraft","redraw","redress","reduce","reduplicate","reef","reek","reel","ref","refer","referee","reference","refill","refinance","refine","refit","reflate","reflect","refloat","refocus","reform","reformat","reformulate","refract","refrain","refresh","refrigerate","refuel","refund","refurbish","refuse","refute","regain","regale","regard","regenerate","register","regress","regret","regroup","regularise","regularize","regulate","regurgitate","rehabilitate","rehash","rehear","rehearse","reheat","rehome","rehouse","reign","reignite","reimburse","rein","reincarnate","reinforce","reinstate","reinterpret","reintroduce","reinvent","reinvest","reinvigorate","reissue","reiterate","reject","rejig","rejigger","rejoice","rejoin","rejuvenate","rekindle","relapse","relate","relaunch","relax","relay","release","relegate","relent","relieve","relinquish","relish","relive","reload","relocate","rely","remain","remainder","remake","remand","remap","remark","remarry","remaster","remediate","remedy","remember","remind","reminisce","remit","remix","remodel","remonstrate","remortgage","remould","remount","remove","remunerate","rename","rend","render","rendezvous","renege","renew","renounce","renovate","rent","reoccur","reoffend","reopen","reorder","reorganise","reorganize","reorient","repackage","repair","repatriate","repay","repeal","repeat","repel","repent","rephrase","replace","replay","replenish","replicate","reply","report","repose","repossess","represent","repress","reprieve","reprimand","reprint","reproach","reprocess","reproduce","reprove","repudiate","repulse","repurpose","request","require","requisition","requite","rerun","reschedule","rescind","rescue","research","researches","resect","resell","resemble","resent","reserve","reset","resettle","reshape","reshuffle","reside","resign","resist","resit","resize","reskill","resolve","resonate","resort","resound","resource","respect","respire","respond","respray","rest","restart","restate","restock","restore","restrain","restrict","restring","restructure","result","resume","resupply","resurface","resurrect","resuscitate","retail","retain","retake","retaliate","retard","retch","retell","retest","rethink","retire","retool","retort","retouch","retrace","retract","retrain","retreat","retrench","retrieve","retrofit","retry","return","reunify","reunite","reuse","rev","revalue","revamp","reveal","revel","revenge","reverberate","revere","reverse","revert","review","revile","revise","revisit","revitalise","revitalize","revive","revivify","revoke","revolt","revolutionise","revolutionize","revolve","reward","rewind","rewire","reword","rework","rewrite","rhapsodise","rhapsodize","rhyme","rib","rick","ricochet","rid","riddle","ride","ridge","ridicule","riffle","rifle","rig","right","rightsize","rile","rim","ring","rinse","riot","rip","ripen","riposte","ripple","rise","risk","ritualise","ritualize","rival","rivet","roam","roar","roast","rob","robe","rock","rocket","roger","roll","romance","romanticise","romanticize","romp","roof","room","roost","root","rope","rosin","roster","rot","rotate","rouge","rough","roughen","roughhouse","round","rouse","roust","rout","route","rove","row","rub","rubberneck","rubbish","ruck","rue","ruffle","ruin","ruins","rule","rumble","ruminate","rummage","rumor","rumour","rumple","run","rupture","rush","rust","rustle","sabotage","sack","sacrifice","sadden","saddle","safeguard","sag","sail","salaam","salivate","sally","salt","salute","salvage","salve","sample","sanctify","sanction","sand","sandbag","sandblast","sandpaper","sandwich","sanitise","sanitize","sap","sashay","sass","sate","satiate","satirise","satirize","satisfy","saturate","saunter","savage","save","savor","savour","saw","say","scald","scale","scallop","scalp","scamper","scan","scandalise","scandalize","scapegoat","scar","scare","scarf","scarify","scarper","scatter","scattering","scavenge","scent","schedule","schematise","schematize","scheme","schlep","schlepp","schmooze","school","schtup","schuss","scoff","scold","scoop","scoot","scope","scorch","score","scorn","scotch","scour","scourge","scout","scowl","scrabble","scram","scramble","scrap","scrape","scratch","scrawl","scream","screech","screen","screw","scribble","scrimp","script","scroll","scrounge","scrub","scrummage","scrunch","scruple","scrutinise","scrutinize","scud","scuff","scuffle","scull","sculpt","scupper","scurry","scuttle","scythe","seal","sealift","sear","search","season","seat","secede","seclude","second","secrete","section","secularise","secularize","secure","sedate","seduce","see","seed","seek","seep","seethe","segment","segregate","segue","seize","select","sell","sellotape","semaphore","send","sensationalise","sensationalize","sense","sensitise","sensitize","sentence","sentimentalise","sentimentalize","separate","sequence","sequester","sequestrate","serenade","serialise","serialize","sermonise","sermonize","serve","service","set","settle","sever","sew","sex","sexualise","sexualize","shack","shackle","shade","shadow","shaft","shag","shake","shalt","sham","shamble","shame","shampoo","shanghai","shape","share","sharpen","shatter","shave","shear","sheathe","shed","sheer","shell","shellac","shelter","shelve","shepherd","shield","shift","shimmer","shimmy","shin","shine","shinny","ship","shipwreck","shirk","shit","shiver","shock","shoe","shoehorn","shoo","shoot","shop","shoplift","shore","short","shorten","shortlist","shoulder","shout","shove","shovel","show","showboat","showcase","shower","shred","shriek","shrill","shrink","shrivel","shroom","shroud","shrug","shtup","shuck","shudder","shuffle","shun","shunt","shush","shut","shuttle","shy","sic","sick","sicken","side","sideline","sidestep","sideswipe","sidetrack","sidle","sieve","sift","sigh","sight","sightsee","sign","signal","signify","signpost","silence","silhouette","silt","silver","simmer","simper","simplify","simulate","simulcast","sin","sing","singe","single","sink","sip","siphon","sire","sit","site","situate","size","sizzle","skate","skateboard","skedaddle","sketch","skew","skewer","ski","skid","skim","skimp","skin","skip","skipper","skirmish","skirt","skitter","skive","skivvy","skulk","sky","skyjack","skyrocket","slack","slacken","slag","slake","slam","slander","slant","slap","slash","slate","slather","slaughter","slave","slaver","slay","sledge","sleek","sleep","sleepwalk","sleet","slew","slice","slick","slide","slight","slim","sling","slink","slip","slit","slither","slob","slobber","slog","slop","slope","slosh","slot","slouch","slough","slow","slug","sluice","slum","slumber","slump","slur","slurp","smack","smart","smarten","smash","smear","smell","smelt","smile","smirk","smite","smoke","smooch","smoodge","smooth","smother","smoulder","smudge","smuggle","snack","snaffle","snag","snaggle","snake","snap","snare","snarf","snarl","snatch","sneak","sneer","sneeze","snicker","sniff","sniffle","snigger","snip","snipe","snitch","snivel","snog","snooker","snoop","snooper","snooze","snore","snorkel","snort","snow","snowball","snowplough","snowplow","snub","snuff","snuffle","snuffling","snuggle","soak","soap","soar","sob","sober","socialise","socialize","sock","sod","sodomise","sodomize","soften","soil","sojourn","solace","solder","soldier","sole","solemnise","solemnize","solicit","solidify","soliloquize","solve","somersault","soothe","sorrow","sort","sough","sound","soundproof","soup","sour","source","souse","sow","space","span","spangle","spank","spar","spare","spark","sparkle","spatter","spattering","spawn","spay","speak","spear","spearhead","spec","specialise","specialize","specify","spectacles","spectate","speculate","speed","spell","spellcheck","spend","spew","spice","spiff","spike","spill","spin","spiral","spirit","spit","spite","splash","splatter","splay","splice","splinter","split","splosh","splurge","splutter","spoil","sponge","sponsor","spoof","spook","spool","spoon","sport","sports","spot","spotlight","spout","sprain","sprawl","spray","spread","spreadeagle","spring","springboard","sprinkle","sprint","spritz","sprout","spruce","spur","spurn","spurt","sputter","spy","squabble","squall","squander","square","squash","squat","squawk","squeak","squeal","squeeze","squelch","squint","squirm","squirrel","squirt","squish","stab","stabilise","stabilize","stable","stables","stack","staff","stage","stagger","stagnate","stain","stake","stalk","stall","stammer","stamp","stampede","stanch","stand","standardise","standardize","staple","star","starch","stare","start","startle","starve","stash","state","statement","station","staunch","stave","stay","steady","steal","steam","steamroller","steel","steep","steepen","steer","stem","stencil","step","stereotype","sterilise","sterilize","stew","stick","stickybeak","stiff","stiffen","stifle","stigmatise","stigmatize","still","stimulate","sting","stinger","stink","stint","stipple","stipulate","stir","stitch","stock","stockpile","stoke","stomach","stomp","stone","stonewall","stoop","stop","stopper","store","storm","storyboard","stow","straddle","strafe","straggle","straighten","strain","strand","strangle","strap","stratify","stravage","stravaig","stray","streak","stream","streamline","strengthen","stress","stretch","stretcher","strew","stride","strike","string","strip","strive","stroke","stroll","structure","struggle","strum","strut","stub","stud","study","stuff","stultify","stumble","stump","stun","stunt","stupefy","stutter","style","stymie","sub","subcontract","subdivide","subdue","subedit","subject","subjugate","sublet","sublimate","submerge","submit","subordinate","suborn","subpoena","subscribe","subside","subsidise","subsidize","subsist","substantiate","substitute","subsume","subtend","subtitle","subtract","subvert","succeed","succor","succour","succumb","suck","sucker","suckle","suction","sue","suffer","suffice","suffocate","suffuse","sugar","suggest","suit","sulk","sulks","sully","sum","summarise","summarize","summon","summons","sun","sunbathe","sunder","sunset","sup","superimpose","superintend","superpose","supersede","supersize","supersized","supervene","supervise","supplant","supplement","supply","support","suppose","suppress","suppurate","surcharge","surf","surface","surge","surmise","surmount","surpass","surprise","surrender","surround","survey","survive","suspect","suspend","suspenders","suss","sustain","suture","swab","swaddle","swagger","swallow","swamp","swan","swank","swap","swarm","swat","swath","swathe","sway","swear","sweat","sweep","sweeps","sweeten","swell","swelter","swerve","swig","swill","swim","swindle","swing","swipe","swirl","swish","switch","swivel","swoon","swoop","swoosh","swot","symbolise","symbolize","sympathise","sympathize","symptomize","synchronise","synchronize","syndicate","synthesise","synthesize","syringe","systematise","systematize","tab","table","tabulate","tack","tackle","tag","tail","tailgate","tailor","taint","take","talk","tally","tame","tamp","tamper","tan","tangle","tango","tank","tankful","tantalise","tantalize","tap","tape","taper","tar","target","tarmac","tarnish","tarry","tart","task","taste","tattle","tattoo","taunt","tauten","tax","taxi","taxicab","teach","team","tear","tease","tee","teem","teeter","teethe","telecast","telecommute","teleconference","telegraph","telemeter","teleoperate","telephone","teleport","telescope","televise","telex","tell","telnet","temp","temper","temporise","temporize","tempt","tenant","tend","tender","tenderise","tenderize","tense","tension","tergiversate","term","terminate","terraform","terrify","terrorise","terrorize","test","testify","tether","text","thank","thatch","thaw","theorise","theorize","thicken","thin","think","thirst","thrash","thread","threaten","thresh","thrill","thrive","throb","throbbing","throng","throttle","throw","thrust","thud","thumb","thump","thunder","thwack","thwart","tick","ticket","tickle","tide","tidy","tie","tighten","tile","till","tilt","time","timetable","tinge","tingle","tingling","tinker","tinkle","tinkling","tint","tip","tippex","tipple","tiptoe","tire","titillate","titivate","title","titrate","titter","toady","toast","toboggan","toddle","toe","tog","toggle","toil","toke","tolerate","toll","tone","tongue","tonify","tool","toot","tootle","top","topple","torch","torment","torpedo","torture","toss","tot","total","tote","totter","touch","tough","toughen","tour","tousle","tout","tow","towel","tower","toy","trace","track","trade","traduce","traffic","trail","train","traipse","trammel","tramp","trample","trampoline","tranquilize","tranquillize","transact","transcend","transcribe","transfer","transfigure","transfix","transform","transfuse","transgress","transit","translate","transliterate","transmit","transmogrify","transmute","transpire","transplant","transport","transpose","trap","trash","traumatise","traumatize","travel","traverse","trawl","tread","treasure","treat","treble","trek","tremble","trembling","trepan","trespass","trial","trick","trickle","trifle","trigger","trill","trim","trip","triple","triumph","trivialise","trivialize","troll","tromp","troop","trot","trouble","troubleshoot","trounce","trouser","truant","truck","trudge","trump","trumpet","truncate","trundle","truss","trust","try","tuck","tug","tugboat","tumble","tune","tunnel","turbocharge","turf","turn","tussle","tut","tutor","twang","tweak","tweet","twiddle","twig","twin","twine","twinkle","twirl","twist","twitch","twitter","twittering","type","typecast","typeset","typify","tyrannise","tyrannize","ulcerate","ululate","ump","umpire","unbalance","unban","unbend","unblock","unbuckle","unburden","unbutton","uncoil","uncork","uncouple","uncover","uncurl","undelete","underachieve","underbid","undercharge","undercook","undercut","underestimate","underestimation","underexpose","undergo","underlie","underline","undermine","underpay","underperform","underpin","underplay","underrate","underscore","undersell","undershoot","underspend","understand","understate","understudy","undertake","undervalue","underwrite","undo","undock","undress","undulate","unearth","unfasten","unfold","unfreeze","unfurl","unhand","unhinge","unhitch","unhook","unify","uninstall","unionise","unionize","unite","unlace","unlearn","unleash","unload","unlock","unloose","unloosen","unmask","unnerve","unpack","unpick","unplug","unravel","unroll","unsaddle","unscramble","unscrew","unseat","unsettle","unsubscribe","untangle","untie","unveil","unwind","unwrap","unzip","up","upbraid","upchange","upchuck","update","upend","upgrade","uphold","upholster","uplift","upload","uproot","upsell","upset","upshift","upskill","upstage","urge","urinate","use","usher","usurp","utilise","utilize","utter","vacate","vacation","vaccinate","vacillate","vacuum","valet","validate","value","vamoose","vandalise","vandalize","vanish","vanquish","vaporise","vaporize","varnish","vary","vault","veer","veg","vegetate","veil","vend","veneer","venerate","vent","ventilate","venture","verbalise","verbalize","verge","verify","versify","vest","vet","veto","vex","vibrate","victimise","victimize","vide","video","videotape","vie","view","viewing","vilify","vindicate","violate","visit","visualise","visualize","vitiate","vitrify","vocalize","voice","void","volley","volumise","volumize","volunteer","vomit","vote","vouch","vouchsafe","vow","voyage","vulgarise","vulgarize","wad","waddle","wade","waffle","waft","wag","wage","wager","waggle","wail","wait","waive","wake","wakeboard","waken","walk","wall","wallop","wallow","wallpaper","waltz","wander","wane","wangle","wank","want","warble","ward","warm","warn","warp","warrant","wash","wassail","waste","watch","water","waterproof","waterski","wave","waver","wax","waylay","weaken","wean","weaponise","weaponize","wear","weary","weasel","weather","weatherise","weatherize","weave","wed","wedge","wee","weed","weekend","weep","weigh","weight","weird","welch","welcome","weld","well","welly","welsh","wend","westernise","westernize","wet","whack","wheedle","wheel","wheeze","whelp","whet","whiff","while","whilst","whimper","whine","whinge","whinny","whip","whirl","whirr","whirring","whisk","whisper","whispering","whistle","whiten","whitewash","whittle","whiz","whizz","whoop","whoosh","whup","wick","widen","widow","wield","wig","wiggle","wildcat","will","wilt","wimp","win","wince","winch","wind","winds","windsurf","wine","wing","wink","winkle","winnow","winter","wipe","wire","wiretap","wise","wisecrack","wish","withdraw","wither","withhold","withstand","witness","witter","wobble","wolf","wonder","woo","woof","word","work","worm","worry","worsen","worship","worst","wound","wow","wowee","wrangle","wrap","wreak","wreathe","wreck","wrench","wrest","wrestle","wriggle","wring","wrinkle","writ","write","writhe","wrong","wrought","xerox","yack","yak","yank","yap","yaw","yawn","yearn","yell","yellow","yelp","yield","yodel","yoke","yomp","yowl","yuppify","zap","zero","zigzag","zing","zip","zone","zoom"];var qc=Object.freeze({adjective:_n,adverb:xn,conjunction:An,interjection:En,noun:Nn,preposition:In,verb:jn}),$n=qc;var Jc=Object.freeze({title:"English",syntax:mn,time:un,internet:yn,person:Sn,word:$n}),ae=Jc;var rt=["male","female"],ge=Symbol("randomValue"),Pi=Symbol("typesValue"),Ue=Symbol("localeValue"),Fr=class{[Pi];[ge];[Ue];constructor(e={}){this[Pi]=new De(e.seed),this[ge]=new Tt(e.seed),this[Ue]=e.locale||ae}seed(e){this[ge].seed(e),this[Pi].seed(e)}locale(e){this[Ue]=e||ae}firstName(e){let{person:t}=this[Ue],i=e&&rt.includes(e)?e:this[ge].pickOne(rt),r;t&&t.firstName&&t.firstName[i]?r=t.firstName:r=ae.person.firstName;let s=r[i];return this[ge].pickOne(s)}lastName(e){let{person:t}=this[Ue];if(!e){let a=t&&t.lastName||ae.person.lastName;if(Array.isArray(a.general)&&a.general.length)return this[ge].pickOne(a.general);throw new Error("The locale does not have a general last name pool.")}let i=e&&rt.includes(e)?e:this[ge].pickOne(rt),r;t&&t.lastName&&t.lastName[i]?r=t.lastName:r=ae.person.lastName;let s=r[i];return this[ge].pickOne(s)}middleName(e){let{person:t}=this[Ue],i=t&&t.middleName||t&&t.firstName||ae.person.firstName,r=e&&rt.includes(e)?e:this[ge].pickOne(rt),s=i[r];return this[ge].pickOne(s)}name(e={}){let{firstName:t,lastName:i,gender:r}=e,s=[];return this[Pi].boolean({likelihood:10})&&s.push(this.prefix(r)),s.push(t||this.firstName(r)),s.push(i||this.lastName(r)),this[Pi].boolean({likelihood:10})&&s.push(this.suffix(r)),s.join(" ")}gender(e){let{person:t}=this[Ue],i=t&&t.gender||ae.person.gender;return e?this[ge].pickOne(i.binary||ae.person.gender.binary):this[ge].pickOne(i.pool||ae.person.gender.pool)}prefix(e){let{person:t}=this[Ue],i=t&&t.prefix||ae.person.prefix;if(!e&&Array.isArray(i.general)&&i.general.length)return this[ge].pickOne(i.general);let r=e&&rt.includes(e)?e:this[ge].pickOne(rt),s=i[r]||ae.person.prefix[r];return this[ge].pickOne(s)}suffix(e){let{person:t}=this[Ue],i=t&&t.suffix||ae.person.suffix;if(Array.isArray(i.general)&&i.general.length)return this[ge].pickOne(i.general);let r=e&&rt.includes(e)?e:this[ge].pickOne(rt),s=i[r]||ae.person.suffix[r];return this[ge].pickOne(s)}jobTitle(){let e=this.jobDescriptor(),t=this.jobArea(),i=this.jobType();return`${e} ${t} ${i}`}jobDescriptor(){let{person:e}=this[Ue],t;return e&&e.title&&e.title.descriptor?t=e.title:t=ae.person.title,this[ge].pickOne(t.descriptor)}jobArea(){let{person:e}=this[Ue],t;return e&&e.title&&e.title.level?t=e.title:t=ae.person.title,this[ge].pickOne(t.level)}jobType(){let{person:e}=this[Ue],t;return e&&e.title&&e.title.job?t=e.title:t=ae.person.title,this[ge].pickOne(t.job||[])}};var Kr=Symbol("randomValue"),Le=Symbol("typesValue"),qr=Symbol("localeValue"),Jr=class{[Le];[Kr];[qr];constructor(e={}){this[Le]=new De(e.seed),this[Kr]=new Tt(e.seed),this[qr]=e.locale||ae}seed(e){this[Kr].seed(e),this[Le].seed(e)}locale(e){this[qr]=e||ae}word(e={}){let t={...e};if(typeof t.syllables=="number"&&typeof t.length=="number")throw new RangeError('Cannot specify both "syllables" and "length".');let i="";if(typeof t.length=="number"){do i+=this.syllable();while(i.length<t.length);i=i.substring(0,t.length)}else{let r=t.syllables||this[Le].number({min:1,max:3});for(let s=0;s<r;s++)i+=this.syllable()}return t.capitalize&&(i=this.capitalize(i)),i}capitalize(e){return e.charAt(0).toUpperCase()+e.substr(1)}words(e=3){return new Array(e).fill("").map(()=>this.word()).join(" ")}sentence(e={}){let t={...e},{words:i=this[Le].number({min:12,max:18})}=t,r=new Array(i).fill("").map(()=>this.word()).join(" ");r=this.capitalize(r);let{punctuation:s}=t;return s!==!1&&!/^[.?;!:]$/.test(String(s))&&(s="."),s&&(r+=s),r}sentences(e={}){let t={};typeof e=="number"?t.size=e:t={...e};let{size:i=this[Le].number({min:2,max:6})}=t;return new Array(i).fill("").map(()=>this.sentence()).join(" ")}slug(e){let t=this.words(e);return an(t)}paragraph(e={}){let t={};typeof e=="number"?t.sentences=e:t={...e};let{lineBreak:i,sentences:r=this[Le].number({min:3,max:7})}=t;return new Array(r).fill("").map(()=>this.sentence()).join(i===!0?`\r
|
|
33
|
+
`)}function Rs(o,e){if(typeof o=="number")return o;let t=Number(o);return Number.isNaN(t)?e:t}function Ts(o,e){let t=typeof o;if(t==="boolean")return o;if(t==="string"){let i=o.trim();if(i==="true")return!0;if(i==="false")return!1}return e}function Sr(o,e){switch(e){case d.aml.vocabularies.shapes.number:case d.aml.vocabularies.shapes.integer:case d.aml.vocabularies.shapes.float:case d.aml.vocabularies.shapes.long:case d.aml.vocabularies.shapes.double:case d.w3.xmlSchema.number:case d.w3.xmlSchema.integer:case d.w3.xmlSchema.float:case d.w3.xmlSchema.long:case d.w3.xmlSchema.double:return Rs(o,0);case d.aml.vocabularies.shapes.boolean:case d.w3.xmlSchema.boolean:return Ts(o,!1);case d.w3.xmlSchema.string:case d.aml.vocabularies.shapes.password:return o??"";case d.aml.vocabularies.shapes.nil:case d.w3.xmlSchema.nil:return null;default:return o}}function Ds(o,e=[]){let t;return Array.isArray(e)&&e.length&&(t=o.find(i=>e.includes(i.id))),t||([t]=o),t}function Ar(o,e){let t=[],{properties:i,inherits:r}=o;i.length&&(t=[...i]),Array.isArray(r)&&r.length&&r.forEach(a=>{let n=a;if(n.types.includes(d.aml.vocabularies.shapes.UnionShape)){let p=n,{anyOf:u=[]}=p;n=Ds(u,e)}if(!n.types.includes(d.w3.shacl.NodeShape))return;let c=Ar(n);c.length&&(t=t.concat(c))});let s=[];return t.forEach(a=>{s.find(l=>l.name===a.name)||s.push(a)}),s}var jt=class{processNode(e){let{types:t}=e;if(t.includes(d.aml.vocabularies.data.Scalar))return this.processScalarNode(e);if(t.includes(d.aml.vocabularies.data.Array))return this.processArrayNode(e);if(t.includes(d.aml.vocabularies.data.Object))return this.processObjectNode(e)}processScalarNode(e){return Sr(e.value,e.dataType)}processArrayNode(e){let t=[];return e.members.forEach(i=>{let r=this.processNode(i);r!==void 0&&t.push(r)}),t}processObjectNode(e){let t={},{properties:i}=e;return Object.keys(i).forEach(r=>{let s=i[r],a=this.processNode(s);if(typeof a<"u"){let n=this.normalizePropertyName(r);t[n]=a}}),t}normalizePropertyName(e){let t=e;try{t=decodeURIComponent(t)}catch{}return t}};var Ce=class extends jt{generate(e){let t=this.processNode(e);return!t||typeof t=="string"?t:JSON.stringify(t,null,2)}};var xe=class extends jt{generate(e,t,i={}){let r=this.processNode(e);if(!r)return r;let{indent:s=0}=i,a=new Array(s).fill(" ").join("");return t?Array.isArray(r)?r.map(n=>`${a}<${t}>${si(n)}</${t}>`).filter(n=>!!n).join(`
|
|
34
|
+
`):`${si({[t]:r})}`:`${si(r,s)}`}};var Ie={};va(Ie,{anyShape:()=>It,arrayShape:()=>oc,fileShape:()=>nc,nodeShape:()=>rc,propertyShape:()=>cc,recursiveShape:()=>dc,scalarShape:()=>sc,shape:()=>Xs,tupleShape:()=>lc,unionShape:()=>ac,xmlSerializer:()=>Ka});var ji={};va(ji,{IAmfAPIContractProcessingDataTypes:()=>Ll,IAmfAnyTypes:()=>Fs,IAmfApiKeySettingsTypes:()=>$l,IAmfArrayNodeTypes:()=>Hs,IAmfArrayTypes:()=>Us,IAmfAsyncApiTypes:()=>ic,IAmfBaseUnitProcessingDataTypes:()=>tc,IAmfCallbackTypes:()=>Pl,IAmfCreativeWorkTypes:()=>Ml,IAmfDataTypeFragmentTypes:()=>Wl,IAmfDocumentTypes:()=>Ul,IAmfDomainExtensionTypes:()=>Dl,IAmfDomainPropertyTypes:()=>Ql,IAmfEncodingTypes:()=>Vl,IAmfEndpointType:()=>gl,IAmfExampleTypes:()=>dl,IAmfExternalDomainElementTypes:()=>ec,IAmfExternalFragmentTypes:()=>Xl,IAmfFileTypes:()=>Ks,IAmfHttpSettingsTypes:()=>Nl,IAmfIriTemplateMappingTypes:()=>Cl,IAmfLicenseTypes:()=>fl,IAmfMessageTypes:()=>Tl,IAmfModuleTypes:()=>Hl,IAmfNilTypes:()=>ll,IAmfNodeTypes:()=>Ms,IAmfOAuth1SettingsTypes:()=>xl,IAmfOAuth2FlowTypes:()=>El,IAmfOAuth2SettingsTypes:()=>Al,IAmfObjectNodeTypes:()=>Ws,IAmfOpenIdConnectSettingsTypes:()=>jl,IAmfParameterTypes:()=>hl,IAmfParametrizedResourceTypeTypes:()=>Fl,IAmfParametrizedSecuritySchemeTypes:()=>_l,IAmfParametrizedTraitTypes:()=>Jl,IAmfPayloadTypes:()=>wl,IAmfPropertyTypes:()=>Vs,IAmfProviderTypes:()=>ml,IAmfRdfsSeqType:()=>Kl,IAmfRecursiveTypes:()=>qs,IAmfRequestTypes:()=>bl,IAmfResourceTypeTypes:()=>ql,IAmfResponseTypes:()=>kl,IAmfScalarNodeTypes:()=>Gs,IAmfScalarTypes:()=>zs,IAmfSchemaTypes:()=>cl,IAmfScopeTypes:()=>Il,IAmfSecurityRequirementTypes:()=>vl,IAmfSecuritySchemeFragmentTypes:()=>Zl,IAmfSecuritySchemeTypes:()=>Sl,IAmfServerType:()=>ul,IAmfSourceMapTypes:()=>zl,IAmfSupportedOperationTypes:()=>yl,IAmfTagTypes:()=>Rl,IAmfTemplatedLinkTypes:()=>Ol,IAmfTraitFragmentTypes:()=>Yl,IAmfTraitTypes:()=>Bl,IAmfTupleTypes:()=>Js,IAmfUnionTypes:()=>Ls,IAmfVariableValueTypes:()=>Gl,IAmfWebApiType:()=>pl,IAmfXmlSerializationTypes:()=>Bs});var zs=[d.aml.vocabularies.shapes.ScalarShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Us=[d.aml.vocabularies.shapes.ArrayShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Ms=[d.w3.shacl.NodeShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Vs=[d.w3.shacl.PropertyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],ll=[d.aml.vocabularies.shapes.NilShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Ls=[d.aml.vocabularies.shapes.UnionShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Ks=[d.aml.vocabularies.shapes.FileShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Fs=[d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],cl=[d.aml.vocabularies.shapes.SchemaShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Js=[d.aml.vocabularies.shapes.TupleShape,d.aml.vocabularies.shapes.ArrayShape,d.aml.vocabularies.shapes.AnyShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],qs=[d.aml.vocabularies.shapes.RecursiveShape,d.w3.shacl.Shape,d.aml.vocabularies.shapes.Shape,d.aml.vocabularies.document.DomainElement],Bs=[d.aml.vocabularies.shapes.XMLSerializer,d.aml.vocabularies.document.DomainElement],Gs=[d.aml.vocabularies.data.Scalar,d.aml.vocabularies.data.Node,d.aml.vocabularies.document.DomainElement],Hs=[d.aml.vocabularies.data.Array,d.w3.rdfSyntax.Seq,d.aml.vocabularies.data.Node,d.aml.vocabularies.document.DomainElement],Ws=[d.aml.vocabularies.data.Object,d.aml.vocabularies.data.Node,d.aml.vocabularies.document.DomainElement],dl=[d.aml.vocabularies.apiContract.Example,d.aml.vocabularies.document.DomainElement],pl=[d.aml.vocabularies.apiContract.WebAPI,d.aml.vocabularies.apiContract.API,d.aml.vocabularies.document.RootDomainElement,d.aml.vocabularies.document.DomainElement],ul=[d.aml.vocabularies.apiContract.Server,d.aml.vocabularies.document.DomainElement],hl=[d.aml.vocabularies.apiContract.Parameter,d.aml.vocabularies.core.Parameter,d.aml.vocabularies.document.DomainElement],ml=[d.aml.vocabularies.core.Organization,d.aml.vocabularies.document.DomainElement],fl=[d.aml.vocabularies.core.License,d.aml.vocabularies.document.DomainElement],gl=[d.aml.vocabularies.apiContract.EndPoint,d.aml.vocabularies.document.DomainElement],yl=[d.aml.vocabularies.apiContract.Operation,d.aml.vocabularies.core.Operation,d.aml.vocabularies.document.DomainElement],bl=[d.aml.vocabularies.apiContract.Request,d.aml.vocabularies.core.Request,d.aml.vocabularies.apiContract.Message,d.aml.vocabularies.document.DomainElement],kl=[d.aml.vocabularies.apiContract.Response,d.aml.vocabularies.core.Response,d.aml.vocabularies.apiContract.Message,d.aml.vocabularies.document.DomainElement],wl=[d.aml.vocabularies.apiContract.Payload,d.aml.vocabularies.core.Payload,d.aml.vocabularies.document.DomainElement],vl=[d.aml.vocabularies.security.SecurityRequirement,d.aml.vocabularies.document.DomainElement],_l=[d.aml.vocabularies.security.ParametrizedSecurityScheme,d.aml.vocabularies.document.DomainElement],Sl=[d.aml.vocabularies.security.SecurityScheme,d.aml.vocabularies.document.DomainElement],Al=[d.aml.vocabularies.security.OAuth2Settings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],El=[d.aml.vocabularies.security.OAuth2Flow,d.aml.vocabularies.document.DomainElement],xl=[d.aml.vocabularies.security.OAuth1Settings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],Nl=[d.aml.vocabularies.security.HttpSettings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],$l=[d.aml.vocabularies.security.ApiKeySettings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],jl=[d.aml.vocabularies.security.OpenIdConnectSettings,d.aml.vocabularies.security.Settings,d.aml.vocabularies.document.DomainElement],Il=[d.aml.vocabularies.security.Scope,d.aml.vocabularies.document.DomainElement],Pl=[d.aml.vocabularies.apiContract.Callback,d.aml.vocabularies.document.DomainElement],Ol=[d.aml.vocabularies.apiContract.TemplatedLink,d.aml.vocabularies.document.DomainElement],Cl=[d.aml.vocabularies.apiContract.IriTemplateMapping,d.aml.vocabularies.document.DomainElement],Rl=[d.aml.vocabularies.apiContract.Tag,d.aml.vocabularies.document.DomainElement],Tl=[d.aml.vocabularies.apiContract.Message,d.aml.vocabularies.document.DomainElement],Dl=[d.aml.vocabularies.apiContract.DomainExtension,d.aml.vocabularies.document.DomainElement],zl=[d.aml.vocabularies.docSourceMaps.SourceMap],Ul=[d.aml.vocabularies.document.Document,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Module,d.aml.vocabularies.document.Unit],Ml=[d.aml.vocabularies.core.CreativeWork,d.aml.vocabularies.document.DomainElement],Vl=[d.aml.vocabularies.apiContract.Encoding,d.aml.vocabularies.document.DomainElement],Ll=[d.aml.vocabularies.document.APIContractProcessingData],Kl=[d.w3.rdfSchema.Seq],Fl=[d.aml.vocabularies.apiContract.ParametrizedResourceType,d.aml.vocabularies.document.ParametrizedDeclaration,d.aml.vocabularies.document.DomainElement],Jl=[d.aml.vocabularies.apiContract.ParametrizedTrait,d.aml.vocabularies.document.ParametrizedDeclaration,d.aml.vocabularies.document.DomainElement],ql=[d.aml.vocabularies.apiContract.ResourceType,d.aml.vocabularies.document.AbstractDeclaration,d.aml.vocabularies.document.DomainElement],Bl=[d.aml.vocabularies.apiContract.Trait,d.aml.vocabularies.document.AbstractDeclaration,d.aml.vocabularies.document.DomainElement],Gl=[d.aml.vocabularies.document.VariableValue,d.aml.vocabularies.document.DomainElement],Hl=[d.aml.vocabularies.document.Module,d.aml.vocabularies.document.Unit],Wl=[d.aml.vocabularies.shapes.DataTypeFragment,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Unit],Xl=[d.aml.vocabularies.document.ExternalFragment,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Unit],Yl=[d.aml.vocabularies.apiContract.TraitFragment,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Unit],Zl=[d.aml.vocabularies.security.SecuritySchemeFragment,d.aml.vocabularies.document.Fragment,d.aml.vocabularies.document.Unit],Ql=[d.aml.vocabularies.document.DomainProperty,d.w3.rdfSyntax.Property,d.aml.vocabularies.document.DomainElement],ec=[d.aml.vocabularies.document.ExternalDomainElement,d.aml.vocabularies.document.DomainElement],tc=[d.aml.vocabularies.document.BaseUnitProcessingData],ic=[d.aml.vocabularies.apiContract.AsyncAPI,d.aml.vocabularies.apiContract.API,d.aml.vocabularies.document.RootDomainElement,d.aml.vocabularies.document.DomainElement];function Ka(o){return{id:`xml-serializer-${o}`,types:Bs,customDomainProperties:[]}}function Xs(o){return{id:o,types:[],values:[],inherits:[],or:[],and:[],xone:[],customDomainProperties:[]}}function It(o){return{...Xs(o),types:Fs,examples:[],xmlSerialization:Ka(o)}}function rc(o){let e=It(o);return e.types=Ms,e.id=`node-shape-${o}`,{...e,properties:[],dependencies:[],customShapeProperties:[],customShapePropertyDefinitions:[]}}function sc(o){let e=It(o);return e.id=`scalar-shape-${o}`,e.types=zs,e}function ac(o){let e=It(o);return e.id=`union-shape-${o}`,e.types=Ls,{...e,anyOf:[]}}function nc(o){let e=It(o);return e.id=`file-shape-${o}`,e.types=Ks,e}function oc(o){let e=It(o);return e.id=`array-shape-${o}`,e.types=Us,e}function lc(o){let e=It(o);return e.id=`tuple-shape-${o}`,e.types=Js,{...e,items:[]}}function cc(o){let e=It(o);return e.types=Vs,e}function dc(o,e){return{...Xs(o),id:`recursive-${o}`,types:qs,fixPoint:e||""}}import{customAlphabet as pc}from"nanoid";var Fa=pc("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_",21);var it=class o{id=Fa();types;name;properties;value;dataType;members;customDomainProperties=[];static scalar(e,t){let i=new o("scalar");return i.value=e,i.dataType=t,i}constructor(e){if(typeof e=="string"){if(e==="scalar")this.types=Gs;else if(e==="array")this.types=Hs;else if(e==="object")this.types=Ws;else throw new Error(`Invalid data node init option: ${e}`);return}if(!e)throw new Error("Expected an initialization option.");let t=e,{id:i,types:r,customDomainProperties:s}=t;if(this.id=i,this.types=r,this.customDomainProperties=s,r.includes(d.aml.vocabularies.data.Scalar)){let a=t;this.value=a.value,this.dataType=a.dataType}else if(r.includes(d.aml.vocabularies.data.Object)){let a=t,n={};this.properties=n,Object.keys(a.properties).forEach(l=>{let c=new o(a.properties[l]);n[l]=c})}else if(r.includes(d.aml.vocabularies.data.Array)){let a=t,n=[];this.members=n,Array.isArray(a.members)&&a.members.forEach(l=>{let c=new o(l);n.push(c)})}}toJSON(){let{id:e,customDomainProperties:t,types:i,name:r}=this,s={id:e,types:i,customDomainProperties:t};if(r&&(s.name=r),i.includes(d.aml.vocabularies.data.Scalar)){let a=s;a.dataType=this.dataType,a.value=this.value}else if(i.includes(d.aml.vocabularies.data.Object)){let a=s;a.properties={};let n=this.properties;n&&Object.keys(n).forEach(l=>{a.properties[l]=n[l].toJSON()})}else if(i.includes(d.aml.vocabularies.data.Array)){let a=s;a.members=[],this.members&&this.members.forEach(n=>{a.members.push(n.toJSON())})}return s}addMember(e){if(!this.types.includes(d.aml.vocabularies.data.Array))throw new Error("Not an ArrayNode.");this.members||(this.members=[]),this.members.push(e)}removeMember(e){if(!this.types.includes(d.aml.vocabularies.data.Array))throw new Error("Not an ArrayNode.");if(!this.members)return;let t=this.members.findIndex(i=>i.id===e);t>=0&&this.members.splice(t,1)}addProperty(e,t){if(!this.types.includes(d.aml.vocabularies.data.Object))throw new Error("Not an ObjectNode.");this.properties||(this.properties={}),this.properties[e]=t}removeProperty(e){if(!this.types.includes(d.aml.vocabularies.data.Object))throw new Error("Not an ObjectNode.");this.properties&&delete this.properties[e]}};var _e=Symbol("nValue"),Ii=Symbol("mValue"),Ja=Symbol("matrixAValue"),Er=Symbol("upperMaskValue"),xr=Symbol("lowerMaskValue"),W=Symbol("mtValue"),Re=Symbol("mtiValue"),Nr=Symbol("instancesValue"),Pt=class o{static[Nr]=new Map;[_e]=624;[Ii]=397;[Ja]=2567483615;[Er]=2147483648;[xr]=2147483647;[W]=new Array(this[_e]);[Re]=this[_e]+1;constructor(e=o.seedFn()){this.initGenRand(e)}static seedFn(){return Math.floor(Math.random()*10**13)}static fromSeed(e=o.seedFn()){if(this[Nr].has(e))return this[Nr].get(e);let t=new o(e);return this[Nr].set(e,t),t}initGenRand(e){let t=e;for(this[W][0]=t>>>0,this[Re]=1;this[Re]<this[_e];this[Re]++)t=this[W][this[Re]-1]^this[W][this[Re]-1]>>>30,this[W][this[Re]]=(((t&4294901760)>>>16)*1812433253<<16)+(t&65535)*1812433253+this[Re],this[W][this[Re]]>>>=0}initByArray(e,t){let i=1,r=0,s;this.initGenRand(19650218);let a=this[_e]>t?this[_e]:t;for(;a;a--)s=this[W][i-1]^this[W][i-1]>>>30,this[W][i]=(this[W][i]^(((s&4294901760)>>>16)*1664525<<16)+(s&65535)*1664525)+e[r]+r,this[W][i]>>>=0,i++,r++,i>=this[_e]&&(this[W][0]=this[W][this[_e]-1],i=1),r>=t&&(r=0);for(a=this[_e]-1;a;a--)s=this[W][i-1]^this[W][i-1]>>>30,this[W][i]=(this[W][i]^(((s&4294901760)>>>16)*1566083941<<16)+(s&65535)*1566083941)-i,this[W][i]>>>=0,i++,i>=this[_e]&&(this[W][0]=this[W][this[_e]-1],i=1);this[W][0]=2147483648}int32(){let e,t=[0,this[Ja]];if(this[Re]>=this[_e]){let i;for(this[Re]===this[_e]+1&&this.initGenRand(5489),i=0;i<this[_e]-this[Ii];i++)e=this[W][i]&this[Er]|this[W][i+1]&this[xr],this[W][i]=this[W][i+this[Ii]]^e>>>1^t[e&1];for(;i<this[_e]-1;i++)e=this[W][i]&this[Er]|this[W][i+1]&this[xr],this[W][i]=this[W][i+(this[Ii]-this[_e])]^e>>>1^t[e&1];e=this[W][this[_e]-1]&this[Er]|this[W][0]&this[xr],this[W][this[_e]-1]=this[W][this[Ii]-1]^e>>>1^t[e&1],this[Re]=0}return e=this[W][this[Re]++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0}int31(){return this.int32()>>>1}real1(){return this.int32()*(1/4294967295)}random(e=32768,t=0){return Math.floor(this.real2()*(e-t)+t)}real2(){return this.int32()*(1/4294967296)}real3(){return(this.int32()+.5)*(1/4294967296)}res53(){let e=this.int32()>>>5,t=this.int32()>>>6;return(e*67108864+t)*(1/9007199254740992)}};var $r="0123456789",Pi="abcdefghijklmnopqrstuvwxyz",jr=Pi.toUpperCase(),Ys=`${$r}abcdef`;function qa(o=""){return o.replace(/ /g,"-").replace(/[^一-龠ぁ-ゔァ-ヴー\w.-]+/g,"")}function rt(o,e={}){let t={};typeof e=="number"?t.max=e:typeof e=="object"&&(t={...e}),typeof t.min!="number"&&(t.min=0),typeof t.max!="number"&&(t.max=99999),typeof t.precision!="number"&&(t.precision=1),t.max>0&&(t.max+=t.precision);let i=Math.floor(o.random(t.max/t.precision,t.min/t.precision));return t.precision===1||(i/=1/t.precision),i}function Ir(o,e={}){let t={};return typeof e=="number"?t.precision=e:typeof e=="object"&&(t={...e}),typeof t.precision!="number"&&(t.precision=.01),rt(o,t)}function Ba(o,e=10,t){let i=typeof t=="string"?t:jr+Pi,r={min:0,max:i.length-1};return new Array(e).fill("").map(()=>i[rt(o,r)]).join("")}function Ga(o,e={}){let t={...e},i;switch(t.casing){case"lower":i=Pi;break;case"upper":i=jr;break;default:i=Pi+jr}if(!t.pool){t.pool="";let r="!@#$%^&*()[]";t.alpha&&(t.pool+=i),t.numeric&&(t.pool+=$r),t.symbols&&(t.pool+=r),t.pool||(t.pool=`${i}${$r}${r}`)}return t.pool.charAt(rt(o,t.pool.length-1))}function Ha(o,e={}){let t={};typeof e=="number"?t.max=e:typeof e=="object"&&(t={...e});let i=864e13;(typeof t.min!="number"||t.min<i*-1)&&(t.min=new Date().setFullYear(1970,1,1)),(typeof t.max!="number"||t.max>i)&&(t.max=new Date().setFullYear(2100,1,1));let r=rt(o,t);return new Date(r)}var ai=Symbol("mtValue"),Ot=class{[ai];constructor(e){this[ai]=Pt.fromSeed(e)}seed(e){this[ai]=Pt.fromSeed(e)}pick(e,t){let i=t;typeof i!="number"?i=rt(this[ai],{min:1,max:e.length}):i>e.length?i=e.length:i<0&&(i=0);let r=[...e],s=r.length,a=s-i,n,l;for(;s-- >a;)l=Math.floor((s+1)*Ir(this[ai],{min:0,max:.99})),n=r[l],r[l]=r[s],r[s]=n;return r.slice(a)}pickOne(e){let t=rt(this[ai],{max:e.length-1});return e[t]}};var Oi=Symbol("randomValue"),st=Symbol("mtValue"),Ve=class{[st];[Oi];constructor(e){this[st]=Pt.fromSeed(e),this[Oi]=new Ot(e)}seed(e){this[st]=Pt.fromSeed(e),this[Oi].seed(e)}number(e={}){return rt(this[st],e)}float(e={}){return Ir(this[st],e)}datetime(e={}){return Ha(this[st],e)}string(e=10,t){return Ba(this[st],e,t)}character(e={}){return Ga(this[st],e)}uuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let i=this.number({min:0,max:15});return(t==="x"?i:i&3|8).toString(16)})}hash(e={}){let{length:t=40,casing:i="lower"}=e,r=i==="upper"?Ys.toUpperCase():Ys;return this.string(t,r)}boolean(e={}){let t={};if(typeof e=="number"?t.likelihood=e:typeof e=="object"&&(t={...e}),typeof t.likelihood>"u"&&(t.likelihood=rt(this[st],{min:0,max:100})),t.likelihood<0||t.likelihood>100)throw new RangeError("Invalid likelihood range. Accepted range is [0, 100].");return this[st].real2()*100<t.likelihood}falsy(e={}){let t=e.pool||[!1,null,0,NaN,""];return this[Oi].pickOne(t)}hexaDecimal(e=1){let t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","A","B","C","D","E","F"];return`0x${this[Oi].pick(t,e).join("")}`}};var uc={names:["January","February","March","April","May","June","July","August","September","October","November","December"],abbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},Xa=uc;var hc={names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},Ya=hc;var mc={month:Xa,weekday:Ya},Za=mc;var fc=Object.freeze({consonants:"bcdfghjklmnprstvwz",vowels:"aeiou"}),Qa=fc;var gc={free:["gmail.com","yahoo.com","hotmail.com"],example:["example.org","example.com","example.net"]},en=gc;var yc={suffix:["com","biz","info","name","net","org"]},tn=yc;var bc=["0therplanet_128.jpg","1markiz_128.jpg","2fockus_128.jpg","8d3k_128.jpg","91bilal_128.jpg","9lessons_128.jpg","AM_Kn2_128.jpg","AlbertoCococi_128.jpg","BenouarradeM_128.jpg","BillSKenney_128.jpg","BrianPurkiss_128.jpg","BroumiYoussef_128.jpg","BryanHorsey_128.jpg","Chakintosh_128.jpg","ChrisFarina78_128.jpg","Elt_n_128.jpg","GavicoInd_128.jpg","HenryHoffman_128.jpg","IsaryAmairani_128.jpg","Karimmove_128.jpg","LucasPerdidao_128.jpg","ManikRathee_128.jpg","RussellBishop_128.jpg","S0ufi4n3_128.jpg","SULiik_128.jpg","Shriiiiimp_128.jpg","Silveredge9_128.jpg","Skyhartman_128.jpg","SlaapMe_128.jpg","Stievius_128.jpg","Talbi_ConSept_128.jpg","VMilescu_128.jpg","VinThomas_128.jpg","YoungCutlass_128.jpg","ZacharyZorbas_128.jpg","_dwite__128.jpg","_kkga_128.jpg","_pedropinho_128.jpg","_ragzor_128.jpg","_scottburgess_128.jpg","_shahedk_128.jpg","_victa_128.jpg","_vojto_128.jpg","_williamguerra_128.jpg","_yardenoon_128.jpg","a1chapone_128.jpg","a_brixen_128.jpg","a_harris88_128.jpg","aaronalfred_128.jpg","aaroni_128.jpg","aaronkwhite_128.jpg","abdots_128.jpg","abdulhyeuk_128.jpg","abdullindenis_128.jpg","abelcabans_128.jpg","abotap_128.jpg","abovefunction_128.jpg","adamawesomeface_128.jpg","adammarsbar_128.jpg","adamnac_128.jpg","adamsxu_128.jpg","adellecharles_128.jpg","ademilter_128.jpg","adhamdannaway_128.jpg","adhiardana_128.jpg","adityasutomo_128.jpg","adobi_128.jpg","adrienths_128.jpg","aeon56_128.jpg","afusinatto_128.jpg","agromov_128.jpg","agustincruiz_128.jpg","ah_lice_128.jpg","ahmadajmi_128.jpg","ahmetalpbalkan_128.jpg","ahmetsulek_128.jpg","aiiaiiaii_128.jpg","ainsleywagon_128.jpg","aio____128.jpg","airskylar_128.jpg","aislinnkelly_128.jpg","ajaxy_ru_128.jpg","aka_james_128.jpg","akashsharma39_128.jpg","akmalfikri_128.jpg","akmur_128.jpg","al_li_128.jpg","alagoon_128.jpg","alan_zhang__128.jpg","albertaugustin_128.jpg","alecarpentier_128.jpg","aleclarsoniv_128.jpg","aleinadsays_128.jpg","alek_djuric_128.jpg","aleksitappura_128.jpg","alessandroribe_128.jpg","alevizio_128.jpg","alexandermayes_128.jpg","alexivanichkin_128.jpg","algunsanabria_128.jpg","allagringaus_128.jpg","allfordesign_128.jpg","allthingssmitty_128.jpg","alsobrooks_128.jpg","alterchuca_128.jpg","aluisio_azevedo_128.jpg","alxleroydeval_128.jpg","alxndrustinov_128.jpg","amandabuzard_128.jpg","amanruzaini_128.jpg","amayvs_128.jpg","amywebbb_128.jpg","anaami_128.jpg","anasnakawa_128.jpg","anatolinicolae_128.jpg","andrea211087_128.jpg","andreas_pr_128.jpg","andresdjasso_128.jpg","andresenfredrik_128.jpg","andrewabogado_128.jpg","andrewarrow_128.jpg","andrewcohen_128.jpg","andrewofficer_128.jpg","andyisonline_128.jpg","andysolomon_128.jpg","andytlaw_128.jpg","angelceballos_128.jpg","angelcolberg_128.jpg","angelcreative_128.jpg","anjhero_128.jpg","ankitind_128.jpg","anoff_128.jpg","anthonysukow_128.jpg","antjanus_128.jpg","antongenkin_128.jpg","antonyryndya_128.jpg","antonyzotov_128.jpg","aoimedia_128.jpg","apriendeau_128.jpg","arashmanteghi_128.jpg","areandacom_128.jpg","areus_128.jpg","ariffsetiawan_128.jpg","ariil_128.jpg","arindam__128.jpg","arishi__128.jpg","arkokoley_128.jpg","aroon_sharma_128.jpg","arpitnj_128.jpg","artd_sign_128.jpg","artem_kostenko_128.jpg","arthurholcombe1_128.jpg","artvavs_128.jpg","ashernatali_128.jpg","ashocka18_128.jpg","atanism_128.jpg","atariboy_128.jpg","ateneupopular_128.jpg","attacks_128.jpg","aviddayentonbay_128.jpg","axel_128.jpg","badlittleduck_128.jpg","bagawarman_128.jpg","baires_128.jpg","balakayuriy_128.jpg","balintorosz_128.jpg","baliomega_128.jpg","baluli_128.jpg","bargaorobalo_128.jpg","barputro_128.jpg","bartjo_128.jpg","bartoszdawydzik_128.jpg","bassamology_128.jpg","batsirai_128.jpg","baumann_alex_128.jpg","baumannzone_128.jpg","bboy1895_128.jpg","bcrad_128.jpg","begreative_128.jpg","belyaev_rs_128.jpg","benefritz_128.jpg","benjamin_knight_128.jpg","bennyjien_128.jpg","benoitboucart_128.jpg","bereto_128.jpg","bergmartin_128.jpg","bermonpainter_128.jpg","bertboerland_128.jpg","besbujupi_128.jpg","beshur_128.jpg","betraydan_128.jpg","beweinreich_128.jpg","bfrohs_128.jpg","bighanddesign_128.jpg","bigmancho_128.jpg","billyroshan_128.jpg","bistrianiosip_128.jpg","blakehawksworth_128.jpg","blakesimkins_128.jpg","bluefx__128.jpg","bluesix_128.jpg","bobbytwoshoes_128.jpg","bobwassermann_128.jpg","bolzanmarco_128.jpg","borantula_128.jpg","borges_marcos_128.jpg","bowbrick_128.jpg","boxmodel_128.jpg","bpartridge_128.jpg","bradenhamm_128.jpg","brajeshwar_128.jpg","brandclay_128.jpg","brandonburke_128.jpg","brandonflatsoda_128.jpg","brandonmorreale_128.jpg","brenmurrell_128.jpg","brenton_clarke_128.jpg","bruno_mart_128.jpg","brunodesign1206_128.jpg","bryan_topham_128.jpg","bu7921_128.jpg","bublienko_128.jpg","buddhasource_128.jpg","buleswapnil_128.jpg","bungiwan_128.jpg","buryaknick_128.jpg","buzzusborne_128.jpg","byrnecore_128.jpg","byryan_128.jpg","cadikkara_128.jpg","calebjoyce_128.jpg","calebogden_128.jpg","canapud_128.jpg","carbontwelve_128.jpg","carlfairclough_128.jpg","carlosblanco_eu_128.jpg","carlosgavina_128.jpg","carlosjgsousa_128.jpg","carlosm_128.jpg","carlyson_128.jpg","caseycavanagh_128.jpg","caspergrl_128.jpg","catadeleon_128.jpg","catarino_128.jpg","cboller1_128.jpg","cbracco_128.jpg","ccinojasso1_128.jpg","cdavis565_128.jpg","cdharrison_128.jpg","ceekaytweet_128.jpg","cemshid_128.jpg","cggaurav_128.jpg","chaabane_wail_128.jpg","chacky14_128.jpg","chadami_128.jpg","chadengle_128.jpg","chaensel_128.jpg","chandlervdw_128.jpg","chanpory_128.jpg","charlesrpratt_128.jpg","charliecwaite_128.jpg","charliegann_128.jpg","chatyrko_128.jpg","cherif_b_128.jpg","chris_frees_128.jpg","chris_witko_128.jpg","chrismj83_128.jpg","chrisslowik_128.jpg","chrisstumph_128.jpg","christianoliff_128.jpg","chrisvanderkooi_128.jpg","ciaranr_128.jpg","cicerobr_128.jpg","claudioguglieri_128.jpg","cloudstudio_128.jpg","clubb3rry_128.jpg","cocolero_128.jpg","codepoet_ru_128.jpg","coderdiaz_128.jpg","codysanfilippo_128.jpg","cofla_128.jpg","colgruv_128.jpg","colirpixoil_128.jpg","collegeman_128.jpg","commadelimited_128.jpg","conspirator_128.jpg","constantx_128.jpg","coreyginnivan_128.jpg","coreyhaggard_128.jpg","coreyweb_128.jpg","craigelimeliah_128.jpg","craighenneberry_128.jpg","craigrcoles_128.jpg","creartinc_128.jpg","croakx_128.jpg","curiousoffice_128.jpg","curiousonaut_128.jpg","cybind_128.jpg","cynthiasavard_128.jpg","cyril_gaillard_128.jpg","d00maz_128.jpg","d33pthought_128.jpg","d_kobelyatsky_128.jpg","d_nny_m_cher_128.jpg","dactrtr_128.jpg","dahparra_128.jpg","dallasbpeters_128.jpg","damenleeturks_128.jpg","danillos_128.jpg","daniloc_128.jpg","danmartin70_128.jpg","dannol_128.jpg","danpliego_128.jpg","danro_128.jpg","dansowter_128.jpg","danthms_128.jpg","danvernon_128.jpg","danvierich_128.jpg","darcystonge_128.jpg","darylws_128.jpg","davecraige_128.jpg","davidbaldie_128.jpg","davidcazalis_128.jpg","davidhemphill_128.jpg","davidmerrique_128.jpg","davidsasda_128.jpg","dawidwu_128.jpg","daykiine_128.jpg","dc_user_128.jpg","dcalonaci_128.jpg","ddggccaa_128.jpg","de_ascanio_128.jpg","deeenright_128.jpg","demersdesigns_128.jpg","denisepires_128.jpg","depaulawagner_128.jpg","derekcramer_128.jpg","derekebradley_128.jpg","derienzo777_128.jpg","desastrozo_128.jpg","designervzm_128.jpg","dev_essentials_128.jpg","devankoshal_128.jpg","deviljho__128.jpg","devinhalladay_128.jpg","dgajjar_128.jpg","dgclegg_128.jpg","dhilipsiva_128.jpg","dhoot_amit_128.jpg","dhooyenga_128.jpg","dhrubo_128.jpg","diansigitp_128.jpg","dicesales_128.jpg","diesellaws_128.jpg","digitalmaverick_128.jpg","dimaposnyy_128.jpg","dingyi_128.jpg","divya_128.jpg","dixchen_128.jpg","djsherman_128.jpg","dmackerman_128.jpg","dmitriychuta_128.jpg","dnezkumar_128.jpg","dnirmal_128.jpg","donjain_128.jpg","doooon_128.jpg","doronmalki_128.jpg","dorphern_128.jpg","dotgridline_128.jpg","dparrelli_128.jpg","dpmachado_128.jpg","dreizle_128.jpg","drewbyreese_128.jpg","dshster_128.jpg","dss49_128.jpg","dudestein_128.jpg","duivvv_128.jpg","dutchnadia_128.jpg","dvdwinden_128.jpg","dzantievm_128.jpg","ecommerceil_128.jpg","eddiechen_128.jpg","edgarchris99_128.jpg","edhenderson_128.jpg","edkf_128.jpg","edobene_128.jpg","eduardostuart_128.jpg","ehsandiary_128.jpg","eitarafa_128.jpg","el_fuertisimo_128.jpg","elbuscainfo_128.jpg","elenadissi_128.jpg","elisabethkjaer_128.jpg","elliotlewis_128.jpg","elliotnolten_128.jpg","embrcecreations_128.jpg","emileboudeling_128.jpg","emmandenn_128.jpg","emmeffess_128.jpg","emsgulam_128.jpg","enda_128.jpg","enjoythetau_128.jpg","enricocicconi_128.jpg","envex_128.jpg","ernestsemerda_128.jpg","erwanhesry_128.jpg","estebanuribe_128.jpg","eugeneeweb_128.jpg","evandrix_128.jpg","evanshajed_128.jpg","exentrich_128.jpg","eyronn_128.jpg","fabbianz_128.jpg","fabbrucci_128.jpg","faisalabid_128.jpg","falconerie_128.jpg","falling_soul_128.jpg","falvarad_128.jpg","felipeapiress_128.jpg","felipecsl_128.jpg","ffbel_128.jpg","finchjke_128.jpg","findingjenny_128.jpg","fiterik_128.jpg","fjaguero_128.jpg","flashmurphy_128.jpg","flexrs_128.jpg","foczzi_128.jpg","fotomagin_128.jpg","fran_mchamy_128.jpg","francis_vega_128.jpg","franciscoamk_128.jpg","frankiefreesbie_128.jpg","fronx_128.jpg","funwatercat_128.jpg","g3d_128.jpg","gaborenton_128.jpg","gabrielizalo_128.jpg","gabrielrosser_128.jpg","ganserene_128.jpg","garand_128.jpg","gauchomatt_128.jpg","gauravjassal_128.jpg","gavr1l0_128.jpg","gcmorley_128.jpg","gearpixels_128.jpg","geneseleznev_128.jpg","geobikas_128.jpg","geran7_128.jpg","geshan_128.jpg","giancarlon_128.jpg","gipsy_raf_128.jpg","giuliusa_128.jpg","gizmeedevil1991_128.jpg","gkaam_128.jpg","gmourier_128.jpg","goddardlewis_128.jpg","gofrasdesign_128.jpg","gojeanyn_128.jpg","gonzalorobaina_128.jpg","grahamkennery_128.jpg","greenbes_128.jpg","gregkilian_128.jpg","gregrwilkinson_128.jpg","gregsqueeb_128.jpg","grrr_nl_128.jpg","gseguin_128.jpg","gt_128.jpg","gu5taf_128.jpg","guiiipontes_128.jpg","guillemboti_128.jpg","guischmitt_128.jpg","gusoto_128.jpg","h1brd_128.jpg","hafeeskhan_128.jpg","hai_ninh_nguyen_128.jpg","haligaliharun_128.jpg","hanna_smi_128.jpg","happypeter1983_128.jpg","harry_sistalam_128.jpg","haruintesettden_128.jpg","hasslunsford_128.jpg","haydn_woods_128.jpg","helderleal_128.jpg","hellofeverrrr_128.jpg","her_ruu_128.jpg","herbigt_128.jpg","herkulano_128.jpg","hermanobrother_128.jpg","herrhaase_128.jpg","heycamtaylor_128.jpg","heyimjuani_128.jpg","heykenneth_128.jpg","hfalucas_128.jpg","hgharrygo_128.jpg","hiemil_128.jpg","hjartstrorn_128.jpg","hoangloi_128.jpg","holdenweb_128.jpg","homka_128.jpg","horaciobella_128.jpg","hota_v_128.jpg","hsinyo23_128.jpg","hugocornejo_128.jpg","hugomano_128.jpg","iamgarth_128.jpg","iamglimy_128.jpg","iamjdeleon_128.jpg","iamkarna_128.jpg","iamkeithmason_128.jpg","iamsteffen_128.jpg","id835559_128.jpg","idiot_128.jpg","iduuck_128.jpg","ifarafonow_128.jpg","igorgarybaldi_128.jpg","illyzoren_128.jpg","ilya_pestov_128.jpg","imammuht_128.jpg","imcoding_128.jpg","imomenui_128.jpg","imsoper_128.jpg","increase_128.jpg","incubo82_128.jpg","instalox_128.jpg","ionuss_128.jpg","ipavelek_128.jpg","iqbalperkasa_128.jpg","iqonicd_128.jpg","irae_128.jpg","isaacfifth_128.jpg","isacosta_128.jpg","ismail_biltagi_128.jpg","isnifer_128.jpg","itolmach_128.jpg","itsajimithing_128.jpg","itskawsar_128.jpg","itstotallyamy_128.jpg","ivanfilipovbg_128.jpg","j04ntoh_128.jpg","j2deme_128.jpg","j_drake__128.jpg","jackiesaik_128.jpg","jacksonlatka_128.jpg","jacobbennett_128.jpg","jagan123_128.jpg","jakemoore_128.jpg","jamiebrittain_128.jpg","janpalounek_128.jpg","jarjan_128.jpg","jarsen_128.jpg","jasonmarkjones_128.jpg","javorszky_128.jpg","jay_wilburn_128.jpg","jayphen_128.jpg","jayrobinson_128.jpg","jcubic_128.jpg","jedbridges_128.jpg","jefffis_128.jpg","jeffgolenski_128.jpg","jehnglynn_128.jpg","jennyshen_128.jpg","jennyyo_128.jpg","jeremery_128.jpg","jeremiaha_128.jpg","jeremiespoken_128.jpg","jeremymouton_128.jpg","jeremyshimko_128.jpg","jeremyworboys_128.jpg","jerrybai1907_128.jpg","jervo_128.jpg","jesseddy_128.jpg","jffgrdnr_128.jpg","jghyllebert_128.jpg","jimmuirhead_128.jpg","jitachi_128.jpg","jjshaw14_128.jpg","jjsiii_128.jpg","jlsolerdeltoro_128.jpg","jm_denis_128.jpg","jmfsocial_128.jpg","jmillspaysbills_128.jpg","jnmnrd_128.jpg","joannefournier_128.jpg","joaoedumedeiros_128.jpg","jodytaggart_128.jpg","joe_black_128.jpg","joelcipriano_128.jpg","joelhelin_128.jpg","joemdesign_128.jpg","joetruesdell_128.jpg","joeymurdah_128.jpg","johannesneu_128.jpg","johncafazza_128.jpg","johndezember_128.jpg","johnriordan_128.jpg","johnsmithagency_128.jpg","joki4_128.jpg","jomarmen_128.jpg","jonathansimmons_128.jpg","jonkspr_128.jpg","jonsgotwood_128.jpg","jordyvdboom_128.jpg","joreira_128.jpg","josecarlospsh_128.jpg","josemarques_128.jpg","josep_martins_128.jpg","josevnclch_128.jpg","joshaustin_128.jpg","joshhemsley_128.jpg","joshmedeski_128.jpg","joshuaraichur_128.jpg","joshuasortino_128.jpg","jpenico_128.jpg","jpscribbles_128.jpg","jqiuss_128.jpg","juamperro_128.jpg","juangomezw_128.jpg","juanmamartinez_128.jpg","juaumlol_128.jpg","judzhin_miles_128.jpg","justinrgraham_128.jpg","justinrhee_128.jpg","justinrob_128.jpg","justme_timothyg_128.jpg","jwalter14_128.jpg","jydesign_128.jpg","kaelifa_128.jpg","kalmerrautam_128.jpg","kamal_chaneman_128.jpg","kanickairaj_128.jpg","kapaluccio_128.jpg","karalek_128.jpg","karlkanall_128.jpg","karolkrakowiak__128.jpg","karsh_128.jpg","karthipanraj_128.jpg","kaspernordkvist_128.jpg","katiemdaly_128.jpg","kaysix_dizzy_128.jpg","kazaky999_128.jpg","kennyadr_128.jpg","kerem_128.jpg","kerihenare_128.jpg","keryilmaz_128.jpg","kevinjohndayy_128.jpg","kevinoh_128.jpg","kevka_128.jpg","keyuri85_128.jpg","kianoshp_128.jpg","kijanmaharjan_128.jpg","kikillo_128.jpg","kimcool_128.jpg","kinday_128.jpg","kirangopal_128.jpg","kiwiupover_128.jpg","kkusaa_128.jpg","klefue_128.jpg","klimmka_128.jpg","knilob_128.jpg","kohette_128.jpg","kojourin_128.jpg","kolage_128.jpg","kolmarlopez_128.jpg","kolsvein_128.jpg","konus_128.jpg","koridhandy_128.jpg","kosmar_128.jpg","kostaspt_128.jpg","krasnoukhov_128.jpg","krystalfister_128.jpg","kucingbelang4_128.jpg","kudretkeskin_128.jpg","kuldarkalvik_128.jpg","kumarrajan12123_128.jpg","kurafire_128.jpg","kurtinc_128.jpg","kushsolitary_128.jpg","kvasnic_128.jpg","ky_128.jpg","kylefoundry_128.jpg","kylefrost_128.jpg","laasli_128.jpg","lanceguyatt_128.jpg","langate_128.jpg","larrybolt_128.jpg","larrygerard_128.jpg","laurengray_128.jpg","lawlbwoy_128.jpg","layerssss_128.jpg","leandrovaranda_128.jpg","lebinoclard_128.jpg","lebronjennan_128.jpg","leehambley_128.jpg","leeiio_128.jpg","leemunroe_128.jpg","leonfedotov_128.jpg","lepetitogre_128.jpg","lepinski_128.jpg","levisan_128.jpg","lewisainslie_128.jpg","lhausermann_128.jpg","liminha_128.jpg","lingeswaran_128.jpg","linkibol_128.jpg","linux29_128.jpg","lisovsky_128.jpg","llun_128.jpg","lmjabreu_128.jpg","loganjlambert_128.jpg","logorado_128.jpg","lokesh_coder_128.jpg","lonesomelemon_128.jpg","longlivemyword_128.jpg","looneydoodle_128.jpg","lososina_128.jpg","louis_currie_128.jpg","low_res_128.jpg","lowie_128.jpg","lu4sh1i_128.jpg","ludwiczakpawel_128.jpg","luxe_128.jpg","lvovenok_128.jpg","m4rio_128.jpg","m_kalibry_128.jpg","ma_tiax_128.jpg","mactopus_128.jpg","macxim_128.jpg","madcampos_128.jpg","madebybrenton_128.jpg","madebyvadim_128.jpg","madewulf_128.jpg","madshensel_128.jpg","madysondesigns_128.jpg","magoo04_128.jpg","magugzbrand2d_128.jpg","mahdif_128.jpg","mahmoudmetwally_128.jpg","maikelk_128.jpg","maiklam_128.jpg","malgordon_128.jpg","malykhinv_128.jpg","mandalareopens_128.jpg","manekenthe_128.jpg","mangosango_128.jpg","manigm_128.jpg","marakasina_128.jpg","marciotoledo_128.jpg","marclgonzales_128.jpg","marcobarbosa_128.jpg","marcomano__128.jpg","marcoramires_128.jpg","marcusgorillius_128.jpg","markjenkins_128.jpg","marklamb_128.jpg","markolschesky_128.jpg","markretzloff_128.jpg","markwienands_128.jpg","marlinjayakody_128.jpg","marosholly_128.jpg","marrimo_128.jpg","marshallchen__128.jpg","martinansty_128.jpg","martip07_128.jpg","mashaaaaal_128.jpg","mastermindesign_128.jpg","matbeedotcom_128.jpg","mateaodviteza_128.jpg","matkins_128.jpg","matt3224_128.jpg","mattbilotti_128.jpg","mattdetails_128.jpg","matthewkay__128.jpg","mattlat_128.jpg","mattsapii_128.jpg","mauriolg_128.jpg","maximseshuk_128.jpg","maximsorokin_128.jpg","maxlinderman_128.jpg","maz_128.jpg","mbilalsiddique1_128.jpg","mbilderbach_128.jpg","mcflydesign_128.jpg","mds_128.jpg","mdsisto_128.jpg","meelford_128.jpg","megdraws_128.jpg","mekal_128.jpg","meln1ks_128.jpg","melvindidit_128.jpg","mfacchinello_128.jpg","mgonto_128.jpg","mhaligowski_128.jpg","mhesslow_128.jpg","mhudobivnik_128.jpg","michaelabehsera_128.jpg","michaelbrooksjr_128.jpg","michaelcolenso_128.jpg","michaelcomiskey_128.jpg","michaelkoper_128.jpg","michaelmartinho_128.jpg","michalhron_128.jpg","michigangraham_128.jpg","michzen_128.jpg","mighty55_128.jpg","miguelkooreman_128.jpg","miguelmendes_128.jpg","mikaeljorhult_128.jpg","mikebeecham_128.jpg","mikemai2awesome_128.jpg","millinet_128.jpg","mirfanqureshi_128.jpg","missaaamy_128.jpg","mizhgan_128.jpg","mizko_128.jpg","mkginfo_128.jpg","mocabyte_128.jpg","mohanrohith_128.jpg","moscoz_128.jpg","motionthinks_128.jpg","moynihan_128.jpg","mr_shiznit_128.jpg","mr_subtle_128.jpg","mrebay007_128.jpg","mrjamesnoble_128.jpg","mrmartineau_128.jpg","mrxloka_128.jpg","mslarkina_128.jpg","msveet_128.jpg","mtolokonnikov_128.jpg","mufaddal_mw_128.jpg","mugukamil_128.jpg","muridrahhal_128.jpg","muringa_128.jpg","murrayswift_128.jpg","mutlu82_128.jpg","mutu_krish_128.jpg","mvdheuvel_128.jpg","mwarkentin_128.jpg","myastro_128.jpg","mylesb_128.jpg","mymyboy_128.jpg","n1ght_coder_128.jpg","n3dmax_128.jpg","n_tassone_128.jpg","nacho_128.jpg","naitanamoreno_128.jpg","namankreative_128.jpg","nandini_m_128.jpg","nasirwd_128.jpg","nastya_mane_128.jpg","nateschulte_128.jpg","nathalie_fs_128.jpg","naupintos_128.jpg","nbirckel_128.jpg","nckjrvs_128.jpg","necodymiconer_128.jpg","nehfy_128.jpg","nellleo_128.jpg","nelshd_128.jpg","nelsonjoyce_128.jpg","nemanjaivanovic_128.jpg","nepdud_128.jpg","nerdgr8_128.jpg","nerrsoft_128.jpg","nessoila_128.jpg","netonet_il_128.jpg","newbrushes_128.jpg","nfedoroff_128.jpg","nickfratter_128.jpg","nicklacke_128.jpg","nicolai_larsen_128.jpg","nicolasfolliot_128.jpg","nicoleglynn_128.jpg","nicollerich_128.jpg","nilshelmersson_128.jpg","nilshoenson_128.jpg","ninjad3m0_128.jpg","nitinhayaran_128.jpg","nomidesigns_128.jpg","normanbox_128.jpg","notbadart_128.jpg","noufalibrahim_128.jpg","noxdzine_128.jpg","nsamoylov_128.jpg","ntfblog_128.jpg","nutzumi_128.jpg","nvkznemo_128.jpg","nwdsha_128.jpg","nyancecom_128.jpg","oaktreemedia_128.jpg","okandungel_128.jpg","okansurreel_128.jpg","okcoker_128.jpg","oksanafrewer_128.jpg","okseanjay_128.jpg","oktayelipek_128.jpg","olaolusoga_128.jpg","olgary_128.jpg","omnizya_128.jpg","ooomz_128.jpg","operatino_128.jpg","opnsrce_128.jpg","orkuncaylar_128.jpg","oscarowusu_128.jpg","oskamaya_128.jpg","oskarlevinson_128.jpg","osmanince_128.jpg","osmond_128.jpg","ostirbu_128.jpg","osvaldas_128.jpg","otozk_128.jpg","ovall_128.jpg","overcloacked_128.jpg","overra_128.jpg","panchajanyag_128.jpg","panghal0_128.jpg","patrickcoombe_128.jpg","paulfarino_128.jpg","pcridesagain_128.jpg","peachananr_128.jpg","pechkinator_128.jpg","peejfancher_128.jpg","pehamondello_128.jpg","perfectflow_128.jpg","perretmagali_128.jpg","petar_prog_128.jpg","petebernardo_128.jpg","peter576_128.jpg","peterlandt_128.jpg","petrangr_128.jpg","phillapier_128.jpg","picard102_128.jpg","pierre_nel_128.jpg","pierrestoffe_128.jpg","pifagor_128.jpg","pixage_128.jpg","plasticine_128.jpg","plbabin_128.jpg","pmeissner_128.jpg","polarity_128.jpg","ponchomendivil_128.jpg","poormini_128.jpg","popey_128.jpg","posterjob_128.jpg","praveen_vijaya_128.jpg","prheemo_128.jpg","primozcigler_128.jpg","prinzadi_128.jpg","privetwagner_128.jpg","prrstn_128.jpg","psaikali_128.jpg","psdesignuk_128.jpg","puzik_128.jpg","pyronite_128.jpg","quailandquasar_128.jpg","r_garcia_128.jpg","r_oy_128.jpg","rachelreveley_128.jpg","rahmeen_128.jpg","ralph_lam_128.jpg","ramanathan_pdy_128.jpg","randomlies_128.jpg","rangafangs_128.jpg","raphaelnikson_128.jpg","raquelwilson_128.jpg","ratbus_128.jpg","rawdiggie_128.jpg","rdbannon_128.jpg","rdsaunders_128.jpg","reabo101_128.jpg","reetajayendra_128.jpg","rehatkathuria_128.jpg","reideiredale_128.jpg","renbyrd_128.jpg","rez___a_128.jpg","ricburton_128.jpg","richardgarretts_128.jpg","richwild_128.jpg","rickdt_128.jpg","rickyyean_128.jpg","rikas_128.jpg","ripplemdk_128.jpg","rmlewisuk_128.jpg","rob_thomas10_128.jpg","robbschiller_128.jpg","robergd_128.jpg","robinclediere_128.jpg","robinlayfield_128.jpg","robturlinckx_128.jpg","rodnylobos_128.jpg","rohixx_128.jpg","romanbulah_128.jpg","roxanejammet_128.jpg","roybarberuk_128.jpg","rpatey_128.jpg","rpeezy_128.jpg","rtgibbons_128.jpg","rtyukmaev_128.jpg","rude_128.jpg","ruehldesign_128.jpg","runningskull_128.jpg","russell_baylis_128.jpg","russoedu_128.jpg","ruzinav_128.jpg","rweve_128.jpg","ryandownie_128.jpg","ryanjohnson_me_128.jpg","ryankirkman_128.jpg","ryanmclaughlin_128.jpg","ryhanhassan_128.jpg","ryuchi311_128.jpg","s4f1_128.jpg","saarabpreet_128.jpg","sachacorazzi_128.jpg","sachingawas_128.jpg","safrankov_128.jpg","sainraja_128.jpg","salimianoff_128.jpg","salleedesign_128.jpg","salvafc_128.jpg","samgrover_128.jpg","samihah_128.jpg","samscouto_128.jpg","samuelkraft_128.jpg","sandywoodruff_128.jpg","sangdth_128.jpg","santi_urso_128.jpg","saschadroste_128.jpg","saschamt_128.jpg","sasha_shestakov_128.jpg","saulihirvi_128.jpg","sawalazar_128.jpg","sawrb_128.jpg","sbtransparent_128.jpg","scips_128.jpg","scott_riley_128.jpg","scottfeltham_128.jpg","scottgallant_128.jpg","scottiedude_128.jpg","scottkclark_128.jpg","scrapdnb_128.jpg","sdidonato_128.jpg","sebashton_128.jpg","sementiy_128.jpg","serefka_128.jpg","sergeyalmone_128.jpg","sergeysafonov_128.jpg","sethlouey_128.jpg","seyedhossein1_128.jpg","sgaurav_baghel_128.jpg","shadeed9_128.jpg","shalt0ni_128.jpg","shaneIxD_128.jpg","shanehudson_128.jpg","sharvin_128.jpg","shesgared_128.jpg","shinze_128.jpg","shoaib253_128.jpg","shojberg_128.jpg","shvelo96_128.jpg","silv3rgvn_128.jpg","silvanmuhlemann_128.jpg","simobenso_128.jpg","sindresorhus_128.jpg","sircalebgrove_128.jpg","skkirilov_128.jpg","slowspock_128.jpg","smaczny_128.jpg","smalonso_128.jpg","smenov_128.jpg","snowshade_128.jpg","snowwrite_128.jpg","sokaniwaal_128.jpg","solid_color_128.jpg","souperphly_128.jpg","souuf_128.jpg","sovesove_128.jpg","soyjavi_128.jpg","spacewood__128.jpg","spbroma_128.jpg","spedwig_128.jpg","sprayaga_128.jpg","sreejithexp_128.jpg","ssbb_me_128.jpg","ssiskind_128.jpg","sta1ex_128.jpg","stalewine_128.jpg","stan_128.jpg","stayuber_128.jpg","stefanotirloni_128.jpg","stefanozoffoli_128.jpg","stefooo_128.jpg","stefvdham_128.jpg","stephcoue_128.jpg","sterlingrules_128.jpg","stevedesigner_128.jpg","steynviljoen_128.jpg","strikewan_128.jpg","stushona_128.jpg","sulaqo_128.jpg","sunlandictwin_128.jpg","sunshinedgirl_128.jpg","superoutman_128.jpg","supervova_128.jpg","supjoey_128.jpg","suprb_128.jpg","sur4dye_128.jpg","surgeonist_128.jpg","suribbles_128.jpg","svenlen_128.jpg","swaplord_128.jpg","sweetdelisa_128.jpg","switmer777_128.jpg","swooshycueb_128.jpg","sydlawrence_128.jpg","syropian_128.jpg","tanveerrao_128.jpg","taybenlor_128.jpg","taylorling_128.jpg","tbakdesigns_128.jpg","teddyzetterlund_128.jpg","teeragit_128.jpg","tereshenkov_128.jpg","terpimost_128.jpg","terrorpixel_128.jpg","terryxlife_128.jpg","teylorfeliz_128.jpg","tgerken_128.jpg","tgormtx_128.jpg","thaisselenator__128.jpg","thaodang17_128.jpg","thatonetommy_128.jpg","the_purplebunny_128.jpg","the_winslet_128.jpg","thedamianhdez_128.jpg","thedjpetersen_128.jpg","thehacker_128.jpg","thekevinjones_128.jpg","themadray_128.jpg","themikenagle_128.jpg","themrdave_128.jpg","theonlyzeke_128.jpg","therealmarvin_128.jpg","thewillbeard_128.jpg","thiagovernetti_128.jpg","thibaut_re_128.jpg","thierrykoblentz_128.jpg","thierrymeier__128.jpg","thimo_cz_128.jpg","thinkleft_128.jpg","thomasgeisen_128.jpg","thomasschrijer_128.jpg","timgthomas_128.jpg","timmillwood_128.jpg","timothycd_128.jpg","timpetricola_128.jpg","tjrus_128.jpg","to_soham_128.jpg","tobysaxon_128.jpg","toddrew_128.jpg","tom_even_128.jpg","tomas_janousek_128.jpg","tonymillion_128.jpg","traneblow_128.jpg","travis_arnold_128.jpg","travishines_128.jpg","tristanlegros_128.jpg","trubeatto_128.jpg","trueblood_33_128.jpg","tumski_128.jpg","tur8le_128.jpg","turkutuuli_128.jpg","tweetubhai_128.jpg","twittypork_128.jpg","txcx_128.jpg","uberschizo_128.jpg","ultragex_128.jpg","umurgdk_128.jpg","unterdreht_128.jpg","urrutimeoli_128.jpg","uxalex_128.jpg","uxpiper_128.jpg","uxward_128.jpg","vanchesz_128.jpg","vaughanmoffitt_128.jpg","vc27_128.jpg","vicivadeline_128.jpg","victorDubugras_128.jpg","victor_haydin_128.jpg","victordeanda_128.jpg","victorerixon_128.jpg","victorquinn_128.jpg","victorstuber_128.jpg","vigobronx_128.jpg","vijaykarthik_128.jpg","vikashpathak18_128.jpg","vikasvinfotech_128.jpg","vimarethomas_128.jpg","vinciarts_128.jpg","vitor376_128.jpg","vitorleal_128.jpg","vivekprvr_128.jpg","vj_demien_128.jpg","vladarbatov_128.jpg","vladimirdevic_128.jpg","vladyn_128.jpg","vlajki_128.jpg","vm_f_128.jpg","vocino_128.jpg","vonachoo_128.jpg","vovkasolovev_128.jpg","vytautas_a_128.jpg","waghner_128.jpg","wake_gs_128.jpg","we_social_128.jpg","wearesavas_128.jpg","weavermedia_128.jpg","webtanya_128.jpg","weglov_128.jpg","wegotvices_128.jpg","wesleytrankin_128.jpg","wikiziner_128.jpg","wiljanslofstra_128.jpg","wim1k_128.jpg","wintopia_128.jpg","woodsman001_128.jpg","woodydotmx_128.jpg","wtrsld_128.jpg","xadhix_128.jpg","xalionmalik_128.jpg","xamorep_128.jpg","xiel_128.jpg","xilantra_128.jpg","xravil_128.jpg","xripunov_128.jpg","xtopherpaul_128.jpg","y2graphic_128.jpg","yalozhkin_128.jpg","yassiryahya_128.jpg","yayteejay_128.jpg","yecidsm_128.jpg","yehudab_128.jpg","yesmeck_128.jpg","yigitpinarbasi_128.jpg","zackeeler_128.jpg","zaki3d_128.jpg","zauerkraut_128.jpg","zforrester_128.jpg","zvchkelly_128.jpg"],rn=bc;var kc={email:en,domain:tn,avatar:rn},sn=kc;var wc={female:["Mary","Patricia","Linda","Barbara","Elizabeth","Jennifer","Maria","Susan","Margaret","Dorothy","Lisa","Nancy","Karen","Betty","Helen","Sandra","Donna","Carol","Ruth","Sharon","Michelle","Laura","Sarah","Kimberly","Deborah","Jessica","Shirley","Cynthia","Angela","Melissa","Brenda","Amy","Anna","Rebecca","Virginia","Kathleen","Pamela","Martha","Debra","Amanda","Stephanie","Carolyn","Christine","Marie","Janet","Catherine","Frances","Ann","Joyce","Diane","Alice","Julie","Heather","Teresa","Doris","Gloria","Evelyn","Jean","Cheryl","Mildred","Katherine","Joan","Ashley","Judith","Rose","Janice","Kelly","Nicole","Judy","Christina","Kathy","Theresa","Beverly","Denise","Tammy","Irene","Jane","Lori","Rachel","Marilyn","Andrea","Kathryn","Louise","Sara","Anne","Jacqueline","Wanda","Bonnie","Julia","Ruby","Lois","Tina","Phyllis","Norma","Paula","Diana","Annie","Lillian","Emily","Robin","Peggy","Crystal","Gladys","Rita","Dawn","Connie","Florence","Tracy","Edna","Tiffany","Carmen","Rosa","Cindy","Grace","Wendy","Victoria","Edith","Kim","Sherry","Sylvia","Josephine","Thelma","Shannon","Sheila","Ethel","Ellen","Elaine","Marjorie","Carrie","Charlotte","Monica","Esther","Pauline","Emma","Juanita","Anita","Rhonda","Hazel","Amber","Eva","Debbie","April","Leslie","Clara","Lucille","Jamie","Joanne","Eleanor","Valerie","Danielle","Megan","Alicia","Suzanne","Michele","Gail","Bertha","Darlene","Veronica","Jill","Erin","Geraldine","Lauren","Cathy","Joann","Lorraine","Lynn","Sally","Regina","Erica","Beatrice","Dolores","Bernice","Audrey","Yvonne","Annette","June","Samantha","Marion","Dana","Stacy","Ana","Renee","Ida","Vivian","Roberta","Holly","Brittany","Melanie","Loretta","Yolanda","Jeanette","Laurie","Katie","Kristen","Vanessa","Alma","Sue","Elsie","Beth","Jeanne","Vicki","Carla","Tara","Rosemary","Eileen","Terri","Gertrude","Lucy","Tonya","Ella","Stacey","Wilma","Gina","Kristin","Jessie","Natalie","Agnes","Vera","Willie","Charlene","Bessie","Delores","Melinda","Pearl","Arlene","Maureen","Colleen","Allison","Tamara","Joy","Georgia","Constance","Lillie","Claudia","Jackie","Marcia","Tanya","Nellie","Minnie","Marlene","Heidi","Glenda","Lydia","Viola","Courtney","Marian","Stella","Caroline","Dora","Jo","Vickie","Mattie","Terry","Maxine","Irma","Mabel","Marsha","Myrtle","Lena","Christy","Deanna","Patsy","Hilda","Gwendolyn","Jennie","Nora","Margie","Nina","Cassandra","Leah","Penny","Kay","Priscilla","Naomi","Carole","Brandy","Olga","Billie","Dianne","Tracey","Leona","Jenny","Felicia","Sonia","Miriam","Velma","Becky","Bobbie","Violet","Kristina","Toni","Misty","Mae","Shelly","Daisy","Ramona","Sherri","Erika","Katrina","Claire","Lindsey","Lindsay","Geneva","Guadalupe","Belinda","Margarita","Sheryl","Cora","Faye","Ada","Natasha","Sabrina","Isabel","Marguerite","Hattie","Harriet","Molly","Cecilia","Kristi","Brandi","Blanche","Sandy","Rosie","Joanna","Iris","Eunice","Angie","Inez","Lynda","Madeline","Amelia","Alberta","Genevieve","Monique","Jodi","Janie","Maggie","Kayla","Sonya","Jan","Lee","Kristine","Candace","Fannie","Maryann","Opal","Alison","Yvette","Melody","Luz","Susie","Olivia","Flora","Shelley","Kristy","Mamie","Lula","Lola","Verna","Beulah","Antoinette","Candice","Juana","Jeannette","Pam","Kelli","Hannah","Whitney","Bridget","Karla","Celia","Latoya","Patty","Shelia","Gayle","Della","Vicky","Lynne","Sheri","Marianne","Kara","Jacquelyn","Erma","Blanca","Myra","Leticia","Pat","Krista","Roxanne","Angelica","Johnnie","Robyn","Francis","Adrienne","Rosalie","Alexandra","Brooke","Bethany","Sadie","Bernadette","Traci","Jody","Kendra","Jasmine","Nichole","Rachael","Chelsea","Mable","Ernestine","Muriel","Marcella","Elena","Krystal","Angelina","Nadine","Kari","Estelle","Dianna","Paulette","Lora","Mona","Doreen","Rosemarie","Angel","Desiree","Antonia","Hope","Ginger","Janis","Betsy","Christie","Freda","Mercedes","Meredith","Lynette","Teri","Cristina","Eula","Leigh","Meghan","Sophia","Eloise","Rochelle","Gretchen","Cecelia","Raquel","Henrietta","Alyssa","Jana","Kelley","Gwen","Kerry","Jenna","Tricia","Laverne","Olive","Alexis","Tasha","Silvia","Elvira","Casey","Delia","Sophie","Kate","Patti","Lorena","Kellie","Sonja","Lila","Lana","Darla","May","Mindy","Essie","Mandy","Lorene","Elsa","Josefina","Jeannie","Miranda","Dixie","Lucia","Marta","Faith","Lela","Johanna","Shari","Camille","Tami","Shawna","Elisa","Ebony","Melba","Ora","Nettie","Tabitha","Ollie","Jaime","Winifred","Kristie"],male:["James","John","Robert","Michael","William","David","Richard","Charles","Joseph","Thomas","Christopher","Daniel","Paul","Mark","Donald","George","Kenneth","Steven","Edward","Brian","Ronald","Anthony","Kevin","Jason","Matthew","Gary","Timothy","Jose","Larry","Jeffrey","Frank","Scott","Eric","Stephen","Andrew","Raymond","Gregory","Joshua","Jerry","Dennis","Walter","Patrick","Peter","Harold","Douglas","Henry","Carl","Arthur","Ryan","Roger","Joe","Juan","Jack","Albert","Jonathan","Justin","Terry","Gerald","Keith","Samuel","Willie","Ralph","Lawrence","Nicholas","Roy","Benjamin","Bruce","Brandon","Adam","Harry","Fred","Wayne","Billy","Steve","Louis","Jeremy","Aaron","Randy","Howard","Eugene","Carlos","Russell","Bobby","Victor","Martin","Ernest","Phillip","Todd","Jesse","Craig","Alan","Shawn","Clarence","Sean","Philip","Chris","Johnny","Earl","Jimmy","Antonio","Danny","Bryan","Tony","Luis","Mike","Stanley","Leonard","Nathan","Dale","Manuel","Rodney","Curtis","Norman","Allen","Marvin","Vincent","Glenn","Jeffery","Travis","Jeff","Chad","Jacob","Lee","Melvin","Alfred","Kyle","Francis","Bradley","Jesus","Herbert","Frederick","Ray","Joel","Edwin","Don","Eddie","Ricky","Troy","Randall","Barry","Alexander","Bernard","Mario","Leroy","Francisco","Marcus","Micheal","Theodore","Clifford","Miguel","Oscar","Jay","Jim","Tom","Calvin","Alex","Jon","Ronnie","Bill","Lloyd","Tommy","Leon","Derek","Warren","Darrell","Jerome","Floyd","Leo","Alvin","Tim","Wesley","Gordon","Dean","Greg","Jorge","Dustin","Pedro","Derrick","Dan","Lewis","Zachary","Corey","Herman","Maurice","Vernon","Roberto","Clyde","Glen","Hector","Shane","Ricardo","Sam","Rick","Lester","Brent","Ramon","Charlie","Tyler","Gilbert","Gene","Marc","Reginald","Ruben","Brett","Angel","Nathaniel","Rafael","Leslie","Edgar","Milton","Raul","Ben","Chester","Cecil","Duane","Franklin","Andre","Elmer","Brad","Gabriel","Ron","Mitchell","Roland","Arnold","Harvey","Jared","Adrian","Karl","Cory","Claude","Erik","Darryl","Jamie","Neil","Jessie","Christian","Javier","Fernando","Clinton","Ted","Mathew","Tyrone","Darren","Lonnie","Lance","Cody","Julio","Kelly","Kurt","Allan","Nelson","Guy","Clayton","Hugh","Max","Dwayne","Dwight","Armando","Felix","Jimmie","Everett","Jordan","Ian","Wallace","Ken","Bob","Jaime","Casey","Alfredo","Alberto","Dave","Ivan","Johnnie","Sidney","Byron","Julian","Isaac","Morris","Clifton","Willard","Daryl","Ross","Virgil","Andy","Marshall","Salvador","Perry","Kirk","Sergio","Marion","Tracy","Seth","Kent","Terrance","Rene","Eduardo","Terrence","Enrique","Freddie","Wade","Austin","Stuart","Fredrick","Arturo","Alejandro","Jackie","Joey","Nick","Luther","Wendell","Jeremiah","Evan","Julius","Dana","Donnie","Otis","Shannon","Trevor","Oliver","Luke","Homer","Gerard","Doug","Kenny","Hubert","Angelo","Shaun","Lyle","Matt","Lynn","Alfonso","Orlando","Rex","Carlton","Ernesto","Cameron","Neal","Pablo","Lorenzo","Omar","Wilbur","Blake","Grant","Horace","Roderick","Kerry","Abraham","Willis","Rickey","Jean","Ira","Andres","Cesar","Johnathan","Malcolm","Rudolph","Damon","Kelvin","Rudy","Preston","Alton","Archie","Marco","Wm","Pete","Randolph","Garry","Geoffrey","Jonathon","Felipe","Bennie","Gerardo","Ed","Dominic","Robin","Loren","Delbert","Colin","Guillermo","Earnest","Lucas","Benny","Noel","Spencer","Rodolfo","Myron","Edmund","Garrett","Salvatore","Cedric","Lowell","Gregg","Sherman","Wilson","Devin","Sylvester","Kim","Roosevelt","Israel","Jermaine","Forrest","Wilbert","Leland","Simon","Guadalupe","Clark","Irving","Carroll","Bryant","Owen","Rufus","Woodrow","Sammy","Kristopher","Mack","Levi","Marcos","Gustavo","Jake","Lionel","Marty","Taylor","Ellis","Dallas","Gilberto","Clint","Nicolas","Laurence","Ismael","Orville","Drew","Jody","Ervin","Dewey","Al","Wilfred","Josh","Hugo","Ignacio","Caleb","Tomas","Sheldon","Erick","Frankie","Stewart","Doyle","Darrel","Rogelio","Terence","Santiago","Alonzo","Elias","Bert","Elbert","Ramiro","Conrad","Pat","Noah","Grady","Phil","Cornelius","Lamar","Rolando","Clay","Percy","Dexter","Bradford","Merle","Darin","Amos","Terrell","Moses","Irvin","Saul","Roman","Darnell","Randal","Tommie","Timmy","Darrin","Winston","Brendan","Toby","Van","Abel","Dominick","Boyd","Courtney","Jan","Emilio","Elijah","Cary","Domingo","Santos","Aubrey","Emmett","Marlon","Emanuel","Jerald","Edmond"]},an=wc;var Zs=["Abbott","Abernathy","Abshire","Adams","Altenwerth","Anderson","Ankunding","Armstrong","Auer","Aufderhar","Bahringer","Bailey","Balistreri","Barrows","Bartell","Bartoletti","Barton","Bashirian","Batz","Bauch","Baumbach","Bayer","Beahan","Beatty","Bechtelar","Becker","Bednar","Beer","Beier","Berge","Bergnaum","Bergstrom","Bernhard","Bernier","Bins","Blanda","Blick","Block","Bode","Boehm","Bogan","Bogisich","Borer","Bosco","Botsford","Boyer","Boyle","Bradtke","Brakus","Braun","Breitenberg","Brekke","Brown","Bruen","Buckridge","Carroll","Carter","Cartwright","Casper","Cassin","Champlin","Christiansen","Cole","Collier","Collins","Conn","Connelly","Conroy","Considine","Corkery","Cormier","Corwin","Cremin","Crist","Crona","Cronin","Crooks","Cruickshank","Cummerata","Cummings","Dach","D'Amore","Daniel","Dare","Daugherty","Davis","Deckow","Denesik","Dibbert","Dickens","Dicki","Dickinson","Dietrich","Donnelly","Dooley","Douglas","Doyle","DuBuque","Durgan","Ebert","Effertz","Emard","Emmerich","Erdman","Ernser","Fadel","Fahey","Farrell","Fay","Feeney","Feest","Feil","Ferry","Fisher","Flatley","Frami","Franecki","Friesen","Fritsch","Funk","Gaylord","Gerhold","Gerlach","Gibson","Gislason","Gleason","Gleichner","Glover","Goldner","Goodwin","Gorczany","Gottlieb","Goyette","Grady","Graham","Grant","Green","Greenfelder","Greenholt","Grimes","Gulgowski","Gusikowski","Gutkowski","Gutmann","Haag","Hackett","Hagenes","Hahn","Haley","Halvorson","Hamill","Hammes","Hand","Hane","Hansen","Harber","Harris","Hartmann","Harvey","Hauck","Hayes","Heaney","Heathcote","Hegmann","Heidenreich","Heller","Herman","Hermann","Hermiston","Herzog","Hessel","Hettinger","Hickle","Hilll","Hills","Hilpert","Hintz","Hirthe","Hodkiewicz","Hoeger","Homenick","Hoppe","Howe","Howell","Hudson","Huel","Huels","Hyatt","Jacobi","Jacobs","Jacobson","Jakubowski","Jaskolski","Jast","Jenkins","Jerde","Johns","Johnson","Johnston","Jones","Kassulke","Kautzer","Keebler","Keeling","Kemmer","Kerluke","Kertzmann","Kessler","Kiehn","Kihn","Kilback","King","Kirlin","Klein","Kling","Klocko","Koch","Koelpin","Koepp","Kohler","Konopelski","Koss","Kovacek","Kozey","Krajcik","Kreiger","Kris","Kshlerin","Kub","Kuhic","Kuhlman","Kuhn","Kulas","Kunde","Kunze","Kuphal","Kutch","Kuvalis","Labadie","Lakin","Lang","Langosh","Langworth","Larkin","Larson","Leannon","Lebsack","Ledner","Leffler","Legros","Lehner","Lemke","Lesch","Leuschke","Lind","Lindgren","Littel","Little","Lockman","Lowe","Lubowitz","Lueilwitz","Luettgen","Lynch","Macejkovic","MacGyver","Maggio","Mann","Mante","Marks","Marquardt","Marvin","Mayer","Mayert","McClure","McCullough","McDermott","McGlynn","McKenzie","McLaughlin","Medhurst","Mertz","Metz","Miller","Mills","Mitchell","Moen","Mohr","Monahan","Moore","Morar","Morissette","Mosciski","Mraz","Mueller","Muller","Murazik","Murphy","Murray","Nader","Nicolas","Nienow","Nikolaus","Nitzsche","Nolan","Oberbrunner","O'Connell","O'Conner","O'Hara","O'Keefe","O'Kon","Okuneva","Olson","Ondricka","O'Reilly","Orn","Ortiz","Osinski","Pacocha","Padberg","Pagac","Parisian","Parker","Paucek","Pfannerstill","Pfeffer","Pollich","Pouros","Powlowski","Predovic","Price","Prohaska","Prosacco","Purdy","Quigley","Quitzon","Rath","Ratke","Rau","Raynor","Reichel","Reichert","Reilly","Reinger","Rempel","Renner","Reynolds","Rice","Rippin","Ritchie","Robel","Roberts","Rodriguez","Rogahn","Rohan","Rolfson","Romaguera","Roob","Rosenbaum","Rowe","Ruecker","Runolfsdottir","Runolfsson","Runte","Russel","Rutherford","Ryan","Sanford","Satterfield","Sauer","Sawayn","Schaden","Schaefer","Schamberger","Schiller","Schimmel","Schinner","Schmeler","Schmidt","Schmitt","Schneider","Schoen","Schowalter","Schroeder","Schulist","Schultz","Schumm","Schuppe","Schuster","Senger","Shanahan","Shields","Simonis","Sipes","Skiles","Smith","Smitham","Spencer","Spinka","Sporer","Stamm","Stanton","Stark","Stehr","Steuber","Stiedemann","Stokes","Stoltenberg","Stracke","Streich","Stroman","Strosin","Swaniawski","Swift","Terry","Thiel","Thompson","Tillman","Torp","Torphy","Towne","Toy","Trantow","Tremblay","Treutel","Tromp","Turcotte","Turner","Ullrich","Upton","Vandervort","Veum","Volkman","Von","VonRueden","Waelchi","Walker","Walsh","Walter","Ward","Waters","Watsica","Weber","Wehner","Weimann","Weissnat","Welch","West","White","Wiegand","Wilderman","Wilkinson","Will","Williamson","Willms","Windler","Wintheiser","Wisoky","Wisozk","Witting","Wiza","Wolf","Wolff","Wuckert","Wunsch","Wyman","Yost","Yundt","Zboncak","Zemlak","Ziemann","Zieme","Zulauf"],vc={general:Zs,female:Zs,male:Zs},nn=vc;var _c={binary:["Female","Male"],pool:["Asexual","Female to male trans man","Female to male transgender man","Female to male transsexual man","F2M","Gender neutral","Hermaphrodite","Intersex man","Intersex person","Intersex woman","Male to female trans woman","Male to female transgender woman","Male to female transsexual woman","Man","M2F","Polygender","T* man","T* woman","Two* person","Two-spirit person","Woman","Agender","Androgyne","Androgynes","Androgynous","Bigender","Cis","Cis Female","Cis Male","Cis Man","Cis Woman","Cisgender","Cisgender Female","Cisgender Male","Cisgender Man","Cisgender Woman","Female to Male","FTM","Gender Fluid","Gender Nonconforming","Gender Questioning","Gender Variant","Genderqueer","Intersex","Male to Female","MTF","Neither","Neutrois","Non-binary","Other","Pangender","Trans","Trans Female","Trans Male","Trans Man","Trans Person","Trans*Female","Trans*Male","Trans*Man","Trans*Person","Trans*Woman","Transexual","Transexual Female","Transexual Male","Transexual Man","Transexual Person","Transexual Woman","Transgender Female","Transgender Person","Transmasculine","Two-spirit"]},on=_c;var Sc={descriptor:["Lead","Senior","Direct","Corporate","Dynamic","Future","Product","National","Regional","District","Central","Global","Customer","Investor","Dynamic","International","Legacy","Forward","Internal","Human","Chief","Principal"],level:["Solutions","Program","Brand","Security","Research","Marketing","Directives","Implementation","Integration","Functionality","Response","Paradigm","Tactics","Identity","Markets","Group","Division","Applications","Optimization","Operations","Infrastructure","Intranet","Communications","Web","Branding","Quality","Assurance","Mobility","Accounts","Data","Creative","Configuration","Accountability","Interactions","Factors","Usability","Metrics"],job:["Supervisor","Associate","Executive","Liaison","Officer","Manager","Engineer","Specialist","Director","Coordinator","Administrator","Architect","Analyst","Designer","Planner","Orchestrator","Technician","Developer","Producer","Consultant","Assistant","Facilitator","Agent","Representative","Strategist"]},ln=Sc;var Qs=["Jr.","Sr.","I","II","III","IV","V","MD","DDS","PhD","DVM"],Ac={gender:on,firstName:an,lastName:nn,title:ln,suffix:{general:Qs,female:Qs,male:Qs},prefix:{general:["Mr.","Mrs.","Ms.","Miss","Dr."],female:["Mrs.","Ms.","Miss"],male:["Mr.","Dr."]},templates:["#{prefix} #{first_name} #{last_name}","#{first_name} #{last_name} #{suffix}","#{first_name} #{last_name}","#{first_name} #{last_name}","#{male_first_name} #{last_name}","#{female_first_name} #{last_name}"]},cn=Ac;var dn=["abandoned","able","absolute","adorable","adventurous","academic","acceptable","acclaimed","accomplished","accurate","aching","acidic","acrobatic","active","actual","adept","admirable","admired","adolescent","adorable","adored","advanced","afraid","affectionate","aged","aggravating","aggressive","agile","agitated","agonizing","agreeable","ajar","alarmed","alarming","alert","alienated","alive","all","altruistic","amazing","ambitious","ample","amused","amusing","anchored","ancient","angelic","angry","anguished","animated","annual","another","antique","anxious","any","apprehensive","appropriate","apt","arctic","arid","aromatic","artistic","ashamed","assured","astonishing","athletic","attached","attentive","attractive","austere","authentic","authorized","automatic","avaricious","average","aware","awesome","awful","awkward","babyish","bad","back","baggy","bare","barren","basic","beautiful","belated","beloved","beneficial","better","best","bewitched","big","big-hearted","biodegradable","bite-sized","bitter","black","black-and-white","bland","blank","blaring","bleak","blind","blissful","blond","blue","blushing","bogus","boiling","bold","bony","boring","bossy","both","bouncy","bountiful","bowed","brave","breakable","brief","bright","brilliant","brisk","broken","bronze","brown","bruised","bubbly","bulky","bumpy","buoyant","burdensome","burly","bustling","busy","buttery","buzzing","calculating","calm","candid","canine","capital","carefree","careful","careless","caring","cautious","cavernous","celebrated","charming","cheap","cheerful","cheery","chief","chilly","chubby","circular","classic","clean","clear","clear-cut","clever","close","closed","cloudy","clueless","clumsy","cluttered","coarse","cold","colorful","colorless","colossal","comfortable","common","compassionate","competent","complete","complex","complicated","composed","concerned","concrete","confused","conscious","considerate","constant","content","conventional","cooked","cool","cooperative","coordinated","corny","corrupt","costly","courageous","courteous","crafty","crazy","creamy","creative","creepy","criminal","crisp","critical","crooked","crowded","cruel","crushing","cuddly","cultivated","cultured","cumbersome","curly","curvy","cute","cylindrical","damaged","damp","dangerous","dapper","daring","darling","dark","dazzling","dead","deadly","deafening","dear","dearest","decent","decimal","decisive","deep","defenseless","defensive","defiant","deficient","definite","definitive","delayed","delectable","delicious","delightful","delirious","demanding","dense","dental","dependable","dependent","descriptive","deserted","detailed","determined","devoted","different","difficult","digital","diligent","dim","dimpled","dimwitted","direct","disastrous","discrete","disfigured","disgusting","disloyal","dismal","distant","downright","dreary","dirty","disguised","dishonest","dismal","distant","distinct","distorted","dizzy","dopey","doting","double","downright","drab","drafty","dramatic","dreary","droopy","dry","dual","dull","dutiful","each","eager","earnest","early","easy","easy-going","ecstatic","edible","educated","elaborate","elastic","elated","elderly","electric","elegant","elementary","elliptical","embarrassed","embellished","eminent","emotional","empty","enchanted","enchanting","energetic","enlightened","enormous","enraged","entire","envious","equal","equatorial","essential","esteemed","ethical","euphoric","even","evergreen","everlasting","every","evil","exalted","excellent","exemplary","exhausted","excitable","excited","exciting","exotic","expensive","experienced","expert","extraneous","extroverted","extra-large","extra-small","fabulous","failing","faint","fair","faithful","fake","false","familiar","famous","fancy","fantastic","far","faraway","far-flung","far-off","fast","fat","fatal","fatherly","favorable","favorite","fearful","fearless","feisty","feline","female","feminine","few","fickle","filthy","fine","finished","firm","first","firsthand","fitting","fixed","flaky","flamboyant","flashy","flat","flawed","flawless","flickering","flimsy","flippant","flowery","fluffy","fluid","flustered","focused","fond","foolhardy","foolish","forceful","forked","formal","forsaken","forthright","fortunate","fragrant","frail","frank","frayed","free","french","fresh","frequent","friendly","frightened","frightening","frigid","frilly","frizzy","frivolous","front","frosty","frozen","frugal","fruitful","full","fumbling","functional","funny","fussy","fuzzy","gargantuan","gaseous","general","generous","gentle","genuine","giant","giddy","gigantic","gifted","giving","glamorous","glaring","glass","gleaming","gleeful","glistening","glittering","gloomy","glorious","glossy","glum","golden","good","good-natured","gorgeous","graceful","gracious","grand","grandiose","granular","grateful","grave","gray","great","greedy","green","gregarious","grim","grimy","gripping","grizzled","gross","grotesque","grouchy","grounded","growing","growling","grown","grubby","gruesome","grumpy","guilty","gullible","gummy","hairy","half","handmade","handsome","handy","happy","happy-go-lucky","hard","hard-to-find","harmful","harmless","harmonious","harsh","hasty","hateful","haunting","healthy","heartfelt","hearty","heavenly","heavy","hefty","helpful","helpless","hidden","hideous","high","high-level","hilarious","hoarse","hollow","homely","honest","honorable","honored","hopeful","horrible","hospitable","hot","huge","humble","humiliating","humming","humongous","hungry","hurtful","husky","icky","icy","ideal","idealistic","identical","idle","idiotic","idolized","ignorant","ill","illegal","ill-fated","ill-informed","illiterate","illustrious","imaginary","imaginative","immaculate","immaterial","immediate","immense","impassioned","impeccable","impartial","imperfect","imperturbable","impish","impolite","important","impossible","impractical","impressionable","impressive","improbable","impure","inborn","incomparable","incompatible","incomplete","inconsequential","incredible","indelible","inexperienced","indolent","infamous","infantile","infatuated","inferior","infinite","informal","innocent","insecure","insidious","insignificant","insistent","instructive","insubstantial","intelligent","intent","intentional","interesting","internal","international","intrepid","ironclad","irresponsible","irritating","itchy","jaded","jagged","jam-packed","jaunty","jealous","jittery","joint","jolly","jovial","joyful","joyous","jubilant","judicious","juicy","jumbo","junior","jumpy","juvenile","kaleidoscopic","keen","key","kind","kindhearted","kindly","klutzy","knobby","knotty","knowledgeable","knowing","known","kooky","kosher","lame","lanky","large","last","lasting","late","lavish","lawful","lazy","leading","lean","leafy","left","legal","legitimate","light","lighthearted","likable","likely","limited","limp","limping","linear","lined","liquid","little","live","lively","livid","loathsome","lone","lonely","long","long-term","loose","lopsided","lost","loud","lovable","lovely","loving","low","loyal","lucky","lumbering","luminous","lumpy","lustrous","luxurious","mad","made-up","magnificent","majestic","major","male","mammoth","married","marvelous","masculine","massive","mature","meager","mealy","mean","measly","meaty","medical","mediocre","medium","meek","mellow","melodic","memorable","menacing","merry","messy","metallic","mild","milky","mindless","miniature","minor","minty","miserable","miserly","misguided","misty","mixed","modern","modest","moist","monstrous","monthly","monumental","moral","mortified","motherly","motionless","mountainous","muddy","muffled","multicolored","mundane","murky","mushy","musty","muted","mysterious","naive","narrow","nasty","natural","naughty","nautical","near","neat","necessary","needy","negative","neglected","negligible","neighboring","nervous","new","next","nice","nifty","nimble","nippy","nocturnal","noisy","nonstop","normal","notable","noted","noteworthy","novel","noxious","numb","nutritious","nutty","obedient","obese","oblong","oily","oblong","obvious","occasional","odd","oddball","offbeat","offensive","official","old","old-fashioned","only","open","optimal","optimistic","opulent","orange","orderly","organic","ornate","ornery","ordinary","original","other","our","outlying","outgoing","outlandish","outrageous","outstanding","oval","overcooked","overdue","overjoyed","overlooked","palatable","pale","paltry","parallel","parched","partial","passionate","past","pastel","peaceful","peppery","perfect","perfumed","periodic","perky","personal","pertinent","pesky","pessimistic","petty","phony","physical","piercing","pink","pitiful","plain","plaintive","plastic","playful","pleasant","pleased","pleasing","plump","plush","polished","polite","political","pointed","pointless","poised","poor","popular","portly","posh","positive","possible","potable","powerful","powerless","practical","precious","present","prestigious","pretty","precious","previous","pricey","prickly","primary","prime","pristine","private","prize","probable","productive","profitable","profuse","proper","proud","prudent","punctual","pungent","puny","pure","purple","pushy","putrid","puzzled","puzzling","quaint","qualified","quarrelsome","quarterly","queasy","querulous","questionable","quick","quick-witted","quiet","quintessential","quirky","quixotic","quizzical","radiant","ragged","rapid","rare","rash","raw","recent","reckless","rectangular","ready","real","realistic","reasonable","red","reflecting","regal","regular","reliable","relieved","remarkable","remorseful","remote","repentant","required","respectful","responsible","repulsive","revolving","rewarding","rich","rigid","right","ringed","ripe","roasted","robust","rosy","rotating","rotten","rough","round","rowdy","royal","rubbery","rundown","ruddy","rude","runny","rural","rusty","sad","safe","salty","same","sandy","sane","sarcastic","sardonic","satisfied","scaly","scarce","scared","scary","scented","scholarly","scientific","scornful","scratchy","scrawny","second","secondary","second-hand","secret","self-assured","self-reliant","selfish","sentimental","separate","serene","serious","serpentine","several","severe","shabby","shadowy","shady","shallow","shameful","shameless","sharp","shimmering","shiny","shocked","shocking","shoddy","short","short-term","showy","shrill","shy","sick","silent","silky","silly","silver","similar","simple","simplistic","sinful","single","sizzling","skeletal","skinny","sleepy","slight","slim","slimy","slippery","slow","slushy","small","smart","smoggy","smooth","smug","snappy","snarling","sneaky","sniveling","snoopy","sociable","soft","soggy","solid","somber","some","spherical","sophisticated","sore","sorrowful","soulful","soupy","sour","spanish","sparkling","sparse","specific","spectacular","speedy","spicy","spiffy","spirited","spiteful","splendid","spotless","spotted","spry","square","squeaky","squiggly","stable","staid","stained","stale","standard","starchy","stark","starry","steep","sticky","stiff","stimulating","stingy","stormy","straight","strange","steel","strict","strident","striking","striped","strong","studious","stunning","stupendous","stupid","sturdy","stylish","subdued","submissive","substantial","subtle","suburban","sudden","sugary","sunny","super","superb","superficial","superior","supportive","sure-footed","surprised","suspicious","svelte","sweaty","sweet","sweltering","swift","sympathetic","tall","talkative","tame","tan","tangible","tart","tasty","tattered","taut","tedious","teeming","tempting","tender","tense","tepid","terrible","terrific","testy","thankful","that","these","thick","thin","third","thirsty","this","thorough","thorny","those","thoughtful","threadbare","thrifty","thunderous","tidy","tight","timely","tinted","tiny","tired","torn","total","tough","traumatic","treasured","tremendous","tragic","trained","tremendous","triangular","tricky","trifling","trim","trivial","troubled","true","trusting","trustworthy","trusty","truthful","tubby","turbulent","twin","ugly","ultimate","unacceptable","unaware","uncomfortable","uncommon","unconscious","understated","unequaled","uneven","unfinished","unfit","unfolded","unfortunate","unhappy","unhealthy","uniform","unimportant","unique","united","unkempt","unknown","unlawful","unlined","unlucky","unnatural","unpleasant","unrealistic","unripe","unruly","unselfish","unsightly","unsteady","unsung","untidy","untimely","untried","untrue","unused","unusual","unwelcome","unwieldy","unwilling","unwitting","unwritten","upbeat","upright","upset","urban","usable","used","useful","useless","utilized","utter","vacant","vague","vain","valid","valuable","vapid","variable","vast","velvety","venerated","vengeful","verifiable","vibrant","vicious","victorious","vigilant","vigorous","villainous","violet","violent","virtual","virtuous","visible","vital","vivacious","vivid","voluminous","wan","warlike","warm","warmhearted","warped","wary","wasteful","watchful","waterlogged","watery","wavy","wealthy","weak","weary","webbed","wee","weekly","weepy","weighty","weird","welcome","well-documented","well-groomed","well-informed","well-lit","well-made","well-off","well-to-do","well-worn","wet","which","whimsical","whirlwind","whispered","white","whole","whopping","wicked","wide","wide-eyed","wiggly","wild","willing","wilted","winding","windy","winged","wiry","wise","witty","wobbly","woeful","wonderful","wooden","woozy","wordy","worldly","worn","worried","worrisome","worse","worst","worthless","worthwhile","worthy","wrathful","wretched","writhing","wrong","wry","yawning","yearly","yellow","yellowish","young","youthful","yummy","zany","zealous","zesty","zigzag"];var pn=["abnormally","absentmindedly","accidentally","acidly","actually","adventurously","afterwards","almost","always","angrily","annually","anxiously","arrogantly","awkwardly","badly","bashfully","beautifully","bitterly","bleakly","blindly","blissfully","boastfully","boldly","bravely","briefly","brightly","briskly","broadly","busily","calmly","carefully","carelessly","cautiously","certainly","cheerfully","clearly","cleverly","closely","coaxingly","colorfully","commonly","continually","coolly","correctly","courageously","crossly","cruelly","curiously","daily","daintily","dearly","deceivingly","deeply","defiantly","deliberately","delightfully","diligently","dimly","doubtfully","dreamily","easily","elegantly","energetically","enormously","enthusiastically","equally","especially","even","evenly","eventually","exactly","excitedly","extremely","fairly","faithfully","famously","far","fast","fatally","ferociously","fervently","fiercely","fondly","foolishly","fortunately","frankly","frantically","freely","frenetically","frightfully","fully","furiously","generally","generously","gently","gladly","gleefully","gracefully","gratefully","greatly","greedily","happily","hastily","healthily","heavily","helpfully","helplessly","highly","honestly","hopelessly","hourly","hungrily","immediately","innocently","inquisitively","instantly","intensely","intently","interestingly","inwardly","irritably","jaggedly","jealously","joshingly","jovially","joyfully","joyously","jubilantly","judgementally","justly","keenly","kiddingly","kindheartedly","kindly","kissingly","knavishly","knottily","knowingly","knowledgeably","kookily","lazily","less","lightly","likely","limply","lively","loftily","longingly","loosely","loudly","lovingly","loyally","madly","majestically","meaningfully","mechanically","merrily","miserably","mockingly","monthly","more","mortally","mostly","mysteriously","naturally","nearly","neatly","needily","nervously","never","nicely","noisily","not","obediently","obnoxiously","oddly","offensively","officially","often","only","openly","optimistically","overconfidently","owlishly","painfully","partially","patiently","perfectly","physically","playfully","politely","poorly","positively","potentially","powerfully","promptly","properly","punctually","quaintly","quarrelsomely","queasily","queerly","questionably","questioningly","quicker","quickly","quietly","quirkily","quizzically","rapidly","rarely","readily","really","reassuringly","recklessly","regularly","reluctantly","repeatedly","reproachfully","restfully","righteously","rightfully","rigidly","roughly","rudely","sadly","safely","scarcely","scarily","searchingly","sedately","seemingly","seldom","selfishly","separately","seriously","shakily","sharply","sheepishly","shrilly","shyly","silently","sleepily","slowly","smoothly","softly","solemnly","solidly","sometimes","soon","speedily","stealthily","sternly","strictly","successfully","suddenly","surprisingly","suspiciously","sweetly","swiftly","sympathetically","tenderly","tensely","terribly","thankfully","thoroughly","thoughtfully","tightly","tomorrow","too","tremendously","triumphantly","truly","truthfully","ultimately","unabashedly","unaccountably","unbearably","unethically","unexpectedly","unfortunately","unimpressively","unnaturally","unnecessarily","upbeat","upliftingly","upright","upside-down","upward","upwardly","urgently","usefully","uselessly","usually","utterly","vacantly","vaguely","vainly","valiantly","vastly","verbally","very","viciously","victoriously","violently","vivaciously","voluntarily","warmly","weakly","wearily","well","wetly","wholly","wildly","willfully","wisely","woefully","wonderfully","worriedly","wrongly","yawningly","yearly","yearningly","yesterday","yieldingly","youthfully"];var un=["after","after all","although","and","as","as a result","as if","as long as","as much as","as soon as","as though","because","before","but","consequently","even","even if","even though","finally","for","for example","furthermore","hence","however","if","if only","if then","if when","in addition","in fact","in order that","inasmuch","incidentally","indeed","instead","just as","lest","likewise","meanwhile","nor","now","now since","now that","now when","once","or","provided","provided that","rather than","since","so","so that","supposing","that","though","until","whenever","whereas","wherever","which","who","yet"];var hn=["yuck","oh","phooey","blah","boo","whoa","yowza","huzzah","boo hoo","fooey","geez","pfft","ew","ah","yum","brr","hm","yahoo","aha","woot","drat","gah","meh","psst","aw","ugh","yippee","eek","gee","bah","gadzooks","duh","ha","mmm","tsk tsk","ouch","phew","ack","uh-huh","gosh","hmph","pish","zowie","er","ick","oof","um"];var mn=["ATM","CD","SUV","TV","aardvark","abacus","abbey","abbreviation","abdomen","ability","abnormality","abolishment","abortion","abrogation","absence","abundance","abuse","academics","academy","accelerant","accelerator","accent","acceptance","access","accessory","accident","accommodation","accompanist","accomplishment","accord","accordance","accordion","account","accountability","accountant","accounting","accuracy","accusation","acetate","achievement","achiever","acid","acknowledgment","acorn","acoustics","acquaintance","acquisition","acre","acrylic","act","action","activation","activist","activity","actor","actress","acupuncture","ad","adaptation","adapter","addiction","addition","address","adjective","adjustment","admin","administration","administrator","admire","admission","adobe","adoption","adrenalin","adrenaline","adult","adulthood","advance","advancement","advantage","advent","adverb","advertisement","advertising","advice","adviser","advocacy","advocate","affair","affect","affidavit","affiliate","affinity","afoul","afterlife","aftermath","afternoon","aftershave","aftershock","afterthought","age","agency","agenda","agent","aggradation","aggression","aglet","agony","agreement","agriculture","aid","aide","aim","air","airbag","airbus","aircraft","airfare","airfield","airforce","airline","airmail","airman","airplane","airport","airship","airspace","alarm","alb","albatross","album","alcohol","alcove","alder","ale","alert","alfalfa","algebra","algorithm","alias","alibi","alien","allegation","allergist","alley","alliance","alligator","allocation","allowance","alloy","alluvium","almanac","almighty","almond","alpaca","alpenglow","alpenhorn","alpha","alphabet","altar","alteration","alternative","altitude","alto","aluminium","aluminum","amazement","amazon","ambassador","amber","ambience","ambiguity","ambition","ambulance","amendment","amenity","ammunition","amnesty","amount","amusement","anagram","analgesia","analog","analogue","analogy","analysis","analyst","analytics","anarchist","anarchy","anatomy","ancestor","anchovy","android","anesthesiologist","anesthesiology","angel","anger","angina","angiosperm","angle","angora","angstrom","anguish","animal","anime","anise","ankle","anklet","anniversary","announcement","annual","anorak","answer","ant","anteater","antecedent","antechamber","antelope","antennae","anterior","anthropology","antibody","anticipation","anticodon","antigen","antique","antiquity","antler","antling","anxiety","anybody","anyone","anything","anywhere","apartment","ape","aperitif","apology","app","apparatus","apparel","appeal","appearance","appellation","appendix","appetiser","appetite","appetizer","applause","apple","applewood","appliance","application","appointment","appreciation","apprehension","approach","appropriation","approval","apricot","apron","apse","aquarium","aquifer","arcade","arch","arch-rival","archaeologist","archaeology","archeology","archer","architect","architecture","archives","area","arena","argument","arithmetic","ark","arm","arm-rest","armadillo","armament","armchair","armoire","armor","armour","armpit","armrest","army","arrangement","array","arrest","arrival","arrogance","arrow","art","artery","arthur","artichoke","article","artifact","artificer","artist","ascend","ascent","ascot","ash","ashram","ashtray","aside","asparagus","aspect","asphalt","aspic","ass","assassination","assault","assembly","assertion","assessment","asset","assignment","assist","assistance","assistant","associate","association","assumption","assurance","asterisk","astrakhan","astrolabe","astrologer","astrology","astronomy","asymmetry","atelier","atheist","athlete","athletics","atmosphere","atom","atrium","attachment","attack","attacker","attainment","attempt","attendance","attendant","attention","attenuation","attic","attitude","attorney","attraction","attribute","auction","audience","audit","auditorium","aunt","authentication","authenticity","author","authorisation","authority","authorization","auto","autoimmunity","automation","automaton","autumn","availability","avalanche","avenue","average","avocado","award","awareness","awe","axis","azimuth","babe","baboon","babushka","baby","bachelor","back","back-up","backbone","backburn","backdrop","background","backpack","backup","backyard","bacon","bacterium","badge","badger","bafflement","bag","bagel","baggage","baggie","baggy","bagpipe","bail","bait","bake","baker","bakery","bakeware","balaclava","balalaika","balance","balcony","ball","ballet","balloon","balloonist","ballot","ballpark","bamboo","ban","banana","band","bandana","bandanna","bandolier","bandwidth","bangle","banjo","bank","bankbook","banker","banking","bankruptcy","banner","banquette","banyan","baobab","bar","barbecue","barbeque","barber","barbiturate","bargain","barge","baritone","barium","bark","barley","barn","barometer","barracks","barrage","barrel","barrier","barstool","bartender","base","baseball","baseboard","baseline","basement","basics","basil","basin","basis","basket","basketball","bass","bassinet","bassoon","bat","bath","bather","bathhouse","bathrobe","bathroom","bathtub","battalion","batter","battery","batting","battle","battleship","bay","bayou","beach","bead","beak","beam","bean","beancurd","beanie","beanstalk","bear","beard","beast","beastie","beat","beating","beauty","beaver","beck","bed","bedrock","bedroom","bee","beech","beef","beer","beet","beetle","beggar","beginner","beginning","begonia","behalf","behavior","behaviour","beheading","behest","behold","being","belfry","belief","believer","bell","belligerency","bellows","belly","belt","bench","bend","beneficiary","benefit","beret","berry","best-seller","bestseller","bet","beverage","beyond","bias","bibliography","bicycle","bid","bidder","bidding","bidet","bifocals","bijou","bike","bikini","bill","billboard","billing","billion","bin","binoculars","biology","biopsy","biosphere","biplane","birch","bird","bird-watcher","birdbath","birdcage","birdhouse","birth","birthday","biscuit","bit","bite","bitten","bitter","black","blackberry","blackbird","blackboard","blackfish","blackness","bladder","blade","blame","blank","blanket","blast","blazer","blend","blessing","blight","blind","blinker","blister","blizzard","block","blocker","blog","blogger","blood","bloodflow","bloom","bloomer","blossom","blouse","blow","blowgun","blowhole","blue","blueberry","blush","boar","board","boat","boatload","boatyard","bob","bobcat","body","bog","bolero","bolt","bomb","bomber","bombing","bond","bonding","bondsman","bone","bonfire","bongo","bonnet","bonsai","bonus","boogeyman","book","bookcase","bookend","booking","booklet","bookmark","boolean","boom","boon","boost","booster","boot","bootee","bootie","booty","border","bore","borrower","borrowing","bosom","boss","botany","bother","bottle","bottling","bottom","bottom-line","boudoir","bough","boulder","boulevard","boundary","bouquet","bourgeoisie","bout","boutique","bow","bower","bowl","bowler","bowling","bowtie","box","boxer","boxspring","boy","boycott","boyfriend","boyhood","boysenberry","bra","brace","bracelet","bracket","brain","brake","bran","branch","brand","brandy","brass","brassiere","bratwurst","bread","breadcrumb","breadfruit","break","breakdown","breakfast","breakpoint","breakthrough","breast","breastplate","breath","breeze","brewer","bribery","brick","bricklaying","bride","bridge","brief","briefing","briefly","briefs","brilliant","brink","brisket","broad","broadcast","broccoli","brochure","brocolli","broiler","broker","bronchitis","bronco","bronze","brooch","brood","brook","broom","brother","brother-in-law","brow","brown","brownie","browser","browsing","brunch","brush","brushfire","brushing","bubble","buck","bucket","buckle","buckwheat","bud","buddy","budget","buffalo","buffer","buffet","bug","buggy","bugle","builder","building","bulb","bulk","bull","bull-fighter","bulldozer","bullet","bump","bumper","bun","bunch","bungalow","bunghole","bunkhouse","burden","bureau","burglar","burial","burlesque","burn","burn-out","burning","burrito","burro","burrow","burst","bus","bush","business","businessman","bust","bustle","butane","butcher","butler","butter","butterfly","button","buy","buyer","buying","buzz","buzzard","c-clamp","cabana","cabbage","cabin","cabinet","cable","caboose","cacao","cactus","caddy","cadet","cafe","caffeine","caftan","cage","cake","calcification","calculation","calculator","calculus","calendar","calf","caliber","calibre","calico","call","calm","calorie","camel","cameo","camera","camp","campaign","campaigning","campanile","camper","campus","can","canal","cancer","candelabra","candidacy","candidate","candle","candy","cane","cannibal","cannon","canoe","canon","canopy","cantaloupe","canteen","canvas","cap","capability","capacity","cape","caper","capital","capitalism","capitulation","capon","cappelletti","cappuccino","captain","caption","captor","car","carabao","caramel","caravan","carbohydrate","carbon","carboxyl","card","cardboard","cardigan","care","career","cargo","caribou","carload","carnation","carnival","carol","carotene","carp","carpenter","carpet","carpeting","carport","carriage","carrier","carrot","carry","cart","cartel","carter","cartilage","cartload","cartoon","cartridge","carving","cascade","case","casement","cash","cashew","cashier","casino","casket","cassava","casserole","cassock","cast","castanet","castle","casualty","cat","catacomb","catalogue","catalysis","catalyst","catamaran","catastrophe","catch","catcher","category","caterpillar","cathedral","cation","catsup","cattle","cauliflower","causal","cause","causeway","caution","cave","caviar","cayenne","ceiling","celebration","celebrity","celeriac","celery","cell","cellar","cello","celsius","cement","cemetery","cenotaph","census","cent","center","centimeter","centre","centurion","century","cephalopod","ceramic","ceramics","cereal","ceremony","certainty","certificate","certification","cesspool","chafe","chain","chainstay","chair","chairlift","chairman","chairperson","chaise","chalet","chalice","chalk","challenge","chamber","champagne","champion","championship","chance","chandelier","change","channel","chaos","chap","chapel","chaplain","chapter","character","characteristic","characterization","chard","charge","charger","charity","charlatan","charm","charset","chart","charter","chasm","chassis","chastity","chasuble","chateau","chatter","chauffeur","chauvinist","check","checkbook","checking","checkout","checkroom","cheddar","cheek","cheer","cheese","cheesecake","cheetah","chef","chem","chemical","chemistry","chemotaxis","cheque","cherry","chess","chest","chestnut","chick","chicken","chicory","chief","chiffonier","child","childbirth","childhood","chili","chill","chime","chimpanzee","chin","chinchilla","chino","chip","chipmunk","chit-chat","chivalry","chive","chives","chocolate","choice","choir","choker","cholesterol","choosing","chop","chops","chopstick","chopsticks","chord","chorus","chow","chowder","chrome","chromolithograph","chronicle","chronograph","chronometer","chrysalis","chub","chuck","chug","church","churn","chutney","cicada","cigarette","cilantro","cinder","cinema","cinnamon","circadian","circle","circuit","circulation","circumference","circumstance","cirrhosis","cirrus","citizen","citizenship","citron","citrus","city","civilian","civilisation","civilization","claim","clam","clamp","clan","clank","clapboard","clarification","clarinet","clarity","clasp","class","classic","classification","classmate","classroom","clause","clave","clavicle","clavier","claw","clay","cleaner","clearance","clearing","cleat","cleavage","clef","cleft","clergyman","cleric","clerk","click","client","cliff","climate","climb","clinic","clip","clipboard","clipper","cloak","cloakroom","clock","clockwork","clogs","cloister","clone","close","closet","closing","closure","cloth","clothes","clothing","cloud","cloudburst","clove","clover","cloves","club","clue","cluster","clutch","co-producer","coach","coal","coalition","coast","coaster","coat","cob","cobbler","cobweb","cock","cockpit","cockroach","cocktail","cocoa","coconut","cod","code","codepage","codling","codon","codpiece","coevolution","cofactor","coffee","coffin","cohesion","cohort","coil","coin","coincidence","coinsurance","coke","cold","coleslaw","coliseum","collaboration","collagen","collapse","collar","collard","collateral","colleague","collection","collectivisation","collectivization","collector","college","collision","colloquy","colon","colonial","colonialism","colonisation","colonization","colony","color","colorlessness","colt","column","columnist","comb","combat","combination","combine","comeback","comedy","comestible","comfort","comfortable","comic","comics","comma","command","commander","commandment","comment","commerce","commercial","commission","commitment","committee","commodity","common","commonsense","commotion","communicant","communication","communion","communist","community","commuter","company","comparison","compass","compassion","compassionate","compensation","competence","competition","competitor","complaint","complement","completion","complex","complexity","compliance","complication","complicity","compliment","component","comportment","composer","composite","composition","compost","comprehension","compress","compromise","comptroller","compulsion","computer","comradeship","con","concentrate","concentration","concept","conception","concern","concert","conclusion","concrete","condition","conditioner","condominium","condor","conduct","conductor","cone","confectionery","conference","confidence","confidentiality","configuration","confirmation","conflict","conformation","confusion","conga","congo","congregation","congress","congressman","congressperson","conifer","connection","connotation","conscience","consciousness","consensus","consent","consequence","conservation","conservative","consideration","consignment","consist","consistency","console","consonant","conspiracy","conspirator","constant","constellation","constitution","constraint","construction","consul","consulate","consulting","consumer","consumption","contact","contact lens","contagion","container","content","contention","contest","context","continent","contingency","continuity","contour","contract","contractor","contrail","contrary","contrast","contribution","contributor","control","controller","controversy","convection","convenience","convention","conversation","conversion","convert","convertible","conviction","cook","cookbook","cookie","cooking","coonskin","cooperation","coordination","coordinator","cop","cop-out","cope","copper","copy","copying","copyright","copywriter","coral","cord","corduroy","core","cork","cormorant","corn","corner","cornerstone","cornet","cornflakes","cornmeal","corporal","corporation","corporatism","corps","corral","correspondence","correspondent","corridor","corruption","corsage","cosset","cost","costume","cot","cottage","cotton","couch","cougar","cough","council","councilman","councilor","councilperson","counsel","counseling","counselling","counsellor","counselor","count","counter","counter-force","counterpart","counterterrorism","countess","country","countryside","county","couple","coupon","courage","course","court","courthouse","courtroom","cousin","covariate","cover","coverage","coverall","cow","cowbell","cowboy","coyote","crab","crack","cracker","crackers","cradle","craft","craftsman","cranberry","crane","cranky","crap","crash","crate","cravat","craw","crawdad","crayfish","crayon","crazy","cream","creation","creationism","creationist","creative","creativity","creator","creature","creche","credential","credenza","credibility","credit","creditor","creek","creme brulee","crepe","crest","crew","crewman","crewmate","crewmember","crewmen","cria","crib","cribbage","cricket","cricketer","crime","criminal","crinoline","crisis","crisp","criteria","criterion","critic","criticism","crocodile","crocus","croissant","crook","crop","cross","cross-contamination","cross-stitch","crotch","croup","crow","crowd","crown","crucifixion","crude","cruelty","cruise","crumb","crunch","crusader","crush","crust","cry","crystal","crystallography","cub","cube","cuckoo","cucumber","cue","cuff-link","cuisine","cultivar","cultivator","culture","culvert","cummerbund","cup","cupboard","cupcake","cupola","curd","cure","curio","curiosity","curl","curler","currant","currency","current","curriculum","curry","curse","cursor","curtailment","curtain","curve","cushion","custard","custody","custom","customer","cut","cuticle","cutlet","cutover","cutting","cyclamen","cycle","cyclone","cyclooxygenase","cygnet","cylinder","cymbal","cynic","cyst","cytokine","cytoplasm","dad","daddy","daffodil","dagger","dahlia","daikon","daily","dairy","daisy","dam","damage","dame","damn","dance","dancer","dancing","dandelion","danger","dare","dark","darkness","darn","dart","dash","dashboard","data","database","date","daughter","dawn","day","daybed","daylight","dead","deadline","deal","dealer","dealing","dearest","death","deathwatch","debate","debris","debt","debtor","decade","decadence","decency","decimal","decision","decision-making","deck","declaration","declination","decline","decoder","decongestant","decoration","decrease","decryption","dedication","deduce","deduction","deed","deep","deer","default","defeat","defendant","defender","defense","deficit","definition","deformation","degradation","degree","delay","deliberation","delight","delivery","demand","democracy","democrat","demon","demur","den","denim","denominator","density","dentist","deodorant","department","departure","dependency","dependent","deployment","deposit","deposition","depot","depression","depressive","depth","deputy","derby","derivation","derivative","derrick","descendant","descent","description","desert","design","designation","designer","desire","desk","desktop","dessert","destination","destiny","destroyer","destruction","detail","detainee","detainment","detection","detective","detector","detention","determination","detour","devastation","developer","developing","development","developmental","deviance","deviation","device","devil","dew","dhow","diabetes","diadem","diagnosis","diagram","dial","dialect","dialogue","diam","diamond","diaper","diaphragm","diarist","diary","dibble","dick","dickey","dictaphone","dictator","diction","dictionary","die","diesel","diet","difference","differential","difficulty","diffuse","dig","digestion","digestive","digger","digging","digit","dignity","dilapidation","dill","dilution","dime","dimension","dimple","diner","dinghy","dining","dinner","dinosaur","dioxide","dip","diploma","diplomacy","dipstick","direction","directive","director","directory","dirndl","dirt","disability","disadvantage","disagreement","disappointment","disarmament","disaster","discharge","discipline","disclaimer","disclosure","disco","disconnection","discount","discourse","discovery","discrepancy","discretion","discrimination","discussion","disdain","disease","disembodiment","disengagement","disguise","disgust","dish","dishwasher","disk","disparity","dispatch","displacement","display","disposal","disposer","disposition","dispute","disregard","disruption","dissemination","dissonance","distance","distinction","distortion","distribution","distributor","district","divalent","divan","diver","diversity","divide","dividend","divider","divine","diving","division","divorce","doc","dock","doctor","doctorate","doctrine","document","documentary","documentation","doe","dog","doggie","dogsled","dogwood","doing","doll","dollar","dollop","dolman","dolor","dolphin","domain","dome","domination","donation","donkey","donor","donut","door","doorbell","doorknob","doorpost","doorway","dory","dose","dot","double","doubling","doubt","doubter","dough","doughnut","down","downfall","downforce","downgrade","download","downstairs","downtown","downturn","dozen","draft","drag","dragon","dragonfly","dragonfruit","dragster","drain","drainage","drake","drama","dramaturge","drapes","draw","drawbridge","drawer","drawing","dream","dreamer","dredger","dress","dresser","dressing","drill","drink","drinking","drive","driver","driveway","driving","drizzle","dromedary","drop","drudgery","drug","drum","drummer","drunk","dryer","duck","duckling","dud","dude","due","duel","dueling","duffel","dugout","dulcimer","dumbwaiter","dump","dump truck","dune","dune buggy","dungarees","dungeon","duplexer","duration","durian","dusk","dust","dust storm","duster","duty","dwarf","dwell","dwelling","dynamics","dynamite","dynamo","dynasty","dysfunction","e-book","e-mail","e-reader","eagle","eaglet","ear","eardrum","earmuffs","earnings","earplug","earring","earrings","earth","earthquake","earthworm","ease","easel","east","eating","eaves","eavesdropper","ecclesia","echidna","eclipse","ecliptic","ecology","economics","economy","ecosystem","ectoderm","ectodermal","ecumenist","eddy","edge","edger","edible","editing","edition","editor","editorial","education","eel","effacement","effect","effective","effectiveness","effector","efficacy","efficiency","effort","egg","egghead","eggnog","eggplant","ego","eicosanoid","ejector","elbow","elderberry","election","electricity","electrocardiogram","electronics","element","elephant","elevation","elevator","eleventh","elf","elicit","eligibility","elimination","elite","elixir","elk","ellipse","elm","elongation","elver","email","emanate","embarrassment","embassy","embellishment","embossing","embryo","emerald","emergence","emergency","emergent","emery","emission","emitter","emotion","emphasis","empire","employ","employee","employer","employment","empowerment","emu","enactment","encirclement","enclave","enclosure","encounter","encouragement","encyclopedia","end","endive","endoderm","endorsement","endothelium","endpoint","enemy","energy","enforcement","engagement","engine","engineer","engineering","enigma","enjoyment","enquiry","enrollment","enterprise","entertainment","enthusiasm","entirety","entity","entrance","entree","entrepreneur","entry","envelope","environment","envy","enzyme","epauliere","epee","ephemera","ephemeris","ephyra","epic","episode","epithelium","epoch","eponym","epoxy","equal","equality","equation","equinox","equipment","equity","equivalent","era","eraser","erection","erosion","error","escalator","escape","escort","espadrille","espalier","essay","essence","essential","establishment","estate","estimate","estrogen","estuary","eternity","ethernet","ethics","ethnicity","ethyl","euphonium","eurocentrism","evaluation","evaluator","evaporation","eve","evening","evening-wear","event","everybody","everyone","everything","eviction","evidence","evil","evocation","evolution","ex-husband","ex-wife","exaggeration","exam","examination","examiner","example","exasperation","excellence","exception","excerpt","excess","exchange","excitement","exclamation","excursion","excuse","execution","executive","executor","exercise","exhaust","exhaustion","exhibit","exhibition","exile","existence","exit","exocrine","expansion","expansionism","expectancy","expectation","expedition","expense","experience","experiment","experimentation","expert","expertise","explanation","exploration","explorer","explosion","export","expose","exposition","exposure","expression","extension","extent","exterior","external","extinction","extreme","extremist","eye","eyeball","eyebrow","eyebrows","eyeglasses","eyelash","eyelashes","eyelid","eyelids","eyeliner","eyestrain","eyrie","fabric","face","facelift","facet","facility","facsimile","fact","factor","factory","faculty","fahrenheit","fail","failure","fairness","fairy","faith","faithful","fall","fallacy","falling-out","fame","familiar","familiarity","family","fan","fang","fanlight","fanny","fanny-pack","fantasy","farm","farmer","farming","farmland","farrow","fascia","fashion","fat","fate","father","father-in-law","fatigue","fatigues","faucet","fault","fav","fava","favor","favorite","fawn","fax","fear","feast","feather","feature","fedelini","federation","fedora","fee","feed","feedback","feeding","feel","feeling","fellow","felony","female","fen","fence","fencing","fender","feng","fennel","ferret","ferry","ferryboat","fertilizer","festival","fetus","few","fiber","fiberglass","fibre","fibroblast","fibrosis","ficlet","fiction","fiddle","field","fiery","fiesta","fifth","fig","fight","fighter","figure","figurine","file","filing","fill","fillet","filly","film","filter","filth","final","finance","financing","finding","fine","finer","finger","fingerling","fingernail","finish","finisher","fir","fire","fireman","fireplace","firewall","firm","first","fish","fishbone","fisherman","fishery","fishing","fishmonger","fishnet","fisting","fit","fitness","fix","fixture","flag","flair","flame","flan","flanker","flare","flash","flat","flatboat","flavor","flax","fleck","fledgling","fleece","flesh","flexibility","flick","flicker","flight","flint","flintlock","flip-flops","flock","flood","floodplain","floor","floozie","flour","flow","flower","flu","flugelhorn","fluke","flume","flung","flute","fly","flytrap","foal","foam","fob","focus","fog","fold","folder","folk","folklore","follower","following","fondue","font","food","foodstuffs","fool","foot","footage","football","footnote","footprint","footrest","footstep","footstool","footwear","forage","forager","foray","force","ford","forearm","forebear","forecast","forehead","foreigner","forelimb","forest","forestry","forever","forgery","fork","form","formal","formamide","format","formation","former","formicarium","formula","fort","forte","fortnight","fortress","fortune","forum","foundation","founder","founding","fountain","fourths","fowl","fox","foxglove","fraction","fragrance","frame","framework","fratricide","fraud","fraudster","freak","freckle","freedom","freelance","freezer","freezing","freight","freighter","frenzy","freon","frequency","fresco","friction","fridge","friend","friendship","fries","frigate","fright","fringe","fritter","frock","frog","front","frontier","frost","frosting","frown","fruit","frustration","fry","fuck","fuel","fugato","fulfillment","full","fun","function","functionality","fund","funding","fundraising","funeral","fur","furnace","furniture","furry","fusarium","futon","future","gadget","gaffe","gaffer","gain","gaiters","gale","gall-bladder","gallery","galley","gallon","galoshes","gambling","game","gamebird","gaming","gamma-ray","gander","gang","gap","garage","garb","garbage","garden","garlic","garment","garter","gas","gasket","gasoline","gasp","gastronomy","gastropod","gate","gateway","gather","gathering","gator","gauge","gauntlet","gavel","gazebo","gazelle","gear","gearshift","geek","gel","gelatin","gelding","gem","gemsbok","gender","gene","general","generation","generator","generosity","genetics","genie","genius","genocide","genre","gentleman","geography","geology","geometry","geranium","gerbil","gesture","geyser","gherkin","ghost","giant","gift","gig","gigantism","giggle","ginger","gingerbread","ginseng","giraffe","girdle","girl","girlfriend","git","glacier","gladiolus","glance","gland","glass","glasses","glee","glen","glider","gliding","glimpse","globe","glockenspiel","gloom","glory","glove","glow","glucose","glue","glut","glutamate","gnat","gnu","go-kart","goal","goat","gobbler","god","goddess","godfather","godmother","godparent","goggles","going","gold","goldfish","golf","gondola","gong","good","good-bye","goodbye","goodie","goodness","goodnight","goodwill","goose","gopher","gorilla","gosling","gossip","governance","government","governor","gown","grab-bag","grace","grade","gradient","graduate","graduation","graffiti","graft","grain","gram","grammar","gran","grand","grandchild","granddaughter","grandfather","grandma","grandmom","grandmother","grandpa","grandparent","grandson","granny","granola","grant","grape","grapefruit","graph","graphic","grasp","grass","grasshopper","grassland","gratitude","gravel","gravitas","gravity","gravy","gray","grease","great-grandfather","great-grandmother","greatness","greed","green","greenhouse","greens","grenade","grey","grid","grief","grill","grin","grip","gripper","grit","grocery","ground","group","grouper","grouse","grove","growth","grub","guacamole","guarantee","guard","guava","guerrilla","guess","guest","guestbook","guidance","guide","guideline","guilder","guilt","guilty","guinea","guitar","guitarist","gum","gumshoe","gun","gunpowder","gutter","guy","gym","gymnast","gymnastics","gynaecology","gyro","habit","habitat","hacienda","hacksaw","hackwork","hail","hair","haircut","hake","half","half-brother","half-sister","halibut","hall","halloween","hallway","halt","ham","hamburger","hammer","hammock","hamster","hand","hand-holding","handball","handful","handgun","handicap","handle","handlebar","handmaiden","handover","handrail","handsaw","hanger","happening","happiness","harald","harbor","harbour","hard-hat","hardboard","hardcover","hardening","hardhat","hardship","hardware","hare","harm","harmonica","harmonise","harmonize","harmony","harp","harpooner","harpsichord","harvest","harvester","hash","hashtag","hassock","haste","hat","hatbox","hatchet","hatchling","hate","hatred","haunt","haven","haversack","havoc","hawk","hay","haze","hazel","hazelnut","head","headache","headlight","headline","headphones","headquarters","headrest","health","health-care","hearing","hearsay","heart","heart-throb","heartache","heartbeat","hearth","hearthside","heartwood","heat","heater","heating","heaven","heavy","hectare","hedge","hedgehog","heel","heifer","height","heir","heirloom","helicopter","helium","hell","hellcat","hello","helmet","helo","help","hemisphere","hemp","hen","hepatitis","herb","herbs","heritage","hermit","hero","heroine","heron","herring","hesitation","heterosexual","hexagon","heyday","hiccups","hide","hierarchy","high","high-rise","highland","highlight","highway","hike","hiking","hill","hint","hip","hippodrome","hippopotamus","hire","hiring","historian","history","hit","hive","hobbit","hobby","hockey","hoe","hog","hold","holder","hole","holiday","home","homeland","homeownership","hometown","homework","homicide","homogenate","homonym","homosexual","homosexuality","honesty","honey","honeybee","honeydew","honor","honoree","hood","hoof","hook","hop","hope","hops","horde","horizon","hormone","horn","hornet","horror","horse","horseradish","horst","hose","hosiery","hospice","hospital","hospitalisation","hospitality","hospitalization","host","hostel","hostess","hotdog","hotel","hound","hour","hourglass","house","houseboat","household","housewife","housework","housing","hovel","hovercraft","howard","howitzer","hub","hubcap","hubris","hug","hugger","hull","human","humanity","humidity","hummus","humor","humour","hunchback","hundred","hunger","hunt","hunter","hunting","hurdle","hurdler","hurricane","hurry","hurt","husband","hut","hutch","hyacinth","hybridisation","hybridization","hydrant","hydraulics","hydrocarb","hydrocarbon","hydrofoil","hydrogen","hydrolyse","hydrolysis","hydrolyze","hydroxyl","hyena","hygienic","hype","hyphenation","hypochondria","hypothermia","hypothesis","ice","ice-cream","iceberg","icebreaker","icecream","icicle","icing","icon","icy","id","idea","ideal","identification","identity","ideology","idiom","idiot","igloo","ignorance","ignorant","ikebana","illegal","illiteracy","illness","illusion","illustration","image","imagination","imbalance","imitation","immigrant","immigration","immortal","impact","impairment","impala","impediment","implement","implementation","implication","import","importance","impostor","impress","impression","imprisonment","impropriety","improvement","impudence","impulse","in-joke","in-laws","inability","inauguration","inbox","incandescence","incarnation","incense","incentive","inch","incidence","incident","incision","inclusion","income","incompetence","inconvenience","increase","incubation","independence","independent","index","indication","indicator","indigence","individual","industrialisation","industrialization","industry","inequality","inevitable","infancy","infant","infarction","infection","infiltration","infinite","infix","inflammation","inflation","influence","influx","info","information","infrastructure","infusion","inglenook","ingrate","ingredient","inhabitant","inheritance","inhibition","inhibitor","initial","initialise","initialize","initiative","injunction","injury","injustice","ink","inlay","inn","innervation","innocence","innocent","innovation","input","inquiry","inscription","insect","insectarium","insert","inside","insight","insolence","insomnia","inspection","inspector","inspiration","installation","instance","instant","instinct","institute","institution","instruction","instructor","instrument","instrumentalist","instrumentation","insulation","insurance","insurgence","insurrection","integer","integral","integration","integrity","intellect","intelligence","intensity","intent","intention","intentionality","interaction","interchange","interconnection","intercourse","interest","interface","interferometer","interior","interject","interloper","internet","interpretation","interpreter","interval","intervenor","intervention","interview","interviewer","intestine","introduction","intuition","invader","invasion","invention","inventor","inventory","inverse","inversion","investigation","investigator","investment","investor","invitation","invite","invoice","involvement","iridescence","iris","iron","ironclad","irony","irrigation","ischemia","island","isogloss","isolation","issue","item","itinerary","ivory","jack","jackal","jacket","jackfruit","jade","jaguar","jail","jailhouse","jalape\xC3\xB1o","jam","jar","jasmine","jaw","jazz","jealousy","jeans","jeep","jelly","jellybeans","jellyfish","jerk","jet","jewel","jeweller","jewellery","jewelry","jicama","jiffy","job","jockey","jodhpurs","joey","jogging","joint","joke","jot","journal","journalism","journalist","journey","joy","judge","judgment","judo","jug","juggernaut","juice","julienne","jumbo","jump","jumper","jumpsuit","jungle","junior","junk","junker","junket","jury","justice","justification","jute","kale","kamikaze","kangaroo","karate","kayak","kazoo","kebab","keep","keeper","kendo","kennel","ketch","ketchup","kettle","kettledrum","key","keyboard","keyboarding","keystone","kick","kick-off","kid","kidney","kielbasa","kill","killer","killing","kilogram","kilometer","kilt","kimono","kinase","kind","kindness","king","kingdom","kingfish","kiosk","kiss","kit","kitchen","kite","kitsch","kitten","kitty","kiwi","knee","kneejerk","knickers","knife","knife-edge","knight","knitting","knock","knot","know-how","knowledge","knuckle","koala","kohlrabi","kumquat","lab","label","labor","laboratory","laborer","labour","labourer","lace","lack","lacquerware","lad","ladder","ladle","lady","ladybug","lag","lake","lamb","lambkin","lament","lamp","lanai","land","landform","landing","landmine","landscape","lane","language","lantern","lap","laparoscope","lapdog","laptop","larch","lard","larder","lark","larva","laryngitis","lasagna","lashes","last","latency","latex","lathe","latitude","latte","latter","laugh","laughter","laundry","lava","law","lawmaker","lawn","lawsuit","lawyer","lay","layer","layout","lead","leader","leadership","leading","leaf","league","leaker","leap","learning","leash","leather","leave","leaver","lecture","leek","leeway","left","leg","legacy","legal","legend","legging","legislation","legislator","legislature","legitimacy","legume","leisure","lemon","lemonade","lemur","lender","lending","length","lens","lentil","leopard","leprosy","leptocephalus","lesbian","lesson","letter","lettuce","level","lever","leverage","leveret","liability","liar","liberty","libido","library","licence","license","licensing","licorice","lid","lie","lieu","lieutenant","life","lifestyle","lifetime","lift","ligand","light","lighting","lightning","lightscreen","ligula","likelihood","likeness","lilac","lily","limb","lime","limestone","limit","limitation","limo","line","linen","liner","linguist","linguistics","lining","link","linkage","linseed","lion","lip","lipid","lipoprotein","lipstick","liquid","liquidity","liquor","list","listening","listing","literate","literature","litigation","litmus","litter","littleneck","liver","livestock","living","lizard","llama","load","loading","loaf","loafer","loan","lobby","lobotomy","lobster","local","locality","location","lock","locker","locket","locomotive","locust","lode","loft","log","loggia","logic","login","logistics","logo","loincloth","lollipop","loneliness","longboat","longitude","look","lookout","loop","loophole","loquat","lord","loss","lot","lotion","lottery","lounge","louse","lout","love","lover","lox","loyalty","luck","luggage","lumber","lumberman","lunch","luncheonette","lunchmeat","lunchroom","lung","lunge","lust","lute","luxury","lychee","lycra","lye","lymphocyte","lynx","lyocell","lyre","lyrics","lysine","mRNA","macadamia","macaroni","macaroon","macaw","machine","machinery","macrame","macro","macrofauna","madam","maelstrom","maestro","magazine","maggot","magic","magnet","magnitude","maid","maiden","mail","mailbox","mailer","mailing","mailman","main","mainland","mainstream","maintainer","maintenance","maize","major","major-league","majority","makeover","maker","makeup","making","male","malice","mall","mallard","mallet","malnutrition","mama","mambo","mammoth","man","manacle","management","manager","manatee","mandarin","mandate","mandolin","mangle","mango","mangrove","manhunt","maniac","manicure","manifestation","manipulation","mankind","manner","manor","mansard","manservant","mansion","mantel","mantle","mantua","manufacturer","manufacturing","many","map","maple","mapping","maracas","marathon","marble","march","mare","margarine","margin","mariachi","marimba","marines","marionberry","mark","marker","market","marketer","marketing","marketplace","marksman","markup","marmalade","marriage","marsh","marshland","marshmallow","marten","marxism","mascara","mask","masonry","mass","massage","mast","master","masterpiece","mastication","mastoid","mat","match","matchmaker","mate","material","maternity","math","mathematics","matrix","matter","mattock","mattress","max","maximum","maybe","mayonnaise","mayor","meadow","meal","mean","meander","meaning","means","meantime","measles","measure","measurement","meat","meatball","meatloaf","mecca","mechanic","mechanism","med","medal","media","median","medication","medicine","medium","meet","meeting","melatonin","melody","melon","member","membership","membrane","meme","memo","memorial","memory","men","menopause","menorah","mention","mentor","menu","merchandise","merchant","mercury","meridian","meringue","merit","mesenchyme","mess","message","messenger","messy","metabolite","metal","metallurgist","metaphor","meteor","meteorology","meter","methane","method","methodology","metric","metro","metronome","mezzanine","microlending","micronutrient","microphone","microwave","mid-course","midden","middle","middleman","midline","midnight","midwife","might","migrant","migration","mile","mileage","milepost","milestone","military","milk","milkshake","mill","millennium","millet","millimeter","million","millisecond","millstone","mime","mimosa","min","mincemeat","mind","mine","mineral","mineshaft","mini","mini-skirt","minibus","minimalism","minimum","mining","minion","minister","mink","minnow","minor","minor-league","minority","mint","minute","miracle","mirror","miscarriage","miscommunication","misfit","misnomer","misogyny","misplacement","misreading","misrepresentation","miss","missile","mission","missionary","mist","mistake","mister","misunderstand","miter","mitten","mix","mixer","mixture","moai","moat","mob","mobile","mobility","mobster","moccasins","mocha","mochi","mode","model","modeling","modem","modernist","modernity","modification","molar","molasses","molding","mole","molecule","mom","moment","monastery","monasticism","money","monger","monitor","monitoring","monk","monkey","monocle","monopoly","monotheism","monsoon","monster","month","monument","mood","moody","moon","moonlight","moonscape","moonshine","moose","mop","morale","morbid","morbidity","morning","moron","morphology","morsel","mortal","mortality","mortgage","mortise","mosque","mosquito","most","motel","moth","mother","mother-in-law","motion","motivation","motive","motor","motorboat","motorcar","motorcycle","mound","mountain","mouse","mouser","mousse","moustache","mouth","mouton","movement","mover","movie","mower","mozzarella","mud","muffin","mug","mukluk","mule","multimedia","murder","muscat","muscatel","muscle","musculature","museum","mushroom","music","music-box","music-making","musician","muskrat","mussel","mustache","mustard","mutation","mutt","mutton","mycoplasma","mystery","myth","mythology","nail","name","naming","nanoparticle","napkin","narrative","nasal","nation","nationality","native","naturalisation","nature","navigation","necessity","neck","necklace","necktie","nectar","nectarine","need","needle","neglect","negligee","negotiation","neighbor","neighborhood","neighbour","neighbourhood","neologism","neon","neonate","nephew","nerve","nest","nestling","nestmate","net","netball","netbook","netsuke","network","networking","neurobiologist","neuron","neuropathologist","neuropsychiatry","news","newsletter","newspaper","newsprint","newsstand","nexus","nibble","nicety","niche","nick","nickel","nickname","niece","night","nightclub","nightgown","nightingale","nightlife","nightlight","nightmare","ninja","nit","nitrogen","nobody","nod","node","noir","noise","nonbeliever","nonconformist","nondisclosure","nonsense","noodle","noodles","noon","norm","normal","normalisation","normalization","north","nose","notation","note","notebook","notepad","nothing","notice","notion","notoriety","nougat","noun","nourishment","novel","nucleotidase","nucleotide","nudge","nuke","number","numeracy","numeric","numismatist","nun","nurse","nursery","nursing","nurture","nut","nutmeg","nutrient","nutrition","nylon","nymph","oak","oar","oasis","oat","oatmeal","oats","obedience","obesity","obi","object","objection","objective","obligation","oboe","observation","observatory","obsession","obsidian","obstacle","occasion","occupation","occurrence","ocean","ocelot","octagon","octave","octavo","octet","octopus","odometer","odyssey","oeuvre","off-ramp","offence","offense","offer","offering","office","officer","official","offset","oil","okra","oldie","oleo","olive","omega","omelet","omission","omnivore","oncology","onion","online","onset","opening","opera","operating","operation","operator","ophthalmologist","opinion","opium","opossum","opponent","opportunist","opportunity","opposite","opposition","optimal","optimisation","optimist","optimization","option","orange","orangutan","orator","orchard","orchestra","orchid","order","ordinary","ordination","ore","oregano","organ","organisation","organising","organization","organizing","orient","orientation","origin","original","originality","ornament","osmosis","osprey","ostrich","other","otter","ottoman","ounce","outback","outcome","outfielder","outfit","outhouse","outlaw","outlay","outlet","outline","outlook","output","outrage","outrigger","outrun","outset","outside","oval","ovary","oven","overcharge","overclocking","overcoat","overexertion","overflight","overhead","overheard","overload","overnighter","overshoot","oversight","overview","overweight","owl","owner","ownership","ox","oxford","oxygen","oyster","ozone","pace","pacemaker","pack","package","packaging","packet","pad","paddle","paddock","pagan","page","pagoda","pail","pain","paint","painter","painting","paintwork","pair","pajamas","palace","palate","palm","pamphlet","pan","pancake","pancreas","panda","panel","panic","pannier","panpipe","pansy","panther","panties","pantologist","pantology","pantry","pants","pantsuit","panty","pantyhose","papa","papaya","paper","paperback","paperwork","parable","parachute","parade","paradise","paragraph","parallelogram","paramecium","paramedic","parameter","paranoia","parcel","parchment","pard","pardon","parent","parenthesis","parenting","park","parka","parking","parliament","parole","parrot","parser","parsley","parsnip","part","participant","participation","particle","particular","partner","partnership","partridge","party","pass","passage","passbook","passenger","passing","passion","passive","passport","password","past","pasta","paste","pastor","pastoralist","pastry","pasture","pat","patch","pate","patent","patentee","path","pathogenesis","pathology","pathway","patience","patient","patina","patio","patriarch","patrimony","patriot","patrol","patroller","patrolling","patron","pattern","patty","pattypan","pause","pavement","pavilion","paw","pawnshop","pay","payee","payment","payoff","pea","peace","peach","peacoat","peacock","peak","peanut","pear","pearl","peasant","pecan","pecker","pedal","peek","peen","peer","peer-to-peer","pegboard","pelican","pelt","pen","penalty","pence","pencil","pendant","pendulum","penguin","penicillin","peninsula","penis","pennant","penny","pension","pentagon","peony","people","pepper","pepperoni","percent","percentage","perception","perch","perennial","perfection","performance","perfume","period","periodical","peripheral","permafrost","permission","permit","perp","perpendicular","persimmon","person","personal","personality","personnel","perspective","pest","pet","petal","petition","petitioner","petticoat","pew","pharmacist","pharmacopoeia","phase","pheasant","phenomenon","phenotype","pheromone","philanthropy","philosopher","philosophy","phone","phosphate","photo","photodiode","photograph","photographer","photography","photoreceptor","phrase","phrasing","physical","physics","physiology","pianist","piano","piccolo","pick","pickax","pickaxe","picket","pickle","pickup","picnic","picture","picturesque","pie","piece","pier","piety","pig","pigeon","piglet","pigpen","pigsty","pike","pilaf","pile","pilgrim","pilgrimage","pill","pillar","pillbox","pillow","pilot","pimp","pimple","pin","pinafore","pince-nez","pine","pineapple","pinecone","ping","pink","pinkie","pinot","pinstripe","pint","pinto","pinworm","pioneer","pipe","pipeline","piracy","pirate","piss","pistol","pit","pita","pitch","pitcher","pitching","pith","pizza","place","placebo","placement","placode","plagiarism","plain","plaintiff","plan","plane","planet","planning","plant","plantation","planter","planula","plaster","plasterboard","plastic","plate","platelet","platform","platinum","platter","platypus","play","player","playground","playroom","playwright","plea","pleasure","pleat","pledge","plenty","plier","pliers","plight","plot","plough","plover","plow","plowman","plug","plugin","plum","plumber","plume","plunger","plywood","pneumonia","pocket","pocket-watch","pocketbook","pod","podcast","poem","poet","poetry","poignance","point","poison","poisoning","poker","polarisation","polarization","pole","polenta","police","policeman","policy","polish","politician","politics","poll","polliwog","pollutant","pollution","polo","polyester","polyp","pomegranate","pomelo","pompom","poncho","pond","pony","pool","poor","pop","popcorn","poppy","popsicle","popularity","population","populist","porcelain","porch","porcupine","pork","porpoise","port","porter","portfolio","porthole","portion","portrait","position","possession","possibility","possible","post","postage","postbox","poster","posterior","postfix","pot","potato","potential","pottery","potty","pouch","poultry","pound","pounding","poverty","powder","power","practice","practitioner","prairie","praise","pray","prayer","precedence","precedent","precipitation","precision","predecessor","preface","preference","prefix","pregnancy","prejudice","prelude","premeditation","premier","premise","premium","preoccupation","preparation","prescription","presence","present","presentation","preservation","preserves","presidency","president","press","pressroom","pressure","pressurisation","pressurization","prestige","presume","pretzel","prevalence","prevention","prey","price","pricing","pride","priest","priesthood","primary","primate","prince","princess","principal","principle","print","printer","printing","prior","priority","prison","prisoner","privacy","private","privilege","prize","prizefight","probability","probation","probe","problem","procedure","proceedings","process","processing","processor","proctor","procurement","produce","producer","product","production","productivity","profession","professional","professor","profile","profit","progenitor","program","programme","programming","progress","progression","prohibition","project","proliferation","promenade","promise","promotion","prompt","pronoun","pronunciation","proof","proof-reader","propaganda","propane","property","prophet","proponent","proportion","proposal","proposition","proprietor","prose","prosecution","prosecutor","prospect","prosperity","prostacyclin","prostanoid","prostrate","protection","protein","protest","protocol","providence","provider","province","provision","prow","proximal","proximity","prune","pruner","pseudocode","pseudoscience","psychiatrist","psychoanalyst","psychologist","psychology","ptarmigan","pub","public","publication","publicity","publisher","publishing","pudding","puddle","puffin","pug","puggle","pulley","pulse","puma","pump","pumpernickel","pumpkin","pumpkinseed","pun","punch","punctuation","punishment","pup","pupa","pupil","puppet","puppy","purchase","puritan","purity","purple","purpose","purr","purse","pursuit","push","pusher","put","puzzle","pyramid","pyridine","quadrant","quail","qualification","quality","quantity","quart","quarter","quartet","quartz","queen","query","quest","question","questioner","questionnaire","quiche","quicksand","quiet","quill","quilt","quince","quinoa","quit","quiver","quota","quotation","quote","rabbi","rabbit","raccoon","race","racer","racing","racism","racist","rack","radar","radiator","radio","radiosonde","radish","raffle","raft","rag","rage","raid","rail","railing","railroad","railway","raiment","rain","rainbow","raincoat","rainmaker","rainstorm","rainy","raise","raisin","rake","rally","ram","rambler","ramen","ramie","ranch","rancher","randomisation","randomization","range","ranger","rank","rap","rape","raspberry","rat","rate","ratepayer","rating","ratio","rationale","rations","raven","ravioli","rawhide","ray","rayon","razor","reach","reactant","reaction","read","reader","readiness","reading","real","reality","realization","realm","reamer","rear","reason","reasoning","rebel","rebellion","reboot","recall","recapitulation","receipt","receiver","reception","receptor","recess","recession","recipe","recipient","reciprocity","reclamation","recliner","recognition","recollection","recommendation","reconsideration","record","recorder","recording","recovery","recreation","recruit","rectangle","red","redesign","redhead","redirect","rediscovery","reduction","reef","refectory","reference","referendum","reflection","reform","refreshments","refrigerator","refuge","refund","refusal","refuse","regard","regime","region","regionalism","register","registration","registry","regret","regulation","regulator","rehospitalisation","rehospitalization","reindeer","reinscription","reject","relation","relationship","relative","relaxation","relay","release","reliability","relief","religion","relish","reluctance","remains","remark","reminder","remnant","remote","removal","renaissance","rent","reorganisation","reorganization","repair","reparation","repayment","repeat","replacement","replica","replication","reply","report","reporter","reporting","repository","representation","representative","reprocessing","republic","republican","reputation","request","requirement","resale","rescue","research","researcher","resemblance","reservation","reserve","reservoir","reset","residence","resident","residue","resist","resistance","resolution","resolve","resort","resource","respect","respite","response","responsibility","rest","restaurant","restoration","restriction","restroom","restructuring","result","resume","retailer","retention","rethinking","retina","retirement","retouching","retreat","retrospect","retrospective","retrospectivity","return","reunion","revascularisation","revascularization","reveal","revelation","revenant","revenge","revenue","reversal","reverse","review","revitalisation","revitalization","revival","revolution","revolver","reward","rhetoric","rheumatism","rhinoceros","rhubarb","rhyme","rhythm","rib","ribbon","rice","riddle","ride","rider","ridge","riding","rifle","right","rim","ring","ringworm","riot","rip","ripple","rise","riser","risk","rite","ritual","river","riverbed","rivulet","road","roadway","roar","roast","robe","robin","robot","robotics","rock","rocker","rocket","rocket-ship","rod","role","roll","roller","romaine","romance","roof","room","roommate","rooster","root","rope","rose","rosemary","roster","rostrum","rotation","round","roundabout","route","router","routine","row","rowboat","rowing","rubber","rubbish","rubric","ruby","ruckus","rudiment","ruffle","rug","rugby","ruin","rule","ruler","ruling","rum","rumor","run","runaway","runner","running","runway","rush","rust","rutabaga","rye","sabre","sac","sack","saddle","sadness","safari","safe","safeguard","safety","saffron","sage","sail","sailboat","sailing","sailor","saint","sake","salad","salami","salary","sale","salesman","salmon","salon","saloon","salsa","salt","salute","samovar","sampan","sample","samurai","sanction","sanctity","sanctuary","sand","sandal","sandbar","sandpaper","sandwich","sanity","sardine","sari","sarong","sash","satellite","satin","satire","satisfaction","sauce","saucer","sauerkraut","sausage","savage","savannah","saving","savings","savior","saviour","savory","saw","saxophone","scaffold","scale","scallion","scallops","scalp","scam","scanner","scarecrow","scarf","scarification","scenario","scene","scenery","scent","schedule","scheduling","schema","scheme","schizophrenic","schnitzel","scholar","scholarship","school","schoolhouse","schooner","science","scientist","scimitar","scissors","scooter","scope","score","scorn","scorpion","scotch","scout","scow","scrambled","scrap","scraper","scratch","screamer","screen","screening","screenwriting","screw","screw-up","screwdriver","scrim","scrip","script","scripture","scrutiny","sculpting","sculptural","sculpture","sea","seabass","seafood","seagull","seal","seaplane","search","seashore","seaside","season","seat","seaweed","second","secrecy","secret","secretariat","secretary","secretion","section","sectional","sector","security","sediment","seed","seeder","seeker","seep","segment","seizure","selection","self","self-confidence","self-control","self-esteem","seller","selling","semantics","semester","semicircle","semicolon","semiconductor","seminar","senate","senator","sender","senior","sense","sensibility","sensitive","sensitivity","sensor","sentence","sentencing","sentiment","sepal","separation","septicaemia","sequel","sequence","serial","series","sermon","serum","serval","servant","server","service","servitude","sesame","session","set","setback","setting","settlement","settler","severity","sewer","sex","sexuality","shack","shackle","shade","shadow","shadowbox","shakedown","shaker","shallot","shallows","shame","shampoo","shanty","shape","share","shareholder","shark","shaw","shawl","shear","shearling","sheath","shed","sheep","sheet","shelf","shell","shelter","sherbet","sherry","shield","shift","shin","shine","shingle","ship","shipper","shipping","shipyard","shirt","shirtdress","shit","shoat","shock","shoe","shoe-horn","shoehorn","shoelace","shoemaker","shoes","shoestring","shofar","shoot","shootdown","shop","shopper","shopping","shore","shoreline","short","shortage","shorts","shortwave","shot","shoulder","shout","shovel","show","show-stopper","shower","shred","shrimp","shrine","shutdown","sibling","sick","sickness","side","sideboard","sideburns","sidecar","sidestream","sidewalk","siding","siege","sigh","sight","sightseeing","sign","signal","signature","signet","significance","signify","signup","silence","silica","silicon","silk","silkworm","sill","silly","silo","silver","similarity","simple","simplicity","simplification","simvastatin","sin","singer","singing","singular","sink","sinuosity","sip","sir","sister","sister-in-law","sitar","site","situation","size","skate","skating","skean","skeleton","ski","skiing","skill","skin","skirt","skull","skullcap","skullduggery","skunk","sky","skylight","skyline","skyscraper","skywalk","slang","slapstick","slash","slate","slave","slavery","slaw","sled","sledge","sleep","sleepiness","sleeping","sleet","sleuth","slice","slide","slider","slime","slip","slipper","slippers","slope","slot","sloth","slump","smell","smelting","smile","smith","smock","smog","smoke","smoking","smolt","smuggling","snack","snail","snake","snakebite","snap","snarl","sneaker","sneakers","sneeze","sniffle","snob","snorer","snow","snowboarding","snowflake","snowman","snowmobiling","snowplow","snowstorm","snowsuit","snuck","snug","snuggle","soap","soccer","socialism","socialist","society","sociology","sock","socks","soda","sofa","softball","softdrink","softening","software","soil","soldier","sole","solicitation","solicitor","solidarity","solidity","soliloquy","solitaire","solution","solvency","sombrero","somebody","someone","someplace","somersault","something","somewhere","son","sonar","sonata","song","songbird","sonnet","soot","sophomore","soprano","sorbet","sorghum","sorrel","sorrow","sort","soul","soulmate","sound","soundness","soup","source","sourwood","sousaphone","south","southeast","souvenir","sovereignty","sow","soy","soybean","space","spacing","spade","spaghetti","span","spandex","spank","sparerib","spark","sparrow","spasm","spat","spatula","spawn","speaker","speakerphone","speaking","spear","spec","special","specialist","specialty","species","specification","spectacle","spectacles","spectrograph","spectrum","speculation","speech","speed","speedboat","spell","spelling","spelt","spending","sphere","sphynx","spice","spider","spiderling","spike","spill","spinach","spine","spiral","spirit","spiritual","spirituality","spit","spite","spleen","splendor","split","spokesman","spokeswoman","sponge","sponsor","sponsorship","spool","spoon","spork","sport","sportsman","spot","spotlight","spouse","sprag","sprat","spray","spread","spreadsheet","spree","spring","sprinkles","sprinter","sprout","spruce","spud","spume","spur","spy","spyglass","square","squash","squatter","squeegee","squid","squirrel","stab","stability","stable","stack","stacking","stadium","staff","stag","stage","stain","stair","staircase","stake","stalk","stall","stallion","stamen","stamina","stamp","stance","stand","standard","standardisation","standardization","standing","standoff","standpoint","star","starboard","start","starter","state","statement","statin","station","station-wagon","statistic","statistics","statue","status","statute","stay","steak","stealth","steam","steamroller","steel","steeple","stem","stench","stencil","step","step-aunt","step-brother","step-daughter","step-father","step-grandfather","step-grandmother","step-mother","step-sister","step-son","step-uncle","stepdaughter","stepmother","stepping-stone","stepson","stereo","stew","steward","stick","sticker","stiletto","still","stimulation","stimulus","sting","stinger","stir-fry","stitch","stitcher","stock","stock-in-trade","stockings","stole","stomach","stone","stonework","stool","stop","stopsign","stopwatch","storage","store","storey","storm","story","story-telling","storyboard","stot","stove","strait","strand","stranger","strap","strategy","straw","strawberry","strawman","stream","street","streetcar","strength","stress","stretch","strife","strike","string","strip","stripe","strobe","stroke","structure","strudel","struggle","stucco","stud","student","studio","study","stuff","stumbling","stump","stupidity","sturgeon","sty","style","styling","stylus","sub","subcomponent","subconscious","subcontractor","subexpression","subgroup","subject","submarine","submitter","subprime","subroutine","subscription","subsection","subset","subsidence","subsidiary","subsidy","substance","substitution","subtitle","suburb","subway","success","succotash","suck","sucker","suede","suet","suffocation","sugar","suggestion","suicide","suit","suitcase","suite","sulfur","sultan","sum","summary","summer","summit","sun","sunbeam","sunbonnet","sundae","sunday","sundial","sunflower","sunglasses","sunlamp","sunlight","sunrise","sunroom","sunset","sunshine","superiority","supermarket","supernatural","supervision","supervisor","supper","supplement","supplier","supply","support","supporter","suppression","supreme","surface","surfboard","surge","surgeon","surgery","surname","surplus","surprise","surround","surroundings","surrounds","survey","survival","survivor","sushi","suspect","suspenders","suspension","sustainment","sustenance","swallow","swamp","swan","swanling","swath","sweat","sweater","sweatshirt","sweatshop","sweatsuit","sweets","swell","swim","swimming","swimsuit","swine","swing","switch","switchboard","switching","swivel","sword","swordfight","swordfish","sycamore","symbol","symmetry","sympathy","symptom","syndicate","syndrome","synergy","synod","synonym","synthesis","syrup","system","t-shirt","tab","tabby","tabernacle","table","tablecloth","tablet","tabletop","tachometer","tackle","taco","tactics","tactile","tadpole","tag","tail","tailbud","tailor","tailspin","take-out","takeover","tale","talent","talk","talking","tam-o'-shanter","tamale","tambour","tambourine","tan","tandem","tangerine","tank","tank-top","tanker","tankful","tap","tape","tapioca","target","taro","tarragon","tart","task","tassel","taste","tatami","tattler","tattoo","tavern","tax","taxi","taxicab","taxpayer","tea","teacher","teaching","team","teammate","teapot","tear","tech","technician","technique","technologist","technology","tectonics","teen","teenager","teepee","telephone","telescreen","teletype","television","tell","teller","temp","temper","temperature","temple","tempo","temporariness","temporary","temptation","temptress","tenant","tendency","tender","tenement","tenet","tennis","tenor","tension","tensor","tent","tentacle","tenth","tepee","teriyaki","term","terminal","termination","terminology","termite","terrace","terracotta","terrapin","terrarium","territory","terror","terrorism","terrorist","test","testament","testimonial","testimony","testing","text","textbook","textual","texture","thanks","thaw","theater","theft","theism","theme","theology","theory","therapist","therapy","thermals","thermometer","thermostat","thesis","thickness","thief","thigh","thing","thinking","thirst","thistle","thong","thongs","thorn","thought","thousand","thread","threat","threshold","thrift","thrill","throat","throne","thrush","thrust","thug","thumb","thump","thunder","thunderbolt","thunderhead","thunderstorm","thyme","tiara","tic","tick","ticket","tide","tie","tiger","tights","tile","till","tilt","timbale","timber","time","timeline","timeout","timer","timetable","timing","timpani","tin","tinderbox","tinkle","tintype","tip","tire","tissue","titanium","title","toad","toast","toaster","tobacco","today","toe","toenail","toffee","tofu","tog","toga","toilet","tolerance","tolerant","toll","tom-tom","tomatillo","tomato","tomb","tomography","tomorrow","ton","tonality","tone","tongue","tonic","tonight","tool","toot","tooth","toothbrush","toothpaste","toothpick","top","top-hat","topic","topsail","toque","toreador","tornado","torso","torte","tortellini","tortilla","tortoise","tosser","total","tote","touch","tough-guy","tour","tourism","tourist","tournament","tow-truck","towel","tower","town","townhouse","township","toy","trace","trachoma","track","tracking","tracksuit","tract","tractor","trade","trader","trading","tradition","traditionalism","traffic","trafficker","tragedy","trail","trailer","trailpatrol","train","trainer","training","trait","tram","tramp","trance","transaction","transcript","transfer","transformation","transit","transition","translation","transmission","transom","transparency","transplantation","transport","transportation","trap","trapdoor","trapezium","trapezoid","trash","travel","traveler","tray","treasure","treasury","treat","treatment","treaty","tree","trek","trellis","tremor","trench","trend","triad","trial","triangle","tribe","tributary","trick","trigger","trigonometry","trillion","trim","trinket","trip","tripod","tritone","triumph","trolley","trombone","troop","trooper","trophy","trouble","trousers","trout","trove","trowel","truck","trumpet","trunk","trust","trustee","truth","try","tsunami","tub","tuba","tube","tuber","tug","tugboat","tuition","tulip","tumbler","tummy","tuna","tune","tune-up","tunic","tunnel","turban","turf","turkey","turmeric","turn","turning","turnip","turnover","turnstile","turret","turtle","tusk","tussle","tutu","tuxedo","tweet","tweezers","twig","twilight","twine","twins","twist","twister","twitter","type","typeface","typewriter","typhoon","ukulele","ultimatum","umbrella","unblinking","uncertainty","uncle","underclothes","underestimate","underground","underneath","underpants","underpass","undershirt","understanding","understatement","undertaker","underwear","underweight","underwire","underwriting","unemployment","unibody","uniform","uniformity","union","unique","unit","unity","universe","university","update","upgrade","uplift","upper","upstairs","upward","urge","urgency","urn","usage","use","user","usher","usual","utensil","utilisation","utility","utilization","vacation","vaccine","vacuum","vagrant","valance","valentine","validate","validity","valley","valuable","value","vampire","van","vanadyl","vane","vanilla","vanity","variability","variable","variant","variation","variety","vascular","vase","vault","vaulting","veal","vector","vegetable","vegetarian","vegetarianism","vegetation","vehicle","veil","vein","veldt","vellum","velocity","velodrome","velvet","vendor","veneer","vengeance","venison","venom","venti","venture","venue","veranda","verb","verdict","verification","vermicelli","vernacular","verse","version","vertigo","verve","vessel","vest","vestment","vet","veteran","veterinarian","veto","viability","vibe","vibraphone","vibration","vibrissae","vice","vicinity","victim","victory","video","view","viewer","vignette","villa","village","vine","vinegar","vineyard","vintage","vintner","vinyl","viola","violation","violence","violet","violin","virginal","virtue","virus","visa","viscose","vise","vision","visit","visitor","visor","vista","visual","vitality","vitamin","vitro","vivo","vixen","vodka","vogue","voice","void","vol","volatility","volcano","volleyball","volume","volunteer","volunteering","vomit","vote","voter","voting","voyage","vulture","wad","wafer","waffle","wage","wagon","waist","waistband","wait","waiter","waiting","waitress","waiver","wake","walk","walker","walking","walkway","wall","wallaby","wallet","walnut","walrus","wampum","wannabe","want","war","warden","wardrobe","warfare","warlock","warlord","warm-up","warming","warmth","warning","warrant","warren","warrior","wasabi","wash","washbasin","washcloth","washer","washtub","wasp","waste","wastebasket","wasting","watch","watcher","watchmaker","water","waterbed","watercress","waterfall","waterfront","watermelon","waterskiing","waterspout","waterwheel","wave","waveform","wax","way","weakness","wealth","weapon","wear","weasel","weather","web","webinar","webmail","webpage","website","wedding","wedge","weed","weeder","weedkiller","week","weekend","weekender","weight","weird","welcome","welfare","well","well-being","west","western","wet-bar","wetland","wetsuit","whack","whale","wharf","wheat","wheel","whelp","whey","whip","whirlpool","whirlwind","whisker","whiskey","whisper","whistle","white","whole","wholesale","wholesaler","whorl","wick","widget","widow","width","wife","wifi","wild","wildebeest","wilderness","wildlife","will","willingness","willow","win","wind","wind-chime","windage","window","windscreen","windshield","wine","winery","wing","wingman","wingtip","wink","winner","winter","wire","wiretap","wiring","wisdom","wiseguy","wish","wisteria","wit","witch","witch-hunt","withdrawal","witness","wok","wolf","woman","wombat","wonder","wont","wood","woodchuck","woodland","woodshed","woodwind","wool","woolens","word","wording","work","workbench","worker","workforce","workhorse","working","workout","workplace","workshop","world","worm","worry","worship","worshiper","worth","wound","wrap","wraparound","wrapper","wrapping","wreck","wrecker","wren","wrench","wrestler","wriggler","wrinkle","wrist","writer","writing","wrong","xylophone","yacht","yahoo","yak","yam","yang","yard","yarmulke","yarn","yawl","year","yeast","yellow","yellowjacket","yesterday","yew","yin","yoga","yogurt","yoke","yolk","young","youngster","yourself","youth","yoyo","yurt","zampone","zebra","zebrafish","zen","zephyr","zero","ziggurat","zinc","zipper","zither","zombie","zone","zoo","zoologist","zoology","zoot-suit","zucchini"];var fn=["a","abaft","aboard","about","above","absent","across","afore","after","against","along","alongside","amid","amidst","among","amongst","an","anenst","anti","apropos","apud","around","as","aside","astride","at","athwart","atop","barring","before","behind","below","beneath","beside","besides","between","beyond","but","by","circa","concerning","considering","despite","down","during","except","excepting","excluding","failing","following","for","forenenst","from","given","in","including","inside","into","lest","like","mid","midst","minus","modulo","near","next","notwithstanding","of","off","on","onto","opposite","out","outside","over","pace","past","per","plus","pro","qua","regarding","round","sans","save","since","than","the","through","throughout","till","times","to","toward","towards","under","underneath","unlike","until","unto","up","upon","versus","via","vice","with","within","without","worth"];var gn=["abandon","abase","abate","abbreviate","abdicate","abduct","abet","abhor","abide","abjure","abnegate","abolish","abominate","abort","abound","abrade","abridge","abrogate","abscond","abseil","absent","absolve","absorb","abstain","abstract","abuse","abut","accede","accelerate","accent","accentuate","accept","access","accessorise","accessorize","acclaim","acclimate","acclimatise","acclimatize","accommodate","accompany","accomplish","accord","accost","account","accouter","accoutre","accredit","accrue","acculturate","accumulate","accuse","accustom","ace","ache","achieve","acidify","acknowledge","acquaint","acquiesce","acquire","acquit","act","action","activate","actualise","actualize","actuate","adapt","add","addle","address","adduce","adhere","adjoin","adjourn","adjudge","adjudicate","adjure","adjust","administer","admire","admit","admonish","adopt","adore","adorn","adsorb","adulterate","adumbrate","advance","advantage","advertise","advise","advocate","aerate","affect","affiliate","affirm","affix","afflict","afford","afforest","affront","age","agglomerate","aggravate","aggregate","agitate","agonise","agonize","agree","aid","ail","aim","air","airbrush","airdrop","airfreight","airlift","alarm","alert","alienate","alight","align","allay","allege","alleviate","allocate","allot","allow","alloy","allude","ally","alphabetise","alphabetize","alter","alternate","amalgamate","amass","amaze","amble","ambush","ameliorate","amend","amortise","amortize","amount","amplify","amputate","amuse","anaesthetise","anaesthetize","analyse","anchor","anesthetize","anger","angle","anglicise","anglicize","animate","anneal","annex","annihilate","annotate","announce","annoy","annul","anodise","anodize","anoint","anonymise","anonymize","answer","antagonise","antagonize","antedate","anthologise","anthologize","anticipate","ape","apologise","apologize","apostrophise","apostrophize","appal","appall","appeal","appear","appease","append","appertain","applaud","apply","appoint","apportion","appraise","appreciate","apprehend","apprentice","apprise","approach","appropriate","approve","approximate","aquaplane","arbitrate","arc","arch","archive","argue","arise","arm","arouse","arraign","arrange","array","arrest","arrive","arrogate","arse","art","articulate","ascend","ascertain","ascribe","ask","asphyxiate","aspirate","aspire","assail","assassinate","assault","assay","assemble","assent","assert","assess","assign","assimilate","assist","associate","assuage","assume","assure","asterisk","astonish","astound","atomise","atomize","atone","atrophy","attach","attack","attain","attempt","attend","attenuate","attest","attract","attribute","auction","audit","audition","augment","augur","authenticate","author","authorise","authorize","autograph","automate","autosave","autowind","avail","avenge","aver","average","avert","avoid","avow","await","awake","awaken","award","awe","ax","axe","baa","babble","baby","babysit","back","backcomb","backdate","backfill","backfire","backlight","backpack","backspace","backtrack","badger","baffle","bag","bail","bait","bake","balance","bale","ball","balloon","ballot","balls","bamboozle","ban","band","bandage","bandy","bang","bangs","banish","bank","bankroll","bankrupt","banter","baptise","baptize","bar","barbecue","bare","barf","bargain","barge","bark","barnstorm","barrack","barrel","barricade","barter","base","bash","bask","bastardise","bastardize","baste","bat","batch","bath","bathe","batten","batter","battle","baulk","bawl","bay","bayonet","be","beach","beam","bean","bear","beard","beat","beatbox","beatboxer","beatify","beautify","beaver","beckon","become","bed","bedazzle","bedeck","bedevil","beef","beep","beetle","befall","befit","befog","befriend","beg","beget","beggar","begin","begrudge","beguile","behave","behead","behold","behoove","behove","belabor","belabour","belay","belch","belie","believe","belittle","bellow","belly","bellyache","belong","belt","bemoan","bemuse","benchmark","bend","benefit","bequeath","berate","bereave","berth","beseech","beset","besiege","besmirch","bespatter","bespeak","best","bestir","bestow","bestride","bet","betake","betide","betoken","betray","better","bewail","beware","bewilder","bewitch","bias","bicker","bicycle","bid","bide","biff","bifurcate","big","bike","bilk","bill","billet","billow","bin","bind","binge","biodegrade","bird","bisect","bitch","bite","bitmap","bivouac","bivvy","blab","blabber","black","blackball","blacken","blacklist","blackmail","blag","blame","blanch","blank","blanket","blare","blaspheme","blast","blather","blaze","blazon","bleach","bleat","bleed","bleep","blemish","blench","blend","bless","blight","blind","blindfold","blindfolded","blindside","blink","bliss","blister","blitz","bloat","block","blockade","blog","blood","bloom","bloop","blossom","blot","blow","blub","blubber","bludge","bludgeon","bluff","blunder","blunt","blur","blurt","blush","bluster","board","boast","bob","bobble","bode","bodge","bog","boggle","boil","bolster","bolt","bomb","bombard","bond","bone","bonk","boo","boob","boogie","book","bookmark","boom","boomerang","boost","boot","bootleg","booze","bop","border","bore","born","borrow","boss","botch","bother","bottle","bottleful","bottom","bounce","bound","bow","bowdlerise","bowdlerize","bowl","bowlful","box","boycott","braai","brace","braces","bracket","brag","braid","brain","brainstorm","brainwash","braise","brake","branch","brand","brandish","brave","brawl","bray","brazen","breach","break","breakfast","breast","breastfeed","breathalyse","breathalyze","breathe","breed","breeze","brew","bribe","brick","bridge","bridle","brief","brighten","brim","bring","bristle","broach","broadcast","broaden","broadside","broil","broker","brood","brook","browbeat","brown","browse","bruise","bruit","brush","brutalise","brutalize","bubble","buck","bucket","bucketful","buckle","bud","buddy","budge","budget","buff","buffer","buffet","bug","bugger","build","bulge","bulk","bulldoze","bullshit","bully","bum","bumble","bump","bunch","bundle","bung","bungle","bunk","bunker","bunt","buoy","burble","burden","burgeon","burglarize","burgle","burn","burnish","burp","burrow","burst","bury","bus","bushwhack","busk","bust","bustle","busy","butcher","butt","butter","button","buttonhole","buttress","buy","buzz","buzzing","bypass","cable","cache","cackle","caddie","cadge","cage","cajole","cake","calcify","calculate","calibrate","call","calm","calve","camouflage","camp","campaign","can","canalise","canalize","cancel","cane","cannibalise","cannibalize","cannon","cannulate","canoe","canonise","canonize","canoodle","canst","cant","canter","canvass","cap","caper","capitalise","capitalize","capitulate","capsize","captain","caption","captivate","capture","caramelise","caramelize","carbonise","carbonize","carburise","carburize","card","care","careen","career","caress","caricature","carjack","carol","carom","carouse","carp","carpet","carpool","carry","cart","cartwheel","carve","cascade","case","cash","cashier","casserole","cast","castigate","castrate","catalog","catalogue","catalyse","catalyze","catapult","catch","categorise","categorize","cater","caterwaul","catnap","caucus","caulk","cause","cauterise","cauterize","caution","cave","cavil","cavort","caw","cc","cease","cede","celebrate","cement","censor","censure","centralise","centralize","centre","certificate","certify","chafe","chaff","chain","chair","chalk","challenge","champ","champion","chance","change","channel","chant","chaperon","chaperone","char","characterise","characterize","charbroil","charge","chargesheet","chargrill","charm","chart","charter","chase","chasten","chastise","chat","chatter","chauffeur","cheapen","cheat","cheater","check","checkmate","cheek","cheep","cheer","cherish","chew","chicken","chide","chill","chillax","chime","chink","chip","chirp","chisel","chivvy","chlorinate","choke","chomp","choose","chop","choreograph","chortle","chorus","christen","chromakey","chronicle","chuck","chuckle","chug","chunder","chunter","churn","cinch","circle","circulate","circumcise","circumnavigate","circumscribe","circumvent","cite","civilise","civilize","clack","claim","clam","clamber","clamor","clamour","clamp","clang","clank","clap","clarify","clash","clasp","class","classify","clatter","claw","clean","cleanse","clear","cleave","clench","clerk","click","climax","climb","clinch","cling","clink","clinking","clip","cloak","clobber","clock","clog","clone","clonk","close","closet","clot","clothe","cloud","clout","clown","club","cluck","clue","clump","clunk","cluster","clutch","clutter","coach","coagulate","coalesce","coarsen","coast","coat","coax","cobble","cock","cocoon","coddle","code","codify","coerce","coexist","cogitate","cohabit","cohere","coil","coin","coincide","collaborate","collapse","collar","collate","collect","collectivise","collectivize","collide","colligate","collocate","collude","colonise","colonize","colorize","colour","comb","combat","combine","combust","come","comfort","command","commandeer","commemorate","commence","commend","comment","commentate","commercialise","commercialize","commingle","commiserate","commission","commit","commune","communicate","commute","compact","compare","compartmentalise","compartmentalize","compel","compensate","compete","compile","complain","complement","complete","complicate","compliment","comply","comport","compose","compost","compound","comprehend","compress","comprise","compromise","compute","computerise","computerize","con","conceal","concede","conceive","concentrate","conceptualise","conceptualize","concern","concertina","conciliate","conclude","concoct","concrete","concur","concuss","condemn","condense","condescend","condition","condone","conduct","cone","confer","confess","confide","configure","confine","confirm","confiscate","conflate","conflict","conform","confound","confront","confuse","confute","congeal","congratulate","congregate","conjecture","conjoin","conjugate","conjure","conk","connect","connive","connote","conquer","conscientise","conscientize","conscript","consecrate","consent","conserve","consider","consign","consist","console","consolidate","consort","conspire","constitute","constrain","constrict","construct","construe","consult","consume","consummate","contact","contain","contaminate","contemplate","contend","content","contest","contextualise","contextualize","continue","contort","contract","contradict","contraindicate","contrast","contravene","contribute","contrive","control","controvert","convalesce","convene","converge","converse","convert","convey","convict","convince","convoke","convulse","coo","cook","cool","coop","cooperate","coordinate","cop","cope","coppice","copulate","copy","copyright","cordon","core","cork","corkscrew","corner","corral","correct","correlate","correspond","corrode","corrupt","coruscate","cosh","cosset","cost","cosy","cotton","couch","cough","counsel","count","countenance","counter","counteract","counterbalance","counterfeit","countermand","counterpoint","countersign","couple","courier","course","court","covenant","cover","covet","cow","cower","cox","cozy","crack","crackle","cradle","craft","cram","cramp","crane","crank","crap","crash","crate","crave","crawl","crayon","creak","creaking","cream","crease","create","credential","credit","creep","cremate","creolise","creolize","creosote","crest","crew","crib","crick","criminalise","criminalize","crimp","cringe","crinkle","cripple","crisp","criticise","criticize","critique","croak","crochet","crook","croon","crop","cross","crouch","crow","crowd","crown","crucify","cruise","crumble","crumple","crunch","crusade","crush","cry","crystallise","crystallize","cube","cuckold","cuddle","cudgel","cue","cuff","cull","culminate","cultivate","culture","cup","curate","curb","curdle","cure","curl","curry","curse","curtail","curtain","curtsy","curve","cushion","cuss","customise","customize","cut","cwtch","cycle","dab","dabble","dally","dam","damage","dammit","damn","damp","dampen","dance","dandle","dangle","dare","darken","darn","dart","dash","date","daub","daunt","dawdle","dawn","daydream","dazzle","deactivate","deaden","deadhead","deafen","deal","debar","debase","debate","debilitate","debit","debrief","debug","debunk","debut","decamp","decant","decapitate","decay","deceive","decelerate","decentralise","decentralize","decide","decimalise","decimalize","decimate","decipher","deck","declaim","declare","declassify","decline","declutter","decode","decommission","decompose","decompress","deconsecrate","deconstruct","decontaminate","decontrol","decorate","decouple","decoy","decrease","decree","decriminalise","decriminalize","decry","decrypt","dedicate","deduce","deduct","deejay","deem","deepen","deface","defame","default","defeat","defecate","defect","defend","defer","defile","define","deflate","deflect","deflower","defog","defoliate","deforest","deform","defrag","defragment","defraud","defray","defrock","defrost","defuse","defy","degenerate","deglaze","degrade","degrease","dehumanise","dehumanize","dehydrate","deify","deign","delay","delegate","delete","deliberate","delight","delimit","delineate","deliquesce","deliver","delouse","delude","deluge","delve","demand","demarcate","demean","demerge","demilitarise","demilitarize","demineralise","demineralize","demist","demo","demob","demobilise","demobilize","democratise","democratize","demolish","demonise","demonize","demonstrate","demoralise","demoralize","demote","demotivate","demur","demystify","denationalise","denationalize","denigrate","denitrify","denominate","denote","denounce","dent","denude","deny","depart","depend","depersonalise","depersonalize","depict","deplane","deplete","deplore","deploy","depopulate","deport","depose","deposit","deprave","deprecate","depreciate","depress","depressurise","depressurize","deprive","depute","deputise","deputize","deracinate","derail","dereference","deregulate","deride","derive","derogate","descale","descend","describe","descry","desecrate","desegregate","deselect","desensitise","desensitize","desert","deserve","design","designate","desire","desist","deskill","desolate","despair","despise","despoil","destabilise","destabilize","destock","destroy","detach","detail","detain","detect","deter","deteriorate","determine","detest","dethrone","detonate","detour","detoxify","detract","detrain","devalue","devastate","develop","deviate","devise","devoice","devolve","devote","devour","diagnose","dial","dice","dicker","dictate","diddle","die","diet","differ","differentiate","diffract","diffuse","dig","digest","digitalise","digitalize","digitise","digitize","dignify","digress","dilate","dilute","diluted","dim","diminish","dimple","dine","ding","dink","dip","diphthongise","diphthongize","direct","dirty","dis","disable","disabuse","disadvantage","disaffiliate","disafforest","disagree","disallow","disambiguate","disappear","disappoint","disapprove","disarm","disarrange","disassemble","disassociate","disavow","disband","disbar","disbelieve","disburse","discard","discern","discharge","discipline","disclaim","disclose","discolor","discolour","discomfit","discomfort","discompose","disconcert","disconnect","discontinue","discount","discourage","discourse","discover","discredit","discriminate","discuss","disdain","disembark","disembowel","disenfranchise","disengage","disentangle","disestablish","disfigure","disgorge","disgrace","disguise","disgust","dish","dishearten","dishonor","dishonour","disillusion","disincentivise","disincentivize","disinfect","disinherit","disinhibit","disintegrate","disinter","disinvest","dislike","dislocate","dislodge","dismantle","dismay","dismember","dismiss","dismount","disobey","disorient","disorientate","disown","disparage","dispatch","dispel","dispense","disperse","displace","display","displease","disport","dispose","dispossess","disprove","dispute","disqualify","disregard","disrespect","disrobe","disrupt","dissect","dissemble","disseminate","dissent","dissimulate","dissipate","dissociate","dissolve","dissuade","distance","distend","distil","distill","distinguish","distort","distract","distress","distribute","distrust","disturb","disunite","ditch","dither","dive","diverge","diversify","divert","divest","divide","divine","divorce","divulge","divvy","do","dob","dock","doctor","document","dodge","doff","dog","dole","doll","dollarise","dollarize","domesticate","dominate","don","donate","doodle","doom","doorstep","dop","dope","dose","doss","dot","dote","double","doubt","douche","douse","dovetail","down","downchange","downgrade","downlink","download","downplay","downshift","downsize","dowse","doze","draft","drag","dragoon","drain","dramatise","dramatize","drape","draught","draw","drawl","dread","dream","dredge","drench","dress","dribble","drift","drill","drink","drip","drive","drivel","drizzle","drone","drool","droop","drop","drown","drowse","drug","drum","dry","dub","duck","duckie","ducks","duel","duff","dull","dumb","dumbfound","dummy","dump","dunk","dunt","dupe","duplicate","dust","dwarf","dwell","dwindle","dye","dynamite","earmark","earn","earth","ease","eat","eavesdrop","ebb","echo","eclipse","economise","economize","eddy","edge","edify","edit","editorialise","editorialize","educate","eff","efface","effect","effectuate","egg","ejaculate","eject","eke","elaborate","elapse","elbow","elect","electrify","electrocute","electroplate","elevate","elicit","elide","eliminate","elongate","elope","elucidate","elude","email","emanate","emancipate","emasculate","embalm","embargo","embark","embarrass","embed","embellish","embezzle","embitter","emblazon","embody","embolden","emboss","embrace","embroider","embroil","emcee","emend","emerge","emigrate","emit","emote","empathise","empathize","emphasise","emphasize","employ","empower","empty","emulate","emulsify","enable","enact","encamp","encapsulate","encase","encash","enchant","encircle","enclose","encode","encompass","encounter","encourage","encroach","encrypt","encumber","end","endanger","endear","endeavor","endeavour","endorse","endow","endure","energise","energize","enervate","enfeeble","enfold","enforce","enfranchise","engage","engender","engineer","engorge","engrave","engross","engulf","enhance","enjoin","enjoy","enlarge","enlighten","enlist","enliven","enmesh","ennoble","enquire","enrage","enrapture","enrich","enrol","enroll","ensconce","enshrine","enshroud","enslave","ensnare","ensue","ensure","entail","entangle","enter","entertain","enthral","enthrall","enthrone","enthuse","entice","entitle","entomb","entrance","entrap","entreat","entrench","entrust","entwine","enumerate","enunciate","envelop","envisage","envision","envy","epitomise","epitomize","equal","equalise","equalize","equate","equip","equivocate","eradicate","erase","erect","erode","err","erupt","escalate","escape","eschew","escort","espouse","espy","essay","establish","esteem","estimate","etch","eulogise","eulogize","euthanise","euthanize","evacuate","evade","evaluate","evangelise","evangelize","evaporate","even","eventuate","evict","evidence","evince","eviscerate","evoke","evolve","exacerbate","exact","exaggerate","exalt","examine","exasperate","excavate","exceed","excel","except","excerpt","exchange","excise","excite","exclaim","exclude","excommunicate","excoriate","excrete","exculpate","excuse","execute","exemplify","exempt","exercise","exert","exeunt","exfoliate","exhale","exhaust","exhibit","exhilarate","exhort","exhume","exile","exist","exit","exonerate","exorcise","exorcize","expand","expatiate","expect","expectorate","expedite","expel","expend","experience","experiment","expiate","expire","explain","explicate","explode","exploit","explore","export","expose","expostulate","expound","express","expropriate","expunge","expurgate","extemporise","extemporize","extend","exterminate","externalise","externalize","extinguish","extirpate","extol","extort","extract","extradite","extrapolate","extricate","extrude","exude","exult","eye","eyeball","eyeglasses","fabricate","face","facilitate","factor","factorise","factorize","fade","faff","fail","faint","fake","fall","falsify","falter","familiarise","familiarize","fan","fancy","fantasise","fantasize","fare","farewell","farm","farrow","fart","fascinate","fashion","fast","fasten","father","fathom","fatten","fault","favor","favour","fawn","fax","faze","fear","feast","feather","feature","federate","feed","feel","feign","feint","fell","fellate","feminise","feminize","fence","fend","ferment","ferret","ferry","fertilise","fertilize","fess","fester","festoon","fetch","fete","fetishise","fetishize","fetter","feud","fib","fictionalise","fictionalize","fiddle","fidget","field","fight","figure","filch","file","filibuster","fill","fillet","film","filter","finagle","finalise","finalize","finance","find","fine","finesse","finger","fingerprint","finish","fire","firebomb","firm","fish","fishtail","fit","fix","fizz","fizzle","flag","flagellate","flail","flake","flame","flank","flap","flare","flash","flat","flatline","flatten","flatter","flaunt","flavour","flay","fleck","flee","fleece","flesh","flex","flick","flicker","flight","flinch","fling","flip","flirt","flit","float","flock","flog","flood","floodlight","floor","flop","floss","flounce","flounder","flour","flourish","flout","flow","flower","flub","fluctuate","fluff","flummox","flunk","flush","fluster","flutter","fly","foal","foam","fob","focalise","focalize","focus","fog","foil","foist","fold","follow","foment","fondle","fool","foot","forage","forbear","forbid","force","ford","forearm","forecast","foreclose","foregather","foreground","foresee","foreshadow","foreshorten","forestall","foretell","forewarn","forfeit","forfend","forgather","forge","forget","forgive","forgo","fork","form","formalise","formalize","format","formulate","fornicate","forsake","forswear","fortify","forward","forwards","fossick","fossilise","fossilize","foster","foul","found","founder","fox","fracture","fragment","frame","franchise","frank","fraternise","fraternize","fray","freak","free","freelance","freeload","freestyle","freewheel","freeze","freight","frequent","freshen","fret","frighten","fringe","frisk","fritter","frizz","frizzle","frogmarch","frolic","front","frost","froth","frown","fruit","frustrate","fry","fuck","fudge","fuel","fulfil","fulfill","fulminate","fumble","fume","fumigate","function","fund","funk","funnel","furl","furlough","furnish","furrow","further","fuse","fuss","gab","gabble","gad","gag","gain","gainsay","gall","gallivant","gallop","galumph","galvanise","galvanize","gamble","gambol","gang","gape","garage","garden","gargle","garland","garner","garnish","garrison","garrote","garrotte","gas","gash","gasp","gatecrash","gather","gauge","gawk","gawp","gaze","gazump","gazunder","gear","gee","gel","geld","gen","generalise","generalize","generate","gentrify","genuflect","germinate","gerrymander","gestate","gesticulate","gesture","get","ghost","ghostwrite","gibber","gift","giggle","gild","ginger","gird","girdle","give","gladden","glamorise","glamorize","glance","glare","glass","glaze","gleam","glean","glide","glimmer","glimmering","glimpse","glint","glisten","glister","glitter","gloat","globalise","globalize","glom","glorify","glory","gloss","glow","glower","glue","glug","glut","gnash","gnaw","go","goad","gob","gobble","goggle","goldbrick","goof","google","goose","gore","gorge","gossip","gouge","govern","grab","grace","grade","graduate","graft","grant","grapple","grasp","grass","grate","gratify","gravitate","graze","grease","green","greet","grey","grieve","grill","grimace","grin","grind","grip","gripe","grit","grizzle","groan","grok","groom","grope","gross","grouch","ground","group","grouse","grout","grovel","grow","growl","grub","grudge","grumble","grunt","guarantee","guard","guess","guest","guffaw","guide","guillotine","guilt","gulp","gum","gun","gurgle","gurn","gush","gussy","gust","gut","gutter","guzzle","gybe","gyp","gyrate","hack","haemorrhage","haggle","hail","hallmark","halloo","hallucinate","halt","halve","ham","hammer","hamper","hamstring","hand","handcuff","handicap","handle","hang","hanker","happen","harangue","harass","harbor","harbour","harden","hare","hark","harm","harmonise","harmonize","harness","harp","harpoon","harrow","harrumph","harry","harvest","hash","hassle","hasten","hatch","hate","haul","haunt","have","haw","hawk","hazard","haze","head","headbutt","headhunt","headline","heal","heap","hear","hearken","hearten","heat","heave","heckle","hector","hedge","heed","heel","heft","heighten","heist","help","hem","hemorrhage","herald","herd","hesitate","hew","hex","hibernate","hiccough","hiccup","hide","hie","highball","highlight","hightail","hijack","hike","hinder","hinge","hint","hire","hiss","hit","hitch","hitchhike","hive","hoard","hoax","hobble","hobnob","hock","hoe","hog","hoick","hoist","hold","hole","holiday","holler","hollow","holster","home","homeschool","homestead","hone","honeymoon","honk","honour","hoodwink","hoof","hook","hoon","hoot","hoover","hop","hope","horn","horrify","horse","horsewhip","hose","hosepipe","hospitalise","hospitalize","host","hot","hotfoot","hound","house","hover","howl","huddle","huff","hug","hull","hum","humanise","humanize","humble","humiliate","humour","hump","hunch","hunger","hunker","hunt","hurdle","hurl","hurry","hurt","hurtle","husband","hush","husk","hustle","hybridise","hybridize","hydrate","hydroplane","hype","hyperventilate","hyphenate","hypnotise","hypnotize","hypothesise","hypothesize","ice","iconify","idealise","idealize","ideate","identify","idle","idolise","idolize","ignite","ignore","illuminate","illumine","illustrate","imagine","imagineer","imbibe","imbue","imitate","immerse","immigrate","immobilise","immobilize","immolate","immortalise","immortalize","immunise","immunize","immure","impact","impair","impale","impanel","impart","impeach","impede","impel","imperil","impersonate","impinge","implant","implement","implicate","implode","implore","imply","import","importune","impose","impound","impoverish","impregnate","impress","imprint","imprison","improve","improvise","impugn","inactivate","inaugurate","incapacitate","incarcerate","incarnate","incense","incentivise","incentivize","inch","incinerate","incise","incite","incline","include","incommode","inconvenience","incorporate","increase","incriminate","incubate","inculcate","incur","indemnify","indent","index","indicate","indict","individualise","individualize","individuate","indoctrinate","induce","induct","indulge","industrialise","industrialize","infantilise","infantilize","infect","infer","infest","infill","infiltrate","inflame","inflate","inflect","inflict","influence","inform","infringe","infuriate","infuse","ingest","ingratiate","inhabit","inhale","inhere","inherit","inhibit","initial","initialise","initialize","initiate","inject","injure","ink","inlay","innovate","inoculate","input","inscribe","inseminate","insert","inset","insinuate","insist","inspect","inspire","install","instance","instigate","instil","instill","institute","institutionalise","institutionalize","instruct","insulate","insult","insure","integrate","intend","intensify","inter","interact","interbreed","intercede","intercept","interchange","interconnect","intercut","interest","interface","interfere","interject","interlace","interleave","interlink","interlock","intermarry","intermesh","intermingle","intermix","intern","internalise","internalize","internationalise","internationalize","interpenetrate","interpolate","interpose","interpret","interrelate","interrogate","interrupt","intersect","intersperse","intertwine","intervene","interview","interweave","interwork","intimate","intimidate","intone","intoxicate","intrigue","introduce","intrude","intubate","intuit","inundate","inure","invade","invalid","invalidate","inveigh","inveigle","invent","inventory","invert","invest","investigate","invigilate","invigorate","invite","invoice","invoke","involve","ionise","ionize","irk","iron","irradiate","irrigate","irritate","irrupt","isolate","issue","italicise","italicize","itch","itemise","itemize","iterate","jab","jabber","jack","jackknife","jail","jam","jangle","jar","jaw","jaywalk","jazz","jeer","jell","jeopardise","jeopardize","jerk","jest","jet","jettison","jib","jibe","jig","jiggle","jilt","jingle","jink","jinx","jive","jockey","jog","joggle","join","joint","joke","jol","jolly","jolt","josh","jostle","jot","journey","joust","judder","judge","juggle","juice","jumble","jump","junk","justify","jut","juxtapose","keel","keelhaul","keen","keep","ken","key","keyboard","kibitz","kick","kid","kidnap","kill","kindle","kink","kip","kiss","kit","kite","klap","kludge","knacker","knead","knee","kneecap","kneel","knife","knight","knit","knock","knot","know","knuckle","kowtow","kvetch","label","labour","lace","lacerate","lack","lacquer","lactate","ladder","ladle","lag","lam","lamb","lambast","lambaste","lament","lamp","lampoon","lance","land","lands","landscape","languish","lap","lapse","lard","large","lark","lash","lasso","last","latch","lather","laud","laugh","launch","launder","lavish","lay","layer","laze","leach","lead","leaf","leaflet","leak","lean","leap","leapfrog","learn","lease","leash","leave","leaven","lech","lecture","leer","leg","legalise","legalize","legislate","legitimise","legitimize","lend","lengthen","lessen","let","letter","letterbox","level","lever","leverage","levitate","levy","liaise","libel","liberalise","liberalize","liberate","license","lick","lie","lift","ligate","light","lighten","like","liken","limber","lime","limit","limp","line","linger","link","lionise","lionize","liquefy","liquidate","liquidise","liquidize","lisp","list","listen","litigate","litter","live","liven","load","loads","loaf","loan","loathe","lob","lobby","lobotomise","lobotomize","localise","localize","locate","lock","lodge","loft","log","loiter","loll","lollop","long","look","looks","loom","loop","loose","loosen","loot","lop","lope","lord","lose","lounge","lour","louse","love","low","lowball","lower","lubricate","luck","lug","lull","lumber","lump","lunch","lunge","lurch","lure","lurk","lust","luxuriate","lynch","macerate","machine","madden","magic","magnetise","magnetize","magnify","mail","maim","mainline","mainstream","maintain","major","make","malfunction","malign","malinger","maltreat","man","manacle","manage","mandate","mangle","manhandle","manicure","manifest","manipulate","manoeuvre","mantle","manufacture","manure","map","mar","march","marginalise","marginalize","marinate","mark","market","maroon","marry","marshal","martyr","marvel","masculinise","masculinize","mash","mask","masquerade","mass","massacre","massage","master","mastermind","masticate","masturbate","match","mate","materialise","materialize","matriculate","matter","mature","maul","maunder","max","maximise","maximize","mean","meander","measure","mechanise","mechanize","medal","meddle","mediate","medicate","meditate","meet","meld","mellow","melt","memorialise","memorialize","memorise","memorize","menace","mend","menstruate","mention","meow","mercerise","mercerize","merchandise","merge","merit","mesh","mesmerise","mesmerize","mess","message","metabolise","metabolize","metamorphose","mete","meter","methinks","mew","mewl","miaow","microblog","microchip","micromanage","microwave","micturate","migrate","militarise","militarize","militate","milk","mill","mime","mimic","mince","mind","mine","mingle","miniaturise","miniaturize","minimise","minimize","minister","minor","mint","minute","mirror","misapply","misappropriate","misbehave","miscalculate","miscarry","miscast","misconceive","misconstrue","miscount","misdiagnose","misdial","misdirect","misfile","misfire","misgovern","mishandle","mishear","mishit","misinform","misinterpret","misjudge","miskey","mislay","mislead","mismanage","mismatch","misname","misplace","misplay","mispronounce","misquote","misread","misreport","misrepresent","miss","mission","misspell","misspend","mist","mistake","mistime","mistreat","mistrust","misunderstand","misuse","mitigate","mitre","mix","moan","mob","mobilise","mobilize","mock","mod","model","moderate","modernise","modernize","modify","modulate","moisten","moisturise","moisturize","mold","molder","molest","mollify","mollycoddle","molt","monitor","monopolise","monopolize","moo","mooch","moon","moonlight","moonwalk","moor","moot","mop","mope","moralise","moralize","morph","mortar","mortgage","mortify","mosey","mosh","mothball","mother","motion","motivate","motor","mould","moulder","moult","mount","mourn","mouse","mouth","move","movies","mow","muck","muddle","muddy","muff","muffle","mug","mulch","mull","multicast","multiply","multitask","mumble","mumbling","mummify","munch","murder","murmur","murmuring","murmurings","muscle","muse","mushroom","muss","muster","mutate","mute","mutilate","mutiny","mutter","muzzle","mystify","nab","nag","nail","name","namecheck","nap","narrate","narrow","narrowcast","nasalise","nasalize","nationalise","nationalize","natter","naturalise","naturalize","nauseate","navigate","near","nearer","nearest","neaten","necessitate","neck","necklace","need","needle","negate","negative","neglect","negotiate","neigh","nerve","nest","nestle","net","nettle","network","neuter","neutralise","neutralize","nibble","nick","nickname","niggle","nip","nitrify","nix","nobble","nod","nominalize","nominate","norm","normalise","normalize","nose","nosedive","nosh","notarise","notarize","notch","note","notice","notify","nourish","nudge","nuke","nullify","numb","number","nurse","nurture","nut","nuzzle","obey","obfuscate","object","objectify","oblige","obliterate","obscure","observe","obsess","obstruct","obtain","obtrude","obviate","occasion","occlude","occupy","occur","off","offend","offer","officiate","offload","offset","offshore","ogle","oil","okay","omit","ooze","open","operate","opine","oppose","oppress","opt","optimise","optimize","option","orbit","orchestrate","ordain","order","organise","organize","orient","orientate","originate","ornament","orphan","oscillate","ossify","ostracise","ostracize","oust","out","outbid","outclass","outdistance","outdo","outface","outfit","outflank","outfox","outgrow","outgun","outlast","outlaw","outline","outlive","outmaneuver","outmanoeuvre","outnumber","outpace","outperform","outplay","outpoint","output","outrage","outrank","outrun","outsell","outshine","outsmart","outsource","outstay","outstrip","outvote","outweigh","outwit","overachieve","overact","overawe","overbalance","overbook","overburden","overcharge","overcome","overcompensate","overcook","overdevelop","overdo","overdose","overdraw","overdub","overeat","overemphasize","overestimate","overexpose","overextend","overfeed","overflow","overfly","overgeneralise","overgeneralize","overgraze","overhang","overhaul","overhear","overheat","overindulge","overlap","overlay","overlie","overload","overlook","overpay","overplay","overpower","overprint","overproduce","overrate","overreach","overreact","override","overrule","overrun","oversee","oversell","overshadow","overshoot","oversimplify","oversleep","overspend","overstate","overstay","overstep","overstock","overstretch","overtake","overtax","overthrow","overtrain","overturn","overuse","overvalue","overwhelm","overwinter","overwork","overwrite","ovulate","owe","own","oxidise","oxidize","oxygenate","pace","pacify","pack","package","packetise","packetize","pad","paddle","padlock","page","paginate","pailful","pain","paint","pair","pal","palatalise","palatalize","pale","pall","palliate","palm","palpate","palpitate","pamper","pan","pander","panel","panhandle","panic","pant","paper","parachute","parade","parallel","paralyse","paralyze","paraphrase","parboil","parcel","parch","pardon","pare","park","parlay","parley","parody","parole","parrot","parry","parse","part","partake","participate","particularise","particularize","partition","partner","party","pass","passivise","passivize","paste","pasteurise","pasteurize","pasture","pat","patch","patent","patrol","patronise","patronize","patter","pattern","pause","pave","paw","pawn","pay","peak","peal","peck","pedal","peddle","pedestrianise","pedestrianize","pee","peek","peel","peep","peer","peg","pelt","pen","penalise","penalize","pencil","penetrate","pension","people","pep","pepper","perambulate","perceive","perch","percolate","perfect","perforate","perform","perfume","perish","perjure","perk","perm","permeate","permit","perpetrate","perpetuate","perplex","persecute","persevere","persist","personalise","personalize","personify","perspire","persuade","pertain","perturb","peruse","pervade","pervert","pester","pet","peter","petition","petrify","phase","philosophise","philosophize","phone","photocopy","photograph","photoshop","photosynthesise","photosynthesize","phrase","pick","picket","pickle","picnic","picture","picturise","picturize","piddle","piece","pierce","pig","pigeonhole","piggyback","pike","pile","pilfer","pill","pillage","pillory","pillow","pilot","pimp","pin","pinch","pine","ping","pinion","pink","pinpoint","pioneer","pip","pipe","pique","pirate","pirouette","piss","pit","pitch","pity","pivot","pixelate","pixellate","placate","place","plagiarise","plagiarize","plague","plait","plan","plane","plant","plaster","plasticise","plasticize","plate","plateau","play","plead","please","pledge","plight","plod","plonk","plop","plot","plough","pluck","plug","plumb","plummet","plump","plunder","plunge","plunk","pluralise","pluralize","ply","poach","pocket","point","poise","poison","poke","polarise","polarize","pole","poleax","poleaxe","police","polish","politicise","politicize","poll","pollard","pollinate","pollute","polymerise","polymerize","ponce","ponder","pong","pontificate","pony","poo","pooh","pool","poop","pootle","pop","popularise","popularize","populate","pore","port","portend","portion","portray","pose","posit","position","possess","posset","post","postmark","postpone","postulate","posture","pot","potter","pounce","pound","pour","pout","powder","power","practice","practise","praise","praises","prance","prang","prate","prattle","pray","preach","precede","precipitate","precis","preclude","predate","predecease","predetermine","predicate","predict","predispose","predominate","preen","preface","prefer","prefigure","prefix","preheat","prejudge","prejudice","preload","premaster","premiere","preoccupy","prep","prepare","prepone","preregister","presage","prescind","prescribe","preselect","presell","present","preserve","preset","preside","press","pressure","pressurise","pressurize","presume","presuppose","pretend","pretest","prettify","prevail","prevaricate","prevent","preview","prey","price","prick","prickle","pride","prime","primp","print","prioritise","prioritize","prise","privatise","privatize","privilege","prize","probate","probe","proceed","process","proclaim","procrastinate","procreate","proctor","procure","prod","produce","profane","profess","professionalise","professionalize","proffer","profile","profit","program","programme","progress","prohibit","project","proliferate","prolong","promenade","promise","promote","prompt","promulgate","pronounce","proof","proofread","prop","propagandise","propagandize","propagate","propel","prophesy","propitiate","propose","proposition","propound","proscribe","prosecute","proselytise","proselytize","prospect","prosper","prostitute","prostrate","protect","protest","protrude","prove","provide","provision","provoke","prowl","prune","pry","psych","psychoanalyse","publicise","publicize","publish","pucker","puff","puke","pull","pullulate","pulp","pulsate","pulse","pulverise","pulverize","pummel","pump","pun","punch","punctuate","puncture","punish","punt","pupate","purchase","purge","purify","purl","purloin","purport","purr","purse","pursue","purvey","push","pussyfoot","put","putrefy","putt","putter","puzzle","quack","quadruple","quaff","quail","quake","qualify","quantify","quarantine","quarrel","quarry","quarter","quarterback","quash","quaver","queer","quell","quench","query","quest","question","queue","quibble","quicken","quiet","quieten","quintuple","quip","quirk","quit","quiver","quiz","quote","quoth","rabbit","race","rack","radiate","radicalise","radicalize","radio","raffle","rag","rage","raid","rail","railroad","rain","raise","rake","rally","ram","ramble","ramp","rampage","randomise","randomize","range","rank","rankle","ransack","ransom","rant","rap","rape","rappel","rasp","rasterise","rasterize","rat","ratchet","rate","ratify","ration","rationalise","rationalize","rattle","ravage","rave","ravel","ravish","raze","razz","reach","reacquaint","react","reactivate","read","readdress","readies","readjust","readmit","ready","reaffirm","realign","realise","realize","reallocate","ream","reanimate","reap","reappear","reapply","reappoint","reappraise","rear","rearm","rearrange","reason","reassemble","reassert","reassess","reassign","reassure","reawaken","rebel","reboot","reborn","rebound","rebrand","rebuff","rebuild","rebuke","rebut","recall","recant","recap","recapitulate","recapture","recast","recede","receive","recess","recharge","reciprocate","recite","reckon","reclaim","reclassify","recline","recognise","recognize","recoil","recollect","recommence","recommend","recompense","reconcile","recondition","reconfigure","reconfirm","reconnect","reconnoitre","reconquer","reconsider","reconstitute","reconstruct","reconvene","record","recount","recoup","recover","recreate","recrudesce","recruit","rectify","recuperate","recur","recycle","redact","redden","redecorate","redeem","redefine","redeploy","redesign","redevelop","redial","redirect","rediscover","redistribute","redistrict","redo","redouble","redound","redraft","redraw","redress","reduce","reduplicate","reef","reek","reel","ref","refer","referee","reference","refill","refinance","refine","refit","reflate","reflect","refloat","refocus","reform","reformat","reformulate","refract","refrain","refresh","refrigerate","refuel","refund","refurbish","refuse","refute","regain","regale","regard","regenerate","register","regress","regret","regroup","regularise","regularize","regulate","regurgitate","rehabilitate","rehash","rehear","rehearse","reheat","rehome","rehouse","reign","reignite","reimburse","rein","reincarnate","reinforce","reinstate","reinterpret","reintroduce","reinvent","reinvest","reinvigorate","reissue","reiterate","reject","rejig","rejigger","rejoice","rejoin","rejuvenate","rekindle","relapse","relate","relaunch","relax","relay","release","relegate","relent","relieve","relinquish","relish","relive","reload","relocate","rely","remain","remainder","remake","remand","remap","remark","remarry","remaster","remediate","remedy","remember","remind","reminisce","remit","remix","remodel","remonstrate","remortgage","remould","remount","remove","remunerate","rename","rend","render","rendezvous","renege","renew","renounce","renovate","rent","reoccur","reoffend","reopen","reorder","reorganise","reorganize","reorient","repackage","repair","repatriate","repay","repeal","repeat","repel","repent","rephrase","replace","replay","replenish","replicate","reply","report","repose","repossess","represent","repress","reprieve","reprimand","reprint","reproach","reprocess","reproduce","reprove","repudiate","repulse","repurpose","request","require","requisition","requite","rerun","reschedule","rescind","rescue","research","researches","resect","resell","resemble","resent","reserve","reset","resettle","reshape","reshuffle","reside","resign","resist","resit","resize","reskill","resolve","resonate","resort","resound","resource","respect","respire","respond","respray","rest","restart","restate","restock","restore","restrain","restrict","restring","restructure","result","resume","resupply","resurface","resurrect","resuscitate","retail","retain","retake","retaliate","retard","retch","retell","retest","rethink","retire","retool","retort","retouch","retrace","retract","retrain","retreat","retrench","retrieve","retrofit","retry","return","reunify","reunite","reuse","rev","revalue","revamp","reveal","revel","revenge","reverberate","revere","reverse","revert","review","revile","revise","revisit","revitalise","revitalize","revive","revivify","revoke","revolt","revolutionise","revolutionize","revolve","reward","rewind","rewire","reword","rework","rewrite","rhapsodise","rhapsodize","rhyme","rib","rick","ricochet","rid","riddle","ride","ridge","ridicule","riffle","rifle","rig","right","rightsize","rile","rim","ring","rinse","riot","rip","ripen","riposte","ripple","rise","risk","ritualise","ritualize","rival","rivet","roam","roar","roast","rob","robe","rock","rocket","roger","roll","romance","romanticise","romanticize","romp","roof","room","roost","root","rope","rosin","roster","rot","rotate","rouge","rough","roughen","roughhouse","round","rouse","roust","rout","route","rove","row","rub","rubberneck","rubbish","ruck","rue","ruffle","ruin","ruins","rule","rumble","ruminate","rummage","rumor","rumour","rumple","run","rupture","rush","rust","rustle","sabotage","sack","sacrifice","sadden","saddle","safeguard","sag","sail","salaam","salivate","sally","salt","salute","salvage","salve","sample","sanctify","sanction","sand","sandbag","sandblast","sandpaper","sandwich","sanitise","sanitize","sap","sashay","sass","sate","satiate","satirise","satirize","satisfy","saturate","saunter","savage","save","savor","savour","saw","say","scald","scale","scallop","scalp","scamper","scan","scandalise","scandalize","scapegoat","scar","scare","scarf","scarify","scarper","scatter","scattering","scavenge","scent","schedule","schematise","schematize","scheme","schlep","schlepp","schmooze","school","schtup","schuss","scoff","scold","scoop","scoot","scope","scorch","score","scorn","scotch","scour","scourge","scout","scowl","scrabble","scram","scramble","scrap","scrape","scratch","scrawl","scream","screech","screen","screw","scribble","scrimp","script","scroll","scrounge","scrub","scrummage","scrunch","scruple","scrutinise","scrutinize","scud","scuff","scuffle","scull","sculpt","scupper","scurry","scuttle","scythe","seal","sealift","sear","search","season","seat","secede","seclude","second","secrete","section","secularise","secularize","secure","sedate","seduce","see","seed","seek","seep","seethe","segment","segregate","segue","seize","select","sell","sellotape","semaphore","send","sensationalise","sensationalize","sense","sensitise","sensitize","sentence","sentimentalise","sentimentalize","separate","sequence","sequester","sequestrate","serenade","serialise","serialize","sermonise","sermonize","serve","service","set","settle","sever","sew","sex","sexualise","sexualize","shack","shackle","shade","shadow","shaft","shag","shake","shalt","sham","shamble","shame","shampoo","shanghai","shape","share","sharpen","shatter","shave","shear","sheathe","shed","sheer","shell","shellac","shelter","shelve","shepherd","shield","shift","shimmer","shimmy","shin","shine","shinny","ship","shipwreck","shirk","shit","shiver","shock","shoe","shoehorn","shoo","shoot","shop","shoplift","shore","short","shorten","shortlist","shoulder","shout","shove","shovel","show","showboat","showcase","shower","shred","shriek","shrill","shrink","shrivel","shroom","shroud","shrug","shtup","shuck","shudder","shuffle","shun","shunt","shush","shut","shuttle","shy","sic","sick","sicken","side","sideline","sidestep","sideswipe","sidetrack","sidle","sieve","sift","sigh","sight","sightsee","sign","signal","signify","signpost","silence","silhouette","silt","silver","simmer","simper","simplify","simulate","simulcast","sin","sing","singe","single","sink","sip","siphon","sire","sit","site","situate","size","sizzle","skate","skateboard","skedaddle","sketch","skew","skewer","ski","skid","skim","skimp","skin","skip","skipper","skirmish","skirt","skitter","skive","skivvy","skulk","sky","skyjack","skyrocket","slack","slacken","slag","slake","slam","slander","slant","slap","slash","slate","slather","slaughter","slave","slaver","slay","sledge","sleek","sleep","sleepwalk","sleet","slew","slice","slick","slide","slight","slim","sling","slink","slip","slit","slither","slob","slobber","slog","slop","slope","slosh","slot","slouch","slough","slow","slug","sluice","slum","slumber","slump","slur","slurp","smack","smart","smarten","smash","smear","smell","smelt","smile","smirk","smite","smoke","smooch","smoodge","smooth","smother","smoulder","smudge","smuggle","snack","snaffle","snag","snaggle","snake","snap","snare","snarf","snarl","snatch","sneak","sneer","sneeze","snicker","sniff","sniffle","snigger","snip","snipe","snitch","snivel","snog","snooker","snoop","snooper","snooze","snore","snorkel","snort","snow","snowball","snowplough","snowplow","snub","snuff","snuffle","snuffling","snuggle","soak","soap","soar","sob","sober","socialise","socialize","sock","sod","sodomise","sodomize","soften","soil","sojourn","solace","solder","soldier","sole","solemnise","solemnize","solicit","solidify","soliloquize","solve","somersault","soothe","sorrow","sort","sough","sound","soundproof","soup","sour","source","souse","sow","space","span","spangle","spank","spar","spare","spark","sparkle","spatter","spattering","spawn","spay","speak","spear","spearhead","spec","specialise","specialize","specify","spectacles","spectate","speculate","speed","spell","spellcheck","spend","spew","spice","spiff","spike","spill","spin","spiral","spirit","spit","spite","splash","splatter","splay","splice","splinter","split","splosh","splurge","splutter","spoil","sponge","sponsor","spoof","spook","spool","spoon","sport","sports","spot","spotlight","spout","sprain","sprawl","spray","spread","spreadeagle","spring","springboard","sprinkle","sprint","spritz","sprout","spruce","spur","spurn","spurt","sputter","spy","squabble","squall","squander","square","squash","squat","squawk","squeak","squeal","squeeze","squelch","squint","squirm","squirrel","squirt","squish","stab","stabilise","stabilize","stable","stables","stack","staff","stage","stagger","stagnate","stain","stake","stalk","stall","stammer","stamp","stampede","stanch","stand","standardise","standardize","staple","star","starch","stare","start","startle","starve","stash","state","statement","station","staunch","stave","stay","steady","steal","steam","steamroller","steel","steep","steepen","steer","stem","stencil","step","stereotype","sterilise","sterilize","stew","stick","stickybeak","stiff","stiffen","stifle","stigmatise","stigmatize","still","stimulate","sting","stinger","stink","stint","stipple","stipulate","stir","stitch","stock","stockpile","stoke","stomach","stomp","stone","stonewall","stoop","stop","stopper","store","storm","storyboard","stow","straddle","strafe","straggle","straighten","strain","strand","strangle","strap","stratify","stravage","stravaig","stray","streak","stream","streamline","strengthen","stress","stretch","stretcher","strew","stride","strike","string","strip","strive","stroke","stroll","structure","struggle","strum","strut","stub","stud","study","stuff","stultify","stumble","stump","stun","stunt","stupefy","stutter","style","stymie","sub","subcontract","subdivide","subdue","subedit","subject","subjugate","sublet","sublimate","submerge","submit","subordinate","suborn","subpoena","subscribe","subside","subsidise","subsidize","subsist","substantiate","substitute","subsume","subtend","subtitle","subtract","subvert","succeed","succor","succour","succumb","suck","sucker","suckle","suction","sue","suffer","suffice","suffocate","suffuse","sugar","suggest","suit","sulk","sulks","sully","sum","summarise","summarize","summon","summons","sun","sunbathe","sunder","sunset","sup","superimpose","superintend","superpose","supersede","supersize","supersized","supervene","supervise","supplant","supplement","supply","support","suppose","suppress","suppurate","surcharge","surf","surface","surge","surmise","surmount","surpass","surprise","surrender","surround","survey","survive","suspect","suspend","suspenders","suss","sustain","suture","swab","swaddle","swagger","swallow","swamp","swan","swank","swap","swarm","swat","swath","swathe","sway","swear","sweat","sweep","sweeps","sweeten","swell","swelter","swerve","swig","swill","swim","swindle","swing","swipe","swirl","swish","switch","swivel","swoon","swoop","swoosh","swot","symbolise","symbolize","sympathise","sympathize","symptomize","synchronise","synchronize","syndicate","synthesise","synthesize","syringe","systematise","systematize","tab","table","tabulate","tack","tackle","tag","tail","tailgate","tailor","taint","take","talk","tally","tame","tamp","tamper","tan","tangle","tango","tank","tankful","tantalise","tantalize","tap","tape","taper","tar","target","tarmac","tarnish","tarry","tart","task","taste","tattle","tattoo","taunt","tauten","tax","taxi","taxicab","teach","team","tear","tease","tee","teem","teeter","teethe","telecast","telecommute","teleconference","telegraph","telemeter","teleoperate","telephone","teleport","telescope","televise","telex","tell","telnet","temp","temper","temporise","temporize","tempt","tenant","tend","tender","tenderise","tenderize","tense","tension","tergiversate","term","terminate","terraform","terrify","terrorise","terrorize","test","testify","tether","text","thank","thatch","thaw","theorise","theorize","thicken","thin","think","thirst","thrash","thread","threaten","thresh","thrill","thrive","throb","throbbing","throng","throttle","throw","thrust","thud","thumb","thump","thunder","thwack","thwart","tick","ticket","tickle","tide","tidy","tie","tighten","tile","till","tilt","time","timetable","tinge","tingle","tingling","tinker","tinkle","tinkling","tint","tip","tippex","tipple","tiptoe","tire","titillate","titivate","title","titrate","titter","toady","toast","toboggan","toddle","toe","tog","toggle","toil","toke","tolerate","toll","tone","tongue","tonify","tool","toot","tootle","top","topple","torch","torment","torpedo","torture","toss","tot","total","tote","totter","touch","tough","toughen","tour","tousle","tout","tow","towel","tower","toy","trace","track","trade","traduce","traffic","trail","train","traipse","trammel","tramp","trample","trampoline","tranquilize","tranquillize","transact","transcend","transcribe","transfer","transfigure","transfix","transform","transfuse","transgress","transit","translate","transliterate","transmit","transmogrify","transmute","transpire","transplant","transport","transpose","trap","trash","traumatise","traumatize","travel","traverse","trawl","tread","treasure","treat","treble","trek","tremble","trembling","trepan","trespass","trial","trick","trickle","trifle","trigger","trill","trim","trip","triple","triumph","trivialise","trivialize","troll","tromp","troop","trot","trouble","troubleshoot","trounce","trouser","truant","truck","trudge","trump","trumpet","truncate","trundle","truss","trust","try","tuck","tug","tugboat","tumble","tune","tunnel","turbocharge","turf","turn","tussle","tut","tutor","twang","tweak","tweet","twiddle","twig","twin","twine","twinkle","twirl","twist","twitch","twitter","twittering","type","typecast","typeset","typify","tyrannise","tyrannize","ulcerate","ululate","ump","umpire","unbalance","unban","unbend","unblock","unbuckle","unburden","unbutton","uncoil","uncork","uncouple","uncover","uncurl","undelete","underachieve","underbid","undercharge","undercook","undercut","underestimate","underestimation","underexpose","undergo","underlie","underline","undermine","underpay","underperform","underpin","underplay","underrate","underscore","undersell","undershoot","underspend","understand","understate","understudy","undertake","undervalue","underwrite","undo","undock","undress","undulate","unearth","unfasten","unfold","unfreeze","unfurl","unhand","unhinge","unhitch","unhook","unify","uninstall","unionise","unionize","unite","unlace","unlearn","unleash","unload","unlock","unloose","unloosen","unmask","unnerve","unpack","unpick","unplug","unravel","unroll","unsaddle","unscramble","unscrew","unseat","unsettle","unsubscribe","untangle","untie","unveil","unwind","unwrap","unzip","up","upbraid","upchange","upchuck","update","upend","upgrade","uphold","upholster","uplift","upload","uproot","upsell","upset","upshift","upskill","upstage","urge","urinate","use","usher","usurp","utilise","utilize","utter","vacate","vacation","vaccinate","vacillate","vacuum","valet","validate","value","vamoose","vandalise","vandalize","vanish","vanquish","vaporise","vaporize","varnish","vary","vault","veer","veg","vegetate","veil","vend","veneer","venerate","vent","ventilate","venture","verbalise","verbalize","verge","verify","versify","vest","vet","veto","vex","vibrate","victimise","victimize","vide","video","videotape","vie","view","viewing","vilify","vindicate","violate","visit","visualise","visualize","vitiate","vitrify","vocalize","voice","void","volley","volumise","volumize","volunteer","vomit","vote","vouch","vouchsafe","vow","voyage","vulgarise","vulgarize","wad","waddle","wade","waffle","waft","wag","wage","wager","waggle","wail","wait","waive","wake","wakeboard","waken","walk","wall","wallop","wallow","wallpaper","waltz","wander","wane","wangle","wank","want","warble","ward","warm","warn","warp","warrant","wash","wassail","waste","watch","water","waterproof","waterski","wave","waver","wax","waylay","weaken","wean","weaponise","weaponize","wear","weary","weasel","weather","weatherise","weatherize","weave","wed","wedge","wee","weed","weekend","weep","weigh","weight","weird","welch","welcome","weld","well","welly","welsh","wend","westernise","westernize","wet","whack","wheedle","wheel","wheeze","whelp","whet","whiff","while","whilst","whimper","whine","whinge","whinny","whip","whirl","whirr","whirring","whisk","whisper","whispering","whistle","whiten","whitewash","whittle","whiz","whizz","whoop","whoosh","whup","wick","widen","widow","wield","wig","wiggle","wildcat","will","wilt","wimp","win","wince","winch","wind","winds","windsurf","wine","wing","wink","winkle","winnow","winter","wipe","wire","wiretap","wise","wisecrack","wish","withdraw","wither","withhold","withstand","witness","witter","wobble","wolf","wonder","woo","woof","word","work","worm","worry","worsen","worship","worst","wound","wow","wowee","wrangle","wrap","wreak","wreathe","wreck","wrench","wrest","wrestle","wriggle","wring","wrinkle","writ","write","writhe","wrong","wrought","xerox","yack","yak","yank","yap","yaw","yawn","yearn","yell","yellow","yelp","yield","yodel","yoke","yomp","yowl","yuppify","zap","zero","zigzag","zing","zip","zone","zoom"];var Ec=Object.freeze({adjective:dn,adverb:pn,conjunction:un,interjection:hn,noun:mn,preposition:fn,verb:gn}),yn=Ec;var xc=Object.freeze({title:"English",syntax:Qa,time:Za,internet:sn,person:cn,word:yn}),oe=xc;var at=["male","female"],be=Symbol("randomValue"),Ci=Symbol("typesValue"),Le=Symbol("localeValue"),Pr=class{[Ci];[be];[Le];constructor(e={}){this[Ci]=new Ve(e.seed),this[be]=new Ot(e.seed),this[Le]=e.locale||oe}seed(e){this[be].seed(e),this[Ci].seed(e)}locale(e){this[Le]=e||oe}firstName(e){let{person:t}=this[Le],i=e&&at.includes(e)?e:this[be].pickOne(at),r;t&&t.firstName&&t.firstName[i]?r=t.firstName:r=oe.person.firstName;let s=r[i];return this[be].pickOne(s)}lastName(e){let{person:t}=this[Le];if(!e){let a=t&&t.lastName||oe.person.lastName;if(Array.isArray(a.general)&&a.general.length)return this[be].pickOne(a.general);throw new Error("The locale does not have a general last name pool.")}let i=e&&at.includes(e)?e:this[be].pickOne(at),r;t&&t.lastName&&t.lastName[i]?r=t.lastName:r=oe.person.lastName;let s=r[i];return this[be].pickOne(s)}middleName(e){let{person:t}=this[Le],i=t&&t.middleName||t&&t.firstName||oe.person.firstName,r=e&&at.includes(e)?e:this[be].pickOne(at),s=i[r];return this[be].pickOne(s)}name(e={}){let{firstName:t,lastName:i,gender:r}=e,s=[];return this[Ci].boolean({likelihood:10})&&s.push(this.prefix(r)),s.push(t||this.firstName(r)),s.push(i||this.lastName(r)),this[Ci].boolean({likelihood:10})&&s.push(this.suffix(r)),s.join(" ")}gender(e){let{person:t}=this[Le],i=t&&t.gender||oe.person.gender;return e?this[be].pickOne(i.binary||oe.person.gender.binary):this[be].pickOne(i.pool||oe.person.gender.pool)}prefix(e){let{person:t}=this[Le],i=t&&t.prefix||oe.person.prefix;if(!e&&Array.isArray(i.general)&&i.general.length)return this[be].pickOne(i.general);let r=e&&at.includes(e)?e:this[be].pickOne(at),s=i[r]||oe.person.prefix[r];return this[be].pickOne(s)}suffix(e){let{person:t}=this[Le],i=t&&t.suffix||oe.person.suffix;if(Array.isArray(i.general)&&i.general.length)return this[be].pickOne(i.general);let r=e&&at.includes(e)?e:this[be].pickOne(at),s=i[r]||oe.person.suffix[r];return this[be].pickOne(s)}jobTitle(){let e=this.jobDescriptor(),t=this.jobArea(),i=this.jobType();return`${e} ${t} ${i}`}jobDescriptor(){let{person:e}=this[Le],t;return e&&e.title&&e.title.descriptor?t=e.title:t=oe.person.title,this[be].pickOne(t.descriptor)}jobArea(){let{person:e}=this[Le],t;return e&&e.title&&e.title.level?t=e.title:t=oe.person.title,this[be].pickOne(t.level)}jobType(){let{person:e}=this[Le],t;return e&&e.title&&e.title.job?t=e.title:t=oe.person.title,this[be].pickOne(t.job||[])}};var Or=Symbol("randomValue"),Ke=Symbol("typesValue"),Cr=Symbol("localeValue"),Rr=class{[Ke];[Or];[Cr];constructor(e={}){this[Ke]=new Ve(e.seed),this[Or]=new Ot(e.seed),this[Cr]=e.locale||oe}seed(e){this[Or].seed(e),this[Ke].seed(e)}locale(e){this[Cr]=e||oe}word(e={}){let t={...e};if(typeof t.syllables=="number"&&typeof t.length=="number")throw new RangeError('Cannot specify both "syllables" and "length".');let i="";if(typeof t.length=="number"){do i+=this.syllable();while(i.length<t.length);i=i.substring(0,t.length)}else{let r=t.syllables||this[Ke].number({min:1,max:3});for(let s=0;s<r;s++)i+=this.syllable()}return t.capitalize&&(i=this.capitalize(i)),i}capitalize(e){return e.charAt(0).toUpperCase()+e.substr(1)}words(e=3){return new Array(e).fill("").map(()=>this.word()).join(" ")}sentence(e={}){let t={...e},{words:i=this[Ke].number({min:12,max:18})}=t,r=new Array(i).fill("").map(()=>this.word()).join(" ");r=this.capitalize(r);let{punctuation:s}=t;return s!==!1&&!/^[.?;!:]$/.test(String(s))&&(s="."),s&&(r+=s),r}sentences(e={}){let t={};typeof e=="number"?t.size=e:t={...e};let{size:i=this[Ke].number({min:2,max:6})}=t;return new Array(i).fill("").map(()=>this.sentence()).join(" ")}slug(e){let t=this.words(e);return qa(t)}paragraph(e={}){let t={};typeof e=="number"?t.sentences=e:t={...e};let{lineBreak:i,sentences:r=this[Ke].number({min:3,max:7})}=t;return new Array(r).fill("").map(()=>this.sentence()).join(i===!0?`\r
|
|
36
35
|
`:" ")}paragraphs(e={}){let t={};typeof e=="number"?t.size=e:t={...e};let{separator:i=`\r
|
|
37
|
-
`,size:r=this[Le].number({min:1,max:7})}=t;return new Array(r).fill("").map(()=>this.paragraph()).join(i)}syllable(e={}){let{syntax:t}=this[qr],i={...e},r=i.length||this[Le].number({min:2,max:3}),s=t&&t.consonants||ae.syntax.consonants,a=t&&t.vowels||ae.syntax.vowels,n=s+a,l="",c;for(let p=0;p<r;p++)p===0?c=this[Le].character({pool:n}):c&&a.includes(c)?c=this[Le].character({pool:s}):c=this[Le].character({pool:a}),l+=c;return i.capitalize&&(l=this.capitalize(l)),l}lorem(){let e=["word","words","sentence","sentences","paragraph","paragraphs"],t=this[Kr].pickOne(e);return this[t]()}};var Me=Symbol("typesValue"),Ri=Symbol("localeValue"),Ft=class{[Me];[Ri];constructor(e={}){this[Me]=new De(e.seed),this[Ri]=e.locale||ae}seed(e){this[Me].seed(e)}locale(e){this[Ri]=e||ae}date(e){return this[Me].datetime(e)}amPm(){return this[Me].boolean()?"am":"pm"}timestamp(e){return this[Me].datetime(e).getTime()}hour(e={}){let t={...e};if(typeof t.min!="number"&&(t.min=t.twentyFour?0:1),typeof t.max!="number"&&(t.max=t.twentyFour?23:12),t.min<0)throw new RangeError(`Provided value ${t.min} for min is less than 0.`);if(t.max>23&&t.twentyFour||t.max>12&&!t.twentyFour)throw new RangeError(`Provided value ${t.max} for max is greater than ${t.twentyFour?23:12}.`);if(t.min>t.max)throw new RangeError(`The min value (${t.min}) cannot be greater than max value (${t.max}).`);return this[Me].number({min:t.min,max:t.max})}minute(e={}){let{min:t=0,max:i=59}=e;if(t<0)throw new RangeError(`Provided value ${t} for min is less than 0.`);if(i>59)throw new RangeError(`Provided value ${i} for max is greater than 59.`);if(t>i)throw new RangeError(`The min value (${t}) cannot be greater than max value (${i}).`);return this[Me].number({min:t,max:i})}millisecond(){return this[Me].number({max:999})}second(){return this[Me].number({max:59})}month(e={}){let{min:t=1,max:i=12}=e;if(t<1)throw new RangeError(`Provided value ${t} for min is less than 1.`);if(i>12)throw new RangeError(`Provided value ${i} for max is greater than 12.`);if(t>i)throw new RangeError(`The min value (${t}) cannot be greater than max value (${i}).`);return this[Me].number({min:t,max:i})}monthName(e={}){let t=this.month(e);return this.months(e.abbr)[t-1]}months(e=!1){let{time:t}=this[Ri],i;return t&&t.month&&t.month.abbr&&t.month.abbr.length>0?i=t.month:i=ae.time.month,e?i.abbr:i.names}weekdays(e=!1){let{time:t}=this[Ri],i;return t&&t.weekday&&t.weekday.abbr&&t.weekday.abbr.length>0?i=t.weekday:i=ae.time.weekday,e?i.abbr:i.names}weekday(e={}){let{min:t=1,max:i=7}=e;if(t<1)throw new RangeError(`Provided value ${t} for min is less than 1.`);if(i>7)throw new RangeError(`Provided value ${i} for max is greater than 7.`);if(t>i)throw new RangeError(`The min value (${t}) cannot be greater than max value (${i}).`);return this[Me].number({min:t,max:i})}weekdayName(e={}){let t=this.weekday(e);return this.weekdays(e.abbr)[t-1]}midnight(e=Date.now()){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}dateOnly(e){let t=this.date(e),i=t.getFullYear(),r=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getDate().toString().padStart(2,"0");return`${i}-${r}-${s}`}timeOnly(e){let t=this.date(e),i=t.getHours().toString().padStart(2,"0"),r=t.getMinutes().toString().padStart(2,"0"),s=t.getSeconds().toString().padStart(2,"0");return`${i}:${r}:${s}`}dateTime(e="rfc3339",t){let i=this.date(t);if(e==="rfc2616")return i.toUTCString();if(e==="rfc3339"){let r=i.getUTCFullYear(),s=(i.getUTCMonth()+1).toString().padStart(2,"0"),a=i.getUTCDate().toString().padStart(2,"0"),n=i.getUTCHours().toString().padStart(2,"0"),l=i.getUTCMinutes().toString().padStart(2,"0"),c=i.getUTCSeconds().toString().padStart(2,"0"),p=i.getUTCMilliseconds().toString().padStart(3,"0");return`${r}-${s}-${a}T${n}:${l}:${c}.${p}Z`}return""}dateTimeOnly(e){let t=this.date(e),i=t.getFullYear(),r=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getDate().toString().padStart(2,"0"),a=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),l=t.getSeconds().toString().padStart(2,"0");return`${i}-${r}-${s}T${a}:${n}:${l}`}};var O;(function(o){o[o.ROOT=0]="ROOT",o[o.GROUP=1]="GROUP",o[o.POSITION=2]="POSITION",o[o.SET=3]="SET",o[o.RANGE=4]="RANGE",o[o.REPETITION=5]="REPETITION",o[o.REFERENCE=6]="REFERENCE",o[o.CHAR=7]="CHAR"})(O||(O={}));var Gc=()=>({type:O.POSITION,value:"b"}),Bc=()=>({type:O.POSITION,value:"B"}),Wc=()=>({type:O.POSITION,value:"^"}),Hc=()=>({type:O.POSITION,value:"$"}),Zs=()=>[{type:O.RANGE,from:48,to:57}],On=()=>[{type:O.CHAR,value:95},{type:O.RANGE,from:97,to:122},{type:O.RANGE,from:65,to:90},...Zs()],Tn=()=>[{type:O.CHAR,value:9},{type:O.CHAR,value:10},{type:O.CHAR,value:11},{type:O.CHAR,value:12},{type:O.CHAR,value:13},{type:O.CHAR,value:32},{type:O.CHAR,value:160},{type:O.CHAR,value:5760},{type:O.CHAR,value:6158},{type:O.CHAR,value:8192},{type:O.CHAR,value:8193},{type:O.CHAR,value:8194},{type:O.CHAR,value:8195},{type:O.CHAR,value:8196},{type:O.CHAR,value:8197},{type:O.CHAR,value:8198},{type:O.CHAR,value:8199},{type:O.CHAR,value:8200},{type:O.CHAR,value:8201},{type:O.CHAR,value:8202},{type:O.CHAR,value:8232},{type:O.CHAR,value:8233},{type:O.CHAR,value:8239},{type:O.CHAR,value:8287},{type:O.CHAR,value:12288},{type:O.CHAR,value:65279}],Yc=()=>[{type:O.CHAR,value:10},{type:O.CHAR,value:13},{type:O.CHAR,value:8232},{type:O.CHAR,value:8233}],Pn=()=>({type:O.SET,set:On(),not:!1}),Rn=()=>({type:O.SET,set:On(),not:!0}),Cn=()=>({type:O.SET,set:Zs(),not:!1}),Dn=()=>({type:O.SET,set:Zs(),not:!0}),Un=()=>({type:O.SET,set:Tn(),not:!1}),Ln=()=>({type:O.SET,set:Tn(),not:!0}),Xc=()=>({type:O.SET,set:Yc(),not:!0}),Zc={0:0,t:9,n:10,v:11,f:12,r:13},Qc=o=>{let e=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return o.replace(e,(t,i,r,s,a,n,l,c)=>{if(r)return t;let p=i?8:s?parseInt(s,16):a?parseInt(a,16):n?parseInt(n,8):l?"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?".indexOf(l):Zc[c],u=String.fromCharCode(p);return/[[{}^$.|?*+()]/.test(u)&&(u=`\\${u}`),u})},ed=(o,e)=>{let t=[],i=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g,r,s;for(;(r=i.exec(o))!==null;)if(r[1])t.push(Pn());else if(r[2])t.push(Cn());else if(r[3])t.push(Un());else if(r[4])t.push(Rn());else if(r[5])t.push(Dn());else if(r[6])t.push(Ln());else if(r[7])t.push({type:O.RANGE,from:(r[8]||r[9]).charCodeAt(0),to:r[10].charCodeAt(0)});else if(s=r[12])t.push({type:O.CHAR,value:s.charCodeAt(0)});else return[t,i.lastIndex];throw new SyntaxError(`Invalid regular expression: /${e}/: Unterminated character class`)},Gr=(o,e)=>{throw new SyntaxError(`Invalid regular expression: /${o}/: ${e}`)},Mn=o=>{let e=0,t={type:O.ROOT,stack:[]},i=t,r=t.stack,s=[],a=l=>Gr(o,`Nothing to repeat at column ${l-1}`),n=Qc(o);for(;e<n.length;){let l=n[e++];switch(l){case"\\":switch(l=n[e++],l){case"b":r.push(Gc());break;case"B":r.push(Bc());break;case"w":r.push(Pn());break;case"W":r.push(Rn());break;case"d":r.push(Cn());break;case"D":r.push(Dn());break;case"s":r.push(Un());break;case"S":r.push(Ln());break;default:/\d/.test(l)?r.push({type:O.REFERENCE,value:parseInt(l,10)}):r.push({type:O.CHAR,value:l.charCodeAt(0)})}break;case"^":r.push(Wc());break;case"$":r.push(Hc());break;case"[":{let c=!1;n[e]==="^"&&(c=!0,e++);let[p,u]=ed(n.slice(e),o);e+=u,r.push({type:O.SET,set:p,not:c});break}case".":r.push(Xc());break;case"(":{let c={type:O.GROUP,stack:[],remember:!0};n[e]==="?"&&(l=n[e+1],e+=2,l==="="?c.followedBy=!0:l==="!"?c.notFollowedBy=!0:l!==":"&&Gr(o,`Invalid group, character '${l}' after '?' at column ${e-1}`),c.remember=!1),r.push(c),s.push(i),i=c,r=c.stack;break}case")":s.length===0&&Gr(o,`Unmatched ) at column ${e-1}`),i=s.pop(),r=i.options?i.options[i.options.length-1]:i.stack;break;case"|":i.options||(i.options=[i.stack],delete i.stack);{let c=[];i.options.push(c),r=c}break;case"{":{let c=/^(\d+)(,(\d+)?)?\}/.exec(n.slice(e));if(c){r.length===0&&a(e);let p=parseInt(c[1],10),u=c[2]?c[3]?parseInt(c[3],10):1/0:p;e+=c[0].length,r.push({type:O.REPETITION,min:p,max:u,value:r.pop()})}else r.push({type:O.CHAR,value:123});break}case"?":r.length===0&&a(e),r.push({type:O.REPETITION,min:0,max:1,value:r.pop()});break;case"+":r.length===0&&a(e),r.push({type:O.REPETITION,min:1,max:1/0,value:r.pop()});break;case"*":r.length===0&&a(e),r.push({type:O.REPETITION,min:0,max:1/0,value:r.pop()});break;default:r.push({type:O.CHAR,value:l.charCodeAt(0)})}}return s.length!==0&&Gr(o,"Unterminated group"),t};var Ci=class o{types;constructor(e={}){this.types=new De(e.seed)}seed(e){this.types.seed(e)}fromPattern(e,t={}){let i,r;e instanceof globalThis.RegExp?(r=e.ignoreCase,i=e.source):(r=t.flags?.includes("i")??!1,i=e);let s=10;typeof t.max=="number"&&(s=t.max);let a=Mn(i),n=Array.from({length:95},(l,c)=>c+32);return this._gen(a,[],r,n,s)}_gen(e,t,i,r,s){let a,n,l,c;switch(e.type){case O.ROOT:case O.GROUP:if(e.followedBy||e.notFollowedBy)return"";for(e.remember&&e.groupNumber===void 0&&(e.groupNumber=t.push(null)-1),a=e.options?this._choice(e.options):e.stack,n="",l=0,c=a.length;l<c;l++)n+=this._gen(a[l],t,i,r,s);return e.remember&&(t[e.groupNumber]=n),n;case O.POSITION:return"";case O.SET:{let p=this._processSet(e,i,r);return p.length?String.fromCharCode(this._choice(p)):""}case O.REPETITION:{let p=e.max===1/0?Math.max(e.min,s):e.max,u=this.types.number({min:e.min,max:p});for(n="",l=0;l<u;l++)n+=this._gen(e.value,t,i,r,s);return n}case O.REFERENCE:return t[e.value-1]||"";case O.CHAR:{let p=i&&this._coin()?o._toCaseInverse(e.value):e.value;return String.fromCharCode(p)}}return""}_processSet(e,t,i){if(e.type===O.CHAR)return[e.value];if(e.type===O.RANGE){let s=[];for(let a=e.from;a<=e.to;a++)s.push(a);return s}let r=new Set;for(let s of e.set){let a=this._processSet(s,t,i);if(a.forEach(n=>r.add(n)),t)for(let n of a){let l=n,c=o._toCaseInverse(l);l!==c&&r.add(c)}}return e.not?i.filter(s=>!r.has(s)):Array.from(r)}static _toCaseInverse(e){return e>=97&&e<=122?e-32:e>=65&&e<=90?e+32:e}_coin(){return this.types.number({min:0,max:1})===0}_choice(e){return e[this.types.number({min:0,max:e.length-1})]}};var Pt=class o{static types=new De;static person=new Fr;static lorem=new Jr;static regExp=new Ci;static readInputValue(e,t,i={}){let{required:r}=e,{defaultValueStr:s,values:a}=t;if(!(!r&&i.requiredOnly===!0)){if(s)return o.readTypedValue(s,t.dataType);if(Array.isArray(a)&&a.length){let n=a[0];return o.readTypedValue(n.value,n.dataType)}if(i.fromExamples){let n;if(Array.isArray(e.examples)&&e.examples.length?n=e.examples.filter(l=>typeof l!="string"):Array.isArray(t.examples)&&t.examples.length&&(n=t.examples),n&&n.length)return o.inputValueFromExamples(n)}return o.generateDefaultValue(t)}}static readInputValues(e,t,i={}){if(!e.required&&i.requiredOnly===!0)return[];let{defaultValue:r}=t;if(r){let n=new Oe().processNode(r);if(Array.isArray(n))return n}let s=t;if(i.fromExamples){let a;return Array.isArray(e.examples)&&e.examples.length?a=e.examples.filter(n=>typeof n!="string"):Array.isArray(s.examples)&&s.examples.length&&(a=s.examples),o.arrayValuesFromExamples(a)}return[]}static inputValueFromExamples(e){if(!Array.isArray(e)||!e.length)return;let[t]=e,{structuredValue:i}=t;if(i&&i.types.includes(d.aml.vocabularies.data.Scalar)){let r=i;return o.readTypedValue(r.value,r.dataType)}}static arrayValuesFromExamples(e){let t=[];if(!Array.isArray(e)||!e.length)return t;let[i]=e;if(!i.structuredValue||!i.structuredValue.types.includes(d.aml.vocabularies.data.Array))return t;let r=i.structuredValue,{members:s}=r;return!Array.isArray(s)||!s.length||s.forEach(a=>{let n=a;if(!n.value)return;let l=o.readTypedValue(n.value,n.dataType);typeof r<"u"&&r!==null&&t.push(l)}),t}static generateDefaultValue(e){let{dataType:t}=e;return this.defaultValue(t)}static generateMockedValue(e){let{dataType:t}=e;switch(t){case d.w3.xmlSchema.string:case d.aml.vocabularies.shapes.password:return this.generateStringValue(e);case d.w3.xmlSchema.number:case d.w3.xmlSchema.integer:case d.w3.xmlSchema.float:case d.w3.xmlSchema.long:case d.w3.xmlSchema.double:case d.aml.vocabularies.shapes.number:case d.aml.vocabularies.shapes.integer:case d.aml.vocabularies.shapes.float:case d.aml.vocabularies.shapes.long:case d.aml.vocabularies.shapes.double:return this.generateNumberValue(e);case d.aml.vocabularies.shapes.boolean:case d.w3.xmlSchema.boolean:return this.types.boolean();case d.aml.vocabularies.shapes.nil:case d.w3.xmlSchema.nil:return null;case d.w3.xmlSchema.date:return new Ft().dateOnly();case d.w3.xmlSchema.dateTime:return new Ft().dateTime(e.format==="date-time"?"rfc3339":e.format);case d.aml.vocabularies.shapes.dateTimeOnly:return new Ft().dateTimeOnly();case d.w3.xmlSchema.time:return new Ft().timeOnly();default:return}}static defaultValue(e){switch(e){case d.w3.xmlSchema.string:case d.aml.vocabularies.shapes.password:return"";case d.w3.xmlSchema.number:case d.w3.xmlSchema.integer:case d.w3.xmlSchema.float:case d.w3.xmlSchema.long:case d.w3.xmlSchema.double:case d.aml.vocabularies.shapes.number:case d.aml.vocabularies.shapes.integer:case d.aml.vocabularies.shapes.float:case d.aml.vocabularies.shapes.long:case d.aml.vocabularies.shapes.double:return 0;case d.aml.vocabularies.shapes.boolean:case d.w3.xmlSchema.boolean:return!1;case d.aml.vocabularies.shapes.nil:case d.w3.xmlSchema.nil:return null;case d.w3.xmlSchema.date:return"";case d.w3.xmlSchema.dateTime:return"";case d.aml.vocabularies.shapes.dateTimeOnly:return"";case d.w3.xmlSchema.time:return"";default:return}}static generateNumberValue(e){let{minimum:t,maximum:i,format:r,multipleOf:s}=e,a={};typeof t=="number"&&(a.min=t),typeof i=="number"&&(a.max=i);let n;return r&&["float","double"].includes(r)?n=this.types.float.bind(this.types):r&&["uint32","uint64","fixed32","fixed64"].includes(r)&&(a.min=0,a.max&&a.max<0&&delete a.max),n||(n=this.types.number.bind(this.types)),typeof s=="number"&&(a.precision=s),n(a)}static generateStringValue(e){let{minLength:t,maxLength:i,name:r="",format:s,pattern:a}=e;if(a)return new Ci().fromPattern(a,{max:10});let n=r.toLowerCase();if(n==="description")return this.lorem.paragraph();if(s==="uuid")return this.types.uuid();if(n==="id"){let p={length:12},u=typeof t=="number";return u?p.length=t:!u&&typeof i=="number"&&(p.length=i),this.types.hash(p)}if(["name","fullname"].includes(n))return this.person.name();if(n==="firstname")return this.person.firstName();if(n==="lastname")return this.person.lastName();let l={},c=typeof t=="number";return c?l.length=t:!c&&typeof i=="number"&&(l.length=i),this.lorem.word(l)}static readTypedValue(e,t){return Rr(e,t)}static readInputType(e){switch(e){case d.aml.vocabularies.shapes.number:case d.aml.vocabularies.shapes.integer:case d.aml.vocabularies.shapes.float:case d.aml.vocabularies.shapes.long:case d.aml.vocabularies.shapes.double:case d.w3.xmlSchema.number:case d.w3.xmlSchema.integer:case d.w3.xmlSchema.float:case d.w3.xmlSchema.long:case d.w3.xmlSchema.double:return"number";case d.w3.xmlSchema.date:return"date";case d.w3.xmlSchema.time:return"time";case d.w3.xmlSchema.dateTime:case d.aml.vocabularies.shapes.dateTimeOnly:return"datetime-local";case d.aml.vocabularies.shapes.boolean:case d.w3.xmlSchema.boolean:return"boolean";case d.aml.vocabularies.shapes.password:return"password";default:return"text"}}static parseNumberInput(e,t){return Ts(e,t)}static parseBooleanInput(e,t){return Ps(e,t)}static parseDateOnlyInput(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return;let i=t.toJSON(),r=i.indexOf("T");return i.substring(0,r)}static parseTimeOnlyInput(e){let t=String(e).trim();if(/^\d\d:\d\d$/.test(t))return`${t}:00`;if(/^\d\d:\d\d:\d\d$/.test(t))return t}static parseDateTimeInput(e,t="rfc3339"){let i=new Date(e);if(!Number.isNaN(i.getTime())){if(t==="rfc2616")return i.toUTCString();if(["rfc3339","date-time"].includes(t))return i.toISOString()}}static parseDateTimeOnlyInput(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return;let i=t.toJSON(),r=i.indexOf(".");return i.substring(0,r)}static parseArrayInput(e,t){let{items:i}=t;return i?o.parseUserInput(e,i):String(e)}static parseUserInput(e,t){if(!t||e===void 0||e===null)return e;let{types:i}=t;return i.includes(d.aml.vocabularies.shapes.ScalarShape)?o.parseScalarInput(e,t):i.includes(d.aml.vocabularies.shapes.ArrayShape)||i.includes(d.aml.vocabularies.shapes.MatrixShape)?o.parseArrayInput(e,t):e}static parseScalarInput(e,t){return this.parseScalar(e,t.dataType,t.format)}static parseScalar(e,t,i){switch(t){case d.aml.vocabularies.shapes.number:case d.aml.vocabularies.shapes.integer:case d.aml.vocabularies.shapes.float:case d.aml.vocabularies.shapes.long:case d.aml.vocabularies.shapes.double:case d.w3.xmlSchema.number:case d.w3.xmlSchema.integer:case d.w3.xmlSchema.float:case d.w3.xmlSchema.long:case d.w3.xmlSchema.double:return o.parseNumberInput(e);case d.aml.vocabularies.shapes.boolean:case d.w3.xmlSchema.boolean:return o.parseBooleanInput(e);case d.w3.xmlSchema.date:return o.parseDateOnlyInput(e);case d.w3.xmlSchema.time:return o.parseTimeOnlyInput(e);case d.w3.xmlSchema.dateTime:return o.parseDateTimeInput(e,i);case d.aml.vocabularies.shapes.dateTimeOnly:return o.parseDateTimeOnlyInput(e);default:return String(e)}}};var Kt=class{opts;constructor(e={}){this.opts=Object.freeze({...e})}_scalarValue(e){let{defaultValue:t,examples:i,values:r,inherits:s,dataType:a}=e;if(this.opts.renderExamples&&i&&i.length){let n=i.find(c=>!!c.structuredValue),l=this._exampleToObject(n);if(typeof l<"u")return Pt.readTypedValue(l,a)}if(t)return new Oe().processNode(t);if(r&&r.length){let n=r[0];if(n.value!==void 0)return Pt.readTypedValue(n.value,a)}if(Array.isArray(s)&&s.length)for(let n=0,l=s.length;n<l;n+=1){let c=this._scalarValue(s[n]);if(c!==void 0)return c}return this.opts.renderMocked?Pt.generateMockedValue(e):Pt.generateDefaultValue(e)}_isNotRequiredUnion(e){let t=0,i=!1;return e.forEach(r=>{r.types.includes(d.aml.vocabularies.shapes.NilShape)?i=!0:r.types.includes(d.aml.vocabularies.shapes.ScalarShape)?r.dataType===d.w3.xmlSchema.nil?i=!0:t+=1:r.types.includes(d.aml.vocabularies.shapes.FileShape)&&(t+=1)}),i?t===e.length-1:!1}};var Di=class extends Kt{generate(e){let t;return e.types.includes(d.w3.shacl.PropertyShape)?t=this._propertyShapeObject(e):t=this.toObject(e),t!==null&&typeof t=="object"?this.serialize(t):t}toObject(e){let{types:t}=e;return t.includes(d.aml.vocabularies.shapes.ScalarShape)?this._scalarShapeObject(e):t.includes(d.w3.shacl.NodeShape)?this._nodeShapeObject(e):t.includes(d.aml.vocabularies.shapes.UnionShape)?this._unionShapeObject(e):t.includes(d.aml.vocabularies.shapes.FileShape)?this._fileShapeObject():t.includes(d.aml.vocabularies.shapes.SchemaShape)?this._schemaShapeObject():t.includes(d.aml.vocabularies.shapes.TupleShape)?this._tupleShapeObject(e):t.includes(d.aml.vocabularies.shapes.ArrayShape)||t.includes(d.aml.vocabularies.shapes.MatrixShape)?this._arrayShapeObject(e):this._anyShapeObject(e)}serialize(e){return JSON.stringify(e,null,2)}_scalarShapeObject(e){return this._scalarValue(e)}_nilShapeObject(){}_nodeShapeObject(e){let{inherits:t}=e,{examples:i=[]}=e;if(Array.isArray(t)&&t.length&&t.forEach(a=>{let n=a;Array.isArray(n.examples)&&n.examples.length&&(i=i.concat(n.examples))}),this.opts.renderExamples&&i.length){let a=i.find(l=>!!l.structuredValue),n=this._exampleToObject(a);if(n!==void 0)return n}let r={},{properties:s}=e;return Array.isArray(t)&&t.length&&t.forEach(a=>{let n=this.toObject(a);typeof n=="object"&&(r={...r,...n})}),s.forEach(a=>{let{name:n}=a,l=this._propertyShapeObject(a);typeof l<"u"&&n&&(r[n]=l)}),r}_unionShapeObject(e){return e.and&&e.and.length?this._allOfUnion(e):e.xone&&e.xone.length?this._oneOfUnion(e):this._anyOfUnion(e)}_anyOfUnion(e){let{anyOf:t=[],examples:i=[]}=e;Array.isArray(e.inherits)&&e.inherits&&e.inherits.forEach(n=>{let l=n;Array.isArray(l.examples)&&l.examples.length&&(i=i.concat(l.examples));let c=n;Array.isArray(c.anyOf)&&c.anyOf.length&&(t=t.concat(c.anyOf))});let{opts:r}=this;if(this._isNotRequiredUnion(t))return;if(this.opts.renderExamples){let n=i.find(c=>!!c.structuredValue),l=this._exampleToObject(n);if(l!==void 0)return l}if(e.defaultValue)return this._unionDefaultValue(t,e.defaultValue);let{selectedUnions:s}=r,a;if(s&&s.length?a=t.find(n=>s.includes(n.id)):[a]=t,a)return this.toObject(a)}_oneOfUnion(e){let{examples:t=[]}=e,{xone:i=[]}=e;Array.isArray(e.inherits)&&e.inherits&&e.inherits.forEach(n=>{let l=n;Array.isArray(l.examples)&&l.examples.length&&(t=t.concat(l.examples))});let{opts:r}=this;if(this.opts.renderExamples){let n=t.find(c=>!!c.structuredValue),l=this._exampleToObject(n);if(l!==void 0)return l}if(e.defaultValue)return this._unionDefaultValue(i,e.defaultValue);let{selectedUnions:s}=r,a;if(s&&s.length?a=i.find(n=>s.includes(n.id)):[a]=i,a)return this.toObject(a)}_allOfUnion(e){let{examples:t=[]}=e,{and:i=[]}=e;if(Array.isArray(e.inherits)&&e.inherits&&e.inherits.forEach(s=>{let a=s;Array.isArray(a.examples)&&a.examples.length&&(t=t.concat(a.examples))}),this.opts.renderExamples){let s=t.find(n=>!!n.structuredValue),a=this._exampleToObject(s);if(a!==void 0)return a}let r={};return i.forEach(s=>{let a=this.toObject(s);typeof a=="object"&&(r={...r,...a})}),r}_unionDefaultValue(e,t){let r=new Oe().generate(t),s=!1,a=!1,n=!1;if(e.forEach(l=>{if(l.types.includes(d.aml.vocabularies.shapes.NilShape)&&(n=!0),!l.types.includes(d.aml.vocabularies.shapes.ScalarShape))return;let c=l;a||(a=c.dataType===d.w3.xmlSchema.boolean),s||(s=[d.w3.xmlSchema.number,d.w3.xmlSchema.long,d.w3.xmlSchema.integer,d.w3.xmlSchema.float,d.w3.xmlSchema.double,d.aml.vocabularies.shapes.number,d.aml.vocabularies.shapes.long,d.aml.vocabularies.shapes.integer,d.aml.vocabularies.shapes.float,d.aml.vocabularies.shapes.double].includes(c.dataType)),n||(n=c.dataType===d.w3.xmlSchema.nil)}),s){let l=Number(r);if(!Number.isNaN(l))return l}if(a){if(r==="true")return!0;if(r==="false")return!1}return n&&(r==="null"||r==="nil")?null:r}_arrayShapeObject(e){let{items:t}=e,i=e.defaultValue||t&&t.defaultValue,{examples:r=[]}=e,s=t;if(Array.isArray(s.examples)&&(r=r.concat(s.examples)),this.opts.renderExamples&&r&&r.length){let a=r.find(l=>!!l.structuredValue),n=this._exampleToObject(a);if(Array.isArray(n))return n;if(typeof n<"u")return[n]}if(i){let n=new Oe().processNode(i);if(Array.isArray(n))return n;if(n)return[n]}if(t){let a=this.toObject(t);if(typeof a<"u")return[a]}return[]}_tupleShapeObject(e){let{items:t,examples:i}=e;if(this.opts.renderExamples&&i&&i.length){let r=i.find(a=>!!a.structuredValue),s=this._exampleToObject(r);if(typeof s<"u")return[s]}if(e.defaultValue){let s=new Oe().processNode(e.defaultValue);if(Array.isArray(s))return s}if(t.length){let r=[];return t.forEach(s=>{let a=this.toObject(s);typeof a<"u"&&r.push(a)}),r}return[]}_anyShapeObject(e){let{and:t=[],xone:i=[],or:r=[]}=e;if(t.length){let s={};return t.forEach(a=>{let n=this.toObject(a);typeof n=="object"&&(s={...s,...n})}),s}if(i.length){let{selectedUnions:s=[]}=this.opts,a=i.find(n=>s.includes(n.id));return a||(a=i[0]),this.toObject(a)}if(r.length){let{selectedUnions:s=[]}=this.opts,a=r.find(n=>s.includes(n.id));return a||(a=r[0]),this.toObject(a)}return this._scalarShapeObject(e)}_propertyShapeObject(e){let{minCount:t=0}=e;if(t===0&&!this.opts.renderOptional)return;let{range:i}=e;if(!i)return;let{types:r}=i;if(r.includes(d.aml.vocabularies.shapes.ScalarShape)){let s=i;return this._scalarShapeObject(s)}return this.toObject(i)}_exampleToObject(e){if(e&&e.structuredValue)return new Oe().processNode(e.structuredValue)}_fileShapeObject(){}_schemaShapeObject(){}};var Ie=o=>o.replace(/[^a-zA-Z0-9-_.]/g,""),Qs="unknown-type";function st(o){let{name:e,inherits:t=[],xmlSerialization:i}=o,r=i&&i.name?i.name:e||Qs;if(r==="schema"&&t.length){let s=t.find(a=>a.name&&a.name!=="schema");s&&(r=s.name==="type"&&s.displayName||s.name)}return Ie(String(r))}var Ui=class extends Kt{generate(e){let t;return e.types.includes(d.w3.shacl.PropertyShape)?t=this._propertyShapeObject(e):t=this.processNode(e,{},!0),t}processNode(e,t={},i=!1){let{types:r}=e;return r.includes(d.aml.vocabularies.shapes.ScalarShape)?this._scalarShapeObject(e,t):r.includes(d.w3.shacl.NodeShape)?this._nodeShapeObject(e,t):r.includes(d.aml.vocabularies.shapes.UnionShape)?this._unionShapeObject(e):r.includes(d.aml.vocabularies.shapes.FileShape)?this._fileShapeObject():r.includes(d.aml.vocabularies.shapes.SchemaShape)?this._schemaShapeObject():r.includes(d.aml.vocabularies.shapes.TupleShape)?this._tupleShapeObject():r.includes(d.aml.vocabularies.shapes.ArrayShape)||r.includes(d.aml.vocabularies.shapes.MatrixShape)?this._arrayShapeObject(e,t,i):this._anyShapeObject(e)}serialize(e){return e}_readCurrentUnion(e){let{selectedUnions:t}=this.opts;return Rs(e,t)}_collectProperties(e){let{selectedUnions:t}=this.opts;return Cr(e,t)}_nodeShapeObject(e,t={}){let i=t.forceName||st(e),r=[],s=t.indent||0,a=this._collectExamples(e,{tagFill:new Array(s*2+0).fill(" ").join(""),indent:s+1,nodeName:i});if(a)return a;let n=[];if(this._collectProperties(e).forEach(u=>{let{range:m,minCount:h=0}=u;if(h===0&&!this.opts.renderOptional||!m)return;let f=m;if(f.xmlSerialization&&f.xmlSerialization.attribute&&f.types.includes(d.aml.vocabularies.shapes.ScalarShape)){let w=Ie(f.xmlSerialization.name?f.xmlSerialization.name:u.name||f.name||Qs);f.xmlSerialization.prefix&&(w=`${f.xmlSerialization.prefix}:${w}`);let b=this._scalarValue(f);n.push(`${w}="${b}"`);return}let k=this._propertyShapeObject(u,{indent:s});if(typeof k<"u"){let w=t.noWrap?0:2,b=new Array(s*2+w).fill(" ").join("");r.push(Pr(b,k))}}),t.noWrap)return r.join(`
|
|
36
|
+
`,size:r=this[Ke].number({min:1,max:7})}=t;return new Array(r).fill("").map(()=>this.paragraph()).join(i)}syllable(e={}){let{syntax:t}=this[Cr],i={...e},r=i.length||this[Ke].number({min:2,max:3}),s=t&&t.consonants||oe.syntax.consonants,a=t&&t.vowels||oe.syntax.vowels,n=s+a,l="",c;for(let p=0;p<r;p++)p===0?c=this[Ke].character({pool:n}):c&&a.includes(c)?c=this[Ke].character({pool:s}):c=this[Ke].character({pool:a}),l+=c;return i.capitalize&&(l=this.capitalize(l)),l}lorem(){let e=["word","words","sentence","sentences","paragraph","paragraphs"],t=this[Or].pickOne(e);return this[t]()}};var Fe=Symbol("typesValue"),Ri=Symbol("localeValue"),Kt=class{[Fe];[Ri];constructor(e={}){this[Fe]=new Ve(e.seed),this[Ri]=e.locale||oe}seed(e){this[Fe].seed(e)}locale(e){this[Ri]=e||oe}date(e){return this[Fe].datetime(e)}amPm(){return this[Fe].boolean()?"am":"pm"}timestamp(e){return this[Fe].datetime(e).getTime()}hour(e={}){let t={...e};if(typeof t.min!="number"&&(t.min=t.twentyFour?0:1),typeof t.max!="number"&&(t.max=t.twentyFour?23:12),t.min<0)throw new RangeError(`Provided value ${t.min} for min is less than 0.`);if(t.max>23&&t.twentyFour||t.max>12&&!t.twentyFour)throw new RangeError(`Provided value ${t.max} for max is greater than ${t.twentyFour?23:12}.`);if(t.min>t.max)throw new RangeError(`The min value (${t.min}) cannot be greater than max value (${t.max}).`);return this[Fe].number({min:t.min,max:t.max})}minute(e={}){let{min:t=0,max:i=59}=e;if(t<0)throw new RangeError(`Provided value ${t} for min is less than 0.`);if(i>59)throw new RangeError(`Provided value ${i} for max is greater than 59.`);if(t>i)throw new RangeError(`The min value (${t}) cannot be greater than max value (${i}).`);return this[Fe].number({min:t,max:i})}millisecond(){return this[Fe].number({max:999})}second(){return this[Fe].number({max:59})}month(e={}){let{min:t=1,max:i=12}=e;if(t<1)throw new RangeError(`Provided value ${t} for min is less than 1.`);if(i>12)throw new RangeError(`Provided value ${i} for max is greater than 12.`);if(t>i)throw new RangeError(`The min value (${t}) cannot be greater than max value (${i}).`);return this[Fe].number({min:t,max:i})}monthName(e={}){let t=this.month(e);return this.months(e.abbr)[t-1]}months(e=!1){let{time:t}=this[Ri],i;return t&&t.month&&t.month.abbr&&t.month.abbr.length>0?i=t.month:i=oe.time.month,e?i.abbr:i.names}weekdays(e=!1){let{time:t}=this[Ri],i;return t&&t.weekday&&t.weekday.abbr&&t.weekday.abbr.length>0?i=t.weekday:i=oe.time.weekday,e?i.abbr:i.names}weekday(e={}){let{min:t=1,max:i=7}=e;if(t<1)throw new RangeError(`Provided value ${t} for min is less than 1.`);if(i>7)throw new RangeError(`Provided value ${i} for max is greater than 7.`);if(t>i)throw new RangeError(`The min value (${t}) cannot be greater than max value (${i}).`);return this[Fe].number({min:t,max:i})}weekdayName(e={}){let t=this.weekday(e);return this.weekdays(e.abbr)[t-1]}midnight(e=Date.now()){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}dateOnly(e){let t=this.date(e),i=t.getFullYear(),r=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getDate().toString().padStart(2,"0");return`${i}-${r}-${s}`}timeOnly(e){let t=this.date(e),i=t.getHours().toString().padStart(2,"0"),r=t.getMinutes().toString().padStart(2,"0"),s=t.getSeconds().toString().padStart(2,"0");return`${i}:${r}:${s}`}dateTime(e="rfc3339",t){let i=this.date(t);if(e==="rfc2616")return i.toUTCString();if(e==="rfc3339"){let r=i.getUTCFullYear(),s=(i.getUTCMonth()+1).toString().padStart(2,"0"),a=i.getUTCDate().toString().padStart(2,"0"),n=i.getUTCHours().toString().padStart(2,"0"),l=i.getUTCMinutes().toString().padStart(2,"0"),c=i.getUTCSeconds().toString().padStart(2,"0"),p=i.getUTCMilliseconds().toString().padStart(3,"0");return`${r}-${s}-${a}T${n}:${l}:${c}.${p}Z`}return""}dateTimeOnly(e){let t=this.date(e),i=t.getFullYear(),r=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getDate().toString().padStart(2,"0"),a=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),l=t.getSeconds().toString().padStart(2,"0");return`${i}-${r}-${s}T${a}:${n}:${l}`}};var C;(function(o){o[o.ROOT=0]="ROOT",o[o.GROUP=1]="GROUP",o[o.POSITION=2]="POSITION",o[o.SET=3]="SET",o[o.RANGE=4]="RANGE",o[o.REPETITION=5]="REPETITION",o[o.REFERENCE=6]="REFERENCE",o[o.CHAR=7]="CHAR"})(C||(C={}));var Nc=()=>({type:C.POSITION,value:"b"}),$c=()=>({type:C.POSITION,value:"B"}),jc=()=>({type:C.POSITION,value:"^"}),Ic=()=>({type:C.POSITION,value:"$"}),ea=()=>[{type:C.RANGE,from:48,to:57}],bn=()=>[{type:C.CHAR,value:95},{type:C.RANGE,from:97,to:122},{type:C.RANGE,from:65,to:90},...ea()],kn=()=>[{type:C.CHAR,value:9},{type:C.CHAR,value:10},{type:C.CHAR,value:11},{type:C.CHAR,value:12},{type:C.CHAR,value:13},{type:C.CHAR,value:32},{type:C.CHAR,value:160},{type:C.CHAR,value:5760},{type:C.CHAR,value:6158},{type:C.CHAR,value:8192},{type:C.CHAR,value:8193},{type:C.CHAR,value:8194},{type:C.CHAR,value:8195},{type:C.CHAR,value:8196},{type:C.CHAR,value:8197},{type:C.CHAR,value:8198},{type:C.CHAR,value:8199},{type:C.CHAR,value:8200},{type:C.CHAR,value:8201},{type:C.CHAR,value:8202},{type:C.CHAR,value:8232},{type:C.CHAR,value:8233},{type:C.CHAR,value:8239},{type:C.CHAR,value:8287},{type:C.CHAR,value:12288},{type:C.CHAR,value:65279}],Pc=()=>[{type:C.CHAR,value:10},{type:C.CHAR,value:13},{type:C.CHAR,value:8232},{type:C.CHAR,value:8233}],wn=()=>({type:C.SET,set:bn(),not:!1}),vn=()=>({type:C.SET,set:bn(),not:!0}),_n=()=>({type:C.SET,set:ea(),not:!1}),Sn=()=>({type:C.SET,set:ea(),not:!0}),An=()=>({type:C.SET,set:kn(),not:!1}),En=()=>({type:C.SET,set:kn(),not:!0}),Oc=()=>({type:C.SET,set:Pc(),not:!0}),Cc={0:0,t:9,n:10,v:11,f:12,r:13},Rc=o=>{let e=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return o.replace(e,(t,i,r,s,a,n,l,c)=>{if(r)return t;let p=i?8:s?parseInt(s,16):a?parseInt(a,16):n?parseInt(n,8):l?"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?".indexOf(l):Cc[c],u=String.fromCharCode(p);return/[[{}^$.|?*+()]/.test(u)&&(u=`\\${u}`),u})},Tc=(o,e)=>{let t=[],i=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g,r,s;for(;(r=i.exec(o))!==null;)if(r[1])t.push(wn());else if(r[2])t.push(_n());else if(r[3])t.push(An());else if(r[4])t.push(vn());else if(r[5])t.push(Sn());else if(r[6])t.push(En());else if(r[7])t.push({type:C.RANGE,from:(r[8]||r[9]).charCodeAt(0),to:r[10].charCodeAt(0)});else if(s=r[12])t.push({type:C.CHAR,value:s.charCodeAt(0)});else return[t,i.lastIndex];throw new SyntaxError(`Invalid regular expression: /${e}/: Unterminated character class`)},Tr=(o,e)=>{throw new SyntaxError(`Invalid regular expression: /${o}/: ${e}`)},xn=o=>{let e=0,t={type:C.ROOT,stack:[]},i=t,r=t.stack,s=[],a=l=>Tr(o,`Nothing to repeat at column ${l-1}`),n=Rc(o);for(;e<n.length;){let l=n[e++];switch(l){case"\\":switch(l=n[e++],l){case"b":r.push(Nc());break;case"B":r.push($c());break;case"w":r.push(wn());break;case"W":r.push(vn());break;case"d":r.push(_n());break;case"D":r.push(Sn());break;case"s":r.push(An());break;case"S":r.push(En());break;default:/\d/.test(l)?r.push({type:C.REFERENCE,value:parseInt(l,10)}):r.push({type:C.CHAR,value:l.charCodeAt(0)})}break;case"^":r.push(jc());break;case"$":r.push(Ic());break;case"[":{let c=!1;n[e]==="^"&&(c=!0,e++);let[p,u]=Tc(n.slice(e),o);e+=u,r.push({type:C.SET,set:p,not:c});break}case".":r.push(Oc());break;case"(":{let c={type:C.GROUP,stack:[],remember:!0};n[e]==="?"&&(l=n[e+1],e+=2,l==="="?c.followedBy=!0:l==="!"?c.notFollowedBy=!0:l!==":"&&Tr(o,`Invalid group, character '${l}' after '?' at column ${e-1}`),c.remember=!1),r.push(c),s.push(i),i=c,r=c.stack;break}case")":s.length===0&&Tr(o,`Unmatched ) at column ${e-1}`),i=s.pop(),r=i.options?i.options[i.options.length-1]:i.stack;break;case"|":i.options||(i.options=[i.stack],delete i.stack);{let c=[];i.options.push(c),r=c}break;case"{":{let c=/^(\d+)(,(\d+)?)?\}/.exec(n.slice(e));if(c){r.length===0&&a(e);let p=parseInt(c[1],10),u=c[2]?c[3]?parseInt(c[3],10):1/0:p;e+=c[0].length,r.push({type:C.REPETITION,min:p,max:u,value:r.pop()})}else r.push({type:C.CHAR,value:123});break}case"?":r.length===0&&a(e),r.push({type:C.REPETITION,min:0,max:1,value:r.pop()});break;case"+":r.length===0&&a(e),r.push({type:C.REPETITION,min:1,max:1/0,value:r.pop()});break;case"*":r.length===0&&a(e),r.push({type:C.REPETITION,min:0,max:1/0,value:r.pop()});break;default:r.push({type:C.CHAR,value:l.charCodeAt(0)})}}return s.length!==0&&Tr(o,"Unterminated group"),t};var Ti=class o{types;constructor(e={}){this.types=new Ve(e.seed)}seed(e){this.types.seed(e)}fromPattern(e,t={}){let i,r;e instanceof globalThis.RegExp?(r=e.ignoreCase,i=e.source):(r=t.flags?.includes("i")??!1,i=e);let s=10;typeof t.max=="number"&&(s=t.max);let a=xn(i),n=Array.from({length:95},(l,c)=>c+32);return this._gen(a,[],r,n,s)}_gen(e,t,i,r,s){let a,n,l,c;switch(e.type){case C.ROOT:case C.GROUP:if(e.followedBy||e.notFollowedBy)return"";for(e.remember&&e.groupNumber===void 0&&(e.groupNumber=t.push(null)-1),a=e.options?this._choice(e.options):e.stack,n="",l=0,c=a.length;l<c;l++)n+=this._gen(a[l],t,i,r,s);return e.remember&&(t[e.groupNumber]=n),n;case C.POSITION:return"";case C.SET:{let p=this._processSet(e,i,r);return p.length?String.fromCharCode(this._choice(p)):""}case C.REPETITION:{let p=e.max===1/0?Math.max(e.min,s):e.max,u=this.types.number({min:e.min,max:p});for(n="",l=0;l<u;l++)n+=this._gen(e.value,t,i,r,s);return n}case C.REFERENCE:return t[e.value-1]||"";case C.CHAR:{let p=i&&this._coin()?o._toCaseInverse(e.value):e.value;return String.fromCharCode(p)}}return""}_processSet(e,t,i){if(e.type===C.CHAR)return[e.value];if(e.type===C.RANGE){let s=[];for(let a=e.from;a<=e.to;a++)s.push(a);return s}let r=new Set;for(let s of e.set){let a=this._processSet(s,t,i);if(a.forEach(n=>r.add(n)),t)for(let n of a){let l=n,c=o._toCaseInverse(l);l!==c&&r.add(c)}}return e.not?i.filter(s=>!r.has(s)):Array.from(r)}static _toCaseInverse(e){return e>=97&&e<=122?e-32:e>=65&&e<=90?e+32:e}_coin(){return this.types.number({min:0,max:1})===0}_choice(e){return e[this.types.number({min:0,max:e.length-1})]}};var Ct=class o{static types=new Ve;static person=new Pr;static lorem=new Rr;static regExp=new Ti;static readInputValue(e,t,i={}){let{required:r}=e,{defaultValueStr:s,values:a}=t;if(!(!r&&i.requiredOnly===!0)){if(s)return o.readTypedValue(s,t.dataType);if(Array.isArray(a)&&a.length){let n=a[0];return o.readTypedValue(n.value,n.dataType)}if(i.fromExamples){let n;if(Array.isArray(e.examples)&&e.examples.length?n=e.examples.filter(l=>typeof l!="string"):Array.isArray(t.examples)&&t.examples.length&&(n=t.examples),n&&n.length)return o.inputValueFromExamples(n)}return o.generateDefaultValue(t)}}static readInputValues(e,t,i={}){if(!e.required&&i.requiredOnly===!0)return[];let{defaultValue:r}=t;if(r){let n=new Ce().processNode(r);if(Array.isArray(n))return n}let s=t;if(i.fromExamples){let a;return Array.isArray(e.examples)&&e.examples.length?a=e.examples.filter(n=>typeof n!="string"):Array.isArray(s.examples)&&s.examples.length&&(a=s.examples),o.arrayValuesFromExamples(a)}return[]}static inputValueFromExamples(e){if(!Array.isArray(e)||!e.length)return;let[t]=e,{structuredValue:i}=t;if(i&&i.types.includes(d.aml.vocabularies.data.Scalar)){let r=i;return o.readTypedValue(r.value,r.dataType)}}static arrayValuesFromExamples(e){let t=[];if(!Array.isArray(e)||!e.length)return t;let[i]=e;if(!i.structuredValue||!i.structuredValue.types.includes(d.aml.vocabularies.data.Array))return t;let r=i.structuredValue,{members:s}=r;return!Array.isArray(s)||!s.length||s.forEach(a=>{let n=a;if(!n.value)return;let l=o.readTypedValue(n.value,n.dataType);typeof r<"u"&&r!==null&&t.push(l)}),t}static generateDefaultValue(e){let{dataType:t}=e;return this.defaultValue(t)}static generateMockedValue(e){let{dataType:t}=e;switch(t){case d.w3.xmlSchema.string:case d.aml.vocabularies.shapes.password:return this.generateStringValue(e);case d.w3.xmlSchema.number:case d.w3.xmlSchema.integer:case d.w3.xmlSchema.float:case d.w3.xmlSchema.long:case d.w3.xmlSchema.double:case d.aml.vocabularies.shapes.number:case d.aml.vocabularies.shapes.integer:case d.aml.vocabularies.shapes.float:case d.aml.vocabularies.shapes.long:case d.aml.vocabularies.shapes.double:return this.generateNumberValue(e);case d.aml.vocabularies.shapes.boolean:case d.w3.xmlSchema.boolean:return this.types.boolean();case d.aml.vocabularies.shapes.nil:case d.w3.xmlSchema.nil:return null;case d.w3.xmlSchema.date:return new Kt().dateOnly();case d.w3.xmlSchema.dateTime:return new Kt().dateTime(e.format==="date-time"?"rfc3339":e.format);case d.aml.vocabularies.shapes.dateTimeOnly:return new Kt().dateTimeOnly();case d.w3.xmlSchema.time:return new Kt().timeOnly();default:return}}static defaultValue(e){switch(e){case d.w3.xmlSchema.string:case d.aml.vocabularies.shapes.password:return"";case d.w3.xmlSchema.number:case d.w3.xmlSchema.integer:case d.w3.xmlSchema.float:case d.w3.xmlSchema.long:case d.w3.xmlSchema.double:case d.aml.vocabularies.shapes.number:case d.aml.vocabularies.shapes.integer:case d.aml.vocabularies.shapes.float:case d.aml.vocabularies.shapes.long:case d.aml.vocabularies.shapes.double:return 0;case d.aml.vocabularies.shapes.boolean:case d.w3.xmlSchema.boolean:return!1;case d.aml.vocabularies.shapes.nil:case d.w3.xmlSchema.nil:return null;case d.w3.xmlSchema.date:return"";case d.w3.xmlSchema.dateTime:return"";case d.aml.vocabularies.shapes.dateTimeOnly:return"";case d.w3.xmlSchema.time:return"";default:return}}static generateNumberValue(e){let{minimum:t,maximum:i,format:r,multipleOf:s}=e,a={};typeof t=="number"&&(a.min=t),typeof i=="number"&&(a.max=i);let n;return r&&["float","double"].includes(r)?n=this.types.float.bind(this.types):r&&["uint32","uint64","fixed32","fixed64"].includes(r)&&(a.min=0,a.max&&a.max<0&&delete a.max),n||(n=this.types.number.bind(this.types)),typeof s=="number"&&(a.precision=s),n(a)}static generateStringValue(e){let{minLength:t,maxLength:i,name:r="",format:s,pattern:a}=e;if(a)return new Ti().fromPattern(a,{max:10});let n=r.toLowerCase();if(n==="description")return this.lorem.paragraph();if(s==="uuid")return this.types.uuid();if(n==="id"){let p={length:12},u=typeof t=="number";return u?p.length=t:!u&&typeof i=="number"&&(p.length=i),this.types.hash(p)}if(["name","fullname"].includes(n))return this.person.name();if(n==="firstname")return this.person.firstName();if(n==="lastname")return this.person.lastName();let l={},c=typeof t=="number";return c?l.length=t:!c&&typeof i=="number"&&(l.length=i),this.lorem.word(l)}static readTypedValue(e,t){return Sr(e,t)}static readInputType(e){switch(e){case d.aml.vocabularies.shapes.number:case d.aml.vocabularies.shapes.integer:case d.aml.vocabularies.shapes.float:case d.aml.vocabularies.shapes.long:case d.aml.vocabularies.shapes.double:case d.w3.xmlSchema.number:case d.w3.xmlSchema.integer:case d.w3.xmlSchema.float:case d.w3.xmlSchema.long:case d.w3.xmlSchema.double:return"number";case d.w3.xmlSchema.date:return"date";case d.w3.xmlSchema.time:return"time";case d.w3.xmlSchema.dateTime:case d.aml.vocabularies.shapes.dateTimeOnly:return"datetime-local";case d.aml.vocabularies.shapes.boolean:case d.w3.xmlSchema.boolean:return"boolean";case d.aml.vocabularies.shapes.password:return"password";default:return"text"}}static parseNumberInput(e,t){return Rs(e,t)}static parseBooleanInput(e,t){return Ts(e,t)}static parseDateOnlyInput(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return;let i=t.toJSON(),r=i.indexOf("T");return i.substring(0,r)}static parseTimeOnlyInput(e){let t=String(e).trim();if(/^\d\d:\d\d$/.test(t))return`${t}:00`;if(/^\d\d:\d\d:\d\d$/.test(t))return t}static parseDateTimeInput(e,t="rfc3339"){let i=new Date(e);if(!Number.isNaN(i.getTime())){if(t==="rfc2616")return i.toUTCString();if(["rfc3339","date-time"].includes(t))return i.toISOString()}}static parseDateTimeOnlyInput(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return;let i=t.toJSON(),r=i.indexOf(".");return i.substring(0,r)}static parseArrayInput(e,t){let{items:i}=t;return i?o.parseUserInput(e,i):String(e)}static parseUserInput(e,t){if(!t||e===void 0||e===null)return e;let{types:i}=t;return i.includes(d.aml.vocabularies.shapes.ScalarShape)?o.parseScalarInput(e,t):i.includes(d.aml.vocabularies.shapes.ArrayShape)||i.includes(d.aml.vocabularies.shapes.MatrixShape)?o.parseArrayInput(e,t):e}static parseScalarInput(e,t){return this.parseScalar(e,t.dataType,t.format)}static parseScalar(e,t,i){switch(t){case d.aml.vocabularies.shapes.number:case d.aml.vocabularies.shapes.integer:case d.aml.vocabularies.shapes.float:case d.aml.vocabularies.shapes.long:case d.aml.vocabularies.shapes.double:case d.w3.xmlSchema.number:case d.w3.xmlSchema.integer:case d.w3.xmlSchema.float:case d.w3.xmlSchema.long:case d.w3.xmlSchema.double:return o.parseNumberInput(e);case d.aml.vocabularies.shapes.boolean:case d.w3.xmlSchema.boolean:return o.parseBooleanInput(e);case d.w3.xmlSchema.date:return o.parseDateOnlyInput(e);case d.w3.xmlSchema.time:return o.parseTimeOnlyInput(e);case d.w3.xmlSchema.dateTime:return o.parseDateTimeInput(e,i);case d.aml.vocabularies.shapes.dateTimeOnly:return o.parseDateTimeOnlyInput(e);default:return String(e)}}};var Ft=class{opts;constructor(e={}){this.opts=Object.freeze({...e})}_scalarValue(e){let{defaultValue:t,examples:i,values:r,inherits:s,dataType:a}=e;if(this.opts.renderExamples&&i&&i.length){let n=i.find(c=>!!c.structuredValue),l=this._exampleToObject(n);if(typeof l<"u")return Ct.readTypedValue(l,a)}if(t)return new Ce().processNode(t);if(r&&r.length){let n=r[0];if(n.value!==void 0)return Ct.readTypedValue(n.value,a)}if(Array.isArray(s)&&s.length)for(let n=0,l=s.length;n<l;n+=1){let c=this._scalarValue(s[n]);if(c!==void 0)return c}return this.opts.renderMocked?Ct.generateMockedValue(e):Ct.generateDefaultValue(e)}_isNotRequiredUnion(e){let t=0,i=!1;return e.forEach(r=>{r.types.includes(d.aml.vocabularies.shapes.NilShape)?i=!0:r.types.includes(d.aml.vocabularies.shapes.ScalarShape)?r.dataType===d.w3.xmlSchema.nil?i=!0:t+=1:r.types.includes(d.aml.vocabularies.shapes.FileShape)&&(t+=1)}),i?t===e.length-1:!1}};var Di=class extends Ft{generate(e){let t;return e.types.includes(d.w3.shacl.PropertyShape)?t=this._propertyShapeObject(e):t=this.toObject(e),t!==null&&typeof t=="object"?this.serialize(t):t}toObject(e){let{types:t}=e;return t.includes(d.aml.vocabularies.shapes.ScalarShape)?this._scalarShapeObject(e):t.includes(d.w3.shacl.NodeShape)?this._nodeShapeObject(e):t.includes(d.aml.vocabularies.shapes.UnionShape)?this._unionShapeObject(e):t.includes(d.aml.vocabularies.shapes.FileShape)?this._fileShapeObject():t.includes(d.aml.vocabularies.shapes.SchemaShape)?this._schemaShapeObject():t.includes(d.aml.vocabularies.shapes.TupleShape)?this._tupleShapeObject(e):t.includes(d.aml.vocabularies.shapes.ArrayShape)||t.includes(d.aml.vocabularies.shapes.MatrixShape)?this._arrayShapeObject(e):this._anyShapeObject(e)}serialize(e){return JSON.stringify(e,null,2)}_scalarShapeObject(e){return this._scalarValue(e)}_nilShapeObject(){}_nodeShapeObject(e){let{inherits:t}=e,{examples:i=[]}=e;if(Array.isArray(t)&&t.length&&t.forEach(a=>{let n=a;Array.isArray(n.examples)&&n.examples.length&&(i=i.concat(n.examples))}),this.opts.renderExamples&&i.length){let a=i.find(l=>!!l.structuredValue),n=this._exampleToObject(a);if(n!==void 0)return n}let r={},{properties:s}=e;return Array.isArray(t)&&t.length&&t.forEach(a=>{let n=this.toObject(a);typeof n=="object"&&(r={...r,...n})}),s.forEach(a=>{let{name:n}=a,l=this._propertyShapeObject(a);typeof l<"u"&&n&&(r[n]=l)}),r}_unionShapeObject(e){return e.and&&e.and.length?this._allOfUnion(e):e.xone&&e.xone.length?this._oneOfUnion(e):this._anyOfUnion(e)}_anyOfUnion(e){let{anyOf:t=[],examples:i=[]}=e;Array.isArray(e.inherits)&&e.inherits&&e.inherits.forEach(n=>{let l=n;Array.isArray(l.examples)&&l.examples.length&&(i=i.concat(l.examples));let c=n;Array.isArray(c.anyOf)&&c.anyOf.length&&(t=t.concat(c.anyOf))});let{opts:r}=this;if(this._isNotRequiredUnion(t))return;if(this.opts.renderExamples){let n=i.find(c=>!!c.structuredValue),l=this._exampleToObject(n);if(l!==void 0)return l}if(e.defaultValue)return this._unionDefaultValue(t,e.defaultValue);let{selectedUnions:s}=r,a;if(s&&s.length?a=t.find(n=>s.includes(n.id)):[a]=t,a)return this.toObject(a)}_oneOfUnion(e){let{examples:t=[]}=e,{xone:i=[]}=e;Array.isArray(e.inherits)&&e.inherits&&e.inherits.forEach(n=>{let l=n;Array.isArray(l.examples)&&l.examples.length&&(t=t.concat(l.examples))});let{opts:r}=this;if(this.opts.renderExamples){let n=t.find(c=>!!c.structuredValue),l=this._exampleToObject(n);if(l!==void 0)return l}if(e.defaultValue)return this._unionDefaultValue(i,e.defaultValue);let{selectedUnions:s}=r,a;if(s&&s.length?a=i.find(n=>s.includes(n.id)):[a]=i,a)return this.toObject(a)}_allOfUnion(e){let{examples:t=[]}=e,{and:i=[]}=e;if(Array.isArray(e.inherits)&&e.inherits&&e.inherits.forEach(s=>{let a=s;Array.isArray(a.examples)&&a.examples.length&&(t=t.concat(a.examples))}),this.opts.renderExamples){let s=t.find(n=>!!n.structuredValue),a=this._exampleToObject(s);if(a!==void 0)return a}let r={};return i.forEach(s=>{let a=this.toObject(s);typeof a=="object"&&(r={...r,...a})}),r}_unionDefaultValue(e,t){let r=new Ce().generate(t),s=!1,a=!1,n=!1;if(e.forEach(l=>{if(l.types.includes(d.aml.vocabularies.shapes.NilShape)&&(n=!0),!l.types.includes(d.aml.vocabularies.shapes.ScalarShape))return;let c=l;a||(a=c.dataType===d.w3.xmlSchema.boolean),s||(s=[d.w3.xmlSchema.number,d.w3.xmlSchema.long,d.w3.xmlSchema.integer,d.w3.xmlSchema.float,d.w3.xmlSchema.double,d.aml.vocabularies.shapes.number,d.aml.vocabularies.shapes.long,d.aml.vocabularies.shapes.integer,d.aml.vocabularies.shapes.float,d.aml.vocabularies.shapes.double].includes(c.dataType)),n||(n=c.dataType===d.w3.xmlSchema.nil)}),s){let l=Number(r);if(!Number.isNaN(l))return l}if(a){if(r==="true")return!0;if(r==="false")return!1}return n&&(r==="null"||r==="nil")?null:r}_arrayShapeObject(e){let{items:t}=e,i=e.defaultValue||t&&t.defaultValue,{examples:r=[]}=e,s=t;if(Array.isArray(s.examples)&&(r=r.concat(s.examples)),this.opts.renderExamples&&r&&r.length){let a=r.find(l=>!!l.structuredValue),n=this._exampleToObject(a);if(Array.isArray(n))return n;if(typeof n<"u")return[n]}if(i){let n=new Ce().processNode(i);if(Array.isArray(n))return n;if(n)return[n]}if(t){let a=this.toObject(t);if(typeof a<"u")return[a]}return[]}_tupleShapeObject(e){let{items:t,examples:i}=e;if(this.opts.renderExamples&&i&&i.length){let r=i.find(a=>!!a.structuredValue),s=this._exampleToObject(r);if(typeof s<"u")return[s]}if(e.defaultValue){let s=new Ce().processNode(e.defaultValue);if(Array.isArray(s))return s}if(t.length){let r=[];return t.forEach(s=>{let a=this.toObject(s);typeof a<"u"&&r.push(a)}),r}return[]}_anyShapeObject(e){let{and:t=[],xone:i=[],or:r=[]}=e;if(t.length){let s={};return t.forEach(a=>{let n=this.toObject(a);typeof n=="object"&&(s={...s,...n})}),s}if(i.length){let{selectedUnions:s=[]}=this.opts,a=i.find(n=>s.includes(n.id));return a||(a=i[0]),this.toObject(a)}if(r.length){let{selectedUnions:s=[]}=this.opts,a=r.find(n=>s.includes(n.id));return a||(a=r[0]),this.toObject(a)}return this._scalarShapeObject(e)}_propertyShapeObject(e){let{minCount:t=0}=e;if(t===0&&!this.opts.renderOptional)return;let{range:i}=e;if(!i)return;let{types:r}=i;if(r.includes(d.aml.vocabularies.shapes.ScalarShape)){let s=i;return this._scalarShapeObject(s)}return this.toObject(i)}_exampleToObject(e){if(e&&e.structuredValue)return new Ce().processNode(e.structuredValue)}_fileShapeObject(){}_schemaShapeObject(){}};var Pe=o=>o.replace(/[^a-zA-Z0-9-_.]/g,""),ta="unknown-type";function nt(o){let{name:e,inherits:t=[],xmlSerialization:i}=o,r=i&&i.name?i.name:e||ta;if(r==="schema"&&t.length){let s=t.find(a=>a.name&&a.name!=="schema");s&&(r=s.name==="type"&&s.displayName||s.name)}return Pe(String(r))}var zi=class extends Ft{generate(e){let t;return e.types.includes(d.w3.shacl.PropertyShape)?t=this._propertyShapeObject(e):t=this.processNode(e,{},!0),t}processNode(e,t={},i=!1){let{types:r}=e;return r.includes(d.aml.vocabularies.shapes.ScalarShape)?this._scalarShapeObject(e,t):r.includes(d.w3.shacl.NodeShape)?this._nodeShapeObject(e,t):r.includes(d.aml.vocabularies.shapes.UnionShape)?this._unionShapeObject(e):r.includes(d.aml.vocabularies.shapes.FileShape)?this._fileShapeObject():r.includes(d.aml.vocabularies.shapes.SchemaShape)?this._schemaShapeObject():r.includes(d.aml.vocabularies.shapes.TupleShape)?this._tupleShapeObject():r.includes(d.aml.vocabularies.shapes.ArrayShape)||r.includes(d.aml.vocabularies.shapes.MatrixShape)?this._arrayShapeObject(e,t,i):this._anyShapeObject(e)}serialize(e){return e}_readCurrentUnion(e){let{selectedUnions:t}=this.opts;return Ds(e,t)}_collectProperties(e){let{selectedUnions:t}=this.opts;return Ar(e,t)}_nodeShapeObject(e,t={}){let i=t.forceName||nt(e),r=[],s=t.indent||0,a=this._collectExamples(e,{tagFill:new Array(s*2+0).fill(" ").join(""),indent:s+1,nodeName:i});if(a)return a;let n=[];if(this._collectProperties(e).forEach(u=>{let{range:h,minCount:m=0}=u;if(m===0&&!this.opts.renderOptional||!h)return;let f=h;if(f.xmlSerialization&&f.xmlSerialization.attribute&&f.types.includes(d.aml.vocabularies.shapes.ScalarShape)){let k=Pe(f.xmlSerialization.name?f.xmlSerialization.name:u.name||f.name||ta);f.xmlSerialization.prefix&&(k=`${f.xmlSerialization.prefix}:${k}`);let S=this._scalarValue(f);n.push(`${k}="${S}"`);return}let b=this._propertyShapeObject(u,{indent:s});if(typeof b<"u"){let k=t.noWrap?0:2,S=new Array(s*2+k).fill(" ").join("");r.push(_r(S,b))}}),t.noWrap)return r.join(`
|
|
38
37
|
`);let c=`<${i}`;n.length&&(c+=" ",c+=n.join(" ")),r.unshift(`${c}>`);let p=new Array(s*2).fill(" ").join("");return r.push(`${p}</${i}>`),r.join(`
|
|
39
|
-
`)}_scalarShapeObject(e,t={}){let{xmlSerialization:i,defaultValue:r}=e,s;r?s=new
|
|
40
|
-
`)}_createTabs(e=0,t=0){return new Array(e*2+t).fill(" ").join("")}_nodePropertyObject(e,t={}){let i=[],r=
|
|
38
|
+
`)}_scalarShapeObject(e,t={}){let{xmlSerialization:i,defaultValue:r}=e,s;r?s=new xe().processNode(r):s=this._scalarValue(e);let a=t.forceName||nt(e),n=[],l=[];if(i){let{namespace:p,prefix:u}=i;if(p){let h=u?`xmlns:${u}`:"xmlns";n.push(`${h}="${p}"`)}u&&(a=`${u}:${a}`)}let c=`<${a}`;return n.length&&(c+=" ",c+=n.join(" ")),c+=">",l.push(c),l.push(s),l.push(`</${a}>`),l.join("")}_nilShapeObject(e,t={}){let{xmlSerialization:i}=e,r="",s=t.forceName||nt(e),a=[],n=[];if(i){let{namespace:c,prefix:p}=i;if(c){let u=p?`xmlns:${p}`:"xmlns";a.push(`${u}="${c}"`)}p&&(s=`${p}:${s}`)}let l=`<${s}`;return a.length&&(l+=" ",l+=a.join(" ")),l+=">",n.push(l),n.push(r),n.push(`</${s}>`),n.join("")}_propertyShapeObject(e,t={}){let{range:i,minCount:r=0}=e;if(r===0&&!this.opts.renderOptional||!i)return;let{types:s}=i;if(s.includes(d.aml.vocabularies.shapes.ScalarShape))return this._scalarShapeObject(i,{...t});if(s.includes(d.aml.vocabularies.shapes.NilShape)){let n=nt(e);return this._nilShapeObject(i,{...t,forceName:n})}if(s.includes(d.aml.vocabularies.shapes.RecursiveShape))return;if(s.includes(d.w3.shacl.NodeShape))return this._nodePropertyObject(e,t);if(s.includes(d.aml.vocabularies.shapes.ArrayShape)||s.includes(d.aml.vocabularies.shapes.MatrixShape))return this._nodePropertyArray(e,t);let a=nt(e);return this.processNode(i,{...t,forceName:a})}_collectExamples(e,t={}){if(!this.opts.renderExamples)return;let{isWrapped:i,nodeName:r,tagFill:s="",indent:a=0}=t,{examples:n=[]}=e,{inherits:l}=e;Array.isArray(l)&&l.length&&l.forEach(h=>{let m=h;if(m.types.includes(d.aml.vocabularies.shapes.UnionShape)){let b=m,{anyOf:k=[]}=b;m=this._readCurrentUnion(k)}let f=m;Array.isArray(f.examples)&&f.examples.length&&(n=n.concat(f.examples))});let c=n.filter(h=>!!h.structuredValue);if(!c.length)return;let p=[];i&&p.push(`${s}<${r}>`);let u=new xe;return c.forEach(h=>{let m=u.generate(h.structuredValue,r,{indent:a+1});m!==void 0&&p.push(m)}),i&&p.push(`${s}</${r}>`),p.join(`
|
|
39
|
+
`)}_createTabs(e=0,t=0){return new Array(e*2+t).fill(" ").join("")}_nodePropertyObject(e,t={}){let i=[],r=Pe(String(e.name)),{indent:s=0}=t,a=this._createTabs(s),n,l=e.range,c=this._collectExamples(l,{tagFill:a,indent:s+1,nodeName:r}),p=[];if(c)n=c;else{let h=[];this._collectProperties(l).forEach(f=>{let{range:b,minCount:k=0}=f;if(k===0&&!this.opts.renderOptional)return;let S=b;if(S.xmlSerialization){let{prefix:D,attribute:w}=S.xmlSerialization;if(w&&S.types.includes(d.aml.vocabularies.shapes.ScalarShape)){let v=Pe(S.xmlSerialization.name?S.xmlSerialization.name:f.name||S.name||ta);D&&(v=`${D}:${v}`);let E=this._scalarValue(S);p.push(`${v}="${E}"`);return}}let I=this._propertyShapeObject(f,{indent:s});if(I!==void 0){let D=this._createTabs(s,2);h.push(_r(D,I))}}),n=h.join(`
|
|
41
40
|
`)}let u=`${a}<${r}`;return p.length&&(u+=" ",u+=p.join(" ")),i.unshift(`${u}>`),i.push(n),i.push(`${a}</${r}>`),i.join(`
|
|
42
|
-
`)}_nodePropertyArray(e,t={}){let i=e.range,r=[],s;i.xmlSerialization&&i.xmlSerialization.name?s=
|
|
43
|
-
`)}_arrayShapeObject(e,t={},i=!1){let{items:r}=e,s=!!r&&r.types.includes(d.aml.vocabularies.shapes.ScalarShape),a;i&&e.xmlSerialization&&e.xmlSerialization.name?a=
|
|
44
|
-
`)}}if(s&&e.defaultValue){let
|
|
45
|
-
`)}return""}_scalarItems(e,t={}){let i=e.items,r=t.indent||0,s=new Array(r*2).fill(" ").join(""),a="";if(i.xmlSerialization&&i.xmlSerialization.name?a=
|
|
46
|
-
`)}}if(e.defaultValue){let p=new
|
|
47
|
-
`)}_exampleToObject(e){if(e&&e.structuredValue)return new
|
|
41
|
+
`)}_nodePropertyArray(e,t={}){let i=e.range,r=[],s;i.xmlSerialization&&i.xmlSerialization.name?s=Pe(i.xmlSerialization.name):s=Pe(String(e.name));let{indent:a=0}=t,n=!!i.items&&i.items.types.includes(d.aml.vocabularies.shapes.ScalarShape),l=this._createTabs(a);n||r.push(`${l}<${s}>`);let c=this._arrayShapeObject(i,{...t,indent:a});return r.push(c),n||r.push(`${l}</${s}>`),r.join(`
|
|
42
|
+
`)}_arrayShapeObject(e,t={},i=!1){let{items:r}=e,s=!!r&&r.types.includes(d.aml.vocabularies.shapes.ScalarShape),a;i&&e.xmlSerialization&&e.xmlSerialization.name?a=Pe(e.xmlSerialization.name):i&&e.name?a=Pe(e.name):!s&&r?.name?a=Pe(r.name):e.name&&(a=Pe(e.name));let n=!1;e.xmlSerialization&&typeof e.xmlSerialization.wrapped=="boolean"&&(n=!0);let l=!!e.xmlSerialization&&!!e.xmlSerialization.wrapped,c=t.indent||0,p=new Array(c*2+0).fill(" ").join(""),u=new Array(c*2+(l?2:0)).fill(" ").join("");if(this.opts.renderExamples){let{examples:h=[]}=e,m=h.filter(f=>!!f.structuredValue);if(m.length){let f=[],b=new xe;if(s&&!l){let[k]=m;!a&&r?.name&&(a=Pe(r.name));let S=b.generate(k.structuredValue,a,{indent:c});S!==void 0&&f.push(S)}else if(s&&l){let[k]=m,S=b.generate(k.structuredValue,a,{indent:c});f.push(`${p}<${a}>`),S!==void 0&&f.push(S),f.push(`${p}</${a}>`)}else l?m.forEach(k=>{f.push(`${p}<${a}>`);let S=b.generate(k.structuredValue,void 0,{indent:c+2});S!==void 0&&f.push(S),f.push(`${p}</${a}>`)}):m.forEach(k=>{let S=b.generate(k.structuredValue,void 0,{indent:c});S!==void 0&&f.push(S)});return f.join(`
|
|
43
|
+
`)}}if(s&&e.defaultValue){let m=new xe().generate(e.defaultValue);return!a&&r?.name&&(a=Pe(r.name)),`<${a}>${m?.trim()}</${a}>`}if(r){let h=[];l&&s&&h.push(`${p}<${a}>`);let m={indent:c+1};a&&(m.forceName=a),!i&&(!n||n&&!l)&&(m.noWrap=!0);let f=this.processNode(r,m);return f!==void 0&&h.push(`${u}${f}`),l&&s&&h.push(`${p}</${a}>`),h.join(`
|
|
44
|
+
`)}return""}_scalarItems(e,t={}){let i=e.items,r=t.indent||0,s=new Array(r*2).fill(" ").join(""),a="";if(i.xmlSerialization&&i.xmlSerialization.name?a=Pe(i.xmlSerialization.name):a=nt(e.name?e:i),this.opts.renderExamples){let{examples:c=[]}=e;Array.isArray(i.examples)&&(c=c.concat(i.examples));let p=c.filter(u=>!!u.structuredValue);if(p.length){let u=[],h=new xe;return p.forEach(m=>{let f=h.generate(m.structuredValue,a);f!==void 0&&u.push(`${s}${f}`)}),u.join(`
|
|
45
|
+
`)}}if(e.defaultValue){let p=new xe().generate(e.defaultValue,a);if(p!==void 0)return`${s}${p}`}let n={indent:r+1,forceName:a},l=this.processNode(i,n);return`${s}${l}`}_nodeItems(e,t={}){let i=e.items,r=t.indent||0,s=new Array(r*2).fill(" ").join(""),a=e.xmlSerialization&&!!e.xmlSerialization.wrapped,n=e.defaultValue||i.defaultValue,l="";i.xmlSerialization&&i.xmlSerialization.name?l=Pe(i.xmlSerialization.name):l=nt(e.name?e:i);let c=a?new Array(r*2+2).fill(" ").join(""):s,p=[];a&&p.push(`${s}<${l}>`);let u=!1;if(this.opts.renderExamples){let{examples:h=[]}=e;Array.isArray(i.examples)&&(h=h.concat(i.examples));let m=h.filter(f=>!!f.structuredValue);if(m.length){let f=[],b=new xe;m.forEach(k=>{let S=b.generate(k.structuredValue,l);S!==void 0&&f.push(`${s}${S}`)}),u=!0}}if(!u&&n){let m=new xe().generate(n,l);m!==void 0&&(p.push(`${s}${m}`),u=!0)}return u||this._collectProperties(i).forEach(m=>{let f=this._propertyShapeObject(m);f&&p.push(`${c}${f}`)}),a&&p.push(`${s}</${l}>`),p.join(`
|
|
46
|
+
`)}_exampleToObject(e){if(e&&e.structuredValue)return new xe().generate(e.structuredValue)}_unionShapeObject(e,t={}){let{anyOf:i=[],examples:r=[]}=e;if(Array.isArray(e.inherits)&&e.inherits&&e.inherits.forEach(s=>{let a=s;Array.isArray(a.examples)&&a.examples.length&&(r=r.concat(a.examples));let n=s;Array.isArray(n.anyOf)&&n.anyOf.length&&(i=i.concat(n.anyOf))}),Array.isArray(i)&&i.length){if(this._isNotRequiredUnion(i))return;let s=r.find(l=>!!l.structuredValue),a=this._exampleToObject(s);if(a!==void 0){let l=nt(e),c=t.indent||0,p=new Array(c*2).fill(" ").join(""),u=new Array(c*2+2).fill(" ").join(""),h=[];h.push(`${p}<${l}>`);let m=String(a).split(`
|
|
48
47
|
`).filter(f=>!!f).map(f=>`${u}${f}`).join(`
|
|
49
|
-
`);return
|
|
50
|
-
`)}if(e.defaultValue)return this._unionDefaultValue(e,e.defaultValue);let n=this._readCurrentUnion(i);if(n)return this.processNode(n,{...t,forceName:e.name})}}_unionDefaultValue(e,t,i={}){let s=new
|
|
51
|
-
`)}_fileShapeObject(){}_schemaShapeObject(){}_tupleShapeObject(){}_anyShapeObject(e){let{and:t=[],xone:i=[],or:r=[]}=e;if(t.length){let n=structuredClone(e);return n.and=[],n.properties=[],t.forEach(l=>{let{types:c}=l;if(c.includes(d.aml.vocabularies.shapes.ScalarShape)){let p=l;n.properties.push(p)}else if(c.includes(d.w3.shacl.NodeShape))l.properties.forEach(u=>n.properties.push(u));else if(c.includes(d.aml.vocabularies.shapes.ArrayShape)||c.includes(d.aml.vocabularies.shapes.MatrixShape)){let p=l;p.items&&n.properties.push(p.items)}}),this._nodeShapeObject(n)}if(i.length){let{selectedUnions:n=[]}=this.opts,l=i.find(c=>n.includes(c.id));return l||(l=i[0]),this.processNode(l)}if(r.length){let{selectedUnions:n=[]}=this.opts,l=r.find(c=>n.includes(c.id));return l||(l=r[0]),this.processNode(l)}let{examples:s=[]}=e,a=
|
|
52
|
-
`)}return this._scalarShapeObject(e)}};var Yn=zo(Bn(),1);var Wr=Symbol("findAmfType"),Wn=Symbol("findReferenceObject"),he=Symbol("getArrayItems"),Hn=Symbol("computeReferenceSecurity"),ia=o=>{class e extends o{_amf;__cachedKeys;__lastSetValue;get amf(){return this._amf}set amf(i){if(this._amf===i||this.__lastSetValue===i)return;this.__lastSetValue=i;let r=i?this._expand(i):void 0;this.__cachedKeys={},this._amf=r,this._amfChanged(r)}_amfChanged(i){}_expand(i){return Yn.AmfModelExpander.expand(i)}_getAmfKey(i,r){if(!i)return"";let{amf:s}=this;if(!s&&!r)return i;Array.isArray(s)&&([s]=s),this.__cachedKeys||(this.__cachedKeys={});let a=r||s&&s["@context"];if(!a||!i)return i;let n=this.__cachedKeys;if(i in n)return n[i];i=String(i);let l=i.indexOf("#"),c=i.substring(0,l+1),p=Object.keys(a);for(let u=0,m=p.length;u<m;u++){let h=p[u];if(a[h]===i)return n[i]=h,h;if(l===-1&&i.indexOf(a[h])===0){let f=i.replace(a[h],`${h}:`);return n[i]=f,f}if(a[h]===c){let f=`${h}:${i.substring(l+1)}`;return n[i]=f,f}}return i}_ensureAmfModel(i){if(i&&(Array.isArray(i)&&([i]=i),this._hasType(i,d.aml.vocabularies.document.Document)))return i}_ensureArray(i){if(i)return i instanceof Array?i:[i]}_getValue(i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&i[a];if(!n)return n;if(Array.isArray(n)&&([n]=n),!n)return;let l=typeof n;return["string","number","boolean","undefined"].includes(l)?n:n["@value"]}_getValueArray(i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&this._ensureArray(i[a]);if(Array.isArray(n))return n.map(l=>l["@value"]||l)}[he](i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&this._ensureArray(i[a]);if(Array.isArray(n))return n}_getLinkValue(i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&i[a];if(n&&(Array.isArray(n)&&([n]=n),!!n))return n["@id"]}_getLinkValues(i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&i[a];if(n)return Array.isArray(n)||(n=[n]),n.map(l=>l["@id"])}_hasType(i,r,s){let a=this._ensureArray(i&&i["@type"]);if(!a||!a.length)return!1;let n=this._getAmfKey(r,s);for(let l of a)if(l===n)return!0;return!1}_hasProperty(i,r,s){let a=this._getAmfKey(r,s);return!!(i&&a&&a in i)}_computePropertyArray(i,r,s){if(!i)return;let a=this._getAmfKey(r,s);if(!a)return;let n=this._ensureArray(i&&i[a]);if(!(!n||!Array.isArray(n)))return n}_computeApiVersion(i,r){let s=this._computeApi(i);if(s)return this._getValue(s,d.aml.vocabularies.core.version,r)}_computeEncodes(i,r){if(!i)return;Array.isArray(i)&&([i]=i);let s=this._getAmfKey(d.aml.vocabularies.document.encodes,r);if(!s)return;let a=i[s];if(a)return Array.isArray(a)?a[0]:a}_computeDeclares(i,r){if(!i||(Array.isArray(i)&&([i]=i),!i))return;let s=this._getAmfKey(d.aml.vocabularies.document.declares,r);if(!s)return;let a=this._ensureArray(i[s]);return Array.isArray(a)?a:void 0}_computeReferences(i,r){if(!i||(Array.isArray(i)&&([i]=i),!i))return;let s=this._getAmfKey(d.aml.vocabularies.document.references,r);if(!s)return;let a=this._ensureArray(i[s]);return a instanceof Array?a:void 0}_computeWebApi(i,r){let s=this._computeEncodes(i,r);if(s&&this._hasType(s,d.aml.vocabularies.apiContract.WebAPI,r))return s}_computeApi(i,r){let s=this._computeEncodes(i,r);if(s&&(this._isAPI(i,r)||this._isWebAPI(i,r)||this._isAsyncAPI(i,r)))return s}_isWebAPI(i,r){let s=this._computeEncodes(i,r);return s?this._hasType(s,d.aml.vocabularies.apiContract.WebAPI,r):!1}_isAsyncAPI(i,r){let s=this._computeEncodes(i,r);return s?this._hasType(s,d.aml.vocabularies.apiContract.AsyncAPI,r):!1}_isAPI(i,r){let s=this._computeEncodes(i,r);return s?this._hasType(s,d.aml.vocabularies.apiContract.API,r):!1}_isValidServerPartial(i,r){if(Array.isArray(i)&&([i]=i),!i)return!1;let s=d.aml.vocabularies.apiContract.Operation,a=d.aml.vocabularies.apiContract.EndPoint,n=[this._getAmfKey(s,r),this._getAmfKey(a,r)],l=i["@type"];for(let c of l)if(n.indexOf(c)!==-1)return!0;return!1}_getServers(i={},r){let{endpointId:s,methodId:a}=i,{amf:n}=this;if(!n)return;let l=this._computeApi(n,r);if(Array.isArray(l)&&([l]=l),!l)if(this._isValidServerPartial(n,r))l=n;else return;let c=this._getAmfKey(d.aml.vocabularies.apiContract.server,r),p=()=>this[he](l,c,r),u=()=>{let h=this._computeEndpointModel(l,s,r),f=this[he](h,c,r);return f||p()},m=()=>{let h=this._computeMethodModel(l,a,r),f=this[he](h,c,r);return f||u()};return a?m():s?u():p()}_computeExpects(i,r){let s=d.aml.vocabularies.apiContract.Operation,a=d.aml.vocabularies.apiContract.expects;if(this._hasType(i,s,r)){let n=this._getAmfKey(a,r),l=this._ensureArray(i[n]);if(l)return Array.isArray(l)?l[0]:l}}_computeEndpoints(i,r){if(!i)return[];let s=d.aml.vocabularies.apiContract.endpoint,a=this._getAmfKey(s,r);return this._ensureArray(i[a])}_computeEndpointModel(i,r,s){if(this._hasType(i,d.aml.vocabularies.apiContract.EndPoint,s))return i;let a=this._computeEndpoints(i,s);if(a)return a.find(n=>n["@id"]===r)}_computeMethodModel(i,r,s){let a=this.__computeMethodsListForMethod(i,r,s);if(a)return a.find(n=>n["@id"]===r)}_computeMethodEndpoint(i,r,s){if(!i||!r)return;if(this._hasType(i,d.aml.vocabularies.apiContract.EndPoint,s))return i;let a=this._computeEndpoints(i,s);if(!a)return;let n=this._getAmfKey(d.aml.vocabularies.apiContract.supportedOperation,s);for(let l=0,c=a.length;l<c;l++){let p=a[l],u=p[n];if(u){Array.isArray(u)||(u=[u]);for(let m=0,h=u.length;m<h;m++)if(u[m]["@id"]===r)return p}}}__computeMethodsListForMethod(i,r,s){let a=this._computeMethodEndpoint(i,r,s);if(!a)return;let n=this._getAmfKey(d.aml.vocabularies.apiContract.supportedOperation,s);return this._ensureArray(a[n])}_computeType(i,r,s,a){if(!i&&!r||!s)return;let n=s.replace("amf://id",""),l=i&&i.find(c=>c["@id"]===s||c["@id"]===n);if(!l&&r&&r.length)for(let c=0,p=r.length;c<p&&!(this._hasType(r[c],d.aml.vocabularies.document.Module)&&(l=this._computeReferenceType(r[c],s,a),l));c++);return l}[Wr](i,r){let{amf:s}=this;if(!s||!i)return;Array.isArray(s)&&([s]=s);let a=this._computeDeclares(s,r),n=i.replace("amf://id","");if(Array.isArray(a)){let l=a.find(c=>c["@id"]===i||c["@id"]===n);if(l)return l}return this[Wn](i)}[Wn](i,r){let{amf:s}=this;if(Array.isArray(s)&&([s]=s),!s)return;let a=this._computeReferences(s,r);if(!Array.isArray(a)||!a.length)return;let n=i.replace("amf://id","");for(let l=0,c=a.length;l<c;l++){let p=a[l],u=this._computeDeclares(p,r);if(Array.isArray(u))for(let m=0,h=u.length;m<h;m++){let f=u[m];if(Array.isArray(f)&&([f]=f),f["@id"]===i||f["@id"]===n)return f}}}_computeReferenceType(i,r,s){let a=this._computeDeclares(i,s);if(!a||!r)return;let n=r.replace("amf://id",""),l=a.find(c=>(Array.isArray(c)&&([c]=c),c["@id"]===r||c["@id"]===n));return Array.isArray(l)&&([l]=l),this._resolve(l)}_computeDocument(i,r,s){if(!i||!r)return;let a=this._getAmfKey(d.aml.vocabularies.core.documentation,s),n=this._ensureArray(i[a]);return n&&n.find(l=>l["@id"]===r)}_resolve(i,r){let{amf:s}=this;if(typeof i!="object"||Array.isArray(i)||!s||i.__apicResolved)return i;let a=this._getAmfKey(d.aml.vocabularies.document.linkTarget,r),n=this._ensureArray(i[a]),l;if(n){let u=n[0]["@id"];if(u===i["@id"])return i.__apicResolved=!0,i;l=this._getLinkTarget(s,u,r)}else if(a=this._getAmfKey(d.aml.vocabularies.document.referenceId,r),n=this._ensureArray(i[a]),n){let u=n[0]["@id"];if(u===i["@id"])return i.__apicResolved=!0,i;l=this._getReferenceId(s,u,r)}if(!l)return this._resolveRecursive(i),i.__apicResolved=!0,i;let c={...l};delete c["@id"];let p=c["@type"];return p&&(i["@type"]?i["@type"]=i["@type"].concat(p):i["@type"]=p,delete c["@type"]),this._mergeShapes(i,c,r),i.__apicResolved=!0,this._resolveRecursive(i),i}_getLinkTarget(i,r,s){if(!i||!r)return;let a,n=this._computeDeclares(i,s);if(n&&(a=this._findById(n,r)),!a){let l=this._computeReferences(i,s);a=this._obtainShapeFromReferences(l,r,s)}if(a)return a=this._resolve(a),a}_obtainShapeFromReferences(i,r,s){if(!Array.isArray(i)||!i.length)return;let a;for(let n of i){let l=this._computeEncodes(n,s);if(l&&l["@id"]===r){a=l;break}if(!l&&(a=this._findById(this._computeDeclares(n,s),r),a))break}return a}_findById(i,r){if(!i)return;let s;for(let a of i)if(a&&a["@id"]===r){s=a;break}return s}_getReferenceId(i,r,s){if(!i||!r)return;let a=this._computeReferences(i,s);if(a)for(let n of a){let l=this._computeEncodes(n,s);if(l&&l["@id"]===r)return l}}_resolveRecursive(i,r){Object.keys(i).forEach(s=>{let a=i[s];if(Array.isArray(a))for(let n=0,l=a.length;n<l;n++)a[n]=this._resolve(a[n]);else typeof a=="object"&&(i[s]=this._resolve(a,r))})}_mergeShapes(i,r,s){let a={...i,...r};return[{key:this._getAmfKey(d.aml.vocabularies.docSourceMaps.sources,s),merger:this._mergeSourceMapsSources.bind(this)}].forEach(({key:l,merger:c})=>{this._hasProperty(a,l,s)&&(a[l]=c(i,r,s))}),Object.assign(i,a)}_mergeSourceMapsSources(i,r,s){let a=this._getAmfKey(d.aml.vocabularies.docSourceMaps.sources,s),n=i[a]||{};Array.isArray(n)&&(n=n[0]);let l=r[a]||{};return Array.isArray(l)&&(l=l[0]),[Object.assign(n,l)]}_expandKey(i,r){let{amf:s}=this;if(!i||typeof i!="string"||!s&&!r)return i;Array.isArray(s)&&([s]=s);let a=r||s&&s["@context"];if(!a)return i;let[n,l]=i.split(":");if(!n||!l)return i;let c=a[n];return c?`${c}${l}`:i}findSecurityScheme(i,r){let{amf:s}=this,a=this._computeDeclares(s,r),n;if(a&&(n=a.find(c=>c["@id"]===i)),n)return n=this._resolve(n),n;let l=this._computeReferences(s,r);if(Array.isArray(l)&&l.length){for(let c of l)if(this._hasType(c,d.aml.vocabularies.document.Module,r)&&(n=this[Hn](c,i,r),n))return n=this._resolve(n),n}}[Hn](i,r,s){let a=this._computeDeclares(i,s);if(!a)return;let n=a.find(l=>{let c=l;return Array.isArray(c)&&([c]=c),c["@id"]===r});return Array.isArray(n)&&([n]=n),this._resolve(n)}getByType(i,r,s){if(!i)return[];let a=[],n=this._computeDeclares(i),l=this._getAmfKey(r,s);n&&n.length&&n.forEach(p=>{this._hasType(p,l)&&a.push(p)});let c=this._computeReferences(i);if(Array.isArray(c)&&c.length){for(let p of c)if(this._hasType(p,d.aml.vocabularies.document.Module)){let u=this.getByType(p,r,s);u.length&&(a=a.concat(u))}}return a}}return e};var ra=class extends ia(Object){constructor(e){super(),e&&(this.amf=e)}readTypes(e,t){let i=e;return typeof i=="string"&&(i=[i]),Array.isArray(i)?i.map(r=>this._expandKey(r,t)):[]}apiSummary(e){let t=e["@context"],i={id:e["@id"],types:this.readTypes(e["@type"],t),customDomainProperties:this.customDomainProperties(e,t),sourceMaps:this.sourceMap(e),schemes:[],accepts:[],contentType:[],documentations:[],tags:[]},r=this._getValue(e,d.aml.vocabularies.core.name,t);r&&typeof r=="string"&&(i.name=r);let s=this._getValue(e,d.aml.vocabularies.core.description,t);s&&typeof s=="string"&&(i.description=s);let a=this._getValue(e,d.aml.vocabularies.core.version,t);a&&typeof a=="string"&&(i.version=a);let n=this._getValue(e,d.aml.vocabularies.core.termsOfService,t);n&&typeof n=="string"&&(i.termsOfService=n);let l=e[this._getAmfKey(d.aml.vocabularies.apiContract.accepts,t)];Array.isArray(l)&&l.length&&(i.accepts=this._getValueArray(e,d.aml.vocabularies.apiContract.accepts,t));let c=e[this._getAmfKey(d.aml.vocabularies.apiContract.contentType,t)];Array.isArray(c)&&c.length&&(i.contentType=this._getValueArray(e,d.aml.vocabularies.apiContract.contentType,t));let p=e[this._getAmfKey(d.aml.vocabularies.apiContract.scheme,t)];Array.isArray(p)&&p.length&&(i.schemes=this._getValueArray(e,d.aml.vocabularies.apiContract.scheme,t));let u=e[this._getAmfKey(d.aml.vocabularies.core.provider,t)];Array.isArray(u)&&([u]=u),u&&(i.provider=this.provider(u));let m=e[this._getAmfKey(d.aml.vocabularies.core.license,t)];Array.isArray(m)&&([m]=m),m&&(i.license=this.license(m));let h=e[this._getAmfKey(d.aml.vocabularies.apiContract.tag,t)];Array.isArray(h)&&h.length&&(i.tags=h.map(k=>this.tag(k)));let f=e[this._getAmfKey(d.aml.vocabularies.core.documentation,t)];return Array.isArray(f)&&f.length&&(i.documentations=f.map(k=>this.documentation(k))),i}api(e,t){let i=t||e["@context"],r=this.apiSummary(e);r.endPoints=[],r.servers=[],r.security=[];let s=e[this._getAmfKey(d.aml.vocabularies.apiContract.endpoint,i)];Array.isArray(s)&&s.length&&(r.endPoints=s.map(l=>this.endPoint(l,i)));let a=e[this._getAmfKey(d.aml.vocabularies.apiContract.server,i)];Array.isArray(a)&&a.length&&(r.servers=a.map(l=>this.server(l,i)));let n=e[this._getAmfKey(d.aml.vocabularies.security.security,i)];return Array.isArray(n)&&n.length&&(r.security=n.map(l=>this.securityRequirement(l,i))),r}webApi(e,t){return this.api(e,t)}asyncApi(e,t){return this.api(e,t)}provider(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getLinkValue(e,d.aml.vocabularies.core.url,i);a&&typeof a=="string"&&(r.url=a);let n=this._getValue(e,d.aml.vocabularies.core.email,i);return n&&typeof n=="string"&&(r.email=n),r}license(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getLinkValue(e,d.aml.vocabularies.core.url,i);return a&&typeof a=="string"&&(r.url=a),r}server(e,t){let i=t||e["@context"],r=this._getValue(e,d.aml.vocabularies.core.urlTemplate,i)||"",s={id:e["@id"],types:this.readTypes(e["@type"],i),url:r,variables:[],customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(s.description=a);let n=e[this._getAmfKey(d.aml.vocabularies.apiContract.variable,i)];Array.isArray(n)&&n.length&&(s.variables=n.map(u=>this.parameter(u,i)));let l=this._getValue(e,d.aml.vocabularies.apiContract.protocol,i),c=this._getValue(e,d.aml.vocabularies.apiContract.protocolVersion,i);l&&(s.protocol=l),c&&(s.protocolVersion=c);let p=e[this._getAmfKey(d.aml.vocabularies.security.security,i)];return Array.isArray(p)&&p.length&&(s.security=p.map(u=>this.securityRequirement(u,i))),s}parameter(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),payloads:[],examples:[],customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.apiContract.paramName,i);a&&typeof a=="string"&&(r.paramName=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(r.description=n);let l=this._getValue(e,d.aml.vocabularies.apiContract.required,i);typeof l=="boolean"&&(r.required=l);let c=this._getValue(e,d.aml.vocabularies.apiContract.allowEmptyValue,i);typeof c=="boolean"&&(r.allowEmptyValue=c);let p=this._getValue(e,d.aml.vocabularies.document.deprecated,i);typeof p=="boolean"&&(r.deprecated=p);let u=this._getValue(e,d.aml.vocabularies.apiContract.explode,i);typeof u=="boolean"&&(r.explode=u);let m=this._getValue(e,d.aml.vocabularies.apiContract.allowReserved,i);typeof m=="boolean"&&(r.allowReserved=m);let h=this._getValue(e,d.aml.vocabularies.apiContract.style,i);h&&typeof h=="string"&&(r.style=h);let f=this._getValue(e,d.aml.vocabularies.apiContract.binding,i);f&&typeof f=="string"&&(r.binding=f);let k=e[this._getAmfKey(d.aml.vocabularies.shapes.schema,i)];if(Array.isArray(k)&&k.length){let[_]=k;r.schema=this.unknownShape(_,{trackedId:e["@id"]},i)}let w=e[this._getAmfKey(d.aml.vocabularies.apiContract.payload,i)];Array.isArray(w)&&w.length&&(r.payloads=w.map(_=>this.payload(_,i)));let b=e[this._getAmfKey(d.aml.vocabularies.apiContract.examples,i)];return Array.isArray(b)&&b.length&&(r.examples=b.map(_=>this.example(_,i))),r}unknownShape(e,t,i){let r=i||e["@context"],s=this.readTypes(e["@type"],r);return s.includes(d.aml.vocabularies.shapes.ScalarShape)?this.scalarShape(e,t,r):s.includes(d.w3.shacl.NodeShape)?this.nodeShape(e,t,r):s.includes(d.aml.vocabularies.shapes.UnionShape)?this.unionShape(e,t,r):s.includes(d.aml.vocabularies.shapes.FileShape)?this.fileShape(e,t,r):s.includes(d.aml.vocabularies.shapes.SchemaShape)?this.schemaShape(e,t,r):s.includes(d.aml.vocabularies.shapes.TupleShape)?this.tupleShape(e,t,r):s.includes(d.aml.vocabularies.shapes.ArrayShape)||s.includes(d.aml.vocabularies.shapes.MatrixShape)?this.arrayShape(e,t,r):s.includes(d.aml.vocabularies.shapes.RecursiveShape)?this.recursiveShape(e,r):this.anyShape(e,t,r)}isLink(e,t){let i=t||e["@context"];return!!this._getLinkValue(e,d.aml.vocabularies.document.linkTarget,i)}getLinkTarget(e,t){let i=t||e["@context"],r=this._getLinkValue(e,d.aml.vocabularies.document.linkTarget,i);if(r)return this[Wr](r,i)}shape(e,t){let i=t||e["@context"];this._resolve(e);let r,s=e;if(this.isLink(s)){r=this._getValue(s,d.aml.vocabularies.document.linkLabel,i);let R=this._getLinkValue(s,d.aml.vocabularies.document.linkTarget,i),G=this[Wr](R,i);G&&(s=G)}let a={id:s["@id"],types:this.readTypes(e["@type"],i),values:[],inherits:[],or:[],and:[],xone:[],customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)};r&&(a.linkLabel=r);let n=this._getValue(s,d.w3.shacl.name,i);n&&typeof n=="string"&&(a.name=n);let l=this._getValue(s,d.aml.vocabularies.core.displayName,i);if(l&&typeof l=="string")a.displayName=l;else{let R=this._getValue(s,d.aml.vocabularies.core.name,i);R&&typeof R=="string"&&(a.displayName=R)}let c=this._getValue(s,d.aml.vocabularies.core.description,i);c&&typeof c=="string"&&(a.description=c);let p=this._getValue(s,d.w3.shacl.defaultValueStr,i);p&&typeof p=="string"&&(a.defaultValueStr=p);let u=this._getValue(s,d.aml.vocabularies.shapes.deprecated,i);typeof u=="boolean"&&(a.deprecated=u);let m=this._getValue(s,d.aml.vocabularies.shapes.readOnly,i);typeof m=="boolean"&&(a.readOnly=m);let h=this._getValue(s,d.aml.vocabularies.shapes.writeOnly,i);typeof h=="boolean"&&(a.writeOnly=h);let f=s[this._getAmfKey(d.w3.shacl.defaultValue,i)];Array.isArray(f)&&f.length&&(a.defaultValue=this.unknownDataNode(f[0],i));let k=this._getAmfKey(d.w3.shacl.or,i),w=s[k];Array.isArray(w)&&w.length&&(a.or=w.map(R=>this.unknownShape(R,void 0,i)));let b=this._getAmfKey(d.w3.shacl.and,i),_=s[b];Array.isArray(_)&&_.length&&(a.and=_.map(R=>this.unknownShape(R,void 0,i)));let E=this._getAmfKey(d.w3.shacl.xone,i),x=s[E];Array.isArray(x)&&x.length&&(a.xone=x.map(R=>this.unknownShape(R,void 0,i)));let I=s[this._getAmfKey(d.w3.shacl.in,i)];if(Array.isArray(I)&&I.length){let[R]=I,G=d.w3.rdfSchema.key,J=this._getAmfKey(G,i);Object.keys(R).forEach(le=>{if(le.startsWith(G)||le.startsWith(J)){let Z=R[le];Array.isArray(Z)&&([Z]=Z);let ce=this.unknownDataNode(Z,i);ce&&a.values.push(ce)}})}let j=this._getAmfKey(d.w3.shacl.not,i),L=s[j];return L&&(Array.isArray(L)&&([L]=L),a.not=this.unknownShape(L,void 0,i)),a}anyShape(e,t={},i){let r=i||e["@context"],s=e,a=this.shape(s,r);if(this.isLink(s)){let p=this.getLinkTarget(s,r);p&&(s=p)}a.examples=[];let n=s[this._getAmfKey(d.aml.vocabularies.apiContract.examples,r)];if(Array.isArray(n)&&n.length)if(t.trackedId){let p=this.filterTrackedExamples(n,t.trackedId,r);a.examples=p.map(u=>this.example(u,r))}else{let p=this.filterNonTrackedExamples(n,r);a.examples=p.map(u=>this.example(u,r))}let l=s[this._getAmfKey(d.aml.vocabularies.core.documentation,r)];if(Array.isArray(l)&&l.length){let[p]=l;a.documentation=this.documentation(p,r)}let c=s[this._getAmfKey(d.aml.vocabularies.shapes.xmlSerialization,r)];return Array.isArray(c)&&c.length&&(a.xmlSerialization=this.xmlSerializer(c[0],r)),a}filterTrackedExamples(e,t,i){let{docSourceMaps:r}=d.aml.vocabularies,s=this._getAmfKey(r.sources,i),a=this._getAmfKey(r.trackedElement,i),n=t.indexOf("amf")===-1?`amf://id${t}`:t;return e.filter(l=>{let c=l;Array.isArray(c)&&([c]=c);let p=c[s];if(!p)return!0;Array.isArray(p)&&([p]=p);let u=p[a];if(!u)return!0;Array.isArray(u)&&([u]=u);let{value:m}=this.synthesizedField(u,i);if(!m)return!0;let h=m.split(",");return h.indexOf(n)!==-1||h.indexOf(t)!==-1})}filterNonTrackedExamples(e,t){let{docSourceMaps:i}=d.aml.vocabularies,r=this._getAmfKey(i.sources,t),s=this._getAmfKey(i.trackedElement,t);return e.filter(a=>{let n=a;Array.isArray(n)&&([n]=n);let l=n[r];if(!l)return!0;Array.isArray(l)&&([l]=l);let c=l[s];if(!c)return!0;Array.isArray(c)&&([c]=c);let{value:p}=this.synthesizedField(c,t);return!p})}scalarShape(e,t={},i){let r=i||e["@context"],s=e,a=this.anyShape(s,t,r);if(this.isLink(s)){let k=this.getLinkTarget(s,r);k&&(s=k)}let n=this._getValue(s,d.w3.shacl.pattern,r);n&&typeof n=="string"&&(a.pattern=n);let l=this._getLinkValue(s,d.w3.shacl.datatype,r);l&&typeof l=="string"&&(a.dataType=l);let c=this._getValue(s,d.aml.vocabularies.shapes.format,r);c&&typeof c=="string"&&(a.format=c);let p=this._getValue(s,d.aml.vocabularies.shapes.multipleOf,r);typeof p=="number"&&(a.multipleOf=p);let u=this._getValue(s,d.w3.shacl.minInclusive,r);typeof u=="number"&&(a.minimum=u,a.exclusiveMinimum=!1);let m=this._getValue(s,d.w3.shacl.maxInclusive,r);typeof m=="number"&&(a.maximum=m,a.exclusiveMaximum=!1);let h=this._getValue(s,d.w3.shacl.minLength,r);typeof h=="number"&&(a.minLength=h);let f=this._getValue(s,d.w3.shacl.maxLength,r);return typeof f=="number"&&(a.maxLength=f),a}nodeShape(e,t={},i){let r=i||e["@context"],s=e,a=this.anyShape(s,t,r);if(this.isLink(s)){let m=this.getLinkTarget(s,r);m&&(s=m)}let n=this._getValue(s,d.aml.vocabularies.shapes.discriminator,r);n&&typeof n=="string"&&(a.discriminator=n);let l=this._getValue(s,d.aml.vocabularies.shapes.discriminatorValue,r);l&&typeof l=="string"&&(a.discriminatorValue=l);let c=this._getValue(s,d.w3.shacl.closed,r);typeof c=="boolean"&&(a.closed=c),a.customShapeProperties=[],a.customShapePropertyDefinitions=[],a.dependencies=[];let p=s[this._getAmfKey(d.w3.shacl.property,r)];Array.isArray(p)&&p.length?a.properties=p.map(m=>this.propertyShape(m,r)):a.properties=[];let u=s[this._getAmfKey(d.w3.shacl.additionalPropertiesSchema,r)];if(Array.isArray(u)&&u.length===1){let[m]=u;a.additionalPropertiesSchema=this.unknownShape(m,void 0,r)}return a}propertyShape(e,t){let i=t||e["@context"],r=e,s=this.shape(r,i);if(this.isLink(r)){let p=this.getLinkTarget(r,i);p&&(r=p)}let a=this._getLinkValue(r,d.w3.shacl.path,i);a&&typeof a=="string"&&(s.path=a);let n=this._getValue(r,d.w3.shacl.minCount,i);typeof n=="number"&&(s.minCount=n);let l=this._getValue(r,d.w3.shacl.maxCount,i);typeof l=="number"&&(s.maxCount=l);let c=r[this._getAmfKey(d.aml.vocabularies.shapes.range,i)];if(Array.isArray(c)&&c.length){let[p]=c;s.range=this.unknownShape(p,void 0,i)}return s}unionShape(e,t={},i){let r=i||e["@context"],s=e[this._getAmfKey(d.aml.vocabularies.shapes.anyOf,r)],a=this.anyShape(e,t,r);if(Array.isArray(s)&&s.length){let n={...t,trackedId:void 0};a.anyOf=s.map(l=>this.unknownShape(l,n,r))}else a.anyOf=[];return a}fileShape(e,t={},i){let r=i||e["@context"],s=e,a=this.anyShape(s,t,r);if(this.isLink(s)){let k=this.getLinkTarget(s,r);k&&(s=k)}let n=this._getValue(s,d.w3.shacl.pattern,r);n&&typeof n=="string"&&(a.pattern=n);let l=this._getValueArray(s,d.aml.vocabularies.shapes.fileType,r);Array.isArray(l)&&l.length&&(a.fileTypes=l);let c=this._getValue(s,d.w3.shacl.minLength,r);typeof c=="number"&&(a.minLength=c);let p=this._getValue(s,d.w3.shacl.maxLength,r);typeof p=="number"&&(a.maxLength=p);let u=this._getValue(s,d.w3.shacl.minInclusive,r);typeof u=="number"&&(a.minimum=u,a.exclusiveMinimum=!1);let m=this._getValue(s,d.w3.shacl.maxInclusive,r);typeof m=="number"&&(a.maximum=m,a.exclusiveMaximum=!1);let h=this._getValue(s,d.aml.vocabularies.shapes.format,r);h&&typeof h=="string"&&(a.format=h);let f=this._getValue(s,d.aml.vocabularies.shapes.multipleOf,r);return typeof f=="number"&&(a.multipleOf=f),a}schemaShape(e,t={},i){let r=i||e["@context"],s=e,a=this.anyShape(s,t,r);if(this.isLink(s)){let c=this.getLinkTarget(s,r);c&&(s=c)}let n=this._getValue(s,d.aml.vocabularies.core.mediaType,r);n&&typeof n=="string"&&(a.mediaType=n);let l=this._getValue(s,d.aml.vocabularies.document.raw,r);return l&&typeof l=="string"&&(a.raw=l),a}recursiveShape(e,t){let i=t||e["@context"],r=e,s=this.shape(r,i);if(this.isLink(r)){let n=this.getLinkTarget(r,i);n&&(r=n)}let a=this._getLinkValue(r,d.aml.vocabularies.shapes.fixPoint,i);return a&&typeof a=="string"&&(s.fixPoint=a),s}dataArrangeShape(e,t={},i){let r=i||e["@context"];return this.anyShape(e,t,r)}arrayShape(e,t={},i){let r=i||e["@context"],s=e,a=this.dataArrangeShape(s,t,r);if(this.isLink(s)){let l=this.getLinkTarget(s,r);l&&(s=l)}let n=s[this._getAmfKey(d.aml.vocabularies.shapes.items,r)];if(Array.isArray(n)&&n.length){let[l]=n;a.items=this.unknownShape(l,void 0,r)}return a}tupleShape(e,t,i){let r=i||e["@context"],s=e,a=this.dataArrangeShape(s,t,r);if(this.isLink(s)){let c=this.getLinkTarget(s,r);c&&(s=c)}let n=s[this._getAmfKey(d.aml.vocabularies.shapes.items,r)],l=this._getAmfKey(d.w3.rdfSchema.key,r);return Array.isArray(n)&&n.length?(a.items=[],n.forEach(c=>{Array.isArray(c)&&([c]=c),Object.keys(c).filter(p=>p.startsWith(l)).forEach(p=>{let u=c[p];Array.isArray(u)&&([u]=u);let m=this.unknownShape(u,void 0,r);a.items.push(m)})})):a.items=[],a}documentation(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getLinkValue(e,d.aml.vocabularies.core.url,i);s&&typeof s=="string"&&(r.url=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(r.description=a);let n=this._getValue(e,d.aml.vocabularies.core.title,i);return n&&typeof n=="string"&&(r.title=n),r}example(e,t){let i=t||e["@context"];this._resolve(e);let r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),strict:!1},s=this._getValue(e,d.aml.vocabularies.document.strict,i);typeof s=="boolean"&&(r.strict=s);let a=this._getValue(e,d.aml.vocabularies.core.name,i);a&&typeof a=="string"&&(r.name=a);let n=this._getValue(e,d.aml.vocabularies.core.displayName,i);n&&typeof n=="string"&&(r.displayName=n);let l=this._getValue(e,d.aml.vocabularies.core.description,i);l&&typeof l=="string"&&(r.description=l);let c=this._getValue(e,d.aml.vocabularies.document.raw,i);c&&typeof c=="string"&&(r.value=c);let p=this._getValue(e,d.aml.vocabularies.document.location,i);p&&typeof p=="string"&&(r.location=p);let u=e[this._getAmfKey(d.aml.vocabularies.document.structuredValue,i)];if(Array.isArray(u)&&u.length){let[m]=u;r.structuredValue=this.unknownDataNode(m,i)}return r}xmlSerializer(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.shapes.xmlAttribute,i);typeof s=="boolean"&&(r.attribute=s);let a=this._getValue(e,d.aml.vocabularies.shapes.xmlWrapped,i);typeof a=="boolean"&&(r.wrapped=a);let n=this._getValue(e,d.aml.vocabularies.shapes.xmlName,i);n&&typeof n=="string"&&(r.name=n);let l=this._getValue(e,d.aml.vocabularies.shapes.xmlNamespace,i);l&&typeof l=="string"&&(r.namespace=l);let c=this._getValue(e,d.aml.vocabularies.shapes.xmlPrefix,i);return c&&typeof c=="string"&&(r.prefix=c),r}unknownDataNode(e,t){let i=this.readTypes(e["@type"],t);if(i.includes(d.aml.vocabularies.data.Scalar))return this.scalarNode(e,t);if(i.includes(d.aml.vocabularies.data.Object))return this.objectNode(e,t);if(i.includes(d.aml.vocabularies.data.Array))return this.arrayNode(e,t)}dataNode(e,t){let i={id:e["@id"],types:this.readTypes(e["@type"],t),customDomainProperties:this.customDomainProperties(e,t)},r=this._getValue(e,d.aml.vocabularies.core.name,t);return r&&typeof r=="string"&&(i.name=r),i}scalarNode(e,t){let i=t||e["@context"],r=this.dataNode(e,t),s=this._getValue(e,d.aml.vocabularies.data.value,i);s&&typeof s=="string"&&(r.value=s);let a=this._getLinkValue(e,d.w3.shacl.datatype,i);return a&&typeof a=="string"&&(r.dataType=a),r}objectNode(e,t){let i=t||e["@context"],r=this.dataNode(e,t);r.properties={};let s=d.aml.vocabularies.data.key,a=`${this._getAmfKey(s,i)}:`;return Object.keys(e).forEach(n=>{if(n.startsWith(s)||n.startsWith(a)){let l=e[n];Array.isArray(l)&&([l]=l);let c=n.replace(s,"").replace(a,""),p=this.unknownDataNode(l,t);p&&(r.properties[c]=p)}}),r}arrayNode(e,t){let i=t||e["@context"],r=this.dataNode(e,i);r.members=[];let s=this._computePropertyArray(e,d.w3.rdfSchema.member);return Array.isArray(s)&&s.length&&s.forEach(a=>{let n=this.unknownDataNode(a);n&&r.members.push(n)}),r}customDomainProperties(e,t){let i=[],r=t||e["@context"],s=this._getLinkValues(e,d.aml.vocabularies.document.customDomainProperties,r);return Array.isArray(s)&&s.length&&s.forEach(a=>{let n=`@base:${a}`,l=e[a]||e[n];if(!l)return;Array.isArray(l)&&([l]=l);let c=this.unknownDataNode(l,r),p=this._getValue(l,d.aml.vocabularies.core.extensionName,r);if(!p||!c)return;let u={id:a,name:p,extension:c};i.push(u)}),i}endPoint(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e),path:"",operations:[],parameters:[],payloads:[],servers:[],security:[],extends:[]},s=this._getValue(e,d.aml.vocabularies.apiContract.path,i);s&&typeof s=="string"&&(r.path=s);let a=this._getValue(e,d.aml.vocabularies.core.name,i);a&&typeof a=="string"&&(r.name=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(r.description=n);let l=this._getValue(e,d.aml.vocabularies.core.summary,i);l&&typeof l=="string"&&(r.summary=l);let c=this[he](e,d.aml.vocabularies.apiContract.supportedOperation,i);Array.isArray(c)&&c.length&&(r.operations=c.map(k=>this.operation(k,i)));let p=this[he](e,d.aml.vocabularies.apiContract.parameter,i);Array.isArray(p)&&p.length&&(r.parameters=p.map(k=>this.parameter(k,i)));let u=this[he](e,d.aml.vocabularies.apiContract.payload,i);Array.isArray(u)&&u.length&&(r.payloads=u.map(k=>this.payload(k,i)));let m=this[he](e,d.aml.vocabularies.apiContract.server,i);Array.isArray(m)&&m.length&&(r.servers=m.map(k=>this.server(k,i)));let h=this[he](e,d.aml.vocabularies.security.security,i);Array.isArray(h)&&h.length&&(r.security=h.map(k=>this.securityRequirement(k,i)));let f=this[he](e,d.aml.vocabularies.document.extends,i);return Array.isArray(f)&&f.length&&(r.extends=[],f.forEach(k=>{let w=k;Array.isArray(w)&&([w]=w),this._hasType(w,d.aml.vocabularies.apiContract.ParametrizedResourceType,i)?r.extends.push(this.parametrizedResourceType(w,i)):this._hasType(w,d.aml.vocabularies.apiContract.ParametrizedTrait,i)&&r.extends.push(this.parametrizedTrait(w,i))})),r}operation(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e),method:"",deprecated:!1,callbacks:[],responses:[],servers:[],security:[],accepts:[],schemes:[],contentType:[],tags:[],extends:[]},s=this._getValue(e,d.aml.vocabularies.apiContract.method,i);s&&typeof s=="string"&&(r.method=s);let a=this._getValue(e,d.aml.vocabularies.core.name,i);a&&typeof a=="string"&&(r.name=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(r.description=n);let l=this._getValue(e,d.aml.vocabularies.apiContract.guiSummary,i);l&&typeof l=="string"&&(r.summary=l);let c=this._getValue(e,d.aml.vocabularies.core.deprecated,i);typeof c=="boolean"&&(r.deprecated=c);let p=this._getValue(e,d.aml.vocabularies.apiContract.operationId,i);p&&typeof p=="string"&&(r.operationId=p);let u=this._getValueArray(e,d.aml.vocabularies.apiContract.accepts,i);Array.isArray(u)&&(r.accepts=u);let m=this._getValueArray(e,d.aml.vocabularies.apiContract.scheme,i);Array.isArray(m)&&(r.schemes=m);let h=this._getValueArray(e,d.aml.vocabularies.apiContract.contentType,i);Array.isArray(h)&&(r.contentType=h);let f=e[this._getAmfKey(d.aml.vocabularies.apiContract.expects,i)];f&&(Array.isArray(f)&&([f]=f),r.request=this.request(f,i));let k=e[this._getAmfKey(d.aml.vocabularies.core.documentation,i)];k&&(Array.isArray(k)&&([k]=k),r.documentation=this.documentation(k,i));let w=e[this._getAmfKey(d.aml.vocabularies.apiContract.returns,i)];Array.isArray(w)&&(r.responses=w.map(j=>this.response(j,i)));let b=e[this._getAmfKey(d.aml.vocabularies.apiContract.callback,i)];Array.isArray(b)&&(r.callbacks=b.map(j=>this.callback(j,i)));let _=e[this._getAmfKey(d.aml.vocabularies.apiContract.server,i)];Array.isArray(_)&&(r.servers=_.map(j=>this.server(j)));let E=e[this._getAmfKey(d.aml.vocabularies.security.security,i)];Array.isArray(E)&&(r.security=E.map(j=>this.securityRequirement(j,i)));let x=e[this._getAmfKey(d.aml.vocabularies.apiContract.tag,i)];Array.isArray(x)&&x.length&&(r.tags=x.map(j=>this.tag(j,i)));let I=e[this._getAmfKey(d.aml.vocabularies.document.extends,i)];return Array.isArray(I)&&I.length&&(r.extends=I.map(j=>this.parametrizedTrait(j,i))),r}tag(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e),name:""},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(r.description=a);let n=e[this._getAmfKey(d.aml.vocabularies.core.documentation,i)];return n&&(Array.isArray(n)&&([n]=n),r.documentation=this.documentation(n,i)),r}tagListItem(e,t){let i=t||e["@context"],r={id:e["@id"],name:""},s=this._getValue(e,d.aml.vocabularies.core.name,i);return s&&typeof s=="string"&&(r.name=s),r}callback(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.apiContract.expression,i);a&&typeof a=="string"&&(r.expression=a);let n=e[this._getAmfKey(d.aml.vocabularies.apiContract.endpoint,i)];return n&&(Array.isArray(n)&&([n]=n),r.endpoint=this.endPoint(n,i)),r}request(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e),required:!1,headers:[],queryParameters:[],payloads:[],uriParameters:[],cookieParameters:[]},s=this._getValue(e,d.aml.vocabularies.core.description,i);s&&typeof s=="string"&&(r.description=s);let a=this._getValue(e,d.aml.vocabularies.apiContract.required,i);a&&typeof a=="boolean"&&(r.required=a);let n=e[this._getAmfKey(d.aml.vocabularies.apiContract.queryString,i)];n&&(Array.isArray(n)&&([n]=n),r.queryString=this.unknownShape(n,void 0,i));let l=this[he](e,d.aml.vocabularies.apiContract.header,i);Array.isArray(l)&&l.length&&(r.headers=l.map(h=>this.parameter(h,i)));let c=this[he](e,d.aml.vocabularies.apiContract.parameter,i);Array.isArray(c)&&c.length&&(r.queryParameters=c.map(h=>this.parameter(h,i)));let p=this[he](e,d.aml.vocabularies.apiContract.uriParameter,i);Array.isArray(p)&&p.length&&(r.uriParameters=p.map(h=>this.parameter(h,i)));let u=this[he](e,d.aml.vocabularies.apiContract.cookieParameter,i);Array.isArray(u)&&u.length&&(r.cookieParameters=u.map(h=>this.parameter(h,i)));let m=this[he](e,d.aml.vocabularies.apiContract.payload,i);return Array.isArray(m)&&m.length&&(r.payloads=m.map(h=>this.payload(h,i))),r}response(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),headers:[],payloads:[],examples:[],links:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(r.description=a);let n=this._getValue(e,d.aml.vocabularies.apiContract.statusCode,i);n&&typeof n=="string"&&(r.statusCode=n);let l=this[he](e,d.aml.vocabularies.apiContract.header,i);Array.isArray(l)&&l.length&&(r.headers=l.map(m=>this.parameter(m,i)));let c=this[he](e,d.aml.vocabularies.apiContract.payload,i);Array.isArray(c)&&c.length&&(r.payloads=c.map(m=>this.payload(m,i)));let p=e[this._getAmfKey(d.aml.vocabularies.apiContract.examples,i)];Array.isArray(p)&&p.length&&(r.examples=p.map(m=>this.example(m,i)));let u=e[this._getAmfKey(d.aml.vocabularies.apiContract.link,i)];return Array.isArray(u)&&u.length&&(r.links=u.map(m=>this.templatedLink(m,i))),r}payload(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),examples:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.mediaType,i);a&&typeof a=="string"&&(r.mediaType=a);let n=e[this._getAmfKey(d.aml.vocabularies.shapes.schema,i)];n&&(Array.isArray(n)&&([n]=n),r.schema=this.unknownShape(n,{trackedId:r.id},i));let l=e[this._getAmfKey(d.aml.vocabularies.apiContract.examples,i)];return Array.isArray(l)&&l.length&&(r.examples=l.map(c=>this.example(c,i))),r}templatedLink(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),mapping:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(r.description=a);let n=this._getValue(e,d.aml.vocabularies.apiContract.operationId,i);n&&typeof n=="string"&&(r.operationId=n);let l=e[this._getAmfKey(d.aml.vocabularies.apiContract.server,i)];l&&(Array.isArray(l)&&([l]=l),r.server=this.server(l,i));let c=e[this._getAmfKey(d.aml.vocabularies.apiContract.mapping,i)];return c&&(c&&!Array.isArray(c)&&(c=[c]),c&&(r.mapping=c.map(p=>this.iriTemplateMapping(p,i)))),r}iriTemplateMapping(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.apiContract.templateVariable,i);s&&typeof s=="string"&&(r.templateVariable=s);let a=this._getValue(e,d.aml.vocabularies.apiContract.linkExpression,i);return a&&typeof a=="string"&&(r.linkExpression=a),r}parametrizedSecurityScheme(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=e[this._getAmfKey(d.aml.vocabularies.security.scheme,i)];a&&(Array.isArray(a)&&([a]=a),r.scheme=this.securityScheme(a,i));let n=e[this._getAmfKey(d.aml.vocabularies.security.settings,i)];return n&&(Array.isArray(n)&&([n]=n),r.settings=this.securitySettings(n,i)),r}securitySchemeListItem(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),type:""},s=this._getValue(e,d.aml.vocabularies.security.type,i);s&&typeof s=="string"&&(r.type=s);let a=this._getValue(e,d.aml.vocabularies.core.name,i);a&&typeof a=="string"&&(r.name=a);let n=this._getValue(e,d.aml.vocabularies.core.displayName,i);return n&&typeof n=="string"&&(r.displayName=n),r}securityScheme(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),headers:[],queryParameters:[],responses:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.displayName,i);a&&typeof a=="string"&&(r.displayName=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(r.description=n);let l=this._getValue(e,d.aml.vocabularies.security.type,i);l&&typeof l=="string"&&(r.type=l);let c=e[this._getAmfKey(d.aml.vocabularies.security.settings,i)];c&&(Array.isArray(c)&&([c]=c),r.settings=this.securitySettings(c,i));let p=e[this._getAmfKey(d.aml.vocabularies.apiContract.queryString,i)];p&&(Array.isArray(p)&&([p]=p),r.queryString=this.unknownShape(p,void 0,i));let u=this[he](e,d.aml.vocabularies.apiContract.header,i);Array.isArray(u)&&u.length&&(r.headers=u.map(f=>this.parameter(f,i)));let m=this[he](e,d.aml.vocabularies.apiContract.parameter,i);Array.isArray(m)&&m.length&&(r.queryParameters=m.map(f=>this.parameter(f,i)));let h=this[he](e,d.aml.vocabularies.apiContract.response,i);return Array.isArray(h)&&h.length&&(r.responses=h.map(f=>this.response(f,i))),r}securityRequirement(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),schemes:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=e[this._getAmfKey(d.aml.vocabularies.security.schemes,i)];return Array.isArray(a)&&a.length&&(r.schemes=a.map(n=>this.parametrizedSecurityScheme(n,i))),r}securitySettings(e,t){let i=t||e["@context"],r=this.readTypes(e["@type"],i);return r.includes(d.aml.vocabularies.security.OAuth1Settings)?this.oAuth1Settings(e,i):r.includes(d.aml.vocabularies.security.OAuth2Settings)?this.oAuth2Settings(e,i):r.includes(d.aml.vocabularies.security.ApiKeySettings)?this.apiKeySettings(e,i):r.includes(d.aml.vocabularies.security.HttpSettings)?this.httpSettings(e,i):r.includes(d.aml.vocabularies.security.OpenIdConnectSettings)?this.openIdConnectSettings(e,i):this.settings(e,i)}settings(e,t){let i=t||e["@context"];return{id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)}}oAuth1Settings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValue(e,d.aml.vocabularies.security.authorizationUri,i);s&&typeof s=="string"&&(r.authorizationUri=s);let a=this._getValue(e,d.aml.vocabularies.security.requestTokenUri,i);a&&typeof a=="string"&&(r.requestTokenUri=a);let n=this._getValue(e,d.aml.vocabularies.security.tokenCredentialsUri,i);n&&typeof n=="string"&&(r.tokenCredentialsUri=n);let l=this._getValueArray(e,d.aml.vocabularies.security.signature,i);return Array.isArray(l)&&l.length?r.signatures=l:r.signatures=[],r}oAuth2Settings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValueArray(e,d.aml.vocabularies.security.authorizationGrant,i);Array.isArray(s)&&s.length?r.authorizationGrants=s:r.authorizationGrants=[];let a=e[this._getAmfKey(d.aml.vocabularies.security.flows,i)];return Array.isArray(a)&&a.length?r.flows=a.map(n=>this.oAuth2Flow(n,i)):r.flows=[],r}oAuth2Flow(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),scopes:[],sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.security.authorizationUri,i);s&&typeof s=="string"&&(r.authorizationUri=s);let a=this._getValue(e,d.aml.vocabularies.security.accessTokenUri,i);a&&typeof a=="string"&&(r.accessTokenUri=a);let n=this._getValue(e,d.aml.vocabularies.security.flow,i);n&&typeof n=="string"&&(r.flow=n);let l=this._getValue(e,d.aml.vocabularies.security.refreshUri,i);l&&typeof l=="string"&&(r.refreshUri=l);let c=e[this._getAmfKey(d.aml.vocabularies.security.scope,i)];return Array.isArray(c)&&c.length&&(r.scopes=c.map(p=>this.scope(p,i))),r}scope(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);return a&&typeof a=="string"&&(r.description=a),r}apiKeySettings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.security.in,i);return a&&typeof a=="string"&&(r.in=a),r}httpSettings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValue(e,d.aml.vocabularies.security.scheme,i);s&&typeof s=="string"&&(r.scheme=s);let a=this._getValue(e,d.aml.vocabularies.security.bearerFormat,i);return a&&typeof a=="string"&&(r.bearerFormat=a),r}openIdConnectSettings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValue(e,d.aml.vocabularies.security.openIdConnectUrl,i);return s&&typeof s=="string"&&(r.url=s),r}sourceMap(e,t){let i=t||e["@context"],r=e[this._getAmfKey(d.aml.vocabularies.docSourceMaps.sources,i)];if(!r)return;Array.isArray(r)&&([r]=r);let s={id:r["@id"],types:this.readTypes(r["@type"])},a=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.synthesizedField,i)];Array.isArray(a)&&a.length&&(s.synthesizedField=a.map(m=>this.synthesizedField(m,i)));let n=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.lexical,i)];Array.isArray(n)&&n.length&&(s.lexical=n.map(m=>this.synthesizedField(m,i)));let l=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.trackedElement,i)];Array.isArray(l)&&l.length&&(s.trackedElement=this.synthesizedField(l[0],i));let c=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.autoGeneratedName,i)];Array.isArray(c)&&c.length&&(s.autoGeneratedName=c.map(m=>this.synthesizedField(m,i)));let p=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.parsedJsonSchema,i)];Array.isArray(p)&&p.length&&(s.parsedJsonSchema=this.synthesizedField(p[0],i));let u=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.declaredElement,i)];return Array.isArray(u)&&u.length&&(s.declaredElement=this.synthesizedField(u[0],i)),s}synthesizedField(e,t){if(typeof e=="string")return{id:"synthesizedField/generated",value:e};let i={id:e["@id"],value:""},r=this._getValue(e,d.aml.vocabularies.docSourceMaps.element,t);typeof r=="string"&&(i.element=r);let s=this._getValue(e,d.aml.vocabularies.docSourceMaps.value,t);return typeof s=="string"&&(i.value=s),i}parametrizedDeclaration(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),variables:[],customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=e[this._getAmfKey(d.aml.vocabularies.document.variable,i)];Array.isArray(a)&&a.forEach(l=>{r.variables.push(this.variableValue(l,i))});let n=e[this._getAmfKey(d.aml.vocabularies.document.target,i)];if(Array.isArray(n)&&n.length){let[l]=n;r.target=this.abstractDeclaration(l,i)}return r}parametrizedTrait(e,t){let i=t||e["@context"];return this.parametrizedDeclaration(e,i)}parametrizedResourceType(e,t){let i=t||e["@context"];return this.parametrizedDeclaration(e,i)}variableValue(e,t){let i=t||e["@context"],r=this._getValue(e,d.aml.vocabularies.core.name,i),s={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),name:r},a=e[this._getAmfKey(d.aml.vocabularies.document.value,i)];if(Array.isArray(a)){let[n]=a;s.value=this.unknownDataNode(n,i)}return s}abstractDeclaration(e,t){let i=t||e["@context"],r=this._getValue(e,d.aml.vocabularies.core.name,i),s={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),name:r,variables:[]},a=this._getValueArray(e,d.aml.vocabularies.document.variable,i);Array.isArray(a)&&(s.variables=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(s.description=n);let l=e[this._getAmfKey(d.aml.vocabularies.document.dataNode,i)];if(Array.isArray(l)){let[c]=l;s.dataNode=this.unknownDataNode(c,i)}return s}endPointWithOperationsListItem(e,t){let i=this._getValue(e,d.aml.vocabularies.apiContract.path,t),r={id:e["@id"],path:i,operations:[]},s=this[he](e,d.aml.vocabularies.apiContract.supportedOperation,t);Array.isArray(s)&&s.length&&(r.operations=s.map(n=>this.operationListItem(n,t)));let a=this._getValue(e,d.aml.vocabularies.core.name,t);return a&&typeof a=="string"&&(r.name=a),r}operationListItem(e,t){let i={id:e["@id"],method:""},r=this._getValue(e,d.aml.vocabularies.apiContract.method,t);r&&typeof r=="string"&&(i.method=r);let s=this._getValue(e,d.aml.vocabularies.core.name,t);return s&&typeof s=="string"&&(i.name=s),i}};var qt=class o{mime;opts;generator;constructor(e,t={}){this.mime=e,this.opts=Object.freeze({...t}),e.includes("json")?this.generator=new Di(t):e.includes("xml")&&(this.generator=new Ui(t))}static asExample(e,t,i){return new o(t,i).toExample(e)}static asSchema(e,t,i){return new o(t,i).toValue(e)}generate(e){let{generator:t}=this;if(t)return t.generate(e)}toValue(e){return this.generate(e)}toExample(e){let t=this.generate(e);if(t==null)return;let i={id:`${e.id}/generated`,strict:!0,types:[d.aml.vocabularies.apiContract.Example],mediaType:this.mime,renderValue:t,customDomainProperties:[]},r=e;if(Array.isArray(r.examples)&&r.examples.length){let[s]=r.examples;s.value&&(i.value=s.value)}return i}};var li=Object.freeze({processApiLink:"amfprocessapilink",processBuffer:"amfprocessbuffer",processApiFile:"amfprocessapifile",selectApiMainFile:"amfselectapimainfile"});var pd=Object.freeze({processApiLink:async(o,e,t,i,r=globalThis)=>{let s=new CustomEvent(li.processApiLink,{bubbles:!0,composed:!0,cancelable:!0,detail:{url:o,mainFile:e,md5:t,packaging:i}});return r.dispatchEvent(s),s.detail.result},processBuffer:async(o,e,t=globalThis)=>{let i=new CustomEvent(li.processBuffer,{bubbles:!0,composed:!0,cancelable:!0,detail:{buffer:o,opts:e}});return t.dispatchEvent(i),i.detail.result},processApiFile:async(o,e=globalThis)=>{let t=new CustomEvent(li.processApiFile,{bubbles:!0,composed:!0,cancelable:!0,detail:{file:o}});return e.dispatchEvent(t),t.detail.result},selectApiMainFile:async(o,e=globalThis)=>{let t=new CustomEvent(li.selectApiMainFile,{bubbles:!0,composed:!0,cancelable:!0,detail:{candidates:o}});return e.dispatchEvent(t),t.detail.result}});function Li(o,e){return o==="number"?e?.format==="int32"||e?.format==="int64"?d.w3.xmlSchema.integer:d.w3.xmlSchema.number:o==="boolean"?d.aml.vocabularies.shapes.boolean:o==="date"?d.w3.xmlSchema.date:o==="datetime"?d.w3.xmlSchema.dateTime:o==="time"?d.aml.vocabularies.shapes.dateTimeOnly:d.w3.xmlSchema.string}var Ct=Symbol("noValue"),ci=class{increment=0;static noValue=Ct;generate(e,t){return t==="string"?this.generateString(e):t==="number"?this.generateNumber(e):t==="date"?this.generateDate(e):t==="time"?this.generateTime(e):t==="datetime"?this.generateDateTime(e):Ct}generateString(e){switch(e){case"random":return F(8);case"uuid-v4":return crypto.randomUUID();default:return Ct}}generateNumber(e){return e==="incremental"?`${this.increment++}`:Ct}generateDate(e){if(e==="now"){let t=new Date,i=t.getFullYear(),r=`${t.getMonth()+1}`.padStart(2,"0"),s=`${t.getDate()}`.padStart(2,"0");return`${i}-${r}-${s}`}return Ct}generateTime(e){if(e==="now"){let t=new Date,i=`${t.getHours()}`.padStart(2,"0"),r=`${t.getMinutes()}`.padStart(2,"0"),s=`${t.getSeconds()}`.padStart(2,"0");return`${i}:${r}:${s}`}return Ct}generateDateTime(e){if(e==="now"){let t=new Date,i=t.getFullYear(),r=`${t.getMonth()+1}`.padStart(2,"0"),s=`${t.getDate()}`.padStart(2,"0"),a=`${t.getHours()}`.padStart(2,"0"),n=`${t.getMinutes()}`.padStart(2,"0"),l=`${t.getSeconds()}`.padStart(2,"0");return`${i}-${r}-${s}T${a}:${n}:${l}`}return Ct}};var sa="anyOf",ud="allOf",md="oneOf",hd="not",aa="string",Xn="binary",St=class{#e;get valueGenerator(){return this.#e||(this.#e=new ci),this.#e}entity(e,t=new Set){if(t.has(e.key))return this.createRecursiveShape(e);t.add(e.key);let i=Ne.nodeShape(e.key);i.id=e.key,this.updateBaseProperties(e,i),i.properties=[];for(let r of e.listProperties()){let s=r.readBinding("web");if(s&&s.hidden)continue;let a=this.property(r);i.properties.push(a)}for(let r of e.listAssociations()){let s=r.readBinding("web");if(s&&s.hidden)continue;let a=this.associationProperty(r,t);i.properties.push(a)}for(let r of e.listParents()){let s=this.entity(r,t);i.inherits.push(s)}return i}property(e){let{required:t,key:i}=e,r=Ne.propertyShape(i);return r.path=`${d.aml.vocabularies.data.key}${e.info.name}`,t&&(r.minCount=1),r.range=this.getRange(e),this.updateBaseProperties(e,r),r.range.name&&(r.name=r.range.name),r}associationProperty(e,t=new Set){let{required:i,key:r}=e,s=Ne.propertyShape(r);return s.path=`${d.aml.vocabularies.data.key}${e.info.name}`,i&&(s.minCount=1),s.range=this.associationShape(e,t),this.updateBaseProperties(e,s),s}associationShape(e,t=new Set){let i=e.schema;if(!i?.embedded)return this.createLinkedShape(e);let r=this.associationUnion(e,t);if(!r)return;if(Array.isArray(r))return this.createUnionShape(e,r);if((i&&i.unionType||sa)===hd){let a=Ne.anyShape(e.key);return a.id=`not-shape-${e.key}`,a.not=r,a}return e.multiple?this.refactorShapeToArray(e.key,r):r}createLinkedShape(e){let t=Ne.scalarShape(e.key);return t.id=`link-${e.key}`,t.dataType=Li(aa),t}createUnionShape(e,t){let i=Ne.unionShape(e.key);this.updateBaseProperties(e,i),i.anyOf=[];let r=e.schema&&e.schema.unionType||sa;return r===sa?i.anyOf=t:r===ud?i.and=t:r===md?i.xone=t:i.not=t[0],e.multiple?this.refactorShapeToArray(e.key,i):i}associationUnion(e,t=new Set){let i=[];for(let r of e.listTargets())i.push(this.entity(r,t));if(i.length)return i.length>1?i:i[0]}getRange(e){let t=e.readBinding("web"),i;e.schema&&(i=e.schema);let{multiple:r,type:s}=e;return r?this.createArrayShape(e,i,t):s===Xn?this.createFileShape(e,t):this.createScalarShape(e,i,t)}setShapeSchema(e,t,i,r,s){if(i.defaultValue){let{type:a}=i.defaultValue,{value:n}=i.defaultValue;if(a==="function"){let l=this.valueGenerator.generate(n,e.type);if(l!==ci.noValue){let c=et.scalar(l,a);t.defaultValue=c.toJSON()}}else{let l=et.scalar(n,r);t.defaultValue=l.toJSON()}}Array.isArray(i.enum)&&(t.values=i.enum.map(a=>et.scalar(a,r).toJSON())),Array.isArray(i.examples)&&(s?t.examples=this.createArrayExamples(i.examples,r):t.examples=this.createExamples(i.examples,r))}createArrayShape(e,t,i){let r=Ne.arrayShape(e.key),{type:s}=e;if(s===Xn?r.items=this.createFileShape(e,i):r.items=this.createScalarShape(e,void 0,i),t){let a=r.items.dataType;this.setShapeSchema(e,r,t,a,e.multiple)}return r}createScalarShape(e,t,i){let r=Ne.scalarShape(e.key);return this.updateBaseProperties(e,r),this.setScalarCommonProperties(r,e,i),r.dataType||(r.dataType=Li(e.type,i)),t&&this.setShapeSchema(e,r,t,r.dataType,e.multiple),r}createExamples(e,t){let i=[];for(let r of e){let s={id:F(),customDomainProperties:[],strict:!0,types:[...ji.IAmfExampleTypes],structuredValue:et.scalar(r,t).toJSON()};i.push(s)}return i}createArrayExamples(e,t){let i={id:F(),customDomainProperties:[],strict:!0,types:[...ji.IAmfExampleTypes]},r=new et("array");for(let s of e){let a=et.scalar(s,t);r.addMember(a)}return i.structuredValue=r.toJSON(),[i]}createFileShape(e,t){let i=Ne.fileShape(e.key);return this.updateBaseProperties(e,i),t&&(Array.isArray(t.fileTypes)&&(i.fileTypes=t.fileTypes),this.setScalarCommonProperties(i,e,t)),i}setScalarCommonProperties(e,t,i){i?.name&&(e.name=i.name),i?.xml&&(e.xmlSerialization=i.xml);let{schema:r,type:s}=t;if(r&&(r.pattern&&(e.pattern=r.pattern),typeof r.multipleOf=="number"&&(e.multipleOf=r.multipleOf),typeof r.minimum=="number"&&(s===aa?e.minLength=r.minimum:e.minimum=r.minimum),typeof r.maximum=="number"&&(s===aa?e.maxLength=r.maximum:e.maximum=r.maximum),typeof r.exclusiveMinimum=="boolean"&&(e.exclusiveMinimum=r.exclusiveMinimum),typeof r.exclusiveMaximum=="boolean"&&(e.exclusiveMaximum=r.exclusiveMaximum)),i?.format)switch(i.format){case"double":e.format=d.w3.xmlSchema.double;break;case"float":e.format=d.w3.xmlSchema.float;break;case"int32":e.format=d.w3.xmlSchema.integer;break;case"int64":e.format=d.w3.xmlSchema.integer;break}typeof t.readOnly=="boolean"&&(e.readOnly=t.readOnly),typeof t.writeOnly=="boolean"&&(e.writeOnly=t.writeOnly);let a=r?.examples&&r.examples.length>0,n=r?.defaultValue?.value!==void 0;if(t.required&&!t.readOnly&&!a&&!n){let l="";t.type==="number"?l=0:t.type==="boolean"&&(l=!1);let c=("dataType"in e?e.dataType:void 0)||Li(t.type,i);e.examples=this.createExamples([String(l)],c)}}updateBaseProperties(e,t){t.name=e.info.name,t.displayName=e.info.displayName,t.description=e.info.description,(e.kind===ne||e.kind===H)&&(t.deprecated=e.deprecated)}createRecursiveShape(e){return Ne.recursiveShape(e.key,e.key)}refactorShapeToArray(e,t){let i=Ne.arrayShape(e);return i.items=t,i}};var ze=class{root;get domain(){return this.root}#e;get key(){return this.#e}#t;get namespace(){return this.#t}constructor(e,t){this.root=e,this.#e=t,this.#t=e.key}};var na=["string","number","boolean","date","datetime","time","binary","json"],Mi;(function(o){o.string="string",o.number="number",o.boolean="boolean",o.date="date",o.datetime="datetime",o.time="time",o.file="binary",o.json="json"})(Mi||(Mi={}));var Zn=["required","multiple","primary","index","unique","search","readOnly","writeOnly","deprecated"],Qn=["required","multiple"],eo=["float","double","int32","int64"];var Jt=class o extends ze{kind;info;required;multiple;primary;unique;index;search;readOnly;writeOnly;deprecated;tags=[];semantics=[];type="string";jsonSchema;jsonIndex;schema;bindings=[];static createSchema(e={}){let{key:t=F(),multiple:i,required:r,type:s=Mi.string,index:a,search:n,primary:l,unique:c,readOnly:p,writeOnly:u,tags:m,semantics:h,deprecated:f,schema:k,bindings:w,jsonSchema:b,jsonIndex:_}=e;if(typeof s=="string"&&!na.includes(s))throw new Error(`Invalid data property type ${s}`);let E=ee.fromJSON(e.info,{name:"new_property"}).toJSON(),x={kind:ne,key:t,info:E,type:s};return b&&(x.jsonSchema=structuredClone(b)),_&&(x.jsonIndex=structuredClone(_)),typeof i=="boolean"&&(x.multiple=i),typeof r=="boolean"&&(x.required=r),typeof a=="boolean"&&(x.index=a),typeof n=="boolean"&&(x.search=n),typeof l=="boolean"&&(x.primary=l),typeof c=="boolean"&&(x.unique=c),typeof p=="boolean"&&(x.readOnly=p),typeof u=="boolean"&&(x.writeOnly=u),typeof f=="boolean"&&(x.deprecated=f),Array.isArray(m)&&(x.tags=[...m]),Array.isArray(h)&&(x.semantics=[...h]),k&&(x.schema=structuredClone(k)),Array.isArray(w)?x.bindings=w.map(I=>structuredClone(I)):x.bindings=[],x}parent;constructor(e,t,i={}){let r=o.createSchema(i);super(e,r.key),this.parent=t,this.kind=ne,this.info=new ee(r.info),this.type=r.type,typeof r.multiple=="boolean"&&(this.multiple=r.multiple),typeof r.required=="boolean"&&(this.required=r.required),typeof r.index=="boolean"&&(this.index=r.index),typeof r.search=="boolean"&&(this.search=r.search),typeof r.deprecated=="boolean"&&(this.deprecated=r.deprecated),typeof r.primary=="boolean"&&(this.primary=r.primary),typeof r.unique=="boolean"&&(this.unique=r.unique),typeof r.readOnly=="boolean"&&(this.readOnly=r.readOnly),typeof r.writeOnly=="boolean"&&(this.writeOnly=r.writeOnly),Array.isArray(r.tags)?this.tags=[...r.tags]:this.tags=[],Array.isArray(r.semantics)?this.semantics=[...r.semantics]:this.semantics=[],r.schema&&(this.schema=structuredClone(r.schema)),r.jsonSchema&&(this.jsonSchema=structuredClone(r.jsonSchema)),r.jsonIndex&&(this.jsonIndex=structuredClone(r.jsonIndex)),Array.isArray(r.bindings)?this.bindings=r.bindings.map(s=>structuredClone(s)):this.bindings=[]}static validate(e,t={}){if(!e||typeof e!="object"&&e!==null)return!1;let i=e;return!(t.strict&&i.kind!==ne)}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON(),type:this.type||Mi.string};return typeof this.index=="boolean"&&(e.index=this.index),typeof this.search=="boolean"&&(e.search=this.search),typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),typeof this.primary=="boolean"&&(e.primary=this.primary),typeof this.unique=="boolean"&&(e.unique=this.unique),typeof this.multiple=="boolean"&&(e.multiple=this.multiple),typeof this.required=="boolean"&&(e.required=this.required),typeof this.readOnly=="boolean"&&(e.readOnly=this.readOnly),typeof this.writeOnly=="boolean"&&(e.writeOnly=this.writeOnly),Array.isArray(this.tags)&&this.tags.length&&(e.tags=[...this.tags]),Array.isArray(this.semantics)&&this.semantics.length&&(e.semantics=this.semantics.map(t=>structuredClone(t))),this.schema&&(e.schema=structuredClone(this.schema)),this.jsonSchema&&(e.jsonSchema=structuredClone(this.jsonSchema)),this.jsonIndex&&(e.jsonIndex=structuredClone(this.jsonIndex)),Array.isArray(this.bindings)&&this.bindings.length&&(e.bindings=this.bindings.map(t=>structuredClone(t))),e}remove(){this.getParentInstance()?.removeProperty(this.key)}getParentInstance(){return this.root.graph.node(this.parent)}static isValidType(e){return typeof e!="string"?!1:na.includes(e)}static isValidAttribute(e){return typeof e!="string"?!1:Zn.includes(e)}static isValidFormat(e){return e===void 0?!0:typeof e!="string"?!1:!!eo.includes(e)}ensureSchema(){return this.schema||(this.schema={}),this.schema}getWebBinding(){let e=this.bindings.find(t=>t.type==="web");return e||(e={type:"web",schema:{}},this.bindings.push(e)),e.schema}readWebBinding(){return this.bindings.find(t=>t.type==="web")?.schema}getExposedName(){let e=this.readWebBinding()?.name||this.info.name;if(!e)throw new g(`Property ${this.key} has no exposed name defined`,{code:"E_MISSING_EXPOSED_NAME",status:500});return e}readBinding(e){return this.bindings.find(i=>i.type===e)?.schema||void 0}toApiShape(){return new St().property(this)}toExample(e,t={}){let i=this.toApiShape();return i.range?new qt(e,{renderExamples:t.renderExamples??!0,renderMocked:t.renderMocked??!0,renderOptional:t.renderOptional??!0,selectedUnions:t.selectedUnions}).generate(i):void 0}addSemantic(e){this.root.ensureWritable();let t=Xe[e.id];if(!wr(t))throw new Error(`Invalid semantic type: ${e.id}. Expected a property semantic.`);let i=this.semantics.findIndex(r=>r.id===e.id);i>=0?this.semantics[i]=e:this.semantics.push(e)}removeSemantic(e){this.root.ensureWritable();let t=this.semantics.findIndex(i=>i.id===e);t>=0&&this.semantics.splice(t,1)}hasSemantic(e){return this.semantics.some(t=>t.id===e)}getSemantic(e){return this.semantics.find(t=>t.id===e)}duplicate(){let e=this.getParentInstance();if(!e)throw new Error(`Cannot duplicate property ${this.key} as it has no parent entity.`);let t=e.fields.findIndex(c=>c.key===this.key);if(t===-1)throw new Error(`Cannot duplicate property ${this.key} as it does not exist on the parent entity fields list.`);let i=this.info.name||"field",r=e.generateUniqueName(i),s=this.toJSON();delete s.key,delete s.primary,s.info?s.info.name=r:s.info={name:r};let a=e.addProperty(s),n=e.fields.length-1,l=e.fields[n];return e.fields.splice(n,1),e.fields.splice(t+1,0,l),a}};var zi=class extends g{static code="E_REMOVE_PROPERTY";static status=500;static message="Error removing a data property.";static help="Make sure the property exists and can be removed."};var Gt=class o extends ze{kind;info;required;multiple;schema;bindings;parent;targets;semantics=[];onDelete;readOnly;static createSchema(e={}){let{key:t=F(),semantics:i=[]}=e,r=ee.fromJSON(e.info,{name:"new_association"}).toJSON(),s={kind:fe,key:t,info:r};return Array.isArray(i)&&(s.semantics=[...i]),e.onDelete&&(s.onDelete=e.onDelete),typeof e.readOnly=="boolean"&&(s.readOnly=e.readOnly),e.schema&&(s.schema=structuredClone(e.schema)),typeof e.multiple=="boolean"&&(s.multiple=e.multiple),typeof e.required=="boolean"&&(s.required=e.required),Array.isArray(e.bindings)&&(s.bindings=e.bindings.map(a=>structuredClone(a))),Array.isArray(e.targets)&&(s.targets=e.targets.map(a=>({...a}))),s}constructor(e,t,i){let r=o.createSchema(i);super(e,r.key),this.parent=t,this.kind=fe,this.info=new ee(r.info),r.schema&&(this.schema=structuredClone(r.schema)),typeof r.multiple=="boolean"&&(this.multiple=r.multiple),typeof r.required=="boolean"&&(this.required=r.required),Array.isArray(r.bindings)?this.bindings=r.bindings.map(s=>structuredClone(s)):this.bindings=[],Array.isArray(r.targets)?this.targets=r.targets.map(s=>({...s})):this.targets=[],Array.isArray(r.semantics)?this.semantics=r.semantics.map(s=>structuredClone(s)):this.semantics=[],r.onDelete&&(this.onDelete=r.onDelete),typeof r.readOnly=="boolean"&&(this.readOnly=r.readOnly)}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON()};return this.schema&&(e.schema=structuredClone(this.schema)),typeof this.multiple=="boolean"&&(e.multiple=this.multiple),typeof this.required=="boolean"&&(e.required=this.required),Array.isArray(this.bindings)&&this.bindings.length&&(e.bindings=this.bindings.map(t=>structuredClone(t))),Array.isArray(this.targets)&&this.targets.length&&(e.targets=this.targets.map(t=>({...t}))),Array.isArray(this.semantics)&&this.semantics.length&&(e.semantics=this.semantics.map(t=>structuredClone(t))),this.onDelete&&(e.onDelete=this.onDelete),typeof this.readOnly=="boolean"&&this.readOnly&&(e.readOnly=this.readOnly),e}getParentInstance(){return this.root.graph.node(this.parent)}remove(){this.getParentInstance()?.removeAssociation(this.key)}ensureSchema(){return this.schema||(this.schema={}),this.schema}static isValidAttribute(e){return typeof e!="string"?!1:Qn.includes(e)}getWebBinding(){let e=this.bindings.find(t=>t.type==="web");return e||(e={type:"web",schema:{}},this.bindings.push(e)),e.schema}readWebBinding(){return this.bindings?.find(t=>t.type==="web")?.schema}getExposedName(){let e=this.readWebBinding()?.name||this.info.name;if(!e)throw new g(`Association ${this.key} has no exposed name defined`,{code:"E_MISSING_EXPOSED_NAME",status:500});return e}readBinding(e){return this.bindings.find(i=>i.type===e)?.schema||void 0}addTarget(e,t){this.root.ensureWritable();let i;if(typeof e=="string"?i=e:(i=e.key,e.domain.key!==this.root.key&&(t=e.domain.key)),this.targets.some(n=>n.key===i&&n.domain===t)){let n=`Target ${i} already exists.`;throw new Error(n)}if(t&&!this.root.dependencies.has(t))throw new Error(`Foreign namespace "${t}" does not exist.`);let r={key:i};t&&(r.domain=t),this.targets.push(r);let s=t?`${t}:${i}`:i,a={type:"association"};t&&(a.domain=t,a.foreign=!0),this.root.graph.setEdge(this.key,s,a)}removeTarget(e){this.root.ensureWritable();let t;typeof e=="string"?t=e:t=e.key;let i=this.targets.findIndex(r=>r.key===t);i>=0&&this.targets.splice(i,1),this.root.graph.removeEdge(this.key,t)}*listTargets(){for(let e of this.targets){let{key:t,domain:i}=e,r=i?`${i}:${t}`:t,s=this.root.graph.node(r);s&&(yield s)}}toApiShape(){return new St().associationProperty(this)}addSemantic(e){this.root.ensureWritable();let t=Xe[e.id];if(!La(t))throw new Error(`Invalid semantic type: ${e.id}. Expected an association semantic.`);let i=this.semantics.findIndex(r=>r.id===e.id);i>=0?this.semantics[i]=e:this.semantics.push(e)}removeSemantic(e){this.root.ensureWritable();let t=this.semantics.findIndex(i=>i.id===e);t>=0&&this.semantics.splice(t,1)}hasSemantic(e){return this.semantics.some(t=>t.id===e)}getSemantic(e){return this.semantics.find(t=>t.id===e)}duplicate(){let e=this.getParentInstance();if(!e)throw new Error(`Cannot duplicate association ${this.key} as it has no parent entity.`);let t=e.fields.findIndex(c=>c.key===this.key);if(t===-1)throw new Error(`Cannot duplicate association ${this.key} as it does not exist on the parent entity fields list.`);let i=this.info.name||"field",r=e.generateUniqueName(i),s=this.toJSON();delete s.key,delete s.targets,s.info?s.info.name=r:s.info={name:r};let a=e.addAssociation(s);for(let c of this.targets)a.addTarget(c.key,c.domain);let n=e.fields.length-1,l=e.fields[n];return e.fields.splice(n,1),e.fields.splice(t+1,0,l),a}};var Bt=class extends Error{messages;status=422;code="E_VALIDATION_ERROR";constructor(e,t){let i=t?.message||"Validation failure";super(i,t),this.messages=e;let r=this.constructor;"captureStackTrace"in Error&&Error.captureStackTrace(this,r)}get[Symbol.toStringTag](){return this.constructor.name}toString(){return`${this.name} [${this.code}]: ${this.message}`}};function je(o,e){if(!o.hasNode(e))return;let t=o.node(e);if(t){if(t.kind===fe){o.removeNode(e);return}for(let i of o.children(e))je(o,i);for(let i of o.outEdges(e)){let r=o.edge(i);r&&(r.type==="association"||r.type==="property")&&je(o,i.w)}o.removeNode(e)}}var to=o=>{let e=o.trim();return e=e.match(/[A-Z]{2,}(?=[ A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(t=>t.toLowerCase()).join("_")||"",e};import io from"dompurify";var oa;function gd(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}if(gd()){let{JSDOM:o}=await import("jsdom"),{window:e}=new o("<!DOCTYPE html>");oa=io(e)}else oa=io;var ro=oa;function yd(o){return ro.sanitize(o)}function so(o,e="untitled_column"){let t=yd(o);return t=to(t),t=t.replace(/[\s-]+/g,"_"),t=t.replace(/[^a-z0-9_]/g,""),t=t.replace(/^_+|_+$/g,""),t||e}function ao(o,e,t="untitled_table"){let i=so(o,t);return`${so(e.slice(0,8))}_${i}`}var Wt=class o extends ze{kind;#e;#t;#r;#i;info;tags;semantics=[];fields;deprecated;static createSchema(e={}){let{key:t=F(),tags:i,semantics:r,fields:s,deprecated:a}=e,n=ee.fromJSON(e.info,{name:"new_entity"}).toJSON(),l={kind:H,key:t,info:n};return Array.isArray(i)&&(l.tags=[...i]),Array.isArray(r)&&(l.semantics=[...r]),Array.isArray(s)&&(l.fields=[...s]),typeof a=="boolean"&&(l.deprecated=a),l}constructor(e,t){let i=o.createSchema(t);super(e,i.key),this.kind=H,this.info=new ee(i.info),Array.isArray(i.tags)?this.tags=[...i.tags]:this.tags=[],Array.isArray(i.semantics)?this.semantics=i.semantics.map(r=>structuredClone(r)):this.semantics=[],Array.isArray(i.fields)?this.fields=[...i.fields]:this.fields=[],typeof i.deprecated=="boolean"&&(this.deprecated=i.deprecated)}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON()};return Array.isArray(this.fields)&&this.fields.length&&(e.fields=[...this.fields]),Array.isArray(this.semantics)&&this.semantics.length&&(e.semantics=this.semantics.map(t=>structuredClone(t))),Array.isArray(this.tags)&&this.tags.length&&(e.tags=[...this.tags]),typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),e}getParentInstance(){let e=this.root.graph.parent(this.key);if(e)return this.root.graph.node(e)}getExposedName(){let e=this.info.name;if(!e)throw new g(`Entity ${this.key} has no exposed name defined`,{code:"E_MISSING_EXPOSED_NAME",status:500});return e}getDatabaseTableName(){return ao(this.getExposedName(),this.namespace)}addProperty(e){if(this.root.ensureWritable(),e&&e.key&&this.root.graph.hasNode(e.key))throw new Error(`Trying to add a property ${e.key}, but it already exists`);let t=new Jt(this.root,this.key,e);return this.root.graph.setNode(t.key,t),this.root.graph.setEdge(this.key,t.key,{type:"property"}),this.fields.push({type:"property",key:t.key}),t}removeProperty(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new zi(`Trying to remove the ${e} property, but it doesn't exist`);if(this.root.graph.node(e).getParentInstance()!==this)throw new zi(`Trying to remove the ${e} property, but it doesn't belong to this entity`);je(this.root.graph,e),this.removeField(e)}get properties(){return this.listProperties()}*listProperties(){for(let{key:e,type:t}of this.fields){if(t!=="property")continue;let i=this.root.graph.node(e);!i||i.kind!==ne||(yield i)}}withInheritedProperties(){if(this.root.readOnly&&this.#e)return this.#e.values();let e=new Map,t=this.listAllParents("up");for(let i of t)for(let r of i.properties)r.info.name&&e.set(r.info.name,r);for(let i of this.properties)i.info.name&&e.set(i.info.name,i);return this.root.readOnly&&(this.#e=Array.from(e.values())),e.values()}hasProperties(){return this.fields.some(e=>e.type==="property")}get parents(){return this.listParents()}*listParents(){for(let e of this.root.graph.outEdges(this.key)){let t=this.root.graph.edge(e);if(!t||t.type!=="parent")continue;let i=this.root.graph.node(e.w);i&&(yield i)}}listAllParents(e="up"){if(this.root.readOnly&&this.#t?.[e])return this.#t[e];let t=new Set,i=[],r=[...this.listParents()],s=0;for(;s<r.length;){let a=r[s++];t.has(a.key)||(t.add(a.key),i.push(a),r.push(...a.listParents()))}return e==="down"&&i.reverse(),this.root.readOnly&&(this.#t||(this.#t={}),this.#t[e]=i),i}addParent(e,t){this.root.ensureWritable();let i=this.domain.buildReferenceKey(e,t);if(i===this.key){let s="Entity cannot be a parent of itself";throw new Bt([{field:"parents",message:s,rule:"circular"}],{message:s})}let{graph:r}=this.root;if(!r.hasNode(i)){let s=`Entity with key "${e}" not found`;throw t&&(s+=` in domain "${t}"`),new Bt([{field:"parents",message:s,rule:"required"}],{message:s})}if(this.hasCircularParent(i)){let s=`Circular inheritance detected. Cannot add ${e} as a parent`;throw new Bt([{field:"parents",message:s,rule:"circular"}],{message:s})}if(r.outEdges(this.key,i).next().value){let s=`Parent ${e} already exists`;throw new Bt([{field:"parents",message:s,rule:"unique"}],{message:s})}return t?r.setEdge(this.key,i,{type:"parent",domain:t,foreign:!0}):r.setEdge(this.key,i,{type:"parent"}),this}removeParent(e,t){this.root.ensureWritable();let{graph:i}=this.root,r=this.domain.buildReferenceKey(e,t);if(!i.hasEdge(this.key,r)){let a=`Trying to remove a parent ${e} from ${this.key}, but it doesn't exist`;throw t&&(a=`Trying to remove a foreign parent ${e} from domain "${t}" from ${this.key}, but it doesn't exist`),new Error(a)}let s=i.edge(this.key,r);if(!s||s.type!=="parent"){let a=`Edge between ${this.key} and ${e} exists but is not a parent relationship`;throw t&&(a=`Edge between ${this.key} and ${e} in domain "${t}" exists but is not a parent relationship`),new Error(a)}return i.removeEdge(this.key,r),this}hasParents(){for(let e of this.root.graph.outEdges(this.key))if(this.root.graph.edge(e)?.type==="parent")return!0;return!1}hasCircularParent(e){let{graph:t}=this.root;for(let r of t.outEdges(e,this.key))if(t.edge(r)?.type==="parent")return!0;let i=t.node(e);for(;i;){if(i.key===this.key)return!0;let r=[...i.listParents()];if(r.length===0)break;i=r[0]}return!1}breadcrumbs(){let e=[];e.push({key:this.key,name:this.info.getLabel("Unnamed entity"),kind:H});let t=this.getParentInstance();if(t){e.push({key:t.key,kind:t.kind,name:t.info.getLabel("Unnamed model")});let i=t.getParentInstance();for(;i&&i!==this.root;)e.push({key:i.key,kind:i.kind,name:i.info.getLabel("Unnamed namespace")}),i=i.getParentInstance()}return e.push({key:this.root.key,name:this.root.info.getLabel("Unnamed data domain"),kind:this.root.kind}),e.reverse()}addAssociation(e={}){this.root.ensureWritable();let{graph:t}=this.root,i={...e},r=i.targets;delete i.targets;let s=Array.isArray(r)&&r.length;if(s){for(let n of r)if(n.domain&&n.key){let l=`${n.domain}:${n.key}`;if(!t.hasNode(l))throw new Error(`Foreign entity ${l} not found`)}else if(n.key&&!t.hasNode(n.key))throw new Error(`Target entity ${n.key} not found`)}let a=new Gt(this.root,this.key,i);if(t.setNode(a.key,a),t.setEdge(this.key,a.key,{type:"association"}),s)for(let n of r)a.addTarget(n.key,n.domain);return this.fields.push({type:"association",key:a.key}),a}removeAssociation(e){if(this.root.ensureWritable(),!this.root.graph.hasEdge(this.key,e))throw new Error(`Unable to find a connection between this entity and the ${e} association`);let t=this.root.graph.edge(this.key,e);if(!t||t.type!=="association")throw new Error(`Association ${e} does not exist`);je(this.root.graph,e),this.removeField(e)}get associations(){return this.listAssociations()}*listAssociations(){for(let{key:e,type:t}of this.fields){if(t!=="association")continue;let i=this.root.graph.node(e);!i||i.kind!==fe||(yield i)}}hasAssociations(){return this.fields.some(e=>e.type==="association")}*listFields(){for(let{key:e}of this.fields){let t=this.root.graph.node(e);t&&(t.kind===fe||t.kind===ne)&&(yield t)}}hasFields(){return this.fields.length>0}removeField(e){this.fields=this.fields.filter(t=>t.key!==e)}toApiShape(){return new St().entity(this)}toExample(e,t={}){let i=this.toApiShape();return new qt(e,{renderExamples:t.renderExamples??!0,renderMocked:t.renderMocked??!0,renderOptional:t.renderOptional??!0,selectedUnions:t.selectedUnions}).generate(i)}isChildOf(e){if(this.key===e)return!1;let t=this.getParentInstance();return t?t.key===e?!0:t.isChildOf(e):!1}primaryKey(){for(let t of this.properties)if(t.primary)return t;let e;for(let t of this.listParents()){let i=t.primaryKey();i&&(e=i)}return e}addSemantic(e){this.root.ensureWritable();let t=Xe[e.id];if(!Ua(t))throw new Error(`Invalid semantic type: ${e.id}. Expected an entity semantic.`);let i=this.semantics.findIndex(r=>r.id===e.id);i>=0?this.semantics[i]=e:this.semantics.push(e)}removeSemantic(e){this.root.ensureWritable();let t=this.semantics.findIndex(i=>i.id===e);t>=0&&this.semantics.splice(t,1)}hasSemantic(e){return this.semantics.some(t=>t.id===e)}getSemantic(e){return this.semantics.find(t=>t.id===e)}withInheritedAssociations(){if(this.root.readOnly&&this.#r)return this.#r.values();let e=new Map,t=this.listAllParents("up");for(let i of t)for(let r of i.associations)r.info.name&&e.set(r.info.name,r);for(let i of this.associations)i.info.name&&e.set(i.info.name,i);return this.root.readOnly&&(this.#r=Array.from(e.values())),e.values()}listAllSemantics(){if(this.root.readOnly&&this.#i)return this.#i;let e=new Map,t=this.listAllParents("up");for(let r of t)for(let s of r.semantics)e.set(s.id,s);for(let r of this.semantics)e.set(r.id,r);let i=Array.from(e.values());return this.root.readOnly&&(this.#i=i),i}generateUniqueName(e){let t=new Set;for(let s of this.listFields())s.info.name&&t.add(s.info.name);let i=2,r=`${e}_copy`;for(;t.has(r);)r=`${e}_copy_${i}`,i++;return r}};var di=class extends g{static code="E_REMOVE_ENTITY";static status=500;static message="Error removing a data entity.";static help="Make sure the entity exists and can be removed."};var $e=class extends g{static code="E_ATTACH";static status=500;static message="Error attaching the object.";static help="Make sure you are attaching the right object."};var at=class extends g{static code="E_DETACH";static status=500;static message="Error detaching the object.";static help="Make sure you are detaching the right object."};var _t=class o extends ze{kind;info;fields;deprecated;static createSchema(e={}){let{key:t=F(),fields:i,deprecated:r}=e,s=ee.fromJSON(e.info,{name:"New model"}).toJSON(),a={kind:de,key:t,info:s};return Array.isArray(i)&&(a.fields=[...i]),typeof r=="boolean"&&(a.deprecated=r),a}constructor(e,t){let i=o.createSchema(t);super(e,i.key),this.kind=de,this.info=new ee(i.info),Array.isArray(i.fields)?this.fields=[...i.fields]:this.fields=[],typeof i.deprecated=="boolean"?this.deprecated=i.deprecated:this.deprecated=void 0}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON()};return Array.isArray(this.fields)&&this.fields.length&&(e.fields=[...this.fields]),typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),e}getParentInstance(){let e=this.root.graph.parent(this.key);return e?this.root.graph.node(e):this.root}addEntity(e){if(this.root.ensureWritable(),e&&e.key&&this.root.graph.hasNode(e.key))throw new Error(`Entity with key ${e?.key} already exists`);let t=new Wt(this.root,e);return this.root.graph.setNode(t.key,t),this.root.graph.setParent(t.key,this.key),this.fields.push({key:t.key,type:"entity"}),t}removeEntity(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new di(`Trying to remove the ${e} entity, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==H)throw new di(`Trying to remove the ${e} entity, but it is not an entity`);if(t.getParentInstance()!==this)throw new di(`Trying to remove the ${e} entity, but it is not a child of this model`);je(this.root.graph,e),this.removeField(e)}attachEntity(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new $e(`Trying to attach the ${e} entity, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==H)throw new $e(`Trying to attach the ${e} entity, but it is not a entity`);if(t.domain.key!==this.root.key)throw new $e(`Trying to attach the ${e} entity, but it is not in the same domain`);let i=t.getParentInstance();if(i===this)throw new $e(`Trying to attach the ${e} entity, but it is already a child of this model`);if(i.detachEntity(e),this.fields.some(s=>s.key===e)||this.fields.push({type:"entity",key:e}),this.root.graph.setParent(e,this.key),this.root.graph.parent(e)!==this.key)throw new $e(`Trying to attach the ${e} entity, but it is not a child of this model`);return this}detachEntity(e){this.root.ensureWritable();let t=this.fields.findIndex(r=>r.key===e);if(t===-1)throw new at(`Trying to detach the ${e} entity, but it doesn't exist`);let i=this.root.graph.node(e);if(!i||i.kind!==H)throw new at(`Trying to detach the ${e} entity, but it is not an entity`);if(i.getParentInstance()!==this)throw new at(`Trying to detach the ${e} entity, but it is not a child of this model`);return this.fields.splice(t,1),this.root.graph.setParent(e),this}*listEntities(){for(let{key:e,type:t}of this.fields){if(t!=="entity")continue;let i=this.root.graph.node(e);!i||i.kind!==H||(yield i)}}hasEntities(){return this.fields.some(e=>e.type==="entity")}breadcrumbs(){let e=[];e.push({key:this.key,name:this.info.getLabel("Unnamed model"),kind:de});let t=this.getParentInstance();for(;t&&t!==this.root;)e.push({key:t.key,kind:t.kind,name:t.info.getLabel("Unnamed namespace")}),t=t.getParentInstance();return e.push({key:this.root.key,name:this.root.info.getLabel("Unnamed data domain"),kind:this.root.kind}),e.reverse()}hasFields(){return this.fields.length>0}removeField(e){this.fields=this.fields.filter(t=>t.key!==e)}isChildOf(e){if(this.key===e)return!1;let t=this.getParentInstance();return t?t.key===e?!0:t===this.root?!1:t.isChildOf(e):!1}};var Ht=class extends g{static code="E_REMOVE_NAMESPACE";static status=500;static message="Error removing a domain namespace.";static help="Make sure the namespace exists and can be removed."};var Vi=class extends g{static code="E_REMOVE_MODEL";static status=500;static message="Error removing a domain model.";static help="Make sure the model exists and can be removed."};var Yt=class o extends ze{kind;info;fields;deprecated;static createSchema(e={}){let{key:t=F(),fields:i,deprecated:r}=e,s=ee.fromJSON(e.info,{name:"New namespace"}).toJSON(),a={kind:ye,key:t,info:s};return Array.isArray(i)&&(a.fields=[...i]),typeof r=="boolean"&&(a.deprecated=r),a}constructor(e,t){let i=o.createSchema(t);super(e,i.key),this.kind=ye,this.info=new ee(i.info),Array.isArray(i.fields)?this.fields=[...i.fields]:this.fields=[],typeof i.deprecated=="boolean"?this.deprecated=i.deprecated:this.deprecated=void 0}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON()};return Array.isArray(this.fields)&&this.fields.length&&(e.fields=[...this.fields]),typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),e}addNamespace(e){if(this.root.ensureWritable(),e&&e.key&&this.root.graph.hasNode(e.key))throw new Error(`Trying to add a namespace to ${this.key}, but it already exists`);let t=new o(this.root,e);return this.root.graph.setNode(t.key,t),this.root.graph.setParent(t.key,this.key),this.fields.push({type:"namespace",key:t.key}),t}removeNamespace(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new Ht(`Trying to remove the ${e} namespace, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==ye)throw new Ht(`Trying to remove the ${e} namespace, but it is not a namespace`);return je(this.root.graph,e),this.removeField(e),this}attachNamespace(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new Error(`Trying to attach the ${e} namespace, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==ye)throw new Error(`Trying to attach the ${e} namespace, but it is not a namespace`);if(t.domain.key!==this.root.key)throw new Error(`Trying to attach the ${e} namespace, but it is not in the same domain`);let i=t.getParentInstance();if(i===this)throw new $e(`Trying to attach the ${e} entity, but it is already a child of this model`);return this.root!==i&&i.detachNamespace(e),this.fields.push({type:"namespace",key:e}),this.root.graph.setParent(e,this.key),this}detachNamespace(e){this.root.ensureWritable();let t=this.fields.findIndex(r=>r.key===e);if(t===-1)throw new Ht(`Trying to detach the ${e} namespace, but it doesn't exist`);let i=this.root.graph.node(e);if(!i||i.kind!==ye)throw new Ht(`Trying to detach the ${e} namespace, but it is not a namespace`);return this.fields.splice(t,1),this.root.graph.setParent(e),this}*listNamespaces(){for(let{key:e,type:t}of this.fields){if(t!=="namespace")continue;let i=this.root.graph.node(e);!i||i.kind!==ye||(yield i)}}hasNamespaces(){return this.fields.some(e=>e.type==="namespace")}addModel(e){if(this.root.ensureWritable(),e&&e.key&&this.root.graph.hasNode(e.key))throw new Error(`Trying to add a model to ${this.key}, but it already exists`);let t=new _t(this.root,e);return this.root.graph.setNode(t.key,t),this.root.graph.setParent(t.key,this.key),this.fields.push({type:"model",key:t.key}),t}removeModel(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new Vi(`Trying to remove the ${e} model, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==de)throw new Vi(`Trying to remove the ${e} model, but it is not a model`);return je(this.root.graph,e),this.removeField(e),this}attachModel(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new $e(`Trying to attach the ${e} model, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==de)throw new $e(`Trying to attach the ${e} model, but it is not a model`);if(t.domain.key!==this.root.key)throw new $e(`Trying to attach the ${e} model, but it is not in the same domain`);let i=t.getParentInstance();if(i===this)throw new $e(`Trying to attach the ${e} model, but it is already a child of this namespace`);return this.root!==i&&i.detachModel(e),this.fields.push({type:"model",key:e}),this.root.graph.setParent(e,this.key),this}detachModel(e){this.root.ensureWritable();let t=this.fields.findIndex(r=>r.key===e);if(t===-1)throw new at(`Trying to detach the ${e} model, but it doesn't exist`);let i=this.root.graph.node(e);if(!i||i.kind!==de)throw new at(`Trying to detach the ${e} model, but it is not a model`);if(i.getParentInstance()!==this)throw new at(`Trying to detach the ${e} model, but it is not a child of this namespace`);return this.fields.splice(t,1),this.root.graph.setParent(e),this}*listModels(){for(let{key:e,type:t}of this.fields){if(t!=="model")continue;let i=this.root.graph.node(e);!i||i.kind!==de||(yield i)}}hasModels(){return this.fields.some(e=>e.type==="model")}getParentInstance(){let e;for(let t of this.root.graph.parents(this.key)){e=t;break}return e?this.root.graph.node(e):this.root}*listFields(){for(let{key:e}of this.fields){let t=this.root.graph.node(e);t&&(t.kind===ye||t.kind===de)&&(yield t)}}hasFields(){return this.fields.length>0}removeField(e){this.fields=this.fields.filter(t=>t.key!==e)}isChildOf(e){if(this.key===e)return!1;let t=this.getParentInstance();return t?t.key===e?!0:t===this.root?!1:t.isChildOf(e):!1}};function pi(o,e,t){return o+""+e+""+(t||"\0")}function la(o,e,t){let i={v:o,w:e};return t&&(i.name=t),i}var Hr=class o{isDirectedValue;isMultigraphValue;isCompoundValue;graphLabelValue;nodesValue;#e;get parentValue(){if(!this.isCompoundValue)throw new Error("Cannot access parentValue in a non-compound graph");return this.#e||(this.#e=new Map),this.#e}#t;get childrenValue(){if(!this.isCompoundValue)throw new Error("Cannot access childrenValue in a non-compound graph");return this.#t||(this.#t=new Map),this.#t}inValue;predecessorsValue;outValue;successorsValue;edgeObjectsValue;edgeLabelsValue;nodeCountValue;edgeCountValue;constructor(e={}){this.isDirectedValue=typeof e.directed=="boolean"?e.directed:!0,this.isMultigraphValue=typeof e.multigraph=="boolean"?e.multigraph:!1,this.isCompoundValue=typeof e.compound=="boolean"?e.compound:!1,this.graphLabelValue=void 0,this.nodesValue=new Map,this.isCompoundValue&&this.childrenValue.set("\0",new Set),this.inValue=new Map,this.outValue=new Map,this.predecessorsValue=new Map,this.successorsValue=new Map,this.edgeObjectsValue=new Map,this.edgeLabelsValue=new Map,this.nodeCountValue=0,this.edgeCountValue=0,this.defaultNodeLabelFn=()=>{},this.defaultEdgeLabelFn=()=>{}}isDirected(){return this.isDirectedValue}isMultigraph(){return this.isMultigraphValue}isCompound(){return this.isCompoundValue}setGraph(e){return this.graphLabelValue=e,this}graph(){return this.graphLabelValue}defaultNodeLabelFn(e){}defaultEdgeLabelFn(e,t,i){}setDefaultNodeLabel(e){return typeof e=="function"?this.defaultNodeLabelFn=e:this.defaultNodeLabelFn=()=>e,this}nodeCount(){return this.nodeCountValue}nodes(){return this.nodesValue.keys()}*sources(){for(let e of this.nodes()){let t=this.inValue.get(e);(!t||t.size===0)&&(yield e)}}*sinks(){for(let e of this.nodes()){let t=this.outValue.get(e);(!t||t.size===0)&&(yield e)}}setNodes(e,t){if(typeof t>"u")for(let i of e)this.setNode(i);else for(let i of e)this.setNode(i,t);return this}setNode(e,t){return this.nodesValue.has(e)?(t&&this.nodesValue.set(e,t),this):(this.nodesValue.set(e,t||this.defaultNodeLabelFn(e)),this.isCompoundValue&&(this.parentValue.set(e,new Set(["\0"])),this.childrenValue.set(e,new Set),this.childrenValue.get("\0").add(e)),this.inValue.set(e,new Map),this.predecessorsValue.set(e,new Map),this.outValue.set(e,new Map),this.successorsValue.set(e,new Map),++this.nodeCountValue,this)}node(e){return this.nodesValue.get(e)}hasNode(e){return this.nodesValue.has(e)}removeNode(e){if(!this.hasNode(e))return this;if(this.nodesValue.delete(e),this.isCompoundValue){this.removeFromParentsChildList(e),this.parentValue.delete(e);for(let r of this.children(e))this.removeParent(r,e);this.childrenValue.delete(e)}let t=this.inValue.get(e);if(t){for(let r of t.keys()){let s=this.edgeObjectsValue.get(r);s&&this.removeEdge(s)}this.inValue.delete(e)}this.predecessorsValue.delete(e);let i=this.outValue.get(e);if(i){for(let r of i.keys()){let s=this.edgeObjectsValue.get(r);s&&this.removeEdge(s)}this.outValue.delete(e)}return this.successorsValue.delete(e),this.nodeCountValue-=1,this}setParent(e,t="\0"){if(!this.isCompoundValue)throw new Error("Cannot set parent in a non-compound graph");return t!=="\0"&&(this.checkParentCycle(e,t),this.nodesValue.has(t)||this.setNode(t)),this.nodesValue.has(e)||this.setNode(e),this.removeFromParentsChildList(e),this.parentValue.set(e,new Set),this.parentValue.get(e).add(t),this.childrenValue.has(t)||this.childrenValue.set(t,new Set),this.childrenValue.get(t).add(e),this}checkParentCycle(e,t){for(let i of this.parents(t)){if(i===e)throw new Error(`Setting ${t} as parent of ${e} would create a cycle`);this.checkParentCycle(e,i)}}addParent(e,t){if(!this.isCompoundValue)throw new Error("Cannot set parent in a non-compound graph");return this.checkParentCycle(e,t),this.nodesValue.has(t)||this.setNode(t),this.nodesValue.has(e)||this.setNode(e),this.parentValue.has(e)||this.parentValue.set(e,new Set),this.parentValue.get(e).add(t),this.childrenValue.has(t)||this.childrenValue.set(t,new Set),this.childrenValue.get(t).add(e),this}removeParent(e,t){if(!this.isCompoundValue)throw new Error("Cannot remove parent in a non-compound graph");return this.nodesValue.has(e)?(t?(this.childrenValue.get(t)?.delete(e),this.parentValue.get(e)?.delete(t)):(this.removeFromParentsChildList(e),this.parentValue.set(e,new Set),this.parentValue.get(e).add("\0"),this.childrenValue.get("\0").add(e)),this):this}removeFromParentsChildList(e){let t=this.parentValue.get(e);if(t)for(let i of t)this.childrenValue.get(i)?.delete(e)}*parents(e){if(this.isCompoundValue){let t=this.parentValue.get(e);if(t)for(let i of t)i!=="\0"&&(yield i)}}hasParents(e){for(let t of this.parents(e))return!0;return!1}hasParent(e,t){if(this.isCompoundValue){let i=this.parentValue.get(e);if(i)return i.has(t)}return!1}parent(e){for(let t of this.parents(e))return t}*children(e="\0"){if(this.isCompoundValue){let t=this.childrenValue.get(e);if(t)for(let i of t.keys())yield i}else if(e==="\0")for(let t of this.nodes())yield t}hasChildren(e="\0"){if(this.isCompoundValue){let t=this.childrenValue.get(e);if(!t)return!1;for(let i of t.keys())return!0;return!1}else if(e==="\0"){for(let t of this.nodes())return!0;return!1}return!1}*predecessors(e){let t=this.predecessorsValue.get(e);if(t)for(let i of t.keys())yield i}*successors(e){let t=this.successorsValue.get(e);if(t)for(let i of t.keys())yield i}*neighbors(e){if(!this.hasNode(e))return;let t=new Set;for(let i of this.predecessors(e))t.has(i)||(t.add(i),yield i);for(let i of this.successors(e))t.has(i)||(t.add(i),yield i)}isLeaf(e){if(this.isDirected()){for(let t of this.successors(e))return!1;return!0}for(let t of this.neighbors(e))return!1;return!0}filterNodes(e){let t=new o({directed:this.isDirectedValue,multigraph:this.isMultigraphValue,compound:this.isCompoundValue}),i=this.graph();t.setGraph(i);let r=new Set;if(this.nodesValue.forEach((s,a)=>{e(a)&&(t.setNode(a,s),r.add(a))}),this.edgeObjectsValue.forEach(s=>{r.has(s.v)&&r.has(s.w)&&t.setEdge(s,this.edge(s))}),this.isCompoundValue){let s=new Map;for(let a of t.nodes()){let n=[...this.parents(a)],l=[];for(;n.length>0;){let c=!1;for(let u of n)t.hasNode(u)&&(l.push(u),c=!0);if(c)break;let p=[];for(let u of n)for(let m of this.parents(u))p.push(m);n=p}l.length===0&&l.push("\0"),s.set(a,l)}for(let[a,n]of s){this.removeParent(a);for(let l of n)t.addParent(a,l)}}return t}setDefaultEdgeLabel(e){return typeof e=="function"?this.defaultEdgeLabelFn=e:this.defaultEdgeLabelFn=()=>e,this}edgeCount(){return this.edgeCountValue}edges(){return this.edgeObjectsValue.values()}setPath(e,t){if(!Array.isArray(e)||!e.length)return this;let i=arguments.length>1;return e.reduce((r,s)=>(i?this.setEdge(r,s,t):this.setEdge(r,s),s)),this}setEdge(e,t,i,r){if(typeof e=="object"&&e!==null&&"v"in e){let s=e;arguments.length>1?this._setEdge({loop:0},s,t):this._setEdge({loop:0},s)}else if(typeof t=="string"){let s=la(e,t,r);arguments.length>2?this._setEdge({loop:0},s,i):this._setEdge({loop:0},s)}else throw new Error("Invalid arguments for setEdge");return this}_setEdge(e,t,i){let r=!1,s;arguments.length>2&&(s=i,r=!0);let a=pi(t.v,t.w,t.name);if(this.edgeLabelsValue.has(a)){if(r&&this.edgeLabelsValue.set(a,s),e.loop===0&&!this.isDirectedValue&&t.w!==t.v){let u=la(t.w,t.v,t.name);r?this._setEdge({loop:1},u,i):this._setEdge({loop:1},u)}return}if(t.name&&!this.isMultigraphValue)throw new Error("Cannot set a named edge when isMultigraph = false");this.hasNode(t.v)||this.setNode(t.v),this.hasNode(t.w)||this.setNode(t.w);let l=r?s:this.defaultEdgeLabelFn(t.v,t.w,t.name);this.edgeLabelsValue.set(a,l),this.edgeObjectsValue.set(a,t);let c=this.predecessorsValue.get(t.w);if(c){let u=(c.get(t.v)||0)+1;c.set(t.v,u)}let p=this.successorsValue.get(t.v);if(p){let u=(p.get(t.w)||0)+1;p.set(t.w,u)}if(this.inValue.get(t.w).set(a,t),this.outValue.get(t.v).set(a,t),this.edgeCountValue++,e.loop===0&&!this.isDirectedValue&&t.w!==t.v){let u=la(t.w,t.v,t.name);r?this._setEdge({loop:1},u,i):typeof l=="object"&&l!==null?this._setEdge({loop:1},u,l):this._setEdge({loop:1},u)}}edge(e,t,i){let r;return typeof e=="object"?r=pi(e.v,e.w,e.name):r=pi(e,t,i),this.edgeLabelsValue.get(r)}hasEdge(e,t,i){let r;return typeof e=="object"?r=pi(e.v,e.w,e.name):r=pi(e,t,i),this.edgeLabelsValue.has(r)}removeEdge(e,t,i){return typeof e=="object"?this._removeEdge({loop:0},e.v,e.w,e.name):this._removeEdge({loop:0},e,t,i),this}_removeEdge(e,t,i,r){let s=pi(t,i,r),a=this.edgeObjectsValue.get(s);if(a){this.edgeLabelsValue.delete(s),this.edgeObjectsValue.delete(s);let n=this.predecessorsValue.get(a.w);if(n){let c=(n.get(a.v)||0)-1;c<=0?n.delete(a.v):n.set(a.v,c)}let l=this.successorsValue.get(a.v);if(l){let c=(l.get(a.w)||0)-1;c<=0?l.delete(a.w):l.set(a.w,c)}this.inValue.get(a.w)?.delete(s),this.outValue.get(a.v)?.delete(s),this.edgeCountValue--}!this.isDirectedValue&&e.loop===0&&this._removeEdge({loop:1},i,t,r)}*inEdges(e,t){let i=this.inValue.get(e);if(i){let r=i.values();if(!t){for(let s of r)yield s;return}for(let s of r)s.v===t&&(yield s)}}*outEdges(e,t){let i=this.outValue.get(e);if(!i)return;let r=i.values();if(!t){for(let s of r)yield s;return}for(let s of r)s.w===t&&(yield s)}*nodeEdges(e,t){for(let i of this.inEdges(e,t))yield i;for(let i of this.outEdges(e,t))i.v!==i.w&&(yield i)}};function bd(o,e){let t=[];for(let i of o.nodes()){let r=o.node(i);if(!r||r.domain.key!==e)continue;let s=[...o.parents(i)],a={v:i};a.value=r.toJSON(),s.length&&(a.parents=s),t.push(a)}return t}function wd(o,e){let t=[];for(let i of o.edges()){let r=o.edge(i);if(!r)continue;let s=o.node(i.v),a=o.node(i.w);if(!s||!a||s.domain.key!==e||a.domain.key!==e&&r.type!=="association"&&r.type!=="parent")continue;let n={v:i.v,w:i.w};i.name&&(n.name=i.name),n.value=structuredClone(r),t.push(n)}return t}function kd(o,e){let t=[],i=new Set;for(let r of o.nodes()){let s=o.node(r);s&&s.domain.key===e&&i.add(r)}for(let r of i){let s=o.node(r);if(s){if(s.kind===ne||s.kind===fe){let n=[...o.inEdges(r)].filter(l=>{let c=o.node(l.v);return c&&c.domain.key===e});if(n.length===0){let l=s.kind===ne?"Property":"Association";t.push(`${l} "${s.info.name}" (${r}) has no parent entity edge. This will cause deserialization to fail.`)}else if(n.length>1){let l=s.kind===ne?"Property":"Association",c=n.map(p=>p.v).join(", ");t.push(`${l} "${s.info.name}" (${r}) has multiple parent edges: ${c}. This may cause deserialization issues.`)}else{let l=n[0],c=o.node(l.v);if(!c||c.kind!==H){let p=s.kind===ne?"Property":"Association";t.push(`${p} "${s.info.name}" (${r}) has a parent that is not an entity. Parent: ${c?.kind||"unknown"} (${l.v})`)}}}if(s.kind===H&&([...o.parents(r)].some(l=>{let c=o.node(l);return c&&c.kind===de})||t.push(`Entity "${s.info.name}" (${r}) has no model parent. Entities must belong to a model.`)),s.kind===de){let a=[...o.parents(r)],n=a.some(l=>{let c=o.node(l);return c&&c.kind===ye});if(a.length>0&&!n){let l=a.map(c=>`${o.node(c)?.kind||"unknown"} (${c})`).join(", ");t.push(`Model "${s.info.name}" (${r}) has invalid parent types: ${l}. Models can only belong to namespaces or be at root level.`)}}}}for(let r of i){let s=o.node(r);if(s&&s.kind===fe){let a=s,l=[...o.outEdges(r)].filter(c=>{let p=o.edge(c);return p&&p.type==="association"});l.length;for(let c of l){let p=o.node(c.w);p?p.kind!==H&&t.push(`Association "${a.info.name}" (${r}) references non-entity target: ${p.kind} (${c.w})`):t.push(`Association "${a.info.name}" (${r}) references non-existent target: ${c.w}`)}}}if(t.length>0)throw new Error(`Graph consistency validation failed for domain "${e}":
|
|
48
|
+
`);return h.push(`${m}`),h.push(`${p}</${l}>`),h.join(`
|
|
49
|
+
`)}if(e.defaultValue)return this._unionDefaultValue(e,e.defaultValue);let n=this._readCurrentUnion(i);if(n)return this.processNode(n,{...t,forceName:e.name})}}_unionDefaultValue(e,t,i={}){let s=new xe().generate(t),n=nt(e),l=i.indent||0,c=new Array(l*2).fill(" ").join(""),p=[`${c}<${n}>`],u=new Array(l*2+2).fill(" ").join("");return p.push(`${u}${String(s).trim()}`),p.push(`${c}</${n}>`),p.join(`
|
|
50
|
+
`)}_fileShapeObject(){}_schemaShapeObject(){}_tupleShapeObject(){}_anyShapeObject(e){let{and:t=[],xone:i=[],or:r=[]}=e;if(t.length){let n=structuredClone(e);return n.and=[],n.properties=[],t.forEach(l=>{let{types:c}=l;if(c.includes(d.aml.vocabularies.shapes.ScalarShape)){let p=l;n.properties.push(p)}else if(c.includes(d.w3.shacl.NodeShape))l.properties.forEach(u=>n.properties.push(u));else if(c.includes(d.aml.vocabularies.shapes.ArrayShape)||c.includes(d.aml.vocabularies.shapes.MatrixShape)){let p=l;p.items&&n.properties.push(p.items)}}),this._nodeShapeObject(n)}if(i.length){let{selectedUnions:n=[]}=this.opts,l=i.find(c=>n.includes(c.id));return l||(l=i[0]),this.processNode(l)}if(r.length){let{selectedUnions:n=[]}=this.opts,l=r.find(c=>n.includes(c.id));return l||(l=r[0]),this.processNode(l)}let{examples:s=[]}=e,a=nt(e);if(this.opts.renderExamples&&s&&s.length){let n=s.find(p=>!!p.structuredValue),l=this._exampleToObject(n),c=[];if(typeof l<"u"){let p=" ";c.push(`<${a}>`),c.push(`${p}${l}`),c.push(`</${a}>`)}return c.join(`
|
|
51
|
+
`)}return this._scalarShapeObject(e)}};var zn=Oo(Rn(),1);var zr=Symbol("findAmfType"),Tn=Symbol("findReferenceObject"),fe=Symbol("getArrayItems"),Dn=Symbol("computeReferenceSecurity"),sa=o=>{class e extends o{_amf;__cachedKeys;__lastSetValue;get amf(){return this._amf}set amf(i){if(this._amf===i||this.__lastSetValue===i)return;this.__lastSetValue=i;let r=i?this._expand(i):void 0;this.__cachedKeys={},this._amf=r,this._amfChanged(r)}_amfChanged(i){}_expand(i){return zn.AmfModelExpander.expand(i)}_getAmfKey(i,r){if(!i)return"";let{amf:s}=this;if(!s&&!r)return i;Array.isArray(s)&&([s]=s),this.__cachedKeys||(this.__cachedKeys={});let a=r||s&&s["@context"];if(!a||!i)return i;let n=this.__cachedKeys;if(i in n)return n[i];i=String(i);let l=i.indexOf("#"),c=i.substring(0,l+1),p=Object.keys(a);for(let u=0,h=p.length;u<h;u++){let m=p[u];if(a[m]===i)return n[i]=m,m;if(l===-1&&i.indexOf(a[m])===0){let f=i.replace(a[m],`${m}:`);return n[i]=f,f}if(a[m]===c){let f=`${m}:${i.substring(l+1)}`;return n[i]=f,f}}return i}_ensureAmfModel(i){if(i&&(Array.isArray(i)&&([i]=i),this._hasType(i,d.aml.vocabularies.document.Document)))return i}_ensureArray(i){if(i)return i instanceof Array?i:[i]}_getValue(i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&i[a];if(!n)return n;if(Array.isArray(n)&&([n]=n),!n)return;let l=typeof n;return["string","number","boolean","undefined"].includes(l)?n:n["@value"]}_getValueArray(i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&this._ensureArray(i[a]);if(Array.isArray(n))return n.map(l=>l["@value"]||l)}[fe](i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&this._ensureArray(i[a]);if(Array.isArray(n))return n}_getLinkValue(i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&i[a];if(n&&(Array.isArray(n)&&([n]=n),!!n))return n["@id"]}_getLinkValues(i,r,s){let a=this._getAmfKey(r,s);if(!a)return;let n=i&&i[a];if(n)return Array.isArray(n)||(n=[n]),n.map(l=>l["@id"])}_hasType(i,r,s){let a=this._ensureArray(i&&i["@type"]);if(!a||!a.length)return!1;let n=this._getAmfKey(r,s);for(let l of a)if(l===n)return!0;return!1}_hasProperty(i,r,s){let a=this._getAmfKey(r,s);return!!(i&&a&&a in i)}_computePropertyArray(i,r,s){if(!i)return;let a=this._getAmfKey(r,s);if(!a)return;let n=this._ensureArray(i&&i[a]);if(!(!n||!Array.isArray(n)))return n}_computeApiVersion(i,r){let s=this._computeApi(i);if(s)return this._getValue(s,d.aml.vocabularies.core.version,r)}_computeEncodes(i,r){if(!i)return;Array.isArray(i)&&([i]=i);let s=this._getAmfKey(d.aml.vocabularies.document.encodes,r);if(!s)return;let a=i[s];if(a)return Array.isArray(a)?a[0]:a}_computeDeclares(i,r){if(!i||(Array.isArray(i)&&([i]=i),!i))return;let s=this._getAmfKey(d.aml.vocabularies.document.declares,r);if(!s)return;let a=this._ensureArray(i[s]);return Array.isArray(a)?a:void 0}_computeReferences(i,r){if(!i||(Array.isArray(i)&&([i]=i),!i))return;let s=this._getAmfKey(d.aml.vocabularies.document.references,r);if(!s)return;let a=this._ensureArray(i[s]);return a instanceof Array?a:void 0}_computeWebApi(i,r){let s=this._computeEncodes(i,r);if(s&&this._hasType(s,d.aml.vocabularies.apiContract.WebAPI,r))return s}_computeApi(i,r){let s=this._computeEncodes(i,r);if(s&&(this._isAPI(i,r)||this._isWebAPI(i,r)||this._isAsyncAPI(i,r)))return s}_isWebAPI(i,r){let s=this._computeEncodes(i,r);return s?this._hasType(s,d.aml.vocabularies.apiContract.WebAPI,r):!1}_isAsyncAPI(i,r){let s=this._computeEncodes(i,r);return s?this._hasType(s,d.aml.vocabularies.apiContract.AsyncAPI,r):!1}_isAPI(i,r){let s=this._computeEncodes(i,r);return s?this._hasType(s,d.aml.vocabularies.apiContract.API,r):!1}_isValidServerPartial(i,r){if(Array.isArray(i)&&([i]=i),!i)return!1;let s=d.aml.vocabularies.apiContract.Operation,a=d.aml.vocabularies.apiContract.EndPoint,n=[this._getAmfKey(s,r),this._getAmfKey(a,r)],l=i["@type"];for(let c of l)if(n.indexOf(c)!==-1)return!0;return!1}_getServers(i={},r){let{endpointId:s,methodId:a}=i,{amf:n}=this;if(!n)return;let l=this._computeApi(n,r);if(Array.isArray(l)&&([l]=l),!l)if(this._isValidServerPartial(n,r))l=n;else return;let c=this._getAmfKey(d.aml.vocabularies.apiContract.server,r),p=()=>this[fe](l,c,r),u=()=>{let m=this._computeEndpointModel(l,s,r),f=this[fe](m,c,r);return f||p()},h=()=>{let m=this._computeMethodModel(l,a,r),f=this[fe](m,c,r);return f||u()};return a?h():s?u():p()}_computeExpects(i,r){let s=d.aml.vocabularies.apiContract.Operation,a=d.aml.vocabularies.apiContract.expects;if(this._hasType(i,s,r)){let n=this._getAmfKey(a,r),l=this._ensureArray(i[n]);if(l)return Array.isArray(l)?l[0]:l}}_computeEndpoints(i,r){if(!i)return[];let s=d.aml.vocabularies.apiContract.endpoint,a=this._getAmfKey(s,r);return this._ensureArray(i[a])}_computeEndpointModel(i,r,s){if(this._hasType(i,d.aml.vocabularies.apiContract.EndPoint,s))return i;let a=this._computeEndpoints(i,s);if(a)return a.find(n=>n["@id"]===r)}_computeMethodModel(i,r,s){let a=this.__computeMethodsListForMethod(i,r,s);if(a)return a.find(n=>n["@id"]===r)}_computeMethodEndpoint(i,r,s){if(!i||!r)return;if(this._hasType(i,d.aml.vocabularies.apiContract.EndPoint,s))return i;let a=this._computeEndpoints(i,s);if(!a)return;let n=this._getAmfKey(d.aml.vocabularies.apiContract.supportedOperation,s);for(let l=0,c=a.length;l<c;l++){let p=a[l],u=p[n];if(u){Array.isArray(u)||(u=[u]);for(let h=0,m=u.length;h<m;h++)if(u[h]["@id"]===r)return p}}}__computeMethodsListForMethod(i,r,s){let a=this._computeMethodEndpoint(i,r,s);if(!a)return;let n=this._getAmfKey(d.aml.vocabularies.apiContract.supportedOperation,s);return this._ensureArray(a[n])}_computeType(i,r,s,a){if(!i&&!r||!s)return;let n=s.replace("amf://id",""),l=i&&i.find(c=>c["@id"]===s||c["@id"]===n);if(!l&&r&&r.length)for(let c=0,p=r.length;c<p&&!(this._hasType(r[c],d.aml.vocabularies.document.Module)&&(l=this._computeReferenceType(r[c],s,a),l));c++);return l}[zr](i,r){let{amf:s}=this;if(!s||!i)return;Array.isArray(s)&&([s]=s);let a=this._computeDeclares(s,r),n=i.replace("amf://id","");if(Array.isArray(a)){let l=a.find(c=>c["@id"]===i||c["@id"]===n);if(l)return l}return this[Tn](i)}[Tn](i,r){let{amf:s}=this;if(Array.isArray(s)&&([s]=s),!s)return;let a=this._computeReferences(s,r);if(!Array.isArray(a)||!a.length)return;let n=i.replace("amf://id","");for(let l=0,c=a.length;l<c;l++){let p=a[l],u=this._computeDeclares(p,r);if(Array.isArray(u))for(let h=0,m=u.length;h<m;h++){let f=u[h];if(Array.isArray(f)&&([f]=f),f["@id"]===i||f["@id"]===n)return f}}}_computeReferenceType(i,r,s){let a=this._computeDeclares(i,s);if(!a||!r)return;let n=r.replace("amf://id",""),l=a.find(c=>(Array.isArray(c)&&([c]=c),c["@id"]===r||c["@id"]===n));return Array.isArray(l)&&([l]=l),this._resolve(l)}_computeDocument(i,r,s){if(!i||!r)return;let a=this._getAmfKey(d.aml.vocabularies.core.documentation,s),n=this._ensureArray(i[a]);return n&&n.find(l=>l["@id"]===r)}_resolve(i,r){let{amf:s}=this;if(typeof i!="object"||Array.isArray(i)||!s||i.__apicResolved)return i;let a=this._getAmfKey(d.aml.vocabularies.document.linkTarget,r),n=this._ensureArray(i[a]),l;if(n){let u=n[0]["@id"];if(u===i["@id"])return i.__apicResolved=!0,i;l=this._getLinkTarget(s,u,r)}else if(a=this._getAmfKey(d.aml.vocabularies.document.referenceId,r),n=this._ensureArray(i[a]),n){let u=n[0]["@id"];if(u===i["@id"])return i.__apicResolved=!0,i;l=this._getReferenceId(s,u,r)}if(!l)return this._resolveRecursive(i),i.__apicResolved=!0,i;let c={...l};delete c["@id"];let p=c["@type"];return p&&(i["@type"]?i["@type"]=i["@type"].concat(p):i["@type"]=p,delete c["@type"]),this._mergeShapes(i,c,r),i.__apicResolved=!0,this._resolveRecursive(i),i}_getLinkTarget(i,r,s){if(!i||!r)return;let a,n=this._computeDeclares(i,s);if(n&&(a=this._findById(n,r)),!a){let l=this._computeReferences(i,s);a=this._obtainShapeFromReferences(l,r,s)}if(a)return a=this._resolve(a),a}_obtainShapeFromReferences(i,r,s){if(!Array.isArray(i)||!i.length)return;let a;for(let n of i){let l=this._computeEncodes(n,s);if(l&&l["@id"]===r){a=l;break}if(!l&&(a=this._findById(this._computeDeclares(n,s),r),a))break}return a}_findById(i,r){if(!i)return;let s;for(let a of i)if(a&&a["@id"]===r){s=a;break}return s}_getReferenceId(i,r,s){if(!i||!r)return;let a=this._computeReferences(i,s);if(a)for(let n of a){let l=this._computeEncodes(n,s);if(l&&l["@id"]===r)return l}}_resolveRecursive(i,r){Object.keys(i).forEach(s=>{let a=i[s];if(Array.isArray(a))for(let n=0,l=a.length;n<l;n++)a[n]=this._resolve(a[n]);else typeof a=="object"&&(i[s]=this._resolve(a,r))})}_mergeShapes(i,r,s){let a={...i,...r};return[{key:this._getAmfKey(d.aml.vocabularies.docSourceMaps.sources,s),merger:this._mergeSourceMapsSources.bind(this)}].forEach(({key:l,merger:c})=>{this._hasProperty(a,l,s)&&(a[l]=c(i,r,s))}),Object.assign(i,a)}_mergeSourceMapsSources(i,r,s){let a=this._getAmfKey(d.aml.vocabularies.docSourceMaps.sources,s),n=i[a]||{};Array.isArray(n)&&(n=n[0]);let l=r[a]||{};return Array.isArray(l)&&(l=l[0]),[Object.assign(n,l)]}_expandKey(i,r){let{amf:s}=this;if(!i||typeof i!="string"||!s&&!r)return i;Array.isArray(s)&&([s]=s);let a=r||s&&s["@context"];if(!a)return i;let[n,l]=i.split(":");if(!n||!l)return i;let c=a[n];return c?`${c}${l}`:i}findSecurityScheme(i,r){let{amf:s}=this,a=this._computeDeclares(s,r),n;if(a&&(n=a.find(c=>c["@id"]===i)),n)return n=this._resolve(n),n;let l=this._computeReferences(s,r);if(Array.isArray(l)&&l.length){for(let c of l)if(this._hasType(c,d.aml.vocabularies.document.Module,r)&&(n=this[Dn](c,i,r),n))return n=this._resolve(n),n}}[Dn](i,r,s){let a=this._computeDeclares(i,s);if(!a)return;let n=a.find(l=>{let c=l;return Array.isArray(c)&&([c]=c),c["@id"]===r});return Array.isArray(n)&&([n]=n),this._resolve(n)}getByType(i,r,s){if(!i)return[];let a=[],n=this._computeDeclares(i),l=this._getAmfKey(r,s);n&&n.length&&n.forEach(p=>{this._hasType(p,l)&&a.push(p)});let c=this._computeReferences(i);if(Array.isArray(c)&&c.length){for(let p of c)if(this._hasType(p,d.aml.vocabularies.document.Module)){let u=this.getByType(p,r,s);u.length&&(a=a.concat(u))}}return a}}return e};var aa=class extends sa(Object){constructor(e){super(),e&&(this.amf=e)}readTypes(e,t){let i=e;return typeof i=="string"&&(i=[i]),Array.isArray(i)?i.map(r=>this._expandKey(r,t)):[]}apiSummary(e){let t=e["@context"],i={id:e["@id"],types:this.readTypes(e["@type"],t),customDomainProperties:this.customDomainProperties(e,t),sourceMaps:this.sourceMap(e),schemes:[],accepts:[],contentType:[],documentations:[],tags:[]},r=this._getValue(e,d.aml.vocabularies.core.name,t);r&&typeof r=="string"&&(i.name=r);let s=this._getValue(e,d.aml.vocabularies.core.description,t);s&&typeof s=="string"&&(i.description=s);let a=this._getValue(e,d.aml.vocabularies.core.version,t);a&&typeof a=="string"&&(i.version=a);let n=this._getValue(e,d.aml.vocabularies.core.termsOfService,t);n&&typeof n=="string"&&(i.termsOfService=n);let l=e[this._getAmfKey(d.aml.vocabularies.apiContract.accepts,t)];Array.isArray(l)&&l.length&&(i.accepts=this._getValueArray(e,d.aml.vocabularies.apiContract.accepts,t));let c=e[this._getAmfKey(d.aml.vocabularies.apiContract.contentType,t)];Array.isArray(c)&&c.length&&(i.contentType=this._getValueArray(e,d.aml.vocabularies.apiContract.contentType,t));let p=e[this._getAmfKey(d.aml.vocabularies.apiContract.scheme,t)];Array.isArray(p)&&p.length&&(i.schemes=this._getValueArray(e,d.aml.vocabularies.apiContract.scheme,t));let u=e[this._getAmfKey(d.aml.vocabularies.core.provider,t)];Array.isArray(u)&&([u]=u),u&&(i.provider=this.provider(u));let h=e[this._getAmfKey(d.aml.vocabularies.core.license,t)];Array.isArray(h)&&([h]=h),h&&(i.license=this.license(h));let m=e[this._getAmfKey(d.aml.vocabularies.apiContract.tag,t)];Array.isArray(m)&&m.length&&(i.tags=m.map(b=>this.tag(b)));let f=e[this._getAmfKey(d.aml.vocabularies.core.documentation,t)];return Array.isArray(f)&&f.length&&(i.documentations=f.map(b=>this.documentation(b))),i}api(e,t){let i=t||e["@context"],r=this.apiSummary(e);r.endPoints=[],r.servers=[],r.security=[];let s=e[this._getAmfKey(d.aml.vocabularies.apiContract.endpoint,i)];Array.isArray(s)&&s.length&&(r.endPoints=s.map(l=>this.endPoint(l,i)));let a=e[this._getAmfKey(d.aml.vocabularies.apiContract.server,i)];Array.isArray(a)&&a.length&&(r.servers=a.map(l=>this.server(l,i)));let n=e[this._getAmfKey(d.aml.vocabularies.security.security,i)];return Array.isArray(n)&&n.length&&(r.security=n.map(l=>this.securityRequirement(l,i))),r}webApi(e,t){return this.api(e,t)}asyncApi(e,t){return this.api(e,t)}provider(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getLinkValue(e,d.aml.vocabularies.core.url,i);a&&typeof a=="string"&&(r.url=a);let n=this._getValue(e,d.aml.vocabularies.core.email,i);return n&&typeof n=="string"&&(r.email=n),r}license(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getLinkValue(e,d.aml.vocabularies.core.url,i);return a&&typeof a=="string"&&(r.url=a),r}server(e,t){let i=t||e["@context"],r=this._getValue(e,d.aml.vocabularies.core.urlTemplate,i)||"",s={id:e["@id"],types:this.readTypes(e["@type"],i),url:r,variables:[],customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(s.description=a);let n=e[this._getAmfKey(d.aml.vocabularies.apiContract.variable,i)];Array.isArray(n)&&n.length&&(s.variables=n.map(u=>this.parameter(u,i)));let l=this._getValue(e,d.aml.vocabularies.apiContract.protocol,i),c=this._getValue(e,d.aml.vocabularies.apiContract.protocolVersion,i);l&&(s.protocol=l),c&&(s.protocolVersion=c);let p=e[this._getAmfKey(d.aml.vocabularies.security.security,i)];return Array.isArray(p)&&p.length&&(s.security=p.map(u=>this.securityRequirement(u,i))),s}parameter(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),payloads:[],examples:[],customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.apiContract.paramName,i);a&&typeof a=="string"&&(r.paramName=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(r.description=n);let l=this._getValue(e,d.aml.vocabularies.apiContract.required,i);typeof l=="boolean"&&(r.required=l);let c=this._getValue(e,d.aml.vocabularies.apiContract.allowEmptyValue,i);typeof c=="boolean"&&(r.allowEmptyValue=c);let p=this._getValue(e,d.aml.vocabularies.document.deprecated,i);typeof p=="boolean"&&(r.deprecated=p);let u=this._getValue(e,d.aml.vocabularies.apiContract.explode,i);typeof u=="boolean"&&(r.explode=u);let h=this._getValue(e,d.aml.vocabularies.apiContract.allowReserved,i);typeof h=="boolean"&&(r.allowReserved=h);let m=this._getValue(e,d.aml.vocabularies.apiContract.style,i);m&&typeof m=="string"&&(r.style=m);let f=this._getValue(e,d.aml.vocabularies.apiContract.binding,i);f&&typeof f=="string"&&(r.binding=f);let b=e[this._getAmfKey(d.aml.vocabularies.shapes.schema,i)];if(Array.isArray(b)&&b.length){let[I]=b;r.schema=this.unknownShape(I,{trackedId:e["@id"]},i)}let k=e[this._getAmfKey(d.aml.vocabularies.apiContract.payload,i)];Array.isArray(k)&&k.length&&(r.payloads=k.map(I=>this.payload(I,i)));let S=e[this._getAmfKey(d.aml.vocabularies.apiContract.examples,i)];return Array.isArray(S)&&S.length&&(r.examples=S.map(I=>this.example(I,i))),r}unknownShape(e,t,i){let r=i||e["@context"],s=this.readTypes(e["@type"],r);return s.includes(d.aml.vocabularies.shapes.ScalarShape)?this.scalarShape(e,t,r):s.includes(d.w3.shacl.NodeShape)?this.nodeShape(e,t,r):s.includes(d.aml.vocabularies.shapes.UnionShape)?this.unionShape(e,t,r):s.includes(d.aml.vocabularies.shapes.FileShape)?this.fileShape(e,t,r):s.includes(d.aml.vocabularies.shapes.SchemaShape)?this.schemaShape(e,t,r):s.includes(d.aml.vocabularies.shapes.TupleShape)?this.tupleShape(e,t,r):s.includes(d.aml.vocabularies.shapes.ArrayShape)||s.includes(d.aml.vocabularies.shapes.MatrixShape)?this.arrayShape(e,t,r):s.includes(d.aml.vocabularies.shapes.RecursiveShape)?this.recursiveShape(e,r):this.anyShape(e,t,r)}isLink(e,t){let i=t||e["@context"];return!!this._getLinkValue(e,d.aml.vocabularies.document.linkTarget,i)}getLinkTarget(e,t){let i=t||e["@context"],r=this._getLinkValue(e,d.aml.vocabularies.document.linkTarget,i);if(r)return this[zr](r,i)}shape(e,t){let i=t||e["@context"];this._resolve(e);let r,s=e;if(this.isLink(s)){r=this._getValue(s,d.aml.vocabularies.document.linkLabel,i);let j=this._getLinkValue(s,d.aml.vocabularies.document.linkTarget,i),z=this[zr](j,i);z&&(s=z)}let a={id:s["@id"],types:this.readTypes(e["@type"],i),values:[],inherits:[],or:[],and:[],xone:[],customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)};r&&(a.linkLabel=r);let n=this._getValue(s,d.w3.shacl.name,i);n&&typeof n=="string"&&(a.name=n);let l=this._getValue(s,d.aml.vocabularies.core.displayName,i);if(l&&typeof l=="string")a.displayName=l;else{let j=this._getValue(s,d.aml.vocabularies.core.name,i);j&&typeof j=="string"&&(a.displayName=j)}let c=this._getValue(s,d.aml.vocabularies.core.description,i);c&&typeof c=="string"&&(a.description=c);let p=this._getValue(s,d.w3.shacl.defaultValueStr,i);p&&typeof p=="string"&&(a.defaultValueStr=p);let u=this._getValue(s,d.aml.vocabularies.shapes.deprecated,i);typeof u=="boolean"&&(a.deprecated=u);let h=this._getValue(s,d.aml.vocabularies.shapes.readOnly,i);typeof h=="boolean"&&(a.readOnly=h);let m=this._getValue(s,d.aml.vocabularies.shapes.writeOnly,i);typeof m=="boolean"&&(a.writeOnly=m);let f=s[this._getAmfKey(d.w3.shacl.defaultValue,i)];Array.isArray(f)&&f.length&&(a.defaultValue=this.unknownDataNode(f[0],i));let b=this._getAmfKey(d.w3.shacl.or,i),k=s[b];Array.isArray(k)&&k.length&&(a.or=k.map(j=>this.unknownShape(j,void 0,i)));let S=this._getAmfKey(d.w3.shacl.and,i),I=s[S];Array.isArray(I)&&I.length&&(a.and=I.map(j=>this.unknownShape(j,void 0,i)));let D=this._getAmfKey(d.w3.shacl.xone,i),w=s[D];Array.isArray(w)&&w.length&&(a.xone=w.map(j=>this.unknownShape(j,void 0,i)));let v=s[this._getAmfKey(d.w3.shacl.in,i)];if(Array.isArray(v)&&v.length){let[j]=v,z=d.w3.rdfSchema.key,J=this._getAmfKey(z,i);Object.keys(j).forEach(ee=>{if(ee.startsWith(z)||ee.startsWith(J)){let G=j[ee];Array.isArray(G)&&([G]=G);let ge=this.unknownDataNode(G,i);ge&&a.values.push(ge)}})}let E=this._getAmfKey(d.w3.shacl.not,i),R=s[E];return R&&(Array.isArray(R)&&([R]=R),a.not=this.unknownShape(R,void 0,i)),a}anyShape(e,t={},i){let r=i||e["@context"],s=e,a=this.shape(s,r);if(this.isLink(s)){let p=this.getLinkTarget(s,r);p&&(s=p)}a.examples=[];let n=s[this._getAmfKey(d.aml.vocabularies.apiContract.examples,r)];if(Array.isArray(n)&&n.length)if(t.trackedId){let p=this.filterTrackedExamples(n,t.trackedId,r);a.examples=p.map(u=>this.example(u,r))}else{let p=this.filterNonTrackedExamples(n,r);a.examples=p.map(u=>this.example(u,r))}let l=s[this._getAmfKey(d.aml.vocabularies.core.documentation,r)];if(Array.isArray(l)&&l.length){let[p]=l;a.documentation=this.documentation(p,r)}let c=s[this._getAmfKey(d.aml.vocabularies.shapes.xmlSerialization,r)];return Array.isArray(c)&&c.length&&(a.xmlSerialization=this.xmlSerializer(c[0],r)),a}filterTrackedExamples(e,t,i){let{docSourceMaps:r}=d.aml.vocabularies,s=this._getAmfKey(r.sources,i),a=this._getAmfKey(r.trackedElement,i),n=t.indexOf("amf")===-1?`amf://id${t}`:t;return e.filter(l=>{let c=l;Array.isArray(c)&&([c]=c);let p=c[s];if(!p)return!0;Array.isArray(p)&&([p]=p);let u=p[a];if(!u)return!0;Array.isArray(u)&&([u]=u);let{value:h}=this.synthesizedField(u,i);if(!h)return!0;let m=h.split(",");return m.indexOf(n)!==-1||m.indexOf(t)!==-1})}filterNonTrackedExamples(e,t){let{docSourceMaps:i}=d.aml.vocabularies,r=this._getAmfKey(i.sources,t),s=this._getAmfKey(i.trackedElement,t);return e.filter(a=>{let n=a;Array.isArray(n)&&([n]=n);let l=n[r];if(!l)return!0;Array.isArray(l)&&([l]=l);let c=l[s];if(!c)return!0;Array.isArray(c)&&([c]=c);let{value:p}=this.synthesizedField(c,t);return!p})}scalarShape(e,t={},i){let r=i||e["@context"],s=e,a=this.anyShape(s,t,r);if(this.isLink(s)){let b=this.getLinkTarget(s,r);b&&(s=b)}let n=this._getValue(s,d.w3.shacl.pattern,r);n&&typeof n=="string"&&(a.pattern=n);let l=this._getLinkValue(s,d.w3.shacl.datatype,r);l&&typeof l=="string"&&(a.dataType=l);let c=this._getValue(s,d.aml.vocabularies.shapes.format,r);c&&typeof c=="string"&&(a.format=c);let p=this._getValue(s,d.aml.vocabularies.shapes.multipleOf,r);typeof p=="number"&&(a.multipleOf=p);let u=this._getValue(s,d.w3.shacl.minInclusive,r);typeof u=="number"&&(a.minimum=u,a.exclusiveMinimum=!1);let h=this._getValue(s,d.w3.shacl.maxInclusive,r);typeof h=="number"&&(a.maximum=h,a.exclusiveMaximum=!1);let m=this._getValue(s,d.w3.shacl.minLength,r);typeof m=="number"&&(a.minLength=m);let f=this._getValue(s,d.w3.shacl.maxLength,r);return typeof f=="number"&&(a.maxLength=f),a}nodeShape(e,t={},i){let r=i||e["@context"],s=e,a=this.anyShape(s,t,r);if(this.isLink(s)){let h=this.getLinkTarget(s,r);h&&(s=h)}let n=this._getValue(s,d.aml.vocabularies.shapes.discriminator,r);n&&typeof n=="string"&&(a.discriminator=n);let l=this._getValue(s,d.aml.vocabularies.shapes.discriminatorValue,r);l&&typeof l=="string"&&(a.discriminatorValue=l);let c=this._getValue(s,d.w3.shacl.closed,r);typeof c=="boolean"&&(a.closed=c),a.customShapeProperties=[],a.customShapePropertyDefinitions=[],a.dependencies=[];let p=s[this._getAmfKey(d.w3.shacl.property,r)];Array.isArray(p)&&p.length?a.properties=p.map(h=>this.propertyShape(h,r)):a.properties=[];let u=s[this._getAmfKey(d.w3.shacl.additionalPropertiesSchema,r)];if(Array.isArray(u)&&u.length===1){let[h]=u;a.additionalPropertiesSchema=this.unknownShape(h,void 0,r)}return a}propertyShape(e,t){let i=t||e["@context"],r=e,s=this.shape(r,i);if(this.isLink(r)){let p=this.getLinkTarget(r,i);p&&(r=p)}let a=this._getLinkValue(r,d.w3.shacl.path,i);a&&typeof a=="string"&&(s.path=a);let n=this._getValue(r,d.w3.shacl.minCount,i);typeof n=="number"&&(s.minCount=n);let l=this._getValue(r,d.w3.shacl.maxCount,i);typeof l=="number"&&(s.maxCount=l);let c=r[this._getAmfKey(d.aml.vocabularies.shapes.range,i)];if(Array.isArray(c)&&c.length){let[p]=c;s.range=this.unknownShape(p,void 0,i)}return s}unionShape(e,t={},i){let r=i||e["@context"],s=e[this._getAmfKey(d.aml.vocabularies.shapes.anyOf,r)],a=this.anyShape(e,t,r);if(Array.isArray(s)&&s.length){let n={...t,trackedId:void 0};a.anyOf=s.map(l=>this.unknownShape(l,n,r))}else a.anyOf=[];return a}fileShape(e,t={},i){let r=i||e["@context"],s=e,a=this.anyShape(s,t,r);if(this.isLink(s)){let b=this.getLinkTarget(s,r);b&&(s=b)}let n=this._getValue(s,d.w3.shacl.pattern,r);n&&typeof n=="string"&&(a.pattern=n);let l=this._getValueArray(s,d.aml.vocabularies.shapes.fileType,r);Array.isArray(l)&&l.length&&(a.fileTypes=l);let c=this._getValue(s,d.w3.shacl.minLength,r);typeof c=="number"&&(a.minLength=c);let p=this._getValue(s,d.w3.shacl.maxLength,r);typeof p=="number"&&(a.maxLength=p);let u=this._getValue(s,d.w3.shacl.minInclusive,r);typeof u=="number"&&(a.minimum=u,a.exclusiveMinimum=!1);let h=this._getValue(s,d.w3.shacl.maxInclusive,r);typeof h=="number"&&(a.maximum=h,a.exclusiveMaximum=!1);let m=this._getValue(s,d.aml.vocabularies.shapes.format,r);m&&typeof m=="string"&&(a.format=m);let f=this._getValue(s,d.aml.vocabularies.shapes.multipleOf,r);return typeof f=="number"&&(a.multipleOf=f),a}schemaShape(e,t={},i){let r=i||e["@context"],s=e,a=this.anyShape(s,t,r);if(this.isLink(s)){let c=this.getLinkTarget(s,r);c&&(s=c)}let n=this._getValue(s,d.aml.vocabularies.core.mediaType,r);n&&typeof n=="string"&&(a.mediaType=n);let l=this._getValue(s,d.aml.vocabularies.document.raw,r);return l&&typeof l=="string"&&(a.raw=l),a}recursiveShape(e,t){let i=t||e["@context"],r=e,s=this.shape(r,i);if(this.isLink(r)){let n=this.getLinkTarget(r,i);n&&(r=n)}let a=this._getLinkValue(r,d.aml.vocabularies.shapes.fixPoint,i);return a&&typeof a=="string"&&(s.fixPoint=a),s}dataArrangeShape(e,t={},i){let r=i||e["@context"];return this.anyShape(e,t,r)}arrayShape(e,t={},i){let r=i||e["@context"],s=e,a=this.dataArrangeShape(s,t,r);if(this.isLink(s)){let l=this.getLinkTarget(s,r);l&&(s=l)}let n=s[this._getAmfKey(d.aml.vocabularies.shapes.items,r)];if(Array.isArray(n)&&n.length){let[l]=n;a.items=this.unknownShape(l,void 0,r)}return a}tupleShape(e,t,i){let r=i||e["@context"],s=e,a=this.dataArrangeShape(s,t,r);if(this.isLink(s)){let c=this.getLinkTarget(s,r);c&&(s=c)}let n=s[this._getAmfKey(d.aml.vocabularies.shapes.items,r)],l=this._getAmfKey(d.w3.rdfSchema.key,r);return Array.isArray(n)&&n.length?(a.items=[],n.forEach(c=>{Array.isArray(c)&&([c]=c),Object.keys(c).filter(p=>p.startsWith(l)).forEach(p=>{let u=c[p];Array.isArray(u)&&([u]=u);let h=this.unknownShape(u,void 0,r);a.items.push(h)})})):a.items=[],a}documentation(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getLinkValue(e,d.aml.vocabularies.core.url,i);s&&typeof s=="string"&&(r.url=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(r.description=a);let n=this._getValue(e,d.aml.vocabularies.core.title,i);return n&&typeof n=="string"&&(r.title=n),r}example(e,t){let i=t||e["@context"];this._resolve(e);let r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),strict:!1},s=this._getValue(e,d.aml.vocabularies.document.strict,i);typeof s=="boolean"&&(r.strict=s);let a=this._getValue(e,d.aml.vocabularies.core.name,i);a&&typeof a=="string"&&(r.name=a);let n=this._getValue(e,d.aml.vocabularies.core.displayName,i);n&&typeof n=="string"&&(r.displayName=n);let l=this._getValue(e,d.aml.vocabularies.core.description,i);l&&typeof l=="string"&&(r.description=l);let c=this._getValue(e,d.aml.vocabularies.document.raw,i);c&&typeof c=="string"&&(r.value=c);let p=this._getValue(e,d.aml.vocabularies.document.location,i);p&&typeof p=="string"&&(r.location=p);let u=e[this._getAmfKey(d.aml.vocabularies.document.structuredValue,i)];if(Array.isArray(u)&&u.length){let[h]=u;r.structuredValue=this.unknownDataNode(h,i)}return r}xmlSerializer(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.shapes.xmlAttribute,i);typeof s=="boolean"&&(r.attribute=s);let a=this._getValue(e,d.aml.vocabularies.shapes.xmlWrapped,i);typeof a=="boolean"&&(r.wrapped=a);let n=this._getValue(e,d.aml.vocabularies.shapes.xmlName,i);n&&typeof n=="string"&&(r.name=n);let l=this._getValue(e,d.aml.vocabularies.shapes.xmlNamespace,i);l&&typeof l=="string"&&(r.namespace=l);let c=this._getValue(e,d.aml.vocabularies.shapes.xmlPrefix,i);return c&&typeof c=="string"&&(r.prefix=c),r}unknownDataNode(e,t){let i=this.readTypes(e["@type"],t);if(i.includes(d.aml.vocabularies.data.Scalar))return this.scalarNode(e,t);if(i.includes(d.aml.vocabularies.data.Object))return this.objectNode(e,t);if(i.includes(d.aml.vocabularies.data.Array))return this.arrayNode(e,t)}dataNode(e,t){let i={id:e["@id"],types:this.readTypes(e["@type"],t),customDomainProperties:this.customDomainProperties(e,t)},r=this._getValue(e,d.aml.vocabularies.core.name,t);return r&&typeof r=="string"&&(i.name=r),i}scalarNode(e,t){let i=t||e["@context"],r=this.dataNode(e,t),s=this._getValue(e,d.aml.vocabularies.data.value,i);s&&typeof s=="string"&&(r.value=s);let a=this._getLinkValue(e,d.w3.shacl.datatype,i);return a&&typeof a=="string"&&(r.dataType=a),r}objectNode(e,t){let i=t||e["@context"],r=this.dataNode(e,t);r.properties={};let s=d.aml.vocabularies.data.key,a=`${this._getAmfKey(s,i)}:`;return Object.keys(e).forEach(n=>{if(n.startsWith(s)||n.startsWith(a)){let l=e[n];Array.isArray(l)&&([l]=l);let c=n.replace(s,"").replace(a,""),p=this.unknownDataNode(l,t);p&&(r.properties[c]=p)}}),r}arrayNode(e,t){let i=t||e["@context"],r=this.dataNode(e,i);r.members=[];let s=this._computePropertyArray(e,d.w3.rdfSchema.member);return Array.isArray(s)&&s.length&&s.forEach(a=>{let n=this.unknownDataNode(a);n&&r.members.push(n)}),r}customDomainProperties(e,t){let i=[],r=t||e["@context"],s=this._getLinkValues(e,d.aml.vocabularies.document.customDomainProperties,r);return Array.isArray(s)&&s.length&&s.forEach(a=>{let n=`@base:${a}`,l=e[a]||e[n];if(!l)return;Array.isArray(l)&&([l]=l);let c=this.unknownDataNode(l,r),p=this._getValue(l,d.aml.vocabularies.core.extensionName,r);if(!p||!c)return;let u={id:a,name:p,extension:c};i.push(u)}),i}endPoint(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e),path:"",operations:[],parameters:[],payloads:[],servers:[],security:[],extends:[]},s=this._getValue(e,d.aml.vocabularies.apiContract.path,i);s&&typeof s=="string"&&(r.path=s);let a=this._getValue(e,d.aml.vocabularies.core.name,i);a&&typeof a=="string"&&(r.name=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(r.description=n);let l=this._getValue(e,d.aml.vocabularies.core.summary,i);l&&typeof l=="string"&&(r.summary=l);let c=this[fe](e,d.aml.vocabularies.apiContract.supportedOperation,i);Array.isArray(c)&&c.length&&(r.operations=c.map(b=>this.operation(b,i)));let p=this[fe](e,d.aml.vocabularies.apiContract.parameter,i);Array.isArray(p)&&p.length&&(r.parameters=p.map(b=>this.parameter(b,i)));let u=this[fe](e,d.aml.vocabularies.apiContract.payload,i);Array.isArray(u)&&u.length&&(r.payloads=u.map(b=>this.payload(b,i)));let h=this[fe](e,d.aml.vocabularies.apiContract.server,i);Array.isArray(h)&&h.length&&(r.servers=h.map(b=>this.server(b,i)));let m=this[fe](e,d.aml.vocabularies.security.security,i);Array.isArray(m)&&m.length&&(r.security=m.map(b=>this.securityRequirement(b,i)));let f=this[fe](e,d.aml.vocabularies.document.extends,i);return Array.isArray(f)&&f.length&&(r.extends=[],f.forEach(b=>{let k=b;Array.isArray(k)&&([k]=k),this._hasType(k,d.aml.vocabularies.apiContract.ParametrizedResourceType,i)?r.extends.push(this.parametrizedResourceType(k,i)):this._hasType(k,d.aml.vocabularies.apiContract.ParametrizedTrait,i)&&r.extends.push(this.parametrizedTrait(k,i))})),r}operation(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e),method:"",deprecated:!1,callbacks:[],responses:[],servers:[],security:[],accepts:[],schemes:[],contentType:[],tags:[],extends:[]},s=this._getValue(e,d.aml.vocabularies.apiContract.method,i);s&&typeof s=="string"&&(r.method=s);let a=this._getValue(e,d.aml.vocabularies.core.name,i);a&&typeof a=="string"&&(r.name=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(r.description=n);let l=this._getValue(e,d.aml.vocabularies.apiContract.guiSummary,i);l&&typeof l=="string"&&(r.summary=l);let c=this._getValue(e,d.aml.vocabularies.core.deprecated,i);typeof c=="boolean"&&(r.deprecated=c);let p=this._getValue(e,d.aml.vocabularies.apiContract.operationId,i);p&&typeof p=="string"&&(r.operationId=p);let u=this._getValueArray(e,d.aml.vocabularies.apiContract.accepts,i);Array.isArray(u)&&(r.accepts=u);let h=this._getValueArray(e,d.aml.vocabularies.apiContract.scheme,i);Array.isArray(h)&&(r.schemes=h);let m=this._getValueArray(e,d.aml.vocabularies.apiContract.contentType,i);Array.isArray(m)&&(r.contentType=m);let f=e[this._getAmfKey(d.aml.vocabularies.apiContract.expects,i)];f&&(Array.isArray(f)&&([f]=f),r.request=this.request(f,i));let b=e[this._getAmfKey(d.aml.vocabularies.core.documentation,i)];b&&(Array.isArray(b)&&([b]=b),r.documentation=this.documentation(b,i));let k=e[this._getAmfKey(d.aml.vocabularies.apiContract.returns,i)];Array.isArray(k)&&(r.responses=k.map(E=>this.response(E,i)));let S=e[this._getAmfKey(d.aml.vocabularies.apiContract.callback,i)];Array.isArray(S)&&(r.callbacks=S.map(E=>this.callback(E,i)));let I=e[this._getAmfKey(d.aml.vocabularies.apiContract.server,i)];Array.isArray(I)&&(r.servers=I.map(E=>this.server(E)));let D=e[this._getAmfKey(d.aml.vocabularies.security.security,i)];Array.isArray(D)&&(r.security=D.map(E=>this.securityRequirement(E,i)));let w=e[this._getAmfKey(d.aml.vocabularies.apiContract.tag,i)];Array.isArray(w)&&w.length&&(r.tags=w.map(E=>this.tag(E,i)));let v=e[this._getAmfKey(d.aml.vocabularies.document.extends,i)];return Array.isArray(v)&&v.length&&(r.extends=v.map(E=>this.parametrizedTrait(E,i))),r}tag(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e),name:""},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(r.description=a);let n=e[this._getAmfKey(d.aml.vocabularies.core.documentation,i)];return n&&(Array.isArray(n)&&([n]=n),r.documentation=this.documentation(n,i)),r}tagListItem(e,t){let i=t||e["@context"],r={id:e["@id"],name:""},s=this._getValue(e,d.aml.vocabularies.core.name,i);return s&&typeof s=="string"&&(r.name=s),r}callback(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.apiContract.expression,i);a&&typeof a=="string"&&(r.expression=a);let n=e[this._getAmfKey(d.aml.vocabularies.apiContract.endpoint,i)];return n&&(Array.isArray(n)&&([n]=n),r.endpoint=this.endPoint(n,i)),r}request(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e),required:!1,headers:[],queryParameters:[],payloads:[],uriParameters:[],cookieParameters:[]},s=this._getValue(e,d.aml.vocabularies.core.description,i);s&&typeof s=="string"&&(r.description=s);let a=this._getValue(e,d.aml.vocabularies.apiContract.required,i);a&&typeof a=="boolean"&&(r.required=a);let n=e[this._getAmfKey(d.aml.vocabularies.apiContract.queryString,i)];n&&(Array.isArray(n)&&([n]=n),r.queryString=this.unknownShape(n,void 0,i));let l=this[fe](e,d.aml.vocabularies.apiContract.header,i);Array.isArray(l)&&l.length&&(r.headers=l.map(m=>this.parameter(m,i)));let c=this[fe](e,d.aml.vocabularies.apiContract.parameter,i);Array.isArray(c)&&c.length&&(r.queryParameters=c.map(m=>this.parameter(m,i)));let p=this[fe](e,d.aml.vocabularies.apiContract.uriParameter,i);Array.isArray(p)&&p.length&&(r.uriParameters=p.map(m=>this.parameter(m,i)));let u=this[fe](e,d.aml.vocabularies.apiContract.cookieParameter,i);Array.isArray(u)&&u.length&&(r.cookieParameters=u.map(m=>this.parameter(m,i)));let h=this[fe](e,d.aml.vocabularies.apiContract.payload,i);return Array.isArray(h)&&h.length&&(r.payloads=h.map(m=>this.payload(m,i))),r}response(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),headers:[],payloads:[],examples:[],links:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(r.description=a);let n=this._getValue(e,d.aml.vocabularies.apiContract.statusCode,i);n&&typeof n=="string"&&(r.statusCode=n);let l=this[fe](e,d.aml.vocabularies.apiContract.header,i);Array.isArray(l)&&l.length&&(r.headers=l.map(h=>this.parameter(h,i)));let c=this[fe](e,d.aml.vocabularies.apiContract.payload,i);Array.isArray(c)&&c.length&&(r.payloads=c.map(h=>this.payload(h,i)));let p=e[this._getAmfKey(d.aml.vocabularies.apiContract.examples,i)];Array.isArray(p)&&p.length&&(r.examples=p.map(h=>this.example(h,i)));let u=e[this._getAmfKey(d.aml.vocabularies.apiContract.link,i)];return Array.isArray(u)&&u.length&&(r.links=u.map(h=>this.templatedLink(h,i))),r}payload(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),examples:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.mediaType,i);a&&typeof a=="string"&&(r.mediaType=a);let n=e[this._getAmfKey(d.aml.vocabularies.shapes.schema,i)];n&&(Array.isArray(n)&&([n]=n),r.schema=this.unknownShape(n,{trackedId:r.id},i));let l=e[this._getAmfKey(d.aml.vocabularies.apiContract.examples,i)];return Array.isArray(l)&&l.length&&(r.examples=l.map(c=>this.example(c,i))),r}templatedLink(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),mapping:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);a&&typeof a=="string"&&(r.description=a);let n=this._getValue(e,d.aml.vocabularies.apiContract.operationId,i);n&&typeof n=="string"&&(r.operationId=n);let l=e[this._getAmfKey(d.aml.vocabularies.apiContract.server,i)];l&&(Array.isArray(l)&&([l]=l),r.server=this.server(l,i));let c=e[this._getAmfKey(d.aml.vocabularies.apiContract.mapping,i)];return c&&(c&&!Array.isArray(c)&&(c=[c]),c&&(r.mapping=c.map(p=>this.iriTemplateMapping(p,i)))),r}iriTemplateMapping(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.apiContract.templateVariable,i);s&&typeof s=="string"&&(r.templateVariable=s);let a=this._getValue(e,d.aml.vocabularies.apiContract.linkExpression,i);return a&&typeof a=="string"&&(r.linkExpression=a),r}parametrizedSecurityScheme(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=e[this._getAmfKey(d.aml.vocabularies.security.scheme,i)];a&&(Array.isArray(a)&&([a]=a),r.scheme=this.securityScheme(a,i));let n=e[this._getAmfKey(d.aml.vocabularies.security.settings,i)];return n&&(Array.isArray(n)&&([n]=n),r.settings=this.securitySettings(n,i)),r}securitySchemeListItem(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),type:""},s=this._getValue(e,d.aml.vocabularies.security.type,i);s&&typeof s=="string"&&(r.type=s);let a=this._getValue(e,d.aml.vocabularies.core.name,i);a&&typeof a=="string"&&(r.name=a);let n=this._getValue(e,d.aml.vocabularies.core.displayName,i);return n&&typeof n=="string"&&(r.displayName=n),r}securityScheme(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),headers:[],queryParameters:[],responses:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.displayName,i);a&&typeof a=="string"&&(r.displayName=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(r.description=n);let l=this._getValue(e,d.aml.vocabularies.security.type,i);l&&typeof l=="string"&&(r.type=l);let c=e[this._getAmfKey(d.aml.vocabularies.security.settings,i)];c&&(Array.isArray(c)&&([c]=c),r.settings=this.securitySettings(c,i));let p=e[this._getAmfKey(d.aml.vocabularies.apiContract.queryString,i)];p&&(Array.isArray(p)&&([p]=p),r.queryString=this.unknownShape(p,void 0,i));let u=this[fe](e,d.aml.vocabularies.apiContract.header,i);Array.isArray(u)&&u.length&&(r.headers=u.map(f=>this.parameter(f,i)));let h=this[fe](e,d.aml.vocabularies.apiContract.parameter,i);Array.isArray(h)&&h.length&&(r.queryParameters=h.map(f=>this.parameter(f,i)));let m=this[fe](e,d.aml.vocabularies.apiContract.response,i);return Array.isArray(m)&&m.length&&(r.responses=m.map(f=>this.response(f,i))),r}securityRequirement(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),schemes:[]},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=e[this._getAmfKey(d.aml.vocabularies.security.schemes,i)];return Array.isArray(a)&&a.length&&(r.schemes=a.map(n=>this.parametrizedSecurityScheme(n,i))),r}securitySettings(e,t){let i=t||e["@context"],r=this.readTypes(e["@type"],i);return r.includes(d.aml.vocabularies.security.OAuth1Settings)?this.oAuth1Settings(e,i):r.includes(d.aml.vocabularies.security.OAuth2Settings)?this.oAuth2Settings(e,i):r.includes(d.aml.vocabularies.security.ApiKeySettings)?this.apiKeySettings(e,i):r.includes(d.aml.vocabularies.security.HttpSettings)?this.httpSettings(e,i):r.includes(d.aml.vocabularies.security.OpenIdConnectSettings)?this.openIdConnectSettings(e,i):this.settings(e,i)}settings(e,t){let i=t||e["@context"];return{id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)}}oAuth1Settings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValue(e,d.aml.vocabularies.security.authorizationUri,i);s&&typeof s=="string"&&(r.authorizationUri=s);let a=this._getValue(e,d.aml.vocabularies.security.requestTokenUri,i);a&&typeof a=="string"&&(r.requestTokenUri=a);let n=this._getValue(e,d.aml.vocabularies.security.tokenCredentialsUri,i);n&&typeof n=="string"&&(r.tokenCredentialsUri=n);let l=this._getValueArray(e,d.aml.vocabularies.security.signature,i);return Array.isArray(l)&&l.length?r.signatures=l:r.signatures=[],r}oAuth2Settings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValueArray(e,d.aml.vocabularies.security.authorizationGrant,i);Array.isArray(s)&&s.length?r.authorizationGrants=s:r.authorizationGrants=[];let a=e[this._getAmfKey(d.aml.vocabularies.security.flows,i)];return Array.isArray(a)&&a.length?r.flows=a.map(n=>this.oAuth2Flow(n,i)):r.flows=[],r}oAuth2Flow(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),scopes:[],sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.security.authorizationUri,i);s&&typeof s=="string"&&(r.authorizationUri=s);let a=this._getValue(e,d.aml.vocabularies.security.accessTokenUri,i);a&&typeof a=="string"&&(r.accessTokenUri=a);let n=this._getValue(e,d.aml.vocabularies.security.flow,i);n&&typeof n=="string"&&(r.flow=n);let l=this._getValue(e,d.aml.vocabularies.security.refreshUri,i);l&&typeof l=="string"&&(r.refreshUri=l);let c=e[this._getAmfKey(d.aml.vocabularies.security.scope,i)];return Array.isArray(c)&&c.length&&(r.scopes=c.map(p=>this.scope(p,i))),r}scope(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.core.description,i);return a&&typeof a=="string"&&(r.description=a),r}apiKeySettings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=this._getValue(e,d.aml.vocabularies.security.in,i);return a&&typeof a=="string"&&(r.in=a),r}httpSettings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValue(e,d.aml.vocabularies.security.scheme,i);s&&typeof s=="string"&&(r.scheme=s);let a=this._getValue(e,d.aml.vocabularies.security.bearerFormat,i);return a&&typeof a=="string"&&(r.bearerFormat=a),r}openIdConnectSettings(e,t){let i=t||e["@context"],r=this.settings(e,i),s=this._getValue(e,d.aml.vocabularies.security.openIdConnectUrl,i);return s&&typeof s=="string"&&(r.url=s),r}sourceMap(e,t){let i=t||e["@context"],r=e[this._getAmfKey(d.aml.vocabularies.docSourceMaps.sources,i)];if(!r)return;Array.isArray(r)&&([r]=r);let s={id:r["@id"],types:this.readTypes(r["@type"])},a=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.synthesizedField,i)];Array.isArray(a)&&a.length&&(s.synthesizedField=a.map(h=>this.synthesizedField(h,i)));let n=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.lexical,i)];Array.isArray(n)&&n.length&&(s.lexical=n.map(h=>this.synthesizedField(h,i)));let l=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.trackedElement,i)];Array.isArray(l)&&l.length&&(s.trackedElement=this.synthesizedField(l[0],i));let c=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.autoGeneratedName,i)];Array.isArray(c)&&c.length&&(s.autoGeneratedName=c.map(h=>this.synthesizedField(h,i)));let p=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.parsedJsonSchema,i)];Array.isArray(p)&&p.length&&(s.parsedJsonSchema=this.synthesizedField(p[0],i));let u=r[this._getAmfKey(d.aml.vocabularies.docSourceMaps.declaredElement,i)];return Array.isArray(u)&&u.length&&(s.declaredElement=this.synthesizedField(u[0],i)),s}synthesizedField(e,t){if(typeof e=="string")return{id:"synthesizedField/generated",value:e};let i={id:e["@id"],value:""},r=this._getValue(e,d.aml.vocabularies.docSourceMaps.element,t);typeof r=="string"&&(i.element=r);let s=this._getValue(e,d.aml.vocabularies.docSourceMaps.value,t);return typeof s=="string"&&(i.value=s),i}parametrizedDeclaration(e,t){let i=t||e["@context"],r={id:e["@id"],types:this.readTypes(e["@type"],i),variables:[],customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i)},s=this._getValue(e,d.aml.vocabularies.core.name,i);s&&typeof s=="string"&&(r.name=s);let a=e[this._getAmfKey(d.aml.vocabularies.document.variable,i)];Array.isArray(a)&&a.forEach(l=>{r.variables.push(this.variableValue(l,i))});let n=e[this._getAmfKey(d.aml.vocabularies.document.target,i)];if(Array.isArray(n)&&n.length){let[l]=n;r.target=this.abstractDeclaration(l,i)}return r}parametrizedTrait(e,t){let i=t||e["@context"];return this.parametrizedDeclaration(e,i)}parametrizedResourceType(e,t){let i=t||e["@context"];return this.parametrizedDeclaration(e,i)}variableValue(e,t){let i=t||e["@context"],r=this._getValue(e,d.aml.vocabularies.core.name,i),s={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),name:r},a=e[this._getAmfKey(d.aml.vocabularies.document.value,i)];if(Array.isArray(a)){let[n]=a;s.value=this.unknownDataNode(n,i)}return s}abstractDeclaration(e,t){let i=t||e["@context"],r=this._getValue(e,d.aml.vocabularies.core.name,i),s={id:e["@id"],types:this.readTypes(e["@type"],i),customDomainProperties:this.customDomainProperties(e,i),sourceMaps:this.sourceMap(e,i),name:r,variables:[]},a=this._getValueArray(e,d.aml.vocabularies.document.variable,i);Array.isArray(a)&&(s.variables=a);let n=this._getValue(e,d.aml.vocabularies.core.description,i);n&&typeof n=="string"&&(s.description=n);let l=e[this._getAmfKey(d.aml.vocabularies.document.dataNode,i)];if(Array.isArray(l)){let[c]=l;s.dataNode=this.unknownDataNode(c,i)}return s}endPointWithOperationsListItem(e,t){let i=this._getValue(e,d.aml.vocabularies.apiContract.path,t),r={id:e["@id"],path:i,operations:[]},s=this[fe](e,d.aml.vocabularies.apiContract.supportedOperation,t);Array.isArray(s)&&s.length&&(r.operations=s.map(n=>this.operationListItem(n,t)));let a=this._getValue(e,d.aml.vocabularies.core.name,t);return a&&typeof a=="string"&&(r.name=a),r}operationListItem(e,t){let i={id:e["@id"],method:""},r=this._getValue(e,d.aml.vocabularies.apiContract.method,t);r&&typeof r=="string"&&(i.method=r);let s=this._getValue(e,d.aml.vocabularies.core.name,t);return s&&typeof s=="string"&&(i.name=s),i}};var Jt=class o{mime;opts;generator;constructor(e,t={}){this.mime=e,this.opts=Object.freeze({...t}),e.includes("json")?this.generator=new Di(t):e.includes("xml")&&(this.generator=new zi(t))}static asExample(e,t,i){return new o(t,i).toExample(e)}static asSchema(e,t,i){return new o(t,i).toValue(e)}generate(e){let{generator:t}=this;if(t)return t.generate(e)}toValue(e){return this.generate(e)}toExample(e){let t=this.generate(e);if(t==null)return;let i={id:`${e.id}/generated`,strict:!0,types:[d.aml.vocabularies.apiContract.Example],mediaType:this.mime,renderValue:t,customDomainProperties:[]},r=e;if(Array.isArray(r.examples)&&r.examples.length){let[s]=r.examples;s.value&&(i.value=s.value)}return i}};var ni=Object.freeze({processApiLink:"amfprocessapilink",processBuffer:"amfprocessbuffer",processApiFile:"amfprocessapifile",selectApiMainFile:"amfselectapimainfile"});var Bc=Object.freeze({processApiLink:async(o,e,t,i,r=globalThis)=>{let s=new CustomEvent(ni.processApiLink,{bubbles:!0,composed:!0,cancelable:!0,detail:{url:o,mainFile:e,md5:t,packaging:i}});return r.dispatchEvent(s),s.detail.result},processBuffer:async(o,e,t=globalThis)=>{let i=new CustomEvent(ni.processBuffer,{bubbles:!0,composed:!0,cancelable:!0,detail:{buffer:o,opts:e}});return t.dispatchEvent(i),i.detail.result},processApiFile:async(o,e=globalThis)=>{let t=new CustomEvent(ni.processApiFile,{bubbles:!0,composed:!0,cancelable:!0,detail:{file:o}});return e.dispatchEvent(t),t.detail.result},selectApiMainFile:async(o,e=globalThis)=>{let t=new CustomEvent(ni.selectApiMainFile,{bubbles:!0,composed:!0,cancelable:!0,detail:{candidates:o}});return e.dispatchEvent(t),t.detail.result}});var na=["string","number","boolean","date","datetime","time","binary","json"],Ui;(function(o){o.string="string",o.number="number",o.boolean="boolean",o.date="date",o.datetime="datetime",o.time="time",o.file="binary",o.json="json"})(Ui||(Ui={}));var Un=["required","multiple","primary","index","unique","search","readOnly","writeOnly","deprecated"],Mn=["required","multiple"],Vn=["float","double","int32","int64"];function Ur(o,e){return o==="number"?e?.format==="int32"||e?.format==="int64"?d.w3.xmlSchema.integer:d.w3.xmlSchema.number:o==="boolean"?d.aml.vocabularies.shapes.boolean:o==="date"?d.w3.xmlSchema.date:o==="datetime"?d.w3.xmlSchema.dateTime:o==="time"?d.aml.vocabularies.shapes.dateTimeOnly:d.w3.xmlSchema.string}var qt=Symbol("noValue"),Mi=class{increment=0;static noValue=qt;generate(e,t){return t==="string"?this.generateString(e):t==="number"?this.generateNumber(e):t==="date"?this.generateDate(e):t==="time"?this.generateTime(e):t==="datetime"?this.generateDateTime(e):qt}generateString(e){switch(e){case"random":return q(8);case"uuid-v4":return crypto.randomUUID();default:return qt}}generateNumber(e){return e==="incremental"?`${this.increment++}`:qt}generateDate(e){if(e==="now"){let t=new Date,i=t.getFullYear(),r=`${t.getMonth()+1}`.padStart(2,"0"),s=`${t.getDate()}`.padStart(2,"0");return`${i}-${r}-${s}`}return qt}generateTime(e){if(e==="now"){let t=new Date,i=`${t.getHours()}`.padStart(2,"0"),r=`${t.getMinutes()}`.padStart(2,"0"),s=`${t.getSeconds()}`.padStart(2,"0");return`${i}:${r}:${s}`}return qt}generateDateTime(e){if(e==="now"){let t=new Date,i=t.getFullYear(),r=`${t.getMonth()+1}`.padStart(2,"0"),s=`${t.getDate()}`.padStart(2,"0"),a=`${t.getHours()}`.padStart(2,"0"),n=`${t.getMinutes()}`.padStart(2,"0"),l=`${t.getSeconds()}`.padStart(2,"0");return`${i}-${r}-${s}T${a}:${n}:${l}`}return qt}};var oa="anyOf",Gc="allOf",Hc="oneOf",Wc="not",la="string",Ln="binary",Tt=class{#e;get valueGenerator(){return this.#e||(this.#e=new Mi),this.#e}entity(e,t=new Set){if(t.has(e.key))return this.createRecursiveShape(e);t.add(e.key);let i=Ie.nodeShape(e.key);i.id=e.key,this.updateBaseProperties(e,i),i.properties=[];for(let r of e.listProperties()){let s=r.readBinding("web");if(s&&s.hidden)continue;let a=this.property(r);i.properties.push(a)}for(let r of e.listAssociations()){let s=r.readBinding("web");if(s&&s.hidden)continue;let a=this.associationProperty(r,t);i.properties.push(a)}for(let r of e.listParents()){let s=this.entity(r,t);i.inherits.push(s)}return i}property(e){let{required:t,key:i}=e,r=Ie.propertyShape(i);return r.path=`${d.aml.vocabularies.data.key}${e.info.name}`,t&&(r.minCount=1),r.range=this.getRange(e),this.updateBaseProperties(e,r),r.range.name&&(r.name=r.range.name),r}associationProperty(e,t=new Set){let{required:i,key:r}=e,s=Ie.propertyShape(r);return s.path=`${d.aml.vocabularies.data.key}${e.info.name}`,i&&(s.minCount=1),s.range=this.associationShape(e,t),this.updateBaseProperties(e,s),s}associationShape(e,t=new Set){let i=e.schema;if(!i?.embedded)return this.createLinkedShape(e);let r=this.associationUnion(e,t);if(!r)return;if(Array.isArray(r))return this.createUnionShape(e,r);if((i&&i.unionType||oa)===Wc){let a=Ie.anyShape(e.key);return a.id=`not-shape-${e.key}`,a.not=r,a}return e.multiple?this.refactorShapeToArray(e.key,r):r}createLinkedShape(e){let t=Ie.scalarShape(e.key);return t.id=`link-${e.key}`,t.dataType=Ur(la),t}createUnionShape(e,t){let i=Ie.unionShape(e.key);this.updateBaseProperties(e,i),i.anyOf=[];let r=e.schema&&e.schema.unionType||oa;return r===oa?i.anyOf=t:r===Gc?i.and=t:r===Hc?i.xone=t:i.not=t[0],e.multiple?this.refactorShapeToArray(e.key,i):i}associationUnion(e,t=new Set){let i=[];for(let r of e.listTargets())i.push(this.entity(r,t));if(i.length)return i.length>1?i:i[0]}getRange(e){let t=e.readBinding("web"),i;e.schema&&(i=e.schema);let{multiple:r,type:s}=e;return r?this.createArrayShape(e,i,t):s===Ln?this.createFileShape(e,t):this.createScalarShape(e,i,t)}setShapeSchema(e,t,i,r,s){if(i.defaultValue){let{type:a}=i.defaultValue,{value:n}=i.defaultValue;if(a==="function"){let l=this.valueGenerator.generate(n,e.type);if(l!==Mi.noValue){let c=it.scalar(l,a);t.defaultValue=c.toJSON()}}else{let l=it.scalar(n,r);t.defaultValue=l.toJSON()}}Array.isArray(i.enum)&&(t.values=i.enum.map(a=>it.scalar(a,r).toJSON())),Array.isArray(i.examples)&&(s?t.examples=this.createArrayExamples(i.examples,r):t.examples=this.createExamples(i.examples,r))}createArrayShape(e,t,i){let r=Ie.arrayShape(e.key),{type:s}=e;if(s===Ln?r.items=this.createFileShape(e,i):r.items=this.createScalarShape(e,void 0,i),t){let a=r.items.dataType;this.setShapeSchema(e,r,t,a,e.multiple)}return r}createScalarShape(e,t,i){let r=Ie.scalarShape(e.key);return this.updateBaseProperties(e,r),this.setScalarCommonProperties(r,e,i),r.dataType||(r.dataType=Ur(e.type,i)),t&&this.setShapeSchema(e,r,t,r.dataType,e.multiple),r}createExamples(e,t){let i=[];for(let r of e){let s={id:q(),customDomainProperties:[],strict:!0,types:[...ji.IAmfExampleTypes],structuredValue:it.scalar(r,t).toJSON()};i.push(s)}return i}createArrayExamples(e,t){let i={id:q(),customDomainProperties:[],strict:!0,types:[...ji.IAmfExampleTypes]},r=new it("array");for(let s of e){let a=it.scalar(s,t);r.addMember(a)}return i.structuredValue=r.toJSON(),[i]}createFileShape(e,t){let i=Ie.fileShape(e.key);return this.updateBaseProperties(e,i),t&&(Array.isArray(t.fileTypes)&&(i.fileTypes=t.fileTypes),this.setScalarCommonProperties(i,e,t)),i}setScalarCommonProperties(e,t,i){i?.name&&(e.name=i.name),i?.xml&&(e.xmlSerialization=i.xml);let{schema:r,type:s}=t;if(r&&(r.pattern&&(e.pattern=r.pattern),typeof r.multipleOf=="number"&&(e.multipleOf=r.multipleOf),typeof r.minimum=="number"&&(s===la?e.minLength=r.minimum:e.minimum=r.minimum),typeof r.maximum=="number"&&(s===la?e.maxLength=r.maximum:e.maximum=r.maximum),typeof r.exclusiveMinimum=="boolean"&&(e.exclusiveMinimum=r.exclusiveMinimum),typeof r.exclusiveMaximum=="boolean"&&(e.exclusiveMaximum=r.exclusiveMaximum)),i?.format)switch(i.format){case"double":e.format=d.w3.xmlSchema.double;break;case"float":e.format=d.w3.xmlSchema.float;break;case"int32":e.format=d.w3.xmlSchema.integer;break;case"int64":e.format=d.w3.xmlSchema.integer;break}typeof t.readOnly=="boolean"&&(e.readOnly=t.readOnly),typeof t.writeOnly=="boolean"&&(e.writeOnly=t.writeOnly);let a=r?.examples&&r.examples.length>0,n=r?.defaultValue?.value!==void 0;if(t.required&&!t.readOnly&&!a&&!n){let l="";t.type==="number"?l=0:t.type==="boolean"&&(l=!1);let c=("dataType"in e?e.dataType:void 0)||Ur(t.type,i);e.examples=this.createExamples([String(l)],c)}}updateBaseProperties(e,t){t.name=e.info.name,t.displayName=e.info.displayName,t.description=e.info.description,(e.kind===ne||e.kind===N)&&(t.deprecated=e.deprecated)}createRecursiveShape(e){return Ie.recursiveShape(e.key,e.key)}refactorShapeToArray(e,t){let i=Ie.arrayShape(e);return i.items=t,i}};var Dt=class o extends Me{kind;info;required;multiple;primary;unique;index;search;readOnly;writeOnly;deprecated;tags=[];semantics=[];type="string";jsonSchema;jsonIndex;schema;bindings=[];lineage;static createSchema(e={}){let{key:t=q(),multiple:i,required:r,type:s=Ui.string,index:a,search:n,primary:l,unique:c,readOnly:p,writeOnly:u,tags:h,semantics:m,deprecated:f,schema:b,bindings:k,jsonSchema:S,jsonIndex:I,lineage:D}=e;if(typeof s=="string"&&!na.includes(s))throw new Error(`Invalid data property type ${s}`);let w=ie.fromJSON(e.info,{name:"new_property"}).toJSON(),v={kind:ne,key:t,info:w,type:s};return S&&(v.jsonSchema=structuredClone(S)),I&&(v.jsonIndex=structuredClone(I)),typeof i=="boolean"&&(v.multiple=i),typeof r=="boolean"&&(v.required=r),typeof a=="boolean"&&(v.index=a),typeof n=="boolean"&&(v.search=n),typeof l=="boolean"&&(v.primary=l),typeof c=="boolean"&&(v.unique=c),typeof p=="boolean"&&(v.readOnly=p),typeof u=="boolean"&&(v.writeOnly=u),typeof f=="boolean"&&(v.deprecated=f),Array.isArray(h)&&(v.tags=[...h]),Array.isArray(m)&&(v.semantics=[...m]),b&&(v.schema=structuredClone(b)),Array.isArray(k)?v.bindings=k.map(E=>structuredClone(E)):v.bindings=[],D&&(v.lineage=structuredClone(D)),v}parent;constructor(e,t,i={}){let r=o.createSchema(i);super(e,r.key),this.parent=t,this.kind=ne,this.info=new ie(r.info),this.type=r.type,typeof r.multiple=="boolean"&&(this.multiple=r.multiple),typeof r.required=="boolean"&&(this.required=r.required),typeof r.index=="boolean"&&(this.index=r.index),typeof r.search=="boolean"&&(this.search=r.search),typeof r.deprecated=="boolean"&&(this.deprecated=r.deprecated),typeof r.primary=="boolean"&&(this.primary=r.primary),typeof r.unique=="boolean"&&(this.unique=r.unique),typeof r.readOnly=="boolean"&&(this.readOnly=r.readOnly),typeof r.writeOnly=="boolean"&&(this.writeOnly=r.writeOnly),Array.isArray(r.tags)?this.tags=[...r.tags]:this.tags=[],Array.isArray(r.semantics)?this.semantics=[...r.semantics]:this.semantics=[],r.schema&&(this.schema=structuredClone(r.schema)),r.jsonSchema&&(this.jsonSchema=structuredClone(r.jsonSchema)),r.jsonIndex&&(this.jsonIndex=structuredClone(r.jsonIndex)),Array.isArray(r.bindings)?this.bindings=r.bindings.map(s=>structuredClone(s)):this.bindings=[],r.lineage&&(this.lineage=structuredClone(r.lineage))}static validate(e,t={}){if(!e||typeof e!="object"&&e!==null)return!1;let i=e;return!(t.strict&&i.kind!==ne)}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON(),type:this.type||Ui.string};return typeof this.index=="boolean"&&(e.index=this.index),typeof this.search=="boolean"&&(e.search=this.search),typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),typeof this.primary=="boolean"&&(e.primary=this.primary),typeof this.unique=="boolean"&&(e.unique=this.unique),typeof this.multiple=="boolean"&&(e.multiple=this.multiple),typeof this.required=="boolean"&&(e.required=this.required),typeof this.readOnly=="boolean"&&(e.readOnly=this.readOnly),typeof this.writeOnly=="boolean"&&(e.writeOnly=this.writeOnly),Array.isArray(this.tags)&&this.tags.length&&(e.tags=[...this.tags]),Array.isArray(this.semantics)&&this.semantics.length&&(e.semantics=this.semantics.map(t=>structuredClone(t))),this.schema&&(e.schema=structuredClone(this.schema)),this.jsonSchema&&(e.jsonSchema=structuredClone(this.jsonSchema)),this.jsonIndex&&(e.jsonIndex=structuredClone(this.jsonIndex)),Array.isArray(this.bindings)&&this.bindings.length&&(e.bindings=this.bindings.map(t=>structuredClone(t))),this.lineage&&(e.lineage=structuredClone(this.lineage)),e}remove(){this.getParentInstance()?.removeProperty(this.key)}getParentInstance(){return this.root.graph.node(this.parent)}static isValidType(e){return typeof e!="string"?!1:na.includes(e)}static isValidAttribute(e){return typeof e!="string"?!1:Un.includes(e)}static isValidFormat(e){return e===void 0?!0:typeof e!="string"?!1:!!Vn.includes(e)}ensureSchema(){return this.schema||(this.schema={}),this.schema}getWebBinding(){let e=this.bindings.find(t=>t.type==="web");return e||(e={type:"web",schema:{}},this.bindings.push(e)),e.schema}readWebBinding(){return this.bindings.find(t=>t.type==="web")?.schema}getExposedName(){let e=this.readWebBinding()?.name||this.info.name;if(!e)throw new g(`Property ${this.key} has no exposed name defined`,{code:"E_MISSING_EXPOSED_NAME",status:500});return e}readBinding(e){return this.bindings.find(i=>i.type===e)?.schema||void 0}toApiShape(){return new Tt().property(this)}toExample(e,t={}){let i=this.toApiShape();return i.range?new Jt(e,{renderExamples:t.renderExamples??!0,renderMocked:t.renderMocked??!0,renderOptional:t.renderOptional??!0,selectedUnions:t.selectedUnions}).generate(i):void 0}addSemantic(e){this.root.ensureWritable();let t=Be[e.id];if(!fr(t))throw new Error(`Invalid semantic type: ${e.id}. Expected a property semantic.`);let i=this.semantics.findIndex(r=>r.id===e.id);i>=0?this.semantics[i]=e:this.semantics.push(e)}removeSemantic(e){this.root.ensureWritable();let t=this.semantics.findIndex(i=>i.id===e);t>=0&&this.semantics.splice(t,1)}hasSemantic(e){return this.semantics.some(t=>t.id===e)}getSemantic(e){return this.semantics.find(t=>t.id===e)}duplicate(){let e=this.getParentInstance();if(!e)throw new Error(`Cannot duplicate property ${this.key} as it has no parent entity.`);let t=e.fields.findIndex(c=>c.key===this.key);if(t===-1)throw new Error(`Cannot duplicate property ${this.key} as it does not exist on the parent entity fields list.`);let i=this.info.name||"field",r=e.generateUniqueName(i),s=this.toJSON();delete s.key,delete s.primary,delete s.lineage,s.info?s.info.name=r:s.info={name:r};let a=e.addProperty(s),n=e.fields.length-1,l=e.fields[n];return e.fields.splice(n,1),e.fields.splice(t+1,0,l),a}setLineage(e,t){this.lineage={id:t,key:e.key,kind:e.kind},e.namespace!==this.root.key&&(this.lineage.domain=e.namespace)}};var zt=class extends g{static code="E_REMOVE_PROPERTY";static status=500;static message="Error removing a data property.";static help="Make sure the property exists and can be removed."};function Ee(o,e){if(!o.hasNode(e))return;let t=o.node(e);if(t){if(t.kind===ae){o.removeNode(e);return}for(let i of o.children(e))Ee(o,i);for(let i of o.outEdges(e)){let r=o.edge(i);r&&(r.type==="association"||r.type==="property")&&Ee(o,i.w)}o.removeNode(e)}}var oi=class o extends Me{kind;info;required;multiple;schema;bindings;parent;targets;semantics=[];onDelete;readOnly;fields;static createSchema(e={}){let{key:t=q(),semantics:i=[]}=e,r=ie.fromJSON(e.info,{name:"new_association"}).toJSON(),s={kind:ae,key:t,info:r};return Array.isArray(i)&&(s.semantics=[...i]),e.onDelete&&(s.onDelete=e.onDelete),typeof e.readOnly=="boolean"&&(s.readOnly=e.readOnly),e.schema&&(s.schema=structuredClone(e.schema)),typeof e.multiple=="boolean"&&(s.multiple=e.multiple),typeof e.required=="boolean"&&(s.required=e.required),Array.isArray(e.bindings)&&(s.bindings=e.bindings.map(a=>structuredClone(a))),Array.isArray(e.targets)&&(s.targets=e.targets.map(a=>({...a}))),Array.isArray(e.fields)&&(s.fields=[...e.fields]),s}constructor(e,t,i){let r=o.createSchema(i);super(e,r.key),this.parent=t,this.kind=ae,this.info=new ie(r.info),r.schema&&(this.schema=structuredClone(r.schema)),typeof r.multiple=="boolean"&&(this.multiple=r.multiple),typeof r.required=="boolean"&&(this.required=r.required),Array.isArray(r.bindings)?this.bindings=r.bindings.map(s=>structuredClone(s)):this.bindings=[],Array.isArray(r.targets)?this.targets=r.targets.map(s=>({...s})):this.targets=[],Array.isArray(r.semantics)?this.semantics=r.semantics.map(s=>structuredClone(s)):this.semantics=[],r.onDelete&&(this.onDelete=r.onDelete),Array.isArray(r.fields)?this.fields=[...r.fields]:this.fields=[],typeof r.readOnly=="boolean"&&(this.readOnly=r.readOnly)}addProperty(e){if(this.root.ensureWritable(),e&&e.key&&this.root.graph.hasNode(e.key))throw new Error(`Trying to add a property ${e.key}, but it already exists`);let t=new Dt(this.root,this.key,e);return this.root.graph.setNode(t.key,t),this.root.graph.setEdge(this.key,t.key,{type:"property"}),this.fields.push({type:"property",key:t.key}),t}get properties(){return this.listProperties()}*listProperties(){for(let{key:e}of this.fields){let t=this.root.graph.node(e);!t||t.kind!==ne||(yield t)}}removeProperty(e){this.root.ensureWritable();let t=this.fields.findIndex(r=>r.key===e&&r.type==="property");if(!this.root.graph.hasNode(e))throw new zt(`Trying to remove the ${e} property, but it doesn't exist`);if(this.root.graph.node(e).getParentInstance()!==this)throw new zt(`Trying to remove the ${e} property, but it doesn't belong to this association`);Ee(this.root.graph,e),t!==-1&&this.fields.splice(t,1)}generateUniqueName(e){let t=new Set;for(let s of this.listProperties())s.info.name&&t.add(s.info.name);let i=2,r=`${e}_copy`;for(;t.has(r);)r=`${e}_copy_${i}`,i++;return r}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON()};return this.schema&&(e.schema=structuredClone(this.schema)),typeof this.multiple=="boolean"&&(e.multiple=this.multiple),typeof this.required=="boolean"&&(e.required=this.required),Array.isArray(this.bindings)&&this.bindings.length&&(e.bindings=this.bindings.map(t=>structuredClone(t))),Array.isArray(this.fields)&&this.fields.length&&(e.fields=[...this.fields]),Array.isArray(this.targets)&&this.targets.length&&(e.targets=this.targets.map(t=>({...t}))),Array.isArray(this.semantics)&&this.semantics.length&&(e.semantics=this.semantics.map(t=>structuredClone(t))),this.onDelete&&(e.onDelete=this.onDelete),typeof this.readOnly=="boolean"&&this.readOnly&&(e.readOnly=this.readOnly),e}getParentInstance(){return this.root.graph.node(this.parent)}remove(){this.getParentInstance()?.removeAssociation(this.key)}ensureSchema(){return this.schema||(this.schema={}),this.schema}static isValidAttribute(e){return typeof e!="string"?!1:Mn.includes(e)}getWebBinding(){let e=this.bindings.find(t=>t.type==="web");return e||(e={type:"web",schema:{}},this.bindings.push(e)),e.schema}readWebBinding(){return this.bindings?.find(t=>t.type==="web")?.schema}getExposedName(){let e=this.readWebBinding()?.name||this.info.name;if(!e)throw new g(`Association ${this.key} has no exposed name defined`,{code:"E_MISSING_EXPOSED_NAME",status:500});return e}readBinding(e){return this.bindings.find(i=>i.type===e)?.schema||void 0}addTarget(e,t){this.root.ensureWritable();let i;if(typeof e=="string"?i=e:(i=e.key,e.domain.key!==this.root.key&&(t=e.domain.key)),t&&t===this.root.key&&(t=void 0),this.targets.some(n=>n.key===i&&n.domain===t)){let n=`Target ${i} already exists.`;throw new Error(n)}if(t&&!this.root.dependencies.has(t))throw new Error(`Foreign namespace "${t}" does not exist.`);let r={key:i};t&&(r.domain=t),this.targets.push(r);let s=t?`${t}:${i}`:i,a={type:"association"};t&&(a.domain=t,a.foreign=!0),this.root.graph.setEdge(this.key,s,a)}removeTarget(e){this.root.ensureWritable();let t;typeof e=="string"?t=e:t=e.key;let i=this.targets.findIndex(r=>r.key===t);i>=0&&this.targets.splice(i,1),this.root.graph.removeEdge(this.key,t)}*listTargets(){for(let e of this.targets){let{key:t,domain:i}=e,r=i?`${i}:${t}`:t,s=this.root.graph.node(r);s&&(yield s)}}toApiShape(){return new Tt().associationProperty(this)}checkPreconditions(e){let t=Be[e];if(!(!t||!gr(t)||!t.preconditions||t.preconditions.length===0)){for(let i of t.preconditions)if(i.kind==="associationMultiple"){if(this.multiple!==i.multiple)throw new g(i.unmetMessage||`Semantic ${e} requires association multiple to be ${i.multiple}.`,{status:400})}else if(i.kind==="entityPairs"){let r=this.getParentInstance(),s=Array.from(this.listTargets());if(!r)throw new g(i.unmetMessage||`Parent entity is required to evaluate entity pairing preconditions for semantic ${e}.`,{status:400});if(!i.entityPairs.some(n=>(Array.isArray(n.parent)?n.parent.some(p=>r.hasSemantic(p)):r.hasSemantic(n.parent))?s.some(p=>Array.isArray(n.target)?n.target.some(u=>p.hasSemantic(u)):p.hasSemantic(n.target)):!1))throw new g(i.unmetMessage||`Association entity pairing precondition check failed for semantic ${e}.`,{status:400})}}}getReciprocalAssociations(e){let t=[],i=this.root,r=this.getParentInstance()?.key??"";for(let s of i.listEntities())for(let a of s.listAssociations())if(!(a.key===this.key&&s.key===r)){for(let n of a.semantics)if(n.link&&n.link.key===this.key&&(!e||n.id===e)){t.push(a);break}}return t}toggleOptionalSemanticProperty(e,t,i){this.root.ensureWritable();let r=Be[e];if(!r||!gr(r))throw new Error(`Invalid semantic type: ${e}. Expected an association semantic.`);if(this.getSemantic(e)?.link)throw new Error(`Cannot toggle edge properties on linked reciprocal semantic ${e}. Edge properties belong to the source of truth association.`);let a=r.properties?.find(c=>c.value.info?.name===t);if(!a)throw new Error(`Property "${t}" is not defined in semantic blueprint ${e}.`);let l=Array.from(this.listProperties()).find(c=>c.info.name===t||c.lineage?.id===e&&c.info.name===t);if(i){if(l)return l;let c={...a.value,lineage:{key:this.key,kind:ae,domain:this.root.key,id:e}};return this.addProperty(c)}else{l&&l.remove();return}}addSemantic(e){this.root.ensureWritable();let t=Be[e.id];if(!gr(t))throw new Error(`Invalid semantic type: ${e.id}. Expected an association semantic.`);this.checkPreconditions(e.id);let i=this.semantics.findIndex(r=>r.id===e.id);i>=0?this.semantics[i]=e:this.semantics.push(e),e.link||t.properties?.forEach(r=>{if(!r.meta.required)return;let s=r.value.info?.name;if(!Array.from(this.listProperties()).find(n=>n.info.name===s||n.lineage?.id===e.id&&n.info.name===s)){let n={...r.value,lineage:{key:this.key,kind:ae,domain:this.root.key,id:e.id}};this.addProperty(n)}})}removeSemantic(e){this.root.ensureWritable();let t=this.semantics.findIndex(s=>s.id===e);t>=0&&this.semantics.splice(t,1);let i=Array.from(this.listProperties()).filter(s=>s.lineage?.id===e);for(let s of i)s.remove();let r=this.getReciprocalAssociations(e);for(let s of r)s.removeSemantic(e),s.semantics.length===0&&s.remove()}hasSemantic(e){return this.semantics.some(t=>t.id===e)}getSemantic(e){return this.semantics.find(t=>t.id===e)}duplicate(){let e=this.getParentInstance();if(!e)throw new Error(`Cannot duplicate association ${this.key} as it has no parent entity.`);let t=e.fields.findIndex(c=>c.key===this.key);if(t===-1)throw new Error(`Cannot duplicate association ${this.key} as it does not exist on the parent entity fields list.`);let i=this.info.name||"field",r=e.generateUniqueName(i),s=this.toJSON();delete s.key,delete s.targets,delete s.fields,s.info?s.info.name=r:s.info={name:r};let a=e.addAssociation(s);for(let c of this.listProperties()){let p=c.toJSON();delete p.key,a.addProperty(p)}for(let c of this.targets)a.addTarget(c.key,c.domain);let n=e.fields.length-1,l=e.fields[n];return e.fields.splice(n,1),e.fields.splice(t+1,0,l),a}};var Bt=class extends Error{messages;status=422;code="E_VALIDATION_ERROR";constructor(e,t){let i=t?.message||"Validation failure";super(i,t),this.messages=e;let r=this.constructor;"captureStackTrace"in Error&&Error.captureStackTrace(this,r)}get[Symbol.toStringTag](){return this.constructor.name}toString(){return`${this.name} [${this.code}]: ${this.message}`}};var Kn=o=>{let e=o.trim();return e=e.match(/[A-Z]{2,}(?=[ A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(t=>t.toLowerCase()).join("_")||"",e};import Fn from"dompurify";var ca;function Xc(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}if(Xc()){let{JSDOM:o}=await import("jsdom"),{window:e}=new o("<!DOCTYPE html>");ca=Fn(e)}else ca=Fn;var Jn=ca;function Yc(o){return Jn.sanitize(o)}function qn(o,e="untitled_column"){let t=Yc(o);return t=Kn(t),t=t.replace(/[\s-]+/g,"_"),t=t.replace(/[^a-z0-9_]/g,""),t=t.replace(/^_+|_+$/g,""),t||e}function Bn(o,e,t="untitled_table"){let i=qn(o,t);return`${qn(e.slice(0,8))}_${i}`}var li=class o extends Me{kind;#e;#t;#r;#i;info;tags;semantics=[];fields;deprecated;static createSchema(e={}){let{key:t=q(),tags:i,semantics:r,fields:s,deprecated:a}=e,n=ie.fromJSON(e.info,{name:"new_entity"}).toJSON(),l={kind:N,key:t,info:n};return Array.isArray(i)&&(l.tags=[...i]),Array.isArray(r)&&(l.semantics=[...r]),Array.isArray(s)&&(l.fields=[...s]),typeof a=="boolean"&&(l.deprecated=a),l}constructor(e,t){let i=o.createSchema(t);super(e,i.key),this.kind=N,this.info=new ie(i.info),Array.isArray(i.tags)?this.tags=[...i.tags]:this.tags=[],Array.isArray(i.semantics)?this.semantics=i.semantics.map(r=>structuredClone(r)):this.semantics=[],Array.isArray(i.fields)?this.fields=[...i.fields]:this.fields=[],typeof i.deprecated=="boolean"&&(this.deprecated=i.deprecated)}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON()};return Array.isArray(this.fields)&&this.fields.length&&(e.fields=[...this.fields]),Array.isArray(this.semantics)&&this.semantics.length&&(e.semantics=this.semantics.map(t=>structuredClone(t))),Array.isArray(this.tags)&&this.tags.length&&(e.tags=[...this.tags]),typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),e}getParentInstance(){let e=this.root.graph.parent(this.key);if(e)return this.root.graph.node(e)}getExposedName(){let e=this.info.name;if(!e)throw new g(`Entity ${this.key} has no exposed name defined`,{code:"E_MISSING_EXPOSED_NAME",status:500});return e}getDatabaseTableName(){return Bn(this.getExposedName(),this.namespace)}addProperty(e){if(this.root.ensureWritable(),e&&e.key&&this.root.graph.hasNode(e.key))throw new Error(`Trying to add a property ${e.key}, but it already exists`);let t=new Dt(this.root,this.key,e);return this.root.graph.setNode(t.key,t),this.root.graph.setEdge(this.key,t.key,{type:"property"}),this.fields.push({type:"property",key:t.key}),t}removeProperty(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new zt(`Trying to remove the ${e} property, but it doesn't exist`);if(this.root.graph.node(e).getParentInstance()!==this)throw new zt(`Trying to remove the ${e} property, but it doesn't belong to this entity`);Ee(this.root.graph,e),this.removeField(e)}get properties(){return this.listProperties()}*listProperties(){for(let{key:e,type:t}of this.fields){if(t!=="property")continue;let i=this.root.graph.node(e);!i||i.kind!==ne||(yield i)}}withInheritedProperties(){if(this.root.readOnly&&this.#e)return this.#e.values();let e=new Map,t=this.listAllParents("up");for(let i of t)for(let r of i.properties)r.info.name&&e.set(r.info.name,r);for(let i of this.properties)i.info.name&&e.set(i.info.name,i);return this.root.readOnly&&(this.#e=Array.from(e.values())),e.values()}hasProperties(){return this.fields.some(e=>e.type==="property")}get parents(){return this.listParents()}*listParents(){for(let e of this.root.graph.outEdges(this.key)){let t=this.root.graph.edge(e);if(!t||t.type!=="parent")continue;let i=this.root.graph.node(e.w);i&&(yield i)}}listAllParents(e="up"){if(this.root.readOnly&&this.#t?.[e])return this.#t[e];let t=new Set,i=[],r=[...this.listParents()],s=0;for(;s<r.length;){let a=r[s++];t.has(a.key)||(t.add(a.key),i.push(a),r.push(...a.listParents()))}return e==="down"&&i.reverse(),this.root.readOnly&&(this.#t||(this.#t={}),this.#t[e]=i),i}addParent(e,t){this.root.ensureWritable();let i=this.domain.buildReferenceKey(e,t);if(i===this.key){let s="Entity cannot be a parent of itself";throw new Bt([{field:"parents",message:s,rule:"circular"}],{message:s})}let{graph:r}=this.root;if(!r.hasNode(i)){let s=`Entity with key "${e}" not found`;throw t&&(s+=` in domain "${t}"`),new Bt([{field:"parents",message:s,rule:"required"}],{message:s})}if(this.hasCircularParent(i)){let s=`Circular inheritance detected. Cannot add ${e} as a parent`;throw new Bt([{field:"parents",message:s,rule:"circular"}],{message:s})}if(r.outEdges(this.key,i).next().value){let s=`Parent ${e} already exists`;throw new Bt([{field:"parents",message:s,rule:"unique"}],{message:s})}return t?r.setEdge(this.key,i,{type:"parent",domain:t,foreign:!0}):r.setEdge(this.key,i,{type:"parent"}),this}removeParent(e,t){this.root.ensureWritable();let{graph:i}=this.root,r=this.domain.buildReferenceKey(e,t);if(!i.hasEdge(this.key,r)){let a=`Trying to remove a parent ${e} from ${this.key}, but it doesn't exist`;throw t&&(a=`Trying to remove a foreign parent ${e} from domain "${t}" from ${this.key}, but it doesn't exist`),new Error(a)}let s=i.edge(this.key,r);if(!s||s.type!=="parent"){let a=`Edge between ${this.key} and ${e} exists but is not a parent relationship`;throw t&&(a=`Edge between ${this.key} and ${e} in domain "${t}" exists but is not a parent relationship`),new Error(a)}return i.removeEdge(this.key,r),this}hasParents(){for(let e of this.root.graph.outEdges(this.key))if(this.root.graph.edge(e)?.type==="parent")return!0;return!1}hasCircularParent(e){let{graph:t}=this.root;for(let r of t.outEdges(e,this.key))if(t.edge(r)?.type==="parent")return!0;let i=t.node(e);for(;i;){if(i.key===this.key)return!0;let r=[...i.listParents()];if(r.length===0)break;i=r[0]}return!1}breadcrumbs(){let e=[];e.push({key:this.key,name:this.info.getLabel("Unnamed entity"),kind:N});let t=this.getParentInstance();if(t){e.push({key:t.key,kind:t.kind,name:t.info.getLabel("Unnamed model")});let i=t.getParentInstance();for(;i&&i!==this.root;)e.push({key:i.key,kind:i.kind,name:i.info.getLabel("Unnamed namespace")}),i=i.getParentInstance()}return e.push({key:this.root.key,name:this.root.info.getLabel("Unnamed data domain"),kind:this.root.kind}),e.reverse()}addAssociation(e={}){this.root.ensureWritable();let{graph:t}=this.root,i={...e},r=i.targets;delete i.targets;let s=Array.isArray(r)&&r.length;if(s)for(let n of r){if(!n.key)throw new Error("Missing key for target");if(n.domain&&n.domain!==this.root.key){let l=`${n.domain}:${n.key}`;if(!t.hasNode(l))throw new Error(`Foreign entity ${l} not found`)}else if(!t.hasNode(n.key))throw new Error(`Target entity ${n.key} not found`)}let a=new oi(this.root,this.key,i);if(t.setNode(a.key,a),t.setEdge(this.key,a.key,{type:"association"}),s)for(let n of r)a.addTarget(n.key,n.domain);return this.fields.push({type:"association",key:a.key}),a}removeAssociation(e){if(this.root.ensureWritable(),!this.root.graph.hasEdge(this.key,e))throw new Error(`Unable to find a connection between this entity and the ${e} association`);let t=this.root.graph.edge(this.key,e);if(!t||t.type!=="association")throw new Error(`Association ${e} does not exist`);let i=this.root.graph.node(e);if(i){let r=i.getReciprocalAssociations();for(let s of r)s.remove()}Ee(this.root.graph,e),this.removeField(e)}get associations(){return this.listAssociations()}*listAssociations(){for(let{key:e,type:t}of this.fields){if(t!=="association")continue;let i=this.root.graph.node(e);!i||i.kind!==ae||(yield i)}}hasAssociations(){return this.fields.some(e=>e.type==="association")}*listFields(){for(let{key:e}of this.fields){let t=this.root.graph.node(e);t&&(t.kind===ae||t.kind===ne)&&(yield t)}}hasFields(){return this.fields.length>0}removeField(e){this.fields=this.fields.filter(t=>t.key!==e)}toApiShape(){return new Tt().entity(this)}toExample(e,t={}){let i=this.toApiShape();return new Jt(e,{renderExamples:t.renderExamples??!0,renderMocked:t.renderMocked??!0,renderOptional:t.renderOptional??!0,selectedUnions:t.selectedUnions}).generate(i)}isChildOf(e){if(this.key===e)return!1;let t=this.getParentInstance();return t?t.key===e?!0:t.isChildOf(e):!1}primaryKey(){for(let t of this.properties)if(t.primary)return t;let e;for(let t of this.listParents()){let i=t.primaryKey();i&&(e=i)}return e}addSemantic(e){this.root.ensureWritable();let t=Be[e.id];if(!Da(t))throw new Error(`Invalid semantic type: ${e.id}. Expected an entity semantic.`);let i=this.semantics.findIndex(r=>r.id===e.id);i>=0?this.semantics[i]=e:this.semantics.push(e),t.properties?.forEach(r=>{r.meta.required&&this.addProperty(r.value)})}removeSemantic(e){this.root.ensureWritable();let t=this.semantics.findIndex(i=>i.id===e);t>=0&&this.semantics.splice(t,1)}hasSemantic(e){return this.semantics.some(t=>t.id===e)}getSemantic(e){return this.semantics.find(t=>t.id===e)}withInheritedAssociations(){if(this.root.readOnly&&this.#r)return this.#r.values();let e=new Map,t=this.listAllParents("up");for(let i of t)for(let r of i.associations)r.info.name&&e.set(r.info.name,r);for(let i of this.associations)i.info.name&&e.set(i.info.name,i);return this.root.readOnly&&(this.#r=Array.from(e.values())),e.values()}listAllSemantics(){if(this.root.readOnly&&this.#i)return this.#i;let e=new Map,t=this.listAllParents("up");for(let r of t)for(let s of r.semantics)e.set(s.id,s);for(let r of this.semantics)e.set(r.id,r);let i=Array.from(e.values());return this.root.readOnly&&(this.#i=i),i}generateUniqueName(e){let t=new Set;for(let s of this.listFields())s.info.name&&t.add(s.info.name);let i=2,r=`${e}_copy`;for(;t.has(r);)r=`${e}_copy_${i}`,i++;return r}};var ci=class extends g{static code="E_REMOVE_ENTITY";static status=500;static message="Error removing a data entity.";static help="Make sure the entity exists and can be removed."};var Oe=class extends g{static code="E_ATTACH";static status=500;static message="Error attaching the object.";static help="Make sure you are attaching the right object."};var ot=class extends g{static code="E_DETACH";static status=500;static message="Error detaching the object.";static help="Make sure you are detaching the right object."};var Ut=class o extends Me{kind;info;fields;deprecated;static createSchema(e={}){let{key:t=q(),fields:i,deprecated:r}=e,s=ie.fromJSON(e.info,{name:"New model"}).toJSON(),a={kind:ye,key:t,info:s};return Array.isArray(i)&&(a.fields=[...i]),typeof r=="boolean"&&(a.deprecated=r),a}constructor(e,t){let i=o.createSchema(t);super(e,i.key),this.kind=ye,this.info=new ie(i.info),Array.isArray(i.fields)?this.fields=[...i.fields]:this.fields=[],typeof i.deprecated=="boolean"?this.deprecated=i.deprecated:this.deprecated=void 0}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON()};return Array.isArray(this.fields)&&this.fields.length&&(e.fields=[...this.fields]),typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),e}getParentInstance(){let e=this.root.graph.parent(this.key);return e?this.root.graph.node(e):this.root}addEntity(e){if(this.root.ensureWritable(),e&&e.key&&this.root.graph.hasNode(e.key))throw new Error(`Entity with key ${e?.key} already exists`);let t=new li(this.root,e);return this.root.graph.setNode(t.key,t),this.root.graph.setParent(t.key,this.key),this.fields.push({key:t.key,type:"entity"}),t}removeEntity(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new ci(`Trying to remove the ${e} entity, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==N)throw new ci(`Trying to remove the ${e} entity, but it is not an entity`);if(t.getParentInstance()!==this)throw new ci(`Trying to remove the ${e} entity, but it is not a child of this model`);Ee(this.root.graph,e),this.removeField(e)}attachEntity(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new Oe(`Trying to attach the ${e} entity, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==N)throw new Oe(`Trying to attach the ${e} entity, but it is not a entity`);if(t.domain.key!==this.root.key)throw new Oe(`Trying to attach the ${e} entity, but it is not in the same domain`);let i=t.getParentInstance();if(i===this)throw new Oe(`Trying to attach the ${e} entity, but it is already a child of this model`);if(i.detachEntity(e),this.fields.some(s=>s.key===e)||this.fields.push({type:"entity",key:e}),this.root.graph.setParent(e,this.key),this.root.graph.parent(e)!==this.key)throw new Oe(`Trying to attach the ${e} entity, but it is not a child of this model`);return this}detachEntity(e){this.root.ensureWritable();let t=this.fields.findIndex(r=>r.key===e);if(t===-1)throw new ot(`Trying to detach the ${e} entity, but it doesn't exist`);let i=this.root.graph.node(e);if(!i||i.kind!==N)throw new ot(`Trying to detach the ${e} entity, but it is not an entity`);if(i.getParentInstance()!==this)throw new ot(`Trying to detach the ${e} entity, but it is not a child of this model`);return this.fields.splice(t,1),this.root.graph.setParent(e),this}*listEntities(){for(let{key:e,type:t}of this.fields){if(t!=="entity")continue;let i=this.root.graph.node(e);!i||i.kind!==N||(yield i)}}hasEntities(){return this.fields.some(e=>e.type==="entity")}breadcrumbs(){let e=[];e.push({key:this.key,name:this.info.getLabel("Unnamed model"),kind:ye});let t=this.getParentInstance();for(;t&&t!==this.root;)e.push({key:t.key,kind:t.kind,name:t.info.getLabel("Unnamed namespace")}),t=t.getParentInstance();return e.push({key:this.root.key,name:this.root.info.getLabel("Unnamed data domain"),kind:this.root.kind}),e.reverse()}hasFields(){return this.fields.length>0}removeField(e){this.fields=this.fields.filter(t=>t.key!==e)}isChildOf(e){if(this.key===e)return!1;let t=this.getParentInstance();return t?t.key===e?!0:t===this.root?!1:t.isChildOf(e):!1}};var Gt=class extends g{static code="E_REMOVE_NAMESPACE";static status=500;static message="Error removing a domain namespace.";static help="Make sure the namespace exists and can be removed."};var Vi=class extends g{static code="E_REMOVE_MODEL";static status=500;static message="Error removing a domain model.";static help="Make sure the model exists and can be removed."};var di=class o extends Me{kind;info;fields;deprecated;static createSchema(e={}){let{key:t=q(),fields:i,deprecated:r}=e,s=ie.fromJSON(e.info,{name:"New namespace"}).toJSON(),a={kind:ke,key:t,info:s};return Array.isArray(i)&&(a.fields=[...i]),typeof r=="boolean"&&(a.deprecated=r),a}constructor(e,t){let i=o.createSchema(t);super(e,i.key),this.kind=ke,this.info=new ie(i.info),Array.isArray(i.fields)?this.fields=[...i.fields]:this.fields=[],typeof i.deprecated=="boolean"?this.deprecated=i.deprecated:this.deprecated=void 0}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON()};return Array.isArray(this.fields)&&this.fields.length&&(e.fields=[...this.fields]),typeof this.deprecated=="boolean"&&(e.deprecated=this.deprecated),e}addNamespace(e){if(this.root.ensureWritable(),e&&e.key&&this.root.graph.hasNode(e.key))throw new Error(`Trying to add a namespace to ${this.key}, but it already exists`);let t=new o(this.root,e);return this.root.graph.setNode(t.key,t),this.root.graph.setParent(t.key,this.key),this.fields.push({type:"namespace",key:t.key}),t}removeNamespace(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new Gt(`Trying to remove the ${e} namespace, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==ke)throw new Gt(`Trying to remove the ${e} namespace, but it is not a namespace`);return Ee(this.root.graph,e),this.removeField(e),this}attachNamespace(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new Error(`Trying to attach the ${e} namespace, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==ke)throw new Error(`Trying to attach the ${e} namespace, but it is not a namespace`);if(t.domain.key!==this.root.key)throw new Error(`Trying to attach the ${e} namespace, but it is not in the same domain`);let i=t.getParentInstance();if(i===this)throw new Oe(`Trying to attach the ${e} entity, but it is already a child of this model`);return this.root!==i&&i.detachNamespace(e),this.fields.push({type:"namespace",key:e}),this.root.graph.setParent(e,this.key),this}detachNamespace(e){this.root.ensureWritable();let t=this.fields.findIndex(r=>r.key===e);if(t===-1)throw new Gt(`Trying to detach the ${e} namespace, but it doesn't exist`);let i=this.root.graph.node(e);if(!i||i.kind!==ke)throw new Gt(`Trying to detach the ${e} namespace, but it is not a namespace`);return this.fields.splice(t,1),this.root.graph.setParent(e),this}*listNamespaces(){for(let{key:e,type:t}of this.fields){if(t!=="namespace")continue;let i=this.root.graph.node(e);!i||i.kind!==ke||(yield i)}}hasNamespaces(){return this.fields.some(e=>e.type==="namespace")}addModel(e){if(this.root.ensureWritable(),e&&e.key&&this.root.graph.hasNode(e.key))throw new Error(`Trying to add a model to ${this.key}, but it already exists`);let t=new Ut(this.root,e);return this.root.graph.setNode(t.key,t),this.root.graph.setParent(t.key,this.key),this.fields.push({type:"model",key:t.key}),t}removeModel(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new Vi(`Trying to remove the ${e} model, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==ye)throw new Vi(`Trying to remove the ${e} model, but it is not a model`);return Ee(this.root.graph,e),this.removeField(e),this}attachModel(e){if(this.root.ensureWritable(),!this.root.graph.hasNode(e))throw new Oe(`Trying to attach the ${e} model, but it doesn't exist`);let t=this.root.graph.node(e);if(!t||t.kind!==ye)throw new Oe(`Trying to attach the ${e} model, but it is not a model`);if(t.domain.key!==this.root.key)throw new Oe(`Trying to attach the ${e} model, but it is not in the same domain`);let i=t.getParentInstance();if(i===this)throw new Oe(`Trying to attach the ${e} model, but it is already a child of this namespace`);return this.root!==i&&i.detachModel(e),this.fields.push({type:"model",key:e}),this.root.graph.setParent(e,this.key),this}detachModel(e){this.root.ensureWritable();let t=this.fields.findIndex(r=>r.key===e);if(t===-1)throw new ot(`Trying to detach the ${e} model, but it doesn't exist`);let i=this.root.graph.node(e);if(!i||i.kind!==ye)throw new ot(`Trying to detach the ${e} model, but it is not a model`);if(i.getParentInstance()!==this)throw new ot(`Trying to detach the ${e} model, but it is not a child of this namespace`);return this.fields.splice(t,1),this.root.graph.setParent(e),this}*listModels(){for(let{key:e,type:t}of this.fields){if(t!=="model")continue;let i=this.root.graph.node(e);!i||i.kind!==ye||(yield i)}}hasModels(){return this.fields.some(e=>e.type==="model")}getParentInstance(){let e;for(let t of this.root.graph.parents(this.key)){e=t;break}return e?this.root.graph.node(e):this.root}*listFields(){for(let{key:e}of this.fields){let t=this.root.graph.node(e);t&&(t.kind===ke||t.kind===ye)&&(yield t)}}hasFields(){return this.fields.length>0}removeField(e){this.fields=this.fields.filter(t=>t.key!==e)}isChildOf(e){if(this.key===e)return!1;let t=this.getParentInstance();return t?t.key===e?!0:t===this.root?!1:t.isChildOf(e):!1}};function pi(o,e,t){return o+""+e+""+(t||"\0")}function da(o,e,t){let i={v:o,w:e};return t&&(i.name=t),i}var Mr=class o{isDirectedValue;isMultigraphValue;isCompoundValue;graphLabelValue;nodesValue;#e;get parentValue(){if(!this.isCompoundValue)throw new Error("Cannot access parentValue in a non-compound graph");return this.#e||(this.#e=new Map),this.#e}#t;get childrenValue(){if(!this.isCompoundValue)throw new Error("Cannot access childrenValue in a non-compound graph");return this.#t||(this.#t=new Map),this.#t}inValue;predecessorsValue;outValue;successorsValue;edgeObjectsValue;edgeLabelsValue;nodeCountValue;edgeCountValue;constructor(e={}){this.isDirectedValue=typeof e.directed=="boolean"?e.directed:!0,this.isMultigraphValue=typeof e.multigraph=="boolean"?e.multigraph:!1,this.isCompoundValue=typeof e.compound=="boolean"?e.compound:!1,this.graphLabelValue=void 0,this.nodesValue=new Map,this.isCompoundValue&&this.childrenValue.set("\0",new Set),this.inValue=new Map,this.outValue=new Map,this.predecessorsValue=new Map,this.successorsValue=new Map,this.edgeObjectsValue=new Map,this.edgeLabelsValue=new Map,this.nodeCountValue=0,this.edgeCountValue=0,this.defaultNodeLabelFn=()=>{},this.defaultEdgeLabelFn=()=>{}}isDirected(){return this.isDirectedValue}isMultigraph(){return this.isMultigraphValue}isCompound(){return this.isCompoundValue}setGraph(e){return this.graphLabelValue=e,this}graph(){return this.graphLabelValue}defaultNodeLabelFn(e){}defaultEdgeLabelFn(e,t,i){}setDefaultNodeLabel(e){return typeof e=="function"?this.defaultNodeLabelFn=e:this.defaultNodeLabelFn=()=>e,this}nodeCount(){return this.nodeCountValue}nodes(){return this.nodesValue.keys()}*sources(){for(let e of this.nodes()){let t=this.inValue.get(e);(!t||t.size===0)&&(yield e)}}*sinks(){for(let e of this.nodes()){let t=this.outValue.get(e);(!t||t.size===0)&&(yield e)}}setNodes(e,t){if(typeof t>"u")for(let i of e)this.setNode(i);else for(let i of e)this.setNode(i,t);return this}setNode(e,t){return this.nodesValue.has(e)?(t&&this.nodesValue.set(e,t),this):(this.nodesValue.set(e,t||this.defaultNodeLabelFn(e)),this.isCompoundValue&&(this.parentValue.set(e,new Set(["\0"])),this.childrenValue.set(e,new Set),this.childrenValue.get("\0").add(e)),this.inValue.set(e,new Map),this.predecessorsValue.set(e,new Map),this.outValue.set(e,new Map),this.successorsValue.set(e,new Map),++this.nodeCountValue,this)}node(e){return this.nodesValue.get(e)}hasNode(e){return this.nodesValue.has(e)}removeNode(e){if(!this.hasNode(e))return this;if(this.nodesValue.delete(e),this.isCompoundValue){this.removeFromParentsChildList(e),this.parentValue.delete(e);for(let r of this.children(e))this.removeParent(r,e);this.childrenValue.delete(e)}let t=this.inValue.get(e);if(t){for(let r of t.keys()){let s=this.edgeObjectsValue.get(r);s&&this.removeEdge(s)}this.inValue.delete(e)}this.predecessorsValue.delete(e);let i=this.outValue.get(e);if(i){for(let r of i.keys()){let s=this.edgeObjectsValue.get(r);s&&this.removeEdge(s)}this.outValue.delete(e)}return this.successorsValue.delete(e),this.nodeCountValue-=1,this}setParent(e,t="\0"){if(!this.isCompoundValue)throw new Error("Cannot set parent in a non-compound graph");return t!=="\0"&&(this.checkParentCycle(e,t),this.nodesValue.has(t)||this.setNode(t)),this.nodesValue.has(e)||this.setNode(e),this.removeFromParentsChildList(e),this.parentValue.set(e,new Set),this.parentValue.get(e).add(t),this.childrenValue.has(t)||this.childrenValue.set(t,new Set),this.childrenValue.get(t).add(e),this}checkParentCycle(e,t){for(let i of this.parents(t)){if(i===e)throw new Error(`Setting ${t} as parent of ${e} would create a cycle`);this.checkParentCycle(e,i)}}addParent(e,t){if(!this.isCompoundValue)throw new Error("Cannot set parent in a non-compound graph");return this.checkParentCycle(e,t),this.nodesValue.has(t)||this.setNode(t),this.nodesValue.has(e)||this.setNode(e),this.parentValue.has(e)||this.parentValue.set(e,new Set),this.parentValue.get(e).add(t),this.childrenValue.has(t)||this.childrenValue.set(t,new Set),this.childrenValue.get(t).add(e),this}removeParent(e,t){if(!this.isCompoundValue)throw new Error("Cannot remove parent in a non-compound graph");return this.nodesValue.has(e)?(t?(this.childrenValue.get(t)?.delete(e),this.parentValue.get(e)?.delete(t)):(this.removeFromParentsChildList(e),this.parentValue.set(e,new Set),this.parentValue.get(e).add("\0"),this.childrenValue.get("\0").add(e)),this):this}removeFromParentsChildList(e){let t=this.parentValue.get(e);if(t)for(let i of t)this.childrenValue.get(i)?.delete(e)}*parents(e){if(this.isCompoundValue){let t=this.parentValue.get(e);if(t)for(let i of t)i!=="\0"&&(yield i)}}hasParents(e){for(let t of this.parents(e))return!0;return!1}hasParent(e,t){if(this.isCompoundValue){let i=this.parentValue.get(e);if(i)return i.has(t)}return!1}parent(e){for(let t of this.parents(e))return t}*children(e="\0"){if(this.isCompoundValue){let t=this.childrenValue.get(e);if(t)for(let i of t.keys())yield i}else if(e==="\0")for(let t of this.nodes())yield t}hasChildren(e="\0"){if(this.isCompoundValue){let t=this.childrenValue.get(e);if(!t)return!1;for(let i of t.keys())return!0;return!1}else if(e==="\0"){for(let t of this.nodes())return!0;return!1}return!1}*predecessors(e){let t=this.predecessorsValue.get(e);if(t)for(let i of t.keys())yield i}*successors(e){let t=this.successorsValue.get(e);if(t)for(let i of t.keys())yield i}*neighbors(e){if(!this.hasNode(e))return;let t=new Set;for(let i of this.predecessors(e))t.has(i)||(t.add(i),yield i);for(let i of this.successors(e))t.has(i)||(t.add(i),yield i)}isLeaf(e){if(this.isDirected()){for(let t of this.successors(e))return!1;return!0}for(let t of this.neighbors(e))return!1;return!0}filterNodes(e){let t=new o({directed:this.isDirectedValue,multigraph:this.isMultigraphValue,compound:this.isCompoundValue}),i=this.graph();t.setGraph(i);let r=new Set;if(this.nodesValue.forEach((s,a)=>{e(a)&&(t.setNode(a,s),r.add(a))}),this.edgeObjectsValue.forEach(s=>{r.has(s.v)&&r.has(s.w)&&t.setEdge(s,this.edge(s))}),this.isCompoundValue){let s=new Map;for(let a of t.nodes()){let n=[...this.parents(a)],l=[];for(;n.length>0;){let c=!1;for(let u of n)t.hasNode(u)&&(l.push(u),c=!0);if(c)break;let p=[];for(let u of n)for(let h of this.parents(u))p.push(h);n=p}l.length===0&&l.push("\0"),s.set(a,l)}for(let[a,n]of s){this.removeParent(a);for(let l of n)t.addParent(a,l)}}return t}setDefaultEdgeLabel(e){return typeof e=="function"?this.defaultEdgeLabelFn=e:this.defaultEdgeLabelFn=()=>e,this}edgeCount(){return this.edgeCountValue}edges(){return this.edgeObjectsValue.values()}setPath(e,t){if(!Array.isArray(e)||!e.length)return this;let i=arguments.length>1;return e.reduce((r,s)=>(i?this.setEdge(r,s,t):this.setEdge(r,s),s)),this}setEdge(e,t,i,r){if(typeof e=="object"&&e!==null&&"v"in e){let s=e;arguments.length>1?this._setEdge({loop:0},s,t):this._setEdge({loop:0},s)}else if(typeof t=="string"){let s=da(e,t,r);arguments.length>2?this._setEdge({loop:0},s,i):this._setEdge({loop:0},s)}else throw new Error("Invalid arguments for setEdge");return this}_setEdge(e,t,i){let r=!1,s;arguments.length>2&&(s=i,r=!0);let a=pi(t.v,t.w,t.name);if(this.edgeLabelsValue.has(a)){if(r&&this.edgeLabelsValue.set(a,s),e.loop===0&&!this.isDirectedValue&&t.w!==t.v){let u=da(t.w,t.v,t.name);r?this._setEdge({loop:1},u,i):this._setEdge({loop:1},u)}return}if(t.name&&!this.isMultigraphValue)throw new Error("Cannot set a named edge when isMultigraph = false");this.hasNode(t.v)||this.setNode(t.v),this.hasNode(t.w)||this.setNode(t.w);let l=r?s:this.defaultEdgeLabelFn(t.v,t.w,t.name);this.edgeLabelsValue.set(a,l),this.edgeObjectsValue.set(a,t);let c=this.predecessorsValue.get(t.w);if(c){let u=(c.get(t.v)||0)+1;c.set(t.v,u)}let p=this.successorsValue.get(t.v);if(p){let u=(p.get(t.w)||0)+1;p.set(t.w,u)}if(this.inValue.get(t.w).set(a,t),this.outValue.get(t.v).set(a,t),this.edgeCountValue++,e.loop===0&&!this.isDirectedValue&&t.w!==t.v){let u=da(t.w,t.v,t.name);r?this._setEdge({loop:1},u,i):typeof l=="object"&&l!==null?this._setEdge({loop:1},u,l):this._setEdge({loop:1},u)}}edge(e,t,i){let r;return typeof e=="object"?r=pi(e.v,e.w,e.name):r=pi(e,t,i),this.edgeLabelsValue.get(r)}hasEdge(e,t,i){let r;return typeof e=="object"?r=pi(e.v,e.w,e.name):r=pi(e,t,i),this.edgeLabelsValue.has(r)}removeEdge(e,t,i){return typeof e=="object"?this._removeEdge({loop:0},e.v,e.w,e.name):this._removeEdge({loop:0},e,t,i),this}_removeEdge(e,t,i,r){let s=pi(t,i,r),a=this.edgeObjectsValue.get(s);if(a){this.edgeLabelsValue.delete(s),this.edgeObjectsValue.delete(s);let n=this.predecessorsValue.get(a.w);if(n){let c=(n.get(a.v)||0)-1;c<=0?n.delete(a.v):n.set(a.v,c)}let l=this.successorsValue.get(a.v);if(l){let c=(l.get(a.w)||0)-1;c<=0?l.delete(a.w):l.set(a.w,c)}this.inValue.get(a.w)?.delete(s),this.outValue.get(a.v)?.delete(s),this.edgeCountValue--}!this.isDirectedValue&&e.loop===0&&this._removeEdge({loop:1},i,t,r)}*inEdges(e,t){let i=this.inValue.get(e);if(i){let r=i.values();if(!t){for(let s of r)yield s;return}for(let s of r)s.v===t&&(yield s)}}*outEdges(e,t){let i=this.outValue.get(e);if(!i)return;let r=i.values();if(!t){for(let s of r)yield s;return}for(let s of r)s.w===t&&(yield s)}*nodeEdges(e,t){for(let i of this.inEdges(e,t))yield i;for(let i of this.outEdges(e,t))i.v!==i.w&&(yield i)}};function Zc(o,e){let t=[];for(let i of o.nodes()){let r=o.node(i);if(!r||r.domain.key!==e)continue;let s=[...o.parents(i)],a={v:i};a.value=r.toJSON(),s.length&&(a.parents=s),t.push(a)}return t}function Qc(o,e){let t=[];for(let i of o.edges()){let r=o.edge(i);if(!r)continue;let s=o.node(i.v),a=o.node(i.w);if(!s||!a||s.domain.key!==e||a.domain.key!==e&&r.type!=="association"&&r.type!=="parent")continue;let n={v:i.v,w:i.w};i.name&&(n.name=i.name),n.value=structuredClone(r),t.push(n)}return t}function ed(o,e){let t=[],i=new Set;for(let r of o.nodes()){let s=o.node(r);s&&s.domain.key===e&&i.add(r)}for(let r of i){let s=o.node(r);if(s){if(s.kind===ne||s.kind===ae){let n=[...o.inEdges(r)].filter(l=>{let c=o.node(l.v);return c&&c.domain.key===e});if(n.length===0){let l=s.kind===ne?"Property":"Association";t.push(`${l} "${s.info.name}" (${r}) has no parent entity edge. This will cause deserialization to fail.`)}else if(n.length>1){let l=s.kind===ne?"Property":"Association",c=n.map(p=>p.v).join(", ");t.push(`${l} "${s.info.name}" (${r}) has multiple parent edges: ${c}. This may cause deserialization issues.`)}else{let l=n[0],c=o.node(l.v);if(!c||c.kind!==N&&c.kind!==ae){let p=s.kind===ne?"Property":"Association";t.push(`${p} "${s.info.name}" (${r}) has a parent that is not an entity or association. Parent: ${c?.kind||"unknown"} (${l.v})`)}}}if(s.kind===N&&([...o.parents(r)].some(l=>{let c=o.node(l);return c&&c.kind===ye})||t.push(`Entity "${s.info.name}" (${r}) has no model parent. Entities must belong to a model.`)),s.kind===ye){let a=[...o.parents(r)],n=a.some(l=>{let c=o.node(l);return c&&c.kind===ke});if(a.length>0&&!n){let l=a.map(c=>`${o.node(c)?.kind||"unknown"} (${c})`).join(", ");t.push(`Model "${s.info.name}" (${r}) has invalid parent types: ${l}. Models can only belong to namespaces or be at root level.`)}}}}for(let r of i){let s=o.node(r);if(s&&s.kind===ae){let a=s,l=[...o.outEdges(r)].filter(c=>{let p=o.edge(c);return p&&p.type==="association"});l.length;for(let c of l){let p=o.node(c.w);p?p.kind!==N&&t.push(`Association "${a.info.name}" (${r}) references non-entity target: ${p.kind} (${c.w})`):t.push(`Association "${a.info.name}" (${r}) references non-existent target: ${c.w}`)}}}if(t.length>0)throw new Error(`Graph consistency validation failed for domain "${e}":
|
|
53
52
|
`+t.map(r=>` - ${r}`).join(`
|
|
54
|
-
`))}function oo(o,e){return kd(o,e),{options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:bd(o,e),edges:wd(o,e)}}function lo(o,e){for(let t of o.nodes()){let i=o.node(t);i&&i.domain.key===e&&o.removeNode(t)}}function ca(o,e,t){let i=new Set,r=new Set;for(let a of e.nodes()){let n=e.node(a);if(!n)continue;let l=`${t}:${a}`;o.setNode(l,n),i.add(l)}for(let a of e.edges()){let n=e.edge(a);if(!n)continue;let l=`${t}:${a.v}`,c=`${t}:${a.w}`;o.setEdge(l,c,{foreign:!0,domain:t,...n}),r.add(`${l}|${c}`)}let s=new Set;for(let a of e.nodes()){let n=`${t}:${a}`;for(let l of e.parents(a)){let c=`${t}:${l}`,p=o.node(n),u=o.node(c);p.kind===H&&u.kind===H?s.has(n)?o.addParent(n,c):(s.add(n),o.setParent(n,c)):o.setParent(n,c)}}return{nodes:i,edges:r}}function no(o,e){for(let t of e)if(t.w===o)return t.v}function vd(o,e,t,i,r){if(!e){let a={type:"malformed_entry",severity:"error",message:"Unable to restore data domain graph. Malformed node entry"};if(r.push(a),i==="strict")throw new Error(a.message);return}let s=e;if(!s.kind){let a={type:"malformed_entry",severity:"error",message:"Unable to restore data domain graph. Node entry missing kind property",affectedKey:s.key};if(r.push(a),i==="strict")throw new Error(a.message);return}try{if(s.kind===ye)return new Yt(o,s);if(s.kind===de)return new _t(o,s);if(s.kind===H)return new Wt(o,s);if(s.kind===ne){let n=s,l=no(n.key,t);if(!l){let c={type:"missing_edge",severity:"error",message:`Property "${n.info?.name||n.key}" has no parent entity edge`,affectedKey:n.key,resolution:i==="lenient"?"Property will be skipped":void 0};if(r.push(c),i==="strict")throw new Error("Unable to restore data domain graph. Malformed node entry");return}return new Jt(o,l,n)}if(s.kind===fe){let n=s,l=no(n.key,t);if(!l){let c={type:"missing_edge",severity:"error",message:`Association "${n.info?.name||n.key}" has no parent entity edge`,affectedKey:n.key,resolution:i==="lenient"?"Association will be skipped":void 0};if(r.push(c),i==="strict")throw new Error("Unable to restore data domain graph. Malformed node entry");return}return new Gt(o,l,n)}let a={type:"unknown_kind",severity:"error",message:`Unknown node kind: ${s.kind}`,affectedKey:s.key};if(r.push(a),i==="strict")throw new Error(`Unable to restore data domain graph. Unknown node kind ${s.kind}`);return}catch(a){let n={type:"malformed_entry",severity:"error",message:`Failed to create node: ${a instanceof Error?a.message:String(a)}`,affectedKey:s.key};if(r.push(n),i==="strict")throw a;return}}function co(o,e={}){let{json:t,dependencies:i,mode:r="strict"}=e,s=new Hr({compound:!0,multigraph:!0,directed:!0}),a=[],n=new Set,l=new Set;if(i)for(let p of i)try{let u=ca(s,p.graph,p.key);u.edges.size&&(l=new Set([...l,...u.edges])),u.nodes.size&&(n=new Set([...n,...u.nodes])),o.dependencies.set(p.key,p)}catch(u){let m=`Failed to merge dependency "${p.key}": ${u instanceof Error?u.message:String(u)}`;if(r==="strict")throw new Error(m,{cause:u});let h={type:"missing_dependency",severity:"error",message:m,affectedKey:p.key,resolution:"Dependency will be skipped"};a.push(h)}if(!t)return{graph:s,issues:a,success:!0};if(Array.isArray(t.nodes)){let p=new Map;for(let u of t.nodes){let m=vd(o,u.value,t.edges,r,a);m&&(s.setNode(u.v,m),u.parents&&p.set(u.v,u.parents))}for(let[u,m]of p){if(!s.hasNode(u)){let h={type:"missing_node",severity:"warning",message:`Cannot set parents for missing node: ${u}`,affectedKey:u,resolution:"Parent relationship will be skipped"};a.push(h);continue}for(let h of m){if(!s.hasNode(h)){let f={type:"missing_node",severity:"warning",message:`Parent node "${h}" not found for child "${u}"`,affectedKey:u,context:{parentKey:h},resolution:"Parent relationship will be skipped"};a.push(f);continue}try{s.setParent(u,h)}catch(f){let w={type:"invalid_parent",severity:"warning",message:`Failed to set parent "${h}" for child "${u}": ${f instanceof Error?f.message:String(f)}`,affectedKey:u,context:{parentKey:h},resolution:"Parent relationship will be skipped"};a.push(w)}}}}if(Array.isArray(t.edges))for(let p of t.edges){if(!p.value){let u="Edge entry missing value";if(r==="strict")throw new Error(u);let m={type:"malformed_entry",severity:"error",message:u,context:{edge:p}};a.push(m);continue}if(p.value.foreign&&!n.has(p.w)){let u={type:"missing_node",severity:"warning",message:`Missing foreign node: ${p.w}`,affectedKey:p.w,resolution:"Edge will be skipped"};a.push(u);continue}if(n.has(p.v)||n.has(p.w)){if(!s.hasNode(p.v)||!s.hasNode(p.w)){let u={type:"missing_node",severity:"warning",message:`Missing foreign node for edge: ${p.v} -> ${p.w}`,context:{sourceNode:p.v,targetNode:p.w},resolution:"Edge will be skipped"};a.push(u);continue}}else{if(!s.hasNode(p.v)){let u={type:"missing_node",severity:"warning",message:`Source node not found for edge: ${p.v}`,affectedKey:p.v,resolution:"Edge will be skipped"};a.push(u);continue}if(!s.hasNode(p.w)){let u={type:"missing_node",severity:"warning",message:`Target node not found for edge: ${p.w}`,affectedKey:p.w,resolution:"Edge will be skipped"};a.push(u);continue}}try{s.setEdge({v:p.v,w:p.w,name:p.name},p.value)}catch(u){let h={type:"malformed_entry",severity:"warning",message:`Failed to create edge ${p.v} -> ${p.w}: ${u instanceof Error?u.message:String(u)}`,context:{sourceNode:p.v,targetNode:p.w},resolution:"Edge will be skipped"};a.push(h)}}let c=a.some(p=>p.severity==="error");return{graph:s,issues:a,success:!c}}var ui=class extends EventTarget{dependencies=new Map;dependencyList=[];constructor(e=[],t=[]){super(),this.dependencyList=[...e];for(let i of t)this.dependencies.set(i.key,i)}};var Ve=class o extends ui{kind;key;graph;info;lifecycle;previousVersion;#e=!0;#t=!1;readOnly;get domain(){return this}#r;get fields(){return this.#r}set fields(e){this.#r=e}issues=[];static createSchema(e={}){let{key:t=F(),fields:i,lifecycle:r="draft",previousVersion:s}=e,a=ee.fromJSON(e.info,{name:"Unnamed domain"}).toJSON(),n={kind:Ce,key:t,info:a,lifecycle:r};return s&&(n.previousVersion=s),e.dependencyList&&(n.dependencyList=structuredClone(e.dependencyList)),e.graph&&(n.graph=e.graph),Array.isArray(i)&&(n.fields=[...i]),n}constructor(e,t=[],i){let r=o.createSchema(e),s=[];for(let l of t)if(l instanceof o)l.readOnly?s.push(l):(console.warn(`Domain ${l.key} is not read only, cloning it. This may have performance implications.`),s.push(l.clone({readOnly:!0})));else if(typeof l=="object"&&l.kind===Ce&&l.key){let c=new o(l,void 0,{readOnly:!0});s.push(c)}else throw new Error(`Invalid foreign domain dependency: ${l}`);super(r.dependencyList,s),this.kind=r.kind,this.key=r.key,this.info=new ee(r.info),this.readOnly=i?.readOnly||!1,this.lifecycle=r.lifecycle||"draft",this.previousVersion=r.previousVersion;let a=i?.mode||"strict",n=co(this,{json:r.graph,dependencies:s,mode:a});this.graph=n.graph,n.issues.length>0&&a==="lenient"&&(this.issues=n.issues),Array.isArray(r.fields)?this.fields=[...r.fields]:this.fields=[],Array.isArray(r.dependencyList)?this.dependencyList=[...r.dependencyList]:this.dependencyList=[],this.#e=!1}clone(e){let t=this.toJSON(),i=Array.from(this.dependencies.values()).map(s=>s.clone()),r={readOnly:this.readOnly,...e};return new o(t,i,r)}toJSON(){let e={info:this.info.toJSON(),kind:this.kind,key:this.key,graph:oo(this.graph,this.key),lifecycle:this.lifecycle};return this.previousVersion&&(e.previousVersion=this.previousVersion),this.dependencyList.length>0&&(e.dependencyList=structuredClone(this.dependencyList)),Array.isArray(this.fields)&&this.fields.length&&(e.fields=[...this.fields]),e}notifyChange(){this.#t||this.#e||(this.#t=!0,queueMicrotask(()=>{this.#t=!1;let e=new Event("change");this.dispatchEvent(e)}))}changeLifecycle(e,t){if(e!==this.lifecycle){if(this.lifecycle==="published"){if(e!=="draft")throw new Error(`Cannot transition from published to ${e}`);if(!t)throw new Error("A new version must be specified when creating a draft from a published domain");if(t===this.info.version)throw new Error("The new version must be different from the current published version");this.previousVersion=this.info.version,this.info.version=t,this.lifecycle="draft",this.notifyChange();return}if(e==="draft"){if(this.lifecycle!=="committed")throw new Error(`Cannot transition from ${this.lifecycle} to draft`);this.lifecycle="draft",this.notifyChange();return}if(e==="committed"){if(this.lifecycle!=="draft")throw new Error(`Cannot transition from ${this.lifecycle} to committed`);this.lifecycle="committed",this.notifyChange();return}if(e==="published"){this.lifecycle="published",this.notifyChange();return}throw new Error(`Unknown lifecycle state: ${e}`)}}ensureWritable(){if(this.lifecycle!=="draft")throw new Error(`Cannot modify the data domain when it is in "${this.lifecycle}" lifecycle state`)}removeField(e){this.fields=this.fields.filter(t=>t.key!==e)}hasFields(){return this.fields.length>0}*listFields(){for(let{key:e}of this.fields){let t=this.graph.node(e);t&&(t.kind===ye||t.kind===de)&&(yield t)}}addNamespace(e,t){if(this.ensureWritable(),t){if(!this.graph.hasNode(t))throw new Error(`Parent namespace ${t} does not exist`);let r=this.graph.node(t);if(!r||r.kind!==ye)throw new Error(`Parent namespace ${t} is not a valid namespace`);if(r.domain.key!==this.key)throw new Error("Cannot add a namespace to a foreign domain");return r.addNamespace(e)}let i=new Yt(this,e);return this.graph.setNode(i.key,i),this.fields.push({type:"namespace",key:i.key}),i}removeNamespace(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Namespace ${e} does not exist`);let t=this.graph.node(e);if(!t||t.kind!==ye)throw new Error(`Namespace ${e} not found`);if(t.domain.key!==this.key)throw new Error("Cannot remove a namespace from a foreign domain");let i=t.getParentInstance();return i===this?(je(this.graph,e),this.removeField(e)):i.removeNamespace(e),this}*listNamespaces(){for(let{key:e,type:t}of this.fields){if(t!=="namespace")continue;let i=this.graph.node(e);!i||i.kind!==ye||(yield i)}}*listForeignNamespaces(e){let t=this.dependencies.get(e);if(!t)throw new Error(`Foreign domain ${e} not found`);for(let i of t.listNamespaces()){let r=`${e}:${i.key}`;this.graph.node(r)&&(yield i)}}hasNamespaces(){return this.fields.some(e=>e.type==="namespace")}*listGraphNamespaces(e){for(let t of this.graph.children(e)){let i=this.graph.node(t);i.kind===ye&&i.domain.key===this.key&&(yield i)}}buildReferenceKey(e,t){if(t&&t!==this.key){if(typeof t!="string"||t.length===0)throw new Error(`Invalid namespace key. Expected a string, got ${typeof t}`);if(!this.dependencies.get(t))throw new Error(`Foreign domain ${t} not found`);return`${t}:${e}`}return e}findNamespace(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===ye)return i}moveNamespace(e,t){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Namespace ${e} does not exist`);let i=this.findNamespace(e);if(!i)throw new Error(`Namespace ${e} not found in the graph`);if(t){let a=this.findNamespace(t);if(a&&a.domain.key!==this.key)throw new Error("Cannot move a namespace to a foreign domain");if(!a)throw new Error(`Parent namespace ${t} does not exist`)}if(e===t)throw new Error("Cannot move a namespace to itself");if(i.domain.key!==this.key)throw new Error("Cannot move a namespace from a foreign domain");let r;if(t){if(r=this.findNamespace(t),!r)throw new Error(`Parent namespace ${t} not found`);if(this.isChildOf(t,e))throw new Error("Cannot move a namespace to its own child")}let s=this.graph.parent(e);return s&&!t?this.graph.node(s).detachNamespace(e):s||this.removeField(e),t&&r?r.attachNamespace(e):this.fields.push({type:"namespace",key:e}),this}isChildOf(e,t){let i=this.graph.children(t);for(let r of i)if(r===e||this.isChildOf(e,r))return!0;return!1}addModel(e,t){if(this.ensureWritable(),t){if(!this.graph.hasNode(t))throw new Error(`Parent ${t} does not exist`);let r=this.findNamespace(t);if(!r)throw new Error(`Parent namespace ${t} is not a valid namespace`);if(r.domain.key!==this.key)throw new Error("Cannot add a model to a foreign domain");return r.addModel(e)}let i=new _t(this,e);return this.graph.setNode(i.key,i),this.fields.push({type:"model",key:i.key}),i}removeModel(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Data model ${e} does not exist`);let t=this.graph.node(e);if(!t||t.kind!==de)throw new Error(`Data model ${e} not found`);if(t.domain.key!==this.key)throw new Error("Cannot remove a model from a foreign domain");let i=t.getParentInstance();return i===this?(je(this.graph,e),this.removeField(e)):i.removeModel(e),this}*listModels(e){let t=e?.domain,i=e?.includeForeign??!1,r=e?.foreignOnly??!1;if(t){let s=t===this.key?this:this.dependencies.get(t);if(!s)throw new Error(`Foreign domain ${t} not found`);for(let a of s.listModels()){let n=t===this.key?a.key:`${t}:${a.key}`,l=this.graph.node(n);l&&(yield l)}return}if(!r)for(let{key:s,type:a}of this.fields){if(a!=="model")continue;let n=this.graph.node(s);n&&n.kind===de&&(yield n)}if(i||r)for(let[s,a]of this.dependencies)for(let n of a.listModels()){let l=`${s}:${n.key}`,c=this.graph.node(l);c&&(yield c)}}*listForeignModels(e){yield*this.listModels({domain:e})}hasModels(){return this.fields.some(e=>e.type==="model")}*listGraphModels(e){for(let t of this.graph.children(e)){let i=this.graph.node(t);i.kind===de&&i.domain.key===this.key&&(yield i)}}findModel(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===de)return i}moveModel(e,t){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Data model ${e} does not exist`);let i=this.findModel(e);if(!i)throw new Error(`Data model ${e} not found in the graph`);if(t){let s=this.findNamespace(t);if(s&&s.domain.key!==this.key)throw new Error("Cannot move a model to a foreign domain");if(!s)throw new Error(`Parent namespace ${t} does not exist`)}if(i.domain.key!==this.key)throw new Error("Cannot move a data model to a foreign domain");let r=this.graph.parent(e);if(r&&!t){let s=this.findNamespace(r);if(!s)throw new Error(`The parent namespace ${r} not found`);s.detachModel(e)}else r||this.removeField(e);return t?this.findNamespace(t).attachModel(e):this.fields.push({type:"model",key:e}),this}addEntity(e,t){if(this.ensureWritable(),!e)throw new Error("An entity expects a DomainModel parent");if(!this.graph.hasNode(e))throw new Error(`The parent ${e} does not exist`);let i=this.findModel(e);if(!i)throw new Error(`Parent model ${e} is not a valid model`);if(i.domain.key!==this.key)throw new Error("Cannot add an entity to a foreign domain");return i.addEntity(t)}removeEntity(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Entity ${e} does not exist`);let t=this.graph.parent(e);if(!t)throw new Error(`Parent model not found for entity ${e}`);let i=this.findModel(t);if(!i)throw new Error(`Parent model ${t} not found`);if(i.domain.key!==this.key)throw new Error("Cannot remove an entity from a foreign domain");return i.removeEntity(e),this}*listEntities(e){let t,i,r=!1,s=!1;if(typeof e=="string"?t=e:e&&typeof e=="object"&&(t=e.parent,i=e.domain,r=e.includeForeign??!1,s=e.foreignOnly??!1),i&&i!==this.key&&!this.dependencies.get(i))throw new Error(`Foreign domain ${i} not found`);let a=t?this.graph.children(t):this.graph.nodes();for(let n of a){let l=this.graph.node(n);if(l&&l.kind===H){let c=l.domain.key===this.key;if(i){l.domain.key===i&&(yield l);continue}s?c||(yield l):r?yield l:c&&(yield l)}}}*listForeignEntities(e){yield*this.listEntities({domain:e})}*listAllForeignEntities(){yield*this.listEntities({foreignOnly:!0})}findEntity(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===H)return i}moveEntity(e,t,i){if(this.ensureWritable(),t===i)throw new Error("Cannot move an entity to the same model");if(!this.graph.hasNode(e))throw new Error(`Entity ${e} does not exist`);if(!this.graph.hasNode(t))throw new Error(`Source model ${t} does not exist`);if(!this.graph.hasNode(i))throw new Error(`Target model ${i} does not exist`);let r=this.findEntity(e),s=this.findModel(t),a=this.findModel(i);if(!r||!s||!a)throw new Error("Entity or models not found in the graph");if(r.domain.key!==this.key)throw new Error("Cannot move an entity from a foreign domain");if(a.domain.key!==this.key)throw new Error("Cannot move an entity to a foreign domain");a.attachEntity(e)}addAssociation(e,t){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Source entity ${e} not found`);let i=this.findEntity(e);if(!i)throw new Error(`Source entity ${e} not found`);if(i.domain.key!==this.key)throw new Error("Cannot add an association to a foreign domain");return i.addAssociation(t)}removeAssociation(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Association ${e} does not exist`);let t=this.graph.node(e);if(!t||t.kind!==fe)throw new Error(`Association ${e} not found`);let i=t.getParentInstance();if(!i)throw new Error(`Parent entity not found for association ${e}`);if(i.domain.key!==this.key)throw new Error("Cannot remove an association from a foreign domain");return i.removeAssociation(e),this}findAssociation(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===fe)return i}getIncomingAssociations(e){let t=[];for(let i of this.graph.inEdges(e)){let r=this.graph.node(i.v);r&&r.kind===fe&&t.push(r)}return t}findAssociationBetween(e,t){let i=this.graph.node(e);if(!i||i.kind!==H)return;let r=i;for(let s of r.listAssociations())for(let a of s.targets)if(this.buildReferenceKey(a.key,a.domain)===t)return s}resolveOwnershipPath(e){let t=this.findEntity(e);if(!t)return null;if(t.hasSemantic(y.User))return[];for(let s of t.listAssociations())if(s.hasSemantic(y.ResourceOwnerIdentifier))return[s];let i=[{key:e,path:[]}],r=new Set([e]);for(;i.length>0;){let s=i.shift();if(!s)continue;let a=this.findEntity(s.key);if(!a)continue;let n=[...a.listAssociations()].filter(u=>u.hasSemantic(y.CreatedBy)||u.hasSemantic(y.UpdatedBy)||u.hasSemantic(y.DeletedBy)?!1:u.hasSemantic(y.RelationalResourceOwner)||u.hasSemantic(y.ResourceOwnerIdentifier)?!0:u.listTargets().some(m=>m.hasSemantic(y.User))),c=this.getIncomingAssociations(s.key).filter(u=>{if(u.hasSemantic(y.CreatedBy)||u.hasSemantic(y.UpdatedBy)||u.hasSemantic(y.DeletedBy))return!1;let m=u.getParentInstance();return m?m.hasSemantic(y.User)||u.schema?.embedded===!0:!1}),p=[...n,...c];for(let u of p){let m=u.getParentInstance();if(!m)continue;let h=[...u.listTargets()];if(h.length!==0)for(let f of h){let k=s.key===m.key?f.key:m.key;if(r.has(k))continue;let w=this.findEntity(k);if(!w)continue;let b=[...s.path,u];if(w.hasSemantic(y.User)||u.hasSemantic(y.ResourceOwnerIdentifier))return b;r.add(k),i.push({key:k,path:b})}}}return null}addProperty(e,t){if(this.ensureWritable(),!e)throw new Error("A property expects a DomainEntity parent");if(!this.graph.hasNode(e))throw new Error(`Parent entity ${e} does not exist`);let i=this.findEntity(e);if(!i)throw new Error(`Parent entity ${e} not found`);if(i.domain.key!==this.key)throw new Error("Cannot add a property to a foreign domain");return i.addProperty(t)}removeProperty(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Property ${e} does not exist`);let t=this.graph.node(e);if(!t||t.kind!==ne)throw new Error(`Property ${e} not found`);let i=t.getParentInstance();if(!i)throw new Error(`Parent entity not found for property ${e}`);if(i.domain.key!==this.key)throw new Error("Cannot remove a property from a foreign domain");return i.removeProperty(e),this}findProperty(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===ne)return i}registerForeignDomain(e){this.ensureWritable();let{info:t,key:i}=e;if(!t.version)throw new Error(`Foreign domain ${i} does not have a version set`);if(this.dependencies.has(i))throw new Error(`Foreign domain with key ${i} already registered`);this.dependencies.set(i,e),this.dependencyList.push({key:i,version:t.version}),ca(this.graph,e.graph,e.key)}unregisterForeignDomain(e){this.ensureWritable();let t=this.dependencies.get(e);if(!t)throw new Error(`Foreign domain with key ${e} not found`);this.dependencies.delete(e),this.dependencyList=this.dependencyList.filter(i=>i.key!==e),lo(this.graph,t.key)}removeDomainElement(e,t){switch(t){case ye:this.removeNamespace(e);break;case de:this.removeModel(e);break;case H:this.removeEntity(e);break;case ne:this.removeProperty(e);break;case fe:this.removeAssociation(e);break;default:throw new Error(`Unknown kind ${t} for the object ${e}`)}}search(e={}){let{query:t,nodeTypes:i,includeForeignDomains:r=!1,caseSensitive:s=!1}=e,a=[],n=!t&&(!i||i.length===0),l=m=>!i||i.length===0?!0:i.includes(m),c=m=>{if(!m||!t)return!t;if(t instanceof RegExp)return t.test(m);let h=s?m:m.toLowerCase(),f=s?t:t.toLowerCase();return h.includes(f)},p=m=>{if(!t)return[];let h=[],{info:f}=m;return c(f.name)&&h.push("name"),c(f.displayName)&&h.push("displayName"),c(f.description)&&h.push("description"),h},u=m=>m.includes(":");for(let m of this.graph.nodes()){let h=this.graph.node(m);if(!h||!h.info)continue;let f=u(m);if(f&&!r||!l(h.kind))continue;if(n){a.push({node:h,matchedFields:[],key:m,isForeign:f});continue}let k=p(h);(!t||k.length>0)&&a.push({node:h,matchedFields:k,key:m,isForeign:f})}return a}};var da=[],pa=[],po={},Fi={},Ki={};function uo(o){return typeof o=="string"?new RegExp("^"+o+"$","i"):o}function Yr(o,e){return o===e?e:o===o.toLowerCase()?e.toLowerCase():o===o.toUpperCase()?e.toUpperCase():o[0]===o[0].toUpperCase()?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e.toLowerCase()}function _d(o,e){return o.replace(/\$(\d{1,2})/g,function(t,i){return e[i]||""})}function xd(o,e){return o.replace(e[0],function(t,i){let r=_d(e[1],arguments);return Yr(t===""?o[i-1]:t,r)})}function mo(o,e,t){if(!o.length||Object.hasOwn(po,o))return e;let i=t.length;for(;i--;){let r=t[i];if(r[0].test(e))return xd(e,r)}return e}function ho(o,e,t){return function(i){let r=i.toLowerCase();return Object.prototype.hasOwnProperty.call(e,r)?Yr(i,r):Object.prototype.hasOwnProperty.call(o,r)?Yr(i,o[r]):mo(r,i,t)}}function fo(o,e,t){return function(i){let r=i.toLowerCase();return Object.prototype.hasOwnProperty.call(e,r)?!0:Object.prototype.hasOwnProperty.call(o,r)?!1:mo(r,r,t)===r}}var ve=function(o,e,t){let i=e===1?ve.singular(o):ve.plural(o);return(t?e+" ":"")+i};ve.plural=ho(Ki,Fi,da);ve.isPlural=fo(Ki,Fi,da);ve.singular=ho(Fi,Ki,pa);ve.isSingular=fo(Fi,Ki,pa);ve.addPluralRule=function(o,e){da.push([uo(o),e])};ve.addSingularRule=function(o,e){pa.push([uo(o),e])};ve.addUncountableRule=function(o){if(typeof o=="string"){po[o.toLowerCase()]=!0;return}ve.addPluralRule(o,"$0"),ve.addSingularRule(o,"$0")};ve.addIrregularRule=function(o,e){e=e.toLowerCase(),o=o.toLowerCase(),Ki[o]=e,Fi[e]=o};[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["my","our"],["its","their"],["his","their"],["her","their"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"],["canvas","canvases"]].forEach(function(o){ve.addIrregularRule(o[0],o[1])});[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(o){ve.addPluralRule(o[0],o[1])});[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/(dg|ss|ois|lk|ok|wn|mb|th|ch|ec|oal|is|ck|ix|sser|ts|wb)ies$/i,"$1ie"],[/\b(l|(?:neck|cross|hog|aun)?t|coll|faer|food|gen|goon|group|hipp|junk|vegg|(?:pork)?p|charl|calor|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(o){ve.addSingularRule(o[0],o[1])});["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(ve.addUncountableRule);var Xr=ve;function Pe(o,e){let t=o.domain||e;return t?`${t}:${o.key}`:o.key}function mi(o){if(!o)throw new g("Cannot generate parameter name from an empty string.",{code:"E_INVALID_PARAM_NAME",help:"The entity name used for path parameter generation is empty."});let e=o.replace(/([a-z])([A-Z])/g,"$1 $2");e=e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2");let i=e.replace(/[^a-zA-Z0-9]/g," ").split(/\s+/).filter(Boolean);if(i.length===0)throw new g(`Cannot generate a valid parameter name from "${o}".`,{code:"E_INVALID_PARAM_NAME",help:"The entity name must contain alphanumeric characters to generate a path parameter."});let s=i.map((a,n)=>{let l=a.toLowerCase();return n===0?l:l.charAt(0).toUpperCase()+l.slice(1)}).join("");return/^[0-9]/.test(s)&&(s="_"+s),`${s}Id`}function Xt(o){let e=o.trim(),t=e.startsWith("/")?e:`/${e}`;return t==="/"?"/":t.replace(/\/+$/,"")}function ua(o,e){let t=o.endsWith("/")?o.slice(0,-1):o,i=e.startsWith("/")?e:`/${e}`;return`${t}${i}`}var Dt=class o{kind;key;entity;hasCollection;collectionPath;resourcePath;isRoot;parent;exposeOptions;actions;accessRules;rateLimiting;paginationContract;truncated;api;static createSchema(e={}){let{key:t=F(),entity:i={key:""},collectionPath:r,resourcePath:s="/",hasCollection:a=!0,isRoot:n,parent:l,exposeOptions:c,actions:p=[],accessRules:u,rateLimiting:m,truncated:h,paginationContract:f}=e,k={kind:Et,key:t,entity:{...i},hasCollection:a,resourcePath:s,actions:p.map(w=>({...w}))};return r!==void 0&&(k.collectionPath=r),n!==void 0&&(k.isRoot=n),l!==void 0&&(k.parent={...l}),c!==void 0&&(k.exposeOptions={...c}),Array.isArray(u)&&(k.accessRules=u.map(w=>({...w}))),m!==void 0&&(k.rateLimiting={...m}),h!==void 0&&(k.truncated=h),f!==void 0&&(k.paginationContract=structuredClone(f)),k}constructor(e,t){this.api=e;let i=o.createSchema(t);this.kind=i.kind,this.key=i.key,this.entity=i.entity,this.hasCollection=i.hasCollection,this.collectionPath=i.collectionPath,this.resourcePath=i.resourcePath,this.isRoot=i.isRoot,this.parent=i.parent,this.exposeOptions=i.exposeOptions,this.actions=i.actions?i.actions.map(r=>$s(this,r)):[],this.accessRules=i.accessRules?i.accessRules.map(r=>ai(this,r)):[],i.rateLimiting&&(this.rateLimiting=new yt(i.rateLimiting)),this.truncated=i.truncated,i.paginationContract&&(this.paginationContract=structuredClone(i.paginationContract))}toJSON(){let e={kind:this.kind,key:this.key,entity:{...this.entity},resourcePath:this.resourcePath,actions:this.actions.map(t=>t.toJSON()),hasCollection:this.hasCollection};return this.collectionPath!==void 0&&(e.collectionPath=this.collectionPath),this.isRoot!==void 0&&(e.isRoot=this.isRoot),this.parent!==void 0&&(e.parent={...this.parent}),this.exposeOptions!==void 0&&(e.exposeOptions={...this.exposeOptions}),Array.isArray(this.accessRules)&&this.accessRules.length>0&&(e.accessRules=this.accessRules.map(t=>t.toJSON())),this.rateLimiting!==void 0&&(e.rateLimiting=this.rateLimiting.toJSON()),this.truncated!==void 0&&(e.truncated=this.truncated),this.paginationContract&&(e.paginationContract=structuredClone(this.paginationContract)),e}setCollectionPath(e){if(!this.hasCollection)throw new g("Cannot set collection path on an exposure that does not have a collection",{code:"E_PATH_MISSING",help:"The exposed entity you are trying to set a collection path for does not have a collection."});let i=Xt(e).split("/").filter(Boolean);if(i.length!==1)throw new g(`Collection path must contain exactly one segment. Received: "${e}"`,{code:"E_PATH_SEGMENT_SIZE",help:"The set path must have a single path segment (e.g., `/products`)"});let r=`/${i[0]}`;if(this.isRoot&&this.api.findCollectionPathCollision(r,this.key))throw new g(`Collection path "${r}" is already in use by another root entity.`,{code:"E_PATH_INUSE",help:"The set path is already in use by another root entity."});let s="";if(this.resourcePath&&this.resourcePath!=="/"){let l=this.resourcePath.split("/").filter(Boolean)[1];l&&/^\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(l)&&(s=l)}if(!s){let n=this.api.domain?.findEntity(this.entity.key,this.entity.domain);if(!n||!n.info.name)throw new g("Cannot generate a semantic parameter name because the associated entity or its name is missing.",{code:"E_ENTITY_NOT_FOUND",help:"Ensure the exposed entity points to a valid domain entity with a defined name."});s=`{${mi(n.info.name)}}`}let a=`${r}/${s}`;this.#r(a),this.collectionPath=r,this.resourcePath=a}setResourcePath(e){let t=Xt(e),i=t.split("/").filter(Boolean);if(this.hasCollection){if(!this.collectionPath)throw new g("Cannot set resource path: missing collection path for this exposure",{code:"E_PATH_MISSING",help:"Set the collection path on the exposed entity first."});let r=this.collectionPath.split("/").filter(Boolean);if(r.length!==1)throw new g(`Invalid stored collection path "${this.collectionPath}"`,{code:"E_PATH_SEGMENT_SIZE",help:"The set collection path must have a single path segment (e.g., `/products`)"});if(i.length!==2)throw new g(`Resource path must be exactly two segments (collection + parameter). Received: "${t}"`,{code:"E_PATH_SEGMENT_SIZE",help:"The set resource path must have exactly two segments (collection + parameter)."});let[s,a]=i;if(s!==r[0])throw new g(`Resource path must start with the collection segment "${r[0]}". Received: "${s}"`,{code:"E_PATH_MISMATCH",help:"Set the resource path to the same value as the collection path + the parameter value."});if(!/^\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(a))throw new g(`The second segment must be a parameter in braces, e.g. {id}. Received: "${a}"`,{code:"E_PARAMETER_INVALID",help:"Use the braces to surround the parameter name, e.g., {productId}."});this.resourcePath!==t&&(this.#r(`/${s}/${a}`),this.resourcePath=`/${s}/${a}`);return}if(i.length!==1)throw new g(`Resource path must contain exactly one segment when no collection is present. Received: "${t}"`,{code:"E_PATH_SEGMENT_SIZE",help:"The set resource path must have exactly one segment."});if(this.isRoot&&this.api.findResourcePathCollision(t,this.key))throw new g(`Resource path "${t}" is already in use by another root entity.`,{code:"E_PATH_INUSE",help:"The set path is already in use by another root entity."});this.resourcePath!==t&&(this.#r(`/${i[0]}`),this.resourcePath=`/${i[0]}`)}#e(e){let i=[...e.join("/").matchAll(/\{([^}]+)\}/g)].map(s=>s[1]),r=new Set;for(let s of i){if(r.has(s))throw new g(`Duplicate path parameter "{${s}}" detected in branch hierarchy.`,{code:"E_PATH_PARAM_COLLISION",help:"Change the parameter name in either this resource or its ancestor to ensure unique parameter names."});r.add(s)}}#t(e,t){for(let i of this.api.exposes.values())if(i.parent?.key===e){let r=[...t,i.resourcePath];this.#e(r),this.#t(i.key,r)}}#r(e){let t=[e],i=this.parent?.key;for(;i;){let r=this.api.exposes.get(i);if(!r)break;t.unshift(r.resourcePath),i=r.parent?.key}this.#e(t),this.#t(this.key,t)}getAbsoluteResourcePath(){let e=Xt(this.resourcePath),t=this.parent?.key;for(;t;){let i=this.api.exposes.get(t);if(!i)break;let r=Xt(i.resourcePath);e=ua(r,e),t=i.parent?.key}return e}getAbsoluteCollectionPath(){if(!this.hasCollection||!this.collectionPath)return;let e=Xt(this.collectionPath),t=this.parent?.key;for(;t;){let i=this.api.exposes.get(t);if(!i)break;let r=Xt(i.resourcePath);e=ua(r,e),t=i.parent?.key}return e}getAllRules(){let e=[];this.api.accessRules.forEach(i=>{i.inheritable&&e.push(i)});let t=this;for(;t;)t.accessRules&&(t===this?e.push(...t.accessRules):e.push(...t.accessRules.filter(i=>i.inheritable))),t=t.parent?this.api.exposes.get(t.parent.key):void 0;return e}getAllRateLimiters(){let e=[];this.api.rateLimiting&&e.push(this.api.rateLimiting);let t=this;for(;t;)t.rateLimiting&&e.push(t.rateLimiting),t=t.parent?this.api.exposes.get(t.parent.key):void 0;return e}getAllRateLimiterRules(){let e=[];this.api.rateLimiting&&e.push(...this.api.rateLimiting.rules);let t=this;for(;t;)t.rateLimiting&&e.push(...t.rateLimiting.rules),t=t.parent?this.api.exposes.get(t.parent.key):void 0;return e}addAction(e){if(this.actions.some(i=>i.kind===e.kind))throw new g(`Action of kind "${e.kind}" already exists for this exposure`,{code:"E_ACTION_USED",help:"There's no need to add an API action again."});let t=$s(this,e);return this.actions.push(t),t}addActionFromKind(e){if(this.actions.some(i=>i.kind===e))throw new g(`Action of kind "${e}" already exists for this exposure`,{code:"E_ACTION_USED",help:"There's no need to add an API action again."});let t=Ba(this,e);return this.actions.push(t),t}createPaginationContract(){let e=this.api.domain?.findEntity(this.entity.key,this.entity.domain);if(!e)throw new g(`Entity "${this.entity.key}" not found"`,{code:"E_ENTITY_NOT_FOUND",help:"The set entity does not exist."});this.paginationContract?(this.paginationContract.filterableFields=[],this.paginationContract.searchableFields=[],this.paginationContract.sortableFields=[]):this.paginationContract={filterableFields:[],searchableFields:[],sortableFields:[]};for(let t of e.properties)t.index&&(this.paginationContract.filterableFields.push(t.key),this.paginationContract.sortableFields.push(t.key)),t.search&&this.paginationContract.searchableFields.push(t.key)}};function nt(o,e){let t=o;for(let i of e){if(typeof t!="object"||t===null)return!1;if(t.properties&&typeof t.properties=="object"&&i in t.properties){t=t.properties[i];continue}return!(t.properties&&t.additionalProperties===!1||t.type&&t.type!=="object"&&t.type!=="any")}return!0}var qi=(o={})=>{let e={...Zr,...o};return o.metadata&&(e.metadata={...o.metadata}),{id:y.Currency,config:e}},Zr={storageFormat:"decimal",defaultCurrency:"USD",decimalPlaces:2,allowNegative:!1,validateCurrencyCode:!0},H_={USD_DECIMAL:qi({storageFormat:"decimal",defaultCurrency:"USD",decimalPlaces:2,allowNegative:!1}),USD_CENTS:qi({storageFormat:"integer_cents",defaultCurrency:"USD",decimalPlaces:2,allowNegative:!1}),MULTI_CURRENCY:qi({storageFormat:"complex_object",allowedCurrencies:["USD","EUR","GBP","JPY","CAD"],decimalPlaces:2,allowNegative:!1}),WITH_NEGATIVES:qi({storageFormat:"decimal",defaultCurrency:"USD",decimalPlaces:2,allowNegative:!0}),HIGH_PRECISION:qi({storageFormat:"decimal",defaultCurrency:"BTC",decimalPlaces:8,allowNegative:!1})};var go={requireVerification:!0,allowSubaddressing:!0,allowInternational:!0};var yo={requireCountryCode:!0,format:"international",allowExtension:!1,requireVerification:!1,verificationMethod:"sms"};function Id(o){let e=o.type,i=o.readWebBinding()?.format,r=o.multiple,s;if(e==="string"){let a=o.schema?.maximum;if(o.schema?.defaultValue?.type==="function"&&o.schema.defaultValue.value==="random"){let n=o.schema.defaultValue.config;if(n){let l=0,c=!1;n.isFixed?n.length&&(l=n.length,c=!0):a&&(l=a,c=!0),c&&(n.prefix&&(l+=n.prefix.length),n.suffix&&(l+=n.suffix.length),(!a||l>a)&&(a=l))}}s=a?`VARCHAR(${a})`:"TEXT"}else if(e==="number"){let a=o.schema?.defaultValue?.type==="function"&&o.schema.defaultValue.value==="incremental";i==="int32"?s="INTEGER":i==="int64"?s="BIGINT":i==="float"||i==="double"?s="DOUBLE PRECISION":a?s="BIGINT":s="NUMERIC"}else e==="boolean"?s="BOOLEAN":e==="date"?s="DATE":e==="datetime"?s="TIMESTAMPTZ":e==="time"?s="TIME":e==="binary"||e==="json"?s="JSONB":s="TEXT";return r?`${s}[]`:s}function bo(o){let e=o.getExposedName();if(!e)throw new g("Property missing a name definition.",{code:"E_PROPERTY_NAME_MISSING",status:500});let t=null;if(o.schema?.defaultValue){let u=o.schema.defaultValue.type,m=String(o.schema.defaultValue.value);if(u==="function"){let h=o.type;if(h==="string"){if(m==="uuid-v4"&&o.primary)throw new g("Function 'uuid-v4' cannot be used as a default for a primary key string.",{code:"E_INVALID_DEFAULT_FUNCTION",status:400});if(m!=="random"&&m!=="uuid-v4")throw new g(`Function '${m}' is not supported for string properties.`,{code:"E_INVALID_DEFAULT_FUNCTION",status:400})}else if(h==="number"){if(m!=="incremental")throw new g(`Function '${m}' is not supported for number properties.`,{code:"E_INVALID_DEFAULT_FUNCTION",status:400})}else if(["date","time","datetime"].includes(h)){if(m!=="now")throw new g(`Function '${m}' is not supported for ${h} properties.`,{code:"E_INVALID_DEFAULT_FUNCTION",status:400})}else throw new g(`Functions are not supported as default values for ${h} properties.`,{code:"E_INVALID_DEFAULT_FUNCTION",status:400})}t={type:u,value:m}}let i=!!o.primary,r=!o.required&&!i,s=!!o.unique;!t&&o.hasSemantic(y.DeletedFlag)&&(t={type:"literal",value:"false"});let a=o.getSemantic(y.Currency);if(a){let u=a.config??{},m=u.storageFormat||Zr.storageFormat;if(m==="complex_object")return[{name:e,dataType:"JSONB",isNullable:r,isPrimary:i,isUnique:s,defaultRule:null}];if(m==="decimal"||m==="integer_cents"){let h=u.decimalPlaces??Zr.decimalPlaces,f=m==="decimal"?`NUMERIC(19, ${h})`:"BIGINT";return[{name:`${e}_amount`,dataType:f,isNullable:r,isPrimary:i,isUnique:s,defaultRule:t},{name:`${e}_currency`,dataType:"CHAR(3)",isNullable:r,isPrimary:!1,isUnique:!1,defaultRule:{type:"literal",value:u.defaultCurrency||"USD"}}]}}let n=[{name:e,dataType:Id(o),isNullable:r,isPrimary:i,isUnique:s,defaultRule:t}],l=!1,c=o.getSemantic(y.Email);c&&(l=(c.config??go).requireVerification!==!1);let p=o.getSemantic(y.Phone);return p&&(l=(p.config??yo).requireVerification===!0),l&&n.push({name:`_${e}_verified`,dataType:"BOOLEAN",isNullable:!1,isPrimary:!1,isUnique:!1,defaultRule:{type:"literal",value:"false"}},{name:`_${e}_token`,dataType:"VARCHAR(255)",isNullable:!0,isPrimary:!1,isUnique:!1,defaultRule:null},{name:`_${e}_expires_at`,dataType:"TIMESTAMPTZ",isNullable:!0,isPrimary:!1,isUnique:!1,defaultRule:null}),n}function jd(o){let e=o.toUpperCase().split("(")[0];return e==="CHARACTER VARYING"&&(e="VARCHAR"),e==="CHARACTER"&&(e="CHAR"),e}function $d(o,e){let t=e.toUpperCase(),i=jd(o.dataType),r=t.split("(")[0];if(i===r){if(i==="VARCHAR"){let a=o.dataType.match(/\((\d+)\)/),n=a?Number.parseInt(a[1],10):null,l=t.match(/\((\d+)\)/),c=l?Number.parseInt(l[1],10):null;return!!(!c||n&&c>=n)}return!0}return{INTEGER:["BIGINT","NUMERIC","VARCHAR","TEXT"],BIGINT:["NUMERIC","VARCHAR","TEXT"],DATE:["TIMESTAMPTZ"],BOOLEAN:["VARCHAR","TEXT"]}[i]?.includes(r)||!1}function Od(o,e,t,i,r){if(!e.actions)return;let s=e.entity.key,a=t.get(s),n=i.findEntity(s);if(!a)return;let l=Array.from(a.withInheritedProperties()),c=new Set(l.map(m=>m.key)),p=Array.from(a.withInheritedAssociations()),u=new Set(p.map(m=>m.key));for(let m of e.actions)if(!(!m.projection||!Array.isArray(m.projection.fields)))for(let h of m.projection.fields)if(h.type==="association"){let f=h.key.split("."),k=f[0];if(u.has(k)){let w=p.find(b=>b.key===k);f.length>1&&(!w||w.schema?.embedded!==!0)&&r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:m.kind,fieldType:"association",fieldKey:h.key,reason:`Projected association '${h.key}' is invalid because association '${k}' is not embedded.`})}else{let w=!1,b=`Projected association '${h.key}' no longer exists on entity '${a.info.getLabel()}'.`;if(n){let _=Array.from(n.withInheritedAssociations()).find(E=>E.key===k);if(_){let E;try{E=_.getExposedName()}catch{}if(E){let x=p.find(I=>{try{return I.getExposedName()===E}catch{return!1}});x&&(f.length>1&&x.schema?.embedded!==!0?b=`Projected association '${h.key}' is invalid because remapped association '${x.key}' is not embedded.`:w=!0)}}}w||r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:m.kind,fieldType:"association",fieldKey:h.key,reason:b})}}else{let f=h.key.split("."),k=f[0];if(c.has(k)){let w=l.find(b=>b.key===k);f.length>1&&(!w||w.type!=="json"?r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:m.kind,fieldType:"property",fieldKey:h.key,reason:`Projected property '${h.key}' is invalid because root property '${k}' is not of type 'json'.`}):w.jsonSchema&&(nt(w.jsonSchema,f.slice(1))||r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:m.kind,fieldType:"property",fieldKey:h.key,reason:`Projected property '${h.key}' is invalid according to the JSON Schema of '${k}'.`})))}else{let w=!1;if(n){let b=Array.from(n.withInheritedProperties()).find(_=>_.key===k);if(b){let _;try{_=b.getExposedName()}catch{}if(_){let E=l.find(x=>{try{return x.getExposedName()===_}catch{return!1}});E&&(f.length===1||E.type==="json")&&(w=!0,f.length>1&&E.jsonSchema&&(nt(E.jsonSchema,f.slice(1))||(w=!1)))}}}w||r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:m.kind,fieldType:"property",fieldKey:h.key,reason:`Projected property '${h.key}' no longer exists on entity '${a.info.getLabel()}'.`})}}}function Td(o,e,t,i,r){if(!e.paginationContract)return;let s=e.paginationContract,a=e.entity.key,n=t.get(a);if(!n)return;let l=Array.from(n.withInheritedProperties()),c=new Set(l.map(m=>m.key)),p=i.findEntity(a),u=(m,h)=>{if(!(!m||!Array.isArray(m)))for(let f of m){let k=f.split("."),w=k[0];if(c.has(w)){let b=l.find(_=>_.key===w);k.length>1&&(!b||b.type!=="json"?r.paginationFieldsWithMismatches.push({exposureKey:o,fieldGroup:h,fieldKey:f,reason:`The ${h} field '${f}' is invalid because root property '${w}' is not of type 'json'.`}):b.jsonSchema&&(nt(b.jsonSchema,k.slice(1))||r.paginationFieldsWithMismatches.push({exposureKey:o,fieldGroup:h,fieldKey:f,reason:`The ${h} field '${f}' is invalid according to the JSON Schema of '${w}'.`})))}else{let b=!1;if(p){let _=Array.from(p.withInheritedProperties()).find(E=>E.key===w);if(_){let E;try{E=_.getExposedName()}catch{}if(E){let x=l.find(I=>{try{return I.getExposedName()===E}catch{return!1}});x&&(k.length===1||x.type==="json")&&(b=!0,k.length>1&&x.jsonSchema&&(nt(x.jsonSchema,k.slice(1))||(b=!1)))}}}b||r.paginationFieldsWithMismatches.push({exposureKey:o,fieldGroup:h,fieldKey:f,reason:`The ${h} field '${f}' no longer exists on entity '${n.info.getLabel()}'.`})}}};u(s.filterableFields,"filterable"),u(s.sortableFields,"sortable"),u(s.searchableFields,"searchable")}function wo(o,e){let t=o.domain,i={hasUpdate:!1,canProceed:!0,breakingChanges:[],exposedEntitiesToRemove:[],subEndpointsToRemove:[],userModelRemapping:[],sessionPropertiesToRemove:[],accessRulesWithMismatches:[],paginationFieldsWithMismatches:[],actionProjectionsWithMismatches:[]};if(!t)return i.hasUpdate=!0,i;if(t.key===e.key&&t.info.version===e.info.version)return i;i.hasUpdate=!0;let r=new Map;for(let w of t.listEntities())r.set(w.key,w);let s=new Map;for(let w of e.listEntities())s.set(w.key,w);let a=new Set;for(let[w,b]of o.exposes.entries()){let _=r.has(b.entity.key),E=s.get(b.entity.key);if(!E){let x=r.get(b.entity.key)?.info.getLabel()||b.entity.key;i.exposedEntitiesToRemove.push({key:w,entityKey:b.entity.key,name:b.entity.key,reason:`Entity ${x} no longer exists in the domain.`}),a.add(w);continue}if(_){let x=r.get(b.entity.key),I=new Map;for(let L of x.withInheritedProperties())try{let R=L.getExposedName();R&&I.set(R,L)}catch{}let j=new Map;for(let L of E.withInheritedProperties())try{let R=L.getExposedName();R&&j.set(R,L)}catch{}for(let[L,R]of I.entries()){let G=j.get(L);if(!G)continue;let J=bo(R),le=bo(G);for(let Z of J){let ce=le.find(lt=>lt.name===Z.name);if(!ce)continue;if(Z.isPrimary&&!ce.isPrimary){i.canProceed=!1;let lt=x.info.getLabel(),ct=`Cannot remove Primary Key constraint from column '${Z.name}' in entity '${lt}'.`;i.breakingChanges.push({type:"primary_key_removed",entityKey:x.key,propertyKey:R.key,reason:ct})}if(!$d(Z,ce.dataType)){i.canProceed=!1;let lt=x.info.getLabel(),ct=`Cannot safely cast column '${Z.name}' in entity '${lt}' from ${Z.dataType} to ${ce.dataType}.`;i.breakingChanges.push({type:"type_change_unsafe",entityKey:x.key,propertyKey:R.key,reason:ct})}let xe=Z.isNullable&&!ce.isNullable,as=!!ce.defaultRule;if(xe&&!as){i.canProceed=!1;let lt=x.info.getLabel(),ct=`Cannot make column '${Z.name}' in entity '${lt}' required without providing a default value to backfill existing records.`;i.breakingChanges.push({type:"column_not_null_missing_default",entityKey:x.key,propertyKey:R.key,reason:ct})}}}}}let n=!0;for(;n;){n=!1;for(let[w,b]of o.exposes.entries())if(!a.has(w)&&b.parent){let _=o.exposes.get(b.parent.key),E=r.get(_.entity.key),x=E?.info.getLabel()||_.entity.key;if(a.has(b.parent.key)){i.subEndpointsToRemove.push({key:w,parentKey:b.parent.key,associationKey:b.parent.association.key,name:b.entity.key,reason:`Parent exposure for entity ${x} is scheduled for removal.`}),a.add(w),n=!0;continue}let I=s.get(_.entity.key);if(!I){i.subEndpointsToRemove.push({key:w,parentKey:b.parent.key,associationKey:b.parent.association.key,name:b.entity.key,reason:`Parent entity ${x} is scheduled for removal.`}),a.add(w),n=!0;continue}let j=Array.from(I.withInheritedAssociations()).find(J=>J.key===b.parent?.association.key),L=E?Array.from(E.withInheritedAssociations()).find(J=>J.key===b.parent?.association.key):void 0,R=j?.info.getLabel()||L?.info.getLabel()||b.parent?.association.key;if(!j){i.subEndpointsToRemove.push({key:w,parentKey:b.parent.key,associationKey:b.parent.association.key,name:b.entity.key,reason:`Parent association ${R} is missing in the new domain.`}),a.add(w),n=!0;continue}if(!j.targets.some(J=>J.key===b.entity.key&&(!J.domain||J.domain===e.key))){let le=(r.get(b.entity.key)||s.get(b.entity.key))?.info.getLabel()||b.entity.key;i.subEndpointsToRemove.push({key:w,parentKey:b.parent.key,associationKey:b.parent.association.key,name:b.entity.key,reason:`Target entity ${le} is no longer a valid target for the parent association ${R}.`}),a.add(w),n=!0;continue}}}let l,c;if(o.user&&(l=r.get(o.user.key),c=s.get(o.user.key),!c)){i.canProceed=!1;let b=`User entity '${l?.info.getLabel()||o.user.key}' no longer exists in the new domain version.`;i.breakingChanges.push({type:"user_entity_missing",entityKey:o.user.key,propertyKey:"",reason:b})}if(o.user&&c&&l){let w=Array.from(l.withInheritedProperties()),b=Array.from(c.withInheritedProperties());if(o.session?.properties)for(let _ of o.session.properties){let E=w.find(j=>j.key===_.key);if(!E){i.sessionPropertiesToRemove.push(_.key);continue}let x;try{x=E.getExposedName()}catch{}if(!x){i.sessionPropertiesToRemove.push(_.key);continue}let I=b.find(j=>{try{return j.getExposedName()===x}catch{return!1}});I?I.key!==E.key&&i.userModelRemapping.push({oldPropertyKey:E.key,newPropertyKey:I.key,exposedName:x,reason:`Property ${E.info.getLabel(E.key)} has been renamed to ${I.info.getLabel(I.key)}.`}):i.sessionPropertiesToRemove.push(_.key)}}let p;c&&(p=Array.from(c.withInheritedProperties()).find(w=>w.hasSemantic(y.UserRole)));let u=p?.schema?.enum,m=(w,b)=>{if(w.type==="matchUserRole"){let _=w;if(!p)i.accessRulesWithMismatches.push({ruleType:"matchUserRole",location:b,reason:"No role field configured on the new user model."});else if(u&&Array.isArray(u))for(let E of _.role)u.includes(E)||i.accessRulesWithMismatches.push({ruleType:"matchUserRole",location:b,reason:`Role '${E}' is no longer a valid role in the new user model.`})}},h=(w,b,_)=>{if(w.type==="matchResourceAttribute"){let E=w;if(!_)return;let x=s.get(_);if(!x)return;let I=Array.from(x.withInheritedProperties());if(!I.some(L=>L.key===E.attribute)){let L=r.get(_),R=E.attribute,G=!1;if(L){let J=Array.from(L.withInheritedProperties()).find(le=>le.key===E.attribute);if(J){R=J.info.getLabel(J.key);let le;try{le=J.getExposedName()}catch{}le&&I.find(ce=>{try{return ce.getExposedName()===le}catch{return!1}})&&(G=!0)}}if(!G){let J=x.info.getLabel();i.accessRulesWithMismatches.push({ruleType:"matchResourceAttribute",location:b,reason:`Property attribute '${R}' no longer exists on entity '${J}'.`})}}}},f=(w,b,_)=>{if(w.type==="matchResourceOwner"){let E=w;if(E.target==="user-entity"){o.user&&!c&&i.accessRulesWithMismatches.push({ruleType:"matchResourceOwner",location:b,reason:"User entity is missing in the new domain."});return}if(!_)return;let x=s.get(_);if(!x)return;if(E.property){let I=Array.from(x.withInheritedProperties()),j=Array.from(x.withInheritedAssociations());if(!(I.some(R=>R.key===E.property)||j.some(R=>R.key===E.property))){let R=r.get(_),G=E.property,J=!1;if(R){let le=Array.from(R.withInheritedProperties()),Z=Array.from(R.withInheritedAssociations()),ce=le.find(xe=>xe.key===E.property)||Z.find(xe=>xe.key===E.property);if(ce){G=ce.info.getLabel(ce.key);let xe;try{xe=ce.getExposedName()}catch{}if(xe){let as=I.find(ct=>{try{return ct.getExposedName()===xe}catch{return!1}}),lt=j.find(ct=>{try{return ct.getExposedName()===xe}catch{return!1}});(as||lt)&&(J=!0)}}}if(!J){let le=x.info.getLabel();e.resolveOwnershipPath(_)!==null?i.accessRulesWithMismatches.push({ruleType:"matchResourceOwner",location:b,reason:`Direct ownership property '${G}' no longer exists on entity '${le}'. The resolved ownership path will be used instead.`}):i.accessRulesWithMismatches.push({ruleType:"matchResourceOwner",location:b,reason:`Ownership property '${G}' no longer exists on entity '${le}' and no transitively resolved ownership path is available.`})}}}else if(!(e.resolveOwnershipPath(_)!==null)){let j=x.info.getLabel();i.accessRulesWithMismatches.push({ruleType:"matchResourceOwner",location:b,reason:`No ownership property specified and no transitively resolved ownership path exists for entity '${j}'.`})}}},k=(w,b)=>{if(w.type==="matchUserProperty"){let _=w;if(o.user&&!c){i.accessRulesWithMismatches.push({ruleType:"matchUserProperty",location:b,reason:"User entity is missing in the new domain."});return}c&&_.property&&(Array.from(c.withInheritedProperties()).some(I=>I.key===_.property)||i.userModelRemapping.some(j=>j.oldPropertyKey===_.property)||i.accessRulesWithMismatches.push({ruleType:"matchUserProperty",location:b,reason:`User property '${_.property}' no longer exists on the User entity.`}))}};if(o.accessRules)for(let w of o.accessRules)m(w,{type:"api",key:o.key}),k(w,{type:"api",key:o.key});for(let[w,b]of o.exposes.entries())if(!a.has(w)){if(b.accessRules)for(let _ of b.accessRules)m(_,{type:"exposure",key:w}),h(_,{type:"exposure",key:w},b.entity.key),f(_,{type:"exposure",key:w},b.entity.key),k(_,{type:"exposure",key:w});if(b.actions){for(let _ of b.actions)if(_.accessRules)for(let E of _.accessRules)m(E,{type:"action",key:`${w}:${_.kind}`}),h(E,{type:"action",key:`${w}:${_.kind}`},b.entity.key),f(E,{type:"action",key:`${w}:${_.kind}`},b.entity.key),k(E,{type:"action",key:`${w}:${_.kind}`})}Od(w,b,s,t,i),Td(w,b,s,t,i)}return i}function ko(o,e,t){if(!t.canProceed)throw new g("Cannot apply domain update because it contains breaking changes. Details in the report.",{code:"E_CANNOT_PROCEED_WITH_UPGRADE",status:400});let i=o.domain;o.dependencies.clear(),o.dependencies.set(e.key,e),o.dependencyList=[{key:e.key,version:e.info.version}];let r=[...t.exposedEntitiesToRemove,...t.subEndpointsToRemove];for(let c of r)o.exposes.delete(c.key);if(o.user&&o.session){let c=new Set(t.sessionPropertiesToRemove),p=new Map;for(let u of t.userModelRemapping)p.set(u.oldPropertyKey,u.newPropertyKey);if(o.session.properties){let u=[];for(let m of o.session.properties){if(c.has(m.key))continue;let h=p.get(m.key);h?u.push({...m,key:h}):u.push(m)}o.session.properties=u}}let s=new Map;for(let c of e.listEntities())s.set(c.key,c);let a;if(o.user){let c=s.get(o.user.key);c&&(a=Array.from(c.withInheritedProperties()).find(p=>p.hasSemantic(y.UserRole)))}let n=a?.schema?.enum,l=(c,p)=>{let u=[];for(let m of c)if(m.type==="matchUserRole"){let h=m;if(!a)continue;if(n&&Array.isArray(n)){let f=h.role.filter(k=>n.includes(k));if(f.length===0)continue;h.role=f}u.push(m)}else if(m.type==="matchResourceAttribute"&&p){let h=m,f=s.get(p);if(!f)continue;let k=Array.from(f.withInheritedProperties());if(k.some(b=>b.key===h.attribute))u.push(m);else{let b,_=i?.findEntity(p);if(_){let x=Array.from(_.withInheritedProperties()).find(I=>I.key===h.attribute);if(x){let I;try{I=x.getExposedName()}catch{}I&&(b=k.find(j=>{try{return j.getExposedName()===I}catch{return!1}}))}}if(b)h.attribute=b.key,u.push(m);else continue}}else if(m.type==="matchResourceOwner"&&p){let h=m;if(h.target==="user-entity")u.push(m);else if(h.property){let f=s.get(p);if(!f)continue;let k=Array.from(f.withInheritedProperties()),w=Array.from(f.withInheritedAssociations());if(k.some(_=>_.key===h.property)||w.some(_=>_.key===h.property))u.push(m);else{let _,E=i?.findEntity(p);if(E){let x=Array.from(E.withInheritedProperties()),I=Array.from(E.withInheritedAssociations()),j=x.find(L=>L.key===h.property)||I.find(L=>L.key===h.property);if(j){let L;try{L=j.getExposedName()}catch{}if(L){let R=k.find(J=>{try{return J.getExposedName()===L}catch{return!1}}),G=w.find(J=>{try{return J.getExposedName()===L}catch{return!1}});R?_=R.key:G&&(_=G.key)}}}_?(h.property=_,u.push(m)):(h.property=void 0,u.push(m))}}else u.push(m)}else if(m.type==="matchUserProperty"){let h=m;if(o.user){let f=s.get(o.user.key);if(f&&h.property)if(Array.from(f.withInheritedProperties()).some(b=>b.key===h.property))u.push(m);else{let b=t.userModelRemapping.find(_=>_.oldPropertyKey===h.property);b?(h.property=b.newPropertyKey,u.push(m)):(h.property="",u.push(m))}else u.push(m)}else u.push(m)}else u.push(m);return u};o.accessRules&&(o.accessRules=l(o.accessRules));for(let c of o.exposes.values()){let p=c.entity.key,u=s.get(p),m=i?.findEntity(p),h=b=>b,f=b=>b,k=!1,w=!1;if(u){let b=Array.from(u.withInheritedProperties()),_=new Set(b.map(I=>I.key)),E=Array.from(u.withInheritedAssociations()),x=new Set(E.map(I=>I.key));h=I=>{let j=I.split("."),L=j[0],R=L,G=!1;if(_.has(L))G=!0;else if(m){let le=Array.from(m.withInheritedProperties()).find(Z=>Z.key===L);if(le){let Z;try{Z=le.getExposedName()}catch{}if(Z){let ce=b.find(xe=>{try{return xe.getExposedName()===Z}catch{return!1}});ce&&(R=ce.key,G=!0)}}}j[0]=R;let J=j.join(".");return G||(k=!0),J},f=I=>{let j=I.split("."),L=j[0],R=L,G=!1;if(x.has(L))G=!0;else if(m){let le=Array.from(m.withInheritedAssociations()).find(Z=>Z.key===L);if(le){let Z;try{Z=le.getExposedName()}catch{}if(Z){let ce=E.find(xe=>{try{return xe.getExposedName()===Z}catch{return!1}});ce&&(R=ce.key,G=!0)}}}j[0]=R;let J=j.join(".");return G||(w=!0),J}}if(c.accessRules&&(c.accessRules=l(c.accessRules,p)),c.actions)for(let b of c.actions)b.accessRules&&(b.accessRules=l(b.accessRules,p)),b.projection&&Array.isArray(b.projection.fields)&&(b.projection.fields=b.projection.fields.map(_=>{if(_.type==="association"){w=!1;let E=f(_.key),I=t.actionProjectionsWithMismatches.some(j=>j.exposureKey===c.key&&j.actionKind===b.kind&&j.fieldType==="association"&&j.fieldKey===_.key)||w?!0:_.invalid;return{..._,key:E,invalid:I}}else{k=!1;let E=h(_.key),I=t.actionProjectionsWithMismatches.some(j=>j.exposureKey===c.key&&j.actionKind===b.kind&&j.fieldType==="property"&&j.fieldKey===_.key)||k?!0:_.invalid;return{..._,key:E,invalid:I}}}));if(c.paginationContract&&u){let b=c.paginationContract;b.filterableFields&&(b.filterableFields=b.filterableFields.map(h)),b.sortableFields&&(b.sortableFields=b.sortableFields.map(h)),b.searchableFields&&(b.searchableFields=b.searchableFields.map(h))}}o.notifyChange()}var Ji=class o extends ui{kind;key;info;user;authentication;authorization;session;exposes;accessRules;rateLimiting;termsOfService;contact;license;pagination;#e=!0;#t=!1;get domain(){if(this.dependencyList.length===0)return;let e=this.dependencyList[0];return this.dependencies.get(e.key)}static createSchema(e={}){let{key:t=F(),exposes:i=[],pagination:r}=e,s=ee.fromJSON(e.info,{name:"Unnamed API"}).toJSON(),a={kind:Ae,key:t,info:s,exposes:i,pagination:r?structuredClone(r):{kind:"cursor"}};return e.user&&(a.user=structuredClone(e.user)),e.dependencyList&&(a.dependencyList=structuredClone(e.dependencyList)),e.authentication&&(a.authentication=structuredClone(e.authentication)),e.authorization&&(a.authorization=structuredClone(e.authorization)),e.session&&(a.session=structuredClone(e.session)),Array.isArray(e.accessRules)&&(a.accessRules=structuredClone(e.accessRules)),e.rateLimiting&&(a.rateLimiting=structuredClone(e.rateLimiting)),e.termsOfService&&(a.termsOfService=e.termsOfService),e.contact&&(a.contact=structuredClone(e.contact)),e.license&&(a.license=structuredClone(e.license)),a}constructor(e,t){let i=o.createSchema(e),r=[];if(t instanceof Ve)t.readOnly?r.push(t):(console.warn(`Domain ${t.key} is not read only, cloning it. This may have performance implications.`),r.push(t.clone({readOnly:!0})));else if(typeof t=="object"&&t.kind===Ce)r.push(new Ve(t,void 0,{readOnly:!0}));else if(t)throw new g("Invalid domain provided. Expected a DataDomain instance or schema.",{code:"E_DOMAIN_INVALID",help:"It looks like the provided data domain is not a valid instance or domain schema."});if(t){if(!t.info.version)throw new g(`Domain ${t.key} must have a version.`,{code:"E_DOMAIN_NO_VERSION",help:"Before attaching the data domain, give it a version name. Only versioned domains can be attached to an API model."});i.dependencyList=[{key:t.key,version:t.info.version}]}super(i.dependencyList,r),this.kind=i.kind,this.key=i.key,this.info=new ee(i.info),this.user=i.user,this.pagination=i.pagination?structuredClone(i.pagination):{kind:"cursor"},i.authentication&&(this.authentication=structuredClone(i.authentication)),i.authorization&&(this.authorization=structuredClone(i.authorization)),i.session&&(this.session=structuredClone(i.session)),Array.isArray(i.exposes)?this.exposes=new Map(i.exposes.map(s=>[s.key,new Dt(this,s)])):this.exposes=new Map,Array.isArray(i.accessRules)?this.accessRules=i.accessRules.map(s=>ai(this,s)):this.accessRules=[],i.rateLimiting&&(this.rateLimiting=new yt(i.rateLimiting)),i.termsOfService&&(this.termsOfService=i.termsOfService),i.contact&&(this.contact=i.contact),i.license&&(this.license=i.license),this.#e=!1}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON(),exposes:Array.from(this.exposes.values()).map(t=>t.toJSON()),pagination:structuredClone(this.pagination)};return this.user&&(e.user={...this.user}),this.dependencyList.length>0&&(e.dependencyList=structuredClone(this.dependencyList)),this.authentication&&(e.authentication=structuredClone(this.authentication)),this.authorization&&(e.authorization=structuredClone(this.authorization)),this.session&&(e.session=structuredClone(this.session)),Array.isArray(this.accessRules)&&this.accessRules.length>0&&(e.accessRules=this.accessRules.map(t=>t.toJSON())),this.rateLimiting&&(e.rateLimiting=this.rateLimiting.toJSON()),this.termsOfService&&(e.termsOfService=this.termsOfService),this.contact&&(e.contact=structuredClone(this.contact)),this.license&&(e.license=structuredClone(this.license)),e}notifyChange(){this.#t||this.#e||(this.#t=!0,queueMicrotask(()=>{this.#t=!1;let e=new Event("change");this.dispatchEvent(e)}))}exposeEntity(e,t){let i=this.domain;if(!i)throw new g("No domain attached to API model",{code:"E_NO_DOMAIN",help:"Attach a data domain to the API model before exposing entities."});let r=Pe(e,this.domain?.key);if(t?.parentId){let u=this.exposes.get(t.parentId);if(!u)throw new g(`Parent exposure not found: ${t.parentId}`,{code:"E_PARENT_NOT_FOUND",help:"Make sure the parent exposure key you provided is correct."});let m;for(let J of this.exposes.values())if(J.parent?.key===u.key&&Pe(J.entity,this.domain?.key)===r){m=J;break}if(m)throw new g(`Entity ${e.key} is already exposed under the specified parent.`,{code:"E_ENTITY_ALREADY_EXPOSED",help:"Do not try to expose already exposed entity under the same parent."});let h;for(let J of this.exposes.values())if(Pe(J.entity,this.domain?.key)===r){h=J;break}if(h&&t?.promoteOnReuse)return this.promoteToRoot(h,i),h;let f=this.findAssociation(u.entity.key,u.entity.domain,e,i);if(!f)throw new g(`No association found from parent entity "${u.entity.key}" to target entity "${e.key}"`,{code:"E_ASSOCIATION_NOT_FOUND",help:"Ensure there is a defined association in the data domain connecting these entities."});let k=f.info.name||"",w=Xr(k.toLocaleLowerCase()),b=f.multiple!==!1,_=i.findEntity(e.key,e.domain);if(!_)throw new g(`Entity not found in domain: ${e.key}`,{code:"E_NO_ENTITY"});let E=mi(_.info.name||""),x=b?`/${w}`:void 0,I=b?`/${w}/{${E}}`:`/${w}`,L=(u.parent?.depth??0)+1,R={kind:Et,key:F(),entity:{...e},actions:[],isRoot:!1,collectionPath:x,resourcePath:"",hasCollection:b,parent:{key:u.key,association:{key:f.key,domain:u.entity.domain},depth:L}};t&&(R.exposeOptions={...t});let G=new Dt(this,R);return G.setResourcePath(I),this.exposes.set(G.key,G),t?.followAssociations&&(t?.maxDepth===void 0||t.maxDepth>L)&&this.followEntityAssociations(R,t),this.notifyChange(),G}let s;for(let u of this.exposes.values())if(u.isRoot&&Pe(u.entity,this.domain?.key)===r){s=u;break}if(s)throw new g(`Entity ${e.key} is already exposed.`,{code:"E_ENTITY_ALREADY_EXPOSED",help:"Do not try to expose already exposed entity."});let a=i.findEntity(e.key,e.domain);if(!a)throw new g(`Entity not found in domain: ${e.key}`,{code:"E_NO_ENTITY",help:"Make sure the entity you are trying to expose exists in the data domain."});let{collectionPath:n,resourcePath:l}=this.generateUniqueRootPaths(a.info.name||""),c={kind:Et,key:F(),entity:{...e},actions:[],isRoot:!0,collectionPath:n,resourcePath:l,hasCollection:!0};t&&(c.exposeOptions={...t});let p=new Dt(this,c);return this.exposes.set(p.key,p),t?.followAssociations&&(t?.maxDepth===void 0||t.maxDepth>0)&&this.followEntityAssociations(c,t),this.notifyChange(),p}promoteToRoot(e,t){if(e.isRoot)return;let i=t.findEntity(e.entity.key,e.entity.domain);if(i){let{collectionPath:r,resourcePath:s}=this.generateUniqueRootPaths(i.info.name||"");e.isRoot=!0,e.parent=void 0,e.hasCollection=!0,e.collectionPath=r,e.setResourcePath(s)}}generateUniqueRootPaths(e){let t=Xr(e.toLocaleLowerCase()),i=mi(e),r=`/${t}`,s=`/${t}/{${i}}`,a=1,n=r;for(;this.findCollectionPathCollision(r);)r=`${n}-${a}`,s=`${r}/{${i}}`,a++;return{collectionPath:r,resourcePath:s}}findAssociation(e,t,i,r){let s=r.findEntity(e,t);if(!s)throw new g(`Parent entity not found in domain: ${e}`,{code:"E_NO_ENTITY"});for(let a of s.listAssociations())for(let n of a.targets)if(n.key===i.key&&n.domain===i.domain)return a}followEntityAssociations(e,t){let i=this.domain;if(!i)throw new g("No domain attached to API model",{code:"E_NO_DOMAIN"});let r=t.maxDepth??6,s=Pe(e.entity,this.domain?.key);this.followAssociationsRecursive(e.entity,e.key,0,[s],t,r,i)}followAssociationsRecursive(e,t,i,r,s,a,n){let l=n.findEntity(e.key,e.domain);if(l)for(let c of l.listAssociations())for(let p of c.targets){let u=Pe(p,this.domain?.key),m=Pe(e,this.domain?.key);if(u===m||r.includes(u))continue;let h=Pe(p,this.domain?.key),f;for(let R of this.exposes.values())if(Pe(R.entity,this.domain?.key)===h){f=R;break}if(f){if(!f.isRoot&&s?.promoteOnReuse){let R=!1;if(f.parent){let G=this.exposes.get(f.parent.key);if(G){let J=Pe(G.entity,this.domain?.key);r.includes(J)&&(R=!0)}}R||this.promoteToRoot(f,n);continue}if(f.isRoot)continue}let k=n.findEntity(p.key,p.domain);if(!k)continue;let w=c.info.name||"",b=Xr(w.toLocaleLowerCase()),_=c.multiple!==!1,E=mi(k.info.name||""),x=_?`/${b}`:void 0,I=_?`/${b}/{${E}}`:`/${b}`,j={kind:Et,key:F(),entity:{...p},actions:[],isRoot:!1,collectionPath:x,resourcePath:"",hasCollection:_,parent:{key:t,association:{key:c.key,domain:e.domain},depth:i+1}},L=new Dt(this,j);L.setResourcePath(I),this.exposes.set(L.key,L),i+1>=a?j.truncated=!0:this.followAssociationsRecursive(p,j.key,i+1,[...r,u],s,a,n)}}removeExposedEntity(e){if(!this.exposes.has(e))throw new g(`Exposed entity with key "${e}" not found.`,{code:"E_NO_EXPOSURE",help:"The exposed entity you are trying to remove does not exist."});this.removeWithChildren(e),this.notifyChange()}removeWithChildren(e){if(!this.exposes.has(e))return;this.exposes.delete(e);let t=i=>{for(let r of this.exposes.values())r.parent?.key===i&&(t(r.key),this.exposes.delete(r.key))};t(e)}cleanForDomainChange(){this.dependencies.clear(),this.dependencyList=[],this.exposes=new Map,this.user=void 0,this.session&&(this.session.properties=[]),this.notifyChange()}attachDataDomain(e){if(!e.info.version)throw new g("Cannot attach DataDomain without a version. Please set the version in the domain info.",{code:"E_DOMAIN_NO_VERSION",help:"Before attaching the data domain, give it a version name. Only versioned domains can be attached to an API model."});this.cleanForDomainChange(),this.dependencies.set(e.key,e),this.dependencyList=[{key:e.key,version:e.info.version}];for(let t of e.listEntities())if(t.hasSemantic(y.User)){this.user={key:t.key};break}this.notifyChange()}findExposedByEntity(e){let t=Pe(e,this.domain?.key);for(let i of this.exposes.values())if(Pe(i.entity,this.domain?.key)===t)return i}findResourcePathCollision(e,t){for(let i of this.exposes.values())if(!(t&&i.key===t)&&i.isRoot&&i.resourcePath===e)return i}findCollectionPathCollision(e,t){for(let i of this.exposes.values())if(!(t&&i.key===t)&&i.isRoot&&i.hasCollection&&i.collectionPath===e)return i}hasDomainUpdate(e){let t=this.domain;return t?t.key!==e.key||t.info.version!==e.info.version:!0}analyzeDomainUpdate(e){return wo(this,e)}applyDomainUpdate(e,t){ko(this,e,t),this.notifyChange()}};function $(o,e){return`${o}_${e}`}function ma(o){let e=[],t={apiModelKey:o.key,kind:Ae,key:o.key};return o.kind!==Ae&&e.push({code:$("API","INVALID_KIND"),message:"The API model type is incorrect.",suggestion:'Set the model type to "ApiModel".',severity:"error",context:{...t,property:"kind"}}),(!o.key||typeof o.key!="string"||o.key.trim()==="")&&e.push({code:$("API","MISSING_KEY"),message:"The API model is missing a unique identifier.",suggestion:"Provide a valid name to use as a unique identifier.",severity:"error",context:{...t,property:"key"}}),(!o.info||!o.info.name||o.info.name.trim()==="")&&e.push({code:$("API","MISSING_NAME"),message:"The API model has no defined name.",suggestion:"Provide a descriptive name for your API.",severity:"error",context:{...t,property:"info.name"}}),(!o.info||!o.info.description||o.info.description.trim()==="")&&e.push({code:$("API","MISSING_DESCRIPTION"),message:"Adding a description helps others understand your API.",suggestion:"Add a description to clarify the purpose of this API.",severity:"warning",context:{...t,property:"info.description"}}),e}function ha(o){let e=[],t={apiModelKey:o.key,kind:Ae,key:o.key},i=o.domain;return i?((!i.info||!i.info.version)&&e.push({code:$("API","MISSING_DOMAIN_VERSION"),message:"The selected Data Domain is missing a version number.",suggestion:"Specify a version for the attached Data Domain.",severity:"error",context:t}),e):(e.push({code:$("API","MISSING_DOMAIN"),message:"No Data Domain is attached to the API.",suggestion:"Select a Data Domain from the settings to power your API.",severity:"error",context:t}),e)}function fa(o){let e=[],t={apiModelKey:o.key,kind:Ae,key:o.key},i=o.domain&&o.user?o.domain.findEntity(o.user.key,o.user.domain):void 0;if(!o.authentication)e.push({code:$("API","MISSING_AUTHENTICATION"),message:"The API is missing authentication settings.",suggestion:"Go to the security settings and configure how users authenticate.",severity:"error",context:{...t,property:"authentication"}});else if(o.authentication.strategy==="UsernamePassword"&&i){let r;for(let a of i.properties)if(a.hasSemantic(y.Password)){r=a;break}r||e.push({code:$("API","MISSING_PASSWORD_SEMANTIC"),message:"The selected user model requires a property with the Password data semantic for authentication.",suggestion:'Go to the Data Modeler and add the "Password" semantic to the password property.',severity:"error",context:{...t,property:"user"}});let s;for(let a of i.properties)if(a.hasSemantic(y.Username)){s=a;break}s||e.push({code:$("API","MISSING_USERNAME_SEMANTIC"),message:"Username & Password authentication requires a field with the Username data semantic.",suggestion:'Go to the Data Modeler and add the "Username" semantic to the property used for login.',severity:"error",context:{...t,property:"user"}})}if(!o.authorization)e.push({code:$("API","MISSING_AUTHORIZATION"),message:"The API is missing authorization settings.",suggestion:"Go to the security settings and configure how to handle user permissions.",severity:"error",context:{...t,property:"authorization"}});else if(o.authorization.strategy==="RBAC"&&i){let r;for(let s of i.properties)if(s.hasSemantic(y.UserRole)){r=s;break}r||e.push({code:$("API","MISSING_ROLE_SEMANTIC"),message:"Role-based access control requires a property with the User Role data semantic on the user model.",suggestion:'Go to the Data Modeler and add the "User Role" semantic to the property used for roles.',severity:"error",context:{...t,property:"user"}})}if(!o.session)e.push({code:$("API","MISSING_SESSION"),message:"The API is missing session configuration.",suggestion:"Configure how user sessions will be handled.",severity:"error",context:{...t,property:"session"}});else{if(o.session.secret||e.push({code:$("API","MISSING_SESSION_SECRET"),message:"A secure encryption key is required for sessions.",suggestion:"Provide a strong security key in the session settings.",severity:"error",context:{...t,property:"session.secret"}}),!o.session.properties||o.session.properties.length===0)e.push({code:$("API","MISSING_SESSION_PROPERTIES"),message:"The session token needs to include at least one piece of user information, like an ID.",suggestion:"Select fields that should be stored securely inside the session payload.",severity:"error",context:{...t,property:"session.properties"}});else if(o.authorization&&o.authorization.strategy==="RBAC"&&i){let a;for(let n of i.properties)if(n.hasSemantic(y.UserRole)){a=n;break}a&&!o.session.properties.find(n=>n.key===a?.key)&&e.push({code:$("API","MISSING_RBAC_SESSION_PROPERTY"),message:"The user role must be included in the session data for permissions to work.",suggestion:"Make sure your selected role property is checked in the session settings.",severity:"error",context:{...t,property:"session.properties"}})}let{cookie:r,jwt:s}=o.session;(!r||!r.enabled)&&(!s||!s.enabled)&&e.push({code:$("API","MISSING_SESSION_TRANSPORT"),message:"No delivery method for sessions (like cookies or tokens) is enabled.",suggestion:"Enable at least one session delivery mechanism in the security settings.",severity:"error",context:{...t,property:"session"}})}if(o.user?o.domain&&!o.domain.findEntity(o.user.key,o.user.domain)&&e.push({code:$("API","INVALID_USER_ENTITY"),message:"The selected user model no longer exists in your data domain.",suggestion:"Please navigate to security settings and select a valid user model.",severity:"error",context:{...t,property:"user"}}):e.push({code:$("API","MISSING_USER_ENTITY"),message:"You need to specify what kind of object represents your users.",suggestion:"Select a model from your domain that stores your user accounts.",severity:"error",context:{...t,property:"user"}}),o.accessRules&&o.accessRules.length>0)for(let r=0;r<o.accessRules.length;r++){let s=o.accessRules[r];s.inheritable||e.push({code:$("API","NON_INHERITABLE_RULE"),message:`The access rule of type "${s.type}" is not inheritable and cannot be applied at the API level.`,suggestion:"Remove this rule from the API settings or move it to a specific exposed entity / action.",severity:"error",context:{...t,property:`accessRules[${r}]`}})}return e}function ga(o){let e=[],t={apiModelKey:o.key,kind:Ae,key:o.key},i=/^https?:\/\//i,r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return o.contact?(o.contact.email&&!r.test(o.contact.email)&&e.push({code:$("API","INVALID_CONTACT_EMAIL"),message:"The contact email address looks invalid.",suggestion:"Please double check the email address formatting.",severity:"error",context:{...t,property:"contact.email"}}),o.contact.url&&!i.test(o.contact.url)&&e.push({code:$("API","INVALID_CONTACT_URL"),message:"The contact link looks invalid.",suggestion:"Provide a working link, starting with http:// or https://.",severity:"error",context:{...t,property:"contact.url"}})):e.push({code:$("API","MISSING_CONTACT"),message:"A contact email or link is highly recommended for API consumers.",suggestion:"Add an email or help desk link in the metadata tab.",severity:"info",context:{...t,property:"contact"}}),o.license?o.license.url&&!i.test(o.license.url)&&e.push({code:$("API","INVALID_LICENSE_URL"),message:"The license link looks invalid.",suggestion:"Provide a working link, starting with http:// or https://.",severity:"error",context:{...t,property:"license.url"}}):e.push({code:$("API","MISSING_LICENSE"),message:"Adding a license to your API helps users understand its usage rights.",suggestion:"Add the name and a link to your API license terms.",severity:"info",context:{...t,property:"license"}}),o.termsOfService||e.push({code:$("API","MISSING_TOS"),message:"Terms of Service help legal compliance.",suggestion:"Add a link to the terms of your API service.",severity:"info",context:{...t,property:"termsOfService"}}),e}function vo(o){let e=[],t={apiModelKey:o.key,kind:Ae,key:o.key},i=!1;for(let r of o.exposes.values())if(r.actions.some(s=>bt.isListAction(s)||wt.isSearchAction(s))){i=!0;break}return i&&(!o.pagination||!o.pagination.kind?e.push({code:$("API","MISSING_PAGINATION"),message:"The API must have a defined pagination strategy when it exposes List or Search actions.",suggestion:"Configure how results are loaded (e.g. by page or by a continuous cursor).",severity:"error",context:{...t,property:"pagination"}}):(o.pagination.defaultLimit===void 0&&e.push({code:$("API","MISSING_PAGINATION_DEFAULT_LIMIT"),message:"The API doesn't have a defined default page limit when it exposes List or Search actions.",suggestion:"Set a default page limit for the pagination otherwise the API will use its default limit.",severity:"info",context:{...t,property:"pagination.defaultLimit"}}),o.pagination.maxLimit===void 0&&e.push({code:$("API","MISSING_PAGINATION_MAX_LIMIT"),message:"The API doesn't have a defined page size max limit when it exposes List or Search actions.",suggestion:"Set a max page size limit for the pagination otherwise the API will use its default max limit.",severity:"info",context:{...t,property:"pagination.maxLimit"}}))),e}function Pd(o,e,t){let i=[],r={apiModelKey:t.key,kind:"Action",key:o.kind,parentExposedEntityKey:e.key};if(Mt.isDeleteAction(o)&&(o.strategy?o.strategy==="hard"&&i.push({code:$("ACTION","DELETE_HARD_WARNING"),message:"Permanent delete is active. There will be no way to restore deleted data.",suggestion:'Consider switching to "soft delete" if users might need to undo mistakes.',severity:"info",context:{...r,property:"strategy"}}):i.push({code:$("ACTION","DELETE_MISSING_STRATEGY"),message:"A Delete action must know if you want to completely erase the record, or just hide it.",suggestion:"Configure the deletion type (permanent or soft).",severity:"error",context:{...r,property:"strategy"}})),Vt.isUpdateAction(o)&&(!o.allowedMethods||o.allowedMethods.length===0)&&i.push({code:$("ACTION","UPDATE_MISSING_METHODS"),message:"An Update action must define how the data is sent (PUT replaces everything; PATCH applies partial changes).",suggestion:"Select at least one allowed HTTP method.",severity:"error",context:{...r,property:"allowedMethods"}}),o.getAllRateLimiters().some(n=>n.rules.length)||i.push({code:$("ACTION","MISSING_RATE_LIMITS"),message:"It is best practice to configure a rate limit so your API is not overwhelmed.",suggestion:"Set a reasonable maximum request speed for this operation.",severity:"warning",context:r}),o.accessRules)for(let n of o.accessRules)i.push(...So(n,e,t));if(o.projection&&(bt.isListAction(o)||wt.isSearchAction(o)||zt.isReadAction(o)||i.push({code:$("ACTION","INVALID_PROJECTION_SEVERITY"),message:`Projections are only supported for read actions (List, Search, Read). The action "${o.kind}" does not support projections.`,suggestion:"Remove projection configuration from this write action.",severity:"warning",context:{...r,property:"projection"}}),o.projection.type!=="include"&&o.projection.type!=="exclude"&&i.push({code:$("ACTION","INVALID_PROJECTION_TYPE"),message:'Projection type must be either "include" or "exclude".',suggestion:"Select a valid projection type.",severity:"error",context:{...r,property:"projection"}}),Array.isArray(o.projection.fields))){let l=e.entity?t.domain?.findEntity(e.entity.key,e.entity.domain):void 0;if(l){let c=Array.from(l.withInheritedProperties()),p=new Set(c.map(m=>m.key)),u=new Set(Array.from(l.withInheritedAssociations()).map(m=>m.key));o.projection.fields.forEach((m,h)=>{if(m.invalid===!0){i.push({code:$("ACTION","INVALID_PROJECTION_FIELD"),message:`The projected field "${m.key}" is marked as invalid. It was not found in the entity definition.`,suggestion:"Update or remove this field from the projection configuration.",severity:"error",context:{...r,property:`projection.fields[${h}]`}});return}if(m.type==="association"){let f=m.key.split("."),k=f[0];if(!u.has(k))i.push({code:$("ACTION","INVALID_PROJECTION_ASSOCIATION"),message:`The projected association "${m.key}" does not exist on this entity.`,suggestion:"Select a valid association or remove it.",severity:"error",context:{...r,property:`projection.fields[${h}]`}});else{let w=Array.from(l.withInheritedAssociations()).find(b=>b.key===k);f.length>1&&(!w||w.schema?.embedded!==!0)&&i.push({code:$("ACTION","INVALID_PROJECTION_ASSOCIATION_EMBEDDED"),message:`The projected association "${m.key}" is invalid because association "${k}" is not embedded.`,suggestion:"Ensure the association is marked as embedded to use dot-notation.",severity:"error",context:{...r,property:`projection.fields[${h}]`}})}}else{let f=m.key.split("."),k=f[0];if(!p.has(k))i.push({code:$("ACTION","INVALID_PROJECTION_PROPERTY"),message:`The projected property "${m.key}" does not exist on this entity.`,suggestion:"Select a valid property or remove it.",severity:"error",context:{...r,property:`projection.fields[${h}]`}});else{let w=c.find(b=>b.key===k);f.length>1&&(!w||w.type!=="json"?i.push({code:$("ACTION","INVALID_PROJECTION_JSON_ROOT"),message:`The projected property "${m.key}" is invalid because root property "${k}" is not of type "json".`,suggestion:'Make sure the root property is of type "json" to use dot-notation.',severity:"error",context:{...r,property:`projection.fields[${h}]`}}):w.jsonSchema&&(nt(w.jsonSchema,f.slice(1))||i.push({code:$("ACTION","INVALID_PROJECTION_JSON_PATH"),message:`The projected property "${m.key}" is invalid according to the JSON Schema of "${k}".`,suggestion:"Configure a valid JSON Schema path or update the projection path.",severity:"error",context:{...r,property:`projection.fields[${h}]`}})))}}})}}return i}function ya(o,e){let t=[],i={apiModelKey:e.key,kind:Et,key:o.key},r=o.entity?e.domain?.findEntity(o.entity.key,o.entity.domain):void 0,s=r?.info.getLabel()||r?.key||"unknown";!o.entity||!o.entity.key?t.push({code:$("EXPOSURE","MISSING_ENTITY_REF"),message:"This exposed endpoint does not point to a specific data model.",suggestion:"Select which database entity this endpoint should serve.",severity:"error",context:{...i,property:"entity"}}):r||t.push({code:$("EXPOSURE","INVALID_ENTITY_REF"),message:"This endpoint points to a data model that no longer exists.",suggestion:"Select a new valid database model or delete this endpoint.",severity:"error",context:{...i,property:"entity"}});let a=r?.hasSemantic(y.User);if(o.isRoot&&r&&!a&&e.domain&&e.domain.resolveOwnershipPath(r.key)===null&&t.push({code:$("EXPOSURE","MISSING_OWNER_PATH"),message:`[${s}]: This root endpoint has no ownership path to the User entity. If you want this resource to be user-isolated, add the Relational Resource Owner semantic to the association that defines its owner.`,suggestion:"Ensure the resource has a direct (Resource Owner Identifier) or indirect (Relational Resource Owner) path to the User entity.",severity:"warning",context:i}),!o.isRoot&&e.domain)if(!o.parent)t.push({code:$("EXPOSURE","MISSING_PARENT_REF"),message:`[${s}]: A sub-endpoint (non-root exposure) must have a parent endpoint.`,suggestion:"Expose this entity under a parent entity or make it a root endpoint.",severity:"error",context:{...i,property:"parent"}});else{let l=e.exposes.get(o.parent.key);if(!l)t.push({code:$("EXPOSURE","INVALID_PARENT_EXPOSURE"),message:`[${s}]: The parent exposed entity "${o.parent.key}" does not exist.`,suggestion:"Ensure that the parent endpoint is exposed.",severity:"error",context:{...i,property:"parent.key"}});else{let c=e.domain.findEntity(l.entity.key,l.entity.domain),p=o.parent.association.key,u=e.domain.findAssociation(p,o.parent.association.domain);if(!u)t.push({code:$("EXPOSURE","MISSING_PARENT_ASSOCIATION"),message:`[${s}]: The parent association "${p}" does not exist in the data domain.`,suggestion:"Select a valid association in the data domain that connects the parent and child entities.",severity:"error",context:{...i,property:"parent.association"}});else{let m=c?.key,h=r?.key,f=u.getParentInstance()?.key===m,k=u.getParentInstance()?.key===h,w=u.targets.some(E=>E.key===m),b=u.targets.some(E=>E.key===h);f&&b||k&&w||t.push({code:$("EXPOSURE","INVALID_PARENT_ASSOCIATION"),message:`[${s}]: The parent association "${p}" does not connect the parent entity "${c?.info.name||m}" with the child entity "${r?.info.name||h}".`,suggestion:"Use an association that directly connects the parent and child data entities.",severity:"error",context:{...i,property:"parent.association"}})}}}if(o.hasCollection){if(!o.collectionPath)t.push({code:$("EXPOSURE","MISSING_COLLECTION_PATH"),message:`[${s}]: When an endpoint exposes a collection, it must define what its base URL path is.`,suggestion:'Add a path (e.g., "/items").',severity:"error",context:{...i,property:"collectionPath"}});else{let l=o.collectionPath.split("/").filter(Boolean);(l.length!==1||!o.collectionPath.startsWith("/"))&&t.push({code:$("EXPOSURE","INVALID_COLLECTION_PATH"),message:`[${s}]: The collection URL should start with "/" and have no extra slashes.`,suggestion:`Ensure the path looks like exactly "/${l[0]||"subresource"}".`,severity:"error",context:{...i,property:"collectionPath"}})}o.resourcePath?o.collectionPath&&(new RegExp(`^${o.collectionPath}/\\{[a-zA-Z0-9_]+\\}$`).test(o.resourcePath)||t.push({code:$("EXPOSURE","INVALID_RESOURCE_PATH_FORMAT"),message:`[${s}]: The single item route should match exactly your collection path plus one identifier variable.`,suggestion:`Make sure the item path is formatted exactly like "${o.collectionPath}/{id}".`,severity:"error",context:{...i,property:"resourcePath"}})):t.push({code:$("EXPOSURE","MISSING_RESOURCE_PATH"),message:`[${s}]: You need an identifier to locate single items.`,suggestion:'Specify the identification parameter format, like "{id}".',severity:"error",context:{...i,property:"resourcePath"}})}else o.resourcePath?(o.resourcePath.split("/").filter(Boolean).length!==1||!o.resourcePath.startsWith("/"))&&t.push({code:$("EXPOSURE","INVALID_RESOURCE_PATH_FORMAT"),message:`[${s}]: The URL route ${o.resourcePath} must only contain one exact part or level.`,suggestion:"Simplify the endpoint URL to a single segment.",severity:"error",context:{...i,property:"resourcePath"}}):t.push({code:$("EXPOSURE","MISSING_RESOURCE_PATH"),message:`[${s}]: Exposed entity representing a single item must declare their URL route.`,suggestion:'Set the URL path (such as "/profile").',severity:"error",context:{...i,property:"resourcePath"}});o.isRoot&&(o.collectionPath&&e.findCollectionPathCollision(o.collectionPath,o.key)&&t.push({code:$("EXPOSURE","ROOT_COLLECTION_COLLISION"),message:`[${s}]: The route "${o.collectionPath}" is already used by another view.`,suggestion:"Give this resource a different path to avoid conflicts.",severity:"error",context:{...i,property:"collectionPath"}}),o.resourcePath&&e.findResourcePathCollision(o.resourcePath,o.key)&&t.push({code:$("EXPOSURE","ROOT_RESOURCE_COLLISION"),message:`[${s}]: The route "${o.resourcePath}" is already used by another one.`,suggestion:"Give this single-item resource a different path to avoid conflicts.",severity:"error",context:{...i,property:"resourcePath"}}));let n=o.getAbsoluteResourcePath();if(n){let l=[...n.matchAll(/\{([^}]+)\}/g)].map(p=>p[1]);if(new Set(l).size!==l.length){let u=l.filter((m,h)=>l.indexOf(m)!==h)[0];t.push({code:$("EXPOSURE","DUPLICATE_PATH_PARAMETER"),message:`[${s}]: The path parameter "{${u}}" is duplicated in the resource path hierarchy.`,suggestion:"Change the parameter name in either this resource or its ancestor to ensure unique parameter names.",severity:"error",context:{...i,property:"resourcePath"}})}}if(!o.actions||o.actions.length===0)t.push({code:$("EXPOSURE","MISSING_ACTIONS"),message:`[${s}]: This exposed entity does not let users do anything.`,suggestion:"Enable at least one operation like Create, Read, or Update.",severity:"error",context:{...i,property:"actions"}});else{let l=!1,c=!1;for(let p of o.actions){t.push(...Pd(p,o,e)),wt.isSearchAction(p)&&(l=!0),bt.isListAction(p)&&(c=!0);let u=!1;p.accessRules&&p.accessRules.length>0&&(u=!0),!u&&o.accessRules&&o.accessRules.length>0&&(u=!0);let m=o.parent?.key;for(;m&&!u;){let h=e.exposes.get(m);if(h&&h.accessRules&&h.accessRules.some(f=>f.inheritable)){u=!0;break}m=h?.parent?.key}!u&&e.accessRules&&e.accessRules.some(h=>h.inheritable)&&(u=!0),u||t.push({code:$("ACTION","MISSING_ACCESS_RULES"),message:`[${s}]: The ${p.kind} action has no security rules attached, making it entirely inaccessible or open.`,suggestion:"Allow specific user roles to access this operation.",severity:"error",context:{...i,kind:"Action",key:p.kind,parentExposedEntityKey:o.key}})}if(c||l){let p=o.paginationContract;if(!p)t.push({code:$("EXPOSURE","MISSING_PAGINATION_CONTRACT"),message:`[${s}]: The List or Search action needs a pagination contract.`,suggestion:"Add a pagination contract to the exposed entity.",severity:"error",context:i});else{if(c&&((!p.filterableFields||p.filterableFields.length===0)&&t.push({code:$("EXPOSURE","LIST_MISSING_FILTERS"),message:`[${s}]: Listing all elements without filters could be overwhelming for large tables.`,suggestion:"Select a few important fields to allow filtering.",severity:"warning",context:i}),(!p.sortableFields||p.sortableFields.length===0)&&t.push({code:$("EXPOSURE","LIST_MISSING_SORTING"),message:`[${s}]: Listing all elements without sorting could be overwhelming for large tables.`,suggestion:"Select a few important fields to allow sorting.",severity:"warning",context:i})),l){let u=[];Array.isArray(p.searchableFields)&&u.push(...p.searchableFields),Array.isArray(p.filterableFields)&&u.push(...p.filterableFields),u.length||t.push({code:$("EXPOSURE","SEARCH_MISSING_FIELDS"),message:`[${s}]: Search action needs to know which text fields to look in.`,suggestion:"Select a few important fields to allow searching or full-text search.",severity:"warning",context:i})}if(r){let u=Array.from(r.withInheritedProperties()),m=new Set(u.map(f=>f.key)),h=(f,k,w,b)=>{if(f&&Array.isArray(f))for(let _ of f){let E=_.split("."),x=E[0];if(!m.has(x))t.push({code:$("EXPOSURE",w),message:`[${s}]: The ${b} field "${_}" does not exist on this entity.`,suggestion:`Select a valid property on the entity for ${b}.`,severity:"error",context:{...i,property:`paginationContract.${k}Fields`}});else{let I=u.find(j=>j.key===x);E.length>1&&(!I||I.type!=="json"?t.push({code:$("EXPOSURE",w),message:`[${s}]: The ${b} field "${_}" is invalid because root property "${x}" is not of type "json".`,suggestion:'Make sure the root property is of type "json" to use dot-notation.',severity:"error",context:{...i,property:`paginationContract.${k}Fields`}}):I.jsonSchema&&(nt(I.jsonSchema,E.slice(1))||t.push({code:$("EXPOSURE",w),message:`[${s}]: The ${b} field "${_}" is invalid according to the JSON Schema of "${x}".`,suggestion:"Configure a valid JSON Schema path or update the field path.",severity:"error",context:{...i,property:`paginationContract.${k}Fields`}})))}}};h(p.filterableFields,"filterable","INVALID_FILTER_FIELD","filterable"),h(p.sortableFields,"sortable","INVALID_SORT_FIELD","sortable"),h(p.searchableFields,"searchable","INVALID_SEARCH_FIELD","searchable")}}}}if(o.accessRules)for(let l of o.accessRules)t.push(...So(l,o,e));return t}function So(o,e,t){let i=[],r={apiModelKey:t.key,kind:"AccessRule",key:o.type,parentExposedEntityKey:e.key};if(o.type==="matchResourceOwner"){let s=o,a=t.domain;if(!a)return i;let n=e.entity.key,l=a.findEntity(n);if(!l)return i;if(s.target==="user-entity")l.hasSemantic(y.User)||i.push({code:$("RULE","INVALID_USER_ENTITY_TARGET"),message:`[${l.info.getLabel()}]: Target is set to "user-entity", but the entity itself does not represent the User.`,suggestion:'Change target to "property" or add User semantic to this entity.',severity:"error",context:r});else if(s.property){let c=Array.from(l.withInheritedProperties()),p=Array.from(l.withInheritedAssociations());c.some(m=>m.key===s.property)||p.some(m=>m.key===s.property)||i.push({code:$("RULE","INVALID_OWNERSHIP_PROPERTY"),message:`[${l.info.getLabel()}]: The ownership property or association "${s.property}" does not exist on this entity.`,suggestion:"Select a valid property/association, or clear the field to use transitively resolved ownership.",severity:"error",context:r})}else a.resolveOwnershipPath(n)===null&&i.push({code:$("RULE","MISSING_OWNERSHIP_PATH"),message:`[${l.info.getLabel()}]: The access rule is set to "Match resource owner", but no direct property or transitive ownership path to the User entity exists.`,suggestion:"Annotate a property/association with the ResourceOwnerIdentifier or RelationalResourceOwner semantic.",severity:"error",context:r})}else if(o.type==="matchResourceAttribute"){let s=o,a=t.domain;if(!a)return i;let n=e.entity.key,l=a.findEntity(n);if(!l)return i;s.attribute&&(Array.from(l.withInheritedProperties()).some(u=>u.key===s.attribute)||i.push({code:$("RULE","INVALID_RESOURCE_ATTRIBUTE"),message:`[${l.info.getLabel()}]: The resource attribute property "${s.attribute}" does not exist.`,suggestion:"Select a valid property on the entity.",severity:"error",context:r}))}else if(o.type==="matchUserProperty"){let s=o,a=t.domain;if(a){let n=Array.from(a.listEntities()).find(l=>l.hasSemantic(y.User));n?s.property?Array.from(n.withInheritedProperties()).some(p=>p.key===s.property)||i.push({code:$("RULE","INVALID_USER_PROPERTY"),message:`The user property "${s.property}" does not exist on the User entity "${n.info.getLabel()}".`,suggestion:"Select a valid property on the User entity.",severity:"error",context:r}):i.push({code:$("RULE","MISSING_USER_PROPERTY"),message:'The access rule is set to "Match user property", but no property is specified.',suggestion:"Specify a property on the User entity to match against.",severity:"error",context:r}):i.push({code:$("RULE","MISSING_USER_MODEL"),message:'The API specifies a "Match user property" rule, but no User entity is configured in the domain.',suggestion:"Annotate an entity in the domain with the User semantic.",severity:"error",context:r})}}return i}var Qr=new Set(["IN","EXISTS","SELECT","FROM","WHERE","AND","OR","NOT","NULL","TRUE","FALSE","BETWEEN","LIKE","INTO","JOIN","INNER JOIN","LEFT JOIN","RIGHT JOIN","FULL JOIN","CROSS JOIN","UNION","INTERSECT","EXCEPT","ORDER BY","GROUP BY","HAVING","DISTINCT","LIMIT","OFFSET","INSERT","UPDATE","DELETE","CREATE","ALTER","DROP","TRUNCATE","RENAME","GRANT","REVOKE","COMMIT","ROLLBACK","SAVEPOINT","BEGIN","END","CASE","WHEN","THEN","ELSE","END CASE","EXCEPTION","RAISE","RETURN","FUNCTION","PROCEDURE"]);function es(o){let e=[],t=o.info.getLabel(),i=o.getParentInstance(),r=o.kind===ne?"property":"association";if(!o.info.name){let a=`The "${t}" ${r} has no name.`,n=`The ${r} must have a name.`;return e.push({field:"name",rule:"required",message:a,help:n,severity:"error",key:o.key,kind:o.kind,parent:i.key}),e}let s=o.info.name;if(s.length<2){let a=`The "${t}" ${r} name is too short.`;e.push({field:"name",rule:"length",message:a,help:"The name must be at least 2 characters long.",severity:"error",key:o.key,kind:o.kind,parent:i.key})}if(s.length>59){let a=`The "${t}" ${r} name is too long.`;e.push({field:"name",rule:"length",message:a,help:"The name must be at most 59 characters long.",severity:"error",key:o.key,kind:o.kind,parent:i.key})}if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){let a=`The "${t}" ${r} name is invalid.`;e.push({field:"name",rule:"format",message:a,help:"The name must start with a letter (a-z) or underscore (_). Subsequent characters can be letters, digits (0-9), or underscores (_).",severity:"error",key:o.key,kind:o.kind,parent:i.key})}if(/^[A-Z]/.test(s)){let a=`The "${t}" ${r} name is not in snake case.`;e.push({field:"name",rule:"snake_case",message:a,help:"The name should be in snake case (lowercase letters and underscores).",severity:"info",key:o.key,kind:o.kind,parent:i.key})}if(Qr.has(s.toUpperCase())){let a=`The "${t}" ${r} name is a reserved keyword.`;e.push({field:"name",rule:"reserved",message:a,help:"The name should not be a reserved keyword.",severity:"error",key:o.key,kind:o.kind,parent:i.key})}return e}var Gi=class{domain;constructor(e){this.domain=e}validate(e){let t=[],i;if(typeof e=="string"?i=this.domain.findAssociation(e):i=e,!i){let n=`The "${e}" association does not exist.`;return t.push({field:"*",rule:"exists",message:n,help:"The association must be defined in the domain.",key:e,kind:fe,severity:"error"}),t}let r=this.validateName(i);t.push(...r);let s=this.validateTargets(i);t.push(...s);let a=this.validateSemantics(i);return t.push(...a),t}validateName(e){return es(e)}validateTargets(e){let t=[],i=e.info.getLabel(),r=e.getParentInstance();if(!e.targets.length){let s=`The "${i}" association has no target.`;return t.push({field:"targets",rule:"required",message:s,help:"An association must have at least one target.",severity:"error",key:e.key,kind:e.kind,parent:r.key}),t}for(let s of e.targets)if(!this.domain.findEntity(s.key,s.domain)){let n=`The "${i}" association has an invalid target "${s.key}".`;t.push({field:"targets",rule:"exists",message:n,help:"The target must be defined in the domain.",severity:"error",key:e.key,kind:e.kind,parent:r.key})}return t}validateSemantics(e){let t=[],i=e.info.getLabel(),r=e.getParentInstance();if(e.hasSemantic(y.RelationalResourceOwner))for(let s of e.targets){let a=this.domain.findEntity(s.key,s.domain);a&&this.domain.resolveOwnershipPath(a.key)===null&&t.push({field:"semantics",rule:"relational_owner_path_valid",message:`The target entity "${a.info.getLabel()}" of the relational resource owner association "${i}" does not have a valid ownership path to a User.`,help:"Ensure the target entity has a direct owner (Resource Owner Identifier) or transitively inherits ownership through another relational owner association.",severity:"error",key:e.key,kind:e.kind,parent:r.key})}return t}};var Bi=class{domain;constructor(e){this.domain=e}validate(e){let t=[],i;if(typeof e=="string"?i=this.domain.findEntity(e):i=e,!i){let c=`The "${e}" entity does not exist.`;return t.push({field:"*",rule:"exists",message:c,help:"The entity must be defined in the domain.",key:e,kind:H,severity:"error"}),t}let r=this.validatePrimaryKey(i);t.push(...r);let s=this.minimumRequiredProperties(i);t.push(...s);let a=this.validateName(i);t.push(...a);let n=this.uniqueName(i);t.push(...n);let l=this.validateUserSemantics(i);return t.push(...l),t}validatePrimaryKey(e){let t=[];if(!e.primaryKey()){let r=`The "${e.info.getLabel()}" entity has no identifier.`;t.push({field:"properties",rule:"primary_key",message:r,help:"An entity that can exists by itself must have identifier defined.",severity:"error",key:e.key,kind:e.kind})}return t}hasPropertiesInherited(e){if(e.hasProperties())return!0;for(let t of e.listParents())if(this.hasPropertiesInherited(t))return!0;return!1}hasAssociationsInherited(e){if(e.hasAssociations())return!0;for(let t of e.listParents())if(this.hasAssociationsInherited(t))return!0;return!1}minimumRequiredProperties(e){let t=[],i=this.hasPropertiesInherited(e),r=this.hasAssociationsInherited(e);if(!i&&!r){let s=`The "${e.info.getLabel()}" entity has no properties. It will be ignored.`;t.push({field:"properties",rule:"required",message:s,help:"Entities that have no properties are ignored in the data domain. No schema will be generated for it.",severity:"warning",key:e.key,kind:e.kind})}return t}validateName(e){let t=[],i=e.info.getLabel();if(!e.info.name){let s=`The "${i}" entity has no name.`;return t.push({field:"name",rule:"required",message:s,help:"An entity must have a name.",severity:"error",key:e.key,kind:e.kind}),t}let r=e.info.name;if(r.length<2){let s=`The "${i}" entity name is too short.`;t.push({field:"name",rule:"length",message:s,help:"The name must be at least 2 characters long.",severity:"error",key:e.key,kind:e.kind})}if(r.length>31){let s=`The "${i}" entity name is too long.`;t.push({field:"name",rule:"length",message:s,help:"The name must be at most 31 characters long.",severity:"error",key:e.key,kind:e.kind})}if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)){let s=`The "${i}" entity name is invalid.`;t.push({field:"name",rule:"format",message:s,help:"The name must start with a letter (a-z) or underscore (_). Subsequent characters can be letters, digits (0-9), or underscores (_).",severity:"error",key:e.key,kind:e.kind})}if(/^[A-Z]/.test(r)){let s=`The "${i}" entity name is not in snake case.`;t.push({field:"name",rule:"snake_case",message:s,help:"The name should be in snake case (lowercase letters and underscores).",severity:"info",key:e.key,kind:e.kind})}if(Qr.has(r.toUpperCase())){let s=`The "${i}" entity name is a reserved keyword.`;t.push({field:"name",rule:"reserved",message:s,help:"The name should not be a reserved keyword.",severity:"error",key:e.key,kind:e.kind})}return t}uniqueName(e){let t=[],i=e.info.name?.toLowerCase();if(!i)return t;for(let r of this.domain.listEntities())if(r.info.name?.toLowerCase()===i&&r.key!==e.key){let s=`The "${i}" entity name is already used in the data domain.`;t.push({field:"name",rule:"unique",message:s,help:"The name must be unique. This includes references to other data domains.",severity:"error",key:r.key,kind:r.kind})}for(let r of this.domain.listEntities({foreignOnly:!0}))if(r.info.name?.toLowerCase()===i&&r.key!==e.key){let s=`The "${i}" entity name is already used in the foreign data domain.`;t.push({field:"name",rule:"unique",message:s,help:"The name must be unique. This includes references to other data domains.",severity:"error",key:r.key,kind:r.kind,parent:r.domain.key})}return t}validateUserSemantics(e){let t=[],i=!1,r=!1;for(let s of e.withInheritedProperties())s.hasSemantic(y.Username)&&(i=!0),s.hasSemantic(y.Password)&&(r=!0);if((i||r)&&!e.hasSemantic(y.User)){let s=`The "${e.info.getLabel()}" entity has Username or Password properties but does not have the User taxonomy.`;t.push({field:"semantics",rule:"user_taxonomy_required",message:s,help:"Entities containing authentication credentials like usernames or passwords must be tagged with the User taxonomy.",severity:"error",key:e.key,kind:e.kind})}if(r&&!i){let s=`The "${e.info.getLabel()}" entity has Password credentials but lacks Username semantics.`;t.push({field:"semantics",rule:"username_required_for_password",message:s,help:"An entity with Password credentials must also define a Username property for authentication.",severity:"error",key:e.key,kind:e.kind})}return t}};var Wi=class{domain;constructor(e){this.domain=e}validate(e){let t=[],i;if(typeof e=="string"?i=this.domain.findProperty(e):i=e,!i){let n=`The "${e}" property does not exist.`;return t.push({field:"*",rule:"exists",message:n,help:"The property must be defined in the domain.",key:e,kind:ne,severity:"error"}),t}let r=this.validateName(i);t.push(...r);let s=this.validatePrimaryKeyDefault(i);t.push(...s);let a=this.validateJsonIndex(i);return t.push(...a),t}validateName(e){return es(e)}validatePrimaryKeyDefault(e){let t=[];if(e.primary){let i=e.schema?.defaultValue;if(i){if(i.type!=="function"||i.value!=="random"){let r=`The primary key property "${e.info.getLabel()}" has an invalid default value.`;t.push({field:"schema.defaultValue",rule:"primary_key_default",message:r,help:'Primary key properties can only have the "random" function as their default value.',severity:"error",key:e.key,kind:e.kind})}}else{let r=`The primary key property "${e.info.getLabel()}" has no default value.`;t.push({field:"schema.defaultValue",rule:"primary_key_no_default",message:r,help:'Without a default generator (e.g., the "random" function), the client application must generate and supply primary key values manually.',severity:"warning",key:e.key,kind:e.kind})}}return t}validateJsonIndex(e){let t=[],i=e.jsonIndex;if(!i)return t;if(e.type!=="json")return t.push({field:"jsonIndex",rule:"json_index_type_mismatch",message:`Property "${e.info.getLabel()}" has a JSON index config but its type is "${e.type}".`,help:'JSON index configuration can only be defined for properties of type "json".',severity:"error",key:e.key,kind:e.kind}),t;if(i.paths&&e.jsonSchema)for(let r of i.paths){if(!r.path){t.push({field:"jsonIndex.paths",rule:"json_index_path_empty",message:`Property "${e.info.getLabel()}" has an empty JSON path in its index config.`,help:"JSON path index configurations must specify a non-empty path.",severity:"error",key:e.key,kind:e.kind});continue}let s=r.path.split(".");nt(e.jsonSchema,s)||t.push({field:"jsonIndex.paths",rule:"json_index_path_invalid",message:`JSON path "${r.path}" in index config for property "${e.info.getLabel()}" is not valid according to the property's JSON Schema.`,help:"All indexed JSON paths must exist in the property's JSON Schema definition.",severity:"error",key:e.key,kind:e.kind})}return t}};var ts=class{domain;constructor(e){this.domain=e}validate(){let e=[],t=this.validateUserEntity();e.push(...t);let i=this.validateTimestampSemantics();e.push(...i);let r=this.validateSoftDeleteSemantics();e.push(...r);let s=this.validatePropertySemanticsDataTypes();e.push(...s);let a=this.validateCurrencySemantics();e.push(...a);let n=this.validateGeospatialEndpoints();return e.push(...n),e}validateUserEntity(){let e=[],t=0;for(let i of this.domain.listEntities())if(i.hasSemantic(y.User)){t++;let r=!1,s=!1,a=!1;for(let n of i.withInheritedProperties())if(n.hasSemantic(y.Username)&&(r=!0),n.hasSemantic(y.Password)&&(s=!0),n.hasSemantic(y.UserRole)&&(a=!0),r&&s&&a)break;r||e.push({field:"semantics",rule:"has_username",message:"No username property on the User entity found.",help:'It is recommended to set the "username" property semantic for APIs supporting authentication.',severity:"warning",key:"user_semantic",kind:H}),s||e.push({field:"semantics",rule:"has_password",message:"No password property on the User entity found.",help:'It is recommended to set the "password" property semantic for APIs supporting authentication.',severity:"warning",key:"user_semantic",kind:H}),a||e.push({field:"semantics",rule:"has_user_role",message:"No role property on the User entity found.",help:'It is recommended to set the "User role" property semantic for APIs supporting authentication.',severity:"warning",key:"user_semantic",kind:H})}return t===0?e.push({field:"semantics",rule:"recommended",message:"No entity with User taxonomy found in the domain.",help:"It is recommended to have an entity with the User taxonomy for authentication purposes.",severity:"warning",key:"user_semantic",kind:H}):t>1&&e.push({field:"semantics",rule:"one_user",message:"There is more than one entity with User taxonomy in the domain.",help:"There can be only one user in the system. Remove the additional User taxonomies.",severity:"error",key:"user_semantic",kind:H}),e}validateTimestampSemantics(){let e=[];for(let t of this.domain.listEntities()){let i=!1,r=!1;for(let s of t.withInheritedProperties())s.hasSemantic(y.CreatedTimestamp)&&(i=!0),s.hasSemantic(y.UpdatedTimestamp)&&(r=!0);i||e.push({field:"semantics",rule:"recommended",message:`The "${t.info.getLabel()}" entity does not have a CreatedTimestamp taxonomy.`,help:"It is recommended to have a CreatedTimestamp property to track when the entity was created.",severity:"info",key:t.key,kind:t.kind}),r||e.push({field:"semantics",rule:"recommended",message:`The "${t.info.getLabel()}" entity does not have an UpdatedTimestamp taxonomy.`,help:"It is recommended to have an UpdatedTimestamp property to track when the entity was last modified.",severity:"info",key:t.key,kind:t.kind})}return e}validateSoftDeleteSemantics(){let e=[];for(let t of this.domain.listEntities()){let i=!1;for(let r of t.withInheritedProperties())if(r.hasSemantic(y.DeletedTimestamp)||r.hasSemantic(y.DeletedFlag)){i=!0;break}i||e.push({field:"semantics",rule:"recommended",message:`The "${t.info.getLabel()}" entity does not have soft delete taxonomy.`,help:"It is recommended to have either a DeletedTimestamp or DeletedFlag property for soft deletion.",severity:"info",key:t.key,kind:t.kind})}return e}validatePropertySemanticsDataTypes(){let e=[];for(let t of this.domain.listEntities())for(let i of t.withInheritedProperties())for(let r of i.semantics){let s=Xe[r.id];wr(s)&&s.applicableDataTypes&&(s.applicableDataTypes.includes(i.type)||e.push({field:"semantics",rule:"type_mismatch",message:`The "${i.info.getLabel()}" property has the "${s.displayName}" semantic applied, but its type "${i.type}" is not compatible.`,help:`The "${s.displayName}" semantic can only be applied to properties of type(s): ${s.applicableDataTypes.join(", ")}.`,severity:"error",key:i.key,kind:i.kind,parent:t.key}))}return e}validateCurrencySemantics(){let e=[];for(let t of this.domain.listEntities())for(let i of t.withInheritedProperties()){let r=i.getSemantic(y.Currency);if(r){let s=r.config;i.type==="number"&&s?.allowedCurrencies&&s.allowedCurrencies.length>1&&e.push({field:"semantics",rule:"currency_number_multiple",message:`The "${i.info.getLabel()}" property has the Currency semantic and is a Number, but allows multiple currencies.`,help:"Number properties cannot accept currency codes. Please change the property type to String, or restrict allowedCurrencies to exactly one currency.",severity:"error",key:i.key,kind:i.kind,parent:t.key})}}return e}validateGeospatialEndpoints(){let e=[];for(let t of this.domain.listEntities()){let i=new Map;for(let r of t.withInheritedProperties()){let s=r.getSemantic(y.GeospatialCoordinates);if(s){let a=s.config??{},n=a.enableDistanceQueries!==!1,l=a.enableBoundingBoxQueries!==!1,c=a.enablePolygonQueries===!0,p=a.enableGeoClustering===!0;if(n||l||c||p){let u=(a.apiEndpointPrefix||"/nearby").trim().toLowerCase();i.has(u)||i.set(u,[]),i.get(u)?.push(r.info.getLabel())}}}for(let[r,s]of i.entries())s.length>1&&e.push({field:"semantics",rule:"geospatial_endpoint_collision",message:`The "${t.info.getLabel()}" entity has multiple geospatial properties (${s.join(", ")}) sharing the same API endpoint prefix "${r}".`,help:"Each geospatial property on the same entity must use a unique apiEndpointPrefix to avoid query endpoint collisions (e.g., /nearby, /nearby-office).",severity:"error",key:t.key,kind:t.kind})}return e}};var Zt=class{domain;report=[];#e=0;#t=0;#r=0;#i=!1;get infoCount(){return this.#i||this.computeIssueCounters(),this.#e}get warningCount(){return this.#i||this.computeIssueCounters(),this.#t}get errorCount(){return this.#i||this.computeIssueCounters(),this.#r}constructor(e){this.domain=e}validate(){this.#i=!1,this.report=[];let e=new Bi(this.domain),t=new Wi(this.domain),i=new Gi(this.domain),r=new ts(this.domain),s=!1;for(let n of this.domain.listEntities()){if(n.domain.key!==this.domain.key)continue;s=!0;let l=e.validate(n);this.report.push(...l);for(let c of n.properties){if(c.domain.key!==this.domain.key)continue;let p=t.validate(c);this.report.push(...p)}for(let c of n.associations){if(c.domain.key!==this.domain.key)continue;let p=i.validate(c);this.report.push(...p)}}if(!s)return this.report;let a=r.validate();return this.report.push(...a),this.report}computeIssueCounters(){this.#e=this.report.filter(e=>e.severity==="info").length,this.#t=this.report.filter(e=>e.severity==="warning").length,this.#r=this.report.filter(e=>e.severity==="error").length,this.#i=!0}};var Hi=class{model;report=[];#e=0;#t=0;#r=0;#i=!1;get infoCount(){return this.#i||this.computeIssueCounters(),this.#e}get warningCount(){return this.#i||this.computeIssueCounters(),this.#t}get errorCount(){return this.#i||this.computeIssueCounters(),this.#r}constructor(e){this.model=e}validate(){if(this.#i=!1,this.report=[],this.report.push(...ma(this.model)),this.report.push(...ha(this.model)),this.report.push(...fa(this.model)),this.report.push(...vo(this.model)),this.report.push(...ga(this.model)),!this.model.exposes||this.model.exposes.size===0)this.report.push({code:"API_NO_EXPOSURES",message:"Your API currently has no exposed data for external clients to request.",suggestion:"Expose a data model so apps can communicate with it.",severity:"warning",context:{apiModelKey:this.model.key,kind:Ae,key:this.model.key,property:"exposes"}});else for(let e of this.model.exposes.values())this.report.push(...ya(e,this.model));return this.report}computeIssueCounters(){this.#e=this.report.filter(e=>e.severity==="info").length,this.#t=this.report.filter(e=>e.severity==="warning").length,this.#r=this.report.filter(e=>e.severity==="error").length,this.#i=!0}};var ba;(function(o){o.LatLon="lat,lon",o.LonLat="lon,lat",o.PostGIS="postgis",o.Degree="degree",o.WKT="wkt",o.GeoJSON="geojson"})(ba||(ba={}));var wa;(function(o){o.Meters="meters",o.Kilometers="kilometers",o.Miles="miles",o.Feet="feet",o.Yards="yards",o.NauticalMiles="nautical_miles"})(wa||(wa={}));var ka;(function(o){o.WGS84="EPSG:4326",o.WebMercator="EPSG:3857",o.NAD83="EPSG:4269",o.NAD27="EPSG:4267"})(ka||(ka={}));var gA={format:ba.LatLon,spatialReferenceSystem:ka.WGS84,defaultDistanceUnit:wa.Meters,enableSpatialIndexing:!0,enableValidation:!0,enablePostGISIntegration:!0,postGISGeometryType:"POINT",enableDistanceQueries:!0,maxQueryDistance:1e5,enableBoundingBoxQueries:!0,enablePolygonQueries:!1,enableGeoClustering:!1,apiEndpointPrefix:"/nearby",includeElevation:!1,coordinatePrecision:6,enableReverseGeocoding:!1};var _o;(function(o){o.Bcrypt="bcrypt",o.Argon2="argon2",o.Scrypt="scrypt"})(_o||(_o={}));var is=(o={})=>{let e={...Hd,...o};return o.metadata&&(e.metadata={...o.metadata}),{id:y.SKU,config:e}},Hd={validationMode:"strict",caseMode:"uppercase",enforceUniqueness:!0,autoGenerate:!1,validateReservedWords:!0,reservedValues:["ADMIN","TEST","NULL","DEFAULT","UNDEFINED","SAMPLE","DEMO"]},xA={PRODUCT_STANDARD:is({validationMode:"strict",caseMode:"uppercase",prefix:"PROD-",enforceUniqueness:!0,validateReservedWords:!0,reservedValues:["ADMIN","TEST","NULL","DEFAULT"]}),SIMPLE:is({validationMode:"lenient",caseMode:"preserve",enforceUniqueness:!0}),AUTO_GENERATE:is({validationMode:"strict",caseMode:"uppercase",autoGenerate:!0,autoGenerateSource:"name",enforceUniqueness:!0}),FLEXIBLE:is({validationMode:"lenient",caseMode:"preserve",enforceUniqueness:!0,validateReservedWords:!1})};function Ao(o){o.command("validate [file]").description("Validate a Data Domain or API Model schema").option("--stdin","Read schema content from STDIN").option("--org <oid>","Organization ID (remote validation)").option("--fid <fid>","File ID / schema ID (remote validation)").option("--domain <path>","Path to local Data Domain schema file (only for local API Model validation)").action(async(e,t)=>{let i=new B({format:P.resolved.format});S.debug("[validate] Starting validation process..."),await new va(e,t,i).execute()})}var va=class{constructor(e,t,i){this.file=e;this.options=t;this.formatter=i}file;options;formatter;async execute(){S.debug("[validate] Executing schema validation...");try{this.validateArguments();let e=await this.loadSchema();this.validateSchemaStructure(e);let t=e.kind,i=[];t===Ce?i=await this.validateDataDomain(e):t===Ae?i=await this.validateApiModel(e):(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Unsupported schema kind "${t}". Supported kinds: "${Ce}", "${Ae}".`}),process.exit(1)),this.reportResults(i,t)}catch(e){let t=se(e);this.formatter.error(t),process.exit(1)}}get isRemoteValidationWithoutOrg(){return!!(this.options.fid&&!this.options.org&&!P.resolved.org)}get shouldReadFromStdin(){return!!(this.options.stdin||!this.file&&!process.stdin.isTTY)}validateArguments(){this.file&&this.options.stdin&&(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:"Cannot specify both [file] path and --stdin"}),process.exit(1)),this.options.org&&!this.options.fid&&(this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"File ID (--fid) is required when using remote validation (--org)."}),process.exit(1)),this.isRemoteValidationWithoutOrg&&(this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required for remote validation. Use --org <oid> or configure a default org."}),process.exit(1))}async loadSchema(){return S.debug(`[validate] Loading schema (remote=${!!this.options.fid})...`),this.options.fid?this.loadRemoteSchema():this.loadLocalSchema()}async loadRemoteSchema(){let e=this.options.org||P.resolved.org;e||(this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required for remote validation."}),process.exit(1)),S.debug(`[validate] Fetching remote schema file ID '${this.options.fid}' from organization '${e}'...`);let t=te(),{media:i}=await t.files.readMedia(e,this.options.fid,{token:t.token});return S.debug("[validate] Remote schema loaded successfully."),i}async loadLocalSchema(){let e;if(this.shouldReadFromStdin)S.debug("[validate] Reading schema from STDIN..."),e=await this.readStdin();else if(this.file){let t=xo.resolve(this.file);S.debug(`[validate] Reading local schema file from path: ${t}`),rs.existsSync(t)||(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`File not found at path: ${t}`}),process.exit(1)),e=rs.readFileSync(t,"utf8")}else this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"A file path, --stdin, or remote --org and --fid must be specified."}),process.exit(1);try{let t=JSON.parse(e);return S.debug("[validate] Local schema parsed successfully."),t}catch(t){let i=t instanceof Error?t.message:String(t);this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Failed to parse schema JSON: ${i}`}),process.exit(1)}}isValidSchemaStructure(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&"kind"in e}validateSchemaStructure(e){this.isValidSchemaStructure(e)||(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:'Invalid schema. The schema must be a JSON object containing a "kind" property.'}),process.exit(1))}async validateDataDomain(e){S.debug("[validate:domain] Validating schema as Data Domain...");let t=[];if(this.options.fid){let a=te(),n=e.dependencyList||[];n.length>0&&(S.debug(`[validate:domain] Listing ${n.length} dependency data domains from catalog...`),t=(await a.dataCatalog.listDependencies(n,{token:a.token})).data||[])}let i=new Ve(e,t,{readOnly:!0}),s=new Zt(i).validate();return S.debug(`[validate:domain] Domain validation rules executed. Issues found: ${s.length}`),s}async validateApiModel(e){S.debug("[validate:api] Validating schema as API Model...");let t;if(this.options.fid){let a=te(),n=e.dependencyList||[];if(n.length>0){S.debug(`[validate:api] Listing ${n.length} dependency data domains from catalog...`);let c=(await a.dataCatalog.listDependencies(n,{token:a.token})).data||[];c.length>0&&(t=new Ve(c[0],c,{readOnly:!0}))}}else if(this.options.domain){let a=xo.resolve(this.options.domain);S.debug(`[validate:api] Loading domain dependency from local path: ${a}`),rs.existsSync(a)||(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Domain dependency file not found at path: ${a}`}),process.exit(1));let n;try{n=JSON.parse(rs.readFileSync(a,"utf8"))}catch(l){let c=l instanceof Error?l.message:String(l);this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Failed to parse domain dependency JSON: ${c}`}),process.exit(1)}t=new Ve(n,[],{readOnly:!0})}let i=new Ji(e,t),s=new Hi(i).validate();return S.debug(`[validate:api] API Model validation rules executed. Issues found: ${s.length}`),s}reportResults(e,t){S.debug(`[validate] Reporting results. Found ${e.length} validation issue(s).`);let i=e.some(r=>r.severity==="error");if(P.resolved.format==="json")console.log(JSON.stringify({isValid:!i,validationIssues:e},null,2));else if(e.length===0)this.formatter.success("Validation passed. No issues found!");else{let r=this.formatIssues(e,t);this.formatter.list(r,["severity","code","message","suggestion","context"],{headers:["SEVERITY","CODE","MESSAGE","SUGGESTION","CONTEXT"]});let s=e.filter(l=>l.severity==="error").length,a=e.filter(l=>l.severity==="warning").length,n=e.filter(l=>l.severity==="info").length;console.log(""),s>0?console.error(X.red(`\u2716 Validation failed: ${s} error(s), ${a} warning(s), ${n} info(s).`)):console.log(X.yellow(`\u26A0 Validation passed with warnings: ${a} warning(s), ${n} info(s).`))}i&&process.exit(1)}formatIssues(e,t){return e.map(i=>{let r=i.severity||"info",s=i.message||"",a,n,l;if(t===Ce){let c=i;a=c.rule||"unknown",n=c.help||"",l=c.key?`${c.kind||"unknown"}: ${c.key}`:c.field||""}else{let c=i;a=c.code||"unknown",n=c.suggestion||"";let p=c.context||{};l=`${p.kind||"unknown"}: ${p.key||""}${p.property?"."+p.property:""}`}return{severity:r,code:a,message:s,suggestion:n,context:l}})}async readStdin(){return new Promise((e,t)=>{let i="";process.stdin.setEncoding("utf8"),process.stdin.on("data",r=>{i+=r}),process.stdin.on("end",()=>{e(i)}),process.stdin.on("error",r=>{t(r)})})}};function Eo(o){o.command("runtime").description("Administrative operations for the API runtime").command("users").description("Administrative operations for users").command("update").description("Update properties of a user directly in the runtime database").requiredOption("--api <api>","API file ID or slug").requiredOption("--user-id <userId>","Primary key of the user record to update").requiredOption("--property <name=value...>","Properties to update in the format name=value (can specify multiple)").option("--org <oid>","Organization ID (defaults to configured org)").option("--env <environment>",'Target environment (e.g. "production", "staging")',"production").action(async i=>{let r=new B({format:P.resolved.format});S.debug("[runtime:update] Starting runtime user update process..."),await new Sa(i,r).execute()})}var Sa=class{constructor(e,t){this.options=e;this.formatter=t}options;formatter;async execute(){S.debug("[runtime:update] Executing runtime user update...");try{let e=te();Nt(e,this.formatter);let t=this.options.org||P.resolved.org;S.debug(`[runtime:update] Using organization ID: ${t}`),t||(this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is not specified.",detail:"Use --org <oid> or configure a default organization."}),process.exit(1)),S.debug("[runtime:update] Parsing properties...");let i=this.parseProperties(this.options.property),r={};for(let[a,n]of Object.entries(i)){let l=["token","password","secret","key"].some(c=>a.toLowerCase().includes(c));r[a]=l?"**********":n}S.debug(`[runtime:update] Parsed properties: ${JSON.stringify(r)}`),S.debug(`[runtime:update] Sending request to update runtime user ID '${this.options.userId}' in environment '${this.options.env}' for api '${this.options.api}'...`);let s=await e.deployments.apis.updateRuntimeUser(t,this.options.api,this.options.userId,i,this.options.env,{token:e.token});S.debug("[runtime:update] Runtime user updated successfully."),this.formatter.success(`User '${this.options.userId}' updated successfully!`,s)}catch(e){let t=se(e);this.formatter.error(t),process.exit(1)}}parseProperties(e){let t={};for(let i of e){let r=i.split("=");if(r.length<2)throw new Error(`Invalid property format: '${i}'. Expected 'name=value'.`);let s=r[0].trim(),a=r.slice(1).join("=").trim();a==="true"?t[s]=!0:a==="false"?t[s]=!1:a==="null"?t[s]=null:/^\d+$/.test(a)?t[s]=parseInt(a,10):/^\d*\.\d+$/.test(a)?t[s]=parseFloat(a):t[s]=a}return t}};var ot;(function(o){o.add="add",o.remove="remove",o.replace="replace",o.copy="copy",o.move="move",o.test="test"})(ot||(ot={}));function ss(o,e,t){let i=new ie(e),r=Lt(o,i);if(!Qe(r,t))throw new pe([{path:i.raw,message:"Test operation failed. The values are not equal."}]);return{doc:o}}var RE=Object.freeze({add:Ze,copy:si,move:xi,remove:gt,replace:ri,test:ss});function Io(o){return Array.isArray(o)?new Array(o.length).fill(0).map((e,t)=>`${t}`):Object.keys(o)}function Yi(o){switch(typeof o){case"object":return JSON.parse(JSON.stringify(o));case"undefined":return null;default:return o}}function rp(o,e,t={}){if(JSON.stringify(o)===JSON.stringify(e))return[];let i=[...o],r=[...e],s=[],a=0,n=0;for(;a<i.length||n<r.length;)if(a>=i.length){let l=t.fixedIndexes?n:-1;s.push({op:"add",index:l,value:r[n]}),n++}else if(n>=r.length)s.push({op:"remove",index:a}),a++;else if(Qe(i[a],r[n]))a++,n++;else{let l=-1,c=-1;for(let p=a;p<i.length;p++)if(Qe(i[p],r[n])){l=p;break}for(let p=n;p<r.length;p++)if(Qe(r[p],i[a])){c=p;break}if(l===-1&&c===-1)s.push({op:"replace",index:n,value:r[n]}),a++,n++;else if(l===-1)s.push({op:"add",index:n,value:r[n]}),n++;else if(c===-1)s.push({op:"remove",index:a}),a++;else{s.push({op:"move",index:n,from:l});let p=i[l];i.splice(l,1),i.splice(a,0,p),a++,n++}}return s.sort((l,c)=>l.op==="remove"&&c.op==="remove"?c.index-l.index:0)}function _a(o,e,t,i=[],r={}){if(o===e)return;if(o==null&&e!==null&&e!==void 0){t.push({op:"replace",path:"",value:e});return}if(e==null&&o!==null&&o!==void 0){t.push({op:"replace",path:"",value:null});return}typeof e.toJSON=="function"&&(e=e.toJSON());let s=It(o),a=It(e),n=vr(s),l=vr(a);if(n&&l){Qe(o,e)||t.push({op:"replace",path:ue(i),value:e});return}if(a!==s){t.push({op:s===void 0?"add":"replace",path:ue(i),value:e});return}if(s==="array"){let u=o,h=rp(u,e,r);for(let f of h){let k=f.index===-1?"-":f.index.toString(),w=[...i,k];f.op==="remove"?(r.invertible&&t.push({op:"test",path:ue(w),value:Yi(u[f.index])}),t.push({op:f.op,path:ue(w)})):f.op==="replace"&&typeof f.value=="object"&&f.value!==null?_a(u[f.index],f.value,t,w,r):f.op==="move"?t.push({op:"move",from:ue([...i,f.from.toString()]),path:ue(w)}):t.push({op:f.op,path:ue(w),value:f.value})}return}let c=Io(e),p=Io(o);for(let u of c){let m=o[u],h=e[u];Object.prototype.hasOwnProperty.call(o,u)?typeof m=="object"&&m!=null&&typeof h=="object"&&h!==null&&Array.isArray(m)===Array.isArray(h)?_a(m,h,t,[...i,u],r):Qe(m,h)||(r.invertible&&t.push({op:"test",path:ue([...i,u]),value:Yi(m)}),t.push({op:"replace",path:ue([...i,u]),value:Yi(h)})):t.push({op:"add",path:ue([...i,u]),value:Yi(h)})}for(let u of p)Object.prototype.hasOwnProperty.call(e,u)||(r.invertible&&t.push({op:"test",path:ue([...i,u]),value:Yi(o[u])}),t.push({op:"remove",path:ue([...i,u])}))}function Xi(o,e,t){let i=[];return _a(o,e,i,[],t),i}var hi=Object.create(null);hi.add=0;hi.remove=1;hi.replace=2;hi.move=3;hi.copy=4;hi.test=5;import{nanoid as op}from"nanoid";function $o(o){o.command("domain").description("Manage Data Domains").command("transition [state]").description("Transition the lifecycle state of a data domain (draft, committed, published)").option("--file <fid>","File ID of the data domain").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--ver <ver>","New version (required when transitioning from published to draft)").action(async(t,i)=>{let r=new B({format:P.resolved.format}),s=P.resolved,a=i.org||s.org;if(S.debug(`[domain:transition] Transitioning domain lifecycle. Options: file=${i.file}, org=${a}, ver=${i.ver}, state=${t}`),!a){r.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1);return}let n=te(),l=i.file;if(!l&&process.stdout.isTTY){S.debug("[domain:transition] File ID not provided; listing data domain files for selection...");try{let h=(await n.files.list(a,{filter:{field:"kind",operator:"eq",value:ut}},{token:n.token})).data||[];h.length>0&&(l=await ft("Select a data domain file:",h.map(f=>({name:`${f.info?.name||"Unnamed"} (${f.key})`,value:f.key}))))}catch(m){S.debug(`[domain:transition] Failed to list domain files for selection: ${m}`)}}if(!l){r.error({code:"CLI_ERR_MISSING_REQUIRED",message:"File ID is required.",detail:"Specify --file <fid>."}),process.exit(1);return}let c=t,p=["draft","committed","published"];if(!c&&process.stdout.isTTY&&(c=await ft("Select target lifecycle state:",[{name:"Draft (draft)",value:"draft"},{name:"Committed (committed)",value:"committed"},{name:"Published (published)",value:"published"}])),!c){r.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Target lifecycle state is required.",detail:`Specify state as a positional argument (allowed: ${p.join(", ")}).`}),process.exit(1);return}if(!p.includes(c)){r.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Invalid lifecycle state '${c}'.`,detail:`Allowed states: ${p.join(", ")}`}),process.exit(1);return}let u;try{u=await n.files.read(a,l,{token:n.token})}catch(m){let h=se(m);r.error(h),process.exit(1);return}if(u.kind!==ut){r.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`File '${l}' is not a data domain.`,detail:`The file kind is '${u.kind}', but expected '${ut}'.`}),process.exit(1);return}try{S.debug(`[domain:transition] Fetching media for file ID '${l}'...`);let{media:m,meta:h}=await n.files.readMedia(a,l,{token:n.token}),f=m;if(f.kind!==Ce){r.error({code:"CLI_ERR_INVALID_ARGUMENT",message:"Invalid data domain schema format.",detail:`The media kind is '${f.kind}', but expected '${Ce}'.`}),process.exit(1);return}let k=[];f.dependencyList&&f.dependencyList.length>0&&(S.debug(`[domain:transition] Fetching dependencies: ${JSON.stringify(f.dependencyList)}`),k=(await n.dataCatalog.listDependencies(f.dependencyList,{token:n.token})).data||[]);let w=new Ve(f,k,{readOnly:!1}),b=i.ver;if(w.lifecycle==="published"&&c==="draft"&&!b){if(process.stdout.isTTY){let R=w.info.version;b=await Je(`Enter new version (current published version is ${R}):`)}if(!b){r.error({code:"CLI_ERR_MISSING_REQUIRED",message:"A new version must be specified when creating a draft from a published domain.",detail:"Provide a version with --ver <ver>."}),process.exit(1);return}}S.debug(`[domain:transition] Changing lifecycle state from '${w.lifecycle}' to '${c}'...`),w.changeLifecycle(c,b),S.debug("[domain:transition] Validating data domain structure...");let E=new Zt(w).validate();if(E&&E.length>0&&E.filter(G=>G.severity==="error").length>0){r.error({code:"CLI_ERR_INVALID_ARGUMENT",message:"Data domain validation failed.",detail:JSON.stringify(E,null,2)}),process.exit(1);return}let x=w.toJSON(),I=Xi(f,x);if(I.length===0){S.debug("[domain:transition] No changes in domain lifecycle detected."),r.success(`Data domain is already in '${c}' state.`);return}S.debug("[domain:transition] Sending patch request to target file media...");let j={id:op(),timestamp:Date.now(),patch:I,version:h.version},L=await n.files.patchMedia(a,l,j,{token:n.token});S.debug(`[domain:transition] Patch applied successfully. New file version: ${L.newVersion}`),r.success(`Successfully transitioned data domain state to '${c}' (new file version: ${L.newVersion}).`,{fileId:l,state:c,version:w.info.version,fileVersion:L.newVersion})}catch(m){let h=se(m);r.error(h),process.exit(1);return}})}parseInt(process.versions.node.split(".")[0],10)<22&&(console.error("Error: apinow requires Node.js 22 or higher."),process.exit(1));function Oo(){let o=process.argv.indexOf("--format");if(o!==-1&&o+1<process.argv.length&&process.argv[o+1]==="json")return"json";try{return P.resolved.format||"text"}catch{return"text"}}process.on("uncaughtException",o=>{new B({format:Oo()}).error({code:"CLI_ERR_UNKNOWN",message:o.message||"An unexpected error occurred.",detail:o.stack}),process.exit(1)});process.on("unhandledRejection",o=>{let e=new B({format:Oo()}),t=o instanceof Error?o.message:String(o),i=o instanceof Error?o.stack:void 0;e.error({code:"CLI_ERR_UNKNOWN",message:`Unhandled promise rejection: ${t}`,detail:i}),process.exit(1)});lp({pkg:gi}).notify();P.load();var Fe=new cp;Fe.name("apinow").description("API NOW! Platform CLI Tool").version(gi.version,"--version").option("--format <format>","Output format: text, json","text").option("--api-url <url>","Override target API server base URL").option("--debug","Enable debug/verbose logging").option("-v, --verbose","Enable verbose logging");Fe.hook("preAction",(o,e)=>{let t,i,r=e;for(;r;){let s=r.opts();s.apiUrl&&!t&&(t=s.apiUrl),s.format&&!i&&(i=s.format),(s.debug||s.verbose)&&Ia("debug"),r=r.parent}P.saturate({apiUrl:t,format:i}),S.debug(`Executing command: ${e.name()} with args: ${JSON.stringify(e.args)}`)});ja(Fe);Ca(Fe);Da(Fe);Ja(Fe);Ga(Fe);Ao(Fe);Eo(Fe);$o(Fe);function To(o){let e=o.options||[];e.some(t=>t.long==="--api-url")||o.option("--api-url <url>","Override target API server base URL"),e.some(t=>t.long==="--format")||o.option("--format <format>","Output format: text, json"),e.some(t=>t.long==="--debug")||o.option("--debug","Enable debug/verbose logging"),e.some(t=>t.long==="--verbose")||(o.options.some(i=>i.short==="-v")?o.option("--verbose","Enable verbose logging"):o.option("-v, --verbose","Enable verbose logging"));for(let t of o.commands)To(t)}for(let o of Fe.commands)To(o);await Fe.parseAsync(process.argv);
|
|
53
|
+
`))}function Hn(o,e){return ed(o,e),{options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:Zc(o,e),edges:Qc(o,e)}}function Wn(o,e){for(let t of o.nodes()){let i=o.node(t);i&&i.domain.key===e&&o.removeNode(t)}}function pa(o,e,t){let i=new Set,r=new Set;for(let a of e.nodes()){let n=e.node(a);if(!n)continue;let l=`${t}:${a}`;o.setNode(l,n),i.add(l)}for(let a of e.edges()){let n=e.edge(a);if(!n)continue;let l=`${t}:${a.v}`,c=`${t}:${a.w}`;o.setEdge(l,c,{foreign:!0,domain:t,...n}),r.add(`${l}|${c}`)}let s=new Set;for(let a of e.nodes()){let n=`${t}:${a}`;for(let l of e.parents(a)){let c=`${t}:${l}`,p=o.node(n),u=o.node(c);p.kind===N&&u.kind===N?s.has(n)?o.addParent(n,c):(s.add(n),o.setParent(n,c)):o.setParent(n,c)}}return{nodes:i,edges:r}}function Gn(o,e){for(let t of e)if(t.w===o)return t.v}function td(o,e,t,i,r){if(!e){let a={type:"malformed_entry",severity:"error",message:"Unable to restore data domain graph. Malformed node entry"};if(r.push(a),i==="strict")throw new Error(a.message);return}let s=e;if(!s.kind){let a={type:"malformed_entry",severity:"error",message:"Unable to restore data domain graph. Node entry missing kind property",affectedKey:s.key};if(r.push(a),i==="strict")throw new Error(a.message);return}try{if(s.kind===ke)return new di(o,s);if(s.kind===ye)return new Ut(o,s);if(s.kind===N)return new li(o,s);if(s.kind===ne){let n=s,l=Gn(n.key,t);if(!l){let c={type:"missing_edge",severity:"error",message:`Property "${n.info?.name||n.key}" has no parent entity edge`,affectedKey:n.key,resolution:i==="lenient"?"Property will be skipped":void 0};if(r.push(c),i==="strict")throw new Error("Unable to restore data domain graph. Malformed node entry");return}return new Dt(o,l,n)}if(s.kind===ae){let n=s,l=Gn(n.key,t);if(!l){let c={type:"missing_edge",severity:"error",message:`Association "${n.info?.name||n.key}" has no parent entity edge`,affectedKey:n.key,resolution:i==="lenient"?"Association will be skipped":void 0};if(r.push(c),i==="strict")throw new Error("Unable to restore data domain graph. Malformed node entry");return}return new oi(o,l,n)}let a={type:"unknown_kind",severity:"error",message:`Unknown node kind: ${s.kind}`,affectedKey:s.key};if(r.push(a),i==="strict")throw new Error(`Unable to restore data domain graph. Unknown node kind ${s.kind}`);return}catch(a){let n={type:"malformed_entry",severity:"error",message:`Failed to create node: ${a instanceof Error?a.message:String(a)}`,affectedKey:s.key};if(r.push(n),i==="strict")throw a;return}}function Xn(o,e={}){let{json:t,dependencies:i,mode:r="strict"}=e,s=new Mr({compound:!0,multigraph:!0,directed:!0}),a=[],n=new Set,l=new Set;if(i)for(let p of i)try{let u=pa(s,p.graph,p.key);u.edges.size&&(l=new Set([...l,...u.edges])),u.nodes.size&&(n=new Set([...n,...u.nodes])),o.dependencies.set(p.key,p)}catch(u){let h=`Failed to merge dependency "${p.key}": ${u instanceof Error?u.message:String(u)}`;if(r==="strict")throw new Error(h,{cause:u});let m={type:"missing_dependency",severity:"error",message:h,affectedKey:p.key,resolution:"Dependency will be skipped"};a.push(m)}if(!t)return{graph:s,issues:a,success:!0};if(Array.isArray(t.nodes)){let p=new Map;for(let u of t.nodes){let h=td(o,u.value,t.edges,r,a);h&&(s.setNode(u.v,h),u.parents&&p.set(u.v,u.parents))}for(let[u,h]of p){if(!s.hasNode(u)){let m={type:"missing_node",severity:"warning",message:`Cannot set parents for missing node: ${u}`,affectedKey:u,resolution:"Parent relationship will be skipped"};a.push(m);continue}for(let m of h){if(!s.hasNode(m)){let f={type:"missing_node",severity:"warning",message:`Parent node "${m}" not found for child "${u}"`,affectedKey:u,context:{parentKey:m},resolution:"Parent relationship will be skipped"};a.push(f);continue}try{s.setParent(u,m)}catch(f){let k={type:"invalid_parent",severity:"warning",message:`Failed to set parent "${m}" for child "${u}": ${f instanceof Error?f.message:String(f)}`,affectedKey:u,context:{parentKey:m},resolution:"Parent relationship will be skipped"};a.push(k)}}}}if(Array.isArray(t.edges))for(let p of t.edges){if(!p.value){let u="Edge entry missing value";if(r==="strict")throw new Error(u);let h={type:"malformed_entry",severity:"error",message:u,context:{edge:p}};a.push(h);continue}if(p.value.foreign&&!n.has(p.w)){let u={type:"missing_node",severity:"warning",message:`Missing foreign node: ${p.w}`,affectedKey:p.w,resolution:"Edge will be skipped"};a.push(u);continue}if(n.has(p.v)||n.has(p.w)){if(!s.hasNode(p.v)||!s.hasNode(p.w)){let u={type:"missing_node",severity:"warning",message:`Missing foreign node for edge: ${p.v} -> ${p.w}`,context:{sourceNode:p.v,targetNode:p.w},resolution:"Edge will be skipped"};a.push(u);continue}}else{if(!s.hasNode(p.v)){let u={type:"missing_node",severity:"warning",message:`Source node not found for edge: ${p.v}`,affectedKey:p.v,resolution:"Edge will be skipped"};a.push(u);continue}if(!s.hasNode(p.w)){let u={type:"missing_node",severity:"warning",message:`Target node not found for edge: ${p.w}`,affectedKey:p.w,resolution:"Edge will be skipped"};a.push(u);continue}}try{s.setEdge({v:p.v,w:p.w,name:p.name},p.value)}catch(u){let m={type:"malformed_entry",severity:"warning",message:`Failed to create edge ${p.v} -> ${p.w}: ${u instanceof Error?u.message:String(u)}`,context:{sourceNode:p.v,targetNode:p.w},resolution:"Edge will be skipped"};a.push(m)}}for(let p of s.nodes()){let u=s.node(p);if(u){if(u.kind===ne){let h=u,m=h.parent?s.node(h.parent):void 0;m&&Array.isArray(m.fields)&&(m.fields.some(b=>b.key===h.key&&b.type==="property")||m.fields.push({type:"property",key:h.key}))}else if(u.kind===ae){let h=u,m=h.parent?s.node(h.parent):void 0;m&&Array.isArray(m.fields)&&(m.fields.some(b=>b.key===h.key&&b.type==="association")||m.fields.push({type:"association",key:h.key}))}}}let c=a.some(p=>p.severity==="error");return{graph:s,issues:a,success:!c}}var ui=class extends EventTarget{dependencies=new Map;dependencyList=[];constructor(e=[],t=[]){super(),this.dependencyList=[...e];for(let i of t)this.dependencies.set(i.key,i)}};var Xe=class o extends ui{kind;key;graph;info;lifecycle;previousVersion;#e=!0;#t=!1;readOnly;get domain(){return this}#r;get fields(){return this.#r}set fields(e){this.#r=e}issues=[];static createSchema(e={}){let{key:t=q(),fields:i,lifecycle:r="draft",previousVersion:s}=e,a=ie.fromJSON(e.info,{name:"Unnamed domain"}).toJSON(),n={kind:ze,key:t,info:a,lifecycle:r};return s&&(n.previousVersion=s),e.dependencyList&&(n.dependencyList=structuredClone(e.dependencyList)),e.graph&&(n.graph=e.graph),Array.isArray(i)&&(n.fields=[...i]),n}constructor(e,t=[],i){let r=o.createSchema(e),s=[];for(let l of t)if(l instanceof o)l.readOnly?s.push(l):(console.warn(`Domain ${l.key} is not read only, cloning it. This may have performance implications.`),s.push(l.clone({readOnly:!0})));else if(typeof l=="object"&&l.kind===ze&&l.key){let c=new o(l,void 0,{readOnly:!0});s.push(c)}else throw new Error(`Invalid foreign domain dependency: ${l}`);super(r.dependencyList,s),this.kind=r.kind,this.key=r.key,this.info=new ie(r.info),this.readOnly=i?.readOnly||!1,this.lifecycle=r.lifecycle||"draft",this.previousVersion=r.previousVersion;let a=i?.mode||"strict",n=Xn(this,{json:r.graph,dependencies:s,mode:a});this.graph=n.graph,n.issues.length>0&&a==="lenient"&&(this.issues=n.issues),Array.isArray(r.fields)?this.fields=[...r.fields]:this.fields=[],Array.isArray(r.dependencyList)?this.dependencyList=[...r.dependencyList]:this.dependencyList=[],this.#e=!1}clone(e){let t=this.toJSON(),i=Array.from(this.dependencies.values()).map(s=>s.clone()),r={readOnly:this.readOnly,...e};return new o(t,i,r)}toJSON(){let e={info:this.info.toJSON(),kind:this.kind,key:this.key,graph:Hn(this.graph,this.key),lifecycle:this.lifecycle};return this.previousVersion&&(e.previousVersion=this.previousVersion),this.dependencyList.length>0&&(e.dependencyList=structuredClone(this.dependencyList)),Array.isArray(this.fields)&&this.fields.length&&(e.fields=[...this.fields]),e}notifyChange(){this.#t||this.#e||(this.#t=!0,queueMicrotask(()=>{this.#t=!1;let e=new Event("change");this.dispatchEvent(e)}))}changeLifecycle(e,t){if(e!==this.lifecycle){if(this.lifecycle==="published"){if(e!=="draft")throw new Error(`Cannot transition from published to ${e}`);if(!t)throw new Error("A new version must be specified when creating a draft from a published domain");if(t===this.info.version)throw new Error("The new version must be different from the current published version");this.previousVersion=this.info.version,this.info.version=t,this.lifecycle="draft",this.notifyChange();return}if(e==="draft"){if(this.lifecycle!=="committed")throw new Error(`Cannot transition from ${this.lifecycle} to draft`);this.lifecycle="draft",this.notifyChange();return}if(e==="committed"){if(this.lifecycle!=="draft")throw new Error(`Cannot transition from ${this.lifecycle} to committed`);this.lifecycle="committed",this.notifyChange();return}if(e==="published"){this.lifecycle="published",this.notifyChange();return}throw new Error(`Unknown lifecycle state: ${e}`)}}ensureWritable(){if(this.lifecycle!=="draft")throw new Error(`Cannot modify the data domain when it is in "${this.lifecycle}" lifecycle state`)}removeField(e){this.fields=this.fields.filter(t=>t.key!==e)}hasFields(){return this.fields.length>0}*listFields(){for(let{key:e}of this.fields){let t=this.graph.node(e);t&&(t.kind===ke||t.kind===ye)&&(yield t)}}addNamespace(e,t){if(this.ensureWritable(),t){if(!this.graph.hasNode(t))throw new Error(`Parent namespace ${t} does not exist`);let r=this.graph.node(t);if(!r||r.kind!==ke)throw new Error(`Parent namespace ${t} is not a valid namespace`);if(r.domain.key!==this.key)throw new Error("Cannot add a namespace to a foreign domain");return r.addNamespace(e)}let i=new di(this,e);return this.graph.setNode(i.key,i),this.fields.push({type:"namespace",key:i.key}),i}removeNamespace(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Namespace ${e} does not exist`);let t=this.graph.node(e);if(!t||t.kind!==ke)throw new Error(`Namespace ${e} not found`);if(t.domain.key!==this.key)throw new Error("Cannot remove a namespace from a foreign domain");let i=t.getParentInstance();return i===this?(Ee(this.graph,e),this.removeField(e)):i.removeNamespace(e),this}*listNamespaces(){for(let{key:e,type:t}of this.fields){if(t!=="namespace")continue;let i=this.graph.node(e);!i||i.kind!==ke||(yield i)}}*listForeignNamespaces(e){let t=this.dependencies.get(e);if(!t)throw new Error(`Foreign domain ${e} not found`);for(let i of t.listNamespaces()){let r=`${e}:${i.key}`;this.graph.node(r)&&(yield i)}}hasNamespaces(){return this.fields.some(e=>e.type==="namespace")}*listGraphNamespaces(e){for(let t of this.graph.children(e)){let i=this.graph.node(t);i.kind===ke&&i.domain.key===this.key&&(yield i)}}buildReferenceKey(e,t){if(t&&t!==this.key){if(typeof t!="string"||t.length===0)throw new Error(`Invalid namespace key. Expected a string, got ${typeof t}`);if(!this.dependencies.get(t))throw new Error(`Foreign domain ${t} not found`);return`${t}:${e}`}return e}findNamespace(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===ke)return i}moveNamespace(e,t){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Namespace ${e} does not exist`);let i=this.findNamespace(e);if(!i)throw new Error(`Namespace ${e} not found in the graph`);if(t){let a=this.findNamespace(t);if(a&&a.domain.key!==this.key)throw new Error("Cannot move a namespace to a foreign domain");if(!a)throw new Error(`Parent namespace ${t} does not exist`)}if(e===t)throw new Error("Cannot move a namespace to itself");if(i.domain.key!==this.key)throw new Error("Cannot move a namespace from a foreign domain");let r;if(t){if(r=this.findNamespace(t),!r)throw new Error(`Parent namespace ${t} not found`);if(this.isChildOf(t,e))throw new Error("Cannot move a namespace to its own child")}let s=this.graph.parent(e);return s&&!t?this.graph.node(s).detachNamespace(e):s||this.removeField(e),t&&r?r.attachNamespace(e):this.fields.push({type:"namespace",key:e}),this}isChildOf(e,t){let i=this.graph.children(t);for(let r of i)if(r===e||this.isChildOf(e,r))return!0;return!1}addModel(e,t){if(this.ensureWritable(),t){if(!this.graph.hasNode(t))throw new Error(`Parent ${t} does not exist`);let r=this.findNamespace(t);if(!r)throw new Error(`Parent namespace ${t} is not a valid namespace`);if(r.domain.key!==this.key)throw new Error("Cannot add a model to a foreign domain");return r.addModel(e)}let i=new Ut(this,e);return this.graph.setNode(i.key,i),this.fields.push({type:"model",key:i.key}),i}removeModel(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Data model ${e} does not exist`);let t=this.graph.node(e);if(!t||t.kind!==ye)throw new Error(`Data model ${e} not found`);if(t.domain.key!==this.key)throw new Error("Cannot remove a model from a foreign domain");let i=t.getParentInstance();return i===this?(Ee(this.graph,e),this.removeField(e)):i.removeModel(e),this}*listModels(e){let t=e?.domain,i=e?.includeForeign??!1,r=e?.foreignOnly??!1;if(t){let s=t===this.key?this:this.dependencies.get(t);if(!s)throw new Error(`Foreign domain ${t} not found`);for(let a of s.listModels()){let n=t===this.key?a.key:`${t}:${a.key}`,l=this.graph.node(n);l&&(yield l)}return}if(!r)for(let{key:s,type:a}of this.fields){if(a!=="model")continue;let n=this.graph.node(s);n&&n.kind===ye&&(yield n)}if(i||r)for(let[s,a]of this.dependencies)for(let n of a.listModels()){let l=`${s}:${n.key}`,c=this.graph.node(l);c&&(yield c)}}*listForeignModels(e){yield*this.listModels({domain:e})}hasModels(){return this.fields.some(e=>e.type==="model")}*listGraphModels(e){for(let t of this.graph.children(e)){let i=this.graph.node(t);i.kind===ye&&i.domain.key===this.key&&(yield i)}}findModel(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===ye)return i}moveModel(e,t){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Data model ${e} does not exist`);let i=this.findModel(e);if(!i)throw new Error(`Data model ${e} not found in the graph`);if(t){let s=this.findNamespace(t);if(s&&s.domain.key!==this.key)throw new Error("Cannot move a model to a foreign domain");if(!s)throw new Error(`Parent namespace ${t} does not exist`)}if(i.domain.key!==this.key)throw new Error("Cannot move a data model to a foreign domain");let r=this.graph.parent(e);if(r&&!t){let s=this.findNamespace(r);if(!s)throw new Error(`The parent namespace ${r} not found`);s.detachModel(e)}else r||this.removeField(e);return t?this.findNamespace(t).attachModel(e):this.fields.push({type:"model",key:e}),this}addEntity(e,t){if(this.ensureWritable(),!e)throw new Error("An entity expects a DomainModel parent");if(!this.graph.hasNode(e))throw new Error(`The parent ${e} does not exist`);let i=this.findModel(e);if(!i)throw new Error(`Parent model ${e} is not a valid model`);if(i.domain.key!==this.key)throw new Error("Cannot add an entity to a foreign domain");return i.addEntity(t)}removeEntity(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Entity ${e} does not exist`);let t=this.graph.parent(e);if(!t)throw new Error(`Parent model not found for entity ${e}`);let i=this.findModel(t);if(!i)throw new Error(`Parent model ${t} not found`);if(i.domain.key!==this.key)throw new Error("Cannot remove an entity from a foreign domain");return i.removeEntity(e),this}*listEntities(e){let t,i,r=!1,s=!1;if(typeof e=="string"?t=e:e&&typeof e=="object"&&(t=e.parent,i=e.domain,r=e.includeForeign??!1,s=e.foreignOnly??!1),i&&i!==this.key&&!this.dependencies.get(i))throw new Error(`Foreign domain ${i} not found`);let a=t?this.graph.children(t):this.graph.nodes();for(let n of a){let l=this.graph.node(n);if(l&&l.kind===N){let c=l.domain.key===this.key;if(i){l.domain.key===i&&(yield l);continue}s?c||(yield l):r?yield l:c&&(yield l)}}}*listForeignEntities(e){yield*this.listEntities({domain:e})}*listAllForeignEntities(){yield*this.listEntities({foreignOnly:!0})}findEntity(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===N)return i}moveEntity(e,t,i){if(this.ensureWritable(),t===i)throw new Error("Cannot move an entity to the same model");if(!this.graph.hasNode(e))throw new Error(`Entity ${e} does not exist`);if(!this.graph.hasNode(t))throw new Error(`Source model ${t} does not exist`);if(!this.graph.hasNode(i))throw new Error(`Target model ${i} does not exist`);let r=this.findEntity(e),s=this.findModel(t),a=this.findModel(i);if(!r||!s||!a)throw new Error("Entity or models not found in the graph");if(r.domain.key!==this.key)throw new Error("Cannot move an entity from a foreign domain");if(a.domain.key!==this.key)throw new Error("Cannot move an entity to a foreign domain");a.attachEntity(e)}addAssociation(e,t){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Source entity ${e} not found`);let i=this.findEntity(e);if(!i)throw new Error(`Source entity ${e} not found`);if(i.domain.key!==this.key)throw new Error("Cannot add an association to a foreign domain");return i.addAssociation(t)}removeAssociation(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Association ${e} does not exist`);let t=this.graph.node(e);if(!t||t.kind!==ae)throw new Error(`Association ${e} not found`);let i=t.getParentInstance();if(!i)throw new Error(`Parent entity not found for association ${e}`);if(i.domain.key!==this.key)throw new Error("Cannot remove an association from a foreign domain");return i.removeAssociation(e),this}findAssociation(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===ae)return i}getIncomingAssociations(e){let t=[];for(let i of this.graph.inEdges(e)){let r=this.graph.node(i.v);r&&r.kind===ae&&t.push(r)}return t}findAssociationBetween(e,t){let i=this.graph.node(e);if(!i||i.kind!==N)return;let r=i;for(let s of r.listAssociations())for(let a of s.targets)if(this.buildReferenceKey(a.key,a.domain)===t)return s}resolveOwnershipPath(e){let t=this.findEntity(e);if(!t)return null;if(t.hasSemantic(y.User))return[];for(let s of t.listAssociations())if(s.hasSemantic(y.ResourceOwnerIdentifier))return[s];let i=[{key:e,path:[]}],r=new Set([e]);for(;i.length>0;){let s=i.shift();if(!s)continue;let a=this.findEntity(s.key);if(!a)continue;let n=[...a.listAssociations()].filter(u=>u.hasSemantic(y.CreatedBy)||u.hasSemantic(y.UpdatedBy)||u.hasSemantic(y.DeletedBy)?!1:u.hasSemantic(y.RelationalResourceOwner)||u.hasSemantic(y.ResourceOwnerIdentifier)?!0:u.listTargets().some(h=>h.hasSemantic(y.User))),c=this.getIncomingAssociations(s.key).filter(u=>{if(u.hasSemantic(y.CreatedBy)||u.hasSemantic(y.UpdatedBy)||u.hasSemantic(y.DeletedBy))return!1;let h=u.getParentInstance();return h?h.hasSemantic(y.User)||u.schema?.embedded===!0:!1}),p=[...n,...c];for(let u of p){let h=u.getParentInstance();if(!h)continue;let m=[...u.listTargets()];if(m.length!==0)for(let f of m){let b=s.key===h.key?f.key:h.key;if(r.has(b))continue;let k=this.findEntity(b);if(!k)continue;let S=[...s.path,u];if(k.hasSemantic(y.User)||u.hasSemantic(y.ResourceOwnerIdentifier))return S;r.add(b),i.push({key:b,path:S})}}}return null}addProperty(e,t){if(this.ensureWritable(),!e)throw new Error("A property expects a DomainEntity parent");if(!this.graph.hasNode(e))throw new Error(`Parent entity ${e} does not exist`);let i=this.findEntity(e);if(!i)throw new Error(`Parent entity ${e} not found`);if(i.domain.key!==this.key)throw new Error("Cannot add a property to a foreign domain");return i.addProperty(t)}removeProperty(e){if(this.ensureWritable(),!this.graph.hasNode(e))throw new Error(`Property ${e} does not exist`);let t=this.graph.node(e);if(!t||t.kind!==ne)throw new Error(`Property ${e} not found`);let i=t.getParentInstance();if(!i)throw new Error(`Parent entity not found for property ${e}`);if(i.domain.key!==this.key)throw new Error("Cannot remove a property from a foreign domain");return i.removeProperty(e),this}findProperty(e,t){let i=this.graph.node(this.buildReferenceKey(e,t));if(i&&i.kind===ne)return i}registerForeignDomain(e){this.ensureWritable();let{info:t,key:i}=e;if(!t.version)throw new Error(`Foreign domain ${i} does not have a version set`);if(this.dependencies.has(i))throw new Error(`Foreign domain with key ${i} already registered`);this.dependencies.set(i,e),this.dependencyList.push({key:i,version:t.version}),pa(this.graph,e.graph,e.key)}unregisterForeignDomain(e){this.ensureWritable();let t=this.dependencies.get(e);if(!t)throw new Error(`Foreign domain with key ${e} not found`);this.dependencies.delete(e),this.dependencyList=this.dependencyList.filter(i=>i.key!==e),Wn(this.graph,t.key)}removeDomainElement(e,t){switch(t){case ke:this.removeNamespace(e);break;case ye:this.removeModel(e);break;case N:this.removeEntity(e);break;case ne:this.removeProperty(e);break;case ae:this.removeAssociation(e);break;default:throw new Error(`Unknown kind ${t} for the object ${e}`)}}search(e={}){let{query:t,nodeTypes:i,includeForeignDomains:r=!1,caseSensitive:s=!1}=e,a=[],n=!t&&(!i||i.length===0),l=h=>!i||i.length===0?!0:i.includes(h),c=h=>{if(!h||!t)return!t;if(t instanceof RegExp)return t.test(h);let m=s?h:h.toLowerCase(),f=s?t:t.toLowerCase();return m.includes(f)},p=h=>{if(!t)return[];let m=[],{info:f}=h;return c(f.name)&&m.push("name"),c(f.displayName)&&m.push("displayName"),c(f.description)&&m.push("description"),m},u=h=>h.includes(":");for(let h of this.graph.nodes()){let m=this.graph.node(h);if(!m||!m.info)continue;let f=u(h);if(f&&!r||!l(m.kind))continue;if(n){a.push({node:m,matchedFields:[],key:h,isForeign:f});continue}let b=p(m);(!t||b.length>0)&&a.push({node:m,matchedFields:b,key:h,isForeign:f})}return a}};var Vr=new Set(["IN","EXISTS","SELECT","FROM","WHERE","AND","OR","NOT","NULL","TRUE","FALSE","BETWEEN","LIKE","INTO","JOIN","INNER JOIN","LEFT JOIN","RIGHT JOIN","FULL JOIN","CROSS JOIN","UNION","INTERSECT","EXCEPT","ORDER BY","GROUP BY","HAVING","DISTINCT","LIMIT","OFFSET","INSERT","UPDATE","DELETE","CREATE","ALTER","DROP","TRUNCATE","RENAME","GRANT","REVOKE","COMMIT","ROLLBACK","SAVEPOINT","BEGIN","END","CASE","WHEN","THEN","ELSE","END CASE","EXCEPTION","RAISE","RETURN","FUNCTION","PROCEDURE"]);function Lr(o){let e=[],t=o.info.getLabel(),i=o.getParentInstance();if(!i)return e;let r;if(i.kind===N)r=i.key;else{let n=i.getParentInstance();if(!n)return e;r=n.key}let s=o.kind===ne?"property":"association";if(!o.info.name){let n=`The "${t}" ${s} has no name.`,l=`The ${s} must have a name.`;return e.push({field:"name",rule:"required",message:n,help:l,severity:"error",key:o.key,kind:o.kind,parent:i.key,parentKind:i.kind,...r?{entityKey:r}:{}}),e}let a=o.info.name;if(a.length<2){let n=`The "${t}" ${s} name is too short.`;e.push({field:"name",rule:"length",message:n,help:"The name must be at least 2 characters long.",severity:"error",key:o.key,kind:o.kind,parent:i.key,parentKind:i.kind,...r?{entityKey:r}:{}})}if(a.length>59){let n=`The "${t}" ${s} name is too long.`;e.push({field:"name",rule:"length",message:n,help:"The name must be at most 59 characters long.",severity:"error",key:o.key,kind:o.kind,parent:i.key,parentKind:i.kind,...r?{entityKey:r}:{}})}if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a)){let n=`The "${t}" ${s} name is invalid.`;e.push({field:"name",rule:"format",message:n,help:"The name must start with a letter (a-z) or underscore (_). Subsequent characters can be letters, digits (0-9), or underscores (_).",severity:"error",key:o.key,kind:o.kind,parent:i.key,parentKind:i.kind,...r?{entityKey:r}:{}})}if(/^[A-Z]/.test(a)){let n=`The "${t}" ${s} name is not in snake case.`;e.push({field:"name",rule:"snake_case",message:n,help:"The name should be in snake case (lowercase letters and underscores).",severity:"info",key:o.key,kind:o.kind,parent:i.key,parentKind:i.kind,...r?{entityKey:r}:{}})}if(Vr.has(a.toUpperCase())){let n=`The "${t}" ${s} name is a reserved keyword.`;e.push({field:"name",rule:"reserved",message:n,help:"The name should not be a reserved keyword.",severity:"error",key:o.key,kind:o.kind,parent:i.key,parentKind:i.kind,...r?{entityKey:r}:{}})}return e}var Kr=class{domain;constructor(e){this.domain=e}validate(e){let t=[],i;if(typeof e=="string"?i=this.domain.findAssociation(e):i=e,!i){let n=`The "${e}" association does not exist.`;return t.push({field:"*",rule:"exists",message:n,help:"The association must be defined in the domain.",key:e,kind:ae,severity:"error",parentKind:N}),t}let r=this.validateName(i);t.push(...r);let s=this.validateTargets(i);t.push(...s);let a=this.validateSemantics(i);return t.push(...a),t}validateName(e){return Lr(e)}validateTargets(e){let t=[],i=e.info.getLabel(),r=e.getParentInstance();if(!e.targets.length){let s=`The "${i}" association has no target.`;return t.push({field:"targets",rule:"required",message:s,help:"An association must have at least one target.",severity:"error",key:e.key,kind:e.kind,parent:r.key,parentKind:N}),t}for(let s of e.targets)if(!this.domain.findEntity(s.key,s.domain)){let n=`The "${i}" association has an invalid target "${s.key}".`;t.push({field:"targets",rule:"exists",message:n,help:"The target must be defined in the domain.",severity:"error",key:e.key,kind:e.kind,parent:r.key,parentKind:N})}return t}validateSemantics(e){let t=[],i=e.info.getLabel(),r=e.getParentInstance();if(e.hasSemantic(y.RelationalResourceOwner))for(let s of e.targets){let a=this.domain.findEntity(s.key,s.domain);a&&this.domain.resolveOwnershipPath(a.key)===null&&t.push({field:"semantics",rule:"relational_owner_path_valid",message:`The target entity "${a.info.getLabel()}" of the relational resource owner association "${i}" does not have a valid ownership path to a User.`,help:"Ensure the target entity has a direct owner (Resource Owner Identifier) or transitively inherits ownership through another relational owner association.",severity:"error",key:e.key,kind:e.kind,parent:r.key,parentKind:N})}return t}};var Fr=class{domain;constructor(e){this.domain=e}validate(e){let t=[],i;if(typeof e=="string"?i=this.domain.findEntity(e):i=e,!i){let c=`The "${e}" entity does not exist.`;return t.push({field:"*",rule:"exists",message:c,help:"The entity must be defined in the domain.",key:e,kind:N,severity:"error",parentKind:N}),t}let r=this.validatePrimaryKey(i);t.push(...r);let s=this.minimumRequiredProperties(i);t.push(...s);let a=this.validateName(i);t.push(...a);let n=this.uniqueName(i);t.push(...n);let l=this.validateUserSemantics(i);return t.push(...l),t}validatePrimaryKey(e){let t=[];if(!e.primaryKey()){let r=`The "${e.info.getLabel()}" entity has no identifier.`;t.push({field:"properties",rule:"primary_key",message:r,help:"An entity that can exists by itself must have identifier defined.",severity:"error",key:e.key,kind:e.kind,parentKind:N})}return t}hasPropertiesInherited(e){if(e.hasProperties())return!0;for(let t of e.listParents())if(this.hasPropertiesInherited(t))return!0;return!1}hasAssociationsInherited(e){if(e.hasAssociations())return!0;for(let t of e.listParents())if(this.hasAssociationsInherited(t))return!0;return!1}minimumRequiredProperties(e){let t=[],i=this.hasPropertiesInherited(e),r=this.hasAssociationsInherited(e);if(!i&&!r){let s=`The "${e.info.getLabel()}" entity has no properties. It will be ignored.`;t.push({field:"properties",rule:"required",message:s,help:"Entities that have no properties are ignored in the data domain. No schema will be generated for it.",severity:"warning",key:e.key,kind:e.kind,parentKind:N})}return t}validateName(e){let t=[],i=e.info.getLabel();if(!e.info.name){let s=`The "${i}" entity has no name.`;return t.push({field:"name",rule:"required",message:s,help:"An entity must have a name.",severity:"error",key:e.key,kind:e.kind,parentKind:N}),t}let r=e.info.name;if(r.length<2){let s=`The "${i}" entity name is too short.`;t.push({field:"name",rule:"length",message:s,help:"The name must be at least 2 characters long.",severity:"error",key:e.key,kind:e.kind,parentKind:N})}if(r.length>31){let s=`The "${i}" entity name is too long.`;t.push({field:"name",rule:"length",message:s,help:"The name must be at most 31 characters long.",severity:"error",key:e.key,kind:e.kind,parentKind:N})}if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)){let s=`The "${i}" entity name is invalid.`;t.push({field:"name",rule:"format",message:s,help:"The name must start with a letter (a-z) or underscore (_). Subsequent characters can be letters, digits (0-9), or underscores (_).",severity:"error",key:e.key,kind:e.kind,parentKind:N})}if(/^[A-Z]/.test(r)){let s=`The "${i}" entity name is not in snake case.`;t.push({field:"name",rule:"snake_case",message:s,help:"The name should be in snake case (lowercase letters and underscores).",severity:"info",key:e.key,kind:e.kind,parentKind:N})}if(Vr.has(r.toUpperCase())){let s=`The "${i}" entity name is a reserved keyword.`;t.push({field:"name",rule:"reserved",message:s,help:"The name should not be a reserved keyword.",severity:"error",key:e.key,kind:e.kind,parentKind:N})}return t}uniqueName(e){let t=[],i=e.info.name?.toLowerCase();if(!i)return t;for(let r of this.domain.listEntities())if(r.info.name?.toLowerCase()===i&&r.key!==e.key){let s=`The "${i}" entity name is already used in the data domain.`;t.push({field:"name",rule:"unique",message:s,help:"The name must be unique. This includes references to other data domains.",severity:"error",key:r.key,kind:r.kind,parentKind:N})}for(let r of this.domain.listEntities({foreignOnly:!0}))if(r.info.name?.toLowerCase()===i&&r.key!==e.key){let s=`The "${i}" entity name is already used in the foreign data domain.`;t.push({field:"name",rule:"unique",message:s,help:"The name must be unique. This includes references to other data domains.",severity:"error",key:r.key,kind:r.kind,parent:r.domain.key,parentKind:N})}return t}validateUserSemantics(e){let t=[],i=!1,r=!1;for(let s of e.withInheritedProperties())s.hasSemantic(y.Username)&&(i=!0),s.hasSemantic(y.Password)&&(r=!0);if((i||r)&&!e.hasSemantic(y.User)){let s=`The "${e.info.getLabel()}" entity has Username or Password properties but does not have the User taxonomy.`;t.push({field:"semantics",rule:"user_taxonomy_required",message:s,help:"Entities containing authentication credentials like usernames or passwords must be tagged with the User taxonomy.",severity:"error",key:e.key,kind:e.kind,parentKind:N})}if(r&&!i){let s=`The "${e.info.getLabel()}" entity has Password credentials but lacks Username semantics.`;t.push({field:"semantics",rule:"username_required_for_password",message:s,help:"An entity with Password credentials must also define a Username property for authentication.",severity:"error",key:e.key,kind:e.kind,parentKind:N})}return t}};function lt(o,e){let t=o;for(let i of e){if(typeof t!="object"||t===null)return!1;if(t.properties&&typeof t.properties=="object"&&i in t.properties){t=t.properties[i];continue}return!(t.properties&&t.additionalProperties===!1||t.type&&t.type!=="object"&&t.type!=="any")}return!0}var Jr=class{domain;constructor(e){this.domain=e}validate(e){let t=[],i;if(typeof e=="string"?i=this.domain.findProperty(e):i=e,!i){let n=`The "${e}" property does not exist.`;return t.push({field:"*",rule:"exists",message:n,help:"The property must be defined in the domain.",key:e,kind:ne,severity:"error",parentKind:N}),t}let r=this.validateName(i);t.push(...r);let s=this.validatePrimaryKeyDefault(i);t.push(...s);let a=this.validateJsonIndex(i);return t.push(...a),t}validateName(e){return Lr(e)}validatePrimaryKeyDefault(e){let t=[];if(e.primary){let i=e.getParentInstance();if(!i)return t;let r=e.schema?.defaultValue;if(r){if(r.type!=="function"||r.value!=="random"){let s=`The primary key property "${e.info.getLabel()}" has an invalid default value.`;t.push({field:"schema.defaultValue",rule:"primary_key_default",message:s,help:'Primary key properties can only have the "random" function as their default value.',severity:"error",key:e.key,kind:e.kind,parentKind:i.kind})}}else{let s=`The primary key property "${e.info.getLabel()}" has no default value.`;t.push({field:"schema.defaultValue",rule:"primary_key_no_default",message:s,help:'Without a default generator (e.g., the "random" function), the client application must generate and supply primary key values manually.',severity:"warning",key:e.key,kind:e.kind,parentKind:i.kind})}}return t}validateJsonIndex(e){let t=[],i=e.jsonIndex;if(!i)return t;let r=e.getParentInstance();if(!r)return t;if(e.type!=="json")return t.push({field:"jsonIndex",rule:"json_index_type_mismatch",message:`Property "${e.info.getLabel()}" has a JSON index config but its type is "${e.type}".`,help:'JSON index configuration can only be defined for properties of type "json".',severity:"error",key:e.key,kind:e.kind,parentKind:r.kind}),t;if(i.paths&&e.jsonSchema)for(let s of i.paths){if(!s.path){t.push({field:"jsonIndex.paths",rule:"json_index_path_empty",message:`Property "${e.info.getLabel()}" has an empty JSON path in its index config.`,help:"JSON path index configurations must specify a non-empty path.",severity:"error",key:e.key,kind:e.kind,parentKind:r.kind});continue}let a=s.path.split(".");lt(e.jsonSchema,a)||t.push({field:"jsonIndex.paths",rule:"json_index_path_invalid",message:`JSON path "${s.path}" in index config for property "${e.info.getLabel()}" is not valid according to the property's JSON Schema.`,help:"All indexed JSON paths must exist in the property's JSON Schema definition.",severity:"error",key:e.key,kind:e.kind,parentKind:r.kind})}return t}};var qr=class{domain;constructor(e){this.domain=e}validate(){let e=[],t=this.validateUserEntity();e.push(...t);let i=this.validateTimestampSemantics();e.push(...i);let r=this.validateSoftDeleteSemantics();e.push(...r);let s=this.validatePropertySemanticsDataTypes();e.push(...s);let a=this.validateCurrencySemantics();e.push(...a);let n=this.validateGeospatialEndpoints();e.push(...n);let l=this.validateOrganizationSemantics();e.push(...l);let c=this.validateProjectSemantics();e.push(...c);let p=this.validateAssociationSemanticsPreconditions();return e.push(...p),e}validateUserEntity(){let e=[],t=0;for(let i of this.domain.listEntities())if(i.hasSemantic(y.User)){t++;let r=!1,s=!1,a=!1;for(let n of i.withInheritedProperties())if(n.hasSemantic(y.Username)&&(r=!0),n.hasSemantic(y.Password)&&(s=!0),n.hasSemantic(y.UserRole)&&(a=!0),r&&s&&a)break;r||e.push({field:"semantics",rule:"has_username",message:"No username property on the User entity found.",help:'It is recommended to set the "username" property semantic for APIs supporting authentication.',severity:"warning",key:"user_semantic",kind:N,parentKind:N}),s||e.push({field:"semantics",rule:"has_password",message:"No password property on the User entity found.",help:'It is recommended to set the "password" property semantic for APIs supporting authentication.',severity:"warning",key:"user_semantic",kind:N,parentKind:N}),a||e.push({field:"semantics",rule:"has_user_role",message:"No role property on the User entity found.",help:'It is recommended to set the "User role" property semantic for APIs supporting authentication.',severity:"warning",key:"user_semantic",kind:N,parentKind:N})}return t===0?e.push({field:"semantics",rule:"recommended",message:"No entity with User taxonomy found in the domain.",help:"It is recommended to have an entity with the User taxonomy for authentication purposes.",severity:"warning",key:"user_semantic",kind:N,parentKind:N}):t>1&&e.push({field:"semantics",rule:"one_user",message:"There is more than one entity with User taxonomy in the domain.",help:"There can be only one user in the system. Remove the additional User taxonomies.",severity:"error",key:"user_semantic",kind:N,parentKind:N}),e}validateTimestampSemantics(){let e=[];for(let t of this.domain.listEntities()){let i=!1,r=!1;for(let s of t.withInheritedProperties())s.hasSemantic(y.CreatedTimestamp)&&(i=!0),s.hasSemantic(y.UpdatedTimestamp)&&(r=!0);i||e.push({field:"semantics",rule:"recommended",message:`The "${t.info.getLabel()}" entity does not have a CreatedTimestamp taxonomy.`,help:"It is recommended to have a CreatedTimestamp property to track when the entity was created.",severity:"info",key:t.key,kind:t.kind,parentKind:N}),r||e.push({field:"semantics",rule:"recommended",message:`The "${t.info.getLabel()}" entity does not have an UpdatedTimestamp taxonomy.`,help:"It is recommended to have an UpdatedTimestamp property to track when the entity was last modified.",severity:"info",key:t.key,kind:t.kind,parentKind:N})}return e}validateSoftDeleteSemantics(){let e=[];for(let t of this.domain.listEntities()){let i=!1;for(let r of t.withInheritedProperties())if(r.hasSemantic(y.DeletedTimestamp)||r.hasSemantic(y.DeletedFlag)){i=!0;break}i||e.push({field:"semantics",rule:"recommended",message:`The "${t.info.getLabel()}" entity does not have soft delete taxonomy.`,help:"It is recommended to have either a DeletedTimestamp or DeletedFlag property for soft deletion.",severity:"info",key:t.key,kind:t.kind,parentKind:N})}return e}validatePropertySemanticsDataTypes(){let e=[];for(let t of this.domain.listEntities())for(let i of t.withInheritedProperties())for(let r of i.semantics){let s=Be[r.id];fr(s)&&s.applicableDataTypes&&(s.applicableDataTypes.includes(i.type)||e.push({field:"semantics",rule:"type_mismatch",message:`The "${i.info.getLabel()}" property has the "${s.displayName}" semantic applied, but its type "${i.type}" is not compatible.`,help:`The "${s.displayName}" semantic can only be applied to properties of type(s): ${s.applicableDataTypes.join(", ")}.`,severity:"error",key:i.key,kind:i.kind,parent:t.key,parentKind:N}))}return e}validateCurrencySemantics(){let e=[];for(let t of this.domain.listEntities())for(let i of t.withInheritedProperties()){let r=i.getSemantic(y.Currency);if(r){let s=r.config;i.type==="number"&&s?.allowedCurrencies&&s.allowedCurrencies.length>1&&e.push({field:"semantics",rule:"currency_number_multiple",message:`The "${i.info.getLabel()}" property has the Currency semantic and is a Number, but allows multiple currencies.`,help:"Number properties cannot accept currency codes. Please change the property type to String, or restrict allowedCurrencies to exactly one currency.",severity:"error",key:i.key,kind:i.kind,parent:t.key,parentKind:N})}}return e}validateGeospatialEndpoints(){let e=[];for(let t of this.domain.listEntities()){let i=new Map;for(let r of t.withInheritedProperties()){let s=r.getSemantic(y.GeospatialCoordinates);if(s){let a=s.config??{},n=a.enableDistanceQueries!==!1,l=a.enableBoundingBoxQueries!==!1,c=a.enablePolygonQueries===!0,p=a.enableGeoClustering===!0;if(n||l||c||p){let u=(a.apiEndpointPrefix||"/nearby").trim().toLowerCase();i.has(u)||i.set(u,[]),i.get(u)?.push(r.info.getLabel())}}}for(let[r,s]of i.entries())s.length>1&&e.push({field:"semantics",rule:"geospatial_endpoint_collision",message:`The "${t.info.getLabel()}" entity has multiple geospatial properties (${s.join(", ")}) sharing the same API endpoint prefix "${r}".`,help:"Each geospatial property on the same entity must use a unique apiEndpointPrefix to avoid query endpoint collisions (e.g., /nearby, /nearby-office).",severity:"error",key:t.key,kind:t.kind,parentKind:N})}return e}validateOrganizationSemantics(){let e=[],t=Array.from(this.domain.listEntities()).filter(c=>c.hasSemantic(y.Organization));if(t.length===0)return e;t.length>1&&e.push({field:"semantics",rule:"single_organization_entity",message:"Multiple entities marked with the Organization semantic found.",help:"Only one entity can be designated as the Organization per data domain. Remove the Organization semantic from additional entities.",severity:"error",key:"organization_semantic",kind:N,parentKind:N});let i=t[0],r=Array.from(this.domain.listEntities()).find(c=>c.hasSemantic(y.User));if(!r)return e.push({field:"semantics",rule:"organization_requires_user",message:"An Organization entity is defined but no User entity exists.",help:"Multi-tenant organization structures require a User entity to establish memberships.",severity:"error",key:"organization_semantic",kind:N,parentKind:N}),e;let s=Array.from(i.withInheritedAssociations()).find(c=>c.hasSemantic(y.OrganizationMembers)),a=Array.from(r.withInheritedAssociations()).find(c=>c.hasSemantic(y.OrganizationMembers));!s&&!a&&e.push({field:"semantics",rule:"organization_members_assoc_missing",message:`Organization entity "${i.info.getLabel()}" is missing an association marked with Semantic#OrganizationMembers pointing to the User entity.`,help:"Please add an association from the Organization entity to the User entity (or vice versa) and apply the Semantic#OrganizationMembers tag.",severity:"error",key:"organization_semantic",kind:N,parentKind:N}),s&&(s.targets.length===1&&s.targets[0].key===r.key||e.push({field:"semantics",rule:"organization_members_target_mismatch",message:`The association "${s.info.getLabel()}" marked with Semantic#OrganizationMembers must have exactly one target pointing to the User entity.`,help:"Ensure the OrganizationMembers association has a single target pointing to the User entity.",severity:"error",key:s.key,kind:s.kind,parent:i.key,parentKind:N})),a&&(a.targets.length===1&&a.targets[0].key===i.key||e.push({field:"semantics",rule:"organization_members_user_target_mismatch",message:`The association "${a.info.getLabel()}" marked with Semantic#OrganizationMembers on User entity must target the Organization entity.`,help:"Change the target of the OrganizationMembers association on the User entity to point to Organization.",severity:"error",key:a.key,kind:a.kind,parent:r.key,parentKind:N}));let n=[s,a].filter(Boolean);n.length>0&&e.push(...this.validateBiDirectionalSemanticLinks(y.OrganizationMembers,"organization_members",n));let l=n.find(c=>!c.getSemantic(y.OrganizationMembers)?.link);if(l){let c=l.getParentInstance(),p=Array.from(l.listProperties()).filter(u=>u.hasSemantic(y.OrganizationRole)||u.hasSemantic(y.AssociationRole));if(p.length===0)e.push({field:"semantics",rule:"organization_role_missing",message:`Association "${l.info.getLabel()}" marked with Semantic#OrganizationMembers on entity "${c?.info.getLabel()}" is missing a property marked with Semantic#OrganizationRole.`,help:"Please add a string property to the OrganizationMembers association to track membership roles and mark it with Semantic#OrganizationRole.",severity:"error",key:l.key,kind:l.kind,parent:c?.key,parentKind:N});else if(p.length>1)e.push({field:"semantics",rule:"organization_role_multiple",message:`Association "${l.info.getLabel()}" marked with Semantic#OrganizationMembers on entity "${c?.info.getLabel()}" has multiple properties marked with Semantic#OrganizationRole. Exactly one role property is required.`,help:"Ensure only one property on the OrganizationMembers association has the Semantic#OrganizationRole tag.",severity:"error",key:l.key,kind:l.kind,parent:c?.key,parentKind:N});else{let u=p[0],h=u.schema?.enum;(!h||!Array.isArray(h)||h.length===0)&&e.push({field:"semantics",rule:"organization_role_enum_missing",message:`The organization role property "${u.info.getLabel()}" on association "${l.info.getLabel()}" should define an enum of allowed roles (e.g. ['owner', 'editor', 'viewer']).`,help:"Define an enum array inside the schema of the OrganizationRole property to set valid roles.",severity:"warning",key:u.key,kind:u.kind,parent:l.key,parentKind:ae})}}return e}validateProjectSemantics(){let e=[],t=Array.from(this.domain.listEntities()).filter(s=>s.hasSemantic(y.Project));if(t.length===0)return e;t.length>1&&e.push({field:"semantics",rule:"single_project_entity",message:"Multiple entities marked with the Project semantic found.",help:"Only one entity can be designated as the Project per data domain. Remove the Project semantic from additional entities.",severity:"error",key:"project_semantic",kind:N,parentKind:N});let i=Array.from(this.domain.listEntities()).find(s=>s.hasSemantic(y.User)),r=i?Array.from(i.withInheritedAssociations()).filter(s=>s.hasSemantic(y.ProjectMembers)):[];for(let s of r)s.targets.length===1&&t.some(n=>n.key===s.targets[0].key)||e.push({field:"semantics",rule:"project_members_user_target_mismatch",message:`The association "${s.info.getLabel()}" marked with Semantic#ProjectMembers on User entity must target the Project entity.`,help:"Change the target of the ProjectMembers association on User entity to point to Project.",severity:"error",key:s.key,kind:s.kind,parent:i?.key,parentKind:N});for(let s of t){let a=Array.from(s.withInheritedAssociations()).find(p=>p.hasSemantic(y.ProjectMembers)),n=r.find(p=>p.targets.some(u=>u.key===s.key));a&&(i&&a.targets.length===1&&a.targets[0].key===i?.key||e.push({field:"semantics",rule:"project_members_target_mismatch",message:`The association "${a.info.getLabel()}" marked with Semantic#ProjectMembers must have exactly one target pointing to the User entity.`,help:"Ensure the ProjectMembers association has a single target pointing to the User entity.",severity:"error",key:a.key,kind:a.kind,parent:s.key,parentKind:N}));let l=[a,n].filter(Boolean),c=l.find(p=>!p.getSemantic(y.ProjectMembers)?.link);if(c){let p=c.getParentInstance(),u=Array.from(c.listProperties()).filter(h=>h.hasSemantic(y.ProjectRole)||h.hasSemantic(y.AssociationRole));if(u.length===0)e.push({field:"semantics",rule:"project_role_missing",message:`Association "${c.info.getLabel()}" marked with Semantic#ProjectMembers on entity "${p?.info.getLabel()}" is missing a property marked with Semantic#ProjectRole.`,help:"Please add a string property to the ProjectMembers association to track membership roles and mark it with Semantic#ProjectRole.",severity:"error",key:c.key,kind:c.kind,parent:p?.key,parentKind:N});else if(u.length>1)e.push({field:"semantics",rule:"project_role_multiple",message:`Association "${c.info.getLabel()}" marked with Semantic#ProjectMembers on entity "${p?.info.getLabel()}" has multiple properties marked with Semantic#ProjectRole. Exactly one role property is required.`,help:"Ensure only one property on the ProjectMembers association has the Semantic#ProjectRole tag.",severity:"error",key:c.key,kind:c.kind,parent:p?.key,parentKind:N});else{let h=u[0],m=h.schema?.enum;(!m||!Array.isArray(m)||m.length===0)&&e.push({field:"semantics",rule:"project_role_enum_missing",message:`The project role property "${h.info.getLabel()}" on association "${c.info.getLabel()}" should define an enum of allowed roles (e.g. ['owner', 'editor', 'viewer']).`,help:"Define an enum array inside the schema of the project role property to set valid roles.",severity:"warning",key:h.key,kind:h.kind,parent:c.key,parentKind:ae})}}l.length>0&&e.push(...this.validateBiDirectionalSemanticLinks(y.ProjectMembers,"project_members",l))}return e}validateBiDirectionalSemanticLinks(e,t,i){let r=[],s=[],a=[];for(let n of i){let l=n.getSemantic(e);if(l)if(l.link){a.push(n),l.config&&Object.keys(l.config).length>0&&r.push({field:"semantics",rule:"semantic_link_config_forbidden",message:`The association "${n.info.getLabel()}" has a semantic link set for "${e}", but also defines "config". Configuration should only be set on the primary semantic.`,help:'Remove the "config" property from the linked semantic definition.',severity:"error",key:n.key,kind:n.kind,parent:n.getParentInstance()?.key,parentKind:N});let c=this.domain.findAssociation(l.link.key,l.link.domain);if(!c)r.push({field:"semantics",rule:"semantic_link_target_not_found",message:`The association "${n.info.getLabel()}" has a semantic link targeting "${l.link.key}", but no matching association exists in the domain.`,help:"Update the link target key to point to an existing association with the primary semantic.",severity:"error",key:n.key,kind:n.kind,parent:n.getParentInstance()?.key,parentKind:N});else{let p=c.getSemantic(e);p?p.link&&r.push({field:"semantics",rule:"semantic_link_target_is_link",message:`The association "${n.info.getLabel()}" links to "${c.info.getLabel()}", which is also a semantic link.`,help:"Point the link directly to the primary association with the source of truth configuration.",severity:"error",key:n.key,kind:n.kind,parent:n.getParentInstance()?.key,parentKind:N}):r.push({field:"semantics",rule:"semantic_link_target_invalid",message:`The association "${n.info.getLabel()}" links to "${c.info.getLabel()}", but the target association does not have the "${e}" semantic.`,help:`Ensure the target association has the "${e}" semantic applied.`,severity:"error",key:n.key,kind:n.kind,parent:n.getParentInstance()?.key,parentKind:N})}}else s.push(n)}if(i.length>1){if(s.length===0)r.push({field:"semantics",rule:"semantic_link_primary_missing",message:`All associations with the "${e}" semantic are defined as links, but no primary association exists.`,help:'Remove the "link" property from one association to designate it as the primary source of truth.',severity:"error",key:a[0].key,kind:a[0].kind,parent:a[0].getParentInstance()?.key,parentKind:N});else if(s.length>1)for(let n=1;n<s.length;n++){let l=s[n];r.push({field:"semantics",rule:`${t}_link_required`,message:`Multiple associations have the "${e}" semantic, but "${l.info.getLabel()}" is missing a "link" to the primary association.`,help:'Define a "link" property pointing to the primary association key, and remove its "config".',severity:"error",key:l.key,kind:l.kind,parent:l.getParentInstance()?.key,parentKind:N})}}return r}validateAssociationSemanticsPreconditions(){let e=[];for(let t of this.domain.listEntities())for(let i of t.listAssociations())for(let r of i.semantics)try{i.checkPreconditions(r.id)}catch(s){let a=s instanceof Error?s.message:String(s);e.push({field:"semantics",rule:"association_semantic_precondition_unmet",message:a,help:"Ensure the association meets all cardinality and entity pairing preconditions for this semantic.",severity:"error",key:i.key,kind:i.kind,parent:t.key,parentKind:N})}return e}};var hi=class{domain;report=[];#e=0;#t=0;#r=0;#i=!1;get infoCount(){return this.#i||this.computeIssueCounters(),this.#e}get warningCount(){return this.#i||this.computeIssueCounters(),this.#t}get errorCount(){return this.#i||this.computeIssueCounters(),this.#r}constructor(e){this.domain=e}validate(){this.#i=!1,this.report=[];let e=new Fr(this.domain),t=new Jr(this.domain),i=new Kr(this.domain),r=new qr(this.domain),s=!1;for(let n of this.domain.listEntities()){if(n.domain.key!==this.domain.key)continue;s=!0;let l=e.validate(n);this.report.push(...l);for(let c of n.properties){if(c.domain.key!==this.domain.key)continue;let p=t.validate(c);this.report.push(...p)}for(let c of n.associations){if(c.domain.key!==this.domain.key)continue;let p=i.validate(c);this.report.push(...p)}}if(!s)return this.report;let a=r.validate();return this.report.push(...a),this.report}computeIssueCounters(){this.#e=this.report.filter(e=>e.severity==="info").length,this.#t=this.report.filter(e=>e.severity==="warning").length,this.#r=this.report.filter(e=>e.severity==="error").length,this.#i=!0}};var ua=[],ha=[],Yn={},Li={},Ki={};function Zn(o){return typeof o=="string"?new RegExp("^"+o+"$","i"):o}function Br(o,e){return o===e?e:o===o.toLowerCase()?e.toLowerCase():o===o.toUpperCase()?e.toUpperCase():o[0]===o[0].toUpperCase()?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():e.toLowerCase()}function id(o,e){return o.replace(/\$(\d{1,2})/g,function(t,i){return e[i]||""})}function rd(o,e){return o.replace(e[0],function(t,i){let r=id(e[1],arguments);return Br(t===""?o[i-1]:t,r)})}function Qn(o,e,t){if(!o.length||Object.hasOwn(Yn,o))return e;let i=t.length;for(;i--;){let r=t[i];if(r[0].test(e))return rd(e,r)}return e}function eo(o,e,t){return function(i){let r=i.toLowerCase();return Object.prototype.hasOwnProperty.call(e,r)?Br(i,r):Object.prototype.hasOwnProperty.call(o,r)?Br(i,o[r]):Qn(r,i,t)}}function to(o,e,t){return function(i){let r=i.toLowerCase();return Object.prototype.hasOwnProperty.call(e,r)?!0:Object.prototype.hasOwnProperty.call(o,r)?!1:Qn(r,r,t)===r}}var Ae=function(o,e,t){let i=e===1?Ae.singular(o):Ae.plural(o);return(t?e+" ":"")+i};Ae.plural=eo(Ki,Li,ua);Ae.isPlural=to(Ki,Li,ua);Ae.singular=eo(Li,Ki,ha);Ae.isSingular=to(Li,Ki,ha);Ae.addPluralRule=function(o,e){ua.push([Zn(o),e])};Ae.addSingularRule=function(o,e){ha.push([Zn(o),e])};Ae.addUncountableRule=function(o){if(typeof o=="string"){Yn[o.toLowerCase()]=!0;return}Ae.addPluralRule(o,"$0"),Ae.addSingularRule(o,"$0")};Ae.addIrregularRule=function(o,e){e=e.toLowerCase(),o=o.toLowerCase(),Ki[o]=e,Li[e]=o};[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["my","our"],["its","their"],["his","their"],["her","their"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"],["canvas","canvases"]].forEach(function(o){Ae.addIrregularRule(o[0],o[1])});[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(o){Ae.addPluralRule(o[0],o[1])});[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/(dg|ss|ois|lk|ok|wn|mb|th|ch|ec|oal|is|ck|ix|sser|ts|wb)ies$/i,"$1ie"],[/\b(l|(?:neck|cross|hog|aun)?t|coll|faer|food|gen|goon|group|hipp|junk|vegg|(?:pork)?p|charl|calor|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(o){Ae.addSingularRule(o[0],o[1])});["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(Ae.addUncountableRule);var Gr=Ae;function Te(o,e){let t=o.domain||e;return t?`${t}:${o.key}`:o.key}function mi(o){if(!o)throw new g("Cannot generate parameter name from an empty string.",{code:"E_INVALID_PARAM_NAME",help:"The entity name used for path parameter generation is empty."});let e=o.replace(/([a-z])([A-Z])/g,"$1 $2");e=e.replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2");let i=e.replace(/[^a-zA-Z0-9]/g," ").split(/\s+/).filter(Boolean);if(i.length===0)throw new g(`Cannot generate a valid parameter name from "${o}".`,{code:"E_INVALID_PARAM_NAME",help:"The entity name must contain alphanumeric characters to generate a path parameter."});let s=i.map((a,n)=>{let l=a.toLowerCase();return n===0?l:l.charAt(0).toUpperCase()+l.slice(1)}).join("");return/^[0-9]/.test(s)&&(s="_"+s),`${s}Id`}function Mt(o){let e=o.trim(),t=e.startsWith("/")?e:`/${e}`;return t==="/"?"/":t.replace(/\/+$/,"")}function ma(o,e){let t=o.endsWith("/")?o.slice(0,-1):o,i=e.startsWith("/")?e:`/${e}`;return`${t}${i}`}var Fi=class o{description;key;rate;interval;burst;constructor(e={}){this.description=e.description,this.key=o.isRateLimitRuleKey(e.key)?structuredClone(e.key):void 0,this.rate=typeof e.rate=="number"?e.rate:void 0,this.interval=o.isRateLimitRuleInterval(e.interval)?e.interval:void 0,this.burst=typeof e.burst=="number"?e.burst:void 0}toJSON(){let e={};return this.description&&(e.description=this.description),o.isRateLimitRuleKey(this.key)&&(e.key=structuredClone(this.key)),typeof this.rate=="number"&&(e.rate=this.rate),o.isRateLimitRuleInterval(this.interval)&&(e.interval=this.interval),typeof this.burst=="number"&&(e.burst=this.burst),e}static isRateLimitRuleInterval(e){return typeof e!="string"?!1:["second","minute","hour","day"].includes(e)}static isRateLimitRuleKey(e){if(typeof e!="object"||e===null)return!1;let t=e;return"type"in t&&(t.type==="ip"||t.type==="userId"||t.type==="role")}};var wt=class{rules;constructor(e={}){this.rules=e.rules?.map(t=>new Fi(t))||[]}toJSON(){return{rules:this.rules.map(e=>e.toJSON())}}};var O;(function(o){o.PRE_FETCH="pre-fetch",o.FETCH="fetch",o.POST_FETCH="post-fetch"})(O||(O={}));var pe=class{type;parent;inheritable=!0;mandatory;#e;get metadata(){if(!this.#e)throw new Error("Metadata not set for access rule "+this.type);return this.#e}constructor(e,t,i={}){this.parent=e,this.type=i.type??"",this.mandatory=i.mandatory??!1,this.#e={...t,...i.metadata}}toJSON(){let e={type:this.type};return this.mandatory&&(e.mandatory=!0),this.#e&&(e.metadata=this.#e),e}};var Hr=class extends pe{type;constructor(e,t={}){super(e,{list:O.PRE_FETCH,create:O.PRE_FETCH,search:O.PRE_FETCH,read:O.PRE_FETCH,update:O.PRE_FETCH,delete:O.PRE_FETCH},t),this.type="allowAuthenticated"}};var Wr=class extends pe{type;constructor(e,t={}){super(e,{list:O.PRE_FETCH,create:O.PRE_FETCH,search:O.PRE_FETCH,read:O.PRE_FETCH,update:O.PRE_FETCH,delete:O.PRE_FETCH},t),this.type="allowPublic"}};var Xr=class extends pe{type;domains;constructor(e,t={}){super(e,{list:O.PRE_FETCH,create:O.PRE_FETCH,search:O.PRE_FETCH,read:O.PRE_FETCH,update:O.PRE_FETCH,delete:O.PRE_FETCH},t),this.type="matchEmailDomain",this.domains=t.domains?[...t.domains]:[]}toJSON(){return{...super.toJSON(),domains:structuredClone(this.domains)}}};var Yr=class extends pe{type;inheritable=!1;property;target;constructor(e,t={}){super(e,{list:O.FETCH,search:O.FETCH,create:O.POST_FETCH,read:O.POST_FETCH,update:O.POST_FETCH,delete:O.POST_FETCH},t),this.type="matchResourceOwner",this.property=t.property,this.target=t.target??"property"}toJSON(){let e={...super.toJSON(),target:this.target};return this.property&&(e.property=this.property),e}};var Zr=class extends pe{type;inheritable=!1;attribute;value;operator;constructor(e,t={}){super(e,{list:O.FETCH,search:O.FETCH,read:O.POST_FETCH,update:O.POST_FETCH,delete:O.POST_FETCH},t),this.type="matchResourceAttribute",this.attribute=t.attribute??"",this.value=t.value??"",this.operator=t.operator??"equal"}toJSON(){let e={...super.toJSON(),attribute:this.attribute,value:this.value};return this.operator&&(e.operator=this.operator),e}};var Qr=class extends pe{type;inheritable=!1;allowedStatuses;deniedStatuses;constructor(e,t={}){super(e,{list:O.FETCH,search:O.FETCH,read:O.POST_FETCH,update:O.POST_FETCH,delete:O.POST_FETCH},t),this.type="lifecycleStatus",this.allowedStatuses=t.allowedStatuses?[...t.allowedStatuses]:[],this.deniedStatuses=t.deniedStatuses?[...t.deniedStatuses]:[]}toJSON(){let e={...super.toJSON()};return this.allowedStatuses.length>0&&(e.allowedStatuses=structuredClone(this.allowedStatuses)),this.deniedStatuses.length>0&&(e.deniedStatuses=structuredClone(this.deniedStatuses)),e}};var es=class extends pe{type;property;value;constructor(e,t={}){super(e,{list:O.PRE_FETCH,create:O.PRE_FETCH,search:O.PRE_FETCH,read:O.PRE_FETCH,update:O.PRE_FETCH,delete:O.PRE_FETCH},t),this.type="matchUserProperty",this.property=t.property??"",this.value=t.value??""}toJSON(){return{...super.toJSON(),property:this.property,value:this.value}}};var ts=class extends pe{type;role;constructor(e,t={}){super(e,{list:O.PRE_FETCH,create:O.PRE_FETCH,search:O.PRE_FETCH,read:O.PRE_FETCH,update:O.PRE_FETCH,delete:O.PRE_FETCH},t),this.type="matchUserRole",this.role=t.role?[...t.role]:[]}toJSON(){return{...super.toJSON(),role:structuredClone(this.role)}}};var is=class extends pe{type;allowedOrgRoles;constructor(e,t={}){super(e,{list:O.FETCH,search:O.FETCH,create:O.PRE_FETCH,read:O.POST_FETCH,update:O.POST_FETCH,delete:O.POST_FETCH},t),this.type="matchOrganization",this.allowedOrgRoles=t.allowedOrgRoles?[...t.allowedOrgRoles]:[]}toJSON(){return{...super.toJSON(),allowedOrgRoles:[...this.allowedOrgRoles]}}};var rs=class extends pe{type;associationKey;allowedRoles;constructor(e,t={}){super(e,{list:O.FETCH,search:O.FETCH,create:O.PRE_FETCH,read:O.POST_FETCH,update:O.POST_FETCH,delete:O.POST_FETCH},t),this.type="matchAssociation",this.associationKey=t.associationKey,this.allowedRoles=t.allowedRoles?[...t.allowedRoles]:[]}toJSON(){let e=super.toJSON();return e.type="matchAssociation",this.associationKey&&(e.associationKey=this.associationKey),this.allowedRoles&&this.allowedRoles.length>0&&(e.allowedRoles=[...this.allowedRoles]),e}};function fi(o,e){switch(e.type){case"allowAuthenticated":return new Hr(o,e);case"allowPublic":return new Wr(o,e);case"matchEmailDomain":return new Xr(o,e);case"matchResourceOwner":return new Yr(o,e);case"matchResourceAttribute":return new Zr(o,e);case"lifecycleStatus":return new Qr(o,e);case"matchUserProperty":return new es(o,e);case"matchUserRole":return new ts(o,e);case"matchOrganization":return new is(o,e);case"matchAssociation":return new rs(o,e);default:throw new g("Unknown access rule kind",{code:"E_UNKNOWN_ACCESS_RULE_KIND",status:422})}}var Ne=class{kind;accessRules;rateLimiting;projection;parent;constructor(e,t={}){this.parent=e,this.kind=t.kind||"",this.accessRules=t.accessRules?t.accessRules.map(i=>fi(this,i)):[],this.rateLimiting=t.rateLimiting?new wt(t.rateLimiting):void 0,t.projection&&(this.projection=structuredClone(t.projection))}toJSON(){let e={kind:this.kind};return this.accessRules.length&&(e.accessRules=this.accessRules.map(t=>t.toJSON())),this.rateLimiting&&(e.rateLimiting=this.rateLimiting.toJSON()),this.projection&&(e.projection=structuredClone(this.projection)),e}getAllRules(){return[...this.parent.getAllRules(),...this.accessRules]}getAllRateLimiters(){let e=this.parent.getAllRateLimiters();return this.rateLimiting&&e.push(this.rateLimiting),e}};var Ji=class extends Ne{kind;constructor(e,t={}){super(e,t),this.kind="create"}toJSON(){return{...super.toJSON(),kind:"create"}}static isCreateAction(e){return e.kind==="create"}static isCreateActionSchema(e){return e.kind==="create"}};var Ht=class extends Ne{kind;strategy;retentionPeriod;constructor(e,t={}){super(e,t),this.kind="delete",this.strategy=t.strategy||"soft",this.retentionPeriod=t.retentionPeriod??30}toJSON(){return{...super.toJSON(),kind:"delete",strategy:this.strategy,retentionPeriod:this.retentionPeriod}}static isDeleteAction(e){return e.kind==="delete"}static isDeleteActionSchema(e){return e.kind==="delete"}};var vt=class extends Ne{kind;cacheTtl;constructor(e,t={}){super(e,t),this.kind="list",this.cacheTtl=t.cacheTtl}toJSON(){let e={...super.toJSON(),kind:"list"};return this.cacheTtl!==void 0&&(e.cacheTtl=this.cacheTtl),e}static isListAction(e){return e.kind==="list"}static isListActionSchema(e){return e.kind==="list"}};var Wt=class extends Ne{kind;constructor(e,t={}){super(e,t),this.kind="read"}toJSON(){return{...super.toJSON(),kind:"read"}}static isReadAction(e){return e.kind==="read"}static isReadActionSchema(e){return e.kind==="read"}};var _t=class extends Ne{kind;maxAstDepth;constructor(e,t={}){super(e,t),this.kind="search",this.maxAstDepth=t.maxAstDepth}toJSON(){let e={...super.toJSON(),kind:"search"};return this.maxAstDepth!==void 0&&(e.maxAstDepth=this.maxAstDepth),e}static isSearchActionSchema(e){return e.kind==="search"}static isSearchAction(e){return e.kind==="search"}};var Xt=class extends Ne{kind;allowedMethods;constructor(e,t={}){super(e,t),this.kind="update",this.allowedMethods=t.allowedMethods?[...t.allowedMethods]:["PATCH"]}toJSON(){return{...super.toJSON(),kind:"update",allowedMethods:structuredClone(this.allowedMethods)}}static isUpdateAction(e){return e.kind==="update"}static isUpdateActionSchema(e){return e.kind==="update"}};function fa(o,e){switch(e.kind){case"list":return new vt(o,e);case"read":return new Wt(o,e);case"create":return new Ji(o,e);case"update":return new Xt(o,e);case"delete":return new Ht(o,e);case"search":return new _t(o,e);default:throw new g("Unknown action kind",{code:"E_UNKNOWN_ACTION_KIND",status:422})}}function io(o,e){switch(e){case"list":return new vt(o);case"read":return new Wt(o);case"create":return new Ji(o);case"update":return new Xt(o);case"delete":return new Ht(o);case"search":return new _t(o);default:throw new g("Unknown action kind",{code:"E_UNKNOWN_ACTION_KIND",status:422})}}var Yt=class o{kind;key;entity;hasCollection;collectionPath;resourcePath;isRoot;parent;exposeOptions;actions;accessRules;rateLimiting;paginationContract;truncated;api;static createSchema(e={}){let{key:t=q(),entity:i={key:""},collectionPath:r,resourcePath:s="/",hasCollection:a=!0,isRoot:n,parent:l,exposeOptions:c,actions:p=[],accessRules:u,rateLimiting:h,truncated:m,paginationContract:f}=e,b={kind:xt,key:t,entity:{...i},hasCollection:a,resourcePath:s,actions:p.map(k=>({...k}))};return r!==void 0&&(b.collectionPath=r),n!==void 0&&(b.isRoot=n),l!==void 0&&(b.parent={...l}),c!==void 0&&(b.exposeOptions={...c}),Array.isArray(u)&&(b.accessRules=u.map(k=>({...k}))),h!==void 0&&(b.rateLimiting={...h}),m!==void 0&&(b.truncated=m),f!==void 0&&(b.paginationContract=structuredClone(f)),b}constructor(e,t){this.api=e;let i=o.createSchema(t);this.kind=i.kind,this.key=i.key,this.entity=i.entity,this.hasCollection=i.hasCollection,this.collectionPath=i.collectionPath,this.resourcePath=i.resourcePath,this.isRoot=i.isRoot,this.parent=i.parent,this.exposeOptions=i.exposeOptions,this.actions=i.actions?i.actions.map(r=>fa(this,r)):[],this.accessRules=i.accessRules?i.accessRules.map(r=>fi(this,r)):[],i.rateLimiting&&(this.rateLimiting=new wt(i.rateLimiting)),this.truncated=i.truncated,i.paginationContract&&(this.paginationContract=structuredClone(i.paginationContract))}toJSON(){let e={kind:this.kind,key:this.key,entity:{...this.entity},resourcePath:this.resourcePath,actions:this.actions.map(t=>t.toJSON()),hasCollection:this.hasCollection};return this.collectionPath!==void 0&&(e.collectionPath=this.collectionPath),this.isRoot!==void 0&&(e.isRoot=this.isRoot),this.parent!==void 0&&(e.parent={...this.parent}),this.exposeOptions!==void 0&&(e.exposeOptions={...this.exposeOptions}),Array.isArray(this.accessRules)&&this.accessRules.length>0&&(e.accessRules=this.accessRules.map(t=>t.toJSON())),this.rateLimiting!==void 0&&(e.rateLimiting=this.rateLimiting.toJSON()),this.truncated!==void 0&&(e.truncated=this.truncated),this.paginationContract&&(e.paginationContract=structuredClone(this.paginationContract)),e}setCollectionPath(e){if(!this.hasCollection)throw new g("Cannot set collection path on an exposure that does not have a collection",{code:"E_PATH_MISSING",help:"The exposed entity you are trying to set a collection path for does not have a collection."});let i=Mt(e).split("/").filter(Boolean);if(i.length!==1)throw new g(`Collection path must contain exactly one segment. Received: "${e}"`,{code:"E_PATH_SEGMENT_SIZE",help:"The set path must have a single path segment (e.g., `/products`)"});let r=`/${i[0]}`;if(this.isRoot&&this.api.findCollectionPathCollision(r,this.key))throw new g(`Collection path "${r}" is already in use by another root entity.`,{code:"E_PATH_INUSE",help:"The set path is already in use by another root entity."});let s="";if(this.resourcePath&&this.resourcePath!=="/"){let l=this.resourcePath.split("/").filter(Boolean)[1];l&&/^\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(l)&&(s=l)}if(!s){let n=this.api.domain?.findEntity(this.entity.key,this.entity.domain);if(!n||!n.info.name)throw new g("Cannot generate a semantic parameter name because the associated entity or its name is missing.",{code:"E_ENTITY_NOT_FOUND",help:"Ensure the exposed entity points to a valid domain entity with a defined name."});s=`{${mi(n.info.name)}}`}let a=`${r}/${s}`;this.#r(a),this.collectionPath=r,this.resourcePath=a}setResourcePath(e){let t=Mt(e),i=t.split("/").filter(Boolean);if(this.hasCollection){if(!this.collectionPath)throw new g("Cannot set resource path: missing collection path for this exposure",{code:"E_PATH_MISSING",help:"Set the collection path on the exposed entity first."});let r=this.collectionPath.split("/").filter(Boolean);if(r.length!==1)throw new g(`Invalid stored collection path "${this.collectionPath}"`,{code:"E_PATH_SEGMENT_SIZE",help:"The set collection path must have a single path segment (e.g., `/products`)"});if(i.length!==2)throw new g(`Resource path must be exactly two segments (collection + parameter). Received: "${t}"`,{code:"E_PATH_SEGMENT_SIZE",help:"The set resource path must have exactly two segments (collection + parameter)."});let[s,a]=i;if(s!==r[0])throw new g(`Resource path must start with the collection segment "${r[0]}". Received: "${s}"`,{code:"E_PATH_MISMATCH",help:"Set the resource path to the same value as the collection path + the parameter value."});if(!/^\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(a))throw new g(`The second segment must be a parameter in braces, e.g. {id}. Received: "${a}"`,{code:"E_PARAMETER_INVALID",help:"Use the braces to surround the parameter name, e.g., {productId}."});this.resourcePath!==t&&(this.#r(`/${s}/${a}`),this.resourcePath=`/${s}/${a}`);return}if(i.length!==1)throw new g(`Resource path must contain exactly one segment when no collection is present. Received: "${t}"`,{code:"E_PATH_SEGMENT_SIZE",help:"The set resource path must have exactly one segment."});if(this.isRoot&&this.api.findResourcePathCollision(t,this.key))throw new g(`Resource path "${t}" is already in use by another root entity.`,{code:"E_PATH_INUSE",help:"The set path is already in use by another root entity."});this.resourcePath!==t&&(this.#r(`/${i[0]}`),this.resourcePath=`/${i[0]}`)}#e(e){let i=[...e.join("/").matchAll(/\{([^}]+)\}/g)].map(s=>s[1]),r=new Set;for(let s of i){if(r.has(s))throw new g(`Duplicate path parameter "{${s}}" detected in branch hierarchy.`,{code:"E_PATH_PARAM_COLLISION",help:"Change the parameter name in either this resource or its ancestor to ensure unique parameter names."});r.add(s)}}#t(e,t){for(let i of this.api.exposes.values())if(i.parent?.key===e){let r=[...t,i.resourcePath];this.#e(r),this.#t(i.key,r)}}#r(e){let t=[e],i=this.parent?.key;for(;i;){let r=this.api.exposes.get(i);if(!r)break;t.unshift(r.resourcePath),i=r.parent?.key}this.#e(t),this.#t(this.key,t)}getAbsoluteResourcePath(){let e=Mt(this.resourcePath),t=this.parent?.key;for(;t;){let i=this.api.exposes.get(t);if(!i)break;let r=Mt(i.resourcePath);e=ma(r,e),t=i.parent?.key}return e}getAbsoluteCollectionPath(){if(!this.hasCollection||!this.collectionPath)return;let e=Mt(this.collectionPath),t=this.parent?.key;for(;t;){let i=this.api.exposes.get(t);if(!i)break;let r=Mt(i.resourcePath);e=ma(r,e),t=i.parent?.key}return e}getAllRules(){let e=[];this.api.accessRules.forEach(i=>{i.inheritable&&e.push(i)});let t=this;for(;t;)t.accessRules&&(t===this?e.push(...t.accessRules):e.push(...t.accessRules.filter(i=>i.inheritable))),t=t.parent?this.api.exposes.get(t.parent.key):void 0;return e}getAllRateLimiters(){let e=[];this.api.rateLimiting&&e.push(this.api.rateLimiting);let t=this;for(;t;)t.rateLimiting&&e.push(t.rateLimiting),t=t.parent?this.api.exposes.get(t.parent.key):void 0;return e}getAllRateLimiterRules(){let e=[];this.api.rateLimiting&&e.push(...this.api.rateLimiting.rules);let t=this;for(;t;)t.rateLimiting&&e.push(...t.rateLimiting.rules),t=t.parent?this.api.exposes.get(t.parent.key):void 0;return e}addAction(e){if(this.actions.some(i=>i.kind===e.kind))throw new g(`Action of kind "${e.kind}" already exists for this exposure`,{code:"E_ACTION_USED",help:"There's no need to add an API action again."});let t=fa(this,e);return this.actions.push(t),t}addActionFromKind(e){if(this.actions.some(i=>i.kind===e))throw new g(`Action of kind "${e}" already exists for this exposure`,{code:"E_ACTION_USED",help:"There's no need to add an API action again."});let t=io(this,e);return this.actions.push(t),t}createPaginationContract(){let e=this.api.domain?.findEntity(this.entity.key,this.entity.domain);if(!e)throw new g(`Entity "${this.entity.key}" not found"`,{code:"E_ENTITY_NOT_FOUND",help:"The set entity does not exist."});this.paginationContract?(this.paginationContract.filterableFields=[],this.paginationContract.searchableFields=[],this.paginationContract.sortableFields=[]):this.paginationContract={filterableFields:[],searchableFields:[],sortableFields:[]};for(let t of e.properties)t.index&&(this.paginationContract.filterableFields.push(t.key),this.paginationContract.sortableFields.push(t.key)),t.search&&this.paginationContract.searchableFields.push(t.key)}getSubResources(e=!1){let t=[],i=r=>{for(let s of this.api.exposes.values())s.parent?.key===r&&(t.push(s),e&&i(s.key))};return i(this.key),t}findSubResource(e,t=!1){let i=this.getSubResources(t),r=Mt(e);return i.find(s=>{if(s.key===e||s.entity.key===e)return!0;let a=this.api.domain?.findEntity(s.entity.key,s.entity.domain);if(a&&a.info.name===e)return!0;if(s.hasCollection&&s.collectionPath){if(s.collectionPath===e||s.collectionPath===r)return!0;let l=s.getAbsoluteCollectionPath();if(l&&(l===e||l===r))return!0}if(s.resourcePath===e||s.resourcePath===r)return!0;let n=s.getAbsoluteResourcePath();return!!(n&&(n===e||n===r))})}};var qi=(o={})=>{let e={...ss,...o};return o.metadata&&(e.metadata={...o.metadata}),{id:y.Currency,config:e}},ss={storageFormat:"decimal",defaultCurrency:"USD",decimalPlaces:2,allowNegative:!1,validateCurrencyCode:!0},rS={USD_DECIMAL:qi({storageFormat:"decimal",defaultCurrency:"USD",decimalPlaces:2,allowNegative:!1}),USD_CENTS:qi({storageFormat:"integer_cents",defaultCurrency:"USD",decimalPlaces:2,allowNegative:!1}),MULTI_CURRENCY:qi({storageFormat:"complex_object",allowedCurrencies:["USD","EUR","GBP","JPY","CAD"],decimalPlaces:2,allowNegative:!1}),WITH_NEGATIVES:qi({storageFormat:"decimal",defaultCurrency:"USD",decimalPlaces:2,allowNegative:!0}),HIGH_PRECISION:qi({storageFormat:"decimal",defaultCurrency:"BTC",decimalPlaces:8,allowNegative:!1})};var ro={requireVerification:!0,allowSubaddressing:!0,allowInternational:!0};var so={requireCountryCode:!0,format:"international",allowExtension:!1,requireVerification:!1,verificationMethod:"sms"};function sd(o){let e=o.type,i=o.readWebBinding()?.format,r=o.multiple,s;if(e==="string"){let a=o.schema?.maximum;if(o.schema?.defaultValue?.type==="function"&&o.schema.defaultValue.value==="random"){let n=o.schema.defaultValue.config;if(n){let l=0,c=!1;n.isFixed?n.length&&(l=n.length,c=!0):a&&(l=a,c=!0),c&&(n.prefix&&(l+=n.prefix.length),n.suffix&&(l+=n.suffix.length),(!a||l>a)&&(a=l))}}s=a?`VARCHAR(${a})`:"TEXT"}else if(e==="number"){let a=o.schema?.defaultValue?.type==="function"&&o.schema.defaultValue.value==="incremental";i==="int32"?s="INTEGER":i==="int64"?s="BIGINT":i==="float"||i==="double"?s="DOUBLE PRECISION":a?s="BIGINT":s="NUMERIC"}else e==="boolean"?s="BOOLEAN":e==="date"?s="DATE":e==="datetime"?s="TIMESTAMPTZ":e==="time"?s="TIME":e==="binary"||e==="json"?s="JSONB":s="TEXT";return r?`${s}[]`:s}function ao(o){let e=o.getExposedName();if(!e)throw new g("Property missing a name definition.",{code:"E_PROPERTY_NAME_MISSING",status:500});let t=null;if(o.schema?.defaultValue){let u=o.schema.defaultValue.type,h=String(o.schema.defaultValue.value);if(u==="function"){let m=o.type;if(m==="string"){if(h==="uuid-v4"&&o.primary)throw new g("Function 'uuid-v4' cannot be used as a default for a primary key string.",{code:"E_INVALID_DEFAULT_FUNCTION",status:400});if(h!=="random"&&h!=="uuid-v4")throw new g(`Function '${h}' is not supported for string properties.`,{code:"E_INVALID_DEFAULT_FUNCTION",status:400})}else if(m==="number"){if(h!=="incremental")throw new g(`Function '${h}' is not supported for number properties.`,{code:"E_INVALID_DEFAULT_FUNCTION",status:400})}else if(["date","time","datetime"].includes(m)){if(h!=="now")throw new g(`Function '${h}' is not supported for ${m} properties.`,{code:"E_INVALID_DEFAULT_FUNCTION",status:400})}else throw new g(`Functions are not supported as default values for ${m} properties.`,{code:"E_INVALID_DEFAULT_FUNCTION",status:400})}t={type:u,value:h}}let i=!!o.primary,r=!o.required&&!i,s=!!o.unique;!t&&o.hasSemantic(y.DeletedFlag)&&(t={type:"literal",value:"false"});let a=o.getSemantic(y.Currency);if(a){let u=a.config??{},h=u.storageFormat||ss.storageFormat;if(h==="complex_object")return[{name:e,dataType:"JSONB",isNullable:r,isPrimary:i,isUnique:s,defaultRule:null}];if(h==="decimal"||h==="integer_cents"){let m=u.decimalPlaces??ss.decimalPlaces,f=h==="decimal"?`NUMERIC(19, ${m})`:"BIGINT";return[{name:`${e}_amount`,dataType:f,isNullable:r,isPrimary:i,isUnique:s,defaultRule:t},{name:`${e}_currency`,dataType:"CHAR(3)",isNullable:r,isPrimary:!1,isUnique:!1,defaultRule:{type:"literal",value:u.defaultCurrency||"USD"}}]}}let n=[{name:e,dataType:sd(o),isNullable:r,isPrimary:i,isUnique:s,defaultRule:t}],l=!1,c=o.getSemantic(y.Email);c&&(l=(c.config??ro).requireVerification!==!1);let p=o.getSemantic(y.Phone);return p&&(l=(p.config??so).requireVerification===!0),l&&n.push({name:`_${e}_verified`,dataType:"BOOLEAN",isNullable:!1,isPrimary:!1,isUnique:!1,defaultRule:{type:"literal",value:"false"}},{name:`_${e}_token`,dataType:"VARCHAR(255)",isNullable:!0,isPrimary:!1,isUnique:!1,defaultRule:null},{name:`_${e}_expires_at`,dataType:"TIMESTAMPTZ",isNullable:!0,isPrimary:!1,isUnique:!1,defaultRule:null}),n}function ad(o){let e=o.toUpperCase().split("(")[0];return e==="CHARACTER VARYING"&&(e="VARCHAR"),e==="CHARACTER"&&(e="CHAR"),e}function nd(o,e){let t=e.toUpperCase(),i=ad(o.dataType),r=t.split("(")[0];if(i===r){if(i==="VARCHAR"){let a=o.dataType.match(/\((\d+)\)/),n=a?Number.parseInt(a[1],10):null,l=t.match(/\((\d+)\)/),c=l?Number.parseInt(l[1],10):null;return!!(!c||n&&c>=n)}return!0}return{INTEGER:["BIGINT","NUMERIC","VARCHAR","TEXT"],BIGINT:["NUMERIC","VARCHAR","TEXT"],DATE:["TIMESTAMPTZ"],BOOLEAN:["VARCHAR","TEXT"]}[i]?.includes(r)||!1}function od(o,e,t,i,r){if(!e.actions)return;let s=e.entity.key,a=t.get(s),n=i.findEntity(s);if(!a)return;let l=Array.from(a.withInheritedProperties()),c=new Set(l.map(h=>h.key)),p=Array.from(a.withInheritedAssociations()),u=new Set(p.map(h=>h.key));for(let h of e.actions)if(!(!h.projection||!Array.isArray(h.projection.fields)))for(let m of h.projection.fields)if(m.type==="association"){let f=m.key.split("."),b=f[0];if(u.has(b)){let k=p.find(S=>S.key===b);f.length>1&&(!k||k.schema?.embedded!==!0)&&r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:h.kind,fieldType:"association",fieldKey:m.key,reason:`Projected association '${m.key}' is invalid because association '${b}' is not embedded.`})}else{let k=!1,S=`Projected association '${m.key}' no longer exists on entity '${a.info.getLabel()}'.`;if(n){let I=Array.from(n.withInheritedAssociations()).find(D=>D.key===b);if(I){let D;try{D=I.getExposedName()}catch{}if(D){let w=p.find(v=>{try{return v.getExposedName()===D}catch{return!1}});w&&(f.length>1&&w.schema?.embedded!==!0?S=`Projected association '${m.key}' is invalid because remapped association '${w.key}' is not embedded.`:k=!0)}}}k||r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:h.kind,fieldType:"association",fieldKey:m.key,reason:S})}}else{let f=m.key.split("."),b=f[0];if(c.has(b)){let k=l.find(S=>S.key===b);f.length>1&&(!k||k.type!=="json"?r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:h.kind,fieldType:"property",fieldKey:m.key,reason:`Projected property '${m.key}' is invalid because root property '${b}' is not of type 'json'.`}):k.jsonSchema&&(lt(k.jsonSchema,f.slice(1))||r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:h.kind,fieldType:"property",fieldKey:m.key,reason:`Projected property '${m.key}' is invalid according to the JSON Schema of '${b}'.`})))}else{let k=!1;if(n){let S=Array.from(n.withInheritedProperties()).find(I=>I.key===b);if(S){let I;try{I=S.getExposedName()}catch{}if(I){let D=l.find(w=>{try{return w.getExposedName()===I}catch{return!1}});D&&(f.length===1||D.type==="json")&&(k=!0,f.length>1&&D.jsonSchema&&(lt(D.jsonSchema,f.slice(1))||(k=!1)))}}}k||r.actionProjectionsWithMismatches.push({exposureKey:o,actionKind:h.kind,fieldType:"property",fieldKey:m.key,reason:`Projected property '${m.key}' no longer exists on entity '${a.info.getLabel()}'.`})}}}function ld(o,e,t,i,r){if(!e.paginationContract)return;let s=e.paginationContract,a=e.entity.key,n=t.get(a);if(!n)return;let l=Array.from(n.withInheritedProperties()),c=new Set(l.map(h=>h.key)),p=i.findEntity(a),u=(h,m)=>{if(!(!h||!Array.isArray(h)))for(let f of h){let b=f.split("."),k=b[0];if(c.has(k)){let S=l.find(I=>I.key===k);b.length>1&&(!S||S.type!=="json"?r.paginationFieldsWithMismatches.push({exposureKey:o,fieldGroup:m,fieldKey:f,reason:`The ${m} field '${f}' is invalid because root property '${k}' is not of type 'json'.`}):S.jsonSchema&&(lt(S.jsonSchema,b.slice(1))||r.paginationFieldsWithMismatches.push({exposureKey:o,fieldGroup:m,fieldKey:f,reason:`The ${m} field '${f}' is invalid according to the JSON Schema of '${k}'.`})))}else{let S=!1;if(p){let I=Array.from(p.withInheritedProperties()).find(D=>D.key===k);if(I){let D;try{D=I.getExposedName()}catch{}if(D){let w=l.find(v=>{try{return v.getExposedName()===D}catch{return!1}});w&&(b.length===1||w.type==="json")&&(S=!0,b.length>1&&w.jsonSchema&&(lt(w.jsonSchema,b.slice(1))||(S=!1)))}}}S||r.paginationFieldsWithMismatches.push({exposureKey:o,fieldGroup:m,fieldKey:f,reason:`The ${m} field '${f}' no longer exists on entity '${n.info.getLabel()}'.`})}}};u(s.filterableFields,"filterable"),u(s.sortableFields,"sortable"),u(s.searchableFields,"searchable")}function no(o,e){let t=o.domain,i={hasUpdate:!1,canProceed:!0,breakingChanges:[],exposedEntitiesToRemove:[],subEndpointsToRemove:[],userModelRemapping:[],sessionPropertiesToRemove:[],accessRulesWithMismatches:[],paginationFieldsWithMismatches:[],actionProjectionsWithMismatches:[]};if(!t)return i.hasUpdate=!0,i;if(t.key===e.key&&t.info.version===e.info.version)return i;i.hasUpdate=!0;let r=new Map;for(let w of t.listEntities())r.set(w.key,w);let s=new Map;for(let w of e.listEntities())s.set(w.key,w);let a=new Set;for(let[w,v]of o.exposes.entries()){let E=r.has(v.entity.key),R=s.get(v.entity.key);if(!R){let j=r.get(v.entity.key)?.info.getLabel()||v.entity.key;i.exposedEntitiesToRemove.push({key:w,entityKey:v.entity.key,name:v.entity.key,reason:`Entity ${j} no longer exists in the domain.`}),a.add(w);continue}if(E){let j=r.get(v.entity.key),z=new Map;for(let ee of j.withInheritedProperties())try{let G=ee.getExposedName();G&&z.set(G,ee)}catch{}let J=new Map;for(let ee of R.withInheritedProperties())try{let G=ee.getExposedName();G&&J.set(G,ee)}catch{}for(let[ee,G]of z.entries()){let ge=J.get(ee);if(!ge)continue;let le=ao(G),ce=ao(ge);for(let we of le){let Se=ce.find(dt=>dt.name===we.name);if(!Se)continue;if(we.isPrimary&&!Se.isPrimary){i.canProceed=!1;let dt=j.info.getLabel(),pt=`Cannot remove Primary Key constraint from column '${we.name}' in entity '${dt}'.`;i.breakingChanges.push({type:"primary_key_removed",entityKey:j.key,propertyKey:G.key,reason:pt})}if(!nd(we,Se.dataType)){i.canProceed=!1;let dt=j.info.getLabel(),pt=`Cannot safely cast column '${we.name}' in entity '${dt}' from ${we.dataType} to ${Se.dataType}.`;i.breakingChanges.push({type:"type_change_unsafe",entityKey:j.key,propertyKey:G.key,reason:pt})}let Ye=we.isNullable&&!Se.isNullable,cs=!!Se.defaultRule;if(Ye&&!cs){i.canProceed=!1;let dt=j.info.getLabel(),pt=`Cannot make column '${we.name}' in entity '${dt}' required without providing a default value to backfill existing records.`;i.breakingChanges.push({type:"column_not_null_missing_default",entityKey:j.key,propertyKey:G.key,reason:pt})}}}}}let n=!0;for(;n;){n=!1;for(let[w,v]of o.exposes.entries())if(!a.has(w)&&v.parent){let E=o.exposes.get(v.parent.key),R=r.get(E.entity.key),j=R?.info.getLabel()||E.entity.key;if(a.has(v.parent.key)){i.subEndpointsToRemove.push({key:w,parentKey:v.parent.key,associationKey:v.parent.association.key,name:v.entity.key,reason:`Parent exposure for entity ${j} is scheduled for removal.`}),a.add(w),n=!0;continue}let z=s.get(E.entity.key);if(!z){i.subEndpointsToRemove.push({key:w,parentKey:v.parent.key,associationKey:v.parent.association.key,name:v.entity.key,reason:`Parent entity ${j} is scheduled for removal.`}),a.add(w),n=!0;continue}let J=Array.from(z.withInheritedAssociations()).find(le=>le.key===v.parent?.association.key),ee=R?Array.from(R.withInheritedAssociations()).find(le=>le.key===v.parent?.association.key):void 0,G=J?.info.getLabel()||ee?.info.getLabel()||v.parent?.association.key;if(!J){i.subEndpointsToRemove.push({key:w,parentKey:v.parent.key,associationKey:v.parent.association.key,name:v.entity.key,reason:`Parent association ${G} is missing in the new domain.`}),a.add(w),n=!0;continue}if(!J.targets.some(le=>le.key===v.entity.key&&(!le.domain||le.domain===e.key))){let ce=(r.get(v.entity.key)||s.get(v.entity.key))?.info.getLabel()||v.entity.key;i.subEndpointsToRemove.push({key:w,parentKey:v.parent.key,associationKey:v.parent.association.key,name:v.entity.key,reason:`Target entity ${ce} is no longer a valid target for the parent association ${G}.`}),a.add(w),n=!0;continue}}}let l,c;if(o.user&&(l=r.get(o.user.key),c=s.get(o.user.key),!c)){i.canProceed=!1;let v=`User entity '${l?.info.getLabel()||o.user.key}' no longer exists in the new domain version.`;i.breakingChanges.push({type:"user_entity_missing",entityKey:o.user.key,propertyKey:"",reason:v})}if(o.user&&c&&l){let w=Array.from(l.withInheritedProperties()),v=Array.from(c.withInheritedProperties());if(o.session?.properties)for(let E of o.session.properties){let R=w.find(J=>J.key===E.key);if(!R){i.sessionPropertiesToRemove.push(E.key);continue}let j;try{j=R.getExposedName()}catch{}if(!j){i.sessionPropertiesToRemove.push(E.key);continue}let z=v.find(J=>{try{return J.getExposedName()===j}catch{return!1}});z?z.key!==R.key&&i.userModelRemapping.push({oldPropertyKey:R.key,newPropertyKey:z.key,exposedName:j,reason:`Property ${R.info.getLabel(R.key)} has been renamed to ${z.info.getLabel(z.key)}.`}):i.sessionPropertiesToRemove.push(E.key)}}let p,u;c&&(p=Array.from(c.withInheritedProperties()).find(v=>v.hasSemantic(y.UserRole)));let h=Array.from(s.values()).find(w=>w.hasSemantic(y.Organization));h&&(u=Array.from(h.withInheritedProperties()).find(w=>w.hasSemantic(y.OrganizationRole)));let m=p?.schema?.enum,f=u?.schema?.enum,b=(w,v)=>{if(w.type==="matchOrganization"){let E=w;if(!u)i.accessRulesWithMismatches.push({ruleType:"matchOrganization",location:v,reason:"No organization role property configured on the new user model."});else if(f&&Array.isArray(f)&&E.allowedOrgRoles)for(let R of E.allowedOrgRoles)f.includes(R)||i.accessRulesWithMismatches.push({ruleType:"matchOrganization",location:v,reason:`Organization role '${R}' is no longer a valid role in the new user model.`})}},k=(w,v)=>{if(w.type==="matchUserRole"){let E=w;if(!p)i.accessRulesWithMismatches.push({ruleType:"matchUserRole",location:v,reason:"No role field configured on the new user model."});else if(m&&Array.isArray(m))for(let R of E.role)m.includes(R)||i.accessRulesWithMismatches.push({ruleType:"matchUserRole",location:v,reason:`Role '${R}' is no longer a valid role in the new user model.`})}},S=(w,v,E)=>{if(w.type==="matchResourceAttribute"){let R=w;if(!E)return;let j=s.get(E);if(!j)return;let z=Array.from(j.withInheritedProperties());if(!z.some(ee=>ee.key===R.attribute)){let ee=r.get(E),G=R.attribute,ge=!1;if(ee){let le=Array.from(ee.withInheritedProperties()).find(ce=>ce.key===R.attribute);if(le){G=le.info.getLabel(le.key);let ce;try{ce=le.getExposedName()}catch{}ce&&z.find(Se=>{try{return Se.getExposedName()===ce}catch{return!1}})&&(ge=!0)}}if(!ge){let le=j.info.getLabel();i.accessRulesWithMismatches.push({ruleType:"matchResourceAttribute",location:v,reason:`Property attribute '${G}' no longer exists on entity '${le}'.`})}}}},I=(w,v,E)=>{if(w.type==="matchResourceOwner"){let R=w;if(R.target==="user-entity"){o.user&&!c&&i.accessRulesWithMismatches.push({ruleType:"matchResourceOwner",location:v,reason:"User entity is missing in the new domain."});return}if(!E)return;let j=s.get(E);if(!j)return;if(R.property){let z=Array.from(j.withInheritedProperties()),J=Array.from(j.withInheritedAssociations());if(!(z.some(G=>G.key===R.property)||J.some(G=>G.key===R.property))){let G=r.get(E),ge=R.property,le=!1;if(G){let ce=Array.from(G.withInheritedProperties()),we=Array.from(G.withInheritedAssociations()),Se=ce.find(Ye=>Ye.key===R.property)||we.find(Ye=>Ye.key===R.property);if(Se){ge=Se.info.getLabel(Se.key);let Ye;try{Ye=Se.getExposedName()}catch{}if(Ye){let cs=z.find(pt=>{try{return pt.getExposedName()===Ye}catch{return!1}}),dt=J.find(pt=>{try{return pt.getExposedName()===Ye}catch{return!1}});(cs||dt)&&(le=!0)}}}if(!le){let ce=j.info.getLabel();e.resolveOwnershipPath(E)!==null?i.accessRulesWithMismatches.push({ruleType:"matchResourceOwner",location:v,reason:`Direct ownership property '${ge}' no longer exists on entity '${ce}'. The resolved ownership path will be used instead.`}):i.accessRulesWithMismatches.push({ruleType:"matchResourceOwner",location:v,reason:`Ownership property '${ge}' no longer exists on entity '${ce}' and no transitively resolved ownership path is available.`})}}}else if(!(e.resolveOwnershipPath(E)!==null)){let J=j.info.getLabel();i.accessRulesWithMismatches.push({ruleType:"matchResourceOwner",location:v,reason:`No ownership property specified and no transitively resolved ownership path exists for entity '${J}'.`})}}},D=(w,v)=>{if(w.type==="matchUserProperty"){let E=w;if(o.user&&!c){i.accessRulesWithMismatches.push({ruleType:"matchUserProperty",location:v,reason:"User entity is missing in the new domain."});return}c&&E.property&&(Array.from(c.withInheritedProperties()).some(z=>z.key===E.property)||i.userModelRemapping.some(J=>J.oldPropertyKey===E.property)||i.accessRulesWithMismatches.push({ruleType:"matchUserProperty",location:v,reason:`User property '${E.property}' no longer exists on the User entity.`}))}};if(o.accessRules)for(let w of o.accessRules)k(w,{type:"api",key:o.key}),b(w,{type:"api",key:o.key}),D(w,{type:"api",key:o.key});for(let[w,v]of o.exposes.entries())if(!a.has(w)){if(v.accessRules)for(let E of v.accessRules)k(E,{type:"exposure",key:w}),b(E,{type:"exposure",key:w}),S(E,{type:"exposure",key:w},v.entity.key),I(E,{type:"exposure",key:w},v.entity.key),D(E,{type:"exposure",key:w});if(v.actions){for(let E of v.actions)if(E.accessRules)for(let R of E.accessRules)k(R,{type:"action",key:`${w}:${E.kind}`}),b(R,{type:"action",key:`${w}:${E.kind}`}),S(R,{type:"action",key:`${w}:${E.kind}`},v.entity.key),I(R,{type:"action",key:`${w}:${E.kind}`},v.entity.key),D(R,{type:"action",key:`${w}:${E.kind}`})}od(w,v,s,t,i),ld(w,v,s,t,i)}return i}function oo(o,e,t){if(!t.canProceed)throw new g("Cannot apply domain update because it contains breaking changes. Details in the report.",{code:"E_CANNOT_PROCEED_WITH_UPGRADE",status:400});let i=o.domain;o.dependencies.clear(),o.dependencies.set(e.key,e),o.dependencyList=[{key:e.key,version:e.info.version}];let r=[...t.exposedEntitiesToRemove,...t.subEndpointsToRemove];for(let h of r)o.exposes.delete(h.key);if(o.user&&o.session){let h=new Set(t.sessionPropertiesToRemove),m=new Map;for(let f of t.userModelRemapping)m.set(f.oldPropertyKey,f.newPropertyKey);if(o.session.properties){let f=[];for(let b of o.session.properties){if(h.has(b.key))continue;let k=m.get(b.key);k?f.push({...b,key:k}):f.push(b)}o.session.properties=f}}let s=new Map;for(let h of e.listEntities())s.set(h.key,h);let a,n;if(o.user){let h=s.get(o.user.key);h&&(a=Array.from(h.withInheritedProperties()).find(f=>f.hasSemantic(y.UserRole)))}let l=Array.from(s.values()).find(h=>h.hasSemantic(y.Organization));l&&(n=Array.from(l.withInheritedProperties()).find(h=>h.hasSemantic(y.OrganizationRole)));let c=a?.schema?.enum,p=n?.schema?.enum,u=(h,m)=>{let f=[];for(let b of h)if(b.type==="matchUserRole"){let k=b;if(!a)continue;if(c&&Array.isArray(c)){let S=k.role.filter(I=>c.includes(I));if(S.length===0)continue;k.role=S}f.push(b)}else if(b.type==="matchOrganization"){let k=b;if(!n)continue;if(p&&Array.isArray(p)&&k.allowedOrgRoles){let S=k.allowedOrgRoles.filter(I=>p.includes(I));if(S.length===0)continue;k.allowedOrgRoles=S}f.push(b)}else if(b.type==="matchResourceAttribute"&&m){let k=b,S=s.get(m);if(!S)continue;let I=Array.from(S.withInheritedProperties());if(I.some(w=>w.key===k.attribute))f.push(b);else{let w,v=i?.findEntity(m);if(v){let R=Array.from(v.withInheritedProperties()).find(j=>j.key===k.attribute);if(R){let j;try{j=R.getExposedName()}catch{}j&&(w=I.find(z=>{try{return z.getExposedName()===j}catch{return!1}}))}}if(w)k.attribute=w.key,f.push(b);else continue}}else if(b.type==="matchResourceOwner"&&m){let k=b;if(k.target==="user-entity")f.push(b);else if(k.property){let S=s.get(m);if(!S)continue;let I=Array.from(S.withInheritedProperties()),D=Array.from(S.withInheritedAssociations());if(I.some(v=>v.key===k.property)||D.some(v=>v.key===k.property))f.push(b);else{let v,E=i?.findEntity(m);if(E){let R=Array.from(E.withInheritedProperties()),j=Array.from(E.withInheritedAssociations()),z=R.find(J=>J.key===k.property)||j.find(J=>J.key===k.property);if(z){let J;try{J=z.getExposedName()}catch{}if(J){let ee=I.find(ge=>{try{return ge.getExposedName()===J}catch{return!1}}),G=D.find(ge=>{try{return ge.getExposedName()===J}catch{return!1}});ee?v=ee.key:G&&(v=G.key)}}}v?(k.property=v,f.push(b)):(k.property=void 0,f.push(b))}}else f.push(b)}else if(b.type==="matchUserProperty"){let k=b;if(o.user){let S=s.get(o.user.key);if(S&&k.property)if(Array.from(S.withInheritedProperties()).some(w=>w.key===k.property))f.push(b);else{let w=t.userModelRemapping.find(v=>v.oldPropertyKey===k.property);w?(k.property=w.newPropertyKey,f.push(b)):(k.property="",f.push(b))}else f.push(b)}else f.push(b)}else f.push(b);return f};o.accessRules&&(o.accessRules=u(o.accessRules));for(let h of o.exposes.values()){let m=h.entity.key,f=s.get(m),b=i?.findEntity(m),k=w=>w,S=w=>w,I=!1,D=!1;if(f){let w=Array.from(f.withInheritedProperties()),v=new Set(w.map(j=>j.key)),E=Array.from(f.withInheritedAssociations()),R=new Set(E.map(j=>j.key));k=j=>{let z=j.split("."),J=z[0],ee=J,G=!1;if(v.has(J))G=!0;else if(b){let le=Array.from(b.withInheritedProperties()).find(ce=>ce.key===J);if(le){let ce;try{ce=le.getExposedName()}catch{}if(ce){let we=w.find(Se=>{try{return Se.getExposedName()===ce}catch{return!1}});we&&(ee=we.key,G=!0)}}}z[0]=ee;let ge=z.join(".");return G||(I=!0),ge},S=j=>{let z=j.split("."),J=z[0],ee=J,G=!1;if(R.has(J))G=!0;else if(b){let le=Array.from(b.withInheritedAssociations()).find(ce=>ce.key===J);if(le){let ce;try{ce=le.getExposedName()}catch{}if(ce){let we=E.find(Se=>{try{return Se.getExposedName()===ce}catch{return!1}});we&&(ee=we.key,G=!0)}}}z[0]=ee;let ge=z.join(".");return G||(D=!0),ge}}if(h.accessRules&&(h.accessRules=u(h.accessRules,m)),h.actions)for(let w of h.actions)w.accessRules&&(w.accessRules=u(w.accessRules,m)),w.projection&&Array.isArray(w.projection.fields)&&(w.projection.fields=w.projection.fields.map(v=>{if(v.type==="association"){D=!1;let E=S(v.key),j=t.actionProjectionsWithMismatches.some(z=>z.exposureKey===h.key&&z.actionKind===w.kind&&z.fieldType==="association"&&z.fieldKey===v.key)||D?!0:v.invalid;return{...v,key:E,invalid:j}}else{I=!1;let E=k(v.key),j=t.actionProjectionsWithMismatches.some(z=>z.exposureKey===h.key&&z.actionKind===w.kind&&z.fieldType==="property"&&z.fieldKey===v.key)||I?!0:v.invalid;return{...v,key:E,invalid:j}}}));if(h.paginationContract&&f){let w=h.paginationContract;w.filterableFields&&(w.filterableFields=w.filterableFields.map(k)),w.sortableFields&&(w.sortableFields=w.sortableFields.map(k)),w.searchableFields&&(w.searchableFields=w.searchableFields.map(k))}}o.notifyChange()}var as=class o extends ui{kind;key;info;user;authentication;authorization;session;exposes;accessRules;rateLimiting;termsOfService;contact;license;pagination;#e=!0;#t=!1;get domain(){if(this.dependencyList.length===0)return;let e=this.dependencyList[0];return this.dependencies.get(e.key)}static createSchema(e={}){let{key:t=q(),exposes:i=[],pagination:r}=e,s=ie.fromJSON(e.info,{name:"Unnamed API"}).toJSON(),a={kind:$e,key:t,info:s,exposes:i,pagination:r?structuredClone(r):{kind:"cursor"}};return e.user&&(a.user=structuredClone(e.user)),e.dependencyList&&(a.dependencyList=structuredClone(e.dependencyList)),e.authentication&&(a.authentication=structuredClone(e.authentication)),e.authorization&&(a.authorization=structuredClone(e.authorization)),e.session&&(a.session=structuredClone(e.session)),Array.isArray(e.accessRules)&&(a.accessRules=structuredClone(e.accessRules)),e.rateLimiting&&(a.rateLimiting=structuredClone(e.rateLimiting)),e.termsOfService&&(a.termsOfService=e.termsOfService),e.contact&&(a.contact=structuredClone(e.contact)),e.license&&(a.license=structuredClone(e.license)),a}constructor(e,t){let i=o.createSchema(e),r=[];if(t instanceof Xe)t.readOnly?r.push(t):(console.warn(`Domain ${t.key} is not read only, cloning it. This may have performance implications.`),r.push(t.clone({readOnly:!0})));else if(typeof t=="object"&&t.kind===ze)r.push(new Xe(t,void 0,{readOnly:!0}));else if(t)throw new g("Invalid domain provided. Expected a DataDomain instance or schema.",{code:"E_DOMAIN_INVALID",help:"It looks like the provided data domain is not a valid instance or domain schema."});if(t){if(!t.info.version)throw new g(`Domain ${t.key} must have a version.`,{code:"E_DOMAIN_NO_VERSION",help:"Before attaching the data domain, give it a version name. Only versioned domains can be attached to an API model."});i.dependencyList=[{key:t.key,version:t.info.version}]}super(i.dependencyList,r),this.kind=i.kind,this.key=i.key,this.info=new ie(i.info),this.user=i.user,this.pagination=i.pagination?structuredClone(i.pagination):{kind:"cursor"},i.authentication&&(this.authentication=structuredClone(i.authentication)),i.authorization&&(this.authorization=structuredClone(i.authorization)),i.session&&(this.session=structuredClone(i.session)),Array.isArray(i.exposes)?this.exposes=new Map(i.exposes.map(s=>[s.key,new Yt(this,s)])):this.exposes=new Map,Array.isArray(i.accessRules)?this.accessRules=i.accessRules.map(s=>fi(this,s)):this.accessRules=[],i.rateLimiting&&(this.rateLimiting=new wt(i.rateLimiting)),i.termsOfService&&(this.termsOfService=i.termsOfService),i.contact&&(this.contact=i.contact),i.license&&(this.license=i.license),this.#e=!1}toJSON(){let e={kind:this.kind,key:this.key,info:this.info.toJSON(),exposes:Array.from(this.exposes.values()).map(t=>t.toJSON()),pagination:structuredClone(this.pagination)};return this.user&&(e.user={...this.user}),this.dependencyList.length>0&&(e.dependencyList=structuredClone(this.dependencyList)),this.authentication&&(e.authentication=structuredClone(this.authentication)),this.authorization&&(e.authorization=structuredClone(this.authorization)),this.session&&(e.session=structuredClone(this.session)),Array.isArray(this.accessRules)&&this.accessRules.length>0&&(e.accessRules=this.accessRules.map(t=>t.toJSON())),this.rateLimiting&&(e.rateLimiting=this.rateLimiting.toJSON()),this.termsOfService&&(e.termsOfService=this.termsOfService),this.contact&&(e.contact=structuredClone(this.contact)),this.license&&(e.license=structuredClone(this.license)),e}notifyChange(){this.#t||this.#e||(this.#t=!0,queueMicrotask(()=>{this.#t=!1;let e=new Event("change");this.dispatchEvent(e)}))}exposeEntity(e,t){let i=this.domain;if(!i)throw new g("No domain attached to API model",{code:"E_NO_DOMAIN",help:"Attach a data domain to the API model before exposing entities."});let r=Te(e,this.domain?.key);if(t?.parentId){let u=this.exposes.get(t.parentId);if(!u)throw new g(`Parent exposure not found: ${t.parentId}`,{code:"E_PARENT_NOT_FOUND",help:"Make sure the parent exposure key you provided is correct."});let h;for(let J of this.exposes.values())if(J.parent?.key===u.key&&Te(J.entity,this.domain?.key)===r){h=J;break}if(h)throw new g(`Entity ${e.key} is already exposed under the specified parent.`,{code:"E_ENTITY_ALREADY_EXPOSED",help:"Do not try to expose already exposed entity under the same parent."});let m;for(let J of this.exposes.values())if(Te(J.entity,this.domain?.key)===r){m=J;break}if(m&&t?.promoteOnReuse)return this.promoteToRoot(m,i),m;let f=this.findAssociation(u.entity.key,u.entity.domain,e,i);if(!f)throw new g(`No association found from parent entity "${u.entity.key}" to target entity "${e.key}"`,{code:"E_ASSOCIATION_NOT_FOUND",help:"Ensure there is a defined association in the data domain connecting these entities."});let b=f.info.name||"",k=Gr(b.toLocaleLowerCase()),S=f.multiple!==!1,I=i.findEntity(e.key,e.domain);if(!I)throw new g(`Entity not found in domain: ${e.key}`,{code:"E_NO_ENTITY"});let D=mi(I.info.name||""),w=S?`/${k}`:void 0,v=S?`/${k}/{${D}}`:`/${k}`,R=(u.parent?.depth??0)+1,j={kind:xt,key:q(),entity:{...e},actions:[],isRoot:!1,collectionPath:w,resourcePath:"",hasCollection:S,parent:{key:u.key,association:{key:f.key,domain:u.entity.domain},depth:R}};t&&(j.exposeOptions={...t});let z=new Yt(this,j);return z.setResourcePath(v),this.exposes.set(z.key,z),t?.followAssociations&&(t?.maxDepth===void 0||t.maxDepth>R)&&this.followEntityAssociations(j,t),this.notifyChange(),z}let s;for(let u of this.exposes.values())if(u.isRoot&&Te(u.entity,this.domain?.key)===r){s=u;break}if(s)throw new g(`Entity ${e.key} is already exposed.`,{code:"E_ENTITY_ALREADY_EXPOSED",help:"Do not try to expose already exposed entity."});let a=i.findEntity(e.key,e.domain);if(!a)throw new g(`Entity not found in domain: ${e.key}`,{code:"E_NO_ENTITY",help:"Make sure the entity you are trying to expose exists in the data domain."});let{collectionPath:n,resourcePath:l}=this.generateUniqueRootPaths(a.info.name||""),c={kind:xt,key:q(),entity:{...e},actions:[],isRoot:!0,collectionPath:n,resourcePath:l,hasCollection:!0};t&&(c.exposeOptions={...t});let p=new Yt(this,c);return this.exposes.set(p.key,p),t?.followAssociations&&(t?.maxDepth===void 0||t.maxDepth>0)&&this.followEntityAssociations(c,t),this.notifyChange(),p}promoteToRoot(e,t){if(e.isRoot)return;let i=t.findEntity(e.entity.key,e.entity.domain);if(i){let{collectionPath:r,resourcePath:s}=this.generateUniqueRootPaths(i.info.name||"");e.isRoot=!0,e.parent=void 0,e.hasCollection=!0,e.collectionPath=r,e.setResourcePath(s)}}generateUniqueRootPaths(e){let t=Gr(e.toLocaleLowerCase()),i=mi(e),r=`/${t}`,s=`/${t}/{${i}}`,a=1,n=r;for(;this.findCollectionPathCollision(r);)r=`${n}-${a}`,s=`${r}/{${i}}`,a++;return{collectionPath:r,resourcePath:s}}findAssociation(e,t,i,r){let s=r.findEntity(e,t);if(!s)throw new g(`Parent entity not found in domain: ${e}`,{code:"E_NO_ENTITY"});for(let a of s.listAssociations())for(let n of a.targets)if(n.key===i.key&&n.domain===i.domain)return a}followEntityAssociations(e,t){let i=this.domain;if(!i)throw new g("No domain attached to API model",{code:"E_NO_DOMAIN"});let r=t.maxDepth??6,s=Te(e.entity,this.domain?.key);this.followAssociationsRecursive(e.entity,e.key,0,[s],t,r,i)}followAssociationsRecursive(e,t,i,r,s,a,n){let l=n.findEntity(e.key,e.domain);if(l)for(let c of l.listAssociations())for(let p of c.targets){let u=Te(p,this.domain?.key),h=Te(e,this.domain?.key);if(u===h||r.includes(u))continue;let m=Te(p,this.domain?.key),f;for(let j of this.exposes.values())if(Te(j.entity,this.domain?.key)===m){f=j;break}if(f){if(!f.isRoot&&s?.promoteOnReuse){let j=!1;if(f.parent){let z=this.exposes.get(f.parent.key);if(z){let J=Te(z.entity,this.domain?.key);r.includes(J)&&(j=!0)}}j||this.promoteToRoot(f,n);continue}if(f.isRoot)continue}let b=n.findEntity(p.key,p.domain);if(!b)continue;let k=c.info.name||"",S=Gr(k.toLocaleLowerCase()),I=c.multiple!==!1,D=mi(b.info.name||""),w=I?`/${S}`:void 0,v=I?`/${S}/{${D}}`:`/${S}`,E={kind:xt,key:q(),entity:{...p},actions:[],isRoot:!1,collectionPath:w,resourcePath:"",hasCollection:I,parent:{key:t,association:{key:c.key,domain:e.domain},depth:i+1}},R=new Yt(this,E);R.setResourcePath(v),this.exposes.set(R.key,R),i+1>=a?E.truncated=!0:this.followAssociationsRecursive(p,E.key,i+1,[...r,u],s,a,n)}}removeExposedEntity(e){if(!this.exposes.has(e))throw new g(`Exposed entity with key "${e}" not found.`,{code:"E_NO_EXPOSURE",help:"The exposed entity you are trying to remove does not exist."});this.removeWithChildren(e),this.notifyChange()}removeWithChildren(e){if(!this.exposes.has(e))return;this.exposes.delete(e);let t=i=>{for(let r of this.exposes.values())r.parent?.key===i&&(t(r.key),this.exposes.delete(r.key))};t(e)}cleanForDomainChange(){this.dependencies.clear(),this.dependencyList=[],this.exposes=new Map,this.user=void 0,this.session&&(this.session.properties=[]),this.notifyChange()}attachDataDomain(e){if(!e.info.version)throw new g("Cannot attach DataDomain without a version. Please set the version in the domain info.",{code:"E_DOMAIN_NO_VERSION",help:"Before attaching the data domain, give it a version name. Only versioned domains can be attached to an API model."});this.cleanForDomainChange(),this.dependencies.set(e.key,e),this.dependencyList=[{key:e.key,version:e.info.version}];for(let t of e.listEntities())if(t.hasSemantic(y.User)){this.user={key:t.key};break}this.notifyChange()}findExposedByEntity(e){let t=Te(e,this.domain?.key);for(let i of this.exposes.values())if(Te(i.entity,this.domain?.key)===t)return i}findResourcePathCollision(e,t){for(let i of this.exposes.values())if(!(t&&i.key===t)&&i.isRoot&&i.resourcePath===e)return i}findCollectionPathCollision(e,t){for(let i of this.exposes.values())if(!(t&&i.key===t)&&i.isRoot&&i.hasCollection&&i.collectionPath===e)return i}hasDomainUpdate(e){let t=this.domain;return t?t.key!==e.key||t.info.version!==e.info.version:!0}analyzeDomainUpdate(e){return no(this,e)}applyDomainUpdate(e,t){oo(this,e,t),this.notifyChange()}};function $(o,e){return`${o}_${e}`}function lo(o){let e=[],t={apiModelKey:o.key,kind:$e,key:o.key};return o.kind!==$e&&e.push({code:$("API","INVALID_KIND"),message:"The API model type is incorrect.",suggestion:'Set the model type to "ApiModel".',severity:"error",context:{...t,property:"kind"}}),(!o.key||typeof o.key!="string"||o.key.trim()==="")&&e.push({code:$("API","MISSING_KEY"),message:"The API model is missing a unique identifier.",suggestion:"Provide a valid name to use as a unique identifier.",severity:"error",context:{...t,property:"key"}}),(!o.info||!o.info.name||o.info.name.trim()==="")&&e.push({code:$("API","MISSING_NAME"),message:"The API model has no defined name.",suggestion:"Provide a descriptive name for your API.",severity:"error",context:{...t,property:"info.name"}}),(!o.info||!o.info.description||o.info.description.trim()==="")&&e.push({code:$("API","MISSING_DESCRIPTION"),message:"Adding a description helps others understand your API.",suggestion:"Add a description to clarify the purpose of this API.",severity:"warning",context:{...t,property:"info.description"}}),e}function co(o){let e=[],t={apiModelKey:o.key,kind:$e,key:o.key},i=o.domain;return i?((!i.info||!i.info.version)&&e.push({code:$("API","MISSING_DOMAIN_VERSION"),message:"The selected Data Domain is missing a version number.",suggestion:"Specify a version for the attached Data Domain.",severity:"error",context:t}),e):(e.push({code:$("API","MISSING_DOMAIN"),message:"No Data Domain is attached to the API.",suggestion:"Select a Data Domain from the settings to power your API.",severity:"error",context:t}),e)}function po(o){let e=[],t={apiModelKey:o.key,kind:$e,key:o.key},i=o.domain&&o.user?o.domain.findEntity(o.user.key,o.user.domain):void 0;if(!o.authentication)e.push({code:$("API","MISSING_AUTHENTICATION"),message:"The API is missing authentication settings.",suggestion:"Go to the security settings and configure how users authenticate.",severity:"error",context:{...t,property:"authentication"}});else if(o.authentication.strategy==="UsernamePassword"&&i){let r;for(let a of i.properties)if(a.hasSemantic(y.Password)){r=a;break}r||e.push({code:$("API","MISSING_PASSWORD_SEMANTIC"),message:"The selected user model requires a property with the Password data semantic for authentication.",suggestion:'Go to the Data Modeler and add the "Password" semantic to the password property.',severity:"error",context:{...t,property:"user"}});let s;for(let a of i.properties)if(a.hasSemantic(y.Username)){s=a;break}s||e.push({code:$("API","MISSING_USERNAME_SEMANTIC"),message:"Username & Password authentication requires a field with the Username data semantic.",suggestion:'Go to the Data Modeler and add the "Username" semantic to the property used for login.',severity:"error",context:{...t,property:"user"}})}if(!o.authorization)e.push({code:$("API","MISSING_AUTHORIZATION"),message:"The API is missing authorization settings.",suggestion:"Go to the security settings and configure how to handle user permissions.",severity:"error",context:{...t,property:"authorization"}});else if(o.authorization.strategy==="RBAC"&&i){let r;for(let s of i.properties)if(s.hasSemantic(y.UserRole)){r=s;break}r||e.push({code:$("API","MISSING_ROLE_SEMANTIC"),message:"Role-based access control requires a property with the User Role data semantic on the user model.",suggestion:'Go to the Data Modeler and add the "User Role" semantic to the property used for roles.',severity:"error",context:{...t,property:"user"}})}if(!o.session)e.push({code:$("API","MISSING_SESSION"),message:"The API is missing session configuration.",suggestion:"Configure how user sessions will be handled.",severity:"error",context:{...t,property:"session"}});else{if(o.session.secret||e.push({code:$("API","MISSING_SESSION_SECRET"),message:"A secure encryption key is required for sessions.",suggestion:"Provide a strong security key in the session settings.",severity:"error",context:{...t,property:"session.secret"}}),!o.session.properties||o.session.properties.length===0)e.push({code:$("API","MISSING_SESSION_PROPERTIES"),message:"The session token needs to include at least one piece of user information, like an ID.",suggestion:"Select fields that should be stored securely inside the session payload.",severity:"error",context:{...t,property:"session.properties"}});else if(o.authorization&&o.authorization.strategy==="RBAC"&&i){let a;for(let n of i.properties)if(n.hasSemantic(y.UserRole)){a=n;break}a&&!o.session.properties.find(n=>n.key===a?.key)&&e.push({code:$("API","MISSING_RBAC_SESSION_PROPERTY"),message:"The user role must be included in the session data for permissions to work.",suggestion:"Make sure your selected role property is checked in the session settings.",severity:"error",context:{...t,property:"session.properties"}})}let{cookie:r,jwt:s}=o.session;(!r||!r.enabled)&&(!s||!s.enabled)&&e.push({code:$("API","MISSING_SESSION_TRANSPORT"),message:"No delivery method for sessions (like cookies or tokens) is enabled.",suggestion:"Enable at least one session delivery mechanism in the security settings.",severity:"error",context:{...t,property:"session"}})}if(o.user?o.domain&&!o.domain.findEntity(o.user.key,o.user.domain)&&e.push({code:$("API","INVALID_USER_ENTITY"),message:"The selected user model no longer exists in your data domain.",suggestion:"Please navigate to security settings and select a valid user model.",severity:"error",context:{...t,property:"user"}}):e.push({code:$("API","MISSING_USER_ENTITY"),message:"You need to specify what kind of object represents your users.",suggestion:"Select a model from your domain that stores your user accounts.",severity:"error",context:{...t,property:"user"}}),o.accessRules&&o.accessRules.length>0)for(let r=0;r<o.accessRules.length;r++){let s=o.accessRules[r];s.inheritable||e.push({code:$("API","NON_INHERITABLE_RULE"),message:`The access rule of type "${s.type}" is not inheritable and cannot be applied at the API level.`,suggestion:"Remove this rule from the API settings or move it to a specific exposed entity / action.",severity:"error",context:{...t,property:`accessRules[${r}]`}})}return e}function uo(o){let e=[],t={apiModelKey:o.key,kind:$e,key:o.key},i=/^https?:\/\//i,r=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return o.contact?(o.contact.email&&!r.test(o.contact.email)&&e.push({code:$("API","INVALID_CONTACT_EMAIL"),message:"The contact email address looks invalid.",suggestion:"Please double check the email address formatting.",severity:"error",context:{...t,property:"contact.email"}}),o.contact.url&&!i.test(o.contact.url)&&e.push({code:$("API","INVALID_CONTACT_URL"),message:"The contact link looks invalid.",suggestion:"Provide a working link, starting with http:// or https://.",severity:"error",context:{...t,property:"contact.url"}})):e.push({code:$("API","MISSING_CONTACT"),message:"A contact email or link is highly recommended for API consumers.",suggestion:"Add an email or help desk link in the metadata tab.",severity:"info",context:{...t,property:"contact"}}),o.license?o.license.url&&!i.test(o.license.url)&&e.push({code:$("API","INVALID_LICENSE_URL"),message:"The license link looks invalid.",suggestion:"Provide a working link, starting with http:// or https://.",severity:"error",context:{...t,property:"license.url"}}):e.push({code:$("API","MISSING_LICENSE"),message:"Adding a license to your API helps users understand its usage rights.",suggestion:"Add the name and a link to your API license terms.",severity:"info",context:{...t,property:"license"}}),o.termsOfService||e.push({code:$("API","MISSING_TOS"),message:"Terms of Service help legal compliance.",suggestion:"Add a link to the terms of your API service.",severity:"info",context:{...t,property:"termsOfService"}}),e}function ho(o){let e=[],t={apiModelKey:o.key,kind:$e,key:o.key},i=!1;for(let r of o.exposes.values())if(r.actions.some(s=>vt.isListAction(s)||_t.isSearchAction(s))){i=!0;break}return i&&(!o.pagination||!o.pagination.kind?e.push({code:$("API","MISSING_PAGINATION"),message:"The API must have a defined pagination strategy when it exposes List or Search actions.",suggestion:"Configure how results are loaded (e.g. by page or by a continuous cursor).",severity:"error",context:{...t,property:"pagination"}}):(o.pagination.defaultLimit===void 0&&e.push({code:$("API","MISSING_PAGINATION_DEFAULT_LIMIT"),message:"The API doesn't have a defined default page limit when it exposes List or Search actions.",suggestion:"Set a default page limit for the pagination otherwise the API will use its default limit.",severity:"info",context:{...t,property:"pagination.defaultLimit"}}),o.pagination.maxLimit===void 0&&e.push({code:$("API","MISSING_PAGINATION_MAX_LIMIT"),message:"The API doesn't have a defined page size max limit when it exposes List or Search actions.",suggestion:"Set a max page size limit for the pagination otherwise the API will use its default max limit.",severity:"info",context:{...t,property:"pagination.maxLimit"}}))),e}function cd(o,e,t){let i=[],r={apiModelKey:t.key,kind:"Action",key:o.kind,parentExposedEntityKey:e.key};if(Ht.isDeleteAction(o)&&(o.strategy?o.strategy==="hard"&&i.push({code:$("ACTION","DELETE_HARD_WARNING"),message:"Permanent delete is active. There will be no way to restore deleted data.",suggestion:'Consider switching to "soft delete" if users might need to undo mistakes.',severity:"info",context:{...r,property:"strategy"}}):i.push({code:$("ACTION","DELETE_MISSING_STRATEGY"),message:"A Delete action must know if you want to completely erase the record, or just hide it.",suggestion:"Configure the deletion type (permanent or soft).",severity:"error",context:{...r,property:"strategy"}})),Xt.isUpdateAction(o)&&(!o.allowedMethods||o.allowedMethods.length===0)&&i.push({code:$("ACTION","UPDATE_MISSING_METHODS"),message:"An Update action must define how the data is sent (PUT replaces everything; PATCH applies partial changes).",suggestion:"Select at least one allowed HTTP method.",severity:"error",context:{...r,property:"allowedMethods"}}),o.getAllRateLimiters().some(n=>n.rules.length)||i.push({code:$("ACTION","MISSING_RATE_LIMITS"),message:"It is best practice to configure a rate limit so your API is not overwhelmed.",suggestion:"Set a reasonable maximum request speed for this operation.",severity:"warning",context:r}),o.accessRules)for(let n of o.accessRules)i.push(...fo(n,e,t));if(o.projection&&(vt.isListAction(o)||_t.isSearchAction(o)||Wt.isReadAction(o)||i.push({code:$("ACTION","INVALID_PROJECTION_SEVERITY"),message:`Projections are only supported for read actions (List, Search, Read). The action "${o.kind}" does not support projections.`,suggestion:"Remove projection configuration from this write action.",severity:"warning",context:{...r,property:"projection"}}),o.projection.type!=="include"&&o.projection.type!=="exclude"&&i.push({code:$("ACTION","INVALID_PROJECTION_TYPE"),message:'Projection type must be either "include" or "exclude".',suggestion:"Select a valid projection type.",severity:"error",context:{...r,property:"projection"}}),Array.isArray(o.projection.fields))){let l=e.entity?t.domain?.findEntity(e.entity.key,e.entity.domain):void 0;if(l){let c=Array.from(l.withInheritedProperties()),p=new Set(c.map(h=>h.key)),u=new Set(Array.from(l.withInheritedAssociations()).map(h=>h.key));o.projection.fields.forEach((h,m)=>{if(h.invalid===!0){i.push({code:$("ACTION","INVALID_PROJECTION_FIELD"),message:`The projected field "${h.key}" is marked as invalid. It was not found in the entity definition.`,suggestion:"Update or remove this field from the projection configuration.",severity:"error",context:{...r,property:`projection.fields[${m}]`}});return}if(h.type==="association"){let f=h.key.split("."),b=f[0];if(!u.has(b))i.push({code:$("ACTION","INVALID_PROJECTION_ASSOCIATION"),message:`The projected association "${h.key}" does not exist on this entity.`,suggestion:"Select a valid association or remove it.",severity:"error",context:{...r,property:`projection.fields[${m}]`}});else{let k=Array.from(l.withInheritedAssociations()).find(S=>S.key===b);f.length>1&&(!k||k.schema?.embedded!==!0)&&i.push({code:$("ACTION","INVALID_PROJECTION_ASSOCIATION_EMBEDDED"),message:`The projected association "${h.key}" is invalid because association "${b}" is not embedded.`,suggestion:"Ensure the association is marked as embedded to use dot-notation.",severity:"error",context:{...r,property:`projection.fields[${m}]`}})}}else{let f=h.key.split("."),b=f[0];if(!p.has(b))i.push({code:$("ACTION","INVALID_PROJECTION_PROPERTY"),message:`The projected property "${h.key}" does not exist on this entity.`,suggestion:"Select a valid property or remove it.",severity:"error",context:{...r,property:`projection.fields[${m}]`}});else{let k=c.find(S=>S.key===b);f.length>1&&(!k||k.type!=="json"?i.push({code:$("ACTION","INVALID_PROJECTION_JSON_ROOT"),message:`The projected property "${h.key}" is invalid because root property "${b}" is not of type "json".`,suggestion:'Make sure the root property is of type "json" to use dot-notation.',severity:"error",context:{...r,property:`projection.fields[${m}]`}}):k.jsonSchema&&(lt(k.jsonSchema,f.slice(1))||i.push({code:$("ACTION","INVALID_PROJECTION_JSON_PATH"),message:`The projected property "${h.key}" is invalid according to the JSON Schema of "${b}".`,suggestion:"Configure a valid JSON Schema path or update the projection path.",severity:"error",context:{...r,property:`projection.fields[${m}]`}})))}}})}}return i}function mo(o,e){let t=[],i={apiModelKey:e.key,kind:xt,key:o.key},r=o.entity?e.domain?.findEntity(o.entity.key,o.entity.domain):void 0,s=r?.info.getLabel()||r?.key||"unknown";!o.entity||!o.entity.key?t.push({code:$("EXPOSURE","MISSING_ENTITY_REF"),message:"This exposed endpoint does not point to a specific data model.",suggestion:"Select which database entity this endpoint should serve.",severity:"error",context:{...i,property:"entity"}}):r||t.push({code:$("EXPOSURE","INVALID_ENTITY_REF"),message:"This endpoint points to a data model that no longer exists.",suggestion:"Select a new valid database model or delete this endpoint.",severity:"error",context:{...i,property:"entity"}});let a=r?.hasSemantic(y.User);if(o.isRoot&&r&&!a&&e.domain&&e.domain.resolveOwnershipPath(r.key)===null&&t.push({code:$("EXPOSURE","MISSING_OWNER_PATH"),message:`[${s}]: This root endpoint has no ownership path to the User entity. If you want this resource to be user-isolated, add the Relational Resource Owner semantic to the association that defines its owner.`,suggestion:"Ensure the resource has a direct (Resource Owner Identifier) or indirect (Relational Resource Owner) path to the User entity.",severity:"warning",context:i}),!o.isRoot&&e.domain)if(!o.parent)t.push({code:$("EXPOSURE","MISSING_PARENT_REF"),message:`[${s}]: A sub-endpoint (non-root exposure) must have a parent endpoint.`,suggestion:"Expose this entity under a parent entity or make it a root endpoint.",severity:"error",context:{...i,property:"parent"}});else{let l=e.exposes.get(o.parent.key);if(!l)t.push({code:$("EXPOSURE","INVALID_PARENT_EXPOSURE"),message:`[${s}]: The parent exposed entity "${o.parent.key}" does not exist.`,suggestion:"Ensure that the parent endpoint is exposed.",severity:"error",context:{...i,property:"parent.key"}});else{let c=e.domain.findEntity(l.entity.key,l.entity.domain),p=o.parent.association.key,u=e.domain.findAssociation(p,o.parent.association.domain);if(!u)t.push({code:$("EXPOSURE","MISSING_PARENT_ASSOCIATION"),message:`[${s}]: The parent association "${p}" does not exist in the data domain.`,suggestion:"Select a valid association in the data domain that connects the parent and child entities.",severity:"error",context:{...i,property:"parent.association"}});else{let h=c?.key,m=r?.key,f=u.getParentInstance()?.key===h,b=u.getParentInstance()?.key===m,k=u.targets.some(D=>D.key===h),S=u.targets.some(D=>D.key===m);f&&S||b&&k||t.push({code:$("EXPOSURE","INVALID_PARENT_ASSOCIATION"),message:`[${s}]: The parent association "${p}" does not connect the parent entity "${c?.info.name||h}" with the child entity "${r?.info.name||m}".`,suggestion:"Use an association that directly connects the parent and child data entities.",severity:"error",context:{...i,property:"parent.association"}})}}}if(o.hasCollection){if(!o.collectionPath)t.push({code:$("EXPOSURE","MISSING_COLLECTION_PATH"),message:`[${s}]: When an endpoint exposes a collection, it must define what its base URL path is.`,suggestion:'Add a path (e.g., "/items").',severity:"error",context:{...i,property:"collectionPath"}});else{let l=o.collectionPath.split("/").filter(Boolean);(l.length!==1||!o.collectionPath.startsWith("/"))&&t.push({code:$("EXPOSURE","INVALID_COLLECTION_PATH"),message:`[${s}]: The collection URL should start with "/" and have no extra slashes.`,suggestion:`Ensure the path looks like exactly "/${l[0]||"subresource"}".`,severity:"error",context:{...i,property:"collectionPath"}})}o.resourcePath?o.collectionPath&&(new RegExp(`^${o.collectionPath}/\\{[a-zA-Z0-9_]+\\}$`).test(o.resourcePath)||t.push({code:$("EXPOSURE","INVALID_RESOURCE_PATH_FORMAT"),message:`[${s}]: The single item route should match exactly your collection path plus one identifier variable.`,suggestion:`Make sure the item path is formatted exactly like "${o.collectionPath}/{id}".`,severity:"error",context:{...i,property:"resourcePath"}})):t.push({code:$("EXPOSURE","MISSING_RESOURCE_PATH"),message:`[${s}]: You need an identifier to locate single items.`,suggestion:'Specify the identification parameter format, like "{id}".',severity:"error",context:{...i,property:"resourcePath"}})}else o.resourcePath?(o.resourcePath.split("/").filter(Boolean).length!==1||!o.resourcePath.startsWith("/"))&&t.push({code:$("EXPOSURE","INVALID_RESOURCE_PATH_FORMAT"),message:`[${s}]: The URL route ${o.resourcePath} must only contain one exact part or level.`,suggestion:"Simplify the endpoint URL to a single segment.",severity:"error",context:{...i,property:"resourcePath"}}):t.push({code:$("EXPOSURE","MISSING_RESOURCE_PATH"),message:`[${s}]: Exposed entity representing a single item must declare their URL route.`,suggestion:'Set the URL path (such as "/profile").',severity:"error",context:{...i,property:"resourcePath"}});o.isRoot&&(o.collectionPath&&e.findCollectionPathCollision(o.collectionPath,o.key)&&t.push({code:$("EXPOSURE","ROOT_COLLECTION_COLLISION"),message:`[${s}]: The route "${o.collectionPath}" is already used by another view.`,suggestion:"Give this resource a different path to avoid conflicts.",severity:"error",context:{...i,property:"collectionPath"}}),o.resourcePath&&e.findResourcePathCollision(o.resourcePath,o.key)&&t.push({code:$("EXPOSURE","ROOT_RESOURCE_COLLISION"),message:`[${s}]: The route "${o.resourcePath}" is already used by another one.`,suggestion:"Give this single-item resource a different path to avoid conflicts.",severity:"error",context:{...i,property:"resourcePath"}}));let n=o.getAbsoluteResourcePath();if(n){let l=[...n.matchAll(/\{([^}]+)\}/g)].map(p=>p[1]);if(new Set(l).size!==l.length){let u=l.filter((h,m)=>l.indexOf(h)!==m)[0];t.push({code:$("EXPOSURE","DUPLICATE_PATH_PARAMETER"),message:`[${s}]: The path parameter "{${u}}" is duplicated in the resource path hierarchy.`,suggestion:"Change the parameter name in either this resource or its ancestor to ensure unique parameter names.",severity:"error",context:{...i,property:"resourcePath"}})}}if(!o.actions||o.actions.length===0)t.push({code:$("EXPOSURE","MISSING_ACTIONS"),message:`[${s}]: This exposed entity does not let users do anything.`,suggestion:"Enable at least one operation like Create, Read, or Update.",severity:"error",context:{...i,property:"actions"}});else{let l=!1,c=!1;for(let p of o.actions){t.push(...cd(p,o,e)),_t.isSearchAction(p)&&(l=!0),vt.isListAction(p)&&(c=!0);let u=!1;p.accessRules&&p.accessRules.length>0&&(u=!0),!u&&o.accessRules&&o.accessRules.length>0&&(u=!0);let h=o.parent?.key;for(;h&&!u;){let m=e.exposes.get(h);if(m&&m.accessRules&&m.accessRules.some(f=>f.inheritable)){u=!0;break}h=m?.parent?.key}!u&&e.accessRules&&e.accessRules.some(m=>m.inheritable)&&(u=!0),u||t.push({code:$("ACTION","MISSING_ACCESS_RULES"),message:`[${s}]: The ${p.kind} action has no security rules attached, making it entirely inaccessible or open.`,suggestion:"Allow specific user roles to access this operation.",severity:"error",context:{...i,kind:"Action",key:p.kind,parentExposedEntityKey:o.key}})}if(c||l){let p=o.paginationContract;if(!p)t.push({code:$("EXPOSURE","MISSING_PAGINATION_CONTRACT"),message:`[${s}]: The List or Search action needs a pagination contract.`,suggestion:"Add a pagination contract to the exposed entity.",severity:"error",context:i});else{if(c&&((!p.filterableFields||p.filterableFields.length===0)&&t.push({code:$("EXPOSURE","LIST_MISSING_FILTERS"),message:`[${s}]: Listing all elements without filters could be overwhelming for large tables.`,suggestion:"Select a few important fields to allow filtering.",severity:"warning",context:i}),(!p.sortableFields||p.sortableFields.length===0)&&t.push({code:$("EXPOSURE","LIST_MISSING_SORTING"),message:`[${s}]: Listing all elements without sorting could be overwhelming for large tables.`,suggestion:"Select a few important fields to allow sorting.",severity:"warning",context:i})),l){let u=[];Array.isArray(p.searchableFields)&&u.push(...p.searchableFields),Array.isArray(p.filterableFields)&&u.push(...p.filterableFields),u.length||t.push({code:$("EXPOSURE","SEARCH_MISSING_FIELDS"),message:`[${s}]: Search action needs to know which text fields to look in.`,suggestion:"Select a few important fields to allow searching or full-text search.",severity:"warning",context:i})}if(r){let u=Array.from(r.withInheritedProperties()),h=new Set(u.map(f=>f.key)),m=(f,b,k,S)=>{if(f&&Array.isArray(f))for(let I of f){let D=I.split("."),w=D[0];if(!h.has(w))t.push({code:$("EXPOSURE",k),message:`[${s}]: The ${S} field "${I}" does not exist on this entity.`,suggestion:`Select a valid property on the entity for ${S}.`,severity:"error",context:{...i,property:`paginationContract.${b}Fields`}});else{let v=u.find(E=>E.key===w);D.length>1&&(!v||v.type!=="json"?t.push({code:$("EXPOSURE",k),message:`[${s}]: The ${S} field "${I}" is invalid because root property "${w}" is not of type "json".`,suggestion:'Make sure the root property is of type "json" to use dot-notation.',severity:"error",context:{...i,property:`paginationContract.${b}Fields`}}):v.jsonSchema&&(lt(v.jsonSchema,D.slice(1))||t.push({code:$("EXPOSURE",k),message:`[${s}]: The ${S} field "${I}" is invalid according to the JSON Schema of "${w}".`,suggestion:"Configure a valid JSON Schema path or update the field path.",severity:"error",context:{...i,property:`paginationContract.${b}Fields`}})))}}};m(p.filterableFields,"filterable","INVALID_FILTER_FIELD","filterable"),m(p.sortableFields,"sortable","INVALID_SORT_FIELD","sortable"),m(p.searchableFields,"searchable","INVALID_SEARCH_FIELD","searchable")}}}}if(o.accessRules)for(let l of o.accessRules)t.push(...fo(l,o,e));return t}function fo(o,e,t){let i=[],r={apiModelKey:t.key,kind:"AccessRule",key:o.type,parentExposedEntityKey:e.key};if(o.type==="matchResourceOwner"){let s=o,a=t.domain;if(!a)return i;let n=e.entity.key,l=a.findEntity(n);if(!l)return i;if(s.target==="user-entity")l.hasSemantic(y.User)||i.push({code:$("RULE","INVALID_USER_ENTITY_TARGET"),message:`[${l.info.getLabel()}]: Target is set to "user-entity", but the entity itself does not represent the User.`,suggestion:'Change target to "property" or add User semantic to this entity.',severity:"error",context:r});else if(s.property){let c=Array.from(l.withInheritedProperties()),p=Array.from(l.withInheritedAssociations());c.some(h=>h.key===s.property)||p.some(h=>h.key===s.property)||i.push({code:$("RULE","INVALID_OWNERSHIP_PROPERTY"),message:`[${l.info.getLabel()}]: The ownership property or association "${s.property}" does not exist on this entity.`,suggestion:"Select a valid property/association, or clear the field to use transitively resolved ownership.",severity:"error",context:r})}else a.resolveOwnershipPath(n)===null&&i.push({code:$("RULE","MISSING_OWNERSHIP_PATH"),message:`[${l.info.getLabel()}]: The access rule is set to "Match resource owner", but no direct property or transitive ownership path to the User entity exists.`,suggestion:"Annotate a property/association with the ResourceOwnerIdentifier or RelationalResourceOwner semantic.",severity:"error",context:r})}else if(o.type==="matchResourceAttribute"){let s=o,a=t.domain;if(!a)return i;let n=e.entity.key,l=a.findEntity(n);if(!l)return i;s.attribute&&(Array.from(l.withInheritedProperties()).some(u=>u.key===s.attribute)||i.push({code:$("RULE","INVALID_RESOURCE_ATTRIBUTE"),message:`[${l.info.getLabel()}]: The resource attribute property "${s.attribute}" does not exist.`,suggestion:"Select a valid property on the entity.",severity:"error",context:r}))}else if(o.type==="matchUserProperty"){let s=o,a=t.domain;if(a){let n=Array.from(a.listEntities()).find(l=>l.hasSemantic(y.User));n?s.property?Array.from(n.withInheritedProperties()).some(p=>p.key===s.property)||i.push({code:$("RULE","INVALID_USER_PROPERTY"),message:`The user property "${s.property}" does not exist on the User entity "${n.info.getLabel()}".`,suggestion:"Select a valid property on the User entity.",severity:"error",context:r}):i.push({code:$("RULE","MISSING_USER_PROPERTY"),message:'The access rule is set to "Match user property", but no property is specified.',suggestion:"Specify a property on the User entity to match against.",severity:"error",context:r}):i.push({code:$("RULE","MISSING_USER_MODEL"),message:'The API specifies a "Match user property" rule, but no User entity is configured in the domain.',suggestion:"Annotate an entity in the domain with the User semantic.",severity:"error",context:r})}}else if(o.type==="matchOrganization"){let s=o,a=t.domain;if(a){let n=Array.from(a.listEntities()).find(c=>c.hasSemantic(y.User)),l=Array.from(a.listEntities()).find(c=>c.hasSemantic(y.Organization));if(n||i.push({code:$("RULE","MISSING_USER_MODEL"),message:'The API specifies a "Match organization access" rule, but no User entity is configured in the domain.',suggestion:"Annotate an entity in the domain with the User semantic.",severity:"error",context:r}),l||i.push({code:$("RULE","MISSING_ORGANIZATION_MODEL"),message:'The API specifies a "Match organization access" rule, but no Organization entity is configured.',suggestion:"Annotate an entity in the domain with the Organization semantic.",severity:"error",context:r}),l){let c=e.entity.key,p=a.findEntity(c);if(p){let u=p.key===l.key,h=p.hasSemantic(y.User)&&Array.from(l.withInheritedAssociations()).some(m=>m.hasSemantic(y.OrganizationMembers)&&m.targets.some(f=>f.key===p.key))||Array.from(l.withInheritedAssociations()).some(m=>m.hasSemantic(y.OrganizationResource)&&m.targets.some(f=>f.key===p.key))||Array.from(p.withInheritedAssociations()).some(m=>m.targets.some(f=>f.key===l.key));!u&&!h&&i.push({code:$("RULE","ORGANIZATION_NOT_LINKED"),message:`[${p.info.getLabel()}]: The access rule is set to "Match organization access", but the resource is not linked to the Organization entity.`,suggestion:"Establish an association between the Organization entity and this resource entity.",severity:"error",context:r})}if(l&&s.allowedOrgRoles&&s.allowedOrgRoles.length>0){let u=Array.from(l.withInheritedProperties()).find(h=>h.hasSemantic(y.OrganizationRole));if(u){let h=u.schema?.enum;if(h&&Array.isArray(h))for(let m of s.allowedOrgRoles)h.includes(m)||i.push({code:$("RULE","INVALID_ORGANIZATION_ROLE"),message:`Organization role "${m}" is not defined in the Organization role enum list.`,suggestion:`Select a valid role from: [${h.join(", ")}].`,severity:"warning",context:r})}}}}}else if(o.type==="matchAssociation"){let s=o,a=t.domain;a&&(Array.from(a.listEntities()).find(l=>l.hasSemantic(y.User))||i.push({code:$("RULE","MISSING_USER_MODEL"),message:'The API specifies a "Match association access" rule, but no User entity is configured in the domain.',suggestion:"Annotate an entity in the domain with the User semantic.",severity:"error",context:r}),s.associationKey||i.push({code:$("RULE","MISSING_ASSOCIATION_KEY"),message:'The access rule is set to "Match association access", but no association key is specified.',suggestion:"Specify the target association key in the rule configuration.",severity:"error",context:r}))}return i}var ns=class{model;report=[];#e=0;#t=0;#r=0;#i=!1;get infoCount(){return this.#i||this.computeIssueCounters(),this.#e}get warningCount(){return this.#i||this.computeIssueCounters(),this.#t}get errorCount(){return this.#i||this.computeIssueCounters(),this.#r}constructor(e){this.model=e}validate(){if(this.#i=!1,this.report=[],this.report.push(...lo(this.model)),this.report.push(...co(this.model)),this.report.push(...po(this.model)),this.report.push(...ho(this.model)),this.report.push(...uo(this.model)),!this.model.exposes||this.model.exposes.size===0)this.report.push({code:"API_NO_EXPOSURES",message:"Your API currently has no exposed data for external clients to request.",suggestion:"Expose a data model so apps can communicate with it.",severity:"warning",context:{apiModelKey:this.model.key,kind:$e,key:this.model.key,property:"exposes"}});else for(let e of this.model.exposes.values())this.report.push(...mo(e,this.model));return this.report}computeIssueCounters(){this.#e=this.report.filter(e=>e.severity==="info").length,this.#t=this.report.filter(e=>e.severity==="warning").length,this.#r=this.report.filter(e=>e.severity==="error").length,this.#i=!0}};function yo(o){o.command("validate [file]").description("Validate a Data Domain or API Model schema").option("--stdin","Read schema content from STDIN").option("--org <oid>","Organization ID (remote validation)").option("--fid <fid>","File ID / schema ID (remote validation)").option("--domain <path>","Path to local Data Domain schema file (only for local API Model validation)").action(async(e,t)=>{let i=new H({format:P.resolved.format});_.debug("[validate] Starting validation process..."),await new ga(e,t,i).execute()})}var ga=class{constructor(e,t,i){this.file=e;this.options=t;this.formatter=i}file;options;formatter;async execute(){_.debug("[validate] Executing schema validation...");try{this.validateArguments();let e=await this.loadSchema();this.validateSchemaStructure(e);let t=e.kind,i=[];t===ze?i=await this.validateDataDomain(e):t===$e?i=await this.validateApiModel(e):(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Unsupported schema kind "${t}". Supported kinds: "${ze}", "${$e}".`}),process.exit(1)),this.reportResults(i,t)}catch(e){let t=Z(e);this.formatter.error(t),process.exit(1)}}get isRemoteValidationWithoutOrg(){return!!(this.options.fid&&!this.options.org&&!P.resolved.org)}get shouldReadFromStdin(){return!!(this.options.stdin||!this.file&&!process.stdin.isTTY)}validateArguments(){this.file&&this.options.stdin&&(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:"Cannot specify both [file] path and --stdin"}),process.exit(1)),this.options.org&&!this.options.fid&&(this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"File ID (--fid) is required when using remote validation (--org)."}),process.exit(1)),this.isRemoteValidationWithoutOrg&&(this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required for remote validation. Use --org <oid> or configure a default org."}),process.exit(1))}async loadSchema(){return _.debug(`[validate] Loading schema (remote=${!!this.options.fid})...`),this.options.fid?this.loadRemoteSchema():this.loadLocalSchema()}async loadRemoteSchema(){let e=this.options.org||P.resolved.org;e||(this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required for remote validation."}),process.exit(1)),_.debug(`[validate] Fetching remote schema file ID '${this.options.fid}' from organization '${e}'...`);let t=X(),{media:i}=await t.files.readMedia(e,this.options.fid,{token:t.token});return _.debug("[validate] Remote schema loaded successfully."),i}async loadLocalSchema(){let e;if(this.shouldReadFromStdin)_.debug("[validate] Reading schema from STDIN..."),e=await this.readStdin();else if(this.file){let t=go.resolve(this.file);_.debug(`[validate] Reading local schema file from path: ${t}`),os.existsSync(t)||(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`File not found at path: ${t}`}),process.exit(1)),e=os.readFileSync(t,"utf8")}else this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"A file path, --stdin, or remote --org and --fid must be specified."}),process.exit(1);try{let t=JSON.parse(e);return _.debug("[validate] Local schema parsed successfully."),t}catch(t){let i=t instanceof Error?t.message:String(t);this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Failed to parse schema JSON: ${i}`}),process.exit(1)}}isValidSchemaStructure(e){return!!e&&typeof e=="object"&&!Array.isArray(e)&&"kind"in e}validateSchemaStructure(e){this.isValidSchemaStructure(e)||(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:'Invalid schema. The schema must be a JSON object containing a "kind" property.'}),process.exit(1))}async validateDataDomain(e){_.debug("[validate:domain] Validating schema as Data Domain...");let t=[];if(this.options.fid){let a=X(),n=e.dependencyList||[];n.length>0&&(_.debug(`[validate:domain] Listing ${n.length} dependency data domains from catalog...`),t=(await a.dataCatalog.listDependencies(n,{token:a.token})).data||[])}let i=new Xe(e,t,{readOnly:!0}),s=new hi(i).validate();return _.debug(`[validate:domain] Domain validation rules executed. Issues found: ${s.length}`),s}async validateApiModel(e){_.debug("[validate:api] Validating schema as API Model...");let t;if(this.options.fid){let a=X(),n=e.dependencyList||[];if(n.length>0){_.debug(`[validate:api] Listing ${n.length} dependency data domains from catalog...`);let c=(await a.dataCatalog.listDependencies(n,{token:a.token})).data||[];c.length>0&&(t=new Xe(c[0],c,{readOnly:!0}))}}else if(this.options.domain){let a=go.resolve(this.options.domain);_.debug(`[validate:api] Loading domain dependency from local path: ${a}`),os.existsSync(a)||(this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Domain dependency file not found at path: ${a}`}),process.exit(1));let n;try{n=JSON.parse(os.readFileSync(a,"utf8"))}catch(l){let c=l instanceof Error?l.message:String(l);this.formatter.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Failed to parse domain dependency JSON: ${c}`}),process.exit(1)}t=new Xe(n,[],{readOnly:!0})}let i=new as(e,t),s=new ns(i).validate();return _.debug(`[validate:api] API Model validation rules executed. Issues found: ${s.length}`),s}reportResults(e,t){_.debug(`[validate] Reporting results. Found ${e.length} validation issue(s).`);let i=e.some(r=>r.severity==="error");if(P.resolved.format==="json")console.log(JSON.stringify({isValid:!i,validationIssues:e},null,2));else if(e.length===0)this.formatter.success("Validation passed. No issues found!");else{let r=this.formatIssues(e,t);this.formatter.list(r,["severity","code","message","suggestion","context"],{headers:["SEVERITY","CODE","MESSAGE","SUGGESTION","CONTEXT"]});let s=e.filter(l=>l.severity==="error").length,a=e.filter(l=>l.severity==="warning").length,n=e.filter(l=>l.severity==="info").length;console.log(""),s>0?console.error(Q.red(`\u2716 Validation failed: ${s} error(s), ${a} warning(s), ${n} info(s).`)):console.log(Q.yellow(`\u26A0 Validation passed with warnings: ${a} warning(s), ${n} info(s).`))}i&&process.exit(1)}formatIssues(e,t){return e.map(i=>{let r=i.severity||"info",s=i.message||"",a,n,l;if(t===ze){let c=i;a=c.rule||"unknown",n=c.help||"",l=c.key?`${c.kind||"unknown"}: ${c.key}`:c.field||""}else{let c=i;a=c.code||"unknown",n=c.suggestion||"";let p=c.context||{};l=`${p.kind||"unknown"}: ${p.key||""}${p.property?"."+p.property:""}`}return{severity:r,code:a,message:s,suggestion:n,context:l}})}async readStdin(){return new Promise((e,t)=>{let i="";process.stdin.setEncoding("utf8"),process.stdin.on("data",r=>{i+=r}),process.stdin.on("end",()=>{e(i)}),process.stdin.on("error",r=>{t(r)})})}};function bo(o){o.command("runtime").description("Administrative operations for the API runtime").command("users").description("Administrative operations for users").command("update").description("Update properties of a user directly in the runtime database").requiredOption("--api <api>","API file ID or slug").requiredOption("--user-id <userId>","Primary key of the user record to update").requiredOption("--property <name=value...>","Properties to update in the format name=value (can specify multiple)").option("--org <oid>","Organization ID (defaults to configured org)").option("--env <environment>",'Target environment (e.g. "production", "staging")',"production").action(async i=>{let r=new H({format:P.resolved.format});_.debug("[runtime:update] Starting runtime user update process..."),await new ya(i,r).execute()})}var ya=class{constructor(e,t){this.options=e;this.formatter=t}options;formatter;async execute(){_.debug("[runtime:update] Executing runtime user update...");try{let e=X();Nt(e,this.formatter);let t=this.options.org||P.resolved.org;_.debug(`[runtime:update] Using organization ID: ${t}`),t||(this.formatter.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is not specified.",detail:"Use --org <oid> or configure a default organization."}),process.exit(1)),_.debug("[runtime:update] Parsing properties...");let i=this.parseProperties(this.options.property),r={};for(let[a,n]of Object.entries(i)){let l=["token","password","secret","key"].some(c=>a.toLowerCase().includes(c));r[a]=l?"**********":n}_.debug(`[runtime:update] Parsed properties: ${JSON.stringify(r)}`),_.debug(`[runtime:update] Sending request to update runtime user ID '${this.options.userId}' in environment '${this.options.env}' for api '${this.options.api}'...`);let s=await e.deployments.apis.updateRuntimeUser(t,this.options.api,this.options.userId,i,this.options.env,{token:e.token});_.debug("[runtime:update] Runtime user updated successfully."),this.formatter.success(`User '${this.options.userId}' updated successfully!`,s)}catch(e){let t=Z(e);this.formatter.error(t),process.exit(1)}}parseProperties(e){let t={};for(let i of e){let r=i.split("=");if(r.length<2)throw new Error(`Invalid property format: '${i}'. Expected 'name=value'.`);let s=r[0].trim(),a=r.slice(1).join("=").trim();a==="true"?t[s]=!0:a==="false"?t[s]=!1:a==="null"?t[s]=null:/^\d+$/.test(a)?t[s]=parseInt(a,10):/^\d*\.\d+$/.test(a)?t[s]=parseFloat(a):t[s]=a}return t}};var ct;(function(o){o.add="add",o.remove="remove",o.replace="replace",o.copy="copy",o.move="move",o.test="test"})(ct||(ct={}));function ls(o,e,t){let i=new re(e),r=Lt(o,i);if(!tt(r,t))throw new ue([{path:i.raw,message:"Test operation failed. The values are not equal."}]);return{doc:o}}var AA=Object.freeze({add:et,copy:ri,move:xi,remove:bt,replace:ii,test:ls});function wo(o){return Array.isArray(o)?new Array(o.length).fill(0).map((e,t)=>`${t}`):Object.keys(o)}function Bi(o){switch(typeof o){case"object":return JSON.parse(JSON.stringify(o));case"undefined":return null;default:return o}}function dd(o,e,t={}){if(JSON.stringify(o)===JSON.stringify(e))return[];let i=[...o],r=[...e],s=[],a=0,n=0;for(;a<i.length||n<r.length;)if(a>=i.length){let l=t.fixedIndexes?n:-1;s.push({op:"add",index:l,value:r[n]}),n++}else if(n>=r.length)s.push({op:"remove",index:a}),a++;else if(tt(i[a],r[n]))a++,n++;else{let l=-1,c=-1;for(let p=a;p<i.length;p++)if(tt(i[p],r[n])){l=p;break}for(let p=n;p<r.length;p++)if(tt(r[p],i[a])){c=p;break}if(l===-1&&c===-1)s.push({op:"replace",index:n,value:r[n]}),a++,n++;else if(l===-1)s.push({op:"add",index:n,value:r[n]}),n++;else if(c===-1)s.push({op:"remove",index:a}),a++;else{s.push({op:"move",index:n,from:l});let p=i[l];i.splice(l,1),i.splice(a,0,p),a++,n++}}return s.sort((l,c)=>l.op==="remove"&&c.op==="remove"?c.index-l.index:0)}function ba(o,e,t,i=[],r={}){if(o===e)return;if(o==null&&e!==null&&e!==void 0){t.push({op:"replace",path:"",value:e});return}if(e==null&&o!==null&&o!==void 0){t.push({op:"replace",path:"",value:null});return}typeof e.toJSON=="function"&&(e=e.toJSON());let s=$t(o),a=$t(e),n=br(s),l=br(a);if(n&&l){tt(o,e)||t.push({op:"replace",path:he(i),value:e});return}if(a!==s){t.push({op:s===void 0?"add":"replace",path:he(i),value:e});return}if(s==="array"){let u=o,m=dd(u,e,r);for(let f of m){let b=f.index===-1?"-":f.index.toString(),k=[...i,b];f.op==="remove"?(r.invertible&&t.push({op:"test",path:he(k),value:Bi(u[f.index])}),t.push({op:f.op,path:he(k)})):f.op==="replace"&&typeof f.value=="object"&&f.value!==null?ba(u[f.index],f.value,t,k,r):f.op==="move"?t.push({op:"move",from:he([...i,f.from.toString()]),path:he(k)}):t.push({op:f.op,path:he(k),value:f.value})}return}let c=wo(e),p=wo(o);for(let u of c){let h=o[u],m=e[u];Object.prototype.hasOwnProperty.call(o,u)?typeof h=="object"&&h!=null&&typeof m=="object"&&m!==null&&Array.isArray(h)===Array.isArray(m)?ba(h,m,t,[...i,u],r):tt(h,m)||(r.invertible&&t.push({op:"test",path:he([...i,u]),value:Bi(h)}),t.push({op:"replace",path:he([...i,u]),value:Bi(m)})):t.push({op:"add",path:he([...i,u]),value:Bi(m)})}for(let u of p)Object.prototype.hasOwnProperty.call(e,u)||(r.invertible&&t.push({op:"test",path:he([...i,u]),value:Bi(o[u])}),t.push({op:"remove",path:he([...i,u])}))}function Gi(o,e,t){let i=[];return ba(o,e,i,[],t),i}var gi=Object.create(null);gi.add=0;gi.remove=1;gi.replace=2;gi.move=3;gi.copy=4;gi.test=5;import{nanoid as md}from"nanoid";function _o(o){o.command("domain").description("Manage Data Domains").command("transition [state]").description("Transition the lifecycle state of a data domain (draft, committed, published)").option("--file <fid>","File ID of the data domain").option("--org <oid>","Organization ID (optional, defaults to configured default org)").option("--ver <ver>","New version (required when transitioning from published to draft)").action(async(t,i)=>{let r=new H({format:P.resolved.format}),s=P.resolved,a=i.org||s.org;if(_.debug(`[domain:transition] Transitioning domain lifecycle. Options: file=${i.file}, org=${a}, ver=${i.ver}, state=${t}`),!a){r.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Organization ID is required.",detail:"Pass --org <oid> or set a default organization using `apinow orgs set-default <oid>`."}),process.exit(1);return}let n=X(),l=i.file;if(!l&&process.stdout.isTTY){_.debug("[domain:transition] File ID not provided; listing data domain files for selection...");try{let m=(await n.files.list(a,{filter:{field:"kind",operator:"eq",value:Et}},{token:n.token})).data||[];m.length>0&&(l=await yt("Select a data domain file:",m.map(f=>({name:`${f.info?.name||"Unnamed"} (${f.key})`,value:f.key}))))}catch(h){_.debug(`[domain:transition] Failed to list domain files for selection: ${h}`)}}if(!l){r.error({code:"CLI_ERR_MISSING_REQUIRED",message:"File ID is required.",detail:"Specify --file <fid>."}),process.exit(1);return}let c=t,p=["draft","committed","published"];if(!c&&process.stdout.isTTY&&(c=await yt("Select target lifecycle state:",[{name:"Draft (draft)",value:"draft"},{name:"Committed (committed)",value:"committed"},{name:"Published (published)",value:"published"}])),!c){r.error({code:"CLI_ERR_MISSING_REQUIRED",message:"Target lifecycle state is required.",detail:`Specify state as a positional argument (allowed: ${p.join(", ")}).`}),process.exit(1);return}if(!p.includes(c)){r.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`Invalid lifecycle state '${c}'.`,detail:`Allowed states: ${p.join(", ")}`}),process.exit(1);return}let u;try{u=await n.files.read(a,l,{token:n.token})}catch(h){let m=Z(h);r.error(m),process.exit(1);return}if(u.kind!==Et){r.error({code:"CLI_ERR_INVALID_ARGUMENT",message:`File '${l}' is not a data domain.`,detail:`The file kind is '${u.kind}', but expected '${Et}'.`}),process.exit(1);return}try{_.debug(`[domain:transition] Fetching media for file ID '${l}'...`);let{media:h,meta:m}=await n.files.readMedia(a,l,{token:n.token}),f=h;if(f.kind!==ze){r.error({code:"CLI_ERR_INVALID_ARGUMENT",message:"Invalid data domain schema format.",detail:`The media kind is '${f.kind}', but expected '${ze}'.`}),process.exit(1);return}let b=[];f.dependencyList&&f.dependencyList.length>0&&(_.debug(`[domain:transition] Fetching dependencies: ${JSON.stringify(f.dependencyList)}`),b=(await n.dataCatalog.listDependencies(f.dependencyList,{token:n.token})).data||[]);let k=new Xe(f,b,{readOnly:!1}),S=i.ver;if(k.lifecycle==="published"&&c==="draft"&&!S){if(process.stdout.isTTY){let j=k.info.version;S=await Ue(`Enter new version (current published version is ${j}):`)}if(!S){r.error({code:"CLI_ERR_MISSING_REQUIRED",message:"A new version must be specified when creating a draft from a published domain.",detail:"Provide a version with --ver <ver>."}),process.exit(1);return}}_.debug(`[domain:transition] Changing lifecycle state from '${k.lifecycle}' to '${c}'...`),k.changeLifecycle(c,S),_.debug("[domain:transition] Validating data domain structure...");let D=new hi(k).validate();if(D&&D.length>0&&D.filter(z=>z.severity==="error").length>0){r.error({code:"CLI_ERR_INVALID_ARGUMENT",message:"Data domain validation failed.",detail:JSON.stringify(D,null,2)}),process.exit(1);return}let w=k.toJSON(),v=Gi(f,w);if(v.length===0){_.debug("[domain:transition] No changes in domain lifecycle detected."),r.success(`Data domain is already in '${c}' state.`);return}_.debug("[domain:transition] Sending patch request to target file media...");let E={id:md(),timestamp:Date.now(),patch:v,version:m.version},R=await n.files.patchMedia(a,l,E,{token:n.token});_.debug(`[domain:transition] Patch applied successfully. New file version: ${R.newVersion}`),r.success(`Successfully transitioned data domain state to '${c}' (new file version: ${R.newVersion}).`,{fileId:l,state:c,version:k.info.version,fileVersion:R.newVersion})}catch(h){let m=Z(h);r.error(m),process.exit(1);return}})}parseInt(process.versions.node.split(".")[0],10)<22&&(console.error("Error: apinow requires Node.js 22 or higher."),process.exit(1));function So(){let o=process.argv.indexOf("--format");if(o!==-1&&o+1<process.argv.length&&process.argv[o+1]==="json")return"json";try{return P.resolved.format||"text"}catch{return"text"}}process.on("uncaughtException",o=>{new H({format:So()}).error({code:"CLI_ERR_UNKNOWN",message:o.message||"An unexpected error occurred.",detail:o.stack}),process.exit(1)});process.on("unhandledRejection",o=>{let e=new H({format:So()}),t=o instanceof Error?o.message:String(o),i=o instanceof Error?o.stack:void 0;e.error({code:"CLI_ERR_UNKNOWN",message:`Unhandled promise rejection: ${t}`,detail:i}),process.exit(1)});fd({pkg:bi}).notify();P.load();var Je=new gd;Je.name("apinow").description("API NOW! Platform CLI Tool").version(bi.version,"--version").option("--format <format>","Output format: text, json","text").option("--api-url <url>","Override target API server base URL").option("--debug","Enable debug/verbose logging").option("-v, --verbose","Enable verbose logging");Je.hook("preAction",(o,e)=>{let t,i,r=e;for(;r;){let s=r.opts();s.apiUrl&&!t&&(t=s.apiUrl),s.format&&!i&&(i=s.format),(s.debug||s.verbose)&&Sa("debug"),r=r.parent}P.saturate({apiUrl:t,format:i}),_.debug(`Executing command: ${e.name()} with args: ${JSON.stringify(e.args)}`)});Aa(Je);Pa(Je);Oa(Je);Ta(Je);La(Je);yo(Je);bo(Je);_o(Je);function Ao(o){let e=o.options||[];e.some(t=>t.long==="--api-url")||o.option("--api-url <url>","Override target API server base URL"),e.some(t=>t.long==="--format")||o.option("--format <format>","Output format: text, json"),e.some(t=>t.long==="--debug")||o.option("--debug","Enable debug/verbose logging"),e.some(t=>t.long==="--verbose")||(o.options.some(i=>i.short==="-v")?o.option("--verbose","Enable verbose logging"):o.option("-v, --verbose","Enable verbose logging"));for(let t of o.commands)Ao(t)}for(let o of Je.commands)Ao(o);await Je.parseAsync(process.argv);
|
|
55
54
|
/*! Bundled license information:
|
|
56
55
|
|
|
57
56
|
@pawel-up/data-mock/build/src/lib/MersenneTwister.js:
|