fern-api 5.139.0 → 5.139.1

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.
Files changed (2) hide show
  1. package/cli.cjs +8 -8
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -172,7 +172,7 @@ GFS4: `),console.error(e)});zE[gP]||(Ycc=global[gP]||[],Zcc(zE,Ycc),zE.close=(fu
172
172
  `)?n.split(`
173
173
 
174
174
  `):n.split(",")}switch(e){case"hoist-pattern":case"public-hoist-pattern":return r(t)}return t}buc.exports=lao});var Suc=b(wuc=>{"use strict";var xuc=require("os"),Mle=require("path"),Cuc=xuc.tmpdir(),R3f=process.getuid?process.getuid():process.pid,k3f=()=>!0,Iuc=process.platform==="win32",vuc={editor:()=>process.env.EDITOR||process.env.VISUAL||(Iuc?"notepad.exe":"vi"),shell:()=>Iuc?process.env.COMSPEC||"cmd.exe":process.env.SHELL||"/bin/bash"},F3f={fromString:()=>process.umask()},LXe=xuc.homedir();LXe?process.env.HOME=LXe:LXe=Mle.resolve(Cuc,"npm-"+R3f);var N3f=process.platform==="win32"?"npm-cache":".npm",j3f=process.platform==="win32"&&process.env.APPDATA||LXe,Q3f=Mle.resolve(j3f,N3f),YTr,TQe;Object.defineProperty(wuc,"defaults",{get:function(){return YTr||(process.env.PREFIX?TQe=process.env.PREFIX:process.platform==="win32"?TQe=Mle.dirname(process.execPath):(TQe=Mle.dirname(Mle.dirname(process.execPath)),process.env.DESTDIR&&(TQe=Mle.join(process.env.DESTDIR,TQe))),YTr={access:null,"allow-same-version":!1,"always-auth":!1,also:null,audit:!0,"auth-type":"legacy","bin-links":!0,browser:null,ca:null,cafile:null,cache:Q3f,"cache-lock-stale":6e4,"cache-lock-retries":10,"cache-lock-wait":1e4,"cache-max":1/0,"cache-min":10,cert:null,cidr:null,color:process.env.NO_COLOR==null,depth:1/0,description:!0,dev:!1,"dry-run":!1,editor:vuc.editor(),"engine-strict":!1,force:!1,"fetch-retries":2,"fetch-retry-factor":10,"fetch-retry-mintimeout":1e4,"fetch-retry-maxtimeout":6e4,git:"git","git-tag-version":!0,"commit-hooks":!0,global:!1,globalconfig:Mle.resolve(TQe,"etc","npmrc"),"global-style":!1,group:process.platform==="win32"?0:process.env.SUDO_GID||process.getgid&&process.getgid(),"ham-it-up":!1,heading:"npm","if-present":!1,"ignore-prepublish":!1,"ignore-scripts":!1,"init-module":Mle.resolve(LXe,".npm-init.js"),"init-author-name":"","init-author-email":"","init-author-url":"","init-version":"1.0.0","init-license":"ISC",json:!1,key:null,"legacy-bundling":!1,link:!1,"local-address":void 0,loglevel:"notice",logstream:process.stderr,"logs-max":10,long:!1,maxsockets:50,message:"%s","metrics-registry":null,"node-options":null,offline:!1,"onload-script":!1,only:null,optional:!0,otp:null,"package-lock":!0,"package-lock-only":!1,parseable:!1,"prefer-offline":!1,"prefer-online":!1,prefix:TQe,production:!1,progress:!process.env.TRAVIS&&!process.env.CI,provenance:!1,proxy:null,"https-proxy":null,"no-proxy":null,"user-agent":"npm/{npm-version} node/{node-version} {platform} {arch}","read-only":!1,"rebuild-bundle":!0,registry:"https://registry.npmjs.org/",rollback:!0,save:!0,"save-bundle":!1,"save-dev":!1,"save-exact":!1,"save-optional":!1,"save-prefix":"^","save-prod":!1,scope:"","script-shell":null,"scripts-prepend-node-path":"warn-only",searchopts:"",searchexclude:null,searchlimit:20,searchstaleness:900,"send-metrics":!1,shell:vuc.shell(),shrinkwrap:!0,"sign-git-tag":!1,"sso-poll-frequency":500,"sso-type":"oauth","strict-ssl":!0,tag:"latest","tag-version-prefix":"v",timing:!1,tmp:Cuc,unicode:k3f(),"unsafe-perm":process.platform==="win32"||process.platform==="cygwin"||!(process.getuid&&process.setuid&&process.getgid&&process.setgid)||process.getuid()!==0,usage:!1,user:process.platform==="win32"?0:"nobody",userconfig:Mle.resolve(LXe,".npmrc"),umask:process.umask?process.umask():F3f.fromString("022"),version:!1,versions:!1,viewer:process.platform==="win32"?"browser":"man",_exit:!0},YTr)}})});var Ouc=b((Ux0,pao)=>{"use strict";var OQe=require("path"),z3f=Euc(),Tuc=Suc();pao.exports=(e,t,r)=>{let n=new z3f(Object.assign({},Tuc.defaults,r),t);n.add(Object.assign({},e),"cli");let i=[],o=!1;if(require.resolve.paths){let u=require.resolve.paths("npm"),l;try{l=require.resolve("npm",{paths:u.slice(-1)})}catch{o=!0}l&&i.push(n.addFile(OQe.resolve(OQe.dirname(l),"..","npmrc"),"builtin"))}n.addEnv(),n.loadPrefix();let s=OQe.resolve(n.localPrefix,".npmrc"),a=n.get("userconfig");if(!n.get("global")&&s!==a?i.push(n.addFile(s,"project")):n.add({},"project"),n.get("workspace-prefix")&&n.get("workspace-prefix")!==s){let u=OQe.resolve(n.get("workspace-prefix"),".npmrc");i.push(n.addFile(u,"workspace"))}if(i.push(n.addFile(n.get("userconfig"),"user")),n.get("prefix")){let u=OQe.resolve(n.get("prefix"),"etc");n.root.globalconfig=OQe.resolve(u,"npmrc"),n.root.globalignorefile=OQe.resolve(u,"npmignore")}i.push(n.addFile(n.get("globalconfig"),"global")),n.loadUser();let c=n.get("cafile");return c&&n.loadCAFile(c),{config:n,warnings:i.filter(Boolean),failedToLoadBuiltInConfig:o}};Object.defineProperty(pao.exports,"defaults",{get(){return Tuc.defaults},enumerable:!0})});var juc=b((_x0,Nuc)=>{"use strict";var Puc=Ouc(),Buc=":_authToken",Duc=":_auth",Ruc=":username",kuc=":_password";Nuc.exports=function(){let t,r;arguments.length>=2?(t=arguments[0],r=Object.assign({},arguments[1])):typeof arguments[0]=="string"?t=arguments[0]:r=Object.assign({},arguments[0]),r=r||{};let n=r.npmrc;return r.npmrc=(r.npmrc?{config:{get:i=>n[i]}}:Puc()).config,t=t||r.npmrc.get("registry")||Puc.defaults.registry,Fuc(t,r)||L3f(r.npmrc)};function M3f(e,t){let r=new URL(t,new URL(e.startsWith("//")?`./${e}`:e,"resolve://"));if(r.protocol==="resolve:"){let{pathname:n,search:i,hash:o}=r;return n+i+o}return r.toString()}function Fuc(e,t){let r=e instanceof URL?e:new URL(e.startsWith("//")?`http:${e}`:e),n;for(;n!=="/"&&r.pathname!==n;){n=r.pathname||"/";let i="//"+r.host+n.replace(/\/$/,""),o=U3f(i,t.npmrc);if(o)return o;if(!t.recursive)return/\/$/.test(e)?void 0:Fuc(new URL("./",r),t);r.pathname=M3f(V3f(n),"..")||"/"}}function L3f(e){return e.get("_auth")?{token:XTr(e.get("_auth")),type:"Basic"}:void 0}function V3f(e){return e[e.length-1]==="/"?e:e+"/"}function U3f(e,t){let r=_3f(t.get(e+Buc)||t.get(e+"/"+Buc));if(r)return r;let n=t.get(e+Ruc)||t.get(e+"/"+Ruc),i=t.get(e+kuc)||t.get(e+"/"+kuc),o=G3f(n,i);if(o)return o;let s=q3f(t.get(e+Duc)||t.get(e+"/"+Duc));if(s)return s}function XTr(e){return e.replace(/^\$\{?([^}]*)\}?$/,function(t,r){return process.env[r]})}function _3f(e){return e?{token:XTr(e),type:"Bearer"}:void 0}function G3f(e,t){if(!e||!t)return;let r=Buffer.from(XTr(t),"base64").toString("utf8");return{token:Buffer.from(e+":"+r,"utf8").toString("base64"),type:"Basic",password:r,username:e}}function q3f(e){return e?{token:XTr(e),type:"Basic"}:void 0}});async function fao(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],o=t.registryUrl??eao(i),s=new URL(encodeURIComponent(e).replace(/^%40/,"@"),o),a=(0,Quc.default)(o.toString(),{recursive:!0}),c={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete c.accept,a&&(c.authorization=`${a.type} ${a.token}`);let u;try{u=await Acc(s,{headers:c,keepalive:!0}).json()}catch(p){throw p?.response?.status===404?new ZTr(e):p}if(t.allVersions)return u;let l=new VXe(e,r);if(u["dist-tags"][r]){let{time:p}=u;u=u.versions[u["dist-tags"][r]],u.time=p}else if(r){let p=!!u.versions[r];if(n&&!p)for(let[f,m]of Object.entries(u.versions))m.deprecated&&delete u.versions[f];if(!p){let f=Object.keys(u.versions);if(r=zuc.default.maxSatisfying(f,r),!r)throw l}let{time:d}=u;if(u=u.versions[r],u.time=d,!u)throw l}return u}var Quc,zuc,ZTr,VXe,dao=h(()=>{"use strict";ycc();Ucc();Quc=be(juc(),1),zuc=be(DE(),1),ZTr=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},VXe=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}}});async function PQe(e,t){let{version:r}=await fao(e.toLowerCase(),t);return r}var $Tr=h(()=>{"use strict";dao();dao()});async function tOr({packageName:e,generatorInvocation:t}){if(t.language==null||e==null)return;let r=K3f(t.outputMode),n=await X3f({packageName:e,language:t.language,githubRepository:h4f(t),registryInfo:r});return n==null?void 0:ZNt.default.inc(n,"patch")??void 0}function K3f(e){let t=e.type;switch(t){case"publish":return Y3f(e);case"publishV2":return J3f(e.publishV2);case"downloadFiles":return eOr.Empty;case"github":return _uc(e.publishInfo);case"githubV2":return _uc(e.githubV2.publishInfo);default:Ee(t)}}function _uc(e){if(e==null)return{registryUrl:void 0,token:void 0,username:void 0};let t=e.type;switch(t){case"npm":return{registryUrl:e.registryUrl,token:e.token,username:void 0};case"maven":return{registryUrl:e.registryUrl,token:e.credentials?.password,username:e.credentials?.username};case"pypi":return{registryUrl:e.registryUrl,token:e.credentials?.password,username:void 0};case"nuget":return{registryUrl:e.registryUrl,token:e.apiKey,username:void 0};case"rubygems":return{registryUrl:e.registryUrl,token:e.apiKey,username:void 0};case"crates":return{registryUrl:e.registryUrl,token:e.token,username:void 0};case"postman":return{registryUrl:void 0,token:void 0,username:void 0};default:Ee(t)}}function J3f(e){let t=e.type;switch(t){case"npmOverride":return{registryUrl:e.npmOverride?.registryUrl,token:e.npmOverride?.token,username:void 0};case"mavenOverride":return{registryUrl:e.mavenOverride?.registryUrl,token:e.mavenOverride?.password,username:e.mavenOverride?.username};case"pypiOverride":return{registryUrl:e.pypiOverride?.registryUrl,token:e.pypiOverride?.password,username:void 0};case"nugetOverride":return{registryUrl:e.nugetOverride?.registryUrl,token:e.nugetOverride?.apiKey,username:void 0};case"rubyGemsOverride":return{registryUrl:e.rubyGemsOverride?.registryUrl,token:e.rubyGemsOverride?.apiKey,username:void 0};case"cratesOverride":return{registryUrl:e.cratesOverride?.registryUrl,token:e.cratesOverride?.token,username:void 0};case"postman":return{registryUrl:void 0,token:void 0,username:void 0};default:Ee(t)}}function Y3f(e){let t=e.registryOverrides;return t.npm!=null?{registryUrl:t.npm.registryUrl,token:t.npm.token,username:void 0}:t.maven!=null?{registryUrl:t.maven.registryUrl,token:t.maven.password,username:t.maven.username}:eOr.Empty}async function X3f({packageName:e,language:t,githubRepository:r,registryInfo:n}){let i=[];switch(t){case"typescript":i.push(await t4f(e,n));break;case"python":i.push(await n4f(e,n));break;case"java":i.push(await o4f(e,n));break;case"csharp":i.push(await a4f(e,n));break;case"ruby":i.push(await u4f(e,n));break;case"go":i.push(await l4f(e,n));break;case"rust":i.push(await f4f(e,n));break;case"php":case"swift":break}return r!=null&&(i.push(await d4f(r)),i.push(await m4f(r))),Z3f(i)}function Z3f(e){let t,r;for(let n of e){if(n==null)continue;let i=ZNt.default.parse(n,{loose:!0});i!=null&&(r==null||ZNt.default.gt(i,r))&&(t=n,r=i)}return t}function $3f(e){return e.registryUrl!=null&&e.registryUrl!==""?e.registryUrl:W3f}function e4f(e){return e.token!=null&&e.token!==""?e.token:process.env.NPM_TOKEN}async function t4f(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=$3f(t),n=e4f(t);if(n!=null){let i=encodeURIComponent(e).replace(/^%40/,"@"),o=await fetch(`${r}/${i}`,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",authorization:`Bearer ${n}`}});if(o.ok){let a=(await o.json())["dist-tags"]?.latest;if(a!=null)return a}}return await PQe(e)}catch{return}}function r4f(e){let t=e.registryUrl;return t==null||t===""||t.includes("upload.pypi.org")||t.includes("pypi.org/legacy")?Muc:`${t.replace(/\/+$/,"").replace(/\/legacy$/,"").replace(/\/simple$/,"")}/pypi`}async function n4f(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=r4f(t),n={},i=t.token??void 0;i!=null&&i!==""&&(n.authorization=`Bearer ${i}`);let s=Object.keys(n).length>0?await fetch(`${r}/${e}/json`,{headers:n}):await fetch(`${r}/${e}/json`);return s.ok?(await s.json()).info.version:void 0}catch{return}}function i4f(e){let t=e.registryUrl;return t==null||t===""||t.includes("oss.sonatype.org")||t.includes("s01.oss.sonatype.org")||t.includes("central.sonatype.com")||t.includes("search.maven.org"),mao}async function o4f(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=e.split(":");if(r.length<2||!r[0]||!r[1])return;let n=r[0],i=r[1],o=i4f(t),s={},a=t.token??void 0;if(a!=null&&a!==""){let p=t.username??"";s.authorization=`Basic ${Buffer.from(`${p}:${a}`).toString("base64")}`}let c=`${o}?q=g:${encodeURIComponent(n)}+AND+a:${encodeURIComponent(i)}&rows=1&wt=json`,l=Object.keys(s).length>0?await fetch(c,{headers:s}):await fetch(c);if(l.ok){let d=(await l.json()).response?.docs?.[0]?.latestVersion;if(d!=null)return d}return}catch{return}}function s4f(e){let t=e.registryUrl;return t==null||t===""||t.includes("nuget.org")?Luc:`${t.replace(/\/+$/,"")}/v3-flatcontainer`}async function a4f(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=s4f(t),n={},i=t.token??void 0;i!=null&&i!==""&&(n.authorization=`Basic ${Buffer.from(`:${i}`).toString("base64")}`);let o=`${r}/${e.toLowerCase()}/index.json`,a=Object.keys(n).length>0?await fetch(o,{headers:n}):await fetch(o);if(a.ok){let u=(await a.json()).versions??[];for(let l=u.length-1;l>=0;l--){let p=u[l];if(p!=null&&!p.includes("-"))return p}}return}catch{return}}function c4f(e){let t=e.registryUrl;return t==null||t===""||t.includes("rubygems.org")?Vuc:`${t.replace(/\/+$/,"")}/api/v1/gems`}async function u4f(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=c4f(t),n={},i=t.token??void 0;i!=null&&i!==""&&(n.authorization=i);let s=Object.keys(n).length>0?await fetch(`${r}/${e}.json`,{headers:n}):await fetch(`${r}/${e}.json`);if(s.ok){let a=await s.json();if(a.version!=null)return a.version}return}catch{return}}async function l4f(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{if(/\/v\d+$/.test(e))return await hao(e);let r=10,n=[];n.push(hao(e).then(s=>({version:s,major:0})));for(let s=2;s<=r;s++)n.push(hao(`${e}/v${s}`).then(a=>({version:a,major:s})));let i=await Promise.all(n),o;for(let s of i)s.version!=null&&(o==null||ZNt.default.gt(s.version,o))&&(o=s.version);return o}catch{return}}async function hao(e){try{let t=e.replace(/[A-Z]/g,n=>"!"+n.toLowerCase()),r=await fetch(`${H3f}/${t}/@latest`);if(r.ok){let n=await r.json();if(n.Version!=null)return n.Version.replace(/^v/,"")}return}catch{return}}function p4f(e){let t=e.registryUrl;return t==null||t===""||t.includes("crates.io")?Uuc:t.replace(/\/+$/,"")}async function f4f(e,t={registryUrl:void 0,token:void 0,username:void 0}){try{let r=p4f(t),n={"user-agent":"fern-cli (https://buildwithfern.com)"},i=t.token??void 0;i!=null&&i!==""&&(n.authorization=`Bearer ${i}`);let o=await fetch(`${r}/${e}`,{headers:n});if(o.ok){let a=(await o.json()).crate?.max_stable_version;if(a!=null)return a}return}catch{return}}async function d4f(e){try{return await NTr(e)}catch{return}}async function m4f(e){try{let t=await kTr(e,".fern/metadata.json");if(t!=null){let r=JSON.parse(t);if(r.sdkVersion!=null)return r.sdkVersion}return}catch{return}}function h4f(e){if(e.outputMode.type==="githubV2")return`${e.outputMode.githubV2.owner}/${e.outputMode.githubV2.repo}`}var ZNt,eOr,W3f,Muc,mao,Luc,Vuc,H3f,Uuc,Guc=h(()=>{"use strict";wt();MU();$Tr();ZNt=be(DE(),1);(function(e){e.Empty={registryUrl:void 0,token:void 0,username:void 0}})(eOr||(eOr={}));W3f="https://registry.npmjs.org",Muc="https://pypi.org/pypi",mao="https://search.maven.org/solrsearch/select",Luc="https://api.nuget.org/v3-flatcontainer",Vuc="https://rubygems.org/api/v1/gems",H3f="https://proxy.golang.org",Uuc="https://crates.io/api/v1/crates"});function JX(){let e=g4f(process.env.FERN_INVOKER);return e??(quc()?"ci":"manual")}function YX(){if(process.env.GITHUB_ACTIONS==="true")return"github";if(process.env.GITLAB_CI==="true")return"gitlab";if(process.env.BITBUCKET_BUILD_NUMBER!=null)return"bitbucket";if(process.env.CIRCLECI==="true")return"circleci";if(process.env.TRAVIS==="true")return"travis";if(process.env.JENKINS_URL!=null||process.env.JENKINS_HOME!=null)return"jenkins";if(process.env.TF_BUILD!=null)return"azure-pipelines";if(process.env.BUILDKITE==="true")return"buildkite";if(process.env.CODEBUILD_BUILD_ID!=null)return"codebuild";if(process.env.TEAMCITY_VERSION!=null)return"teamcity";if(process.env.DRONE==="true")return"drone";if(process.env.SEMAPHORE==="true")return"semaphore";if(process.env.APPVEYOR==="true"||process.env.APPVEYOR==="True")return"appveyor";if(quc())return"unknown"}function g4f(e){if(e==null)return;let t=e.trim().toLowerCase();switch(t){case"autopilot":case"autorelease":case"ci":case"manual":return t;default:return}}function quc(){return!!(process.env.CI||process.env.CONTINUOUS_INTEGRATION||process.env.GITHUB_ACTIONS||process.env.GITLAB_CI||process.env.CIRCLECI||process.env.TRAVIS||process.env.JENKINS_URL||process.env.JENKINS_HOME||process.env.TF_BUILD||process.env.BUILDKITE||process.env.CODEBUILD_BUILD_ID||process.env.TEAMCITY_VERSION||process.env.BITBUCKET_BUILD_NUMBER||process.env.DRONE||process.env.SEMAPHORE||process.env.APPVEYOR||process.env.BUDDY_WORKSPACE_ID||process.env.WERCKER_RUN_ID)}var Wuc=h(()=>{"use strict"});var Huc=h(()=>{"use strict"});var EQ,Kuc=h(()=>{"use strict";DWi();EQ=class extends fW{definition;sources;type="fern";constructor({definition:t,sources:r,...n}){super(n),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace({context:t},r,n,i){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}}});function rOr({generatorInvocation:e,version:t,userProvidedVersion:r,packageName:n,context:i}){if(e.language==="python"){let o=cd.pypi({version:t,packageName:n});return i.logger.debug(`Created PyPiPublishTarget: version ${t} package name: ${n}`),o}else if(e.language==="typescript"){if(r!=null){let o=n??(typeof e.raw?.config=="object"&&e.raw?.config!==null?e.raw.config.packageJson?.name:void 0),s=cd.npm({version:r,packageName:o,tokenEnvironmentVariable:""});return i.logger.debug(`Created NpmPublishTarget: version ${r} package name: ${o}`),s}return}else if(e.language==="rust"){let o=cd.crates({version:t,packageName:n});return i.logger.debug(`Created CratesPublishTarget: version ${t} package name: ${n}`),o}else if(e.language==="go"){if(r!=null){let o=(()=>{let a=e.raw?.config;if(typeof a!="object"||a===null)return;let c=a.module;if(!(c==null||typeof c.path!="string"))return c.path})(),s=cd.go({version:r,modulePath:o});return i.logger.debug(`Created GoPublishTarget: version ${r} module path: ${o}`),s}return}else if(e.language==="java"){let o=e.raw?.config,s=(()=>{if(!o||typeof o!="object"||o===null)return;let c=o;if(typeof c.group=="string"&&typeof c.artifact=="string")return{groupId:c.group,artifactId:c.artifact};if(typeof c["package-prefix"]=="string"&&n)return{groupId:c["package-prefix"],artifactId:n};typeof c["package-prefix"]=="string"&&!n&&i.logger.warn("Java generator has package-prefix configured but no package name could be resolved. Set 'package-name' (or 'group' and 'artifact') in the generator config to stamp Maven coordinates.")})(),a=s?`${s.groupId}:${s.artifactId}`:void 0;if(a){let c=t??"0.0.0",u=cd.maven({coordinate:a,version:c,usernameEnvironmentVariable:"MAVEN_USERNAME",passwordEnvironmentVariable:"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:"MAVEN_PUBLISH_REGISTRY_URL"});return i.logger.debug(`Created MavenPublishTarget: coordinate ${a} version ${c}`),u}else o&&typeof o=="object"&&i.logger.debug("Java generator config provided but could not construct Maven coordinate. Expected either 'group' and 'artifact' or 'package-prefix' with packageName.");return}else if(e.language==="ruby"){let o=cd.rubygems({version:t,packageName:n});return i.logger.debug(`Created RubyGemsPublishTarget: version ${t} package name: ${n}`),o}else if(e.language==="php"){let o=n??(()=>{let a=e.raw?.config;if(typeof a!="object"||a===null)return;let c=a.packageName;return typeof c=="string"?c:void 0})(),s=cd.packagist({version:t,packageName:o});return i.logger.debug(`Created PackagistPublishTarget: version ${t} package name: ${o}`),s}else if(e.language==="csharp"){if(r!=null){let o=n??(typeof e.raw?.config=="object"&&e.raw?.config!==null?e.raw.config["package-id"]:void 0),s=cd.nuget({version:r,packageName:typeof o=="string"?o:void 0});return i.logger.debug(`Created NugetPublishTarget: version ${r} package name: ${String(o)}`),s}return}}var Juc=h(()=>{"use strict";_n()});function XX(){if(process.env.IGNORE_GIT_IN_METADATA==="true")return"DUMMY";try{let e=(0,gao.execSync)("git rev-parse HEAD",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();return/^[0-9a-f]{40}$/.test(e)?e:void 0}catch{return}}function ZX(){if(process.env.IGNORE_GIT_IN_METADATA!=="true")try{return(0,gao.execSync)("git status --porcelain",{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim().length>0}catch{return}}var gao,Yuc=h(()=>{"use strict";gao=require("child_process")});function yao({document:e,errorResponses:t,schema:r}){if(!S4f(r))throw new Error("error-responses.schema must be an OpenAPI schema object or a $ref");let n=Aao(r);if(n.length>0)throw new Error(`error-responses.schema may only contain local "#/..." references into the OpenAPI document. Found: ${n.join(", ")}`);let i=t["apply-to"]??"all",o=t.ensure??[];for(let c of o)if(!$uc(c["status-code"].toString()))throw new Error(`error-responses.ensure.status-code must be between 400 and 599, got ${c["status-code"]}`);let s=y4f({schema:r,name:t.name}),a=new Set;for(let[c,u]of Object.entries(e.paths))if(u!=null)for(let l of Xuc){let p=u[l];if(p==null)continue;let d=p.responses??{};p.responses=d;for(let[f,m]of Object.entries(d)){if(!$uc(f))continue;let g=x4f({document:e,response:m});if(g!=null&&(i==="all"||!w4f(g))){let A=$Nt(m)?Lji(g):g;C4f({response:A,errorSchemaRef:s,responsePath:["paths",c,l,"responses",f],insertedRefPointers:a}),d[f]=A}}for(let f of o){let m=f["status-code"].toString();d[m]!=null||!(f.methods??Xuc).includes(l)||(d[m]={description:A4f[f["status-code"]]??`Error ${m}`,content:{[iOr]:{schema:s}}},a.add(sOr(["paths",c,l,"responses",m,"content",iOr,"schema"])))}}return $Nt(r)||b4f({document:e,schema:r,name:t.name,errorSchemaRef:s,insertedRefPointers:a}),e}function tlc({schema:e,name:t}){return t??e.title??elc}function y4f({schema:e,name:t}){return $Nt(e)?e:{$ref:`#/components/schemas/${rlc(tlc({schema:e,name:t}))}`}}function b4f({document:e,schema:t,name:r,errorSchemaRef:n,insertedRefPointers:i}){let o=tlc({schema:t,name:r}),s=e.components??{};e.components=s;let a=s.schemas??{};s.schemas=a;let c=a[o];if(c!=null&&!b0(c,t)){let u=E4f({document:e,schemaName:o,errorSchemaRef:n,insertedRefPointers:i});if(u.length>0)throw new Error(`error-responses: components.schemas already contains a different schema named "${o}" that is still referenced from ${u.join(", ")}. Set error-responses.name to an unused name, or reference the existing schema with \`schema: { $ref: "#/components/schemas/${o}" }\`.`)}a[o]=t}function E4f({document:e,schemaName:t,errorSchemaRef:r,insertedRefPointers:n}){let{responses:i,...o}=e.components??{},s=new Set,a=[],c=[],u=({ref:l,path:p})=>{let d=I4f(l);if(d!=null&&!s.has(d)&&(s.add(d),a.push(d)),l!==r.$ref)return;let f=sOr(p),[m,g,A]=p;!(m==="components"&&g==="schemas"&&A===t)&&!n.has(f)&&c.push(f)};oOr({...e,components:o},u);for(let l=a.pop();l!=null;l=a.pop())oOr(i?.[l],u,["components","responses",l]);return c}function I4f(e){if(!e.startsWith(Zuc))return;let[t]=e.slice(Zuc.length).split("/");return t==null||t===""?void 0:v4f(t)}function oOr(e,t,r=[]){if(Array.isArray(e)){e.forEach((i,o)=>{oOr(i,t,[...r,o.toString()])});return}if(!nOr(e))return;typeof e.$ref=="string"&&t({ref:e.$ref,path:r});let n=nOr(e.discriminator)?e.discriminator.mapping:void 0;if(nOr(n))for(let[i,o]of Object.entries(n))typeof o=="string"&&t({ref:o,path:[...r,"discriminator","mapping",i]});for(let[i,o]of Object.entries(e))i!=="$ref"&&i!=="discriminator"&&oOr(o,t,[...r,i])}function sOr(e){return`#/${e.map(rlc).join("/")}`}function rlc(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function v4f(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Aao(e,t=[]){if(Array.isArray(e))for(let r of e)Aao(r,t);else if(nOr(e))for(let[r,n]of Object.entries(e))r==="$ref"&&typeof n=="string"&&!n.startsWith("#/")?t.push(n):Aao(n,t);return t}function nOr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function x4f({document:e,response:t}){if(!$Nt(t))return t;let r="#/components/responses/";if(!t.$ref.startsWith(r))return;let n=e.components?.responses?.[t.$ref.slice(r.length)];if(!(n==null||$Nt(n)))return n}function C4f({response:e,errorSchemaRef:t,responsePath:r,insertedRefPointers:n}){let i=e.content??{};e.content=i;let o=Object.keys(i);if(o.length===0){i[iOr]={schema:t},n.add(sOr([...r,"content",iOr,"schema"]));return}for(let s of o){let a=i[s]??{};if(a.schema==null)i[s]={...a,schema:t};else{let{example:c,examples:u,...l}=a;i[s]={...l,schema:t}}n.add(sOr([...r,"content",s,"schema"]))}}function w4f(e){return Object.values(e.content??{}).some(t=>t.schema!=null)}function $uc(e){if(/^[45]XX$/i.test(e))return!0;let t=Number(e);return Number.isInteger(t)&&t>=400&&t<=599}function $Nt(e){return"$ref"in e}function S4f(e){return e.$ref===void 0||typeof e.$ref=="string"}var elc,iOr,Xuc,A4f,Zuc,nlc=h(()=>{"use strict";Vi();elc="ProblemDetails",iOr="application/json",Xuc=["get","post","put","patch","delete","head","options","trace"],A4f={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",408:"Request Timeout",409:"Conflict",410:"Gone",412:"Precondition Failed",413:"Payload Too Large",415:"Unsupported Media Type",422:"Unprocessable Entity",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"};Zuc="#/components/responses/"});function O4f(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,s={};for(let a of Object.keys(t))i.has(a)?s[a]=n?.[a]!==void 0?n[a]:t[a]:o.has(a)?s[a]=n?.[a]!==void 0?n[a]:r?.[a]!==void 0?r[a]:void 0:s[a]=n?.[a]??r?.[a]??t[a];return s}function BQe({options:e,overrides:t}){return O4f({defaults:T4f,options:e,overrides:t})}var T4f,bao=h(()=>{"use strict";aa();T4f={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!0,respectReadonlySchemas:!1,useReadVariantForResponses:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,respectOptionalRequestBody:!1,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,groupEnvironmentsByHost:!1,multiServerStrategy:wn.MultiServerStrategy.EnvironmentPerServer,removeDiscriminantsFromSchemas:wn.RemoveDiscriminantsFromSchemas.Always,inferDefaultEnvironment:!0}});var ilc=h(()=>{"use strict"});var olc=h(()=>{"use strict"});var vW,slc=h(()=>{"use strict";ac();vW={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return vW._visit(this,t)}}),xml:e=>({...e,type:"xml",_visit:function(t){return vW._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);case"xml":return t.xml(e);default:return t._other(e)}}}});var alc=h(()=>{"use strict"});var clc=h(()=>{"use strict"});var ulc=h(()=>{"use strict"});var llc=h(()=>{"use strict"});var plc=h(()=>{"use strict"});var flc=h(()=>{"use strict"});var dlc=h(()=>{"use strict"});var mlc=h(()=>{"use strict"});var hlc=h(()=>{"use strict"});var glc=h(()=>{"use strict"});var Alc=h(()=>{"use strict"});var ylc=h(()=>{"use strict"});var b1,blc=h(()=>{"use strict";ac();b1={basic:e=>({...e,type:"basic",_visit:function(t){return b1._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return b1._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return b1._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return b1._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return b1._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}}});var Elc=h(()=>{"use strict"});var Ilc=h(()=>{"use strict"});var vlc=h(()=>{"use strict"});var bD,xlc=h(()=>{"use strict";ac();bD={openapi:e=>({...e,type:"openapi",_visit:function(t){return bD._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return bD._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}}});var Clc=h(()=>{"use strict"});var wlc=h(()=>{"use strict"});var Slc=h(()=>{"use strict"});var Tlc=h(()=>{"use strict"});var Olc=h(()=>{"use strict"});var Plc=h(()=>{"use strict"});var Blc=h(()=>{"use strict"});var Dlc=h(()=>{"use strict"});var Rlc=h(()=>{"use strict"});var klc=h(()=>{"use strict"});var Flc=h(()=>{"use strict"});var Nlc=h(()=>{"use strict"});var jlc=h(()=>{"use strict"});var Qlc=h(()=>{"use strict"});var zlc=h(()=>{"use strict"});var Mlc=h(()=>{"use strict"});var Eao=h(()=>{"use strict";ilc();olc();slc();alc();clc();ulc();llc();plc();flc();dlc();mlc();hlc();glc();Alc();ylc();blc();Elc();Ilc();vlc();xlc();Clc();wlc();Slc();Tlc();Olc();Plc();Blc();Dlc();Rlc();klc();Flc();Nlc();jlc();Qlc();zlc();Mlc()});var Llc=h(()=>{"use strict";Eao()});var hc,Vlc=h(()=>{"use strict";ac();hc={primitive:e=>({value:e,type:"primitive",_visit:function(t){return hc._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return hc._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return hc._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return hc._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return hc._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return hc._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return hc._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return hc._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return hc._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"null":return t.null(e);case"unknown":return t.unknown(e.value);default:return t._other(e)}}}});var Ulc=h(()=>{"use strict"});var S0e,_lc=h(()=>{"use strict";ac();S0e={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return S0e._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return S0e._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}}});var Glc=h(()=>{"use strict"});var T0e,qlc=h(()=>{"use strict";ac();T0e={boolean:e=>({value:e,type:"boolean",_visit:function(t){return T0e._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return T0e._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}}});var Wlc=h(()=>{"use strict"});var Bo,Hlc=h(()=>{"use strict";ac();Bo={int:e=>({value:e,type:"int",_visit:function(t){return Bo._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return Bo._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return Bo._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return Bo._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return Bo._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return Bo._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Bo._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return Bo._visit(this,t)}}),datetimeRfc2822:e=>({value:e,type:"datetimeRfc2822",_visit:function(t){return Bo._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return Bo._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return Bo._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return Bo._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"datetimeRfc2822":return t.datetimeRfc2822(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}}});var Klc=h(()=>{"use strict"});var Iao=h(()=>{"use strict";Vlc();Ulc();_lc();Glc();qlc();Wlc();Hlc();Klc()});var Jlc=h(()=>{"use strict";Iao()});var Ylc=h(()=>{"use strict"});var Xlc=h(()=>{"use strict"});var D4f,O0e,Zlc=h(()=>{"use strict";D4f={RsaSha256:"rsa-sha256",RsaSha384:"rsa-sha384",RsaSha512:"rsa-sha512",EcdsaSha256:"ecdsa-sha256",EcdsaSha384:"ecdsa-sha384",EcdsaSha512:"ecdsa-sha512",Ed25519:"ed25519"},O0e={...D4f,_visit:(e,t)=>{switch(e){case O0e.RsaSha256:return t.rsaSha256();case O0e.RsaSha384:return t.rsaSha384();case O0e.RsaSha512:return t.rsaSha512();case O0e.EcdsaSha256:return t.ecdsaSha256();case O0e.EcdsaSha384:return t.ecdsaSha384();case O0e.EcdsaSha512:return t.ecdsaSha512();case O0e.Ed25519:return t.ed25519();default:return t._other()}}}});var $lc=h(()=>{"use strict"});var R4f,Zh,epc=h(()=>{"use strict";R4f={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",Alpha:"Alpha",Preview:"Preview",Legacy:"Legacy"},Zh={...R4f,_visit:(e,t)=>{switch(e){case Zh.GenerallyAvailable:return t.generallyAvailable();case Zh.Beta:return t.beta();case Zh.Deprecated:return t.deprecated();case Zh.Alpha:return t.alpha();case Zh.Preview:return t.preview();case Zh.Legacy:return t.legacy();default:return t._other()}}}});var tpc=h(()=>{"use strict"});var rpc=h(()=>{"use strict"});var npc=h(()=>{"use strict"});var ipc=h(()=>{"use strict"});var opc=h(()=>{"use strict"});var $X,spc=h(()=>{"use strict";ac();$X={language:e=>({...e,type:"language",_visit:function(t){return $X._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return $X._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}}});var apc=h(()=>{"use strict"});var cpc=h(()=>{"use strict"});var upc=h(()=>{"use strict"});var lpc=h(()=>{"use strict"});var k4f,vao,ppc=h(()=>{"use strict";k4f={Data:"data",Protocol:"protocol"},vao={...k4f,_visit:(e,t)=>{switch(e){case vao.Data:return t.data();case vao.Protocol:return t.protocol();default:return t._other()}}}});var fpc=h(()=>{"use strict"});var dpc=h(()=>{"use strict"});var LU,mpc=h(()=>{"use strict";ac();LU={unknown:e=>({value:e,type:"unknown",_visit:function(t){return LU._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return LU._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}}});var VU,hpc=h(()=>{"use strict";ac();VU={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return VU._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return VU._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}}});var gpc=h(()=>{"use strict"});var Apc=h(()=>{"use strict"});var ypc=h(()=>{"use strict"});var bpc=h(()=>{"use strict"});var Epc=h(()=>{"use strict"});var Ipc=h(()=>{"use strict"});var vpc=h(()=>{"use strict"});var xpc=h(()=>{"use strict"});var Cpc=h(()=>{"use strict"});var wpc=h(()=>{"use strict"});var Spc=h(()=>{"use strict"});var Tpc=h(()=>{"use strict"});var Opc=h(()=>{"use strict"});var Ppc=h(()=>{"use strict"});var Bpc=h(()=>{"use strict"});var Dpc=h(()=>{"use strict"});var Rpc=h(()=>{"use strict"});var kpc=h(()=>{"use strict"});var F4f,E1,Fpc=h(()=>{"use strict";F4f={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE"},E1={...F4f,_visit:(e,t)=>{switch(e){case E1.Get:return t.get();case E1.Post:return t.post();case E1.Put:return t.put();case E1.Patch:return t.patch();case E1.Delete:return t.delete();case E1.Head:return t.head();case E1.Options:return t.options();case E1.Trace:return t.trace();default:return t._other()}}}});var Npc=h(()=>{"use strict"});var jpc=h(()=>{"use strict"});var Qpc=h(()=>{"use strict"});var zpc=h(()=>{"use strict"});var Mpc=h(()=>{"use strict"});var Ty,Lpc=h(()=>{"use strict";ac();Ty={boolean:e=>({value:e,type:"boolean",_visit:function(t){return Ty._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Ty._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}}});var Vpc=h(()=>{"use strict"});var Upc=h(()=>{"use strict"});var _pc=h(()=>{"use strict"});var Gpc=h(()=>{"use strict"});var qpc=h(()=>{"use strict"});var N4f,xao,Wpc=h(()=>{"use strict";N4f={Json:"json",Form:"form"},xao={...N4f,_visit:(e,t)=>{switch(e){case xao.Json:return t.json();case xao.Form:return t.form();default:return t._other()}}}});var eZ,Hpc=h(()=>{"use strict";ac();eZ={file:e=>({...e,type:"file",_visit:function(t){return eZ._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return eZ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}}});var Kpc=h(()=>{"use strict"});var Jpc=h(()=>{"use strict"});var Ypc=h(()=>{"use strict"});var Xpc=h(()=>{"use strict"});var Zpc=h(()=>{"use strict"});var $pc=h(()=>{"use strict"});var tZ,efc=h(()=>{"use strict";ac();tZ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return tZ._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return tZ._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}}});var tfc=h(()=>{"use strict"});var rfc=h(()=>{"use strict"});var Lw,nfc=h(()=>{"use strict";ac();Lw={cursor:e=>({...e,type:"cursor",_visit:function(t){return Lw._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return Lw._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return Lw._visit(this,t)}}),uri:e=>({...e,type:"uri",_visit:function(t){return Lw._visit(this,t)}}),path:e=>({...e,type:"path",_visit:function(t){return Lw._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);case"uri":return t.uri(e);case"path":return t.path(e);default:return t._other(e)}}}});var ifc=h(()=>{"use strict"});var ofc=h(()=>{"use strict"});var sfc=h(()=>{"use strict"});var afc=h(()=>{"use strict"});var Ku,cfc=h(()=>{"use strict";ac();Ku={int:e=>({...e,type:"int",_visit:function(t){return Ku._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Ku._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Ku._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Ku._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Ku._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Ku._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Ku._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Ku._visit(this,e)}}),datetimeRfc2822:()=>({type:"datetimeRfc2822",_visit:function(e){return Ku._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Ku._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Ku._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Ku._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"datetimeRfc2822":return t.datetimeRfc2822();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}}});var ufc=h(()=>{"use strict"});var lfc=h(()=>{"use strict"});var pfc=h(()=>{"use strict"});var xW,ffc=h(()=>{"use strict";ac();xW={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return xW._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return xW._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return xW._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return xW._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}}});var AP,dfc=h(()=>{"use strict";ac();AP={file:e=>({...e,type:"file",_visit:function(t){return AP._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return AP._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return AP._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return AP._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return AP._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return AP._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return AP._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}}});var ejt,mfc=h(()=>{"use strict";ac();ejt={disabled:e=>({value:e,type:"disabled",_visit:function(t){return ejt._visit(this,t)}}),_visit:(e,t)=>e.type==="disabled"?t.disabled(e.value):t._other(e)}});var Aa,hfc=h(()=>{"use strict";ac();Aa={primitive:e=>({...e,type:"primitive",_visit:function(t){return Aa._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Aa._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Aa._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Aa._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Aa._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Aa._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Aa._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Aa._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Aa._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Aa._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Aa._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}}});var gfc=h(()=>{"use strict"});var Afc=h(()=>{"use strict"});var yfc=h(()=>{"use strict"});var bfc=h(()=>{"use strict"});var j4f,I1,Efc=h(()=>{"use strict";j4f={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm"},I1={...j4f,_visit:(e,t)=>{switch(e){case I1.Curl:return t.curl();case I1.Python:return t.python();case I1.Javascript:return t.javascript();case I1.Typescript:return t.typescript();case I1.Go:return t.go();case I1.Ruby:return t.ruby();case I1.Csharp:return t.csharp();case I1.Java:return t.java();case I1.Js:return t.js();case I1.Node:return t.node();case I1.Ts:return t.ts();case I1.Nodets:return t.nodets();case I1.Golang:return t.golang();case I1.Dotnet:return t.dotnet();case I1.Jvm:return t.jvm();default:return t._other()}}}});var Ifc=h(()=>{"use strict"});var vfc=h(()=>{"use strict"});var xfc=h(()=>{"use strict"});var Cfc=h(()=>{"use strict"});var wfc=h(()=>{"use strict"});var Sfc=h(()=>{"use strict"});var Q4f,tjt,Tfc=h(()=>{"use strict";Q4f={Sha256:"sha256",Sha1:"sha1",Sha384:"sha384",Sha512:"sha512"},tjt={...Q4f,_visit:(e,t)=>{switch(e){case tjt.Sha256:return t.sha256();case tjt.Sha1:return t.sha1();case tjt.Sha384:return t.sha384();case tjt.Sha512:return t.sha512();default:return t._other()}}}});var Ofc=h(()=>{"use strict"});var rjt,Pfc=h(()=>{"use strict";ac();rjt={queryParameter:e=>({...e,type:"queryParameter",_visit:function(t){return rjt._visit(this,t)}}),_visit:(e,t)=>e.type==="queryParameter"?t.queryParameter(e):t._other(e)}});var Bfc=h(()=>{"use strict"});var Dfc=h(()=>{"use strict"});var z4f,Cao,Rfc=h(()=>{"use strict";z4f={Get:"GET",Post:"POST"},Cao={...z4f,_visit:(e,t)=>{switch(e){case Cao.Get:return t.get();case Cao.Post:return t.post();default:return t._other()}}}});var kfc=h(()=>{"use strict"});var M4f,Ffc,Nfc=h(()=>{"use strict";M4f={Alphabetical:"alphabetical"},Ffc={...M4f,_visit:(e,t)=>e===Ffc.Alphabetical?t.alphabetical():t._other()}});var L4f,njt,jfc=h(()=>{"use strict";L4f={Body:"body",Timestamp:"timestamp",NotificationUrl:"notification-url",MessageId:"message-id"},njt={...L4f,_visit:(e,t)=>{switch(e){case njt.Body:return t.body();case njt.Timestamp:return t.timestamp();case njt.NotificationUrl:return t.notificationUrl();case njt.MessageId:return t.messageId();default:return t._other()}}}});var Qfc=h(()=>{"use strict"});var V4f,ijt,zfc=h(()=>{"use strict";V4f={Sha256:"sha256",Sha1:"sha1",Sha384:"sha384",Sha512:"sha512"},ijt={...V4f,_visit:(e,t)=>{switch(e){case ijt.Sha256:return t.sha256();case ijt.Sha1:return t.sha1();case ijt.Sha384:return t.sha384();case ijt.Sha512:return t.sha512();default:return t._other()}}}});var U4f,wao,Mfc=h(()=>{"use strict";U4f={Base64:"base64",Hex:"hex"},wao={...U4f,_visit:(e,t)=>{switch(e){case wao.Base64:return t.base64();case wao.Hex:return t.hex();default:return t._other()}}}});var DQe,Lfc=h(()=>{"use strict";ac();DQe={hmac:e=>({...e,type:"hmac",_visit:function(t){return DQe._visit(this,t)}}),asymmetric:e=>({...e,type:"asymmetric",_visit:function(t){return DQe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"hmac":return t.hmac(e);case"asymmetric":return t.asymmetric(e);default:return t._other(e)}}}});var Vfc=h(()=>{"use strict"});var _4f,aOr,Ufc=h(()=>{"use strict";_4f={UnixSeconds:"unix-seconds",UnixMillis:"unix-millis",Iso8601:"iso8601"},aOr={..._4f,_visit:(e,t)=>{switch(e){case aOr.UnixSeconds:return t.unixSeconds();case aOr.UnixMillis:return t.unixMillis();case aOr.Iso8601:return t.iso8601();default:return t._other()}}}});var _fc=h(()=>{"use strict"});var Gfc=h(()=>{"use strict"});var qfc=h(()=>{"use strict"});var G4f,Sao,Wfc=h(()=>{"use strict";G4f={Client:"client",Server:"server"},Sao={...G4f,_visit:(e,t)=>{switch(e){case Sao.Client:return t.client();case Sao.Server:return t.server();default:return t._other()}}}});var Hfc=h(()=>{"use strict"});var Kfc=h(()=>{"use strict"});var Jfc=h(()=>{"use strict"});var Tao=h(()=>{"use strict";Ylc();Xlc();Zlc();$lc();epc();tpc();rpc();npc();ipc();opc();spc();apc();cpc();upc();lpc();ppc();fpc();dpc();mpc();hpc();gpc();Apc();ypc();bpc();Epc();Ipc();vpc();xpc();Cpc();wpc();Spc();Tpc();Opc();Ppc();Bpc();Dpc();Rpc();kpc();Fpc();Npc();jpc();Qpc();zpc();Mpc();Lpc();Vpc();Upc();_pc();Gpc();qpc();Wpc();Hpc();Kpc();Jpc();Ypc();Xpc();Zpc();$pc();efc();tfc();rfc();nfc();ifc();ofc();sfc();afc();cfc();ufc();lfc();pfc();ffc();dfc();mfc();hfc();gfc();Afc();yfc();bfc();Efc();Ifc();vfc();xfc();Cfc();wfc();Sfc();Tfc();Ofc();Pfc();Bfc();Dfc();Rfc();kfc();Nfc();jfc();Qfc();zfc();Mfc();Lfc();Vfc();Ufc();_fc();Gfc();qfc();Wfc();Hfc();Kfc();Jfc()});var mm={};Z(mm,{AsymmetricAlgorithm:()=>O0e,Availability:()=>Zh,CustomCodeSample:()=>$X,DiscriminatorContext:()=>vao,EndpointExample:()=>LU,EndpointResponseExample:()=>VU,HttpMethod:()=>E1,LiteralSchemaValue:()=>Ty,MultipartRequestPropertyEncoding:()=>xao,MultipartSchema:()=>eZ,OneOfSchema:()=>tZ,Pagination:()=>Lw,PrimitiveSchemaValue:()=>Ku,Request:()=>xW,Response:()=>AP,RetriesConfiguration:()=>ejt,Schema:()=>Aa,SupportedSdkLanguage:()=>I1,WebhookBodyHashAlgorithm:()=>tjt,WebhookBodyHashLocation:()=>rjt,WebhookHttpMethod:()=>Cao,WebhookPayloadBodySort:()=>Ffc,WebhookPayloadComponent:()=>njt,WebhookSignatureAlgorithm:()=>ijt,WebhookSignatureEncoding:()=>wao,WebhookSignatureVerification:()=>DQe,WebhookTimestampFormat:()=>aOr,WebsocketMessageOrigin:()=>Sao});var Yfc=h(()=>{"use strict";Tao()});var Xfc=h(()=>{"use strict"});var Zfc=h(()=>{"use strict"});var $fc=h(()=>{"use strict"});var edc=h(()=>{"use strict"});var tdc=h(()=>{"use strict"});var rdc=h(()=>{"use strict"});var ndc=h(()=>{"use strict"});var idc=h(()=>{"use strict"});var odc=h(()=>{"use strict"});var sdc=h(()=>{"use strict"});var adc=h(()=>{"use strict"});var cdc=h(()=>{"use strict"});var udc=h(()=>{"use strict"});var ldc=h(()=>{"use strict"});var pdc=h(()=>{"use strict"});var fdc=h(()=>{"use strict"});var ddc=h(()=>{"use strict"});var mdc=h(()=>{"use strict"});var hdc=h(()=>{"use strict"});var gdc=h(()=>{"use strict"});var Adc=h(()=>{"use strict"});var ydc=h(()=>{"use strict"});var bdc=h(()=>{"use strict"});var U6,Edc=h(()=>{"use strict";ac();U6={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return U6._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return U6._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}}});var Idc=h(()=>{"use strict"});var vdc=h(()=>{"use strict"});var xdc=h(()=>{"use strict"});var Cdc=h(()=>{"use strict"});var wdc=h(()=>{"use strict"});var Ui,Sdc=h(()=>{"use strict";ac();Ui={int:e=>({...e,type:"int",_visit:function(t){return Ui._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Ui._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Ui._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Ui._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Ui._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Ui._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Ui._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Ui._visit(this,t)}}),datetimeRfc2822:e=>({...e,type:"datetimeRfc2822",_visit:function(t){return Ui._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Ui._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Ui._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Ui._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"datetimeRfc2822":return t.datetimeRfc2822(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}}});var Tdc=h(()=>{"use strict"});var Odc=h(()=>{"use strict"});var kF,Pdc=h(()=>{"use strict";ac();kF={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return kF._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return kF._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return kF._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return kF._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}}});var Ug,Bdc=h(()=>{"use strict";ac();Ug={file:e=>({...e,type:"file",_visit:function(t){return Ug._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Ug._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Ug._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return Ug._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Ug._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Ug._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Ug._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}}});var Wr,Ddc=h(()=>{"use strict";ac();Wr={primitive:e=>({...e,type:"primitive",_visit:function(t){return Wr._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Wr._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Wr._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Wr._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Wr._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Wr._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Wr._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Wr._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Wr._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Wr._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Wr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}}});var Rdc=h(()=>{"use strict"});var kdc=h(()=>{"use strict"});var Fdc=h(()=>{"use strict"});var Ndc=h(()=>{"use strict"});var jdc=h(()=>{"use strict"});var Qdc=h(()=>{"use strict"});var zdc=h(()=>{"use strict"});var Oao=h(()=>{"use strict";Xfc();Zfc();$fc();edc();tdc();rdc();ndc();idc();odc();sdc();adc();cdc();udc();ldc();pdc();fdc();ddc();mdc();hdc();gdc();Adc();ydc();bdc();Edc();Idc();vdc();xdc();Cdc();wdc();Sdc();Tdc();Odc();Pdc();Bdc();Ddc();Rdc();kdc();Fdc();Ndc();jdc();Qdc();zdc()});var Mdc=h(()=>{"use strict";Oao()});var Ldc=h(()=>{"use strict";Llc();Eao();Jlc();Iao();Yfc();Tao();Mdc();Oao()});var ac=h(()=>{"use strict";Ldc()});var CW,Vdc,ojt,Pao,VT0,Bao=h(()=>{"use strict";CW={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},Vdc={[CW.Debug]:1,[CW.Info]:2,[CW.Warn]:3,[CW.Error]:4},ojt=class{debug(t,...r){console.debug(t,...r)}info(t,...r){console.info(t,...r)}warn(t,...r){console.warn(t,...r)}error(t,...r){console.error(t,...r)}},Pao=class{level;logger;silent;constructor(t){this.level=Vdc[t.level],this.logger=t.logger,this.silent=t.silent}shouldLog(t){return!this.silent&&this.level<=Vdc[t]}isDebug(){return this.shouldLog(CW.Debug)}debug(t,...r){this.isDebug()&&this.logger.debug(t,...r)}isInfo(){return this.shouldLog(CW.Info)}info(t,...r){this.isInfo()&&this.logger.info(t,...r)}isWarn(){return this.shouldLog(CW.Warn)}warn(t,...r){this.isWarn()&&this.logger.warn(t,...r)}isError(){return this.shouldLog(CW.Error)}error(t,...r){this.isError()&&this.logger.error(t,...r)}},VT0=new Pao({level:CW.Info,logger:new ojt,silent:!0})});var Udc,_dc=h(()=>{"use strict";Bao();(function(e){e.LogLevel=CW,e.ConsoleLogger=ojt})(Udc||(Udc={}))});var Gdc=h(()=>{"use strict";_dc()});var qdc=h(()=>{"use strict";Gdc()});var Wdc=h(()=>{"use strict"});var Hdc=h(()=>{"use strict";Bao()});var Kdc=h(()=>{"use strict"});var Ju,Vw=h(()=>{"use strict";Ju={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"}});function hm(e,t){return`Expected ${t}. Received ${K4f(e)}.`}function K4f(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}var FF=h(()=>{"use strict"});function v1(e){return{...e,json:Jdc(e.json),parse:Jdc(e.parse)}}function Jdc(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
175
- `)),{ok:!0,value:t}):n}}var rZ=h(()=>{"use strict"});function cOr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Dao=h(()=>{"use strict"});var UXe,Rao=h(()=>{"use strict";Dao();UXe=class e extends Error{errors;constructor(t){super(t.map(cOr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}}});var _Xe,kao=h(()=>{"use strict";Dao();_Xe=class e extends Error{errors;constructor(t){super(t.map(cOr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}}});function $m(e){return{nullable:()=>J4f(e),optional:()=>Fao(e),optionalNullable:()=>Y4f(e),transform:t=>Nao(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new _Xe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new UXe(n.errors)}}}function J4f(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Ju.NULLABLE};return{...t,...$m(t)}}function Fao(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Ju.OPTIONAL};return{...t,...$m(t)}}function Y4f(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>Ju.OPTIONAL_NULLABLE};return{...t,...$m(t)}}function Nao(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...$m(r)}}var Ydc=h(()=>{"use strict";Vw();Rao();kao()});var IQ=h(()=>{"use strict";Ydc();Rao();kao()});function Xdc(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:hm(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:hm(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Ju.BIGINT};return{...v1(e),...$m(e)}}var Zdc=h(()=>{"use strict";Vw();FF();rZ();IQ()});var $dc=h(()=>{"use strict";Zdc()});function emc(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:hm(t,"string")}]}:X4f.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:hm(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:hm(t,"Date object")}]},getType:()=>Ju.DATE};return{...v1(e),...$m(e)}}var X4f,tmc=h(()=>{"use strict";Vw();FF();rZ();IQ();X4f=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/});var rmc=h(()=>{"use strict";tmc()});function x1(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...v1(r),...$m(r)}}}var nZ=h(()=>{"use strict";IQ();rZ()});function uOr(e){let t=new Set(e);return x1(Ju.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:hm(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:hm(n,"enum")}]}:{ok:!0,value:n})()}var nmc=h(()=>{"use strict";Vw();nZ();FF()});var jao=h(()=>{"use strict";nmc()});function imc(e){let t=Qao(e);return{...t,...$m(t)}}function Qao(e){return{parse:(t,r)=>GXe(e).parse(t,r),json:(t,r)=>GXe(e).json(t,r),getType:()=>GXe(e).getType()}}function GXe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}var zao=h(()=>{"use strict";IQ()});function Mao(e){return Object.entries(e)}var omc=h(()=>{"use strict"});function sjt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}var Lao=h(()=>{"use strict"});function Lle(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}var ajt=h(()=>{"use strict"});function cjt(e){return Object.keys(e)}var Vao=h(()=>{"use strict"});function smc(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var amc=h(()=>{"use strict"});function wW(e){return{withParsedProperties:t=>Uao(e,t)}}function Uao(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(Z4f.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Lle(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:hm(n,"object")}]};let o=new Set(Object.keys(t)),s=sjt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...$m(r),...wW(r)}}var Z4f,cmc=h(()=>{"use strict";Lao();FF();ajt();IQ();Z4f=Object.prototype.hasOwnProperty});var ujt=h(()=>{"use strict";cmc()});function umc(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Vle(e){return e.isProperty}var _ao=h(()=>{"use strict"});function lOr(e){let t;function r(){if(t==null){t={};for(let[d,f]of Mao(e)){let m=Vle(f)?f.rawKey:d,g=Vle(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:g}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of Mao(e)){let m=Vle(f)?f.rawKey:d,g=Vle(f)?f.valueSchema:f;eVf(g)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Vle(f)?f.rawKey:d),_getParsedProperties:()=>cjt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return lmc({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:g=>{let A=r()[g];if(A!=null)return{transformedKey:A.parsedKey,transform:y=>{let E=[...m,g];return A.valueSchema.parse(y,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return lmc({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:g=>{let A=e[g];if(A!=null)return Vle(A)?{transformedKey:A.rawKey,transform:y=>{let E=[...m,g];return A.valueSchema.json(y,{...f,breadcrumbsPrefix:E})}}:{transformedKey:g,transform:y=>{let E=[...m,g];return A.json(y,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>Ju.OBJECT};return{...v1(p),...$m(p),...wW(p),...RQe(p)}}function lmc({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Lle(e))return{ok:!1,errors:[{path:s,message:hm(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!$4f.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function RQe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>pmc({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>pmc({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Ju.OBJECT};return{...r,...$m(r),...wW(r),...RQe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>Ju.OBJECT};return{...n,...$m(n),...wW(n),...RQe(n)}}}}function pmc({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Lle(t))return{ok:!1,errors:[{path:i,message:hm(t,"object")}]};let o=new Set(e),[s,a]=smc(cjt(t),l=>o.has(l)),c=r(sjt(t,a)),u=n(sjt(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function eVf(e){return!tVf(e)}function tVf(e){switch(e.getType()){case Ju.ANY:case Ju.UNKNOWN:case Ju.OPTIONAL:case Ju.OPTIONAL_NULLABLE:return!0;default:return!1}}var $4f,Gao=h(()=>{"use strict";Vw();omc();Lao();FF();ajt();Vao();rZ();amc();ujt();IQ();_ao();$4f=Object.prototype.hasOwnProperty});function fmc(e){return lOr(e)}var dmc=h(()=>{"use strict";Gao()});var qao=h(()=>{"use strict";Gao();dmc();_ao()});function mmc(e){let t={...Qao(e),_getRawProperties:()=>GXe(e)._getRawProperties(),_getParsedProperties:()=>GXe(e)._getParsedProperties()};return{...t,...$m(t),...wW(t),...RQe(t)}}var hmc=h(()=>{"use strict";qao();ujt();IQ();zao()});var gmc=h(()=>{"use strict";zao();hmc()});function pOr(e){let t={parse:(r,n)=>Amc(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>Amc(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Ju.LIST};return{...v1(t),...$m(t)}}function Amc(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:hm(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}var ymc=h(()=>{"use strict";Vw();FF();rZ();IQ()});var Wao=h(()=>{"use strict";ymc()});function bmc(e){return x1(Ju.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:hm(r,`${e.toString()}`)}]})()}var Emc=h(()=>{"use strict";Vw();nZ();FF()});function Imc(e){return x1(Ju.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:hm(r,`"${e}"`)}]})()}var vmc=h(()=>{"use strict";Vw();nZ();FF()});var xmc=h(()=>{"use strict";Emc();vmc()});var Cmc,wmc=h(()=>{"use strict";Vw();nZ();Cmc=x1(Ju.ANY,e=>({ok:!0,value:e}))});var Smc,Tmc=h(()=>{"use strict";Vw();nZ();FF();Smc=x1(Ju.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:hm(e,"boolean")}]})});var Omc,Pmc=h(()=>{"use strict";Vw();nZ();Omc=x1(Ju.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}))});var Bmc,Dmc=h(()=>{"use strict";Vw();nZ();FF();Bmc=x1(Ju.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:hm(e,"number")}]})});var Rmc,kmc=h(()=>{"use strict";Vw();nZ();FF();Rmc=x1(Ju.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:hm(e,"string")}]})});var Fmc,Nmc=h(()=>{"use strict";Vw();nZ();Fmc=x1(Ju.UNKNOWN,e=>({ok:!0,value:e}))});var jmc=h(()=>{"use strict";wmc();Tmc();Pmc();Dmc();kmc();Nmc()});function zmc(e,t){let r={parse:(n,i)=>Qmc({value:n,isKeyNumeric:e.getType()===Ju.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>Qmc({value:n,isKeyNumeric:e.getType()===Ju.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Ju.RECORD};return{...v1(r),...$m(r)}}function Qmc({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Lle(e))return{ok:!1,errors:[{path:i,message:hm(e,"object")}]};let o={},s=[];for(let a in e){if(!rVf.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}var rVf,Mmc=h(()=>{"use strict";Vw();FF();ajt();rZ();IQ();rVf=Object.prototype.hasOwnProperty});var Lmc=h(()=>{"use strict";Mmc()});function Vmc(e){let t=pOr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:hm(n,"Set")}]},getType:()=>Ju.SET};return{...v1(r),...$m(r)}}var Umc=h(()=>{"use strict";Vw();FF();rZ();Wao();IQ()});var _mc=h(()=>{"use strict";Umc()});function qmc(e){let t={parse:(r,n)=>Gmc((i,o)=>i.parse(r,o),e,n),json:(r,n)=>Gmc((i,o)=>i.json(r,o),e,n),getType:()=>Ju.UNDISCRIMINATED_UNION};return{...v1(t),...$m(t)}}function Gmc(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}var Wmc=h(()=>{"use strict";Vw();rZ();IQ()});var Hmc=h(()=>{"use strict";Wmc()});function Kmc(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var Jmc=h(()=>{"use strict"});function Xmc(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=uOr(cjt(t)),o={parse:(s,a)=>Ymc({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>Ymc({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>Ju.UNION};return{...v1(o),...$m(o),...wW(o)}}function Ymc({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Lle(e))return{ok:!1,errors:[{path:a,message:hm(e,"object")}]};let c=e[t],u={};for(let f in e)nVf.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var nVf,Zmc=h(()=>{"use strict";Vw();FF();ajt();Vao();rZ();jao();ujt();IQ();nVf=Object.prototype.hasOwnProperty});var $mc=h(()=>{"use strict";Jmc();Zmc()});var ehc=h(()=>{"use strict";$dc();rmc();jao();gmc();Wao();xmc();qao();ujt();jmc();Lmc();IQ();_mc();Hmc();$mc()});var ee={};Z(ee,{JsonError:()=>UXe,ParseError:()=>_Xe,any:()=>Cmc,bigint:()=>Xdc,boolean:()=>Smc,booleanLiteral:()=>bmc,date:()=>emc,discriminant:()=>Kmc,enum_:()=>uOr,getObjectLikeUtils:()=>wW,getObjectUtils:()=>RQe,getSchemaUtils:()=>$m,isProperty:()=>Vle,lazy:()=>imc,lazyObject:()=>mmc,list:()=>pOr,never:()=>Omc,number:()=>Bmc,object:()=>lOr,objectWithoutOptionalProperties:()=>fmc,optional:()=>Fao,property:()=>umc,record:()=>zmc,set:()=>Vmc,string:()=>Rmc,stringLiteral:()=>Imc,transform:()=>Nao,undiscriminatedUnion:()=>qmc,union:()=>Xmc,unknown:()=>Fmc,withParsedProperties:()=>Uao});var thc=h(()=>{"use strict";ehc()});var rhc=h(()=>{"use strict"});var yr=h(()=>{"use strict";Wdc();Hdc();Kdc();thc();rhc()});var fOr,Hao=h(()=>{"use strict";yr();fOr=ee.objectWithoutOptionalProperties({usernameVariableName:ee.string().optional(),usernameEnvVar:ee.string().optional(),usernamePlaceholder:ee.string().optional(),passwordVariableName:ee.string().optional(),passwordEnvVar:ee.string().optional(),passwordPlaceholder:ee.string().optional()})});var dOr,Kao=h(()=>{"use strict";yr();dOr=ee.objectWithoutOptionalProperties({tokenVariableName:ee.string().optional(),tokenEnvVar:ee.string().optional(),tokenPlaceholder:ee.string().optional()})});var mOr,Jao=h(()=>{"use strict";yr();mOr=ee.objectWithoutOptionalProperties({typeName:ee.string()})});var hOr,Yao=h(()=>{"use strict";yr();hOr=ee.objectWithoutOptionalProperties({name:ee.string(),namespace:ee.string().optional(),prefix:ee.string().optional()})});var gOr,Xao=h(()=>{"use strict";ac();yr();Jao();Yao();gOr=ee.union("type",{protobuf:mOr,xml:hOr}).transform({transform:e=>{switch(e.type){case"protobuf":return vW.protobuf(e);case"xml":return vW.xml(e);default:return e}},untransform:({_visit:e,...t})=>t})});var qXe,AOr=h(()=>{"use strict";yr();qXe=ee.string()});var yOr,Zao=h(()=>{"use strict";yr();yOr=ee.objectWithoutOptionalProperties({headerName:ee.string(),prefix:ee.string().optional(),headerVariableName:ee.string().optional(),headerEnvVar:ee.string().optional(),headerPlaceholder:ee.string().optional()})});var bOr,$ao=h(()=>{"use strict";yr();bOr=ee.objectWithoutOptionalProperties({type:ee.stringLiteral("namespace"),name:ee.string()})});var EOr,eco=h(()=>{"use strict";yr();EOr=ee.string()});var IOr,tco=h(()=>{"use strict";yr();IOr=ee.enum_(["GenerallyAvailable","Beta","Deprecated","Alpha","Preview","Legacy"])});var ds,ud=h(()=>{"use strict";yr();tco();ds=ee.objectWithoutOptionalProperties({availability:IOr.optional()})});var Nn,ya=h(()=>{"use strict";yr();Nn=ee.objectWithoutOptionalProperties({description:ee.string().optional()})});var zd,C1=h(()=>{"use strict";yr();zd=ee.objectWithoutOptionalProperties({inline:ee.boolean().optional()})});var $c,Oy=h(()=>{"use strict";yr();$c=ee.objectWithoutOptionalProperties({nameOverride:ee.string().optional(),generatedName:ee.string()})});var gc,EA=h(()=>{"use strict";yr();gc=ee.objectWithoutOptionalProperties({namespace:ee.string().optional()})});var vOr,rco=h(()=>{"use strict";yr();$ao();vOr=ee.undiscriminatedUnion([ee.string(),bOr])});var P0e,ljt=h(()=>{"use strict";yr();rco();P0e=ee.list(vOr)});var Yu,B0=h(()=>{"use strict";yr();ljt();Yu=ee.objectWithoutOptionalProperties({groupName:P0e.optional()})});var xOr,nco=h(()=>{"use strict";yr();xOr=ee.objectWithoutOptionalProperties({file:ee.string()})});var COr,ico=h(()=>{"use strict";yr();COr=ee.objectWithoutOptionalProperties({file:ee.string()})});var wOr,oco=h(()=>{"use strict";ac();yr();nco();ico();wOr=ee.union("type",{openapi:xOr,protobuf:COr}).transform({transform:e=>{switch(e.type){case"openapi":return bD.openapi(e);case"protobuf":return bD.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t})});var Jo,Pf=h(()=>{"use strict";yr();oco();Jo=ee.objectWithoutOptionalProperties({source:wOr.optional()})});var Xu,D0=h(()=>{"use strict";yr();Xu=ee.objectWithoutOptionalProperties({title:ee.string().optional()})});var SOr,sco=h(()=>{"use strict";yr();SOr=ee.objectWithoutOptionalProperties({snake:ee.string().optional(),camel:ee.string().optional(),screamingSnake:ee.string().optional(),pascal:ee.string().optional()})});var B0e,TOr=h(()=>{"use strict";yr();ud();ya();sco();B0e=ee.objectWithoutOptionalProperties({nameOverride:ee.string().optional(),generatedName:ee.string(),value:ee.string(),casing:SOr.optional()}).extend(Nn).extend(ds)});var WXe,OOr=h(()=>{"use strict";yr();ud();ya();C1();Oy();EA();B0();Pf();D0();TOr();WXe=ee.objectWithoutOptionalProperties({default:B0e.optional(),values:ee.list(B0e)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Jo).extend(Xu).extend(zd)});var POr,aco=h(()=>{"use strict";yr();OOr();POr=ee.objectWithoutOptionalProperties({scopesEnum:WXe.optional()})});var BOr,cco=h(()=>{"use strict";yr();BOr=ee.objectWithoutOptionalProperties({queryParameterName:ee.string()})});var NF,D0e=h(()=>{"use strict";yr();NF=ee.string()});var DOr,uco=h(()=>{"use strict";ac();yr();Hao();Kao();Zao();aco();cco();DOr=ee.union("type",{basic:fOr,bearer:dOr,header:yOr,query:BOr,oauth:POr}).transform({transform:e=>{switch(e.type){case"basic":return b1.basic(e);case"bearer":return b1.bearer(e);case"header":return b1.header(e);case"query":return b1.query(e);case"oauth":return b1.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t})});var R0e,pjt=h(()=>{"use strict";yr();R0e=ee.string()});var ROr,lco=h(()=>{"use strict";yr();ROr=ee.objectWithoutOptionalProperties({id:ee.string(),default:ee.string().optional(),values:ee.list(ee.string()).optional()})});var fjt,pco=h(()=>{"use strict";yr();lco();ya();fjt=ee.objectWithoutOptionalProperties({name:ee.string().optional(),url:ee.string(),audiences:ee.list(ee.string()).optional(),defaultUrl:ee.string().optional(),urlTemplate:ee.string().optional(),variables:ee.list(ROr).optional()}).extend(Nn)});var HXe,kOr=h(()=>{"use strict";yr();HXe=ee.number()});var jF,k0e=h(()=>{"use strict";yr();jF=ee.string()});var FOr,fco=h(()=>{"use strict";yr();k0e();ya();FOr=ee.objectWithoutOptionalProperties({id:jF}).extend(Nn)});var w1,iZ=h(()=>{"use strict";yr();Xao();w1=ee.objectWithoutOptionalProperties({encoding:gOr.optional()})});var oZ,KXe=h(()=>{"use strict";yr();oZ=ee.objectWithoutOptionalProperties({sdkMethodName:ee.string().optional()})});var UU,kQe=h(()=>{"use strict";yr();kOr();UU=ee.objectWithoutOptionalProperties({statusCode:HXe.optional()})});var JXe,NOr=h(()=>{"use strict";yr();JXe=ee.objectWithoutOptionalProperties({name:ee.string().optional(),attribute:ee.boolean().optional(),text:ee.boolean().optional(),wrapped:ee.boolean().optional(),separator:ee.string().optional()})});var dco=h(()=>{"use strict";Hao();Kao();Xao();AOr();Zao();$ao();eco();aco();nco();Jao();ico();cco();D0e();rco();ljt();uco();pjt();pco();lco();oco();kOr();fco();k0e();ud();ya();iZ();C1();Oy();EA();B0();KXe();Pf();kQe();D0();Yao();NOr()});var mco={};Z(mco,{BasicSecurityScheme:()=>fOr,BearerSecurityScheme:()=>dOr,Encoding:()=>gOr,ErrorStatusCodeKey:()=>qXe,HeaderSecurityScheme:()=>yOr,Namespace:()=>bOr,NamespaceId:()=>EOr,OauthSecurityScheme:()=>POr,OpenApiSource:()=>xOr,ProtobufEncoding:()=>mOr,ProtobufSource:()=>COr,QuerySecurityScheme:()=>BOr,SchemaId:()=>NF,SdkGroup:()=>vOr,SdkGroupName:()=>P0e,SecurityScheme:()=>DOr,SecuritySchemeId:()=>R0e,Server:()=>fjt,ServerVariable:()=>ROr,Source:()=>wOr,StatusCode:()=>HXe,Tag:()=>FOr,TagId:()=>jF,WithAvailability:()=>ds,WithDescription:()=>Nn,WithEncoding:()=>w1,WithInline:()=>zd,WithName:()=>$c,WithNamespace:()=>gc,WithSdkGroupName:()=>Yu,WithSdkMethodName:()=>oZ,WithSource:()=>Jo,WithStatusCode:()=>UU,WithTitle:()=>Xu,XmlEncoding:()=>hOr,XmlPropertyEncoding:()=>JXe});var nhc=h(()=>{"use strict";dco()});var jOr,hco=h(()=>{"use strict";ac();yr();jOr=ee.union("type",{boolean:ee.object({value:ee.boolean()}),string:ee.object({value:ee.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return T0e.boolean(e.value);case"string":return T0e.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var QOr,gco=h(()=>{"use strict";yr();QOr=ee.objectWithoutOptionalProperties({})});var YXe,zOr=h(()=>{"use strict";ac();yr();YXe=ee.union("type",{int:ee.object({value:ee.number()}),int64:ee.object({value:ee.number()}),uint:ee.object({value:ee.number()}),uint64:ee.object({value:ee.number()}),float:ee.object({value:ee.number()}),double:ee.object({value:ee.number()}),string:ee.object({value:ee.string()}),datetime:ee.object({value:ee.string()}),datetimeRfc2822:ee.object({value:ee.string()}),date:ee.object({value:ee.string()}),base64:ee.object({value:ee.string()}),boolean:ee.object({value:ee.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return Bo.int(e.value);case"int64":return Bo.int64(e.value);case"uint":return Bo.uint(e.value);case"uint64":return Bo.uint64(e.value);case"float":return Bo.float(e.value);case"double":return Bo.double(e.value);case"string":return Bo.string(e.value);case"datetime":return Bo.datetime(e.value);case"datetimeRfc2822":return Bo.datetimeRfc2822(e.value);case"date":return Bo.date(e.value);case"base64":return Bo.base64(e.value);case"boolean":return Bo.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var $h,ihc=h(()=>{"use strict";ac();yr();ja();hco();gco();zOr();$h=ee.union("type",{primitive:ee.object({value:YXe}),object:ee.lazyObject(()=>MOr),array:ee.object({value:ee.list(ee.lazy(()=>$h))}),map:ee.object({value:ee.list(ee.lazyObject(()=>VOr))}),enum:ee.object({value:ee.string()}),literal:ee.object({value:jOr}),oneOf:ee.object({value:ee.lazy(()=>LOr)}),null:QOr,unknown:ee.object({value:ee.lazy(()=>$h)})}).transform({transform:e=>{switch(e.type){case"primitive":return hc.primitive(e.value);case"object":return hc.object(e);case"array":return hc.array(e.value);case"map":return hc.map(e.value);case"enum":return hc.enum(e.value);case"literal":return hc.literal(e.value);case"oneOf":return hc.oneOf(e.value);case"null":return hc.null(e);case"unknown":return hc.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var XXe,UOr=h(()=>{"use strict";yr();XXe=ee.string()});var MOr,ohc=h(()=>{"use strict";yr();ja();UOr();MOr=ee.objectWithoutOptionalProperties({properties:ee.record(XXe,ee.lazy(()=>$h))})});var LOr,shc=h(()=>{"use strict";ac();yr();ja();UOr();LOr=ee.union("type",{discriminated:ee.object({value:ee.record(XXe,ee.lazy(()=>$h))}),undiscriminated:ee.object({value:ee.lazy(()=>$h)})}).transform({transform:e=>{switch(e.type){case"discriminated":return S0e.discriminated(e.value);case"undiscriminated":return S0e.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var VOr,ahc=h(()=>{"use strict";yr();ja();zOr();VOr=ee.objectWithoutOptionalProperties({key:YXe,value:ee.lazy(()=>$h)})});var Aco=h(()=>{"use strict";ihc();ohc();shc();ahc();hco();gco();zOr();UOr()});var yco={};Z(yco,{FullExample:()=>$h,FullObjectExample:()=>MOr,FullOneOfExample:()=>LOr,KeyValuePair:()=>VOr,LiteralExample:()=>jOr,NullExample:()=>QOr,PrimitiveExample:()=>YXe,PropertyKey:()=>XXe});var chc=h(()=>{"use strict";Aco()});var ZXe,_Or=h(()=>{"use strict";yr();D0e();ZXe=ee.objectWithoutOptionalProperties({propertyKey:ee.string(),allOfSchemaIds:ee.list(NF),conflictingTypeSignatures:ee.boolean()})});var GOr,uhc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();GOr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Sl),minItems:ee.number().optional(),maxItems:ee.number().optional(),default:ee.unknown().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var qOr,bco=h(()=>{"use strict";yr();qOr=ee.enum_(["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"])});var WOr,Eco=h(()=>{"use strict";yr();WOr=ee.enum_(["alphabetical"])});var HOr,Ico=h(()=>{"use strict";yr();HOr=ee.enum_(["body","timestamp","notification-url","message-id"])});var $Xe,KOr=h(()=>{"use strict";yr();Eco();Ico();$Xe=ee.objectWithoutOptionalProperties({components:ee.list(HOr),delimiter:ee.string().optional(),bodySort:WOr.optional()})});var F0e,djt=h(()=>{"use strict";yr();F0e=ee.enum_(["base64","hex"])});var JOr,vco=h(()=>{"use strict";yr();JOr=ee.enum_(["unix-seconds","unix-millis","iso8601"])});var eZe,YOr=h(()=>{"use strict";yr();vco();eZe=ee.objectWithoutOptionalProperties({header:ee.string(),format:JOr.optional(),tolerance:ee.number().optional()})});var XOr,xco=h(()=>{"use strict";yr();bco();KOr();djt();YOr();XOr=ee.objectWithoutOptionalProperties({header:ee.string(),asymmetricAlgorithm:qOr,encoding:F0e.optional(),signaturePrefix:ee.string().optional(),jwksUrl:ee.string().optional(),keyIdHeader:ee.string().optional(),payloadFormat:$Xe.optional(),timestamp:eZe.optional()})});var ZOr,Cco=h(()=>{"use strict";yr();ZOr=ee.objectWithoutOptionalProperties({default:ee.boolean().optional()})});var tZe,$Or=h(()=>{"use strict";yr();ya();Pf();kQe();tZe=ee.objectWithoutOptionalProperties({}).extend(Nn).extend(Jo).extend(UU)});var rZe,lhc=h(()=>{"use strict";yr();ja();rZe=ee.objectWithoutOptionalProperties({key:ee.string(),schema:ee.lazy(()=>Sl)})});var ePr,wco=h(()=>{"use strict";yr();ePr=ee.objectWithoutOptionalProperties({cursor:ee.string(),nextCursor:ee.property("next_cursor",ee.string()),results:ee.string()})});var tPr,Sco=h(()=>{"use strict";yr();ya();tPr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),language:ee.string(),code:ee.string(),install:ee.string().optional()}).extend(Nn)});var rPr,Tco=h(()=>{"use strict";yr();rPr=ee.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"])});var nPr,Oco=h(()=>{"use strict";yr();ya();Tco();nPr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),sdk:rPr,code:ee.string()}).extend(Nn)});var iPr,Pco=h(()=>{"use strict";ac();yr();Sco();Oco();iPr=ee.union("type",{language:tPr,sdk:nPr}).transform({transform:e=>{switch(e.type){case"language":return $X.language(e);case"sdk":return $X.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t})});var oPr,Bco=h(()=>{"use strict";yr();oPr=ee.objectWithoutOptionalProperties({results:ee.string()})});var nZe,sPr=h(()=>{"use strict";yr();nZe=ee.enum_(["data","protocol"])});var aPr,phc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();sPr();aPr=ee.objectWithoutOptionalProperties({discriminantProperty:ee.string(),discriminantPropertyNameOverride:ee.string().optional(),discriminatorContext:nZe.optional(),defaultDiscriminantValue:ee.string().optional(),commonProperties:ee.list(ee.lazyObject(()=>rZe)),schemas:ee.record(ee.string(),ee.lazy(()=>Sl))}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var cPr,Dco=h(()=>{"use strict";yr();cPr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),minimum:ee.number().optional(),maximum:ee.number().optional(),exclusiveMinimum:ee.boolean().optional(),exclusiveMaximum:ee.boolean().optional(),multipleOf:ee.number().optional()})});var uPr,Rco=h(()=>{"use strict";yr();uPr=ee.unknown()});var lPr,kco=h(()=>{"use strict";yr();ja();lPr=ee.objectWithoutOptionalProperties({sse:ee.boolean(),events:ee.list(ee.lazy(()=>$h))})});var pPr,Fco=h(()=>{"use strict";ac();yr();ja();kco();pPr=ee.union("type",{withStreaming:lPr,withoutStreaming:ee.object({value:ee.lazy(()=>$h)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return VU.withStreaming(e);case"withoutStreaming":return VU.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var iZe,fPr=h(()=>{"use strict";yr();ja();iZe=ee.objectWithoutOptionalProperties({name:ee.string(),value:ee.lazy(()=>$h)})});var dPr,Nco=h(()=>{"use strict";yr();ja();dPr=ee.objectWithoutOptionalProperties({name:ee.string(),parameterNameOverride:ee.string().optional(),value:ee.lazy(()=>$h)})});var oZe,mPr=h(()=>{"use strict";yr();ja();oZe=ee.objectWithoutOptionalProperties({name:ee.string(),value:ee.lazy(()=>$h)})});var hPr,jco=h(()=>{"use strict";yr();ja();ya();Pco();Fco();fPr();Nco();mPr();hPr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),pathParameters:ee.list(dPr).optional(),queryParameters:ee.list(oZe).optional(),headers:ee.list(iZe).optional(),request:ee.lazy(()=>$h).optional(),response:pPr.optional(),codeSamples:ee.list(iPr)}).extend(Nn)});var sZe,gPr=h(()=>{"use strict";ac();yr();Rco();jco();sZe=ee.union("type",{unknown:ee.object({value:uPr}),full:hPr}).transform({transform:e=>{switch(e.type){case"unknown":return LU.unknown(e.value);case"full":return LU.full(e);default:return e}},untransform:({_visit:e,...t})=>t})});var sZ,aZe=h(()=>{"use strict";yr();ljt();sZ=ee.objectWithoutOptionalProperties({groupName:P0e,methodName:ee.string()})});var cZe,APr=h(()=>{"use strict";yr();pjt();cZe=ee.list(ee.record(R0e,ee.list(ee.string())))});var N0e,mjt=h(()=>{"use strict";yr();ja();ud();ya();Pf();N0e=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Sl),env:ee.string().optional(),parameterNameOverride:ee.string().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var uZe,yPr=h(()=>{"use strict";yr();uZe=ee.objectWithoutOptionalProperties({name:ee.string().optional(),url:ee.string().optional(),audiences:ee.list(ee.string()).optional()})});var bPr,Qco=h(()=>{"use strict";yr();ja();bPr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),description:ee.string().optional(),example:ee.lazy(()=>$h)})});var EPr,zco=h(()=>{"use strict";yr();ja();ya();Oy();Pf();Qco();EPr=ee.objectWithoutOptionalProperties({isWildcardStatusCode:ee.boolean().optional(),schema:ee.lazy(()=>Sl).optional(),examples:ee.list(bPr).optional(),namespace:ee.string().optional()}).extend(Nn).extend($c).extend(Jo)});var lZe,IPr=h(()=>{"use strict";yr();lZe=ee.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"])});var vPr,Mco=h(()=>{"use strict";yr();vPr=ee.objectWithoutOptionalProperties({offset:ee.string(),results:ee.string(),step:ee.string().optional(),hasNextPage:ee.string().optional()})});var xPr,Lco=h(()=>{"use strict";yr();xPr=ee.objectWithoutOptionalProperties({nextPath:ee.string(),results:ee.string()})});var CPr,Vco=h(()=>{"use strict";yr();CPr=ee.objectWithoutOptionalProperties({nextUri:ee.string(),results:ee.string()})});var pZe,wPr=h(()=>{"use strict";ac();yr();wco();Bco();Mco();Lco();Vco();pZe=ee.union("type",{cursor:ePr,offset:vPr,custom:oPr,uri:CPr,path:xPr}).transform({transform:e=>{switch(e.type){case"cursor":return Lw.cursor(e);case"offset":return Lw.offset(e);case"custom":return Lw.custom(e);case"uri":return Lw.uri(e);case"path":return Lw.path(e);default:return e}},untransform:({_visit:e,...t})=>t})});var j0e,hjt=h(()=>{"use strict";yr();ja();ud();ya();Pf();j0e=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Sl),variableReference:ee.string().optional(),parameterNameOverride:ee.string().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var fZe,SPr=h(()=>{"use strict";yr();ja();ud();ya();Pf();fZe=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Sl),parameterNameOverride:ee.string().optional(),explode:ee.boolean().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var TPr,Uco=h(()=>{"use strict";yr();ja();ya();Pf();TPr=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Sl),contentType:ee.string().optional(),additionalProperties:ee.boolean()}).extend(Nn).extend(Jo)});var OPr,_co=h(()=>{"use strict";yr();ja();ya();Pf();OPr=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Sl),contentType:ee.string().optional(),required:ee.boolean().optional(),additionalProperties:ee.boolean()}).extend(Nn).extend(Jo)});var PPr,Gco=h(()=>{"use strict";yr();PPr=ee.enum_(["json","form"])});var BPr,qco=h(()=>{"use strict";yr();ya();BPr=ee.objectWithoutOptionalProperties({isOptional:ee.boolean(),isArray:ee.boolean()}).extend(Nn)});var DPr,Wco=h(()=>{"use strict";ac();yr();ja();qco();DPr=ee.union("type",{file:BPr,json:ee.object({value:ee.lazy(()=>Sl)})}).transform({transform:e=>{switch(e.type){case"file":return eZ.file(e);case"json":return eZ.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var Q0e,gjt=h(()=>{"use strict";yr();ya();Gco();Wco();Q0e=ee.objectWithoutOptionalProperties({key:ee.string(),schema:DPr,contentType:ee.string().optional(),exploded:ee.boolean().optional(),encoding:PPr.optional()}).extend(Nn)});var dZe,RPr=h(()=>{"use strict";yr();ya();Pf();gjt();dZe=ee.objectWithoutOptionalProperties({name:ee.string().optional(),properties:ee.list(Q0e)}).extend(Nn).extend(Jo)});var mZe,kPr=h(()=>{"use strict";yr();ya();Pf();mZe=ee.objectWithoutOptionalProperties({contentType:ee.string().optional()}).extend(Nn).extend(Jo)});var FPr,Hco=h(()=>{"use strict";ac();yr();Uco();_co();RPr();kPr();FPr=ee.union("type",{octetStream:mZe,multipart:dZe,json:OPr,formUrlEncoded:TPr}).transform({transform:e=>{switch(e.type){case"octetStream":return xW.octetStream(e);case"multipart":return xW.multipart(e);case"json":return xW.json(e);case"formUrlEncoded":return xW.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t})});var hZe,NPr=h(()=>{"use strict";yr();ya();Pf();kQe();hZe=ee.objectWithoutOptionalProperties({}).extend(Nn).extend(Jo).extend(UU)});var gZe,Kco=h(()=>{"use strict";yr();ja();ya();Pf();kQe();gZe=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Sl),responseProperty:ee.string().optional(),terminator:ee.string().optional(),resumable:ee.boolean().optional()}).extend(Nn).extend(Jo).extend(UU)});var z0e,jPr=h(()=>{"use strict";yr();ya();Pf();kQe();z0e=ee.objectWithoutOptionalProperties({contentType:ee.string().optional()}).extend(Nn).extend(Jo).extend(UU)});var AZe,QPr=h(()=>{"use strict";ac();yr();$Or();NPr();Kco();jPr();AZe=ee.union("type",{file:hZe,json:gZe,text:z0e,bytes:tZe,streamingSse:gZe,streamingText:z0e,streamingJson:gZe}).transform({transform:e=>{switch(e.type){case"file":return AP.file(e);case"json":return AP.json(e);case"text":return AP.text(e);case"bytes":return AP.bytes(e);case"streamingSse":return AP.streamingSse(e);case"streamingText":return AP.streamingText(e);case"streamingJson":return AP.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t})});var yZe,zPr=h(()=>{"use strict";ac();yr();yZe=ee.union("type",{disabled:ee.object({value:ee.boolean().optional()})}).transform({transform:e=>e.type==="disabled"?ejt.disabled(e.value):e,untransform:({_visit:e,...t})=>t})});var MPr,Jco=h(()=>{"use strict";yr();AOr();k0e();ud();ya();EA();Pf();gPr();aZe();APr();mjt();yPr();zco();IPr();wPr();hjt();SPr();Hco();QPr();zPr();MPr=ee.objectWithoutOptionalProperties({authed:ee.boolean(),security:cZe.optional(),internal:ee.boolean().optional(),idempotent:ee.boolean().optional(),method:lZe,audiences:ee.list(ee.string()),path:ee.string(),summary:ee.string().optional(),subtitle:ee.string().optional(),operationId:ee.string().optional(),tags:ee.list(jF),pathParameters:ee.list(j0e),queryParameters:ee.list(fZe),headers:ee.list(N0e),sdkName:sZ.optional(),generatedRequestName:ee.string(),requestNameOverride:ee.string().optional(),request:FPr.optional(),response:AZe.optional(),errors:ee.record(qXe,EPr),servers:ee.list(uZe),examples:ee.list(sZe),pagination:pZe.optional(),retries:yZe.optional(),globalParameterIds:ee.list(ee.string()).optional()}).extend(Nn).extend(ds).extend(Jo).extend(gc)});var LPr,Yco=h(()=>{"use strict";yr();ja();LPr=ee.objectWithoutOptionalProperties({header:ee.string(),name:ee.string().optional(),optional:ee.boolean().optional(),env:ee.string().optional(),schema:ee.lazy(()=>Sl).optional(),clientDefault:ee.unknown().optional()})});var VPr,Xco=h(()=>{"use strict";yr();VPr=ee.objectWithoutOptionalProperties({name:ee.string(),parameterName:ee.string().optional(),in:ee.string().optional(),target:ee.string().optional(),type:ee.string().optional(),env:ee.string().optional(),default:ee.unknown().optional(),optional:ee.boolean().optional(),apply:ee.string().optional(),docs:ee.string().optional()})});var UPr,Zco=h(()=>{"use strict";yr();pjt();UPr=ee.list(ee.record(R0e,ee.list(ee.string())))});var _Pr,$co=h(()=>{"use strict";yr();_Pr=ee.enum_(["sha256","sha1","sha384","sha512"])});var GPr,euo=h(()=>{"use strict";yr();GPr=ee.objectWithoutOptionalProperties({name:ee.string()})});var qPr,tuo=h(()=>{"use strict";ac();yr();euo();qPr=ee.union("type",{queryParameter:GPr}).transform({transform:e=>e.type==="queryParameter"?rjt.queryParameter(e):e,untransform:({_visit:e,...t})=>t})});var WPr,ruo=h(()=>{"use strict";yr();$co();tuo();djt();WPr=ee.objectWithoutOptionalProperties({algorithm:_Pr,encoding:F0e.optional(),location:qPr})});var HPr,nuo=h(()=>{"use strict";yr();HPr=ee.objectWithoutOptionalProperties({portVariants:ee.boolean(),legacyQueryEncoding:ee.boolean()})});var KPr,iuo=h(()=>{"use strict";yr();KPr=ee.enum_(["sha256","sha1","sha384","sha512"])});var JPr,ouo=h(()=>{"use strict";yr();ruo();nuo();KOr();iuo();djt();YOr();JPr=ee.objectWithoutOptionalProperties({header:ee.string(),algorithm:KPr.optional(),encoding:F0e.optional(),signaturePrefix:ee.string().optional(),payloadFormat:$Xe.optional(),timestamp:eZe.optional(),bodyHashBinding:WPr.optional(),notificationUrlNormalization:HPr.optional()})});var YPr,suo=h(()=>{"use strict";yr();ja();YPr=ee.objectWithoutOptionalProperties({header:ee.string(),name:ee.string().optional(),env:ee.string().optional(),schema:ee.lazy(()=>Sl).optional()})});var XPr,auo=h(()=>{"use strict";yr();XPr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),minimum:ee.number().optional(),maximum:ee.number().optional(),exclusiveMinimum:ee.boolean().optional(),exclusiveMaximum:ee.boolean().optional(),multipleOf:ee.number().optional()})});var ZPr,cuo=h(()=>{"use strict";ac();yr();ZPr=ee.union("type",{boolean:ee.object({value:ee.boolean()}),string:ee.object({value:ee.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return Ty.boolean(e.value);case"string":return Ty.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var bZe,$Pr=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();cuo();bZe=ee.objectWithoutOptionalProperties({value:ZPr}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var eBr,uuo=h(()=>{"use strict";yr();eBr=ee.objectWithoutOptionalProperties({default:ee.number().optional()})});var tBr,luo=h(()=>{"use strict";yr();tBr=ee.objectWithoutOptionalProperties({default:ee.string().optional(),pattern:ee.string().optional(),format:ee.string().optional(),minLength:ee.number().optional(),maxLength:ee.number().optional()})});var rBr,puo=h(()=>{"use strict";ac();yr();Cco();Dco();auo();uuo();luo();rBr=ee.union("type",{int:XPr,int64:eBr,uint:ee.object({}),uint64:ee.object({}),float:ee.object({}),double:cPr,string:tBr,datetime:ee.object({}),datetimeRfc2822:ee.object({}),date:ee.object({}),base64:ee.object({}),boolean:ZOr}).transform({transform:e=>{switch(e.type){case"int":return Ku.int(e);case"int64":return Ku.int64(e);case"uint":return Ku.uint();case"uint64":return Ku.uint64();case"float":return Ku.float();case"double":return Ku.double(e);case"string":return Ku.string(e);case"datetime":return Ku.datetime();case"datetimeRfc2822":return Ku.datetimeRfc2822();case"date":return Ku.date();case"base64":return Ku.base64();case"boolean":return Ku.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t})});var M0e,Ajt=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();puo();M0e=ee.objectWithoutOptionalProperties({schema:rBr}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var nBr,fhc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();D0();Ajt();nBr=ee.objectWithoutOptionalProperties({key:M0e,value:ee.lazy(()=>Sl),minProperties:ee.number().optional(),maxProperties:ee.number().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Xu).extend(zd)});var iBr,fuo=h(()=>{"use strict";yr();ya();Pf();gjt();iBr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),properties:ee.list(Q0e)}).extend(Nn).extend(Jo)});var oBr,dhc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();oBr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Sl)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var EZe,sBr=h(()=>{"use strict";yr();EZe=ee.objectWithoutOptionalProperties({differentSchema:ee.boolean()})});var aBr,mhc=h(()=>{"use strict";yr();ja();D0e();ud();NOr();sBr();aBr=ee.objectWithoutOptionalProperties({key:ee.string(),schema:ee.lazy(()=>Sl),readonly:ee.boolean().optional(),writeonly:ee.boolean().optional(),conflict:ee.record(NF,EZe),generatedName:ee.string(),nameOverride:ee.string().optional(),audiences:ee.list(ee.string()),xml:JXe.optional()}).extend(ds)});var aZ,IZe=h(()=>{"use strict";yr();D0e();ud();ya();Oy();EA();B0();Pf();D0();aZ=ee.objectWithoutOptionalProperties({schema:NF}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Jo).extend(Xu)});var cBr,hhc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();_Or();IZe();cBr=ee.objectWithoutOptionalProperties({allOf:ee.list(aZ),properties:ee.list(ee.lazyObject(()=>aBr)),allOfPropertyConflicts:ee.list(ZXe),additionalProperties:ee.boolean(),minProperties:ee.number().optional(),maxProperties:ee.number().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var uBr,ghc=h(()=>{"use strict";ac();yr();ja();uBr=ee.union("type",{discriminated:ee.lazyObject(()=>aPr),undiscriminated:ee.lazyObject(()=>lBr)}).transform({transform:e=>{switch(e.type){case"discriminated":return tZ.discriminated(e);case"undiscriminated":return tZ.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t})});var pBr,duo=h(()=>{"use strict";yr();ja();eco();D0e();pBr=ee.objectWithoutOptionalProperties({rootSchemas:ee.record(NF,ee.lazy(()=>Sl)),namespacedSchemas:ee.record(EOr,ee.record(NF,ee.lazy(()=>Sl)))})});var fBr,muo=h(()=>{"use strict";yr();fBr=ee.objectWithoutOptionalProperties({summary:ee.string().optional(),description:ee.string().optional()})});var dBr,huo=h(()=>{"use strict";yr();fco();k0e();dBr=ee.objectWithoutOptionalProperties({tagsById:ee.record(jF,FOr),orderedTagIds:ee.list(jF).optional()})});var vZe,mBr=h(()=>{"use strict";yr();ja();ya();vZe=ee.objectWithoutOptionalProperties({name:ee.string().optional(),payload:ee.lazy(()=>$h)}).extend(Nn)});var xZe,hBr=h(()=>{"use strict";yr();xZe=ee.enum_(["GET","POST"])});var CZe,gBr=h(()=>{"use strict";ac();yr();xco();ouo();CZe=ee.union("type",{hmac:JPr,asymmetric:XOr}).transform({transform:e=>{switch(e.type){case"hmac":return DQe.hmac(e);case"asymmetric":return DQe.asymmetric(e);default:return e}},untransform:({_visit:e,...t})=>t})});var ABr,guo=h(()=>{"use strict";yr();ja();k0e();ya();EA();Pf();aZe();mjt();fuo();QPr();mBr();hBr();gBr();ABr=ee.objectWithoutOptionalProperties({audiences:ee.list(ee.string()),sdkName:sZ.optional(),method:xZe,summary:ee.string().optional(),operationId:ee.string(),tags:ee.list(jF),headers:ee.list(N0e),generatedPayloadName:ee.string(),payload:ee.lazy(()=>Sl),multipartFormData:iBr.optional(),response:AZe.optional(),signatureVerification:CZe.optional(),examples:ee.list(vZe)}).extend(Nn).extend(Jo).extend(gc)});var yBr,Auo=h(()=>{"use strict";yr();mjt();hjt();SPr();yBr=ee.objectWithoutOptionalProperties({queryParameters:ee.list(fZe),headers:ee.list(N0e),pathParameters:ee.list(j0e)})});var bBr,yuo=h(()=>{"use strict";yr();bBr=ee.enum_(["client","server"])});var EBr,buo=h(()=>{"use strict";yr();ja();yuo();EBr=ee.objectWithoutOptionalProperties({name:ee.string(),displayName:ee.string().optional(),origin:bBr,body:ee.lazy(()=>Sl),methodName:ee.string().optional()})});var IBr,Euo=h(()=>{"use strict";yr();IBr=ee.objectWithoutOptionalProperties({name:ee.string(),url:ee.string()})});var vBr,Iuo=h(()=>{"use strict";yr();ja();ya();vBr=ee.objectWithoutOptionalProperties({messageType:ee.string(),payload:ee.lazy(()=>$h)}).extend(Nn)});var xBr,vuo=h(()=>{"use strict";yr();ya();fPr();mPr();Iuo();xBr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),queryParameters:ee.list(oZe).optional(),headers:ee.list(iZe).optional(),messages:ee.list(vBr)}).extend(Nn)});var CBr,xuo=h(()=>{"use strict";yr();ljt();ya();Pf();Auo();buo();Euo();vuo();CBr=ee.objectWithoutOptionalProperties({audiences:ee.list(ee.string()),path:ee.string(),groupName:P0e,summary:ee.string().optional(),connectMethodName:ee.string().optional(),handshake:yBr,messages:ee.list(EBr),servers:ee.list(IBr),examples:ee.list(xBr)}).extend(Nn).extend(Jo)});var Ahc,yhc=h(()=>{"use strict";yr();D0e();uco();pjt();pco();Jco();Yco();Xco();Zco();suo();hjt();Ajt();duo();muo();huo();guo();xuo();Ahc=ee.objectWithoutOptionalProperties({apiVersion:ee.unknown().optional(),specVersion:ee.string().optional(),title:ee.string().optional(),description:ee.string().optional(),baseUrlEnv:ee.string().optional(),basePath:ee.string().optional(),basePathParameters:ee.list(j0e).optional(),servers:ee.list(fjt),websocketServers:ee.list(fjt),groups:ee.record(ee.string(),fBr),tags:dBr,hasEndpointsMarkedInternal:ee.boolean(),endpoints:ee.list(MPr),webhooks:ee.list(ABr),channels:ee.record(ee.string(),CBr),groupedSchemas:pBr,variables:ee.record(ee.string(),M0e),nonRequestReferencedSchemas:ee.set(NF),securitySchemes:ee.record(R0e,DOr),security:UPr.optional(),globalHeaders:ee.list(LPr).optional(),globalParameters:ee.list(VPr).optional(),idempotencyHeaders:ee.list(YPr).optional()})});var wBr,bhc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();wBr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Sl)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var SBr,Cuo=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();SBr=ee.objectWithoutOptionalProperties({}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var Sl,Ehc=h(()=>{"use strict";ac();yr();ja();OOr();$Pr();Ajt();IZe();Cuo();Sl=ee.union("type",{primitive:M0e,object:ee.lazyObject(()=>cBr),array:ee.lazyObject(()=>GOr),map:ee.lazyObject(()=>nBr),optional:ee.lazyObject(()=>wBr),enum:WXe,reference:aZ,literal:bZe,oneOf:ee.object({value:ee.lazy(()=>uBr)}),nullable:ee.lazyObject(()=>oBr),unknown:SBr}).transform({transform:e=>{switch(e.type){case"primitive":return Aa.primitive(e);case"object":return Aa.object(e);case"array":return Aa.array(e);case"map":return Aa.map(e);case"optional":return Aa.optional(e);case"enum":return Aa.enum(e);case"reference":return Aa.reference(e);case"literal":return Aa.literal(e);case"oneOf":return Aa.oneOf(e.value);case"nullable":return Aa.nullable(e);case"unknown":return Aa.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t})});var lBr,Ihc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();lBr=ee.objectWithoutOptionalProperties({commonProperties:ee.list(ee.lazyObject(()=>rZe)).optional(),schemas:ee.list(ee.lazy(()=>Sl))}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var wuo=h(()=>{"use strict";_Or();uhc();bco();xco();tco();Cco();$Or();sco();lhc();wco();Pco();Sco();Oco();Bco();phc();sPr();Dco();Jco();gPr();Fco();aZe();APr();OOr();TOr();Qco();Rco();NPr();qco();Uco();jco();Yco();Xco();Zco();mjt();fPr();ouo();yPr();zco();IPr();suo();auo();_co();Kco();$Pr();cuo();uuo();fhc();fuo();RPr();gjt();Gco();Wco();dhc();mhc();sBr();hhc();kPr();Mco();ghc();yhc();bhc();wPr();Lco();hjt();Nco();Ajt();puo();SPr();mPr();IZe();Hco();QPr();zPr();Ehc();duo();muo();kco();luo();Tco();huo();jPr();Ihc();Cuo();Vco();guo();$co();ruo();tuo();euo();mBr();hBr();nuo();Eco();Ico();KOr();iuo();djt();gBr();YOr();vco();xuo();Auo();Iuo();yuo();buo();Euo();vuo()});var Suo={};Z(Suo,{AllOfPropertyConflict:()=>ZXe,ArraySchema:()=>GOr,AsymmetricAlgorithm:()=>qOr,AsymmetricWebhookSignatureVerification:()=>XOr,Availability:()=>IOr,BooleanSchema:()=>ZOr,BytesResponse:()=>tZe,CasingOverrides:()=>SOr,CommonProperty:()=>rZe,CursorPagination:()=>ePr,CustomCodeSample:()=>iPr,CustomCodeSampleLanguage:()=>tPr,CustomCodeSampleSdk:()=>nPr,CustomPagination:()=>oPr,DiscriminatedOneOfSchema:()=>aPr,DiscriminatorContext:()=>nZe,DoubleSchema:()=>cPr,Endpoint:()=>MPr,EndpointExample:()=>sZe,EndpointResponseExample:()=>pPr,EndpointSdkName:()=>sZ,EndpointSecurity:()=>cZe,EnumSchema:()=>WXe,EnumValue:()=>B0e,ErrorExample:()=>bPr,FernExample:()=>uPr,FileResponse:()=>hZe,FileSchema:()=>BPr,FormUrlEncodedRequest:()=>TPr,FullEndpointExample:()=>hPr,GlobalHeader:()=>LPr,GlobalParameter:()=>VPr,GlobalSecurity:()=>UPr,Header:()=>N0e,HeaderExample:()=>iZe,HmacWebhookSignatureVerification:()=>JPr,HttpEndpointServer:()=>uZe,HttpError:()=>EPr,HttpMethod:()=>lZe,IdempotencyHeader:()=>YPr,IntSchema:()=>XPr,JsonRequest:()=>OPr,JsonResponse:()=>gZe,LiteralSchema:()=>bZe,LiteralSchemaValue:()=>ZPr,LongSchema:()=>eBr,MapSchema:()=>nBr,MultipartFormDataWebhookPayload:()=>iBr,MultipartRequest:()=>dZe,MultipartRequestProperty:()=>Q0e,MultipartRequestPropertyEncoding:()=>PPr,MultipartSchema:()=>DPr,NullableSchema:()=>oBr,ObjectProperty:()=>aBr,ObjectPropertyConflictInfo:()=>EZe,ObjectSchema:()=>cBr,OctetStreamRequest:()=>mZe,OffsetPagination:()=>vPr,OneOfSchema:()=>uBr,OpenApiIntermediateRepresentation:()=>Ahc,OptionalSchema:()=>wBr,Pagination:()=>pZe,PathPagination:()=>xPr,PathParameter:()=>j0e,PathParameterExample:()=>dPr,PrimitiveSchema:()=>M0e,PrimitiveSchemaValue:()=>rBr,QueryParameter:()=>fZe,QueryParameterExample:()=>oZe,ReferencedSchema:()=>aZ,Request:()=>FPr,Response:()=>AZe,RetriesConfiguration:()=>yZe,Schema:()=>Sl,Schemas:()=>pBr,SdkGroupInfo:()=>fBr,StreamingResponseExample:()=>lPr,StringSchema:()=>tBr,SupportedSdkLanguage:()=>rPr,Tags:()=>dBr,TextResponse:()=>z0e,UnDiscriminatedOneOfSchema:()=>lBr,UnknownSchema:()=>SBr,UriPagination:()=>CPr,Webhook:()=>ABr,WebhookBodyHashAlgorithm:()=>_Pr,WebhookBodyHashBinding:()=>WPr,WebhookBodyHashLocation:()=>qPr,WebhookBodyHashQueryParameterLocation:()=>GPr,WebhookExampleCall:()=>vZe,WebhookHttpMethod:()=>xZe,WebhookNotificationUrlNormalization:()=>HPr,WebhookPayloadBodySort:()=>WOr,WebhookPayloadComponent:()=>HOr,WebhookPayloadFormat:()=>$Xe,WebhookSignatureAlgorithm:()=>KPr,WebhookSignatureEncoding:()=>F0e,WebhookSignatureVerification:()=>CZe,WebhookTimestamp:()=>eZe,WebhookTimestampFormat:()=>JOr,WebsocketChannel:()=>CBr,WebsocketHandshake:()=>yBr,WebsocketMessageExample:()=>vBr,WebsocketMessageOrigin:()=>bBr,WebsocketMessageSchema:()=>EBr,WebsocketServer:()=>IBr,WebsocketSessionExample:()=>xBr});var vhc=h(()=>{"use strict";wuo()});var TBr,xhc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();TBr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Md),minItems:ee.number().optional(),maxItems:ee.number().optional(),example:ee.list(ee.unknown()).optional(),default:ee.unknown().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var OBr,Tuo=h(()=>{"use strict";yr();OBr=ee.objectWithoutOptionalProperties({example:ee.string().optional()})});var PBr,Ouo=h(()=>{"use strict";yr();PBr=ee.objectWithoutOptionalProperties({default:ee.boolean().optional(),example:ee.boolean().optional()})});var wZe,Chc=h(()=>{"use strict";yr();ja();wZe=ee.objectWithoutOptionalProperties({key:ee.string(),schema:ee.lazy(()=>Md)})});var yjt,Puo=h(()=>{"use strict";yr();yjt=ee.objectWithoutOptionalProperties({example:ee.string().optional()})});var BBr,Buo=h(()=>{"use strict";yr();BBr=ee.objectWithoutOptionalProperties({example:ee.string().optional()})});var DBr,whc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();sPr();DBr=ee.objectWithoutOptionalProperties({discriminantProperty:ee.string(),discriminantPropertyNameOverride:ee.string().optional(),discriminatorContext:nZe.optional(),defaultDiscriminantValue:ee.string().optional(),commonProperties:ee.list(ee.lazyObject(()=>wZe)),schemas:ee.record(ee.string(),ee.lazy(()=>Md))}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var RBr,Duo=h(()=>{"use strict";yr();RBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),minimum:ee.number().optional(),maximum:ee.number().optional(),exclusiveMinimum:ee.boolean().optional(),exclusiveMaximum:ee.boolean().optional(),multipleOf:ee.number().optional(),example:ee.number().optional()})});var L0e,bjt=h(()=>{"use strict";yr();ja();ud();ya();Pf();L0e=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Md),env:ee.string().optional(),parameterNameOverride:ee.string().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var vQ,V0e=h(()=>{"use strict";yr();ya();vQ=ee.objectWithoutOptionalProperties({name:ee.string().optional(),value:ee.unknown()}).extend(Nn)});var kBr,Ruo=h(()=>{"use strict";yr();ja();kOr();ya();Oy();Pf();V0e();kBr=ee.objectWithoutOptionalProperties({statusCode:HXe,isWildcardStatusCode:ee.boolean().optional(),schema:ee.lazy(()=>Md),fullExamples:ee.list(vQ).optional(),namespace:ee.string().optional()}).extend(Nn).extend($c).extend(Jo)});var FBr,kuo=h(()=>{"use strict";yr();ja();ud();ya();Pf();FBr=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Md),variableReference:ee.string().optional(),parameterNameOverride:ee.string().optional(),explode:ee.boolean().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var SZe,NBr=h(()=>{"use strict";yr();ja();ud();ya();Pf();SZe=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Md),parameterNameOverride:ee.string().optional(),explode:ee.boolean().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var jBr,Fuo=h(()=>{"use strict";yr();ja();ya();KXe();Pf();V0e();jBr=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Md),contentType:ee.string().optional(),required:ee.boolean().optional(),fullExamples:ee.list(vQ).optional(),additionalProperties:ee.boolean()}).extend(Nn).extend(Jo).extend(oZ)});var QBr,Nuo=h(()=>{"use strict";yr();ja();ya();KXe();Pf();V0e();QBr=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Md),contentType:ee.string().optional(),fullExamples:ee.list(vQ).optional(),additionalProperties:ee.boolean()}).extend(Nn).extend(Jo).extend(oZ)});var zBr,juo=h(()=>{"use strict";yr();KXe();RPr();V0e();zBr=ee.objectWithoutOptionalProperties({fullExamples:ee.list(vQ).optional()}).extend(dZe).extend(oZ)});var MBr,Quo=h(()=>{"use strict";yr();KXe();kPr();MBr=ee.objectWithoutOptionalProperties({}).extend(mZe).extend(oZ)});var LBr,zuo=h(()=>{"use strict";ac();yr();Fuo();Nuo();juo();Quo();LBr=ee.union("type",{octetStream:MBr,multipart:zBr,json:jBr,formUrlEncoded:QBr}).transform({transform:e=>{switch(e.type){case"octetStream":return kF.octetStream(e);case"multipart":return kF.multipart(e);case"json":return kF.json(e);case"formUrlEncoded":return kF.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t})});var TZe,Muo=h(()=>{"use strict";yr();ja();ya();Pf();kQe();V0e();TZe=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Md),responseProperty:ee.string().optional(),terminator:ee.string().optional(),fullExamples:ee.list(vQ).optional(),resumable:ee.boolean().optional()}).extend(Nn).extend(Jo).extend(UU)});var OZe,VBr=h(()=>{"use strict";ac();yr();$Or();NPr();jPr();Muo();OZe=ee.union("type",{file:hZe,json:TZe,text:z0e,bytes:tZe,streamingSse:TZe,streamingText:z0e,streamingJson:TZe}).transform({transform:e=>{switch(e.type){case"file":return Ug.file(e);case"json":return Ug.json(e);case"text":return Ug.text(e);case"bytes":return Ug.bytes(e);case"streamingSse":return Ug.streamingSse(e);case"streamingText":return Ug.streamingText(e);case"streamingJson":return Ug.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t})});var Shc,Thc=h(()=>{"use strict";yr();AOr();k0e();ud();ya();EA();Pf();gPr();aZe();APr();yPr();IPr();wPr();zPr();bjt();Ruo();kuo();NBr();zuo();VBr();Shc=ee.objectWithoutOptionalProperties({authed:ee.boolean(),security:cZe.optional(),internal:ee.boolean().optional(),idempotent:ee.boolean().optional(),method:lZe,audiences:ee.list(ee.string()),path:ee.string(),summary:ee.string().optional(),subtitle:ee.string().optional(),operationId:ee.string().optional(),tags:ee.list(jF),pathParameters:ee.list(FBr),queryParameters:ee.list(SZe),headers:ee.list(L0e),sdkName:sZ.optional(),generatedRequestName:ee.string(),requestNameOverride:ee.string().optional(),request:LBr.optional(),response:OZe.optional(),errors:ee.record(qXe,kBr),servers:ee.list(uZe),examples:ee.list(sZe),pagination:pZe.optional(),retries:yZe.optional(),globalParameterIds:ee.list(ee.string()).optional()}).extend(Nn).extend(ds).extend(Jo).extend(gc)});var UBr,Luo=h(()=>{"use strict";yr();ud();ya();C1();Oy();EA();B0();Pf();D0();TOr();UBr=ee.objectWithoutOptionalProperties({default:B0e.optional(),values:ee.list(B0e),example:ee.string().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Jo).extend(Xu).extend(zd)});var _Br,Vuo=h(()=>{"use strict";yr();_Br=ee.objectWithoutOptionalProperties({example:ee.number().optional()})});var GBr,Uuo=h(()=>{"use strict";yr();GBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),example:ee.number().optional()})});var qBr,_uo=h(()=>{"use strict";yr();qBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),minimum:ee.number().optional(),maximum:ee.number().optional(),exclusiveMinimum:ee.boolean().optional(),exclusiveMaximum:ee.boolean().optional(),multipleOf:ee.number().optional(),example:ee.number().optional()})});var WBr,Guo=h(()=>{"use strict";yr();WBr=ee.objectWithoutOptionalProperties({default:ee.string().optional(),pattern:ee.string().optional(),format:ee.string().optional(),minLength:ee.number().optional(),maxLength:ee.number().optional(),example:ee.string().optional()})});var HBr,quo=h(()=>{"use strict";yr();HBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),example:ee.number().optional()})});var KBr,Wuo=h(()=>{"use strict";yr();KBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),example:ee.number().optional()})});var JBr,Huo=h(()=>{"use strict";ac();yr();Tuo();Ouo();Puo();Buo();Duo();Vuo();Uuo();_uo();Guo();quo();Wuo();JBr=ee.union("type",{int:qBr,int64:GBr,uint:KBr,uint64:HBr,float:_Br,double:RBr,string:WBr,datetime:yjt,datetimeRfc2822:yjt,date:BBr,base64:OBr,boolean:PBr}).transform({transform:e=>{switch(e.type){case"int":return Ui.int(e);case"int64":return Ui.int64(e);case"uint":return Ui.uint(e);case"uint64":return Ui.uint64(e);case"float":return Ui.float(e);case"double":return Ui.double(e);case"string":return Ui.string(e);case"datetime":return Ui.datetime(e);case"datetimeRfc2822":return Ui.datetimeRfc2822(e);case"date":return Ui.date(e);case"base64":return Ui.base64(e);case"boolean":return Ui.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t})});var PZe,YBr=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();Huo();PZe=ee.objectWithoutOptionalProperties({schema:JBr}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var XBr,Ohc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();D0();YBr();XBr=ee.objectWithoutOptionalProperties({key:PZe,value:ee.lazy(()=>Md),minProperties:ee.number().optional(),maxProperties:ee.number().optional(),example:ee.unknown().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Xu).extend(zd)});var ZBr,Kuo=h(()=>{"use strict";yr();ya();Pf();gjt();ZBr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),properties:ee.list(Q0e)}).extend(Nn).extend(Jo)});var $Br,Phc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();$Br=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Md)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var eDr,Bhc=h(()=>{"use strict";yr();ja();D0e();ud();NOr();sBr();eDr=ee.objectWithoutOptionalProperties({key:ee.string(),schema:ee.lazy(()=>Md),readonly:ee.boolean().optional(),writeonly:ee.boolean().optional(),audiences:ee.list(ee.string()),conflict:ee.record(NF,EZe),nameOverride:ee.string().optional(),generatedName:ee.string(),xml:JXe.optional()}).extend(ds)});var tDr,Dhc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();_Or();IZe();V0e();tDr=ee.objectWithoutOptionalProperties({allOf:ee.list(aZ),properties:ee.list(ee.lazyObject(()=>eDr)),allOfPropertyConflicts:ee.list(ZXe),fullExamples:ee.list(vQ).optional(),additionalProperties:ee.boolean(),minProperties:ee.number().optional(),maxProperties:ee.number().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var rDr,Rhc=h(()=>{"use strict";ac();yr();ja();rDr=ee.union("type",{discriminated:ee.lazyObject(()=>DBr),undiscriminated:ee.lazyObject(()=>nDr)}).transform({transform:e=>{switch(e.type){case"discriminated":return U6.discriminated(e);case"undiscriminated":return U6.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t})});var iDr,khc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();iDr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Md)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var oDr,Juo=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();oDr=ee.objectWithoutOptionalProperties({example:ee.unknown()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var Md,Fhc=h(()=>{"use strict";ac();yr();ja();$Pr();IZe();Luo();YBr();Juo();Md=ee.union("type",{primitive:PZe,object:ee.lazyObject(()=>tDr),array:ee.lazyObject(()=>TBr),map:ee.lazyObject(()=>XBr),optional:ee.lazyObject(()=>iDr),enum:UBr,reference:aZ,literal:bZe,oneOf:ee.object({value:ee.lazy(()=>rDr)}),nullable:ee.lazyObject(()=>$Br),unknown:oDr}).transform({transform:e=>{switch(e.type){case"primitive":return Wr.primitive(e);case"object":return Wr.object(e);case"array":return Wr.array(e);case"map":return Wr.map(e);case"optional":return Wr.optional(e);case"enum":return Wr.enum(e);case"reference":return Wr.reference(e);case"literal":return Wr.literal(e);case"oneOf":return Wr.oneOf(e.value);case"nullable":return Wr.nullable(e);case"unknown":return Wr.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t})});var nDr,Nhc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();nDr=ee.objectWithoutOptionalProperties({commonProperties:ee.list(ee.lazyObject(()=>wZe)).optional(),schemas:ee.list(ee.lazy(()=>Md))}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var jhc,Qhc=h(()=>{"use strict";yr();ja();k0e();ya();EA();Pf();aZe();mBr();hBr();gBr();bjt();Kuo();VBr();jhc=ee.objectWithoutOptionalProperties({audiences:ee.list(ee.string()),sdkName:sZ.optional(),method:xZe,summary:ee.string().optional(),operationId:ee.string(),tags:ee.list(jF),headers:ee.list(L0e),generatedPayloadName:ee.string(),payload:ee.lazy(()=>Md),multipartFormData:ZBr.optional(),response:OZe.optional(),signatureVerification:CZe.optional(),examples:ee.list(vZe)}).extend(Nn).extend(Jo).extend(gc)});var zhc,Mhc=h(()=>{"use strict";yr();bjt();NBr();zhc=ee.objectWithoutOptionalProperties({queryParameters:ee.list(SZe),headers:ee.list(L0e)})});var Yuo=h(()=>{"use strict";xhc();Tuo();Ouo();Chc();Puo();Buo();whc();Duo();Thc();Luo();Vuo();bjt();Ruo();Uuo();_uo();Fuo();Muo();Ohc();Kuo();V0e();Phc();Bhc();Dhc();Rhc();khc();Nuo();juo();Quo();kuo();Huo();YBr();NBr();zuo();VBr();Fhc();Guo();quo();Wuo();Nhc();Juo();Qhc();Mhc()});var Xuo={};Z(Xuo,{ArraySchemaWithExample:()=>TBr,Base64WithExample:()=>OBr,BooleanWithExample:()=>PBr,CommonPropertyWithExample:()=>wZe,DateWithExample:()=>BBr,DatetimeWithExample:()=>yjt,DiscriminatedOneOfSchemaWithExample:()=>DBr,DoubleWithExample:()=>RBr,EndpointWithExample:()=>Shc,EnumSchemaWithExample:()=>UBr,FloatWithExample:()=>_Br,HeaderWithExample:()=>L0e,HttpErrorWithExample:()=>kBr,Int64WithExample:()=>GBr,IntWithExample:()=>qBr,JsonRequestWithExample:()=>jBr,JsonResponseWithExample:()=>TZe,MapSchemaWithExample:()=>XBr,MultipartFormDataWebhookPayloadWithExample:()=>ZBr,NamedFullExample:()=>vQ,NullableSchemaWithExample:()=>$Br,ObjectPropertyWithExample:()=>eDr,ObjectSchemaWithExample:()=>tDr,OneOfSchemaWithExample:()=>rDr,OptionalSchemaWithExample:()=>iDr,ParseFormUrlEncodedRequest:()=>QBr,ParseMultipartRequest:()=>zBr,ParseOctetStreamRequest:()=>MBr,PathParameterWithExample:()=>FBr,PrimitiveSchemaValueWithExample:()=>JBr,PrimitiveSchemaWithExample:()=>PZe,QueryParameterWithExample:()=>SZe,RequestWithExample:()=>LBr,ResponseWithExample:()=>OZe,SchemaWithExample:()=>Md,StringSchemaWithExample:()=>WBr,Uint64WithExample:()=>HBr,UintWithExample:()=>KBr,UnDiscriminatedOneOfSchemaWithExample:()=>nDr,UnknownSchemaWithExample:()=>oDr,WebhookWithExample:()=>jhc,WebsocketHandshakeWithExample:()=>zhc});var Lhc=h(()=>{"use strict";Yuo()});var Vhc=h(()=>{"use strict";nhc();dco();chc();Aco();vhc();wuo();Lhc();Yuo()});var va={};Z(va,{AllOfPropertyConflict:()=>ZXe,ArraySchema:()=>GOr,ArraySchemaWithExample:()=>TBr,AsymmetricAlgorithm:()=>qOr,AsymmetricWebhookSignatureVerification:()=>XOr,Availability:()=>IOr,Base64WithExample:()=>OBr,BasicSecurityScheme:()=>fOr,BearerSecurityScheme:()=>dOr,BooleanSchema:()=>ZOr,BooleanWithExample:()=>PBr,BytesResponse:()=>tZe,CasingOverrides:()=>SOr,CommonProperty:()=>rZe,CommonPropertyWithExample:()=>wZe,CursorPagination:()=>ePr,CustomCodeSample:()=>iPr,CustomCodeSampleLanguage:()=>tPr,CustomCodeSampleSdk:()=>nPr,CustomPagination:()=>oPr,DateWithExample:()=>BBr,DatetimeWithExample:()=>yjt,DiscriminatedOneOfSchema:()=>aPr,DiscriminatedOneOfSchemaWithExample:()=>DBr,DiscriminatorContext:()=>nZe,DoubleSchema:()=>cPr,DoubleWithExample:()=>RBr,Encoding:()=>gOr,Endpoint:()=>MPr,EndpointExample:()=>sZe,EndpointResponseExample:()=>pPr,EndpointSdkName:()=>sZ,EndpointSecurity:()=>cZe,EndpointWithExample:()=>Shc,EnumSchema:()=>WXe,EnumSchemaWithExample:()=>UBr,EnumValue:()=>B0e,ErrorExample:()=>bPr,ErrorStatusCodeKey:()=>qXe,FernExample:()=>uPr,FileResponse:()=>hZe,FileSchema:()=>BPr,FloatWithExample:()=>_Br,FormUrlEncodedRequest:()=>TPr,FullEndpointExample:()=>hPr,FullExample:()=>$h,FullObjectExample:()=>MOr,FullOneOfExample:()=>LOr,GlobalHeader:()=>LPr,GlobalParameter:()=>VPr,GlobalSecurity:()=>UPr,Header:()=>N0e,HeaderExample:()=>iZe,HeaderSecurityScheme:()=>yOr,HeaderWithExample:()=>L0e,HmacWebhookSignatureVerification:()=>JPr,HttpEndpointServer:()=>uZe,HttpError:()=>EPr,HttpErrorWithExample:()=>kBr,HttpMethod:()=>lZe,IdempotencyHeader:()=>YPr,Int64WithExample:()=>GBr,IntSchema:()=>XPr,IntWithExample:()=>qBr,JsonRequest:()=>OPr,JsonRequestWithExample:()=>jBr,JsonResponse:()=>gZe,JsonResponseWithExample:()=>TZe,KeyValuePair:()=>VOr,LiteralExample:()=>jOr,LiteralSchema:()=>bZe,LiteralSchemaValue:()=>ZPr,LongSchema:()=>eBr,MapSchema:()=>nBr,MapSchemaWithExample:()=>XBr,MultipartFormDataWebhookPayload:()=>iBr,MultipartFormDataWebhookPayloadWithExample:()=>ZBr,MultipartRequest:()=>dZe,MultipartRequestProperty:()=>Q0e,MultipartRequestPropertyEncoding:()=>PPr,MultipartSchema:()=>DPr,NamedFullExample:()=>vQ,Namespace:()=>bOr,NamespaceId:()=>EOr,NullExample:()=>QOr,NullableSchema:()=>oBr,NullableSchemaWithExample:()=>$Br,OauthSecurityScheme:()=>POr,ObjectProperty:()=>aBr,ObjectPropertyConflictInfo:()=>EZe,ObjectPropertyWithExample:()=>eDr,ObjectSchema:()=>cBr,ObjectSchemaWithExample:()=>tDr,OctetStreamRequest:()=>mZe,OffsetPagination:()=>vPr,OneOfSchema:()=>uBr,OneOfSchemaWithExample:()=>rDr,OpenApiIntermediateRepresentation:()=>Ahc,OpenApiSource:()=>xOr,OptionalSchema:()=>wBr,OptionalSchemaWithExample:()=>iDr,Pagination:()=>pZe,ParseFormUrlEncodedRequest:()=>QBr,ParseMultipartRequest:()=>zBr,ParseOctetStreamRequest:()=>MBr,PathPagination:()=>xPr,PathParameter:()=>j0e,PathParameterExample:()=>dPr,PathParameterWithExample:()=>FBr,PrimitiveExample:()=>YXe,PrimitiveSchema:()=>M0e,PrimitiveSchemaValue:()=>rBr,PrimitiveSchemaValueWithExample:()=>JBr,PrimitiveSchemaWithExample:()=>PZe,PropertyKey:()=>XXe,ProtobufEncoding:()=>mOr,ProtobufSource:()=>COr,QueryParameter:()=>fZe,QueryParameterExample:()=>oZe,QueryParameterWithExample:()=>SZe,QuerySecurityScheme:()=>BOr,ReferencedSchema:()=>aZ,Request:()=>FPr,RequestWithExample:()=>LBr,Response:()=>AZe,ResponseWithExample:()=>OZe,RetriesConfiguration:()=>yZe,Schema:()=>Sl,SchemaId:()=>NF,SchemaWithExample:()=>Md,Schemas:()=>pBr,SdkGroup:()=>vOr,SdkGroupInfo:()=>fBr,SdkGroupName:()=>P0e,SecurityScheme:()=>DOr,SecuritySchemeId:()=>R0e,Server:()=>fjt,ServerVariable:()=>ROr,Source:()=>wOr,StatusCode:()=>HXe,StreamingResponseExample:()=>lPr,StringSchema:()=>tBr,StringSchemaWithExample:()=>WBr,SupportedSdkLanguage:()=>rPr,Tag:()=>FOr,TagId:()=>jF,Tags:()=>dBr,TextResponse:()=>z0e,Uint64WithExample:()=>HBr,UintWithExample:()=>KBr,UnDiscriminatedOneOfSchema:()=>lBr,UnDiscriminatedOneOfSchemaWithExample:()=>nDr,UnknownSchema:()=>SBr,UnknownSchemaWithExample:()=>oDr,UriPagination:()=>CPr,Webhook:()=>ABr,WebhookBodyHashAlgorithm:()=>_Pr,WebhookBodyHashBinding:()=>WPr,WebhookBodyHashLocation:()=>qPr,WebhookBodyHashQueryParameterLocation:()=>GPr,WebhookExampleCall:()=>vZe,WebhookHttpMethod:()=>xZe,WebhookNotificationUrlNormalization:()=>HPr,WebhookPayloadBodySort:()=>WOr,WebhookPayloadComponent:()=>HOr,WebhookPayloadFormat:()=>$Xe,WebhookSignatureAlgorithm:()=>KPr,WebhookSignatureEncoding:()=>F0e,WebhookSignatureVerification:()=>CZe,WebhookTimestamp:()=>eZe,WebhookTimestampFormat:()=>JOr,WebhookWithExample:()=>jhc,WebsocketChannel:()=>CBr,WebsocketHandshake:()=>yBr,WebsocketHandshakeWithExample:()=>zhc,WebsocketMessageExample:()=>vBr,WebsocketMessageOrigin:()=>bBr,WebsocketMessageSchema:()=>EBr,WebsocketServer:()=>IBr,WebsocketSessionExample:()=>xBr,WithAvailability:()=>ds,WithDescription:()=>Nn,WithEncoding:()=>w1,WithInline:()=>zd,WithName:()=>$c,WithNamespace:()=>gc,WithSdkGroupName:()=>Yu,WithSdkMethodName:()=>oZ,WithSource:()=>Jo,WithStatusCode:()=>UU,WithTitle:()=>Xu,XmlEncoding:()=>hOr,XmlPropertyEncoding:()=>JXe,commons:()=>mco,example:()=>yco,finalIr:()=>Suo,parseIr:()=>Xuo});var ja=h(()=>{"use strict";Vhc()});var Uhc=h(()=>{"use strict";ac();qdc();ja()});var _hc,BZe,Ghc,sDr=h(()=>{"use strict";_hc=/^(\d+)/,BZe=/^[a-zA-Z][a-zA-Z0-9_]*$/,Ghc={"<":"LESS_THAN",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL_TO","<=":"LESS_THAN_OR_EQUAL_TO","!=":"NOT_EQUALS","=":"EQUAL_TO","==":"EQUAL_TO","*":"ALL","":"EMPTY",'""':"EMPTY_STRING","-":"HYPHEN","|":"PIPE",".":"DOT","/":"SLASH"}});function FQe(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let s=Math.floor(e/10),a=e%10;return a===0?n[s]:`${n[s]}_${t[a]}`}if(e<1e3){let s=Math.floor(e/100),a=e%100;return a===0?`${t[s]}_hundred`:`${t[s]}_hundred_${FQe(a)}`}let i=Math.floor(e/1e3),o=e%1e3;return o===0?`${t[i]}_thousand`:`${t[i]}_thousand_${FQe(o)}`}var Zuo=h(()=>{"use strict"});function Ejt(e){let t=e.match(_hc);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let o=FQe(i);return n.length>0?`${o}_${n}`:o}}}var $uo=h(()=>{"use strict";Zuo();sDr()});function DZe(e){let t=Ejt(e),r=Ghc[e];return t!=null?_u(ti(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":_u(ti(e)))}var qhc=h(()=>{"use strict";Vi();$uo();sDr()});function QF(e,t){return e.type==="primitive"&&t.type==="primitive"?Whc(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?oVf(e.values,t.values):e.type==="array"&&t.type==="array"?QF(e.value,t.value):e.type==="unknown"&&t.type==="unknown"?!0:e.type==="reference"&&t.type==="reference"?e.schema===t.schema:e.type==="optional"&&t.type==="optional"||e.type==="nullable"&&t.type==="nullable"?QF(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?sVf(e.value,t.value):e.type==="object"&&t.type==="object"?aVf(e,t):e.type==="map"&&t.type==="map"?Whc(e.key.schema,t.key.schema)&&QF(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function Whc(e,t){return e.type===t.type}function oVf(e,t){let r=new Set(e.map(i=>i.value)),n=new Set(t.map(i=>i.value));return b0(r,n)}function sVf(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:QF(n,i)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:QF(r,i)}):!1}function aVf(e,t){if(e.properties.length!==t.properties.length)return!1;let r=new Map(e.properties.map(n=>[n.key,n.schema]));return t.properties.every(n=>{let i=r.get(n.key);return i==null?!1:QF(i,n.schema)})}var Hhc=h(()=>{"use strict";Vi()});var Khc=h(()=>{"use strict";sDr();Zuo();qhc();Hhc();$uo()});var Ac=h(()=>{"use strict";Uhc();ac();ja();Khc()});function R0(e){switch(e){case Zh.Deprecated:return"deprecated";case Zh.Beta:return"beta";case Zh.GenerallyAvailable:return"generally-available";case Zh.Alpha:return"alpha";case Zh.Preview:return"preview";case Zh.Legacy:return"legacy";default:return}}var NQe=h(()=>{"use strict";Ac()});function Ijt(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};case"xml":return{xml:{name:e.name,namespace:e.namespace,prefix:e.prefix}};default:Ee(e)}}function aDr(e){return{xml:{name:e.name,attribute:e.attribute,text:e.text,wrapped:e.wrapped,separator:e.separator}}}var cDr=h(()=>{"use strict";wt()});function Jhc(e){let t=e.match(/^(_+)/),r=e.match(/(_+)$/),n=t?.[1]??"",i=r?.[1]??"";if(n===""&&i==="")return ti(e);if(n.length+i.length>=e.length)return e;let o=e.slice(n.length,e.length-i.length||void 0);return`${n}${ti(o)}${i}`}function cVf(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function Yhc(e){let t=e?cVf(e):void 0;if(t==null||t.length===0)return Vje;let r=[];for(let[n,i]of t.entries())typeof i=="string"?r.push(Jhc(i)):typeof i=="object"?i.type==="namespace"?n<t.length-1?r.push(Jhc(i.name)):r.push(i.name,Vje):Ee(i.type):Ee(i);return r.join("/")}function Ule(e){return Us.of(`${Yhc(e)}.yml`)}function elo({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?Vje:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,Yhc(r))}function Xhc({sdkName:e,namespaceOverride:t}){return Us.of(`${elo({sdkName:e,namespaceOverride:t})}.yml`)}function Zhc({location:e,namespaceOverride:t}){return t!=null?NI(Us.of(t),e):e}var RZe=h(()=>{"use strict";aa();wt();Ey();Vi()});function $hc(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"unknown":return uDr({namespace:e.namespace,groupName:e.groupName});case"oneOf":return uDr({namespace:e.value.namespace,groupName:e.value.groupName});default:Ee(e)}}function uDr({namespace:e,groupName:t}){return e!=null&&t!=null?Ule([{type:"namespace",name:e},...t]):e!=null?Ule([{type:"namespace",name:e}]):Ule(t)}var tlo=h(()=>{"use strict";wt();RZe()});function _le(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":case"unknown":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;default:Ee(e)}}var vjt=h(()=>{"use strict";wt()});function rf(e){return typeof e=="string"?e:e.type}function kZe(e){if(typeof e!="string")return e.docs}function jQe(e){if(typeof e!="string")return e.default}function rlo(e){if(typeof e!="string")return e.validation}function FZe(e){let t=e.match(/^optional<\s*nullable<\s*(.+)\s*>\s*>$/);if(t!=null&&t[1]!=null)return t[1].trim();let r=e.match(/^nullable<\s*(.+)\s*>$/);return r!=null&&r[1]!=null?r[1].trim():e}var _6=h(()=>{"use strict"});function tgc(e){let t=rf(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?egc(e):{...e,type:egc(e.type)}}function egc(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}var rgc=h(()=>{"use strict";_6()});function QQe(e){return rf(e).startsWith("optional<")?e:typeof e=="string"?ngc(e):{...e,type:ngc(e.type)}}function ngc(e){return e.startsWith("optional<")?e:`optional<${e}>`}var lDr=h(()=>{"use strict";_6()});function Oc({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:o,variant:s}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return pDr(e);case"array":return olo({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"map":return slo({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"reference":return ilo({schema:e,fileContainingReference:t,context:n,namespace:i,variant:s});case"unknown":return clo();case"optional":return fDr({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"nullable":return alo({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"enum":return IVf({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:o});case"literal":return e.value,ulo(e);case"object":return vVf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"oneOf":return xVf({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});default:Ee(e)}}function pDr(e){switch(e.schema.type){case"string":return hVf({description:e.description,schema:e.schema});case"int":return gVf({description:e.description,schema:e.schema});case"float":return AVf({description:e.description,schema:e.schema});case"double":return yVf({description:e.description,schema:e.schema});case"boolean":return dVf({description:e.description,schema:e.schema});case"int64":return mVf({description:e.description,schema:e.schema})}let t=e.schema._visit({int:()=>"integer",int64:()=>"long",uint:()=>"uint",uint64:()=>"uint64",float:()=>"double",double:()=>"double",string:()=>"string",datetime:()=>"datetime",datetimeRfc2822:()=>"datetime-rfc-2822",date:()=>"date",base64:()=>"base64",boolean:()=>"boolean",_other:()=>"unknown"});return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function dVf({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function mVf({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function hVf({description:e,schema:t}){let r="string",n=bVf(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function gVf({description:e,schema:t}){let r="integer",n=igc(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function AVf({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function yVf({description:e,schema:t}){let r="double",n=igc(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function bVf(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,o=EVf(t);if(!(o==null&&r==null&&n==null&&i==null))return{format:o,pattern:r,minLength:n,maxLength:i}}function EVf(e){switch(e){case"date":case"date-time":case"password":case"byte":case"bytes":case"binary":case"email":case"uuid":case"uri":case"hostname":case"ipv4":case"ipv6":return e;default:return}}function igc(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:o,exclusiveMaximum:s}=e;if(r=nlo(r,t),n=nlo(n,t),i=nlo(i,t),!(r==null&&n==null&&o==null&&s==null&&i==null))return{min:r,max:n,exclusiveMin:o,exclusiveMax:s,multipleOf:i}}function nlo(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[uVf,lVf]:[pVf,fVf];return e<r||e>n?void 0:e}function ilo({schema:e,fileContainingReference:t,context:r,variant:n}){let i=r.getSchema(e.schema,e.namespace);if(i==null)return"unknown";let o=CVf(i)??e.schema,s=r.options.respectReadonlySchemas&&n!=null?r.getSchemaFinalName(o,n):o,a=_le(i),c=wVf(i),l=dDr({context:r,fileContainingReference:t,declarationFile:uDr({namespace:e.namespace,groupName:a}),type:s});return i.type==="nullable"&&(l=r.options.wrapReferencesToNullableInOptional?`optional<${l}>`:`nullable<${l}>`),i.type==="optional"&&!l.startsWith("optional<")&&(l=`optional<${l}>`),e.description==null&&c==null?l:{type:l,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function olo({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Oc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=`list<${rf(a)}>`;return e.description==null&&e.title==null&&e.default==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{},...e.default!=null?{default:e.default}:{},type:c}}function slo({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=pDr(e.key),c=Oc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=e.encoding!=null?Ijt(e.encoding):void 0,l=`map<${rf(a)}, ${rf(c)}>`;if(e.description==null&&u==null&&e.title==null)return l;let p={type:l};return e.description!=null&&(p.docs=e.description),e.encoding!=null&&(p.encoding=u),e.availability!=null&&(p.availability=R0(e.availability)),p}function alo({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){if(!n.options.respectNullableSchemas)return fDr({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});let a=Oc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=rf(a),u=kZe(a),l=jQe(a),p=rlo(a),d=tgc(c);if(n.options.wrapReferencesToNullableInOptional&&(d=QQe(d)),e.availability==null&&e.description==null&&u==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||u!=null)&&(f.docs=e.description??u),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=R0(e.availability)),f}function fDr({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Oc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=rf(a),u=kZe(a),l=jQe(a),p=rlo(a),d=QQe(c);if(e.availability==null&&e.description==null&&u==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||u!=null)&&(f.docs=e.description??u),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=R0(e.availability)),f}function clo(){return"unknown"}function ulo(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Ee(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function IVf({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let o=xjt(e,i),s=e.nameOverride??e.generatedName;n.builder.addType(r,{name:s,schema:o.schema});let a=dDr({type:s,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return a;let c={type:a};return e.description!=null&&(c.docs=e.description),e.default!=null&&(c.default=e.default.value),e.availability!=null&&(c.availability=R0(e.availability)),c}function vVf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=zQe({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:a.schema});let u=dDr({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?u:{type:u,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function xVf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=llo({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:a.schema});let u=dDr({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?u:{...e.title!=null?{"display-name":e.title}:{},type:u,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function dDr({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function CVf(e){return Aa._visit(e,{primitive:t=>t.nameOverride??t.generatedName,object:t=>t.nameOverride??t.generatedName,array:t=>t.nameOverride??t.generatedName,map:t=>t.nameOverride??t.generatedName,enum:t=>t.nameOverride??t.generatedName,reference:t=>t.nameOverride??t.generatedName,literal:t=>t.nameOverride??t.generatedName,oneOf:t=>t.nameOverride??t.generatedName,optional:t=>t.nameOverride??t.generatedName,nullable:t=>t.nameOverride??t.generatedName,unknown:t=>t.nameOverride??t.generatedName,_other:()=>{}})}function wVf(e){return Aa._visit(e,{primitive:t=>t.title,object:t=>t.title,array:t=>t.title,map:t=>t.title,enum:t=>t.title,reference:t=>t.title,literal:t=>t.title,oneOf:t=>t.title,optional:t=>t.title,nullable:t=>t.title,unknown:t=>{},_other:()=>{}})}var uVf,lVf,pVf,fVf,cZ=h(()=>{"use strict";wt();Ac();Cjt();NQe();cDr();tlo();vjt();_6();rgc();lDr();uVf=-2147483648,lVf=2147483647,pVf=-17976931348623157e292,fVf=17976931348623157e292});function Gle(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Ee(e)}}var mDr=h(()=>{"use strict";wt()});function agc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s;switch(e.type){case"primitive":s=OVf(e);break;case"array":s=SVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":s=TVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":s=PVf({schema:e,context:t,declarationFile:r,namespace:n,variant:o});break;case"unknown":s=DVf(e.nameOverride,e.generatedName,e.description);break;case"optional":s=cgc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":s=BVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":s=xjt(e,i);break;case"literal":s=RVf(e,e.nameOverride,e.generatedName);break;case"object":s=zQe({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;case"oneOf":s=llo({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;default:Ee(e)}return s}function zQe({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,skipReadonlyProperties:o,variant:s}){let a=o===!0||s==="write",c=e.properties.some(g=>g.readonly),u=new Set;for(let g of e.properties){if(a&&g.readonly)continue;let A=Object.entries(g.conflict);if(!A.every(([y,E])=>!E.differentSchema))for(let[y]of A)for(let E of wjt({property:g.key,schemaId:y,context:t,namespace:n}))u.add(E)}let l={};for(let g of e.properties)a&&g.readonly||Object.keys(g.conflict).length>0&&Object.values(g.conflict).every(y=>!y.differentSchema)||(l[g.key]=sgc({property:g,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:s}));for(let g of e.allOfPropertyConflicts)g.allOfSchemaIds.forEach(A=>u.add(A));let p=[];for(let g of e.allOf){let A=hDr({schema:g.schema,context:t,namespace:n});if(A==null||u.has(g.schema)||u.has(A))continue;let y=Oc({schema:Aa.reference(g),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});p.push(FZe(rf(y)))}for(let g of u){let A=NZe(t,g,n);for(let y of A.properties)l[y.key]==null&&(a&&y.readonly||(l[y.key]=sgc({property:y,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:s})));for(let y of A.allOf){if(u.has(y.schema))continue;let E=Oc({schema:Aa.reference(y),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});p.push(FZe(rf(E)))}}let d={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(l).map(([g,A])=>FVf(g)?[g,typeof A=="string"?{type:A,name:`_${g}`}:{...A,name:`_${g}`}]:[g,A]))};p.length>0&&(d.extends=p),e.additionalProperties&&(d["extra-properties"]=!0),e.availability!=null&&(d.availability=R0(e.availability)),e.source!=null&&(d.source=Gle(e.source)),e.encoding!=null&&(d.encoding=Ijt(e.encoding)),d.inline=flo(e,i);let f=e.nameOverride??e.generatedName;return{name:s==="read"&&c&&t.options.respectReadonlySchemas&&t.hasReadVariant(f)?`${f}Read`:f,schema:d}}function wjt({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];let o=i.type==="nullable"?i.value:i;if(o.type==="reference")return wjt({property:e,schemaId:o.schema,context:r,namespace:n});if(o.type==="object"){let{properties:s,allOf:a}=plo(r,o,n),c=s.some(l=>l.key===e),u=[...a.flatMap(l=>wjt({property:e,context:r,schemaId:l.schema,namespace:n}))];if(c||u.length>0)return[t,...u]}return[]}function plo(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?NZe(e,t.schema,r):t.type==="nullable"?plo(e,t.value,r):{properties:[],allOf:[]}}function NZe(e,t,r){let n=e.getSchema(t,r);return n==null?{properties:[],allOf:[]}:plo(e,n,r)}function SVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:olo({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function TVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:slo({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function OVf(e){let t=pDr(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function ogc(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function xjt(e,t){let r={enum:e.values.map(o=>{let s=o.nameOverride??o.generatedName,a=o.value;if(s===a&&o.description==null&&(o.casing==null||ogc(o.casing)))return s;let c={value:o.value};if(s!==a&&(c.name=s),o.description!=null&&(c.docs=o.description),o.casing!=null&&!ogc(o.casing)){let u={},l=!1;o.casing.camel!=null&&(u.camel=o.casing.camel,l=!0),o.casing.screamingSnake!=null&&(u["screaming-snake"]=o.casing.screamingSnake,l=!0),o.casing.snake!=null&&(u.snake=o.casing.snake,l=!0),o.casing.pascal!=null&&(u.pascal=o.casing.pascal,l=!0),l&&(c.casing=u)}return c})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=flo(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?Gle(e.source):void 0};for(let o of r.enum){let s=typeof o=="string"?o:o.name??o.value;n.has(s.toLowerCase())||(i.enum.push(o),n.add(s.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function PVf({schema:e,context:t,declarationFile:r,namespace:n,variant:i}){return{name:e.nameOverride??e.generatedName,schema:ilo({schema:e,context:t,fileContainingReference:r,namespace:n,variant:i})}}function BVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.options.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:alo({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:cgc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function cgc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:fDr({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function DVf(e,t,r){return r!=null?{name:e??t,schema:{type:"unknown",docs:r}}:{name:e??t,schema:clo()}}function RVf(e,t,r){return{name:t??r,schema:ulo(e)}}function llo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s=e.encoding!=null?Ijt(e.encoding):void 0;if(e.type==="discriminated"){let u={};for(let p of e.commonProperties)u[p.key]=Oc({schema:p.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o});let l={};for(let[p,d]of Object.entries(e.schemas))l[p]=Oc({schema:d,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:o});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantPropertyNameOverride!=null||e.discriminatorContext!=null?{...e.discriminantPropertyNameOverride!=null&&{name:e.discriminantPropertyNameOverride},value:e.discriminantProperty,...e.discriminatorContext!=null&&{context:e.discriminatorContext}}:e.discriminantProperty,"base-properties":u,docs:e.description??void 0,availability:e.availability!=null?R0(e.availability):void 0,union:l,"default-variant":e.defaultDiscriminantValue??void 0,encoding:s,source:e.source!=null?Gle(e.source):void 0}}}let a=[];for(let u of e.schemas)a.push(Oc({schema:u,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o}));let c=e.commonProperties!=null&&e.commonProperties.length>0?Object.fromEntries(e.commonProperties.map(u=>[u.key,Oc({schema:u.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o})])):void 0;return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,"base-properties":c,docs:e.description??void 0,union:a,encoding:s,source:e.source!=null?Gle(e.source):void 0,inline:flo(e,i)}}}function FVf(e){return kVf.test(e)}function hDr({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?hDr({context:t,schema:n.schema,namespace:r}):e}function sgc({property:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s=Oc({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:o});return NVf({typeReference:s,audiences:e.audiences,name:e.nameOverride,availability:R0(e.availability),propertyAccess:jVf(e),encoding:e.xml!=null?aDr(e.xml):void 0})}function NVf({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i,encoding:o}){return t.length===0&&r==null&&n==null&&i==null&&o==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{},...i!=null?{access:i}:{},...o!=null?{encoding:o}:{}}}function flo(e,t){return e.inline===!0||t>0?!0:void 0}function jVf(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return Fd.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return Fd.ObjectPropertyAccess.WriteOnly}}var kVf,Cjt=h(()=>{"use strict";wt();lo();Ac();cZ();NQe();cDr();mDr();_6();kVf=/^[0-9]/});function ugc(e){let t=e.replace(/^x-|^X-/,"");return ti(t)}var lgc=h(()=>{"use strict";Vi()});function pgc(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.usernamePlaceholder!=null&&(i.username===void 0?i.username={placeholder:n.usernamePlaceholder}:i.username.placeholder=n.usernamePlaceholder),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),n.passwordPlaceholder!=null&&(i.password===void 0?i.password={placeholder:n.passwordPlaceholder}:i.password.placeholder=n.passwordPlaceholder),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),n.tokenPlaceholder!=null&&(i.token===void 0?i.token={placeholder:n.tokenPlaceholder}:i.token.placeholder=n.tokenPlaceholder),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??ugc(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),n.headerPlaceholder!=null&&(i.placeholder=n.headerPlaceholder),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(Us.of("__package__.yml"),{name:"OauthScope",schema:xjt(n.scopesEnum,0).schema})}}var fgc=h(()=>{"use strict";Ey();Cjt();lgc()});function uZ({header:e,context:t,fileContainingReference:r,namespace:n}){let i=Oc({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),o=rf(i),s=jQe(i),a=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:ti(a);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null&&e.clientDefault==null&&s==null)return o;let u={type:o};return c!==e.name&&(u.name=c),e.description!=null&&(u.docs=e.description),e.env!=null&&(u.env=e.env),e.availability!=null&&(u.availability=R0(e.availability)),e.clientDefault!=null&&(u["client-default"]=e.clientDefault),s!=null&&(u.default=s),u}var jZe=h(()=>{"use strict";Vi();cZ();NQe();_6()});function gDr({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=Oc({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null&&e.clientDefault==null)return rf(i);let o=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:rf(i)};return e.description!=null&&(o.docs=e.description),e.availability!=null&&(o.availability=R0(e.availability)),e.clientDefault!=null&&"type"in o&&(o["client-default"]=e.clientDefault),o}var dlo=h(()=>{"use strict";cZ();NQe();_6()});function yDr({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=mlo({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let o=rf(i.value),s=hlo(e.schema,t,n)??jQe(i.value);o==="unknown"?o="string":o==="optional<unknown>"&&(o="optional<string>");let a={type:o};return e.clientDefault!=null&&(a["client-default"]=e.clientDefault),s!=null&&(a.default=s),i.allowMultiple&&(a["allow-multiple"]=!0),e.explode!=null&&(a.explode=e.explode),e.description!=null&&(a.docs=e.description),e.parameterNameOverride!=null&&(a.name=e.parameterNameOverride),e.availability!=null&&(a.availability=R0(e.availability)),QVf(i.value)&&i.value.validation!==void 0&&(a.validation=i.value.validation),a.default==null&&a["client-default"]==null&&a["allow-multiple"]==null&&a.docs==null&&a.name==null&&a.availability==null&&a.validation==null&&a.explode==null?o:a}function mlo({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:Oc({schema:Aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:Us.of(qf),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,c]of Object.entries(i.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(s=!0),c.type==="literal"&&c.value.type==="string"&&(BZe.test(c.value.value)?o.push(c.value.value):o.push({value:c.value.value,name:DZe(c.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[a,c]=i.value.schemas;if(a!=null&&c!=null&&ADr({array:a,primitive:c}))return{value:Oc({schema:Aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&c!=null&&ADr({array:c,primitive:a}))return{value:Oc({schema:Aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[a,c]of Object.entries(i.value.schemas))return mlo({schema:c,context:t,fileContainingReference:r,namespace:n})}else if(t.options.objectQueryParameters)return{value:Oc({schema:e,context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?Aa.optional:Aa.nullable;if(e.value.type==="reference"){let o=t.getSchema(e.value.schema,n);if(o==null)return;if(o.type==="array")return{value:Oc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:o.value,description:e.description??o.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.options.objectQueryParameters)return{value:Oc({schema:e,context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:Oc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,c]of Object.entries(e.value.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(s=!0),c.type==="literal"&&c.value.type==="string"&&(BZe.test(c.value.value)?o.push(c.value.value):o.push({value:c.value.value,name:DZe(c.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[a,c]=e.value.value.schemas;if(a!=null&&c!=null&&ADr({array:a,primitive:c}))return{value:Oc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&c!=null&&ADr({array:c,primitive:a}))return{value:Oc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}if(t.options.objectQueryParameters)return{value:Oc({schema:e,context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[a,c]of Object.entries(e.value.value.schemas))return mlo({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.options.objectQueryParameters?{value:Oc({schema:e,context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:Oc({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:Oc({schema:Aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}:{value:Oc({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function hlo(e,t,r){if(e.type==="array")return e.default??void 0;if(e.type==="optional"||e.type==="nullable")return hlo(e.value,t,r);if(e.type==="reference"){let n=t.getSchema(e.schema,r);if(n!=null)return hlo(n,t,r)}}function ADr({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function QVf(e){return typeof e=="object"&&e!==null&&"type"in e}var glo=h(()=>{"use strict";aa();Ac();Ey();cZ();NQe();_6()});function dgc({websocketExample:e,context:t}){let r={messages:[]};e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=zVf(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=MVf({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=U0e(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function zVf(e){let t={};return e.forEach(r=>{let n=U0e(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function MVf({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let o=U0e(i.value);r.has(i.name)||o!=null&&(n[i.name]=o)}),n}function U0e(e){switch(e.type){case"primitive":return mgc(e.value);case"object":return hgc(e.properties);case"array":return LVf(e.value);case"map":return VVf(e.value);case"oneOf":return UVf(e.value);case"enum":return e.value;case"literal":return _Vf(e.value);case"unknown":return U0e(e.value);case"null":return null;default:Ee(e)}}function mgc(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:Ee(e)}}function hgc(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,U0e(r)]))}function LVf(e){return e.map(t=>U0e(t))}function VVf(e){return Object.fromEntries(e.map(t=>[mgc(t.key),U0e(t.value)]))}function UVf(e){return e.type==="discriminated"?hgc(e.value):U0e(e.value)}function _Vf(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ee(e)}}var ggc=h(()=>{"use strict";wt()});function Sjt(e){try{let r=new URL(e).pathname.split("/").filter(n=>n.length>0);if(r.length>0)return r[r.length-1]}catch{}}function Tjt(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function bDr(e,t,r=!1){let n=Sjt(t);return r&&n!=null?n:e!=null&&n!=null?`${e}_${n}`:n??e??"websocket"}var Alo=h(()=>{"use strict"});function qle(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function EDr(e,t){return t??(e?.groupName!=null?qle(e.groupName):void 0)}function Agc({endpointNamespace:e,error:t}){return t.namespace??e}var MQe=h(()=>{"use strict"});function ygc({channel:e,context:t,declarationFile:r}){let n=e.servers[0],i=t.ir.servers.length===0&&t.ir.websocketServers.length<=1,o=n!=null?t.getUrlId(n.url):void 0,s=n!=null&&!i?o??(t.options.groupEnvironmentsByHost?bDr(n.name,n.url,!0):n.name):void 0;t.logger.debug(`[buildChannel] Channel path="${e.path}", server name="${n?.name}", server url="${n?.url}", resolved urlId="${s}" (from collision map: ${t.getUrlId(n?.url??"")!=null})`);let a=e.path;for(let m of e.handshake.pathParameters)m.parameterNameOverride!=null&&(a=a.replace(`{${m.name}}`,`{${m.parameterNameOverride}}`));let c=t.authOverrides?.auth!=null,u={path:a,url:s,auth:c};e.audiences!=null&&e.audiences.length>0&&(u.audiences=e.audiences),e.summary!=null&&(u["display-name"]=e.summary),e.connectMethodName!=null&&(u["connect-method-name"]=e.connectMethodName),e.description!=null&&(u.docs=e.description);let l=qle(e.groupName),p={};if(e.handshake.pathParameters.length>0)for(let m of e.handshake.pathParameters){let g=m.parameterNameOverride??m.name;p[g]=gDr({pathParameter:m,context:t,fileContainingReference:r,namespace:l})}Object.keys(p).length>0&&(u["path-parameters"]=p);let d={};if(e.handshake.queryParameters.length>0)for(let m of e.handshake.queryParameters){let g=yDr({queryParameter:m,context:t,fileContainingReference:r,namespace:l});g!=null&&(d[m.name]=g)}Object.keys(d).length>0&&(u["query-parameters"]=d);let f={};if(e.handshake.headers.length>0)for(let m of e.handshake.headers){let g=uZ({header:m,context:t,fileContainingReference:r,namespace:l});f[m.name]=g}Object.keys(f).length>0&&(u.headers=f),t.builder.addChannel(r,{channel:u});for(let m of e.messages){let g={origin:m.origin,body:Oc({schema:m.body,context:t,fileContainingReference:r,namespace:l,declarationDepth:0})};m.displayName!=null&&(g["display-name"]=m.displayName),m.methodName!=null&&(g["method-name"]=m.methodName),t.builder.addChannelMessage(r,{messageId:m.name,message:g})}for(let m of e.examples){let g=dgc({context:t,websocketExample:m});t.builder.addChannelExample(r,{example:g})}}var bgc=h(()=>{"use strict";jZe();dlo();glo();cZ();ggc();Alo();MQe()});function ylo(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}function Egc(e){try{return new URL(e).hostname}catch{return}}function Igc(e){return e??vgc}function GVf(e,t){let r=new Map;for(let n of e){if(ylo(n)||!("url"in n)||!n.url)continue;let i=Egc(n.url)??n.url;r.has(i)||r.set(i,{environmentName:Igc(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.httpServers.push({name:n.name,url:n.url,audiences:n.audiences})}for(let n of t){let i=Egc(n.url)??n.url;r.has(i)||r.set(i,{environmentName:Igc(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.websocketServers.push(n)}return r}function _0e(e){return Object.entries(e).reduce((t,[r,n])=>(mD(n)?Object.entries(n.urls).forEach(([i,o])=>{t[i]=o}):t[r]=typeof n=="string"?n:n.url,t),{})}function qVf(e,t,r){for(let[n,i]of Object.entries(t))if(i!=null)if(e[n]!=null&&e[n]!==i){let o=Tjt(i),s=o!=null?`${n}_${o}`:`${n}_ws`;e[s]=i,r.setUrlId(i,s)}else e[n]=i,r.setUrlId(i,n)}function xgc(e){let t=e.environmentOverrides?.["base-url-env"]??e.ir.baseUrlEnv;if(t!=null&&e.builder.setBaseUrlEnv(t),e.environmentOverrides!=null){for(let[C,O]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:C,schema:O});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let r={},n=[],i=e.ir.servers.some(C=>ylo(C)),o=e.ir.servers;for(let C of o)if(ylo(C)){let O={urls:{}},D={},R={},P={};for(let[J,X]of Object.entries(C.urls))O.urls[J]=X.defaultUrl??X.url,X.urlTemplate&&(D[J]=X.urlTemplate),X.defaultUrl&&(R[J]=X.defaultUrl),X.variables&&X.variables.length>0&&(P[J]=X.variables);(Object.keys(D).length>0||Object.keys(P).length>0)&&(O["url-templates"]=D,O["default-urls"]=R,O.variables=P),C.name&&(r[C.name]=O)}else if("url"in C&&C.url){let D=C.urlTemplate!=null&&C.variables!=null&&C.variables.length>0?{url:C.url,audiences:C.audiences,"default-url":C.defaultUrl,"url-template":C.urlTemplate,variables:C.variables?.map(R=>({id:R.id,default:R.default,values:R.values}))}:C.audiences?{url:C.url,audiences:C.audiences}:C.url;if(C.name==null){n.push(D);continue}r[C.name]=D}let s={},a={},c=[],u={},l={},p={};for(let C of e.ir.endpoints)for(let O of C.servers){if(O.url==null&&O.name!=null){s[O.name]||(s[O.name]=[]);continue}if(O.url==null)continue;let D=O,R="defaultUrl"in O&&typeof D.defaultUrl=="string"?D.defaultUrl:void 0,P="urlTemplate"in O&&typeof D.urlTemplate=="string"?D.urlTemplate:void 0,M="variables"in O&&Array.isArray(D.variables)?D.variables:void 0,J=R??O.url,X=O.audiences?{url:J,audiences:O.audiences}:J;if(O.name==null){c.push(X);continue}s[O.name]||(s[O.name]=[]),s[O.name]?.push({url:J,audiences:O.audiences}),a[O.name]=X,P&&O.name&&(u[O.name]=P),R&&O.name&&(l[O.name]=R),M&&M.length>0&&O.name&&(p[O.name]=M)}let d={},f=[];for(let C of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${C.name}", url="${C.url}"`);let O=C.audiences?{url:C.url,audiences:C.audiences}:C.url;if(C.name==null){f.push(O);continue}d[C.name]=O}let m=Object.keys(r).length,g=m>0,A=Object.keys(a).length>0,y=Object.keys(s).some(C=>s[C]?.length===0),E=Object.keys(d).length>0;if(e.options.groupEnvironmentsByHost&&E&&(g||e.ir.servers.length>0)){let C=Object.entries(d).map(([D,R])=>({name:D,url:typeof R=="string"?R:R.url,audiences:typeof R=="string"?void 0:R.audiences})),O=GVf(o,C);if(O.size>0){let D=!0;for(let[R,P]of O.entries()){let M={},J=[...P.httpServers.map($=>({...$,isHttp:!0})),...P.websocketServers.map($=>({...$,isHttp:!1}))],X=new Map;for(let $ of J){let ie=Sjt($.url),ue=Tjt($.url);ie&&ue&&(X.has(ie)||X.set(ie,new Set),X.get(ie)?.add(ue))}if(P.httpServers.length>0){let $=P.httpServers[0];$!=null&&(M[ME]=$.url,e.setUrlId($.url,ME));for(let ie=1;ie<P.httpServers.length;ie++){let ue=P.httpServers[ie];if(ue!=null){let oe=Sjt(ue.url),de=Tjt(ue.url),we=oe?X.get(oe):void 0,De=we&&we.size>1,ae=De&&de!=="https"?`${oe}_${de}`:oe||`Http${ie+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${ue.url}", pathSegment="${oe}", protocol="${de}", hasCollision=${De}, urlId="${ae}"`),M[ae]=ue.url,e.setUrlId(ue.url,ae)}}}for(let $ of P.websocketServers){let ie=Sjt($.url),ue=Tjt($.url),oe=ie?X.get(ie):void 0,de=oe&&oe.size>1,we=de?`${ie}_${ue}`:bDr($.name,$.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${$.name}", url="${$.url}", pathSegment="${ie}", protocol="${ue}", hasCollision=${de}, urlId="${we}"`),M[we]=$.url,e.setUrlId($.url,we)}if(Object.keys(M).length>1)e.builder.addEnvironment({name:P.environmentName,schema:{urls:M}});else if(Object.keys(M).length===1){let $=Object.values(M)[0];$!=null&&e.builder.addEnvironment({name:P.environmentName,schema:$})}D&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(P.environmentName),Object.keys(M).length>1&&e.builder.setDefaultUrl(ME),D=!1)}return}}if(!g&&!A&&E&&e.ir.servers.length===0){for(let[C,O]of Object.entries(d))e.builder.addEnvironment({name:C,schema:O});e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(Object.keys(d)[0]),e.builder.setDefaultUrl(ME);return}if(c.length>0&&e.logger.debug(`Skipping endpoint level servers ${c.map(C=>typeof C=="string"?C:C.url).join(", ")} because x-fern-server-name was not provided.`),!g){let C=e.ir.servers[0],O=C?.url,D=C?.audiences,R=C?.defaultUrl,P=C?.urlTemplate,M=C?.variables;if(O!=null){let X=P!=null&&M!=null&&M.length>0?{url:O,audiences:D,"default-url":R,"url-template":P,variables:M?.map($=>({id:$.id,default:$.default,values:$.values}))}:D?{url:O,audiences:D}:O;r[vgc]=X}}let x=Object.values(r).map(C=>typeof C=="string"?C:mD(C)?Object.values(C.urls)[0]:C.url),v=n.filter(C=>{let O=typeof C=="string"?C:C.url;return!x.includes(O)});if(v.length>0&&e.logger.debug(`Skipping top level servers ${v.map(C=>typeof C=="string"?C:C.url).join(", ")} because x-fern-server-name was not provided.`),i){let C=!0;for(let[O,D]of Object.entries(r))if(e.builder.addEnvironment({name:O,schema:D}),C){if(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(O),mD(D)){let R=Object.keys(D.urls)[0];R&&e.builder.setDefaultUrl(R)}C=!1}return}if(!A&&!y){let C=!0;for(let[O,D]of Object.entries(r))if(C){if(E){let R=typeof D=="string"?D:mD(D)?Object.values(D.urls)[0]:D["default-url"]??D.url;R!=null&&e.setUrlId(R,ME),e.builder.addEnvironment({name:O,schema:{urls:{[ME]:R??"",..._0e(d)}}})}else e.builder.addEnvironment({name:O,schema:D});e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(O),C=!1}else if(E){let R=typeof D=="string"?D:mD(D)?Object.values(D.urls)[0]:D["default-url"]??D.url;R!=null&&e.setUrlId(R,ME),e.builder.addEnvironment({name:O,schema:{urls:{[ME]:R??"",..._0e(d)}}})}else e.builder.addEnvironment({name:O,schema:D});E&&e.builder.setDefaultUrl(ME)}else if(m===1){let C=Object.keys(r)[0],O=Object.values(r)[0],D=typeof O=="string"?O:mD(O)?Object.values(O.urls)[0]:O["default-url"]??O.url,R={},P={},M={};typeof O!="string"&&!mD(O)&&(O["url-template"]&&(R[ME]=O["url-template"]),O["default-url"]&&(P[ME]=O["default-url"]),O.variables&&O.variables.length>0&&(M[ME]=O.variables)),Object.assign(R,u),Object.assign(P,l),Object.assign(M,p);let J=Object.keys(R).length>0||Object.keys(M).length>0;D!=null&&e.setUrlId(D,ME);let X={urls:{[ME]:D??"",..._0e(a),..._0e(d)},...J?{"url-templates":R,"default-urls":P,variables:M}:{}};e.builder.addEnvironment({name:C,schema:X}),e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(C),e.builder.setDefaultUrl(ME)}else{let C=new Map;for(let P of e.ir.endpoints)for(let M of P.servers)if(M.url!=null&&M.name!=null){C.has(M.name)||C.set(M.name,new Map);let J=M.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",X=C.get(M.name);X&&X.set(J,M.url)}let O=new Set(C.keys()),D=new Set(Object.keys(r)),R=O.size>0&&[...O].every(P=>D.has(P));if(e.options.multiServerStrategy==="urls-per-environment"&&C.size>0&&R){let P=Object.entries(r),M=P[0];if(M){let[J,X]=M,$=typeof X=="string"?X:mD(X)?Object.values(X.urls)[0]:X["default-url"]??X.url,ie={};$!=null&&(ie[ME]=$,e.setUrlId($,ME));for(let ue=1;ue<P.length;ue++){let oe=P[ue];if(oe==null)continue;let[de,we]=oe,De=typeof we=="string"?we:mD(we)?Object.values(we.urls)[0]:we["default-url"]??we.url;De!=null&&(ie[de]=De,e.setUrlId(De,de))}E&&qVf(ie,_0e(d),e),e.builder.addEnvironment({name:J,schema:{urls:ie}}),e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(J),e.builder.setDefaultUrl(ME)}}else if(C.size>0){let P=!0;for(let[M,J]of Object.entries(r)){let X=typeof J=="string"?J:mD(J)?Object.values(J.urls)[0]:J["default-url"]??J.url;if(!X)continue;e.setUrlId(X,ME);let $=X.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",ie={[ME]:X};for(let[ue,oe]of C.entries()){let de=oe.get($)||oe.get("production")||oe.values().next().value;de&&(ie[ue]=de)}E&&Object.assign(ie,_0e(d)),Object.keys(ie).length>1?e.builder.addEnvironment({name:M,schema:{urls:ie}}):e.builder.addEnvironment({name:M,schema:X}),P&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(M),P=!1)}C.size>0&&e.builder.setDefaultUrl(ME)}else{let P=!0;for(let[M,J]of Object.entries(r)){if(E||Object.keys(a).length>0){let X=typeof J=="string"?J:mD(J)?Object.values(J.urls)[0]:J["default-url"]??J.url;X!=null&&e.setUrlId(X,ME),e.builder.addEnvironment({name:M,schema:{urls:{[ME]:X??"",..._0e(a),..._0e(d)}}})}else e.builder.addEnvironment({name:M,schema:J});P&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(M),P=!1)}}}}var ME,vgc,Cgc=h(()=>{"use strict";lo();Alo();ME="Base",vgc="Default"});function wgc(e){if(e.globalHeaderOverrides!=null){for(let[r,n]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:n});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let o=n.optional===!0?"optional<string>":"string",s=o;if(n.name==null&&n.env==null&&n.clientDefault==null&&typeof n.schema=="string")s=n.schema;else if(n!=null){let a=n.schema?_le(n.schema):void 0,c=a!=null?qle(a):void 0,u=Us.of("api.yml");s={name:n.name,env:n.env,type:n.schema!=null?rf(Oc({schema:n.schema,context:e,fileContainingReference:c?NI(Us.of(ti(c)),u):u,namespace:c,declarationDepth:0}))??o:o},(typeof n.clientDefault=="string"||typeof n.clientDefault=="boolean")&&(s["client-default"]=n.clientDefault)}e.builder.addGlobalHeader({name:r,schema:s})}if(e.options.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let o of i.headers){if(HVf.has(o.name.toLowerCase()))continue;let s=r[o.name];if(s==null){let a=t[o.name],c=uZ({header:{...o,schema:a?.schema??o.schema,name:a?.name??o.name},fileContainingReference:Us.of(zI),context:e,namespace:void 0});s=new blo(c),r[o.name]=s}s.increment()}let n=e.ir.endpoints.length*WVf;for(let[i,o]of Object.entries(r)){let s=t[i],a=o.count===e.ir.endpoints.length,c=o.count>=n;s==null&&(a?e.builder.addGlobalHeader({name:i,schema:o.schema}):c&&e.builder.addGlobalHeader({name:i,schema:QQe(o.schema)}))}}}var blo,WVf,HVf,Sgc=h(()=>{"use strict";aa();Ey();Vi();jZe();cZ();vjt();MQe();_6();lDr();blo=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},WVf=.75,HVf=new Set(["authorization"])});function Tgc(e){let t=e.ir.globalParameters;if(!(t==null||t.length===0))for(let r of t){let n=KVf(r);e.builder.addGlobalParameter({name:r.name,schema:n})}}function KVf(e){let t={};return e.in!=null&&(t.in=e.in),e.target!=null&&(t.target=e.target),e.type!=null&&(t.type=e.type),e.env!=null&&(t.env=e.env),e.default!=null&&(t.default=e.default),e.optional!=null&&(t.optional=e.optional),e.apply!=null&&(t.apply=e.apply),e.parameterName!=null&&(t["parameter-name"]=e.parameterName),e.docs!=null&&(t.docs=e.docs),t}var Ogc=h(()=>{"use strict"});function Pgc(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?_le(t.schema):void 0,n=r!=null?qle(r):void 0,i=uZ({header:{...t,schema:t.schema??Aa.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:Ku.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0})}),name:t.name??t.header,parameterNameOverride:void 0,description:void 0,availability:void 0,source:void 0,clientDefault:void 0},fileContainingReference:Us.of(zI),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:QQe(i)})}}var Bgc=h(()=>{"use strict";aa();Ac();Ey();jZe();vjt();MQe();lDr()});function ED(e){switch(e.type){case"primitive":return Rgc(e.value);case"object":return kgc(e.properties);case"array":return Fgc(e.value);case"map":return YVf(e.value);case"oneOf":return XVf(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return ZVf(e.value);case"unknown":return ED(e.value);case"null":return null;default:Ee(e)}}function Dgc(e){switch(e.type){case"withStreaming":return e.sse?{stream:JVf(e.events)}:{stream:Fgc(e.events)};case"withoutStreaming":return{body:ED(e.value)};default:Ee(e)}}function Rgc(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:Ee(e)}}function kgc(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,ED(r)]))}function JVf(e){return e.map(t=>({event:"",data:ED(t)}))}function Fgc(e){return e.map(t=>ED(t))}function YVf(e){return Object.fromEntries(e.map(t=>[Rgc(t.key),ED(t.value)]))}function XVf(e){return e.type==="discriminated"?kgc(e.value):ED(e.value)}function ZVf(e){switch(e.type){case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"boolean":return e.value;default:Ee(e)}}var IDr=h(()=>{"use strict";wt()});function Ngc({endpointExample:e,context:t,pathParameterRenames:r}){let n={};if(e.type!=="full")return e.value;e.name!=null&&(n.name=e.name),e.description!=null&&(n.docs=e.description);let i={};if(t.ir.basePathParameters!=null)for(let u of t.ir.basePathParameters){let l=u.clientDefault??u.name;(typeof l=="string"||typeof l=="number"||typeof l=="boolean")&&(i[u.name]=l)}e.pathParameters!=null&&e.pathParameters.length>0&&Object.assign(i,$Vf(e.pathParameters,r)),Object.keys(i).length>0&&(n["path-parameters"]=i),e.queryParameters!=null&&e.queryParameters.length>0&&(n["query-parameters"]=eUf(e.queryParameters));let o=e.headers!=null&&e.headers.length>0,s=t.builder.getGlobalHeaders(),a=Object.keys(s).length>0,c=new Set(e.headers?.map(u=>u.name)??[]);if(o||a){let u=[];if(e.headers!=null)for(let l of e.headers)l.name!==t.builder.getAuthHeaderName()&&u.push(l);for(let[l,p]of Object.entries(s)){if(p!=null&&typeof p=="object"&&p.type!=null){let f=_v({type:p.type,_default:void 0,validation:void 0,visitor:{primitive:At,map:At,list:At,optional:m=>m,nullable:m=>m,set:At,named:At,literal:m=>{if(m.type==="string")return m.string;if(m.type==="boolean")return m.boolean.toString()},unknown:At}});if(f!=null){let m=u.findIndex(A=>A.name===l),g={name:l,value:hc.literal(T0e.string(f))};m>=0?u[m]=g:u.push(g);continue}}if(c.has(l))continue;let d=p!=null&&typeof p=="object"?p.type:typeof p=="string"?p:void 0;u.push({name:l,value:hc.primitive(tUf(jgc(d),l))})}n.headers=rUf({context:t,namedFullExamples:u})}return e.request!=null&&(n.request=ED(e.request)),e.response!=null&&(n.response=Dgc(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(n["code-samples"]=e.codeSamples.map(u=>u.type==="language"?{name:u.name??void 0,docs:u.description??void 0,language:u.language,code:u.code,install:u.install??void 0}:{name:u.name??void 0,docs:u.description??void 0,sdk:u.sdk,code:u.code}).filter(sa)),n}function $Vf(e,t){let r={};return e.forEach(n=>{let i=ED(n.value);if(i!=null){let o=n.parameterNameOverride??t?.[n.name]??n.name;r[o]=i}}),r}function eUf(e){let t={};return e.forEach(r=>{let n=ED(r.value);n!=null&&(t[r.name]=n)}),t}function jgc(e){if(e==null)return;let t=e.match(/^(?:optional|nullable)<(.+)>$/);return t!=null?jgc(t[1]):e}function tUf(e,t){switch(e){case"integer":case"int":return Bo.int(0);case"int64":case"long":return Bo.int64(0);case"uint":return Bo.uint(0);case"uint64":return Bo.uint64(0);case"float":return Bo.float(0);case"double":return Bo.double(0);case"boolean":return Bo.boolean(!0);case"date":return Bo.date("2024-01-01");case"date-time":case"datetime":return Bo.datetime("2024-01-01T00:00:00Z");case"base64":return Bo.base64("SGVsbG8=");default:return Bo.string(t)}}function rUf({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=ED(n.value);i!=null&&(r[n.name]=i)}),r}var Qgc=h(()=>{"use strict";wt();lo();Ac();IDr()});var yP,Ojt=h(()=>{"use strict";(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(yP||(yP={}))});function zgc(e){return E1._visit(e,{get:()=>Fd.HttpMethodSchema.Get,post:()=>Fd.HttpMethodSchema.Post,put:()=>Fd.HttpMethodSchema.Put,patch:()=>Fd.HttpMethodSchema.Patch,delete:()=>Fd.HttpMethodSchema.Delete,head:()=>Fd.HttpMethodSchema.Head,options:()=>{throw new S({message:"OPTIONS is unsupported",code:S.Code.ConfigError})},trace:()=>{throw new S({message:"TRACE is unsupported",code:S.Code.ConfigError})},_other:()=>{throw new S({message:"Unknown http method is unsupported",code:S.Code.ConfigError})}})}var Mgc=h(()=>{"use strict";lo();Ac();Ft()});function Elo(e){return e==="POST"||e==="PUT"||e==="PATCH"}var Lgc=h(()=>{"use strict"});function nUf({endpoint:e,context:t,namespace:r}){let n=new Set;for(let o of e.queryParameters)n.add(o.name);for(let o of e.headers)n.add(o.parameterNameOverride??o.name);let i=e.request;if(i==null)return n;switch(i.type){case"multipart":for(let o of i.properties)n.add(o.key);break;case"json":case"formUrlEncoded":{let o=i.schema.type==="reference"?i.schema.schema:void 0,s=i.schema.type==="reference"?t.getSchema(i.schema.schema,r):i.schema;if(s?.type!=="object"||o!=null&&t.isResponseReachable(o)){n.add("body");break}for(let a of s.properties)n.add(a.nameOverride??a.key);for(let a of s.allOf){let{properties:c}=NZe(t,a.schema,r);for(let u of c)n.add(u.nameOverride??u.key)}break}case"octetStream":break;default:Ee(i)}return n}function iUf({pathParameterName:e,reservedNames:t,pathParameters:r}){let n=new Set;for(let s of r){let a=s.parameterNameOverride??s.name;a!==e&&n.add(a)}let i=`${e}${Vgc}`,o=2;for(;t.has(i)||n.has(i);)i=`${e}${Vgc}${o}`,o++;return i}function _gc({endpoint:e,declarationFile:t,context:r}){let n=[],i=new Set,o=e.path,s=EDr(e.sdkName,e.namespace),a=nUf({endpoint:e,context:r,namespace:s}),c={},u={};for(let y of e.pathParameters){let E=y.parameterNameOverride;E==null&&a.has(y.name)&&(E=iUf({pathParameterName:y.name,reservedNames:a,pathParameters:e.pathParameters}),c[y.name]=E),E&&(o=o.replace(`{${y.name}}`,`{${E}}`)),u[E??y.name]=gDr({pathParameter:y,context:r,fileContainingReference:t,namespace:s})}let l={};for(let y of e.queryParameters){let E=yDr({queryParameter:y,context:r,fileContainingReference:t,namespace:s});E!=null&&(l[y.name]=E,i.add(y.name))}let p;if(e.pagination!=null)switch(e.pagination.type){case"cursor":p={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":p={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":p={type:"custom",results:e.pagination.results};break;case"uri":p={next_uri:e.pagination.nextUri,results:e.pagination.results};break;case"path":p={next_path:e.pagination.nextPath,results:e.pagination.results};break;default:Ee(e.pagination)}let d={path:o,method:zgc(e.method),auth:oUf({endpoint:e,context:r}),docs:e.description??void 0,pagination:p,source:e.source!=null?Gle(e.source):void 0};!uUf({context:r,request:e.request})&&Object.keys(u).length>0&&(d["path-parameters"]=u),e.summary!=null&&(d["display-name"]=e.summary),e.subtitle!=null&&(d.subtitle=e.subtitle);let f={},m=r.builder.getGlobalHeaderNames(),g=r.builder.getAuthHeaderName();g!=null&&m.add(g);let A=e.headers.filter(y=>!m.has(y.name));for(let y of A){let E=uZ({header:y,context:r,fileContainingReference:t,namespace:s});f[y.name]=E,i.add(typeof E=="string"?y.name:E.name??y.name)}if(e.request!=null){r.setInState(yP.Request);let y=cUf({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.options.inlinePathParameters&&Object.keys(u).length>0?u:void 0,queryParameters:Object.keys(l).length>0?l:void 0,headers:Object.keys(f).length>0?f:void 0,usedNames:i,namespace:s});d.request=y.value,n=[...n,...y.schemaIdsToExclude??[]],r.unsetInState(yP.Request)}else{let y=r.options.inlinePathParameters&&Object.keys(u).length>0,E=Object.keys(l).length>0,x=Object.keys(f).length>0,v={};(y||E||x)&&(v.name=e.requestNameOverride??e.generatedRequestName),y&&(v["path-parameters"]=u),E&&(v["query-parameters"]=l),x&&(v.headers=f),Object.keys(v).length>0&&(d.request=v)}if(e.response!=null&&e.response._visit({json:y=>{let E=Oc({schema:y.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0,variant:r.options.respectReadonlySchemas&&r.options.useReadVariantForResponses?"read":void 0});d.response={docs:y.description??void 0,type:rf(E)},y.statusCode!=null&&(d.response["status-code"]=y.statusCode),y.responseProperty!=null&&(d.response.property=y.responseProperty)},streamingJson:y=>{let E=Oc({schema:y.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0,variant:r.options.respectReadonlySchemas&&r.options.useReadVariantForResponses?"read":void 0});d["response-stream"]={docs:y.description??void 0,type:rf(E),format:"json",terminator:y.terminator??void 0}},streamingSse:y=>{let E=Oc({schema:y.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0,variant:r.options.respectReadonlySchemas&&r.options.useReadVariantForResponses?"read":void 0});d["response-stream"]={docs:y.description??void 0,type:rf(E),format:"sse",terminator:y.terminator??void 0,resumable:y.resumable??void 0}},file:y=>{d.response={docs:y.description??void 0,type:"file","status-code":y.statusCode}},bytes:y=>{d.response={docs:y.description??void 0,type:"bytes","status-code":y.statusCode}},streamingText:y=>{d["response-stream"]={docs:y.description??void 0,type:"text"}},text:y=>{d.response={docs:y.description??void 0,type:"text","status-code":y.statusCode,"content-type":y.contentType??void 0}},_other:()=>{throw new S({message:"Unrecognized Response type: "+e.response?.type,code:S.Code.InternalError})}}),r.builder.getEnvironmentType()==="multi"){let y=r.getDefaultServerName(),E=e.servers[0];if(E==null)y!=null&&(d.url=y);else{let x=E.url!=null?r.getUrlId(E.url):void 0;d.url=x??E.name??void 0}}return e.idempotent&&(d.idempotent=!0),e.availability!=null&&(d.availability=R0(e.availability)),Object.entries(e.errors).forEach(([y,E])=>{let x=E.generatedName,v=Us.of(qf);r.builder.enableUniqueErrorsPerEndpoint&&(x=`${e.generatedRequestName}${E.generatedName}`,E.schema!=null&&(E.schema.type!=="reference"&&E.schema.type!=="oneOf"?E.schema.generatedName=`${e.generatedRequestName}${E.schema.generatedName}`:E.schema.type==="oneOf"&&(E.schema.value.generatedName=`${e.generatedRequestName}${E.schema.value.generatedName}`)));let C={"status-code":E.isWildcardStatusCode===!0?y:parseInt(y)},O=Agc({endpointNamespace:s,error:E}),D=Zhc({location:qgc,namespaceOverride:O});if(E.schema!=null){let M=Oc({schema:E.schema,context:r,fileContainingReference:D,declarationFile:D,namespace:O,declarationDepth:0});C.type=rf(M),C.docs=E.description}r.builder.addError(D,{name:x,schema:r.isErrorUnknownSchema({statusCode:y,namespace:E.namespace})?{...C,type:"unknown"}:C}),d.errors==null&&(d.errors=[]);let R=r.builder.addImport({file:t,fileToImport:D});d.errors.push(R!=null?`${R}.${x}`:x),C.type!=null&&E.examples?.forEach(M=>{let J={value:ED(M.example),name:M.name,docs:M.description};r.builder.addErrorExample(D,{name:x,example:J})})}),e.examples.length>0&&(d.examples=sUf({endpointExamples:e.examples,context:r,pathParameterRenames:c})),e.retries!=null&&(d.retries=aUf({retries:e.retries})),e.globalParameterIds!=null&&e.globalParameterIds.length>0&&(d["global-parameters"]=e.globalParameterIds),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?d.audiences=[Ilo,...e.audiences]:e.audiences.length>0&&(d.audiences=e.audiences),{value:d,schemaIdsToExclude:n}}function oUf({endpoint:e,context:t}){return e.security==null?t.authOverrides?.auth!=null?!0:t.ir.security==null?void 0:t.ir.security.length>0?!0:void 0:e.security.length===0?!1:JSON.stringify(e.security)===JSON.stringify(t.ir.security)?!0:e.security}function sUf({endpointExamples:e,context:t,pathParameterRenames:r}){return e.map(n=>{try{return Ngc({endpointExample:n,context:t,pathParameterRenames:r})}catch(i){throw console.error(`Error building endpoint example: ${i}`),i}})}function aUf({retries:e}){if(e!=null){if(e.type==="disabled")return{disabled:e.value??void 0};Ee(e)}}function cUf({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:o,pathParameters:s,queryParameters:a,headers:c,usedNames:u,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let p=n.schema.type==="reference"?n.schema.schema:void 0,d=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(d?.type!=="object"||p!=null&&r.isResponseReachable(p)){let R=r.options.respectReadonlySchemas&&Elo(e.method)?"write":void 0,P=Oc({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0,variant:R}),M={body:P},J=Object.keys(s??{}).length>0,X=Object.keys(a??{}).length>0,$=Object.keys(c??{}).length>0;J&&(M["path-parameters"]=s),X&&(M["query-parameters"]=a),$&&(M.headers=c),(J||X||$)&&(M.name=i??o),n.contentType!=null&&(M["content-type"]=n.contentType),n.description!=null&&(M.docs=n.description);let ie=typeof M.body=="string"&&M["path-parameters"]==null&&M["query-parameters"]==null&&M.headers==null&&M.name==null&&M.docs==null&&(M["content-type"]==null||M["content-type"]==="application/json"),ue=Ugc(n);return ue&&(ie&&delete M["content-type"],M.body=typeof P=="string"?{type:P,optional:!0}:{...P,optional:!0}),{schemaIdsToExclude:[],value:ie&&!ue?M.body:M}}let f=new Map;for(let D of d.allOf){let R=r.getSchema(D.schema,l);if(R==null)continue;let P=_le(R),M=Ule(P),{properties:J}=NZe(r,D.schema,l);for(let X of J)f.set(X.key,M)}let m=new Set,g=new Set;for(let D of d.allOfPropertyConflicts)D.allOfSchemaIds.forEach(R=>m.add(R)),D.conflictingTypeSignatures&&g.add(D.propertyKey);let A=Elo(e.method)===!0,y=D=>A&&D.readonly===!0;for(let D of d.properties){if(y(D))continue;let R=Object.entries(D.conflict);if(!R.every(([P,M])=>!M.differentSchema))for(let[P]of R)for(let M of wjt({property:D.key,schemaId:P,context:r,namespace:l}))m.add(M)}let E=(D,R)=>{let P=Oc({schema:D.schema,fileContainingReference:t,declarationFile:R,context:r,namespace:l,declarationDepth:1}),M=D.xml!=null?aDr(D.xml):void 0,J=ue=>M==null?ue:{...typeof ue=="string"?{type:ue}:ue,encoding:M},X=D.nameOverride??D.key,$=R0(D.availability);if(!u.has(X)&&D.audiences.length<=0)return u.add(X),D.nameOverride!=null?J({type:rf(P),docs:kZe(P),name:D.nameOverride,availability:$}):J($?{...typeof P=="string"?{type:P}:P,availability:$}:P);let ie={type:rf(P),docs:kZe(P)};return u.has(X)&&(ie.name=D.generatedName),D.audiences.length>0&&(ie.audiences=D.audiences),$!=null&&(ie.availability=$),u.add(X),J(ie)},x={};for(let D of d.properties)y(D)||(x[D.key]=E(D,f.get(D.key)??t));let v=[];for(let D of d.allOf){let R=hDr({schema:D.schema,context:r,namespace:l});if(R==null||m.has(D.schema)||m.has(R))continue;let P=Oc({schema:Aa.reference(D),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),M=FZe(rf(P));M!=="unknown"&&v.push(M)}for(let D of m){let R=NZe(r,D,l),P=r.getSchema(D,l),M=P!=null?Ule(_le(P)):t;for(let J of R.properties)if(x[J.key]==null&&!y(J)){if(g.has(J.key)){x[J.key]="unknown";continue}x[J.key]=E(J,M)}for(let J of R.allOf){if(m.has(J.schema))continue;let X=Oc({schema:Aa.reference(J),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),$=FZe(rf(X));$!=="unknown"&&!v.includes($)&&v.push($)}}let C={properties:x};v.length>0&&(C.extends=v),n.additionalProperties&&(C["extra-properties"]=!0),Ugc(n)&&(C.optional=!0);let O={name:i??d.nameOverride??d.generatedName,"path-parameters":s,"query-parameters":a,headers:c,body:C};return n.contentType!=null&&(O["content-type"]=n.contentType),n.description!=null&&(O.docs=n.description),{schemaIdsToExclude:p!=null?[p]:[],value:O}}else if(n.type==="octetStream"){let p={body:"bytes","content-type":n.contentType??Qp.APPLICATION_OCTET_STREAM,"query-parameters":a};return a!=null&&(p.name=i??o),n.description!=null&&(p.docs=n.description),{schemaIdsToExclude:[],value:p}}else if(n.type==="multipart"){let p=Object.fromEntries(n.properties.map(d=>{if(d.schema.type==="file"){let f=d.schema.isArray?"list<file>":"file";if(f=d.schema.isOptional?`optional<${f}>`:f,d.description!=null||d.contentType!=null){let m={type:f};if(d.description!=null&&(m.docs=d.description),d.contentType!=null){let g=d.contentType.split(",")[0];m["content-type"]=g}return[d.key,m]}return[d.key,f]}else{let f=Oc({schema:d.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(d.contentType||d.exploded||d.encoding){let m=typeof f=="string"?{type:f}:f;d.contentType!=null&&(m["content-type"]=d.contentType),d.encoding==="form"?m.style="form":d.encoding==="json"?m.style="json":d.exploded&&(m.style="exploded"),f=m}return[d.key,f]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??o,"path-parameters":s,"query-parameters":a,headers:c,body:{properties:p},"content-type":Qp.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else Ee(n)}function Ugc(e){return e.type==="json"&&e.required!==!0}function uUf({context:e,request:t}){if(!e.options.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;case"formUrlEncoded":return!0;default:Ee(t)}}var Vgc,Ggc=h(()=>{"use strict";aa();wt();Ac();Ey();Ft();Qgc();vlo();jZe();dlo();glo();Cjt();cZ();Ojt();NQe();IDr();RZe();cDr();Mgc();mDr();vjt();MQe();_6();Lgc();Vgc="PathParam"});function lUf({location:e,namespaceOverride:t}){return t!=null?{...e,file:NI(Us.of(t),e.file)}:e}function Wgc(e){return e.includes(".")?ti(e):e}function pUf(e){let t=e.namespace,r=e.tags.filter(c=>c!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:Us.of(`${ti(r)}.yml`),endpointId:e.summary!=null?ti(e.summary):ti(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:Us.of(qf),endpointId:ti(e.summary)}:{file:Us.of(qf),endpointId:ti(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:Us.of(qf),endpointId:Wgc(n)};let i=M7(r),o=M7(n);if(b0(i,o))return{file:Us.of("__package__.yml"),endpointId:r};let s=mUf({operationId:n,tag:r,path:e.path,method:e.method});if(s!=null)return s;let a=[];for(let c=0;c<i.length;++c){let u=i[c];if(u!=null&&u===o[c])a.push(u);else{let l=ti(r);return{file:Us.of(`${l}.yml`),endpointId:Wgc(n),tag:r}}}if(a.length>=o.length)throw new S({message:`Cannot get file for endpoint ${JSON.stringify(e)}`,code:S.Code.InternalError});return{file:Us.of(ti(a.join("_"))+".yml"),endpointId:ti(o.slice(a.length).join("_")),tag:r}}function Pjt(e){let t=e.tags[0];if(e.sdkName!=null){let r=elo({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:Us.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return lUf({namespaceOverride:e.namespace,location:pUf(e)})}function mUf({operationId:e,tag:t,path:r,method:n}){let o=`${r.split(fUf).join("_").replaceAll(dUf,"_")}_${n.toLowerCase()}`;if(e.endsWith(o))return{file:Us.of(ti(t)+".yml"),endpointId:ti(e.slice(0,-1*o.length)),tag:t}}var fUf,dUf,xlo=h(()=>{"use strict";aa();wt();Ey();Ft();Vi();RZe();fUf=new RegExp("[^a-zA-Z0-9{}]+"),dUf=new RegExp("[{}]","g")});function Hgc(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let o of r){let{endpointId:s,file:a,tag:c}=Pjt(o),u=a.split(".")[0];u!=null&&t.add(u);let l;if(o.sdkName!=null){let f=e.ir.groups;for(let m of o.sdkName.groupName){let g=typeof m=="string"?m:m.name,A=f[g];if(A==null)break;if(A.summary!=null||A.description!=null){l=f[g];break}}}let p=c==null?void 0:n.tagsById[c];e.setInState(yP.Endpoint),e.setEndpointMethod(o.method);let d=_gc({context:e,endpoint:o,declarationFile:a});e.unsetEndpointMethod(),e.unsetInState(yP.Endpoint),i=[...i,...d.schemaIdsToExclude],e.builder.addEndpoint(a,{name:s,schema:d.value,source:o.source!=null?Gle(o.source):void 0}),(p?.id!=null||p?.description!=null)&&e.builder.setServiceInfo(a,{"display-name":l?.summary??p?.id,docs:l?.description??p?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}var Kgc=h(()=>{"use strict";Ggc();Ojt();mDr();xlo()});function Jgc(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?qle(r.groupName):void 0,i=Oc({schema:Aa.primitive(r),context:e,fileContainingReference:Us.of(qf),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:rf(i),docs:r.description??void 0}})}}var Ygc=h(()=>{"use strict";aa();Ac();Ey();cZ();MQe();_6()});function $gc(e){for(let t of e.ir.webhooks){let r=AUf({webhook:t,context:e});if(r==null)continue;let n=EDr(t.sdkName,t.namespace),i={};for(let s of t.headers)i[s.name]=uZ({header:s,context:e,fileContainingReference:r.file,namespace:n});let o={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:Oc({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),signature:yUf(t.signatureVerification),examples:t.examples!=null?t.examples.map(s=>({docs:s.description,name:s.name,payload:ED(s.payload)})):void 0};t.response!=null&&t.response._visit({json:s=>{let a=Oc({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o.response={docs:s.description??void 0,type:rf(a)},s.statusCode!=null&&(o.response["status-code"]=s.statusCode)},file:s=>{o.response={docs:s.description??void 0,type:"file","status-code":s.statusCode}},bytes:s=>{o.response={docs:s.description??void 0,type:"bytes","status-code":s.statusCode}},text:s=>{o.response={docs:s.description??void 0,type:"text","status-code":s.statusCode,"content-type":s.contentType??void 0}},streamingJson:s=>{let a=Oc({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:rf(a),format:"json"}},streamingSse:s=>{let a=Oc({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:rf(a),format:"sse"}},streamingText:s=>{o["response-stream"]={docs:s.description??void 0,type:"text"}},_other:()=>{throw new S({message:"Unrecognized Response type: "+t.response?.type,code:S.Code.InternalError})}}),e.builder.addWebhook(r.file,{name:r.endpointId,schema:o}),t.description!=null&&(o.docs=t.description)}}function hUf({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:NI(Us.of(t),e.file)}:e}function gUf({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:Us.of(qf),endpointId:n};let i=M7(r),o=M7(n);if(b0(i,o))return{file:Us.of("__package__.yml"),endpointId:r};let s=[];for(let a=0;a<i.length;++a){let c=i[a];if(c!=null&&c===o[a])s.push(c);else{let u=ti(r);return{file:Us.of(`${u}.yml`),endpointId:n,tag:r}}}if(s.length>=o.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:Us.of(ti(s.join("_"))+".yml"),endpointId:ti(o.slice(s.length).join("_")),tag:r}}function AUf({webhook:e,context:t}){return e.sdkName!=null?{file:Xhc({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:hUf({namespaceOverride:e.namespace,location:gUf({webhook:e,context:t})})}function yUf(e){if(e!=null)switch(e.type){case"hmac":return{type:"hmac",header:e.header,algorithm:bUf(e.algorithm),encoding:Clo(e.encoding),"signature-prefix":e.signaturePrefix,"payload-format":Xgc(e.payloadFormat),timestamp:Zgc(e.timestamp),"body-hash-binding":IUf(e.bodyHashBinding),"url-normalization":vUf(e.notificationUrlNormalization)};case"asymmetric":return{type:"asymmetric",header:e.header,"asymmetric-algorithm":EUf(e.asymmetricAlgorithm),encoding:Clo(e.encoding),"signature-prefix":e.signaturePrefix,"jwks-url":e.jwksUrl,"key-id-header":e.keyIdHeader,"payload-format":Xgc(e.payloadFormat),timestamp:Zgc(e.timestamp)};default:return}}function bUf(e){if(e!=null)switch(e){case"sha256":return"sha256";case"sha1":return"sha1";case"sha384":return"sha384";case"sha512":return"sha512";default:return}}function Clo(e){if(e!=null)switch(e){case"base64":return"base64";case"hex":return"hex";default:return}}function EUf(e){switch(e){case"rsa-sha256":return"rsa-sha256";case"rsa-sha384":return"rsa-sha384";case"rsa-sha512":return"rsa-sha512";case"ecdsa-sha256":return"ecdsa-sha256";case"ecdsa-sha384":return"ecdsa-sha384";case"ecdsa-sha512":return"ecdsa-sha512";case"ed25519":return"ed25519";default:return"rsa-sha256"}}function Xgc(e){if(e!=null)return{components:e.components.map(SUf),delimiter:e.delimiter,"body-sort":wUf(e.bodySort)}}function IUf(e){if(e!=null)return{algorithm:xUf(e.algorithm),encoding:e.encoding!=null?Clo(e.encoding):void 0,location:CUf(e.location)}}function vUf(e){if(e!=null)return{"port-variants":e.portVariants,"legacy-query-encoding":e.legacyQueryEncoding}}function xUf(e){switch(e){case"sha256":return"sha256";case"sha1":return"sha1";case"sha384":return"sha384";case"sha512":return"sha512";default:Ee(e)}}function CUf(e){if(e.type==="queryParameter")return{type:"query-parameter",name:e.name};Ee(e.type)}function wUf(e){if(e!=null&&e==="alphabetical")return"alphabetical"}function SUf(e){switch(e){case"body":return"body";case"timestamp":return"timestamp";case"notification-url":return"notification-url";case"message-id":return"message-id";default:return"body"}}function TUf(e){switch(e){case"unix-seconds":return"unix-seconds";case"unix-millis":return"unix-millis";case"iso8601":return"iso8601";default:return}}function Zgc(e){if(e!=null)return{header:e.header,format:e.format!=null?TUf(e.format):void 0,tolerance:e.tolerance}}var eAc=h(()=>{"use strict";aa();wt();Ey();Ft();Vi();jZe();cZ();IDr();RZe();MQe();_6()});function G0e(e,t,r){switch(e.type){case"primitive":case"enum":case"literal":case"unknown":return;case"reference":{let n=e.schema;if(r.has(n))return;r.add(n);let i=tAc(n,e.namespace,t);i!=null&&G0e(i,t,r);return}case"object":for(let n of e.allOf)if(!r.has(n.schema)){r.add(n.schema);let i=tAc(n.schema,n.namespace,t);i!=null&&G0e(i,t,r)}for(let n of e.properties)G0e(n.schema,t,r);return;case"array":case"map":case"optional":case"nullable":G0e(e.value,t,r);return;case"oneOf":OUf(e.value,t,r);return;default:Ee(e)}}function OUf(e,t,r){switch(e.type){case"discriminated":for(let n of Object.values(e.schemas))G0e(n,t,r);for(let n of e.commonProperties)G0e(n.schema,t,r);return;case"undiscriminated":for(let n of e.schemas)G0e(n,t,r);return;default:Ee(e)}}function tAc(e,t,r){return t==null?r.rootSchemas[e]:r.namespacedSchemas[t]?.[e]}function _U(e,t,r){G0e(e,t,r)}function wlo(e){let t=new Set,r=new Set,{groupedSchemas:n}=e;for(let i of e.endpoints){if(i.request!=null)switch(i.request.type){case"json":case"formUrlEncoded":_U(i.request.schema,n,t);break;case"multipart":for(let o of i.request.properties)o.schema.type==="json"&&_U(o.schema.value,n,t);break;case"octetStream":break;default:Ee(i.request)}if(i.response!=null)switch(i.response.type){case"json":case"streamingJson":case"streamingSse":_U(i.response.schema,n,r);break;case"file":case"text":case"bytes":case"streamingText":break;default:Ee(i.response)}for(let o of Object.values(i.errors))o.schema!=null&&_U(o.schema,n,r);for(let o of i.pathParameters)_U(o.schema,n,r);for(let o of i.queryParameters)_U(o.schema,n,r);for(let o of i.headers)_U(o.schema,n,r)}for(let i of e.webhooks)_U(i.payload,n,r);for(let i of Object.values(e.channels)){for(let o of i.messages)_U(o.body,n,r);for(let o of i.handshake.queryParameters)_U(o.schema,n,r);for(let o of i.handshake.headers)_U(o.schema,n,r);for(let o of i.handshake.pathParameters)_U(o.schema,n,r)}return{requestReachable:t,responseReachable:r}}function PUf(e){return e.type!=="object"?!1:e.properties.some(t=>t.readonly===!0)}function Slo(e,t){let r=new Set,n=new Set,i=new Set;function o(s){for(let[a,c]of Object.entries(s)){if(!PUf(c))continue;let u=t.requestReachable.has(a),l=t.responseReachable.has(a);u&&l?r.add(a):u&&!l?n.add(a):!u&&l&&i.add(a)}}o(e.groupedSchemas.rootSchemas);for(let s of Object.values(e.groupedSchemas.namespacedSchemas))o(s);return{needsBothVariants:r,requestOnlyWithReadonly:n,responseOnlyWithReadonly:i}}var rAc=h(()=>{"use strict";wt()});function nAc({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,o]of Object.entries(e)){if(t.has(i))continue;let s=$hc(o);if(n.options.respectReadonlySchemas&&n.needsBothVariants(i)&&o.type==="object"){let u=zQe({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:"read"});n.builder.addType(s,{name:u.name??i,schema:u.schema});let l=zQe({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:l.name??i,schema:l.schema});continue}if(n.options.respectReadonlySchemas&&n.isRequestOnlyWithReadonly(i)&&o.type==="object"){let u=zQe({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:u.name??i,schema:u.schema});continue}let a;n.options.respectReadonlySchemas&&(a=n.isRequestOnly(i)?"write":"read");let c=agc({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:a});if(Vbe(c.schema)){let u=rf(c.schema);if(u===(c.name??i)||u===`optional<${c.name??i}>`||u===`nullable<${c.name??i}>`||u===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(s,{name:c.name??i,schema:c.schema})}}function iAc(e){if(e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),xgc(e),wgc(e),Tgc(e),Pgc(e),pgc(e),Jgc(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.basePathParameters!=null&&e.ir.basePathParameters.length>0){let i={};for(let o of e.ir.basePathParameters){let s={type:"string"};o.description!=null&&(s.docs=o.description),o.clientDefault!=null&&(s["client-default"]=o.clientDefault),i[o.name]=s}e.builder.setRootPathParameters(i)}if(e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(Ilo),e.options.respectReadonlySchemas&&e.options.useReadVariantForResponses){let i=wlo(e.ir),o=Slo(e.ir,i);e.setVariantPlan(o,i)}let t=Hgc(e),r=t.sdkGroups;if(e.options.respectReadonlySchemas&&!e.options.useReadVariantForResponses){let i=wlo(e.ir),o=Slo(e.ir,i);e.setVariantPlan(o,i)}e.setInState(yP.Webhook),$gc(e),e.unsetInState(yP.Webhook),e.setInState(yP.Channel);for(let i of Object.values(e.ir.channels)){let o=Ule(i.groupName);ygc({channel:i,context:e,declarationFile:o})}e.unsetInState(yP.Channel);let n=BUf({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});nAc({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,o]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))nAc({schemas:o,schemaIdsToExclude:n,namespace:i,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(o=>r.has(o))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.optimizeServiceAuth(),e.builder.build()}function BUf({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return new Set(t);let n=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(o=>Object.keys(o))]),i=new Set(t);for(let o of n)r.includes(o)||i.add(o);return i}var Ilo,qgc,vlo=h(()=>{"use strict";aa();lo();Ey();fgc();bgc();Cgc();Sgc();Ogc();Bgc();Kgc();Cjt();Ygc();eAc();rAc();Ojt();RZe();tlo();_6();Ilo="external",qgc=Us.of(qf)});var Bjt,oAc=h(()=>{"use strict";Bjt=class{context;constructor(t){this.context=t}}});var vDr,sAc=h(()=>{"use strict";Ey();Ft();vDr=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[s,a]of Object.entries(n.files)){let c=i!=null?Us.of(`${i}${"/"}${s}`):Us.of(s);t[c]=a}let o=Object.keys(n.directories).sort();for(let s of o){let a=i!=null?`${i}${"/"}${s}`:s,c=n.directories[s];r(c,a)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Us.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new S({message:`Internal error; cannot add file with path: ${t}`,code:S.Code.InternalError});return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}}});function aAc(e){return e?.header!=null}var LQe,cAc=h(()=>{"use strict";aa();lo();Ey();Vi();sAc();LQe=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;rootPathParameters=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new vDr,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":n,"display-name":i,docs:o}){let s=this.getOrCreateFile(t);s.service==null&&(s.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(s.service.auth=r),n!=null&&(s.service["base-path"]=n),i!=null&&(s.service["display-name"]=i),o!=null&&(s.docs=o)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBaseUrlEnv(t){this.rootApiFile["base-url-env"]=t}setBasePath(t){this.basePath=t}setRootPathParameters(t){Object.keys(t).length!==0&&(this.rootPathParameters=t)}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return OX(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let n of Object.values(this.rootApiFile["auth-schemes"]))aAc(n)&&t.push(n.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(aAc(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addGlobalParameter({name:t,schema:r}){this.rootApiFile["global-parameters"]==null&&(this.rootApiFile["global-parameters"]={}),this.rootApiFile["global-parameters"][t]=r}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??ti((tU(r)+"/"+JS(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Us.of(zI))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=_He(tU(UHe.of(`/${t}`)),UHe.of(`/${r}`)),i;let o=this.getOrCreateFile(t);return o.imports==null&&(o.imports={}),o.imports[i]=_He(tU(UHe.of(`/${t}`)),UHe.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===Us.of(zI))return;let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let o=i.types[r];o!=null&&(typeof o=="string"?i.types[r]={type:o,examples:[n]}:(o.examples==null&&(o.examples=[]),o.examples.push(n)))}addError(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:i.errors[r]?.type!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){let i=this.getOrCreateFile(t);if(i.errors==null)return;let o=i.errors[r];if(o==null)return;o.examples==null&&(o.examples=[]),(o.examples.some(a=>b0(a,n))??!1)||o.examples?.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(o.service.source=i),o.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=NI(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}optimizeServiceAuth(){let t=[this.packageMarkerFile,...Object.values(this.root.getAllFiles())];for(let r of t){if(r.service==null)continue;let n=Object.values(r.service.endpoints);if(n.length===0)continue;if(n.every(o=>o.auth===!0)){r.service.auth=!0;for(let o of Object.values(r.service.endpoints))delete o.auth}}}build(){let t=this.root.getAllFiles(),r=this.basePath,n=this.rootPathParameters,i=r!=null&&n==null&&!r.includes("{");if(r!=null&&i){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([s,a])=>[s,{...a,path:NI(r,a.path)}]))});for(let s of Object.values(t))s.service!=null&&(s.service={...s.service,endpoints:Object.fromEntries(Object.entries(s.service.endpoints).map(([a,c])=>[a,{...c,path:NI(r,c.path)}]))})}else r!=null&&(this.rootApiFile["base-path"]=r,n!=null&&(this.rootApiFile["path-parameters"]=n));return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===qf?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}}});var Tlo=h(()=>{"use strict";oAc();cAc()});function uAc({statusCode:e,namespace:t}){return t!=null?`${t}:${e}`:`${e}`}var xDr,lAc=h(()=>{"use strict";wt();Tlo();Ac();bao();Ojt();xDr=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;options;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;schemaNameMapping=new Map;variantPlan;reachability;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:o,authOverrides:s}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=s,this.globalHeaderOverrides=o,this.options=BQe({options:n}),this.enableUniqueErrorsPerEndpoint=this.options.enableUniqueErrorsPerEndpoint,this.referencedSchemaIds=this.options.onlyIncludeReferencedSchemas?new Set:void 0,this.builder=new LQe(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let a={};if(!this.enableUniqueErrorsPerEndpoint)for(let c of r.endpoints)for(let[u,l]of Object.entries(c.errors)){let p=uAc({statusCode:u,namespace:l.namespace}),d=a[p];d==null&&l.schema!=null?a[p]=l.schema:d!=null&&l.schema!=null&&QF(d,l.schema)||this.unknownSchema.add(p)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}setUrlId(t,r){this.urlIdMap.set(t,r)}getUrlId(t){return this.urlIdMap.get(t)}isErrorUnknownSchema({statusCode:t,namespace:r}){return this.unknownSchema.has(uAc({statusCode:t,namespace:r}))}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.options.onlyIncludeReferencedSchemas&&this.isInAnyState(yP.Channel,yP.Endpoint,yP.Webhook)}markSchemaAsReferenced(t,r){switch(t.type){case"primitive":return;case"object":this.markObjectSchemaAsReferenced(t,r);return;case"array":this.markSchemaAsReferenced(t.value,r);return;case"map":this.markSchemaAsReferenced(t.value,r);return;case"optional":this.markSchemaAsReferenced(t.value,r);return;case"reference":this.markSchemaIdAsReferenced(t.schema,r);return;case"oneOf":this.markOneofSchemaAsReferenced(t.value,r);return;case"nullable":this.markSchemaAsReferenced(t.value,r);return;case"enum":return;case"literal":return;case"unknown":return;default:Ee(t)}}markObjectSchemaAsReferenced(t,r){for(let n of t.allOf)this.markSchemaIdAsReferenced(n.schema,r);for(let n of t.properties)this.markSchemaAsReferenced(n.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let n of Object.values(t.schemas))this.markSchemaAsReferenced(n,r);return;case"undiscriminated":for(let n of t.schemas)this.markSchemaAsReferenced(n,r);return;default:Ee(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let n=this.getSchema(t,r);n!=null&&this.markSchemaAsReferenced(n,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}setSchemaFinalName(t,r){this.schemaNameMapping.set(t,r)}hasReadVariant(t){return this.schemaNameMapping.has(t)}setVariantPlan(t,r){this.variantPlan=t,this.reachability=r;let n=[this.ir.groupedSchemas.rootSchemas,...Object.values(this.ir.groupedSchemas.namespacedSchemas)];for(let i of n)for(let[o,s]of Object.entries(i))if(t.needsBothVariants.has(o)&&s.type==="object"){let a=s.nameOverride??s.generatedName;this.schemaNameMapping.set(a,`${a}Read`)}}needsBothVariants(t){return this.variantPlan?.needsBothVariants.has(t)??!1}isRequestOnlyWithReadonly(t){return this.variantPlan?.requestOnlyWithReadonly.has(t)??!1}isResponseReachable(t){return this.reachability==null?this.ir.nonRequestReferencedSchemas.has(t):this.reachability.responseReachable.has(t)}isRequestOnly(t){return this.reachability==null?!this.ir.nonRequestReferencedSchemas.has(t):this.reachability.requestReachable.has(t)&&!this.reachability.responseReachable.has(t)}getSchemaFinalName(t,r){return!this.options.respectReadonlySchemas||r==="write"?t:this.schemaNameMapping.get(t)??t}}});function Olo(e){let t=new xDr(e);return t.options.respectOptionalRequestBody&&t.logger.warn("The `respect-optional-request-body` setting is deprecated and no longer has any effect. A request body that OpenAPI does not mark as required is now always described as omittable in the IR, and each SDK generator opts in to that behaviour through its own configuration."),iAc(t)}var pAc=h(()=>{"use strict";vlo();lAc()});var CDr=h(()=>{"use strict";bao();pAc();xlo()});var DUf,fAc,RUf,kUf,FUf,NUf,Qb,jUf,QUf,Djt,Rjt,zUf,zF,dAc,mAc,hAc,gAc,AAc,yAc,bAc,EAc,IAc,vAc,xAc,CAc,wAc,SAc,TAc,OAc,PAc,Plo,MUf,LUf,BAc,WG0,HG0,KG0,JG0,YG0,XG0,QZe,ZG0,kjt,wDr,$G0,eq0,tq0,rq0,Ir,Wo=h(()=>{"use strict";DUf=Object.create,fAc=Object.defineProperty,RUf=Object.getOwnPropertyDescriptor,kUf=Object.getOwnPropertyNames,FUf=Object.getPrototypeOf,NUf=Object.prototype.hasOwnProperty,Qb=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),jUf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=kUf(t),o=0,s=i.length,a;o<s;o++)a=i[o],!NUf.call(e,a)&&a!==r&&fAc(e,a,{get:(c=>t[c]).bind(null,a),enumerable:!(n=RUf(t,a))||n.enumerable});return e},QUf=(e,t,r)=>(r=e!=null?DUf(FUf(e)):{},jUf(t||!e||!e.__esModule?fAc(r,"default",{value:e,enumerable:!0}):r,e)),Djt=Qb(((e,t)=>{function r(c){return typeof c>"u"||c===null}function n(c){return typeof c=="object"&&c!==null}function i(c){return Array.isArray(c)?c:r(c)?[]:[c]}function o(c,u){if(u){let l=Object.keys(u);for(let p=0,d=l.length;p<d;p+=1){let f=l[p];c[f]=u[f]}}return c}function s(c,u){let l="";for(let p=0;p<u;p+=1)l+=c;return l}function a(c){return c===0&&Number.NEGATIVE_INFINITY===1/c}t.exports.isNothing=r,t.exports.isObject=n,t.exports.toArray=i,t.exports.repeat=s,t.exports.isNegativeZero=a,t.exports.extend=o})),Rjt=Qb(((e,t)=>{function r(i,o){let s="",a=i.reason||"(unknown reason)";return i.mark?(i.mark.name&&(s+='in "'+i.mark.name+'" '),s+="("+(i.mark.line+1)+":"+(i.mark.column+1)+")",!o&&i.mark.snippet&&(s+=`
175
+ `)),{ok:!0,value:t}):n}}var rZ=h(()=>{"use strict"});function cOr(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Dao=h(()=>{"use strict"});var UXe,Rao=h(()=>{"use strict";Dao();UXe=class e extends Error{errors;constructor(t){super(t.map(cOr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}}});var _Xe,kao=h(()=>{"use strict";Dao();_Xe=class e extends Error{errors;constructor(t){super(t.map(cOr).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}}});function $m(e){return{nullable:()=>J4f(e),optional:()=>Fao(e),optionalNullable:()=>Y4f(e),transform:t=>Nao(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new _Xe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new UXe(n.errors)}}}function J4f(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Ju.NULLABLE};return{...t,...$m(t)}}function Fao(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>Ju.OPTIONAL};return{...t,...$m(t)}}function Y4f(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>Ju.OPTIONAL_NULLABLE};return{...t,...$m(t)}}function Nao(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...$m(r)}}var Ydc=h(()=>{"use strict";Vw();Rao();kao()});var IQ=h(()=>{"use strict";Ydc();Rao();kao()});function Xdc(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:hm(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:hm(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Ju.BIGINT};return{...v1(e),...$m(e)}}var Zdc=h(()=>{"use strict";Vw();FF();rZ();IQ()});var $dc=h(()=>{"use strict";Zdc()});function emc(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:hm(t,"string")}]}:X4f.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:hm(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:hm(t,"Date object")}]},getType:()=>Ju.DATE};return{...v1(e),...$m(e)}}var X4f,tmc=h(()=>{"use strict";Vw();FF();rZ();IQ();X4f=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/});var rmc=h(()=>{"use strict";tmc()});function x1(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...v1(r),...$m(r)}}}var nZ=h(()=>{"use strict";IQ();rZ()});function uOr(e){let t=new Set(e);return x1(Ju.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:hm(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:hm(n,"enum")}]}:{ok:!0,value:n})()}var nmc=h(()=>{"use strict";Vw();nZ();FF()});var jao=h(()=>{"use strict";nmc()});function imc(e){let t=Qao(e);return{...t,...$m(t)}}function Qao(e){return{parse:(t,r)=>GXe(e).parse(t,r),json:(t,r)=>GXe(e).json(t,r),getType:()=>GXe(e).getType()}}function GXe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}var zao=h(()=>{"use strict";IQ()});function Mao(e){return Object.entries(e)}var omc=h(()=>{"use strict"});function sjt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}var Lao=h(()=>{"use strict"});function Lle(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}var ajt=h(()=>{"use strict"});function cjt(e){return Object.keys(e)}var Vao=h(()=>{"use strict"});function smc(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var amc=h(()=>{"use strict"});function wW(e){return{withParsedProperties:t=>Uao(e,t)}}function Uao(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(Z4f.call(t,a)){let c=t[a];s[a]=typeof c=="function"?c(o.value):c}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Lle(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:hm(n,"object")}]};let o=new Set(Object.keys(t)),s=sjt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...$m(r),...wW(r)}}var Z4f,cmc=h(()=>{"use strict";Lao();FF();ajt();IQ();Z4f=Object.prototype.hasOwnProperty});var ujt=h(()=>{"use strict";cmc()});function umc(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Vle(e){return e.isProperty}var _ao=h(()=>{"use strict"});function lOr(e){let t;function r(){if(t==null){t={};for(let[d,f]of Mao(e)){let m=Vle(f)?f.rawKey:d,g=Vle(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:g}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of Mao(e)){let m=Vle(f)?f.rawKey:d,g=Vle(f)?f.valueSchema:f;eVf(g)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function c(){return i==null&&a(),i}function u(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Vle(f)?f.rawKey:d),_getParsedProperties:()=>cjt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return lmc({value:d,requiredKeys:a(),requiredKeysSet:u(),getProperty:g=>{let A=r()[g];if(A!=null)return{transformedKey:A.parsedKey,transform:y=>{let E=[...m,g];return A.valueSchema.parse(y,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return lmc({value:d,requiredKeys:c(),requiredKeysSet:l(),getProperty:g=>{let A=e[g];if(A!=null)return Vle(A)?{transformedKey:A.rawKey,transform:y=>{let E=[...m,g];return A.valueSchema.json(y,{...f,breadcrumbsPrefix:E})}}:{transformedKey:g,transform:y=>{let E=[...m,g];return A.json(y,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>Ju.OBJECT};return{...v1(p),...$m(p),...wW(p),...RQe(p)}}function lmc({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Lle(e))return{ok:!1,errors:[{path:s,message:hm(e,"object")}]};let a=t.length,c=[],u={};for(let l in e){if(!$4f.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?u[d.transformedKey]=f.value:(u[l]=p,c.push(...f.errors))}else switch(i){case"fail":c.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":u[l]=p;break}}if(a>0)for(let l of t)l in e||c.push({path:s,message:`Missing required key "${l}"`});return c.length===0||o?{ok:!0,value:u}:{ok:!1,errors:c}}function RQe(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>pmc({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>pmc({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Ju.OBJECT};return{...r,...$m(r),...wW(r),...RQe(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))t.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[c,u]of Object.entries(i))r.has(c)||(a[c]=u);return{ok:!0,value:{...a,...s.value}}},getType:()=>Ju.OBJECT};return{...n,...$m(n),...wW(n),...RQe(n)}}}}function pmc({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Lle(t))return{ok:!1,errors:[{path:i,message:hm(t,"object")}]};let o=new Set(e),[s,a]=smc(cjt(t),l=>o.has(l)),c=r(sjt(t,a)),u=n(sjt(t,s));return c.ok&&u.ok?{ok:!0,value:{...c.value,...u.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...u.ok?[]:u.errors]}}function eVf(e){return!tVf(e)}function tVf(e){switch(e.getType()){case Ju.ANY:case Ju.UNKNOWN:case Ju.OPTIONAL:case Ju.OPTIONAL_NULLABLE:return!0;default:return!1}}var $4f,Gao=h(()=>{"use strict";Vw();omc();Lao();FF();ajt();Vao();rZ();amc();ujt();IQ();_ao();$4f=Object.prototype.hasOwnProperty});function fmc(e){return lOr(e)}var dmc=h(()=>{"use strict";Gao()});var qao=h(()=>{"use strict";Gao();dmc();_ao()});function mmc(e){let t={...Qao(e),_getRawProperties:()=>GXe(e)._getRawProperties(),_getParsedProperties:()=>GXe(e)._getParsedProperties()};return{...t,...$m(t),...wW(t),...RQe(t)}}var hmc=h(()=>{"use strict";qao();ujt();IQ();zao()});var gmc=h(()=>{"use strict";zao();hmc()});function pOr(e){let t={parse:(r,n)=>Amc(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>Amc(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Ju.LIST};return{...v1(t),...$m(t)}}function Amc(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:hm(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}var ymc=h(()=>{"use strict";Vw();FF();rZ();IQ()});var Wao=h(()=>{"use strict";ymc()});function bmc(e){return x1(Ju.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:hm(r,`${e.toString()}`)}]})()}var Emc=h(()=>{"use strict";Vw();nZ();FF()});function Imc(e){return x1(Ju.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:hm(r,`"${e}"`)}]})()}var vmc=h(()=>{"use strict";Vw();nZ();FF()});var xmc=h(()=>{"use strict";Emc();vmc()});var Cmc,wmc=h(()=>{"use strict";Vw();nZ();Cmc=x1(Ju.ANY,e=>({ok:!0,value:e}))});var Smc,Tmc=h(()=>{"use strict";Vw();nZ();FF();Smc=x1(Ju.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:hm(e,"boolean")}]})});var Omc,Pmc=h(()=>{"use strict";Vw();nZ();Omc=x1(Ju.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}))});var Bmc,Dmc=h(()=>{"use strict";Vw();nZ();FF();Bmc=x1(Ju.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:hm(e,"number")}]})});var Rmc,kmc=h(()=>{"use strict";Vw();nZ();FF();Rmc=x1(Ju.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:hm(e,"string")}]})});var Fmc,Nmc=h(()=>{"use strict";Vw();nZ();Fmc=x1(Ju.UNKNOWN,e=>({ok:!0,value:e}))});var jmc=h(()=>{"use strict";wmc();Tmc();Pmc();Dmc();kmc();Nmc()});function zmc(e,t){let r={parse:(n,i)=>Qmc({value:n,isKeyNumeric:e.getType()===Ju.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>Qmc({value:n,isKeyNumeric:e.getType()===Ju.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Ju.RECORD};return{...v1(r),...$m(r)}}function Qmc({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Lle(e))return{ok:!1,errors:[{path:i,message:hm(e,"object")}]};let o={},s=[];for(let a in e){if(!rVf.call(e,a))continue;let c=e[a];if(c===void 0)continue;let u=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(u=d)}let l=r(u),p=n(c,u);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}var rVf,Mmc=h(()=>{"use strict";Vw();FF();ajt();rZ();IQ();rVf=Object.prototype.hasOwnProperty});var Lmc=h(()=>{"use strict";Mmc()});function Vmc(e){let t=pOr(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:hm(n,"Set")}]},getType:()=>Ju.SET};return{...v1(r),...$m(r)}}var Umc=h(()=>{"use strict";Vw();FF();rZ();Wao();IQ()});var _mc=h(()=>{"use strict";Umc()});function qmc(e){let t={parse:(r,n)=>Gmc((i,o)=>i.parse(r,o),e,n),json:(r,n)=>Gmc((i,o)=>i.json(r,o),e,n),getType:()=>Ju.UNDISCRIMINATED_UNION};return{...v1(t),...$m(t)}}function Gmc(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}var Wmc=h(()=>{"use strict";Vw();rZ();IQ()});var Hmc=h(()=>{"use strict";Wmc()});function Kmc(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var Jmc=h(()=>{"use strict"});function Xmc(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=uOr(cjt(t)),o={parse:(s,a)=>Ymc({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.parse(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>Ymc({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,u)=>u.json(c,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>Ju.UNION};return{...v1(o),...$m(o),...wW(o)}}function Ymc({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Lle(e))return{ok:!1,errors:[{path:a,message:hm(e,"object")}]};let c=e[t],u={};for(let f in e)nVf.call(e,f)&&f!==t&&(u[f]=e[f]);if(c==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(c);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...u}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(u,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var nVf,Zmc=h(()=>{"use strict";Vw();FF();ajt();Vao();rZ();jao();ujt();IQ();nVf=Object.prototype.hasOwnProperty});var $mc=h(()=>{"use strict";Jmc();Zmc()});var ehc=h(()=>{"use strict";$dc();rmc();jao();gmc();Wao();xmc();qao();ujt();jmc();Lmc();IQ();_mc();Hmc();$mc()});var ee={};Z(ee,{JsonError:()=>UXe,ParseError:()=>_Xe,any:()=>Cmc,bigint:()=>Xdc,boolean:()=>Smc,booleanLiteral:()=>bmc,date:()=>emc,discriminant:()=>Kmc,enum_:()=>uOr,getObjectLikeUtils:()=>wW,getObjectUtils:()=>RQe,getSchemaUtils:()=>$m,isProperty:()=>Vle,lazy:()=>imc,lazyObject:()=>mmc,list:()=>pOr,never:()=>Omc,number:()=>Bmc,object:()=>lOr,objectWithoutOptionalProperties:()=>fmc,optional:()=>Fao,property:()=>umc,record:()=>zmc,set:()=>Vmc,string:()=>Rmc,stringLiteral:()=>Imc,transform:()=>Nao,undiscriminatedUnion:()=>qmc,union:()=>Xmc,unknown:()=>Fmc,withParsedProperties:()=>Uao});var thc=h(()=>{"use strict";ehc()});var rhc=h(()=>{"use strict"});var yr=h(()=>{"use strict";Wdc();Hdc();Kdc();thc();rhc()});var fOr,Hao=h(()=>{"use strict";yr();fOr=ee.objectWithoutOptionalProperties({usernameVariableName:ee.string().optional(),usernameEnvVar:ee.string().optional(),usernamePlaceholder:ee.string().optional(),passwordVariableName:ee.string().optional(),passwordEnvVar:ee.string().optional(),passwordPlaceholder:ee.string().optional()})});var dOr,Kao=h(()=>{"use strict";yr();dOr=ee.objectWithoutOptionalProperties({tokenVariableName:ee.string().optional(),tokenEnvVar:ee.string().optional(),tokenPlaceholder:ee.string().optional()})});var mOr,Jao=h(()=>{"use strict";yr();mOr=ee.objectWithoutOptionalProperties({typeName:ee.string()})});var hOr,Yao=h(()=>{"use strict";yr();hOr=ee.objectWithoutOptionalProperties({name:ee.string(),namespace:ee.string().optional(),prefix:ee.string().optional()})});var gOr,Xao=h(()=>{"use strict";ac();yr();Jao();Yao();gOr=ee.union("type",{protobuf:mOr,xml:hOr}).transform({transform:e=>{switch(e.type){case"protobuf":return vW.protobuf(e);case"xml":return vW.xml(e);default:return e}},untransform:({_visit:e,...t})=>t})});var qXe,AOr=h(()=>{"use strict";yr();qXe=ee.string()});var yOr,Zao=h(()=>{"use strict";yr();yOr=ee.objectWithoutOptionalProperties({headerName:ee.string(),prefix:ee.string().optional(),headerVariableName:ee.string().optional(),headerEnvVar:ee.string().optional(),headerPlaceholder:ee.string().optional()})});var bOr,$ao=h(()=>{"use strict";yr();bOr=ee.objectWithoutOptionalProperties({type:ee.stringLiteral("namespace"),name:ee.string()})});var EOr,eco=h(()=>{"use strict";yr();EOr=ee.string()});var IOr,tco=h(()=>{"use strict";yr();IOr=ee.enum_(["GenerallyAvailable","Beta","Deprecated","Alpha","Preview","Legacy"])});var ds,ud=h(()=>{"use strict";yr();tco();ds=ee.objectWithoutOptionalProperties({availability:IOr.optional()})});var Nn,ya=h(()=>{"use strict";yr();Nn=ee.objectWithoutOptionalProperties({description:ee.string().optional()})});var zd,C1=h(()=>{"use strict";yr();zd=ee.objectWithoutOptionalProperties({inline:ee.boolean().optional()})});var $c,Oy=h(()=>{"use strict";yr();$c=ee.objectWithoutOptionalProperties({nameOverride:ee.string().optional(),generatedName:ee.string()})});var gc,EA=h(()=>{"use strict";yr();gc=ee.objectWithoutOptionalProperties({namespace:ee.string().optional()})});var vOr,rco=h(()=>{"use strict";yr();$ao();vOr=ee.undiscriminatedUnion([ee.string(),bOr])});var P0e,ljt=h(()=>{"use strict";yr();rco();P0e=ee.list(vOr)});var Yu,B0=h(()=>{"use strict";yr();ljt();Yu=ee.objectWithoutOptionalProperties({groupName:P0e.optional()})});var xOr,nco=h(()=>{"use strict";yr();xOr=ee.objectWithoutOptionalProperties({file:ee.string()})});var COr,ico=h(()=>{"use strict";yr();COr=ee.objectWithoutOptionalProperties({file:ee.string()})});var wOr,oco=h(()=>{"use strict";ac();yr();nco();ico();wOr=ee.union("type",{openapi:xOr,protobuf:COr}).transform({transform:e=>{switch(e.type){case"openapi":return bD.openapi(e);case"protobuf":return bD.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t})});var Jo,Pf=h(()=>{"use strict";yr();oco();Jo=ee.objectWithoutOptionalProperties({source:wOr.optional()})});var Xu,D0=h(()=>{"use strict";yr();Xu=ee.objectWithoutOptionalProperties({title:ee.string().optional()})});var SOr,sco=h(()=>{"use strict";yr();SOr=ee.objectWithoutOptionalProperties({snake:ee.string().optional(),camel:ee.string().optional(),screamingSnake:ee.string().optional(),pascal:ee.string().optional()})});var B0e,TOr=h(()=>{"use strict";yr();ud();ya();sco();B0e=ee.objectWithoutOptionalProperties({nameOverride:ee.string().optional(),generatedName:ee.string(),value:ee.string(),casing:SOr.optional()}).extend(Nn).extend(ds)});var WXe,OOr=h(()=>{"use strict";yr();ud();ya();C1();Oy();EA();B0();Pf();D0();TOr();WXe=ee.objectWithoutOptionalProperties({default:B0e.optional(),values:ee.list(B0e)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Jo).extend(Xu).extend(zd)});var POr,aco=h(()=>{"use strict";yr();OOr();POr=ee.objectWithoutOptionalProperties({scopesEnum:WXe.optional()})});var BOr,cco=h(()=>{"use strict";yr();BOr=ee.objectWithoutOptionalProperties({queryParameterName:ee.string()})});var NF,D0e=h(()=>{"use strict";yr();NF=ee.string()});var DOr,uco=h(()=>{"use strict";ac();yr();Hao();Kao();Zao();aco();cco();DOr=ee.union("type",{basic:fOr,bearer:dOr,header:yOr,query:BOr,oauth:POr}).transform({transform:e=>{switch(e.type){case"basic":return b1.basic(e);case"bearer":return b1.bearer(e);case"header":return b1.header(e);case"query":return b1.query(e);case"oauth":return b1.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t})});var R0e,pjt=h(()=>{"use strict";yr();R0e=ee.string()});var ROr,lco=h(()=>{"use strict";yr();ROr=ee.objectWithoutOptionalProperties({id:ee.string(),default:ee.string().optional(),values:ee.list(ee.string()).optional()})});var fjt,pco=h(()=>{"use strict";yr();lco();ya();fjt=ee.objectWithoutOptionalProperties({name:ee.string().optional(),url:ee.string(),audiences:ee.list(ee.string()).optional(),defaultUrl:ee.string().optional(),urlTemplate:ee.string().optional(),variables:ee.list(ROr).optional()}).extend(Nn)});var HXe,kOr=h(()=>{"use strict";yr();HXe=ee.number()});var jF,k0e=h(()=>{"use strict";yr();jF=ee.string()});var FOr,fco=h(()=>{"use strict";yr();k0e();ya();FOr=ee.objectWithoutOptionalProperties({id:jF}).extend(Nn)});var w1,iZ=h(()=>{"use strict";yr();Xao();w1=ee.objectWithoutOptionalProperties({encoding:gOr.optional()})});var oZ,KXe=h(()=>{"use strict";yr();oZ=ee.objectWithoutOptionalProperties({sdkMethodName:ee.string().optional()})});var UU,kQe=h(()=>{"use strict";yr();kOr();UU=ee.objectWithoutOptionalProperties({statusCode:HXe.optional()})});var JXe,NOr=h(()=>{"use strict";yr();JXe=ee.objectWithoutOptionalProperties({name:ee.string().optional(),attribute:ee.boolean().optional(),text:ee.boolean().optional(),wrapped:ee.boolean().optional(),separator:ee.string().optional()})});var dco=h(()=>{"use strict";Hao();Kao();Xao();AOr();Zao();$ao();eco();aco();nco();Jao();ico();cco();D0e();rco();ljt();uco();pjt();pco();lco();oco();kOr();fco();k0e();ud();ya();iZ();C1();Oy();EA();B0();KXe();Pf();kQe();D0();Yao();NOr()});var mco={};Z(mco,{BasicSecurityScheme:()=>fOr,BearerSecurityScheme:()=>dOr,Encoding:()=>gOr,ErrorStatusCodeKey:()=>qXe,HeaderSecurityScheme:()=>yOr,Namespace:()=>bOr,NamespaceId:()=>EOr,OauthSecurityScheme:()=>POr,OpenApiSource:()=>xOr,ProtobufEncoding:()=>mOr,ProtobufSource:()=>COr,QuerySecurityScheme:()=>BOr,SchemaId:()=>NF,SdkGroup:()=>vOr,SdkGroupName:()=>P0e,SecurityScheme:()=>DOr,SecuritySchemeId:()=>R0e,Server:()=>fjt,ServerVariable:()=>ROr,Source:()=>wOr,StatusCode:()=>HXe,Tag:()=>FOr,TagId:()=>jF,WithAvailability:()=>ds,WithDescription:()=>Nn,WithEncoding:()=>w1,WithInline:()=>zd,WithName:()=>$c,WithNamespace:()=>gc,WithSdkGroupName:()=>Yu,WithSdkMethodName:()=>oZ,WithSource:()=>Jo,WithStatusCode:()=>UU,WithTitle:()=>Xu,XmlEncoding:()=>hOr,XmlPropertyEncoding:()=>JXe});var nhc=h(()=>{"use strict";dco()});var jOr,hco=h(()=>{"use strict";ac();yr();jOr=ee.union("type",{boolean:ee.object({value:ee.boolean()}),string:ee.object({value:ee.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return T0e.boolean(e.value);case"string":return T0e.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var QOr,gco=h(()=>{"use strict";yr();QOr=ee.objectWithoutOptionalProperties({})});var YXe,zOr=h(()=>{"use strict";ac();yr();YXe=ee.union("type",{int:ee.object({value:ee.number()}),int64:ee.object({value:ee.number()}),uint:ee.object({value:ee.number()}),uint64:ee.object({value:ee.number()}),float:ee.object({value:ee.number()}),double:ee.object({value:ee.number()}),string:ee.object({value:ee.string()}),datetime:ee.object({value:ee.string()}),datetimeRfc2822:ee.object({value:ee.string()}),date:ee.object({value:ee.string()}),base64:ee.object({value:ee.string()}),boolean:ee.object({value:ee.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return Bo.int(e.value);case"int64":return Bo.int64(e.value);case"uint":return Bo.uint(e.value);case"uint64":return Bo.uint64(e.value);case"float":return Bo.float(e.value);case"double":return Bo.double(e.value);case"string":return Bo.string(e.value);case"datetime":return Bo.datetime(e.value);case"datetimeRfc2822":return Bo.datetimeRfc2822(e.value);case"date":return Bo.date(e.value);case"base64":return Bo.base64(e.value);case"boolean":return Bo.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var $h,ihc=h(()=>{"use strict";ac();yr();ja();hco();gco();zOr();$h=ee.union("type",{primitive:ee.object({value:YXe}),object:ee.lazyObject(()=>MOr),array:ee.object({value:ee.list(ee.lazy(()=>$h))}),map:ee.object({value:ee.list(ee.lazyObject(()=>VOr))}),enum:ee.object({value:ee.string()}),literal:ee.object({value:jOr}),oneOf:ee.object({value:ee.lazy(()=>LOr)}),null:QOr,unknown:ee.object({value:ee.lazy(()=>$h)})}).transform({transform:e=>{switch(e.type){case"primitive":return hc.primitive(e.value);case"object":return hc.object(e);case"array":return hc.array(e.value);case"map":return hc.map(e.value);case"enum":return hc.enum(e.value);case"literal":return hc.literal(e.value);case"oneOf":return hc.oneOf(e.value);case"null":return hc.null(e);case"unknown":return hc.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var XXe,UOr=h(()=>{"use strict";yr();XXe=ee.string()});var MOr,ohc=h(()=>{"use strict";yr();ja();UOr();MOr=ee.objectWithoutOptionalProperties({properties:ee.record(XXe,ee.lazy(()=>$h))})});var LOr,shc=h(()=>{"use strict";ac();yr();ja();UOr();LOr=ee.union("type",{discriminated:ee.object({value:ee.record(XXe,ee.lazy(()=>$h))}),undiscriminated:ee.object({value:ee.lazy(()=>$h)})}).transform({transform:e=>{switch(e.type){case"discriminated":return S0e.discriminated(e.value);case"undiscriminated":return S0e.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var VOr,ahc=h(()=>{"use strict";yr();ja();zOr();VOr=ee.objectWithoutOptionalProperties({key:YXe,value:ee.lazy(()=>$h)})});var Aco=h(()=>{"use strict";ihc();ohc();shc();ahc();hco();gco();zOr();UOr()});var yco={};Z(yco,{FullExample:()=>$h,FullObjectExample:()=>MOr,FullOneOfExample:()=>LOr,KeyValuePair:()=>VOr,LiteralExample:()=>jOr,NullExample:()=>QOr,PrimitiveExample:()=>YXe,PropertyKey:()=>XXe});var chc=h(()=>{"use strict";Aco()});var ZXe,_Or=h(()=>{"use strict";yr();D0e();ZXe=ee.objectWithoutOptionalProperties({propertyKey:ee.string(),allOfSchemaIds:ee.list(NF),conflictingTypeSignatures:ee.boolean()})});var GOr,uhc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();GOr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Sl),minItems:ee.number().optional(),maxItems:ee.number().optional(),default:ee.unknown().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var qOr,bco=h(()=>{"use strict";yr();qOr=ee.enum_(["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"])});var WOr,Eco=h(()=>{"use strict";yr();WOr=ee.enum_(["alphabetical"])});var HOr,Ico=h(()=>{"use strict";yr();HOr=ee.enum_(["body","timestamp","notification-url","message-id"])});var $Xe,KOr=h(()=>{"use strict";yr();Eco();Ico();$Xe=ee.objectWithoutOptionalProperties({components:ee.list(HOr),delimiter:ee.string().optional(),bodySort:WOr.optional()})});var F0e,djt=h(()=>{"use strict";yr();F0e=ee.enum_(["base64","hex"])});var JOr,vco=h(()=>{"use strict";yr();JOr=ee.enum_(["unix-seconds","unix-millis","iso8601"])});var eZe,YOr=h(()=>{"use strict";yr();vco();eZe=ee.objectWithoutOptionalProperties({header:ee.string(),format:JOr.optional(),tolerance:ee.number().optional()})});var XOr,xco=h(()=>{"use strict";yr();bco();KOr();djt();YOr();XOr=ee.objectWithoutOptionalProperties({header:ee.string(),asymmetricAlgorithm:qOr,encoding:F0e.optional(),signaturePrefix:ee.string().optional(),jwksUrl:ee.string().optional(),keyIdHeader:ee.string().optional(),payloadFormat:$Xe.optional(),timestamp:eZe.optional()})});var ZOr,Cco=h(()=>{"use strict";yr();ZOr=ee.objectWithoutOptionalProperties({default:ee.boolean().optional()})});var tZe,$Or=h(()=>{"use strict";yr();ya();Pf();kQe();tZe=ee.objectWithoutOptionalProperties({}).extend(Nn).extend(Jo).extend(UU)});var rZe,lhc=h(()=>{"use strict";yr();ja();rZe=ee.objectWithoutOptionalProperties({key:ee.string(),schema:ee.lazy(()=>Sl)})});var ePr,wco=h(()=>{"use strict";yr();ePr=ee.objectWithoutOptionalProperties({cursor:ee.string(),nextCursor:ee.property("next_cursor",ee.string()),results:ee.string()})});var tPr,Sco=h(()=>{"use strict";yr();ya();tPr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),language:ee.string(),code:ee.string(),install:ee.string().optional()}).extend(Nn)});var rPr,Tco=h(()=>{"use strict";yr();rPr=ee.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"])});var nPr,Oco=h(()=>{"use strict";yr();ya();Tco();nPr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),sdk:rPr,code:ee.string()}).extend(Nn)});var iPr,Pco=h(()=>{"use strict";ac();yr();Sco();Oco();iPr=ee.union("type",{language:tPr,sdk:nPr}).transform({transform:e=>{switch(e.type){case"language":return $X.language(e);case"sdk":return $X.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t})});var oPr,Bco=h(()=>{"use strict";yr();oPr=ee.objectWithoutOptionalProperties({results:ee.string()})});var nZe,sPr=h(()=>{"use strict";yr();nZe=ee.enum_(["data","protocol"])});var aPr,phc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();sPr();aPr=ee.objectWithoutOptionalProperties({discriminantProperty:ee.string(),discriminantPropertyNameOverride:ee.string().optional(),discriminatorContext:nZe.optional(),defaultDiscriminantValue:ee.string().optional(),commonProperties:ee.list(ee.lazyObject(()=>rZe)),schemas:ee.record(ee.string(),ee.lazy(()=>Sl))}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var cPr,Dco=h(()=>{"use strict";yr();cPr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),minimum:ee.number().optional(),maximum:ee.number().optional(),exclusiveMinimum:ee.boolean().optional(),exclusiveMaximum:ee.boolean().optional(),multipleOf:ee.number().optional()})});var uPr,Rco=h(()=>{"use strict";yr();uPr=ee.unknown()});var lPr,kco=h(()=>{"use strict";yr();ja();lPr=ee.objectWithoutOptionalProperties({sse:ee.boolean(),events:ee.list(ee.lazy(()=>$h))})});var pPr,Fco=h(()=>{"use strict";ac();yr();ja();kco();pPr=ee.union("type",{withStreaming:lPr,withoutStreaming:ee.object({value:ee.lazy(()=>$h)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return VU.withStreaming(e);case"withoutStreaming":return VU.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var iZe,fPr=h(()=>{"use strict";yr();ja();iZe=ee.objectWithoutOptionalProperties({name:ee.string(),value:ee.lazy(()=>$h)})});var dPr,Nco=h(()=>{"use strict";yr();ja();dPr=ee.objectWithoutOptionalProperties({name:ee.string(),parameterNameOverride:ee.string().optional(),value:ee.lazy(()=>$h)})});var oZe,mPr=h(()=>{"use strict";yr();ja();oZe=ee.objectWithoutOptionalProperties({name:ee.string(),value:ee.lazy(()=>$h)})});var hPr,jco=h(()=>{"use strict";yr();ja();ya();Pco();Fco();fPr();Nco();mPr();hPr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),pathParameters:ee.list(dPr).optional(),queryParameters:ee.list(oZe).optional(),headers:ee.list(iZe).optional(),request:ee.lazy(()=>$h).optional(),response:pPr.optional(),codeSamples:ee.list(iPr)}).extend(Nn)});var sZe,gPr=h(()=>{"use strict";ac();yr();Rco();jco();sZe=ee.union("type",{unknown:ee.object({value:uPr}),full:hPr}).transform({transform:e=>{switch(e.type){case"unknown":return LU.unknown(e.value);case"full":return LU.full(e);default:return e}},untransform:({_visit:e,...t})=>t})});var sZ,aZe=h(()=>{"use strict";yr();ljt();sZ=ee.objectWithoutOptionalProperties({groupName:P0e,methodName:ee.string()})});var cZe,APr=h(()=>{"use strict";yr();pjt();cZe=ee.list(ee.record(R0e,ee.list(ee.string())))});var N0e,mjt=h(()=>{"use strict";yr();ja();ud();ya();Pf();N0e=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Sl),env:ee.string().optional(),parameterNameOverride:ee.string().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var uZe,yPr=h(()=>{"use strict";yr();uZe=ee.objectWithoutOptionalProperties({name:ee.string().optional(),url:ee.string().optional(),audiences:ee.list(ee.string()).optional()})});var bPr,Qco=h(()=>{"use strict";yr();ja();bPr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),description:ee.string().optional(),example:ee.lazy(()=>$h)})});var EPr,zco=h(()=>{"use strict";yr();ja();ya();Oy();Pf();Qco();EPr=ee.objectWithoutOptionalProperties({isWildcardStatusCode:ee.boolean().optional(),schema:ee.lazy(()=>Sl).optional(),examples:ee.list(bPr).optional(),namespace:ee.string().optional()}).extend(Nn).extend($c).extend(Jo)});var lZe,IPr=h(()=>{"use strict";yr();lZe=ee.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"])});var vPr,Mco=h(()=>{"use strict";yr();vPr=ee.objectWithoutOptionalProperties({offset:ee.string(),results:ee.string(),step:ee.string().optional(),hasNextPage:ee.string().optional()})});var xPr,Lco=h(()=>{"use strict";yr();xPr=ee.objectWithoutOptionalProperties({nextPath:ee.string(),results:ee.string()})});var CPr,Vco=h(()=>{"use strict";yr();CPr=ee.objectWithoutOptionalProperties({nextUri:ee.string(),results:ee.string()})});var pZe,wPr=h(()=>{"use strict";ac();yr();wco();Bco();Mco();Lco();Vco();pZe=ee.union("type",{cursor:ePr,offset:vPr,custom:oPr,uri:CPr,path:xPr}).transform({transform:e=>{switch(e.type){case"cursor":return Lw.cursor(e);case"offset":return Lw.offset(e);case"custom":return Lw.custom(e);case"uri":return Lw.uri(e);case"path":return Lw.path(e);default:return e}},untransform:({_visit:e,...t})=>t})});var j0e,hjt=h(()=>{"use strict";yr();ja();ud();ya();Pf();j0e=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Sl),variableReference:ee.string().optional(),parameterNameOverride:ee.string().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var fZe,SPr=h(()=>{"use strict";yr();ja();ud();ya();Pf();fZe=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Sl),parameterNameOverride:ee.string().optional(),explode:ee.boolean().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var TPr,Uco=h(()=>{"use strict";yr();ja();ya();Pf();TPr=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Sl),contentType:ee.string().optional(),additionalProperties:ee.boolean()}).extend(Nn).extend(Jo)});var OPr,_co=h(()=>{"use strict";yr();ja();ya();Pf();OPr=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Sl),contentType:ee.string().optional(),required:ee.boolean().optional(),additionalProperties:ee.boolean()}).extend(Nn).extend(Jo)});var PPr,Gco=h(()=>{"use strict";yr();PPr=ee.enum_(["json","form"])});var BPr,qco=h(()=>{"use strict";yr();ya();BPr=ee.objectWithoutOptionalProperties({isOptional:ee.boolean(),isArray:ee.boolean()}).extend(Nn)});var DPr,Wco=h(()=>{"use strict";ac();yr();ja();qco();DPr=ee.union("type",{file:BPr,json:ee.object({value:ee.lazy(()=>Sl)})}).transform({transform:e=>{switch(e.type){case"file":return eZ.file(e);case"json":return eZ.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var Q0e,gjt=h(()=>{"use strict";yr();ya();Gco();Wco();Q0e=ee.objectWithoutOptionalProperties({key:ee.string(),schema:DPr,contentType:ee.string().optional(),exploded:ee.boolean().optional(),encoding:PPr.optional()}).extend(Nn)});var dZe,RPr=h(()=>{"use strict";yr();ya();Pf();gjt();dZe=ee.objectWithoutOptionalProperties({name:ee.string().optional(),properties:ee.list(Q0e)}).extend(Nn).extend(Jo)});var mZe,kPr=h(()=>{"use strict";yr();ya();Pf();mZe=ee.objectWithoutOptionalProperties({contentType:ee.string().optional()}).extend(Nn).extend(Jo)});var FPr,Hco=h(()=>{"use strict";ac();yr();Uco();_co();RPr();kPr();FPr=ee.union("type",{octetStream:mZe,multipart:dZe,json:OPr,formUrlEncoded:TPr}).transform({transform:e=>{switch(e.type){case"octetStream":return xW.octetStream(e);case"multipart":return xW.multipart(e);case"json":return xW.json(e);case"formUrlEncoded":return xW.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t})});var hZe,NPr=h(()=>{"use strict";yr();ya();Pf();kQe();hZe=ee.objectWithoutOptionalProperties({}).extend(Nn).extend(Jo).extend(UU)});var gZe,Kco=h(()=>{"use strict";yr();ja();ya();Pf();kQe();gZe=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Sl),responseProperty:ee.string().optional(),terminator:ee.string().optional(),resumable:ee.boolean().optional()}).extend(Nn).extend(Jo).extend(UU)});var z0e,jPr=h(()=>{"use strict";yr();ya();Pf();kQe();z0e=ee.objectWithoutOptionalProperties({contentType:ee.string().optional()}).extend(Nn).extend(Jo).extend(UU)});var AZe,QPr=h(()=>{"use strict";ac();yr();$Or();NPr();Kco();jPr();AZe=ee.union("type",{file:hZe,json:gZe,text:z0e,bytes:tZe,streamingSse:gZe,streamingText:z0e,streamingJson:gZe}).transform({transform:e=>{switch(e.type){case"file":return AP.file(e);case"json":return AP.json(e);case"text":return AP.text(e);case"bytes":return AP.bytes(e);case"streamingSse":return AP.streamingSse(e);case"streamingText":return AP.streamingText(e);case"streamingJson":return AP.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t})});var yZe,zPr=h(()=>{"use strict";ac();yr();yZe=ee.union("type",{disabled:ee.object({value:ee.boolean().optional()})}).transform({transform:e=>e.type==="disabled"?ejt.disabled(e.value):e,untransform:({_visit:e,...t})=>t})});var MPr,Jco=h(()=>{"use strict";yr();AOr();k0e();ud();ya();EA();Pf();gPr();aZe();APr();mjt();yPr();zco();IPr();wPr();hjt();SPr();Hco();QPr();zPr();MPr=ee.objectWithoutOptionalProperties({authed:ee.boolean(),security:cZe.optional(),internal:ee.boolean().optional(),idempotent:ee.boolean().optional(),method:lZe,audiences:ee.list(ee.string()),path:ee.string(),summary:ee.string().optional(),subtitle:ee.string().optional(),operationId:ee.string().optional(),tags:ee.list(jF),pathParameters:ee.list(j0e),queryParameters:ee.list(fZe),headers:ee.list(N0e),sdkName:sZ.optional(),generatedRequestName:ee.string(),requestNameOverride:ee.string().optional(),request:FPr.optional(),response:AZe.optional(),errors:ee.record(qXe,EPr),servers:ee.list(uZe),examples:ee.list(sZe),pagination:pZe.optional(),retries:yZe.optional(),globalParameterIds:ee.list(ee.string()).optional()}).extend(Nn).extend(ds).extend(Jo).extend(gc)});var LPr,Yco=h(()=>{"use strict";yr();ja();LPr=ee.objectWithoutOptionalProperties({header:ee.string(),name:ee.string().optional(),optional:ee.boolean().optional(),env:ee.string().optional(),schema:ee.lazy(()=>Sl).optional(),clientDefault:ee.unknown().optional()})});var VPr,Xco=h(()=>{"use strict";yr();VPr=ee.objectWithoutOptionalProperties({name:ee.string(),parameterName:ee.string().optional(),in:ee.string().optional(),target:ee.string().optional(),type:ee.string().optional(),env:ee.string().optional(),default:ee.unknown().optional(),optional:ee.boolean().optional(),apply:ee.string().optional(),docs:ee.string().optional()})});var UPr,Zco=h(()=>{"use strict";yr();pjt();UPr=ee.list(ee.record(R0e,ee.list(ee.string())))});var _Pr,$co=h(()=>{"use strict";yr();_Pr=ee.enum_(["sha256","sha1","sha384","sha512"])});var GPr,euo=h(()=>{"use strict";yr();GPr=ee.objectWithoutOptionalProperties({name:ee.string()})});var qPr,tuo=h(()=>{"use strict";ac();yr();euo();qPr=ee.union("type",{queryParameter:GPr}).transform({transform:e=>e.type==="queryParameter"?rjt.queryParameter(e):e,untransform:({_visit:e,...t})=>t})});var WPr,ruo=h(()=>{"use strict";yr();$co();tuo();djt();WPr=ee.objectWithoutOptionalProperties({algorithm:_Pr,encoding:F0e.optional(),location:qPr})});var HPr,nuo=h(()=>{"use strict";yr();HPr=ee.objectWithoutOptionalProperties({portVariants:ee.boolean(),legacyQueryEncoding:ee.boolean()})});var KPr,iuo=h(()=>{"use strict";yr();KPr=ee.enum_(["sha256","sha1","sha384","sha512"])});var JPr,ouo=h(()=>{"use strict";yr();ruo();nuo();KOr();iuo();djt();YOr();JPr=ee.objectWithoutOptionalProperties({header:ee.string(),algorithm:KPr.optional(),encoding:F0e.optional(),signaturePrefix:ee.string().optional(),payloadFormat:$Xe.optional(),timestamp:eZe.optional(),bodyHashBinding:WPr.optional(),notificationUrlNormalization:HPr.optional()})});var YPr,suo=h(()=>{"use strict";yr();ja();YPr=ee.objectWithoutOptionalProperties({header:ee.string(),name:ee.string().optional(),env:ee.string().optional(),schema:ee.lazy(()=>Sl).optional()})});var XPr,auo=h(()=>{"use strict";yr();XPr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),minimum:ee.number().optional(),maximum:ee.number().optional(),exclusiveMinimum:ee.boolean().optional(),exclusiveMaximum:ee.boolean().optional(),multipleOf:ee.number().optional()})});var ZPr,cuo=h(()=>{"use strict";ac();yr();ZPr=ee.union("type",{boolean:ee.object({value:ee.boolean()}),string:ee.object({value:ee.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return Ty.boolean(e.value);case"string":return Ty.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t})});var bZe,$Pr=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();cuo();bZe=ee.objectWithoutOptionalProperties({value:ZPr}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var eBr,uuo=h(()=>{"use strict";yr();eBr=ee.objectWithoutOptionalProperties({default:ee.number().optional()})});var tBr,luo=h(()=>{"use strict";yr();tBr=ee.objectWithoutOptionalProperties({default:ee.string().optional(),pattern:ee.string().optional(),format:ee.string().optional(),minLength:ee.number().optional(),maxLength:ee.number().optional()})});var rBr,puo=h(()=>{"use strict";ac();yr();Cco();Dco();auo();uuo();luo();rBr=ee.union("type",{int:XPr,int64:eBr,uint:ee.object({}),uint64:ee.object({}),float:ee.object({}),double:cPr,string:tBr,datetime:ee.object({}),datetimeRfc2822:ee.object({}),date:ee.object({}),base64:ee.object({}),boolean:ZOr}).transform({transform:e=>{switch(e.type){case"int":return Ku.int(e);case"int64":return Ku.int64(e);case"uint":return Ku.uint();case"uint64":return Ku.uint64();case"float":return Ku.float();case"double":return Ku.double(e);case"string":return Ku.string(e);case"datetime":return Ku.datetime();case"datetimeRfc2822":return Ku.datetimeRfc2822();case"date":return Ku.date();case"base64":return Ku.base64();case"boolean":return Ku.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t})});var M0e,Ajt=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();puo();M0e=ee.objectWithoutOptionalProperties({schema:rBr}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var nBr,fhc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();D0();Ajt();nBr=ee.objectWithoutOptionalProperties({key:M0e,value:ee.lazy(()=>Sl),minProperties:ee.number().optional(),maxProperties:ee.number().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Xu).extend(zd)});var iBr,fuo=h(()=>{"use strict";yr();ya();Pf();gjt();iBr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),properties:ee.list(Q0e)}).extend(Nn).extend(Jo)});var oBr,dhc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();oBr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Sl)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var EZe,sBr=h(()=>{"use strict";yr();EZe=ee.objectWithoutOptionalProperties({differentSchema:ee.boolean()})});var aBr,mhc=h(()=>{"use strict";yr();ja();D0e();ud();NOr();sBr();aBr=ee.objectWithoutOptionalProperties({key:ee.string(),schema:ee.lazy(()=>Sl),readonly:ee.boolean().optional(),writeonly:ee.boolean().optional(),conflict:ee.record(NF,EZe),generatedName:ee.string(),nameOverride:ee.string().optional(),audiences:ee.list(ee.string()),xml:JXe.optional()}).extend(ds)});var aZ,IZe=h(()=>{"use strict";yr();D0e();ud();ya();Oy();EA();B0();Pf();D0();aZ=ee.objectWithoutOptionalProperties({schema:NF}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Jo).extend(Xu)});var cBr,hhc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();_Or();IZe();cBr=ee.objectWithoutOptionalProperties({allOf:ee.list(aZ),properties:ee.list(ee.lazyObject(()=>aBr)),allOfPropertyConflicts:ee.list(ZXe),additionalProperties:ee.boolean(),minProperties:ee.number().optional(),maxProperties:ee.number().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var uBr,ghc=h(()=>{"use strict";ac();yr();ja();uBr=ee.union("type",{discriminated:ee.lazyObject(()=>aPr),undiscriminated:ee.lazyObject(()=>lBr)}).transform({transform:e=>{switch(e.type){case"discriminated":return tZ.discriminated(e);case"undiscriminated":return tZ.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t})});var pBr,duo=h(()=>{"use strict";yr();ja();eco();D0e();pBr=ee.objectWithoutOptionalProperties({rootSchemas:ee.record(NF,ee.lazy(()=>Sl)),namespacedSchemas:ee.record(EOr,ee.record(NF,ee.lazy(()=>Sl)))})});var fBr,muo=h(()=>{"use strict";yr();fBr=ee.objectWithoutOptionalProperties({summary:ee.string().optional(),description:ee.string().optional()})});var dBr,huo=h(()=>{"use strict";yr();fco();k0e();dBr=ee.objectWithoutOptionalProperties({tagsById:ee.record(jF,FOr),orderedTagIds:ee.list(jF).optional()})});var vZe,mBr=h(()=>{"use strict";yr();ja();ya();vZe=ee.objectWithoutOptionalProperties({name:ee.string().optional(),payload:ee.lazy(()=>$h)}).extend(Nn)});var xZe,hBr=h(()=>{"use strict";yr();xZe=ee.enum_(["GET","POST"])});var CZe,gBr=h(()=>{"use strict";ac();yr();xco();ouo();CZe=ee.union("type",{hmac:JPr,asymmetric:XOr}).transform({transform:e=>{switch(e.type){case"hmac":return DQe.hmac(e);case"asymmetric":return DQe.asymmetric(e);default:return e}},untransform:({_visit:e,...t})=>t})});var ABr,guo=h(()=>{"use strict";yr();ja();k0e();ya();EA();Pf();aZe();mjt();fuo();QPr();mBr();hBr();gBr();ABr=ee.objectWithoutOptionalProperties({audiences:ee.list(ee.string()),sdkName:sZ.optional(),method:xZe,summary:ee.string().optional(),operationId:ee.string(),tags:ee.list(jF),headers:ee.list(N0e),generatedPayloadName:ee.string(),payload:ee.lazy(()=>Sl),multipartFormData:iBr.optional(),response:AZe.optional(),signatureVerification:CZe.optional(),examples:ee.list(vZe)}).extend(Nn).extend(Jo).extend(gc)});var yBr,Auo=h(()=>{"use strict";yr();mjt();hjt();SPr();yBr=ee.objectWithoutOptionalProperties({queryParameters:ee.list(fZe),headers:ee.list(N0e),pathParameters:ee.list(j0e)})});var bBr,yuo=h(()=>{"use strict";yr();bBr=ee.enum_(["client","server"])});var EBr,buo=h(()=>{"use strict";yr();ja();yuo();EBr=ee.objectWithoutOptionalProperties({name:ee.string(),displayName:ee.string().optional(),description:ee.string().optional(),origin:bBr,body:ee.lazy(()=>Sl),methodName:ee.string().optional()})});var IBr,Euo=h(()=>{"use strict";yr();IBr=ee.objectWithoutOptionalProperties({name:ee.string(),url:ee.string()})});var vBr,Iuo=h(()=>{"use strict";yr();ja();ya();vBr=ee.objectWithoutOptionalProperties({messageType:ee.string(),payload:ee.lazy(()=>$h)}).extend(Nn)});var xBr,vuo=h(()=>{"use strict";yr();ya();fPr();mPr();Iuo();xBr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),queryParameters:ee.list(oZe).optional(),headers:ee.list(iZe).optional(),messages:ee.list(vBr)}).extend(Nn)});var CBr,xuo=h(()=>{"use strict";yr();ljt();ya();Pf();Auo();buo();Euo();vuo();CBr=ee.objectWithoutOptionalProperties({audiences:ee.list(ee.string()),path:ee.string(),groupName:P0e,summary:ee.string().optional(),connectMethodName:ee.string().optional(),handshake:yBr,messages:ee.list(EBr),servers:ee.list(IBr),examples:ee.list(xBr)}).extend(Nn).extend(Jo)});var Ahc,yhc=h(()=>{"use strict";yr();D0e();uco();pjt();pco();Jco();Yco();Xco();Zco();suo();hjt();Ajt();duo();muo();huo();guo();xuo();Ahc=ee.objectWithoutOptionalProperties({apiVersion:ee.unknown().optional(),specVersion:ee.string().optional(),title:ee.string().optional(),description:ee.string().optional(),baseUrlEnv:ee.string().optional(),basePath:ee.string().optional(),basePathParameters:ee.list(j0e).optional(),servers:ee.list(fjt),websocketServers:ee.list(fjt),groups:ee.record(ee.string(),fBr),tags:dBr,hasEndpointsMarkedInternal:ee.boolean(),endpoints:ee.list(MPr),webhooks:ee.list(ABr),channels:ee.record(ee.string(),CBr),groupedSchemas:pBr,variables:ee.record(ee.string(),M0e),nonRequestReferencedSchemas:ee.set(NF),securitySchemes:ee.record(R0e,DOr),security:UPr.optional(),globalHeaders:ee.list(LPr).optional(),globalParameters:ee.list(VPr).optional(),idempotencyHeaders:ee.list(YPr).optional()})});var wBr,bhc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();wBr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Sl)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var SBr,Cuo=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();SBr=ee.objectWithoutOptionalProperties({}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var Sl,Ehc=h(()=>{"use strict";ac();yr();ja();OOr();$Pr();Ajt();IZe();Cuo();Sl=ee.union("type",{primitive:M0e,object:ee.lazyObject(()=>cBr),array:ee.lazyObject(()=>GOr),map:ee.lazyObject(()=>nBr),optional:ee.lazyObject(()=>wBr),enum:WXe,reference:aZ,literal:bZe,oneOf:ee.object({value:ee.lazy(()=>uBr)}),nullable:ee.lazyObject(()=>oBr),unknown:SBr}).transform({transform:e=>{switch(e.type){case"primitive":return Aa.primitive(e);case"object":return Aa.object(e);case"array":return Aa.array(e);case"map":return Aa.map(e);case"optional":return Aa.optional(e);case"enum":return Aa.enum(e);case"reference":return Aa.reference(e);case"literal":return Aa.literal(e);case"oneOf":return Aa.oneOf(e.value);case"nullable":return Aa.nullable(e);case"unknown":return Aa.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t})});var lBr,Ihc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();lBr=ee.objectWithoutOptionalProperties({commonProperties:ee.list(ee.lazyObject(()=>rZe)).optional(),schemas:ee.list(ee.lazy(()=>Sl))}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var wuo=h(()=>{"use strict";_Or();uhc();bco();xco();tco();Cco();$Or();sco();lhc();wco();Pco();Sco();Oco();Bco();phc();sPr();Dco();Jco();gPr();Fco();aZe();APr();OOr();TOr();Qco();Rco();NPr();qco();Uco();jco();Yco();Xco();Zco();mjt();fPr();ouo();yPr();zco();IPr();suo();auo();_co();Kco();$Pr();cuo();uuo();fhc();fuo();RPr();gjt();Gco();Wco();dhc();mhc();sBr();hhc();kPr();Mco();ghc();yhc();bhc();wPr();Lco();hjt();Nco();Ajt();puo();SPr();mPr();IZe();Hco();QPr();zPr();Ehc();duo();muo();kco();luo();Tco();huo();jPr();Ihc();Cuo();Vco();guo();$co();ruo();tuo();euo();mBr();hBr();nuo();Eco();Ico();KOr();iuo();djt();gBr();YOr();vco();xuo();Auo();Iuo();yuo();buo();Euo();vuo()});var Suo={};Z(Suo,{AllOfPropertyConflict:()=>ZXe,ArraySchema:()=>GOr,AsymmetricAlgorithm:()=>qOr,AsymmetricWebhookSignatureVerification:()=>XOr,Availability:()=>IOr,BooleanSchema:()=>ZOr,BytesResponse:()=>tZe,CasingOverrides:()=>SOr,CommonProperty:()=>rZe,CursorPagination:()=>ePr,CustomCodeSample:()=>iPr,CustomCodeSampleLanguage:()=>tPr,CustomCodeSampleSdk:()=>nPr,CustomPagination:()=>oPr,DiscriminatedOneOfSchema:()=>aPr,DiscriminatorContext:()=>nZe,DoubleSchema:()=>cPr,Endpoint:()=>MPr,EndpointExample:()=>sZe,EndpointResponseExample:()=>pPr,EndpointSdkName:()=>sZ,EndpointSecurity:()=>cZe,EnumSchema:()=>WXe,EnumValue:()=>B0e,ErrorExample:()=>bPr,FernExample:()=>uPr,FileResponse:()=>hZe,FileSchema:()=>BPr,FormUrlEncodedRequest:()=>TPr,FullEndpointExample:()=>hPr,GlobalHeader:()=>LPr,GlobalParameter:()=>VPr,GlobalSecurity:()=>UPr,Header:()=>N0e,HeaderExample:()=>iZe,HmacWebhookSignatureVerification:()=>JPr,HttpEndpointServer:()=>uZe,HttpError:()=>EPr,HttpMethod:()=>lZe,IdempotencyHeader:()=>YPr,IntSchema:()=>XPr,JsonRequest:()=>OPr,JsonResponse:()=>gZe,LiteralSchema:()=>bZe,LiteralSchemaValue:()=>ZPr,LongSchema:()=>eBr,MapSchema:()=>nBr,MultipartFormDataWebhookPayload:()=>iBr,MultipartRequest:()=>dZe,MultipartRequestProperty:()=>Q0e,MultipartRequestPropertyEncoding:()=>PPr,MultipartSchema:()=>DPr,NullableSchema:()=>oBr,ObjectProperty:()=>aBr,ObjectPropertyConflictInfo:()=>EZe,ObjectSchema:()=>cBr,OctetStreamRequest:()=>mZe,OffsetPagination:()=>vPr,OneOfSchema:()=>uBr,OpenApiIntermediateRepresentation:()=>Ahc,OptionalSchema:()=>wBr,Pagination:()=>pZe,PathPagination:()=>xPr,PathParameter:()=>j0e,PathParameterExample:()=>dPr,PrimitiveSchema:()=>M0e,PrimitiveSchemaValue:()=>rBr,QueryParameter:()=>fZe,QueryParameterExample:()=>oZe,ReferencedSchema:()=>aZ,Request:()=>FPr,Response:()=>AZe,RetriesConfiguration:()=>yZe,Schema:()=>Sl,Schemas:()=>pBr,SdkGroupInfo:()=>fBr,StreamingResponseExample:()=>lPr,StringSchema:()=>tBr,SupportedSdkLanguage:()=>rPr,Tags:()=>dBr,TextResponse:()=>z0e,UnDiscriminatedOneOfSchema:()=>lBr,UnknownSchema:()=>SBr,UriPagination:()=>CPr,Webhook:()=>ABr,WebhookBodyHashAlgorithm:()=>_Pr,WebhookBodyHashBinding:()=>WPr,WebhookBodyHashLocation:()=>qPr,WebhookBodyHashQueryParameterLocation:()=>GPr,WebhookExampleCall:()=>vZe,WebhookHttpMethod:()=>xZe,WebhookNotificationUrlNormalization:()=>HPr,WebhookPayloadBodySort:()=>WOr,WebhookPayloadComponent:()=>HOr,WebhookPayloadFormat:()=>$Xe,WebhookSignatureAlgorithm:()=>KPr,WebhookSignatureEncoding:()=>F0e,WebhookSignatureVerification:()=>CZe,WebhookTimestamp:()=>eZe,WebhookTimestampFormat:()=>JOr,WebsocketChannel:()=>CBr,WebsocketHandshake:()=>yBr,WebsocketMessageExample:()=>vBr,WebsocketMessageOrigin:()=>bBr,WebsocketMessageSchema:()=>EBr,WebsocketServer:()=>IBr,WebsocketSessionExample:()=>xBr});var vhc=h(()=>{"use strict";wuo()});var TBr,xhc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();TBr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Md),minItems:ee.number().optional(),maxItems:ee.number().optional(),example:ee.list(ee.unknown()).optional(),default:ee.unknown().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var OBr,Tuo=h(()=>{"use strict";yr();OBr=ee.objectWithoutOptionalProperties({example:ee.string().optional()})});var PBr,Ouo=h(()=>{"use strict";yr();PBr=ee.objectWithoutOptionalProperties({default:ee.boolean().optional(),example:ee.boolean().optional()})});var wZe,Chc=h(()=>{"use strict";yr();ja();wZe=ee.objectWithoutOptionalProperties({key:ee.string(),schema:ee.lazy(()=>Md)})});var yjt,Puo=h(()=>{"use strict";yr();yjt=ee.objectWithoutOptionalProperties({example:ee.string().optional()})});var BBr,Buo=h(()=>{"use strict";yr();BBr=ee.objectWithoutOptionalProperties({example:ee.string().optional()})});var DBr,whc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();sPr();DBr=ee.objectWithoutOptionalProperties({discriminantProperty:ee.string(),discriminantPropertyNameOverride:ee.string().optional(),discriminatorContext:nZe.optional(),defaultDiscriminantValue:ee.string().optional(),commonProperties:ee.list(ee.lazyObject(()=>wZe)),schemas:ee.record(ee.string(),ee.lazy(()=>Md))}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var RBr,Duo=h(()=>{"use strict";yr();RBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),minimum:ee.number().optional(),maximum:ee.number().optional(),exclusiveMinimum:ee.boolean().optional(),exclusiveMaximum:ee.boolean().optional(),multipleOf:ee.number().optional(),example:ee.number().optional()})});var L0e,bjt=h(()=>{"use strict";yr();ja();ud();ya();Pf();L0e=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Md),env:ee.string().optional(),parameterNameOverride:ee.string().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var vQ,V0e=h(()=>{"use strict";yr();ya();vQ=ee.objectWithoutOptionalProperties({name:ee.string().optional(),value:ee.unknown()}).extend(Nn)});var kBr,Ruo=h(()=>{"use strict";yr();ja();kOr();ya();Oy();Pf();V0e();kBr=ee.objectWithoutOptionalProperties({statusCode:HXe,isWildcardStatusCode:ee.boolean().optional(),schema:ee.lazy(()=>Md),fullExamples:ee.list(vQ).optional(),namespace:ee.string().optional()}).extend(Nn).extend($c).extend(Jo)});var FBr,kuo=h(()=>{"use strict";yr();ja();ud();ya();Pf();FBr=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Md),variableReference:ee.string().optional(),parameterNameOverride:ee.string().optional(),explode:ee.boolean().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var SZe,NBr=h(()=>{"use strict";yr();ja();ud();ya();Pf();SZe=ee.objectWithoutOptionalProperties({name:ee.string(),schema:ee.lazy(()=>Md),parameterNameOverride:ee.string().optional(),explode:ee.boolean().optional(),clientDefault:ee.unknown().optional()}).extend(Nn).extend(ds).extend(Jo)});var jBr,Fuo=h(()=>{"use strict";yr();ja();ya();KXe();Pf();V0e();jBr=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Md),contentType:ee.string().optional(),required:ee.boolean().optional(),fullExamples:ee.list(vQ).optional(),additionalProperties:ee.boolean()}).extend(Nn).extend(Jo).extend(oZ)});var QBr,Nuo=h(()=>{"use strict";yr();ja();ya();KXe();Pf();V0e();QBr=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Md),contentType:ee.string().optional(),fullExamples:ee.list(vQ).optional(),additionalProperties:ee.boolean()}).extend(Nn).extend(Jo).extend(oZ)});var zBr,juo=h(()=>{"use strict";yr();KXe();RPr();V0e();zBr=ee.objectWithoutOptionalProperties({fullExamples:ee.list(vQ).optional()}).extend(dZe).extend(oZ)});var MBr,Quo=h(()=>{"use strict";yr();KXe();kPr();MBr=ee.objectWithoutOptionalProperties({}).extend(mZe).extend(oZ)});var LBr,zuo=h(()=>{"use strict";ac();yr();Fuo();Nuo();juo();Quo();LBr=ee.union("type",{octetStream:MBr,multipart:zBr,json:jBr,formUrlEncoded:QBr}).transform({transform:e=>{switch(e.type){case"octetStream":return kF.octetStream(e);case"multipart":return kF.multipart(e);case"json":return kF.json(e);case"formUrlEncoded":return kF.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t})});var TZe,Muo=h(()=>{"use strict";yr();ja();ya();Pf();kQe();V0e();TZe=ee.objectWithoutOptionalProperties({schema:ee.lazy(()=>Md),responseProperty:ee.string().optional(),terminator:ee.string().optional(),fullExamples:ee.list(vQ).optional(),resumable:ee.boolean().optional()}).extend(Nn).extend(Jo).extend(UU)});var OZe,VBr=h(()=>{"use strict";ac();yr();$Or();NPr();jPr();Muo();OZe=ee.union("type",{file:hZe,json:TZe,text:z0e,bytes:tZe,streamingSse:TZe,streamingText:z0e,streamingJson:TZe}).transform({transform:e=>{switch(e.type){case"file":return Ug.file(e);case"json":return Ug.json(e);case"text":return Ug.text(e);case"bytes":return Ug.bytes(e);case"streamingSse":return Ug.streamingSse(e);case"streamingText":return Ug.streamingText(e);case"streamingJson":return Ug.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t})});var Shc,Thc=h(()=>{"use strict";yr();AOr();k0e();ud();ya();EA();Pf();gPr();aZe();APr();yPr();IPr();wPr();zPr();bjt();Ruo();kuo();NBr();zuo();VBr();Shc=ee.objectWithoutOptionalProperties({authed:ee.boolean(),security:cZe.optional(),internal:ee.boolean().optional(),idempotent:ee.boolean().optional(),method:lZe,audiences:ee.list(ee.string()),path:ee.string(),summary:ee.string().optional(),subtitle:ee.string().optional(),operationId:ee.string().optional(),tags:ee.list(jF),pathParameters:ee.list(FBr),queryParameters:ee.list(SZe),headers:ee.list(L0e),sdkName:sZ.optional(),generatedRequestName:ee.string(),requestNameOverride:ee.string().optional(),request:LBr.optional(),response:OZe.optional(),errors:ee.record(qXe,kBr),servers:ee.list(uZe),examples:ee.list(sZe),pagination:pZe.optional(),retries:yZe.optional(),globalParameterIds:ee.list(ee.string()).optional()}).extend(Nn).extend(ds).extend(Jo).extend(gc)});var UBr,Luo=h(()=>{"use strict";yr();ud();ya();C1();Oy();EA();B0();Pf();D0();TOr();UBr=ee.objectWithoutOptionalProperties({default:B0e.optional(),values:ee.list(B0e),example:ee.string().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Jo).extend(Xu).extend(zd)});var _Br,Vuo=h(()=>{"use strict";yr();_Br=ee.objectWithoutOptionalProperties({example:ee.number().optional()})});var GBr,Uuo=h(()=>{"use strict";yr();GBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),example:ee.number().optional()})});var qBr,_uo=h(()=>{"use strict";yr();qBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),minimum:ee.number().optional(),maximum:ee.number().optional(),exclusiveMinimum:ee.boolean().optional(),exclusiveMaximum:ee.boolean().optional(),multipleOf:ee.number().optional(),example:ee.number().optional()})});var WBr,Guo=h(()=>{"use strict";yr();WBr=ee.objectWithoutOptionalProperties({default:ee.string().optional(),pattern:ee.string().optional(),format:ee.string().optional(),minLength:ee.number().optional(),maxLength:ee.number().optional(),example:ee.string().optional()})});var HBr,quo=h(()=>{"use strict";yr();HBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),example:ee.number().optional()})});var KBr,Wuo=h(()=>{"use strict";yr();KBr=ee.objectWithoutOptionalProperties({default:ee.number().optional(),example:ee.number().optional()})});var JBr,Huo=h(()=>{"use strict";ac();yr();Tuo();Ouo();Puo();Buo();Duo();Vuo();Uuo();_uo();Guo();quo();Wuo();JBr=ee.union("type",{int:qBr,int64:GBr,uint:KBr,uint64:HBr,float:_Br,double:RBr,string:WBr,datetime:yjt,datetimeRfc2822:yjt,date:BBr,base64:OBr,boolean:PBr}).transform({transform:e=>{switch(e.type){case"int":return Ui.int(e);case"int64":return Ui.int64(e);case"uint":return Ui.uint(e);case"uint64":return Ui.uint64(e);case"float":return Ui.float(e);case"double":return Ui.double(e);case"string":return Ui.string(e);case"datetime":return Ui.datetime(e);case"datetimeRfc2822":return Ui.datetimeRfc2822(e);case"date":return Ui.date(e);case"base64":return Ui.base64(e);case"boolean":return Ui.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t})});var PZe,YBr=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();Huo();PZe=ee.objectWithoutOptionalProperties({schema:JBr}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var XBr,Ohc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();D0();YBr();XBr=ee.objectWithoutOptionalProperties({key:PZe,value:ee.lazy(()=>Md),minProperties:ee.number().optional(),maxProperties:ee.number().optional(),example:ee.unknown().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Xu).extend(zd)});var ZBr,Kuo=h(()=>{"use strict";yr();ya();Pf();gjt();ZBr=ee.objectWithoutOptionalProperties({name:ee.string().optional(),properties:ee.list(Q0e)}).extend(Nn).extend(Jo)});var $Br,Phc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();$Br=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Md)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var eDr,Bhc=h(()=>{"use strict";yr();ja();D0e();ud();NOr();sBr();eDr=ee.objectWithoutOptionalProperties({key:ee.string(),schema:ee.lazy(()=>Md),readonly:ee.boolean().optional(),writeonly:ee.boolean().optional(),audiences:ee.list(ee.string()),conflict:ee.record(NF,EZe),nameOverride:ee.string().optional(),generatedName:ee.string(),xml:JXe.optional()}).extend(ds)});var tDr,Dhc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();_Or();IZe();V0e();tDr=ee.objectWithoutOptionalProperties({allOf:ee.list(aZ),properties:ee.list(ee.lazyObject(()=>eDr)),allOfPropertyConflicts:ee.list(ZXe),fullExamples:ee.list(vQ).optional(),additionalProperties:ee.boolean(),minProperties:ee.number().optional(),maxProperties:ee.number().optional()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var rDr,Rhc=h(()=>{"use strict";ac();yr();ja();rDr=ee.union("type",{discriminated:ee.lazyObject(()=>DBr),undiscriminated:ee.lazyObject(()=>nDr)}).transform({transform:e=>{switch(e.type){case"discriminated":return U6.discriminated(e);case"undiscriminated":return U6.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t})});var iDr,khc=h(()=>{"use strict";yr();ja();ud();ya();C1();Oy();EA();B0();D0();iDr=ee.objectWithoutOptionalProperties({value:ee.lazy(()=>Md)}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu).extend(zd)});var oDr,Juo=h(()=>{"use strict";yr();ud();ya();Oy();EA();B0();D0();oDr=ee.objectWithoutOptionalProperties({example:ee.unknown()}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(Xu)});var Md,Fhc=h(()=>{"use strict";ac();yr();ja();$Pr();IZe();Luo();YBr();Juo();Md=ee.union("type",{primitive:PZe,object:ee.lazyObject(()=>tDr),array:ee.lazyObject(()=>TBr),map:ee.lazyObject(()=>XBr),optional:ee.lazyObject(()=>iDr),enum:UBr,reference:aZ,literal:bZe,oneOf:ee.object({value:ee.lazy(()=>rDr)}),nullable:ee.lazyObject(()=>$Br),unknown:oDr}).transform({transform:e=>{switch(e.type){case"primitive":return Wr.primitive(e);case"object":return Wr.object(e);case"array":return Wr.array(e);case"map":return Wr.map(e);case"optional":return Wr.optional(e);case"enum":return Wr.enum(e);case"reference":return Wr.reference(e);case"literal":return Wr.literal(e);case"oneOf":return Wr.oneOf(e.value);case"nullable":return Wr.nullable(e);case"unknown":return Wr.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t})});var nDr,Nhc=h(()=>{"use strict";yr();ja();ud();ya();iZ();C1();Oy();EA();B0();Pf();D0();nDr=ee.objectWithoutOptionalProperties({commonProperties:ee.list(ee.lazyObject(()=>wZe)).optional(),schemas:ee.list(ee.lazy(()=>Md))}).extend(Yu).extend(gc).extend($c).extend(Nn).extend(ds).extend(w1).extend(Jo).extend(Xu).extend(zd)});var jhc,Qhc=h(()=>{"use strict";yr();ja();k0e();ya();EA();Pf();aZe();mBr();hBr();gBr();bjt();Kuo();VBr();jhc=ee.objectWithoutOptionalProperties({audiences:ee.list(ee.string()),sdkName:sZ.optional(),method:xZe,summary:ee.string().optional(),operationId:ee.string(),tags:ee.list(jF),headers:ee.list(L0e),generatedPayloadName:ee.string(),payload:ee.lazy(()=>Md),multipartFormData:ZBr.optional(),response:OZe.optional(),signatureVerification:CZe.optional(),examples:ee.list(vZe)}).extend(Nn).extend(Jo).extend(gc)});var zhc,Mhc=h(()=>{"use strict";yr();bjt();NBr();zhc=ee.objectWithoutOptionalProperties({queryParameters:ee.list(SZe),headers:ee.list(L0e)})});var Yuo=h(()=>{"use strict";xhc();Tuo();Ouo();Chc();Puo();Buo();whc();Duo();Thc();Luo();Vuo();bjt();Ruo();Uuo();_uo();Fuo();Muo();Ohc();Kuo();V0e();Phc();Bhc();Dhc();Rhc();khc();Nuo();juo();Quo();kuo();Huo();YBr();NBr();zuo();VBr();Fhc();Guo();quo();Wuo();Nhc();Juo();Qhc();Mhc()});var Xuo={};Z(Xuo,{ArraySchemaWithExample:()=>TBr,Base64WithExample:()=>OBr,BooleanWithExample:()=>PBr,CommonPropertyWithExample:()=>wZe,DateWithExample:()=>BBr,DatetimeWithExample:()=>yjt,DiscriminatedOneOfSchemaWithExample:()=>DBr,DoubleWithExample:()=>RBr,EndpointWithExample:()=>Shc,EnumSchemaWithExample:()=>UBr,FloatWithExample:()=>_Br,HeaderWithExample:()=>L0e,HttpErrorWithExample:()=>kBr,Int64WithExample:()=>GBr,IntWithExample:()=>qBr,JsonRequestWithExample:()=>jBr,JsonResponseWithExample:()=>TZe,MapSchemaWithExample:()=>XBr,MultipartFormDataWebhookPayloadWithExample:()=>ZBr,NamedFullExample:()=>vQ,NullableSchemaWithExample:()=>$Br,ObjectPropertyWithExample:()=>eDr,ObjectSchemaWithExample:()=>tDr,OneOfSchemaWithExample:()=>rDr,OptionalSchemaWithExample:()=>iDr,ParseFormUrlEncodedRequest:()=>QBr,ParseMultipartRequest:()=>zBr,ParseOctetStreamRequest:()=>MBr,PathParameterWithExample:()=>FBr,PrimitiveSchemaValueWithExample:()=>JBr,PrimitiveSchemaWithExample:()=>PZe,QueryParameterWithExample:()=>SZe,RequestWithExample:()=>LBr,ResponseWithExample:()=>OZe,SchemaWithExample:()=>Md,StringSchemaWithExample:()=>WBr,Uint64WithExample:()=>HBr,UintWithExample:()=>KBr,UnDiscriminatedOneOfSchemaWithExample:()=>nDr,UnknownSchemaWithExample:()=>oDr,WebhookWithExample:()=>jhc,WebsocketHandshakeWithExample:()=>zhc});var Lhc=h(()=>{"use strict";Yuo()});var Vhc=h(()=>{"use strict";nhc();dco();chc();Aco();vhc();wuo();Lhc();Yuo()});var va={};Z(va,{AllOfPropertyConflict:()=>ZXe,ArraySchema:()=>GOr,ArraySchemaWithExample:()=>TBr,AsymmetricAlgorithm:()=>qOr,AsymmetricWebhookSignatureVerification:()=>XOr,Availability:()=>IOr,Base64WithExample:()=>OBr,BasicSecurityScheme:()=>fOr,BearerSecurityScheme:()=>dOr,BooleanSchema:()=>ZOr,BooleanWithExample:()=>PBr,BytesResponse:()=>tZe,CasingOverrides:()=>SOr,CommonProperty:()=>rZe,CommonPropertyWithExample:()=>wZe,CursorPagination:()=>ePr,CustomCodeSample:()=>iPr,CustomCodeSampleLanguage:()=>tPr,CustomCodeSampleSdk:()=>nPr,CustomPagination:()=>oPr,DateWithExample:()=>BBr,DatetimeWithExample:()=>yjt,DiscriminatedOneOfSchema:()=>aPr,DiscriminatedOneOfSchemaWithExample:()=>DBr,DiscriminatorContext:()=>nZe,DoubleSchema:()=>cPr,DoubleWithExample:()=>RBr,Encoding:()=>gOr,Endpoint:()=>MPr,EndpointExample:()=>sZe,EndpointResponseExample:()=>pPr,EndpointSdkName:()=>sZ,EndpointSecurity:()=>cZe,EndpointWithExample:()=>Shc,EnumSchema:()=>WXe,EnumSchemaWithExample:()=>UBr,EnumValue:()=>B0e,ErrorExample:()=>bPr,ErrorStatusCodeKey:()=>qXe,FernExample:()=>uPr,FileResponse:()=>hZe,FileSchema:()=>BPr,FloatWithExample:()=>_Br,FormUrlEncodedRequest:()=>TPr,FullEndpointExample:()=>hPr,FullExample:()=>$h,FullObjectExample:()=>MOr,FullOneOfExample:()=>LOr,GlobalHeader:()=>LPr,GlobalParameter:()=>VPr,GlobalSecurity:()=>UPr,Header:()=>N0e,HeaderExample:()=>iZe,HeaderSecurityScheme:()=>yOr,HeaderWithExample:()=>L0e,HmacWebhookSignatureVerification:()=>JPr,HttpEndpointServer:()=>uZe,HttpError:()=>EPr,HttpErrorWithExample:()=>kBr,HttpMethod:()=>lZe,IdempotencyHeader:()=>YPr,Int64WithExample:()=>GBr,IntSchema:()=>XPr,IntWithExample:()=>qBr,JsonRequest:()=>OPr,JsonRequestWithExample:()=>jBr,JsonResponse:()=>gZe,JsonResponseWithExample:()=>TZe,KeyValuePair:()=>VOr,LiteralExample:()=>jOr,LiteralSchema:()=>bZe,LiteralSchemaValue:()=>ZPr,LongSchema:()=>eBr,MapSchema:()=>nBr,MapSchemaWithExample:()=>XBr,MultipartFormDataWebhookPayload:()=>iBr,MultipartFormDataWebhookPayloadWithExample:()=>ZBr,MultipartRequest:()=>dZe,MultipartRequestProperty:()=>Q0e,MultipartRequestPropertyEncoding:()=>PPr,MultipartSchema:()=>DPr,NamedFullExample:()=>vQ,Namespace:()=>bOr,NamespaceId:()=>EOr,NullExample:()=>QOr,NullableSchema:()=>oBr,NullableSchemaWithExample:()=>$Br,OauthSecurityScheme:()=>POr,ObjectProperty:()=>aBr,ObjectPropertyConflictInfo:()=>EZe,ObjectPropertyWithExample:()=>eDr,ObjectSchema:()=>cBr,ObjectSchemaWithExample:()=>tDr,OctetStreamRequest:()=>mZe,OffsetPagination:()=>vPr,OneOfSchema:()=>uBr,OneOfSchemaWithExample:()=>rDr,OpenApiIntermediateRepresentation:()=>Ahc,OpenApiSource:()=>xOr,OptionalSchema:()=>wBr,OptionalSchemaWithExample:()=>iDr,Pagination:()=>pZe,ParseFormUrlEncodedRequest:()=>QBr,ParseMultipartRequest:()=>zBr,ParseOctetStreamRequest:()=>MBr,PathPagination:()=>xPr,PathParameter:()=>j0e,PathParameterExample:()=>dPr,PathParameterWithExample:()=>FBr,PrimitiveExample:()=>YXe,PrimitiveSchema:()=>M0e,PrimitiveSchemaValue:()=>rBr,PrimitiveSchemaValueWithExample:()=>JBr,PrimitiveSchemaWithExample:()=>PZe,PropertyKey:()=>XXe,ProtobufEncoding:()=>mOr,ProtobufSource:()=>COr,QueryParameter:()=>fZe,QueryParameterExample:()=>oZe,QueryParameterWithExample:()=>SZe,QuerySecurityScheme:()=>BOr,ReferencedSchema:()=>aZ,Request:()=>FPr,RequestWithExample:()=>LBr,Response:()=>AZe,ResponseWithExample:()=>OZe,RetriesConfiguration:()=>yZe,Schema:()=>Sl,SchemaId:()=>NF,SchemaWithExample:()=>Md,Schemas:()=>pBr,SdkGroup:()=>vOr,SdkGroupInfo:()=>fBr,SdkGroupName:()=>P0e,SecurityScheme:()=>DOr,SecuritySchemeId:()=>R0e,Server:()=>fjt,ServerVariable:()=>ROr,Source:()=>wOr,StatusCode:()=>HXe,StreamingResponseExample:()=>lPr,StringSchema:()=>tBr,StringSchemaWithExample:()=>WBr,SupportedSdkLanguage:()=>rPr,Tag:()=>FOr,TagId:()=>jF,Tags:()=>dBr,TextResponse:()=>z0e,Uint64WithExample:()=>HBr,UintWithExample:()=>KBr,UnDiscriminatedOneOfSchema:()=>lBr,UnDiscriminatedOneOfSchemaWithExample:()=>nDr,UnknownSchema:()=>SBr,UnknownSchemaWithExample:()=>oDr,UriPagination:()=>CPr,Webhook:()=>ABr,WebhookBodyHashAlgorithm:()=>_Pr,WebhookBodyHashBinding:()=>WPr,WebhookBodyHashLocation:()=>qPr,WebhookBodyHashQueryParameterLocation:()=>GPr,WebhookExampleCall:()=>vZe,WebhookHttpMethod:()=>xZe,WebhookNotificationUrlNormalization:()=>HPr,WebhookPayloadBodySort:()=>WOr,WebhookPayloadComponent:()=>HOr,WebhookPayloadFormat:()=>$Xe,WebhookSignatureAlgorithm:()=>KPr,WebhookSignatureEncoding:()=>F0e,WebhookSignatureVerification:()=>CZe,WebhookTimestamp:()=>eZe,WebhookTimestampFormat:()=>JOr,WebhookWithExample:()=>jhc,WebsocketChannel:()=>CBr,WebsocketHandshake:()=>yBr,WebsocketHandshakeWithExample:()=>zhc,WebsocketMessageExample:()=>vBr,WebsocketMessageOrigin:()=>bBr,WebsocketMessageSchema:()=>EBr,WebsocketServer:()=>IBr,WebsocketSessionExample:()=>xBr,WithAvailability:()=>ds,WithDescription:()=>Nn,WithEncoding:()=>w1,WithInline:()=>zd,WithName:()=>$c,WithNamespace:()=>gc,WithSdkGroupName:()=>Yu,WithSdkMethodName:()=>oZ,WithSource:()=>Jo,WithStatusCode:()=>UU,WithTitle:()=>Xu,XmlEncoding:()=>hOr,XmlPropertyEncoding:()=>JXe,commons:()=>mco,example:()=>yco,finalIr:()=>Suo,parseIr:()=>Xuo});var ja=h(()=>{"use strict";Vhc()});var Uhc=h(()=>{"use strict";ac();qdc();ja()});var _hc,BZe,Ghc,sDr=h(()=>{"use strict";_hc=/^(\d+)/,BZe=/^[a-zA-Z][a-zA-Z0-9_]*$/,Ghc={"<":"LESS_THAN",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL_TO","<=":"LESS_THAN_OR_EQUAL_TO","!=":"NOT_EQUALS","=":"EQUAL_TO","==":"EQUAL_TO","*":"ALL","":"EMPTY",'""':"EMPTY_STRING","-":"HYPHEN","|":"PIPE",".":"DOT","/":"SLASH"}});function FQe(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let s=Math.floor(e/10),a=e%10;return a===0?n[s]:`${n[s]}_${t[a]}`}if(e<1e3){let s=Math.floor(e/100),a=e%100;return a===0?`${t[s]}_hundred`:`${t[s]}_hundred_${FQe(a)}`}let i=Math.floor(e/1e3),o=e%1e3;return o===0?`${t[i]}_thousand`:`${t[i]}_thousand_${FQe(o)}`}var Zuo=h(()=>{"use strict"});function Ejt(e){let t=e.match(_hc);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let o=FQe(i);return n.length>0?`${o}_${n}`:o}}}var $uo=h(()=>{"use strict";Zuo();sDr()});function DZe(e){let t=Ejt(e),r=Ghc[e];return t!=null?_u(ti(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":_u(ti(e)))}var qhc=h(()=>{"use strict";Vi();$uo();sDr()});function QF(e,t){return e.type==="primitive"&&t.type==="primitive"?Whc(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?oVf(e.values,t.values):e.type==="array"&&t.type==="array"?QF(e.value,t.value):e.type==="unknown"&&t.type==="unknown"?!0:e.type==="reference"&&t.type==="reference"?e.schema===t.schema:e.type==="optional"&&t.type==="optional"||e.type==="nullable"&&t.type==="nullable"?QF(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?sVf(e.value,t.value):e.type==="object"&&t.type==="object"?aVf(e,t):e.type==="map"&&t.type==="map"?Whc(e.key.schema,t.key.schema)&&QF(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function Whc(e,t){return e.type===t.type}function oVf(e,t){let r=new Set(e.map(i=>i.value)),n=new Set(t.map(i=>i.value));return b0(r,n)}function sVf(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:QF(n,i)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:QF(r,i)}):!1}function aVf(e,t){if(e.properties.length!==t.properties.length)return!1;let r=new Map(e.properties.map(n=>[n.key,n.schema]));return t.properties.every(n=>{let i=r.get(n.key);return i==null?!1:QF(i,n.schema)})}var Hhc=h(()=>{"use strict";Vi()});var Khc=h(()=>{"use strict";sDr();Zuo();qhc();Hhc();$uo()});var Ac=h(()=>{"use strict";Uhc();ac();ja();Khc()});function R0(e){switch(e){case Zh.Deprecated:return"deprecated";case Zh.Beta:return"beta";case Zh.GenerallyAvailable:return"generally-available";case Zh.Alpha:return"alpha";case Zh.Preview:return"preview";case Zh.Legacy:return"legacy";default:return}}var NQe=h(()=>{"use strict";Ac()});function Ijt(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};case"xml":return{xml:{name:e.name,namespace:e.namespace,prefix:e.prefix}};default:Ee(e)}}function aDr(e){return{xml:{name:e.name,attribute:e.attribute,text:e.text,wrapped:e.wrapped,separator:e.separator}}}var cDr=h(()=>{"use strict";wt()});function Jhc(e){let t=e.match(/^(_+)/),r=e.match(/(_+)$/),n=t?.[1]??"",i=r?.[1]??"";if(n===""&&i==="")return ti(e);if(n.length+i.length>=e.length)return e;let o=e.slice(n.length,e.length-i.length||void 0);return`${n}${ti(o)}${i}`}function cVf(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function Yhc(e){let t=e?cVf(e):void 0;if(t==null||t.length===0)return Vje;let r=[];for(let[n,i]of t.entries())typeof i=="string"?r.push(Jhc(i)):typeof i=="object"?i.type==="namespace"?n<t.length-1?r.push(Jhc(i.name)):r.push(i.name,Vje):Ee(i.type):Ee(i);return r.join("/")}function Ule(e){return Us.of(`${Yhc(e)}.yml`)}function elo({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?Vje:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,Yhc(r))}function Xhc({sdkName:e,namespaceOverride:t}){return Us.of(`${elo({sdkName:e,namespaceOverride:t})}.yml`)}function Zhc({location:e,namespaceOverride:t}){return t!=null?NI(Us.of(t),e):e}var RZe=h(()=>{"use strict";aa();wt();Ey();Vi()});function $hc(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"unknown":return uDr({namespace:e.namespace,groupName:e.groupName});case"oneOf":return uDr({namespace:e.value.namespace,groupName:e.value.groupName});default:Ee(e)}}function uDr({namespace:e,groupName:t}){return e!=null&&t!=null?Ule([{type:"namespace",name:e},...t]):e!=null?Ule([{type:"namespace",name:e}]):Ule(t)}var tlo=h(()=>{"use strict";wt();RZe()});function _le(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":case"unknown":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;default:Ee(e)}}var vjt=h(()=>{"use strict";wt()});function rf(e){return typeof e=="string"?e:e.type}function kZe(e){if(typeof e!="string")return e.docs}function jQe(e){if(typeof e!="string")return e.default}function rlo(e){if(typeof e!="string")return e.validation}function FZe(e){let t=e.match(/^optional<\s*nullable<\s*(.+)\s*>\s*>$/);if(t!=null&&t[1]!=null)return t[1].trim();let r=e.match(/^nullable<\s*(.+)\s*>$/);return r!=null&&r[1]!=null?r[1].trim():e}var _6=h(()=>{"use strict"});function tgc(e){let t=rf(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?egc(e):{...e,type:egc(e.type)}}function egc(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}var rgc=h(()=>{"use strict";_6()});function QQe(e){return rf(e).startsWith("optional<")?e:typeof e=="string"?ngc(e):{...e,type:ngc(e.type)}}function ngc(e){return e.startsWith("optional<")?e:`optional<${e}>`}var lDr=h(()=>{"use strict";_6()});function Oc({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:o,variant:s}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return pDr(e);case"array":return olo({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"map":return slo({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"reference":return ilo({schema:e,fileContainingReference:t,context:n,namespace:i,variant:s});case"unknown":return clo();case"optional":return fDr({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"nullable":return alo({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"enum":return IVf({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:o});case"literal":return e.value,ulo(e);case"object":return vVf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"oneOf":return xVf({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});default:Ee(e)}}function pDr(e){switch(e.schema.type){case"string":return hVf({description:e.description,schema:e.schema});case"int":return gVf({description:e.description,schema:e.schema});case"float":return AVf({description:e.description,schema:e.schema});case"double":return yVf({description:e.description,schema:e.schema});case"boolean":return dVf({description:e.description,schema:e.schema});case"int64":return mVf({description:e.description,schema:e.schema})}let t=e.schema._visit({int:()=>"integer",int64:()=>"long",uint:()=>"uint",uint64:()=>"uint64",float:()=>"double",double:()=>"double",string:()=>"string",datetime:()=>"datetime",datetimeRfc2822:()=>"datetime-rfc-2822",date:()=>"date",base64:()=>"base64",boolean:()=>"boolean",_other:()=>"unknown"});return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function dVf({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function mVf({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function hVf({description:e,schema:t}){let r="string",n=bVf(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function gVf({description:e,schema:t}){let r="integer",n=igc(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function AVf({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function yVf({description:e,schema:t}){let r="double",n=igc(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function bVf(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,o=EVf(t);if(!(o==null&&r==null&&n==null&&i==null))return{format:o,pattern:r,minLength:n,maxLength:i}}function EVf(e){switch(e){case"date":case"date-time":case"password":case"byte":case"bytes":case"binary":case"email":case"uuid":case"uri":case"hostname":case"ipv4":case"ipv6":return e;default:return}}function igc(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:o,exclusiveMaximum:s}=e;if(r=nlo(r,t),n=nlo(n,t),i=nlo(i,t),!(r==null&&n==null&&o==null&&s==null&&i==null))return{min:r,max:n,exclusiveMin:o,exclusiveMax:s,multipleOf:i}}function nlo(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[uVf,lVf]:[pVf,fVf];return e<r||e>n?void 0:e}function ilo({schema:e,fileContainingReference:t,context:r,variant:n}){let i=r.getSchema(e.schema,e.namespace);if(i==null)return"unknown";let o=CVf(i)??e.schema,s=r.options.respectReadonlySchemas&&n!=null?r.getSchemaFinalName(o,n):o,a=_le(i),c=wVf(i),l=dDr({context:r,fileContainingReference:t,declarationFile:uDr({namespace:e.namespace,groupName:a}),type:s});return i.type==="nullable"&&(l=r.options.wrapReferencesToNullableInOptional?`optional<${l}>`:`nullable<${l}>`),i.type==="optional"&&!l.startsWith("optional<")&&(l=`optional<${l}>`),e.description==null&&c==null?l:{type:l,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function olo({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Oc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=`list<${rf(a)}>`;return e.description==null&&e.title==null&&e.default==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{},...e.default!=null?{default:e.default}:{},type:c}}function slo({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=pDr(e.key),c=Oc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=e.encoding!=null?Ijt(e.encoding):void 0,l=`map<${rf(a)}, ${rf(c)}>`;if(e.description==null&&u==null&&e.title==null)return l;let p={type:l};return e.description!=null&&(p.docs=e.description),e.encoding!=null&&(p.encoding=u),e.availability!=null&&(p.availability=R0(e.availability)),p}function alo({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){if(!n.options.respectNullableSchemas)return fDr({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});let a=Oc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=rf(a),u=kZe(a),l=jQe(a),p=rlo(a),d=tgc(c);if(n.options.wrapReferencesToNullableInOptional&&(d=QQe(d)),e.availability==null&&e.description==null&&u==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||u!=null)&&(f.docs=e.description??u),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=R0(e.availability)),f}function fDr({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Oc({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=rf(a),u=kZe(a),l=jQe(a),p=rlo(a),d=QQe(c);if(e.availability==null&&e.description==null&&u==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||u!=null)&&(f.docs=e.description??u),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=R0(e.availability)),f}function clo(){return"unknown"}function ulo(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Ee(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function IVf({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let o=xjt(e,i),s=e.nameOverride??e.generatedName;n.builder.addType(r,{name:s,schema:o.schema});let a=dDr({type:s,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return a;let c={type:a};return e.description!=null&&(c.docs=e.description),e.default!=null&&(c.default=e.default.value),e.availability!=null&&(c.availability=R0(e.availability)),c}function vVf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=zQe({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:a.schema});let u=dDr({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?u:{type:u,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function xVf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=llo({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:a.schema});let u=dDr({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?u:{...e.title!=null?{"display-name":e.title}:{},type:u,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:R0(e.availability)}:{}}}function dDr({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function CVf(e){return Aa._visit(e,{primitive:t=>t.nameOverride??t.generatedName,object:t=>t.nameOverride??t.generatedName,array:t=>t.nameOverride??t.generatedName,map:t=>t.nameOverride??t.generatedName,enum:t=>t.nameOverride??t.generatedName,reference:t=>t.nameOverride??t.generatedName,literal:t=>t.nameOverride??t.generatedName,oneOf:t=>t.nameOverride??t.generatedName,optional:t=>t.nameOverride??t.generatedName,nullable:t=>t.nameOverride??t.generatedName,unknown:t=>t.nameOverride??t.generatedName,_other:()=>{}})}function wVf(e){return Aa._visit(e,{primitive:t=>t.title,object:t=>t.title,array:t=>t.title,map:t=>t.title,enum:t=>t.title,reference:t=>t.title,literal:t=>t.title,oneOf:t=>t.title,optional:t=>t.title,nullable:t=>t.title,unknown:t=>{},_other:()=>{}})}var uVf,lVf,pVf,fVf,cZ=h(()=>{"use strict";wt();Ac();Cjt();NQe();cDr();tlo();vjt();_6();rgc();lDr();uVf=-2147483648,lVf=2147483647,pVf=-17976931348623157e292,fVf=17976931348623157e292});function Gle(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Ee(e)}}var mDr=h(()=>{"use strict";wt()});function agc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s;switch(e.type){case"primitive":s=OVf(e);break;case"array":s=SVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":s=TVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":s=PVf({schema:e,context:t,declarationFile:r,namespace:n,variant:o});break;case"unknown":s=DVf(e.nameOverride,e.generatedName,e.description);break;case"optional":s=cgc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":s=BVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":s=xjt(e,i);break;case"literal":s=RVf(e,e.nameOverride,e.generatedName);break;case"object":s=zQe({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;case"oneOf":s=llo({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;default:Ee(e)}return s}function zQe({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,skipReadonlyProperties:o,variant:s}){let a=o===!0||s==="write",c=e.properties.some(g=>g.readonly),u=new Set;for(let g of e.properties){if(a&&g.readonly)continue;let A=Object.entries(g.conflict);if(!A.every(([y,E])=>!E.differentSchema))for(let[y]of A)for(let E of wjt({property:g.key,schemaId:y,context:t,namespace:n}))u.add(E)}let l={};for(let g of e.properties)a&&g.readonly||Object.keys(g.conflict).length>0&&Object.values(g.conflict).every(y=>!y.differentSchema)||(l[g.key]=sgc({property:g,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:s}));for(let g of e.allOfPropertyConflicts)g.allOfSchemaIds.forEach(A=>u.add(A));let p=[];for(let g of e.allOf){let A=hDr({schema:g.schema,context:t,namespace:n});if(A==null||u.has(g.schema)||u.has(A))continue;let y=Oc({schema:Aa.reference(g),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});p.push(FZe(rf(y)))}for(let g of u){let A=NZe(t,g,n);for(let y of A.properties)l[y.key]==null&&(a&&y.readonly||(l[y.key]=sgc({property:y,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:s})));for(let y of A.allOf){if(u.has(y.schema))continue;let E=Oc({schema:Aa.reference(y),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});p.push(FZe(rf(E)))}}let d={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(l).map(([g,A])=>FVf(g)?[g,typeof A=="string"?{type:A,name:`_${g}`}:{...A,name:`_${g}`}]:[g,A]))};p.length>0&&(d.extends=p),e.additionalProperties&&(d["extra-properties"]=!0),e.availability!=null&&(d.availability=R0(e.availability)),e.source!=null&&(d.source=Gle(e.source)),e.encoding!=null&&(d.encoding=Ijt(e.encoding)),d.inline=flo(e,i);let f=e.nameOverride??e.generatedName;return{name:s==="read"&&c&&t.options.respectReadonlySchemas&&t.hasReadVariant(f)?`${f}Read`:f,schema:d}}function wjt({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];let o=i.type==="nullable"?i.value:i;if(o.type==="reference")return wjt({property:e,schemaId:o.schema,context:r,namespace:n});if(o.type==="object"){let{properties:s,allOf:a}=plo(r,o,n),c=s.some(l=>l.key===e),u=[...a.flatMap(l=>wjt({property:e,context:r,schemaId:l.schema,namespace:n}))];if(c||u.length>0)return[t,...u]}return[]}function plo(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?NZe(e,t.schema,r):t.type==="nullable"?plo(e,t.value,r):{properties:[],allOf:[]}}function NZe(e,t,r){let n=e.getSchema(t,r);return n==null?{properties:[],allOf:[]}:plo(e,n,r)}function SVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:olo({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function TVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:slo({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function OVf(e){let t=pDr(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function ogc(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function xjt(e,t){let r={enum:e.values.map(o=>{let s=o.nameOverride??o.generatedName,a=o.value;if(s===a&&o.description==null&&(o.casing==null||ogc(o.casing)))return s;let c={value:o.value};if(s!==a&&(c.name=s),o.description!=null&&(c.docs=o.description),o.casing!=null&&!ogc(o.casing)){let u={},l=!1;o.casing.camel!=null&&(u.camel=o.casing.camel,l=!0),o.casing.screamingSnake!=null&&(u["screaming-snake"]=o.casing.screamingSnake,l=!0),o.casing.snake!=null&&(u.snake=o.casing.snake,l=!0),o.casing.pascal!=null&&(u.pascal=o.casing.pascal,l=!0),l&&(c.casing=u)}return c})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=flo(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?Gle(e.source):void 0};for(let o of r.enum){let s=typeof o=="string"?o:o.name??o.value;n.has(s.toLowerCase())||(i.enum.push(o),n.add(s.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function PVf({schema:e,context:t,declarationFile:r,namespace:n,variant:i}){return{name:e.nameOverride??e.generatedName,schema:ilo({schema:e,context:t,fileContainingReference:r,namespace:n,variant:i})}}function BVf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.options.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:alo({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:cgc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function cgc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:fDr({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function DVf(e,t,r){return r!=null?{name:e??t,schema:{type:"unknown",docs:r}}:{name:e??t,schema:clo()}}function RVf(e,t,r){return{name:t??r,schema:ulo(e)}}function llo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s=e.encoding!=null?Ijt(e.encoding):void 0;if(e.type==="discriminated"){let u={};for(let p of e.commonProperties)u[p.key]=Oc({schema:p.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o});let l={};for(let[p,d]of Object.entries(e.schemas))l[p]=Oc({schema:d,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:o});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantPropertyNameOverride!=null||e.discriminatorContext!=null?{...e.discriminantPropertyNameOverride!=null&&{name:e.discriminantPropertyNameOverride},value:e.discriminantProperty,...e.discriminatorContext!=null&&{context:e.discriminatorContext}}:e.discriminantProperty,"base-properties":u,docs:e.description??void 0,availability:e.availability!=null?R0(e.availability):void 0,union:l,"default-variant":e.defaultDiscriminantValue??void 0,encoding:s,source:e.source!=null?Gle(e.source):void 0}}}let a=[];for(let u of e.schemas)a.push(Oc({schema:u,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o}));let c=e.commonProperties!=null&&e.commonProperties.length>0?Object.fromEntries(e.commonProperties.map(u=>[u.key,Oc({schema:u.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o})])):void 0;return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,"base-properties":c,docs:e.description??void 0,union:a,encoding:s,source:e.source!=null?Gle(e.source):void 0,inline:flo(e,i)}}}function FVf(e){return kVf.test(e)}function hDr({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?hDr({context:t,schema:n.schema,namespace:r}):e}function sgc({property:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s=Oc({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:o});return NVf({typeReference:s,audiences:e.audiences,name:e.nameOverride,availability:R0(e.availability),propertyAccess:jVf(e),encoding:e.xml!=null?aDr(e.xml):void 0})}function NVf({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i,encoding:o}){return t.length===0&&r==null&&n==null&&i==null&&o==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{},...i!=null?{access:i}:{},...o!=null?{encoding:o}:{}}}function flo(e,t){return e.inline===!0||t>0?!0:void 0}function jVf(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return Fd.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return Fd.ObjectPropertyAccess.WriteOnly}}var kVf,Cjt=h(()=>{"use strict";wt();lo();Ac();cZ();NQe();cDr();mDr();_6();kVf=/^[0-9]/});function ugc(e){let t=e.replace(/^x-|^X-/,"");return ti(t)}var lgc=h(()=>{"use strict";Vi()});function pgc(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.usernamePlaceholder!=null&&(i.username===void 0?i.username={placeholder:n.usernamePlaceholder}:i.username.placeholder=n.usernamePlaceholder),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),n.passwordPlaceholder!=null&&(i.password===void 0?i.password={placeholder:n.passwordPlaceholder}:i.password.placeholder=n.passwordPlaceholder),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),n.tokenPlaceholder!=null&&(i.token===void 0?i.token={placeholder:n.tokenPlaceholder}:i.token.placeholder=n.tokenPlaceholder),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??ugc(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),n.headerPlaceholder!=null&&(i.placeholder=n.headerPlaceholder),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(Us.of("__package__.yml"),{name:"OauthScope",schema:xjt(n.scopesEnum,0).schema})}}var fgc=h(()=>{"use strict";Ey();Cjt();lgc()});function uZ({header:e,context:t,fileContainingReference:r,namespace:n}){let i=Oc({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),o=rf(i),s=jQe(i),a=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:ti(a);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null&&e.clientDefault==null&&s==null)return o;let u={type:o};return c!==e.name&&(u.name=c),e.description!=null&&(u.docs=e.description),e.env!=null&&(u.env=e.env),e.availability!=null&&(u.availability=R0(e.availability)),e.clientDefault!=null&&(u["client-default"]=e.clientDefault),s!=null&&(u.default=s),u}var jZe=h(()=>{"use strict";Vi();cZ();NQe();_6()});function gDr({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=Oc({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null&&e.clientDefault==null)return rf(i);let o=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:rf(i)};return e.description!=null&&(o.docs=e.description),e.availability!=null&&(o.availability=R0(e.availability)),e.clientDefault!=null&&"type"in o&&(o["client-default"]=e.clientDefault),o}var dlo=h(()=>{"use strict";cZ();NQe();_6()});function yDr({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=mlo({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let o=rf(i.value),s=hlo(e.schema,t,n)??jQe(i.value);o==="unknown"?o="string":o==="optional<unknown>"&&(o="optional<string>");let a={type:o};return e.clientDefault!=null&&(a["client-default"]=e.clientDefault),s!=null&&(a.default=s),i.allowMultiple&&(a["allow-multiple"]=!0),e.explode!=null&&(a.explode=e.explode),e.description!=null&&(a.docs=e.description),e.parameterNameOverride!=null&&(a.name=e.parameterNameOverride),e.availability!=null&&(a.availability=R0(e.availability)),QVf(i.value)&&i.value.validation!==void 0&&(a.validation=i.value.validation),a.default==null&&a["client-default"]==null&&a["allow-multiple"]==null&&a.docs==null&&a.name==null&&a.availability==null&&a.validation==null&&a.explode==null?o:a}function mlo({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:Oc({schema:Aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:Us.of(qf),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,c]of Object.entries(i.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(s=!0),c.type==="literal"&&c.value.type==="string"&&(BZe.test(c.value.value)?o.push(c.value.value):o.push({value:c.value.value,name:DZe(c.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[a,c]=i.value.schemas;if(a!=null&&c!=null&&ADr({array:a,primitive:c}))return{value:Oc({schema:Aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&c!=null&&ADr({array:c,primitive:a}))return{value:Oc({schema:Aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[a,c]of Object.entries(i.value.schemas))return mlo({schema:c,context:t,fileContainingReference:r,namespace:n})}else if(t.options.objectQueryParameters)return{value:Oc({schema:e,context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?Aa.optional:Aa.nullable;if(e.value.type==="reference"){let o=t.getSchema(e.value.schema,n);if(o==null)return;if(o.type==="array")return{value:Oc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:o.value,description:e.description??o.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.options.objectQueryParameters)return{value:Oc({schema:e,context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:Oc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,c]of Object.entries(e.value.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(s=!0),c.type==="literal"&&c.value.type==="string"&&(BZe.test(c.value.value)?o.push(c.value.value):o.push({value:c.value.value,name:DZe(c.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[a,c]=e.value.value.schemas;if(a!=null&&c!=null&&ADr({array:a,primitive:c}))return{value:Oc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&c!=null&&ADr({array:c,primitive:a}))return{value:Oc({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}if(t.options.objectQueryParameters)return{value:Oc({schema:e,context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[a,c]of Object.entries(e.value.value.schemas))return mlo({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.options.objectQueryParameters?{value:Oc({schema:e,context:t,fileContainingReference:r,declarationFile:Us.of(qf),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:Oc({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:Oc({schema:Aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}:{value:Oc({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function hlo(e,t,r){if(e.type==="array")return e.default??void 0;if(e.type==="optional"||e.type==="nullable")return hlo(e.value,t,r);if(e.type==="reference"){let n=t.getSchema(e.schema,r);if(n!=null)return hlo(n,t,r)}}function ADr({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function QVf(e){return typeof e=="object"&&e!==null&&"type"in e}var glo=h(()=>{"use strict";aa();Ac();Ey();cZ();NQe();_6()});function dgc({websocketExample:e,context:t}){let r={messages:[]};e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=zVf(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=MVf({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=U0e(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function zVf(e){let t={};return e.forEach(r=>{let n=U0e(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function MVf({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let o=U0e(i.value);r.has(i.name)||o!=null&&(n[i.name]=o)}),n}function U0e(e){switch(e.type){case"primitive":return mgc(e.value);case"object":return hgc(e.properties);case"array":return LVf(e.value);case"map":return VVf(e.value);case"oneOf":return UVf(e.value);case"enum":return e.value;case"literal":return _Vf(e.value);case"unknown":return U0e(e.value);case"null":return null;default:Ee(e)}}function mgc(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:Ee(e)}}function hgc(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,U0e(r)]))}function LVf(e){return e.map(t=>U0e(t))}function VVf(e){return Object.fromEntries(e.map(t=>[mgc(t.key),U0e(t.value)]))}function UVf(e){return e.type==="discriminated"?hgc(e.value):U0e(e.value)}function _Vf(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ee(e)}}var ggc=h(()=>{"use strict";wt()});function Sjt(e){try{let r=new URL(e).pathname.split("/").filter(n=>n.length>0);if(r.length>0)return r[r.length-1]}catch{}}function Tjt(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function bDr(e,t,r=!1){let n=Sjt(t);return r&&n!=null?n:e!=null&&n!=null?`${e}_${n}`:n??e??"websocket"}var Alo=h(()=>{"use strict"});function qle(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function EDr(e,t){return t??(e?.groupName!=null?qle(e.groupName):void 0)}function Agc({endpointNamespace:e,error:t}){return t.namespace??e}var MQe=h(()=>{"use strict"});function ygc({channel:e,context:t,declarationFile:r}){let n=e.servers[0],i=t.ir.servers.length===0&&t.ir.websocketServers.length<=1,o=n!=null?t.getUrlId(n.url):void 0,s=n!=null&&!i?o??(t.options.groupEnvironmentsByHost?bDr(n.name,n.url,!0):n.name):void 0;t.logger.debug(`[buildChannel] Channel path="${e.path}", server name="${n?.name}", server url="${n?.url}", resolved urlId="${s}" (from collision map: ${t.getUrlId(n?.url??"")!=null})`);let a=e.path;for(let m of e.handshake.pathParameters)m.parameterNameOverride!=null&&(a=a.replace(`{${m.name}}`,`{${m.parameterNameOverride}}`));let c=t.authOverrides?.auth!=null,u={path:a,url:s,auth:c};e.audiences!=null&&e.audiences.length>0&&(u.audiences=e.audiences),e.summary!=null&&(u["display-name"]=e.summary),e.connectMethodName!=null&&(u["connect-method-name"]=e.connectMethodName),e.description!=null&&(u.docs=e.description);let l=qle(e.groupName),p={};if(e.handshake.pathParameters.length>0)for(let m of e.handshake.pathParameters){let g=m.parameterNameOverride??m.name;p[g]=gDr({pathParameter:m,context:t,fileContainingReference:r,namespace:l})}Object.keys(p).length>0&&(u["path-parameters"]=p);let d={};if(e.handshake.queryParameters.length>0)for(let m of e.handshake.queryParameters){let g=yDr({queryParameter:m,context:t,fileContainingReference:r,namespace:l});g!=null&&(d[m.name]=g)}Object.keys(d).length>0&&(u["query-parameters"]=d);let f={};if(e.handshake.headers.length>0)for(let m of e.handshake.headers){let g=uZ({header:m,context:t,fileContainingReference:r,namespace:l});f[m.name]=g}Object.keys(f).length>0&&(u.headers=f),t.builder.addChannel(r,{channel:u});for(let m of e.messages){let g={origin:m.origin,body:Oc({schema:m.body,context:t,fileContainingReference:r,namespace:l,declarationDepth:0})};m.displayName!=null&&(g["display-name"]=m.displayName),m.description!=null&&(g.docs=m.description),m.methodName!=null&&(g["method-name"]=m.methodName),t.builder.addChannelMessage(r,{messageId:m.name,message:g})}for(let m of e.examples){let g=dgc({context:t,websocketExample:m});t.builder.addChannelExample(r,{example:g})}}var bgc=h(()=>{"use strict";jZe();dlo();glo();cZ();ggc();Alo();MQe()});function ylo(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}function Egc(e){try{return new URL(e).hostname}catch{return}}function Igc(e){return e??vgc}function GVf(e,t){let r=new Map;for(let n of e){if(ylo(n)||!("url"in n)||!n.url)continue;let i=Egc(n.url)??n.url;r.has(i)||r.set(i,{environmentName:Igc(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.httpServers.push({name:n.name,url:n.url,audiences:n.audiences})}for(let n of t){let i=Egc(n.url)??n.url;r.has(i)||r.set(i,{environmentName:Igc(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.websocketServers.push(n)}return r}function _0e(e){return Object.entries(e).reduce((t,[r,n])=>(mD(n)?Object.entries(n.urls).forEach(([i,o])=>{t[i]=o}):t[r]=typeof n=="string"?n:n.url,t),{})}function qVf(e,t,r){for(let[n,i]of Object.entries(t))if(i!=null)if(e[n]!=null&&e[n]!==i){let o=Tjt(i),s=o!=null?`${n}_${o}`:`${n}_ws`;e[s]=i,r.setUrlId(i,s)}else e[n]=i,r.setUrlId(i,n)}function xgc(e){let t=e.environmentOverrides?.["base-url-env"]??e.ir.baseUrlEnv;if(t!=null&&e.builder.setBaseUrlEnv(t),e.environmentOverrides!=null){for(let[C,O]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:C,schema:O});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let r={},n=[],i=e.ir.servers.some(C=>ylo(C)),o=e.ir.servers;for(let C of o)if(ylo(C)){let O={urls:{}},D={},R={},P={};for(let[J,X]of Object.entries(C.urls))O.urls[J]=X.defaultUrl??X.url,X.urlTemplate&&(D[J]=X.urlTemplate),X.defaultUrl&&(R[J]=X.defaultUrl),X.variables&&X.variables.length>0&&(P[J]=X.variables);(Object.keys(D).length>0||Object.keys(P).length>0)&&(O["url-templates"]=D,O["default-urls"]=R,O.variables=P),C.name&&(r[C.name]=O)}else if("url"in C&&C.url){let D=C.urlTemplate!=null&&C.variables!=null&&C.variables.length>0?{url:C.url,audiences:C.audiences,"default-url":C.defaultUrl,"url-template":C.urlTemplate,variables:C.variables?.map(R=>({id:R.id,default:R.default,values:R.values}))}:C.audiences?{url:C.url,audiences:C.audiences}:C.url;if(C.name==null){n.push(D);continue}r[C.name]=D}let s={},a={},c=[],u={},l={},p={};for(let C of e.ir.endpoints)for(let O of C.servers){if(O.url==null&&O.name!=null){s[O.name]||(s[O.name]=[]);continue}if(O.url==null)continue;let D=O,R="defaultUrl"in O&&typeof D.defaultUrl=="string"?D.defaultUrl:void 0,P="urlTemplate"in O&&typeof D.urlTemplate=="string"?D.urlTemplate:void 0,M="variables"in O&&Array.isArray(D.variables)?D.variables:void 0,J=R??O.url,X=O.audiences?{url:J,audiences:O.audiences}:J;if(O.name==null){c.push(X);continue}s[O.name]||(s[O.name]=[]),s[O.name]?.push({url:J,audiences:O.audiences}),a[O.name]=X,P&&O.name&&(u[O.name]=P),R&&O.name&&(l[O.name]=R),M&&M.length>0&&O.name&&(p[O.name]=M)}let d={},f=[];for(let C of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${C.name}", url="${C.url}"`);let O=C.audiences?{url:C.url,audiences:C.audiences}:C.url;if(C.name==null){f.push(O);continue}d[C.name]=O}let m=Object.keys(r).length,g=m>0,A=Object.keys(a).length>0,y=Object.keys(s).some(C=>s[C]?.length===0),E=Object.keys(d).length>0;if(e.options.groupEnvironmentsByHost&&E&&(g||e.ir.servers.length>0)){let C=Object.entries(d).map(([D,R])=>({name:D,url:typeof R=="string"?R:R.url,audiences:typeof R=="string"?void 0:R.audiences})),O=GVf(o,C);if(O.size>0){let D=!0;for(let[R,P]of O.entries()){let M={},J=[...P.httpServers.map($=>({...$,isHttp:!0})),...P.websocketServers.map($=>({...$,isHttp:!1}))],X=new Map;for(let $ of J){let ie=Sjt($.url),ue=Tjt($.url);ie&&ue&&(X.has(ie)||X.set(ie,new Set),X.get(ie)?.add(ue))}if(P.httpServers.length>0){let $=P.httpServers[0];$!=null&&(M[ME]=$.url,e.setUrlId($.url,ME));for(let ie=1;ie<P.httpServers.length;ie++){let ue=P.httpServers[ie];if(ue!=null){let oe=Sjt(ue.url),de=Tjt(ue.url),we=oe?X.get(oe):void 0,De=we&&we.size>1,ae=De&&de!=="https"?`${oe}_${de}`:oe||`Http${ie+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${ue.url}", pathSegment="${oe}", protocol="${de}", hasCollision=${De}, urlId="${ae}"`),M[ae]=ue.url,e.setUrlId(ue.url,ae)}}}for(let $ of P.websocketServers){let ie=Sjt($.url),ue=Tjt($.url),oe=ie?X.get(ie):void 0,de=oe&&oe.size>1,we=de?`${ie}_${ue}`:bDr($.name,$.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${$.name}", url="${$.url}", pathSegment="${ie}", protocol="${ue}", hasCollision=${de}, urlId="${we}"`),M[we]=$.url,e.setUrlId($.url,we)}if(Object.keys(M).length>1)e.builder.addEnvironment({name:P.environmentName,schema:{urls:M}});else if(Object.keys(M).length===1){let $=Object.values(M)[0];$!=null&&e.builder.addEnvironment({name:P.environmentName,schema:$})}D&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(P.environmentName),Object.keys(M).length>1&&e.builder.setDefaultUrl(ME),D=!1)}return}}if(!g&&!A&&E&&e.ir.servers.length===0){for(let[C,O]of Object.entries(d))e.builder.addEnvironment({name:C,schema:O});e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(Object.keys(d)[0]),e.builder.setDefaultUrl(ME);return}if(c.length>0&&e.logger.debug(`Skipping endpoint level servers ${c.map(C=>typeof C=="string"?C:C.url).join(", ")} because x-fern-server-name was not provided.`),!g){let C=e.ir.servers[0],O=C?.url,D=C?.audiences,R=C?.defaultUrl,P=C?.urlTemplate,M=C?.variables;if(O!=null){let X=P!=null&&M!=null&&M.length>0?{url:O,audiences:D,"default-url":R,"url-template":P,variables:M?.map($=>({id:$.id,default:$.default,values:$.values}))}:D?{url:O,audiences:D}:O;r[vgc]=X}}let x=Object.values(r).map(C=>typeof C=="string"?C:mD(C)?Object.values(C.urls)[0]:C.url),v=n.filter(C=>{let O=typeof C=="string"?C:C.url;return!x.includes(O)});if(v.length>0&&e.logger.debug(`Skipping top level servers ${v.map(C=>typeof C=="string"?C:C.url).join(", ")} because x-fern-server-name was not provided.`),i){let C=!0;for(let[O,D]of Object.entries(r))if(e.builder.addEnvironment({name:O,schema:D}),C){if(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(O),mD(D)){let R=Object.keys(D.urls)[0];R&&e.builder.setDefaultUrl(R)}C=!1}return}if(!A&&!y){let C=!0;for(let[O,D]of Object.entries(r))if(C){if(E){let R=typeof D=="string"?D:mD(D)?Object.values(D.urls)[0]:D["default-url"]??D.url;R!=null&&e.setUrlId(R,ME),e.builder.addEnvironment({name:O,schema:{urls:{[ME]:R??"",..._0e(d)}}})}else e.builder.addEnvironment({name:O,schema:D});e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(O),C=!1}else if(E){let R=typeof D=="string"?D:mD(D)?Object.values(D.urls)[0]:D["default-url"]??D.url;R!=null&&e.setUrlId(R,ME),e.builder.addEnvironment({name:O,schema:{urls:{[ME]:R??"",..._0e(d)}}})}else e.builder.addEnvironment({name:O,schema:D});E&&e.builder.setDefaultUrl(ME)}else if(m===1){let C=Object.keys(r)[0],O=Object.values(r)[0],D=typeof O=="string"?O:mD(O)?Object.values(O.urls)[0]:O["default-url"]??O.url,R={},P={},M={};typeof O!="string"&&!mD(O)&&(O["url-template"]&&(R[ME]=O["url-template"]),O["default-url"]&&(P[ME]=O["default-url"]),O.variables&&O.variables.length>0&&(M[ME]=O.variables)),Object.assign(R,u),Object.assign(P,l),Object.assign(M,p);let J=Object.keys(R).length>0||Object.keys(M).length>0;D!=null&&e.setUrlId(D,ME);let X={urls:{[ME]:D??"",..._0e(a),..._0e(d)},...J?{"url-templates":R,"default-urls":P,variables:M}:{}};e.builder.addEnvironment({name:C,schema:X}),e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(C),e.builder.setDefaultUrl(ME)}else{let C=new Map;for(let P of e.ir.endpoints)for(let M of P.servers)if(M.url!=null&&M.name!=null){C.has(M.name)||C.set(M.name,new Map);let J=M.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",X=C.get(M.name);X&&X.set(J,M.url)}let O=new Set(C.keys()),D=new Set(Object.keys(r)),R=O.size>0&&[...O].every(P=>D.has(P));if(e.options.multiServerStrategy==="urls-per-environment"&&C.size>0&&R){let P=Object.entries(r),M=P[0];if(M){let[J,X]=M,$=typeof X=="string"?X:mD(X)?Object.values(X.urls)[0]:X["default-url"]??X.url,ie={};$!=null&&(ie[ME]=$,e.setUrlId($,ME));for(let ue=1;ue<P.length;ue++){let oe=P[ue];if(oe==null)continue;let[de,we]=oe,De=typeof we=="string"?we:mD(we)?Object.values(we.urls)[0]:we["default-url"]??we.url;De!=null&&(ie[de]=De,e.setUrlId(De,de))}E&&qVf(ie,_0e(d),e),e.builder.addEnvironment({name:J,schema:{urls:ie}}),e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(J),e.builder.setDefaultUrl(ME)}}else if(C.size>0){let P=!0;for(let[M,J]of Object.entries(r)){let X=typeof J=="string"?J:mD(J)?Object.values(J.urls)[0]:J["default-url"]??J.url;if(!X)continue;e.setUrlId(X,ME);let $=X.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",ie={[ME]:X};for(let[ue,oe]of C.entries()){let de=oe.get($)||oe.get("production")||oe.values().next().value;de&&(ie[ue]=de)}E&&Object.assign(ie,_0e(d)),Object.keys(ie).length>1?e.builder.addEnvironment({name:M,schema:{urls:ie}}):e.builder.addEnvironment({name:M,schema:X}),P&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(M),P=!1)}C.size>0&&e.builder.setDefaultUrl(ME)}else{let P=!0;for(let[M,J]of Object.entries(r)){if(E||Object.keys(a).length>0){let X=typeof J=="string"?J:mD(J)?Object.values(J.urls)[0]:J["default-url"]??J.url;X!=null&&e.setUrlId(X,ME),e.builder.addEnvironment({name:M,schema:{urls:{[ME]:X??"",..._0e(a),..._0e(d)}}})}else e.builder.addEnvironment({name:M,schema:J});P&&(e.options.inferDefaultEnvironment!==!1&&e.builder.setDefaultEnvironment(M),P=!1)}}}}var ME,vgc,Cgc=h(()=>{"use strict";lo();Alo();ME="Base",vgc="Default"});function wgc(e){if(e.globalHeaderOverrides!=null){for(let[r,n]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:n});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let o=n.optional===!0?"optional<string>":"string",s=o;if(n.name==null&&n.env==null&&n.clientDefault==null&&typeof n.schema=="string")s=n.schema;else if(n!=null){let a=n.schema?_le(n.schema):void 0,c=a!=null?qle(a):void 0,u=Us.of("api.yml");s={name:n.name,env:n.env,type:n.schema!=null?rf(Oc({schema:n.schema,context:e,fileContainingReference:c?NI(Us.of(ti(c)),u):u,namespace:c,declarationDepth:0}))??o:o},(typeof n.clientDefault=="string"||typeof n.clientDefault=="boolean")&&(s["client-default"]=n.clientDefault)}e.builder.addGlobalHeader({name:r,schema:s})}if(e.options.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let o of i.headers){if(HVf.has(o.name.toLowerCase()))continue;let s=r[o.name];if(s==null){let a=t[o.name],c=uZ({header:{...o,schema:a?.schema??o.schema,name:a?.name??o.name},fileContainingReference:Us.of(zI),context:e,namespace:void 0});s=new blo(c),r[o.name]=s}s.increment()}let n=e.ir.endpoints.length*WVf;for(let[i,o]of Object.entries(r)){let s=t[i],a=o.count===e.ir.endpoints.length,c=o.count>=n;s==null&&(a?e.builder.addGlobalHeader({name:i,schema:o.schema}):c&&e.builder.addGlobalHeader({name:i,schema:QQe(o.schema)}))}}}var blo,WVf,HVf,Sgc=h(()=>{"use strict";aa();Ey();Vi();jZe();cZ();vjt();MQe();_6();lDr();blo=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},WVf=.75,HVf=new Set(["authorization"])});function Tgc(e){let t=e.ir.globalParameters;if(!(t==null||t.length===0))for(let r of t){let n=KVf(r);e.builder.addGlobalParameter({name:r.name,schema:n})}}function KVf(e){let t={};return e.in!=null&&(t.in=e.in),e.target!=null&&(t.target=e.target),e.type!=null&&(t.type=e.type),e.env!=null&&(t.env=e.env),e.default!=null&&(t.default=e.default),e.optional!=null&&(t.optional=e.optional),e.apply!=null&&(t.apply=e.apply),e.parameterName!=null&&(t["parameter-name"]=e.parameterName),e.docs!=null&&(t.docs=e.docs),t}var Ogc=h(()=>{"use strict"});function Pgc(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?_le(t.schema):void 0,n=r!=null?qle(r):void 0,i=uZ({header:{...t,schema:t.schema??Aa.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:Ku.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0})}),name:t.name??t.header,parameterNameOverride:void 0,description:void 0,availability:void 0,source:void 0,clientDefault:void 0},fileContainingReference:Us.of(zI),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:QQe(i)})}}var Bgc=h(()=>{"use strict";aa();Ac();Ey();jZe();vjt();MQe();lDr()});function ED(e){switch(e.type){case"primitive":return Rgc(e.value);case"object":return kgc(e.properties);case"array":return Fgc(e.value);case"map":return YVf(e.value);case"oneOf":return XVf(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return ZVf(e.value);case"unknown":return ED(e.value);case"null":return null;default:Ee(e)}}function Dgc(e){switch(e.type){case"withStreaming":return e.sse?{stream:JVf(e.events)}:{stream:Fgc(e.events)};case"withoutStreaming":return{body:ED(e.value)};default:Ee(e)}}function Rgc(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:Ee(e)}}function kgc(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,ED(r)]))}function JVf(e){return e.map(t=>({event:"",data:ED(t)}))}function Fgc(e){return e.map(t=>ED(t))}function YVf(e){return Object.fromEntries(e.map(t=>[Rgc(t.key),ED(t.value)]))}function XVf(e){return e.type==="discriminated"?kgc(e.value):ED(e.value)}function ZVf(e){switch(e.type){case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"boolean":return e.value;default:Ee(e)}}var IDr=h(()=>{"use strict";wt()});function Ngc({endpointExample:e,context:t,pathParameterRenames:r}){let n={};if(e.type!=="full")return e.value;e.name!=null&&(n.name=e.name),e.description!=null&&(n.docs=e.description);let i={};if(t.ir.basePathParameters!=null)for(let u of t.ir.basePathParameters){let l=u.clientDefault??u.name;(typeof l=="string"||typeof l=="number"||typeof l=="boolean")&&(i[u.name]=l)}e.pathParameters!=null&&e.pathParameters.length>0&&Object.assign(i,$Vf(e.pathParameters,r)),Object.keys(i).length>0&&(n["path-parameters"]=i),e.queryParameters!=null&&e.queryParameters.length>0&&(n["query-parameters"]=eUf(e.queryParameters));let o=e.headers!=null&&e.headers.length>0,s=t.builder.getGlobalHeaders(),a=Object.keys(s).length>0,c=new Set(e.headers?.map(u=>u.name)??[]);if(o||a){let u=[];if(e.headers!=null)for(let l of e.headers)l.name!==t.builder.getAuthHeaderName()&&u.push(l);for(let[l,p]of Object.entries(s)){if(p!=null&&typeof p=="object"&&p.type!=null){let f=_v({type:p.type,_default:void 0,validation:void 0,visitor:{primitive:At,map:At,list:At,optional:m=>m,nullable:m=>m,set:At,named:At,literal:m=>{if(m.type==="string")return m.string;if(m.type==="boolean")return m.boolean.toString()},unknown:At}});if(f!=null){let m=u.findIndex(A=>A.name===l),g={name:l,value:hc.literal(T0e.string(f))};m>=0?u[m]=g:u.push(g);continue}}if(c.has(l))continue;let d=p!=null&&typeof p=="object"?p.type:typeof p=="string"?p:void 0;u.push({name:l,value:hc.primitive(tUf(jgc(d),l))})}n.headers=rUf({context:t,namedFullExamples:u})}return e.request!=null&&(n.request=ED(e.request)),e.response!=null&&(n.response=Dgc(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(n["code-samples"]=e.codeSamples.map(u=>u.type==="language"?{name:u.name??void 0,docs:u.description??void 0,language:u.language,code:u.code,install:u.install??void 0}:{name:u.name??void 0,docs:u.description??void 0,sdk:u.sdk,code:u.code}).filter(sa)),n}function $Vf(e,t){let r={};return e.forEach(n=>{let i=ED(n.value);if(i!=null){let o=n.parameterNameOverride??t?.[n.name]??n.name;r[o]=i}}),r}function eUf(e){let t={};return e.forEach(r=>{let n=ED(r.value);n!=null&&(t[r.name]=n)}),t}function jgc(e){if(e==null)return;let t=e.match(/^(?:optional|nullable)<(.+)>$/);return t!=null?jgc(t[1]):e}function tUf(e,t){switch(e){case"integer":case"int":return Bo.int(0);case"int64":case"long":return Bo.int64(0);case"uint":return Bo.uint(0);case"uint64":return Bo.uint64(0);case"float":return Bo.float(0);case"double":return Bo.double(0);case"boolean":return Bo.boolean(!0);case"date":return Bo.date("2024-01-01");case"date-time":case"datetime":return Bo.datetime("2024-01-01T00:00:00Z");case"base64":return Bo.base64("SGVsbG8=");default:return Bo.string(t)}}function rUf({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=ED(n.value);i!=null&&(r[n.name]=i)}),r}var Qgc=h(()=>{"use strict";wt();lo();Ac();IDr()});var yP,Ojt=h(()=>{"use strict";(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(yP||(yP={}))});function zgc(e){return E1._visit(e,{get:()=>Fd.HttpMethodSchema.Get,post:()=>Fd.HttpMethodSchema.Post,put:()=>Fd.HttpMethodSchema.Put,patch:()=>Fd.HttpMethodSchema.Patch,delete:()=>Fd.HttpMethodSchema.Delete,head:()=>Fd.HttpMethodSchema.Head,options:()=>{throw new S({message:"OPTIONS is unsupported",code:S.Code.ConfigError})},trace:()=>{throw new S({message:"TRACE is unsupported",code:S.Code.ConfigError})},_other:()=>{throw new S({message:"Unknown http method is unsupported",code:S.Code.ConfigError})}})}var Mgc=h(()=>{"use strict";lo();Ac();Ft()});function Elo(e){return e==="POST"||e==="PUT"||e==="PATCH"}var Lgc=h(()=>{"use strict"});function nUf({endpoint:e,context:t,namespace:r}){let n=new Set;for(let o of e.queryParameters)n.add(o.name);for(let o of e.headers)n.add(o.parameterNameOverride??o.name);let i=e.request;if(i==null)return n;switch(i.type){case"multipart":for(let o of i.properties)n.add(o.key);break;case"json":case"formUrlEncoded":{let o=i.schema.type==="reference"?i.schema.schema:void 0,s=i.schema.type==="reference"?t.getSchema(i.schema.schema,r):i.schema;if(s?.type!=="object"||o!=null&&t.isResponseReachable(o)){n.add("body");break}for(let a of s.properties)n.add(a.nameOverride??a.key);for(let a of s.allOf){let{properties:c}=NZe(t,a.schema,r);for(let u of c)n.add(u.nameOverride??u.key)}break}case"octetStream":break;default:Ee(i)}return n}function iUf({pathParameterName:e,reservedNames:t,pathParameters:r}){let n=new Set;for(let s of r){let a=s.parameterNameOverride??s.name;a!==e&&n.add(a)}let i=`${e}${Vgc}`,o=2;for(;t.has(i)||n.has(i);)i=`${e}${Vgc}${o}`,o++;return i}function _gc({endpoint:e,declarationFile:t,context:r}){let n=[],i=new Set,o=e.path,s=EDr(e.sdkName,e.namespace),a=nUf({endpoint:e,context:r,namespace:s}),c={},u={};for(let y of e.pathParameters){let E=y.parameterNameOverride;E==null&&a.has(y.name)&&(E=iUf({pathParameterName:y.name,reservedNames:a,pathParameters:e.pathParameters}),c[y.name]=E),E&&(o=o.replace(`{${y.name}}`,`{${E}}`)),u[E??y.name]=gDr({pathParameter:y,context:r,fileContainingReference:t,namespace:s})}let l={};for(let y of e.queryParameters){let E=yDr({queryParameter:y,context:r,fileContainingReference:t,namespace:s});E!=null&&(l[y.name]=E,i.add(y.name))}let p;if(e.pagination!=null)switch(e.pagination.type){case"cursor":p={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":p={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":p={type:"custom",results:e.pagination.results};break;case"uri":p={next_uri:e.pagination.nextUri,results:e.pagination.results};break;case"path":p={next_path:e.pagination.nextPath,results:e.pagination.results};break;default:Ee(e.pagination)}let d={path:o,method:zgc(e.method),auth:oUf({endpoint:e,context:r}),docs:e.description??void 0,pagination:p,source:e.source!=null?Gle(e.source):void 0};!uUf({context:r,request:e.request})&&Object.keys(u).length>0&&(d["path-parameters"]=u),e.summary!=null&&(d["display-name"]=e.summary),e.subtitle!=null&&(d.subtitle=e.subtitle);let f={},m=r.builder.getGlobalHeaderNames(),g=r.builder.getAuthHeaderName();g!=null&&m.add(g);let A=e.headers.filter(y=>!m.has(y.name));for(let y of A){let E=uZ({header:y,context:r,fileContainingReference:t,namespace:s});f[y.name]=E,i.add(typeof E=="string"?y.name:E.name??y.name)}if(e.request!=null){r.setInState(yP.Request);let y=cUf({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.options.inlinePathParameters&&Object.keys(u).length>0?u:void 0,queryParameters:Object.keys(l).length>0?l:void 0,headers:Object.keys(f).length>0?f:void 0,usedNames:i,namespace:s});d.request=y.value,n=[...n,...y.schemaIdsToExclude??[]],r.unsetInState(yP.Request)}else{let y=r.options.inlinePathParameters&&Object.keys(u).length>0,E=Object.keys(l).length>0,x=Object.keys(f).length>0,v={};(y||E||x)&&(v.name=e.requestNameOverride??e.generatedRequestName),y&&(v["path-parameters"]=u),E&&(v["query-parameters"]=l),x&&(v.headers=f),Object.keys(v).length>0&&(d.request=v)}if(e.response!=null&&e.response._visit({json:y=>{let E=Oc({schema:y.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0,variant:r.options.respectReadonlySchemas&&r.options.useReadVariantForResponses?"read":void 0});d.response={docs:y.description??void 0,type:rf(E)},y.statusCode!=null&&(d.response["status-code"]=y.statusCode),y.responseProperty!=null&&(d.response.property=y.responseProperty)},streamingJson:y=>{let E=Oc({schema:y.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0,variant:r.options.respectReadonlySchemas&&r.options.useReadVariantForResponses?"read":void 0});d["response-stream"]={docs:y.description??void 0,type:rf(E),format:"json",terminator:y.terminator??void 0}},streamingSse:y=>{let E=Oc({schema:y.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0,variant:r.options.respectReadonlySchemas&&r.options.useReadVariantForResponses?"read":void 0});d["response-stream"]={docs:y.description??void 0,type:rf(E),format:"sse",terminator:y.terminator??void 0,resumable:y.resumable??void 0}},file:y=>{d.response={docs:y.description??void 0,type:"file","status-code":y.statusCode}},bytes:y=>{d.response={docs:y.description??void 0,type:"bytes","status-code":y.statusCode}},streamingText:y=>{d["response-stream"]={docs:y.description??void 0,type:"text"}},text:y=>{d.response={docs:y.description??void 0,type:"text","status-code":y.statusCode,"content-type":y.contentType??void 0}},_other:()=>{throw new S({message:"Unrecognized Response type: "+e.response?.type,code:S.Code.InternalError})}}),r.builder.getEnvironmentType()==="multi"){let y=r.getDefaultServerName(),E=e.servers[0];if(E==null)y!=null&&(d.url=y);else{let x=E.url!=null?r.getUrlId(E.url):void 0;d.url=x??E.name??void 0}}return e.idempotent&&(d.idempotent=!0),e.availability!=null&&(d.availability=R0(e.availability)),Object.entries(e.errors).forEach(([y,E])=>{let x=E.generatedName,v=Us.of(qf);r.builder.enableUniqueErrorsPerEndpoint&&(x=`${e.generatedRequestName}${E.generatedName}`,E.schema!=null&&(E.schema.type!=="reference"&&E.schema.type!=="oneOf"?E.schema.generatedName=`${e.generatedRequestName}${E.schema.generatedName}`:E.schema.type==="oneOf"&&(E.schema.value.generatedName=`${e.generatedRequestName}${E.schema.value.generatedName}`)));let C={"status-code":E.isWildcardStatusCode===!0?y:parseInt(y)},O=Agc({endpointNamespace:s,error:E}),D=Zhc({location:qgc,namespaceOverride:O});if(E.schema!=null){let M=Oc({schema:E.schema,context:r,fileContainingReference:D,declarationFile:D,namespace:O,declarationDepth:0});C.type=rf(M),C.docs=E.description}r.builder.addError(D,{name:x,schema:r.isErrorUnknownSchema({statusCode:y,namespace:E.namespace})?{...C,type:"unknown"}:C}),d.errors==null&&(d.errors=[]);let R=r.builder.addImport({file:t,fileToImport:D});d.errors.push(R!=null?`${R}.${x}`:x),C.type!=null&&E.examples?.forEach(M=>{let J={value:ED(M.example),name:M.name,docs:M.description};r.builder.addErrorExample(D,{name:x,example:J})})}),e.examples.length>0&&(d.examples=sUf({endpointExamples:e.examples,context:r,pathParameterRenames:c})),e.retries!=null&&(d.retries=aUf({retries:e.retries})),e.globalParameterIds!=null&&e.globalParameterIds.length>0&&(d["global-parameters"]=e.globalParameterIds),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?d.audiences=[Ilo,...e.audiences]:e.audiences.length>0&&(d.audiences=e.audiences),{value:d,schemaIdsToExclude:n}}function oUf({endpoint:e,context:t}){return e.security==null?t.authOverrides?.auth!=null?!0:t.ir.security==null?void 0:t.ir.security.length>0?!0:void 0:e.security.length===0?!1:JSON.stringify(e.security)===JSON.stringify(t.ir.security)?!0:e.security}function sUf({endpointExamples:e,context:t,pathParameterRenames:r}){return e.map(n=>{try{return Ngc({endpointExample:n,context:t,pathParameterRenames:r})}catch(i){throw console.error(`Error building endpoint example: ${i}`),i}})}function aUf({retries:e}){if(e!=null){if(e.type==="disabled")return{disabled:e.value??void 0};Ee(e)}}function cUf({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:o,pathParameters:s,queryParameters:a,headers:c,usedNames:u,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let p=n.schema.type==="reference"?n.schema.schema:void 0,d=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(d?.type!=="object"||p!=null&&r.isResponseReachable(p)){let R=r.options.respectReadonlySchemas&&Elo(e.method)?"write":void 0,P=Oc({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0,variant:R}),M={body:P},J=Object.keys(s??{}).length>0,X=Object.keys(a??{}).length>0,$=Object.keys(c??{}).length>0;J&&(M["path-parameters"]=s),X&&(M["query-parameters"]=a),$&&(M.headers=c),(J||X||$)&&(M.name=i??o),n.contentType!=null&&(M["content-type"]=n.contentType),n.description!=null&&(M.docs=n.description);let ie=typeof M.body=="string"&&M["path-parameters"]==null&&M["query-parameters"]==null&&M.headers==null&&M.name==null&&M.docs==null&&(M["content-type"]==null||M["content-type"]==="application/json"),ue=Ugc(n);return ue&&(ie&&delete M["content-type"],M.body=typeof P=="string"?{type:P,optional:!0}:{...P,optional:!0}),{schemaIdsToExclude:[],value:ie&&!ue?M.body:M}}let f=new Map;for(let D of d.allOf){let R=r.getSchema(D.schema,l);if(R==null)continue;let P=_le(R),M=Ule(P),{properties:J}=NZe(r,D.schema,l);for(let X of J)f.set(X.key,M)}let m=new Set,g=new Set;for(let D of d.allOfPropertyConflicts)D.allOfSchemaIds.forEach(R=>m.add(R)),D.conflictingTypeSignatures&&g.add(D.propertyKey);let A=Elo(e.method)===!0,y=D=>A&&D.readonly===!0;for(let D of d.properties){if(y(D))continue;let R=Object.entries(D.conflict);if(!R.every(([P,M])=>!M.differentSchema))for(let[P]of R)for(let M of wjt({property:D.key,schemaId:P,context:r,namespace:l}))m.add(M)}let E=(D,R)=>{let P=Oc({schema:D.schema,fileContainingReference:t,declarationFile:R,context:r,namespace:l,declarationDepth:1}),M=D.xml!=null?aDr(D.xml):void 0,J=ue=>M==null?ue:{...typeof ue=="string"?{type:ue}:ue,encoding:M},X=D.nameOverride??D.key,$=R0(D.availability);if(!u.has(X)&&D.audiences.length<=0)return u.add(X),D.nameOverride!=null?J({type:rf(P),docs:kZe(P),name:D.nameOverride,availability:$}):J($?{...typeof P=="string"?{type:P}:P,availability:$}:P);let ie={type:rf(P),docs:kZe(P)};return u.has(X)&&(ie.name=D.generatedName),D.audiences.length>0&&(ie.audiences=D.audiences),$!=null&&(ie.availability=$),u.add(X),J(ie)},x={};for(let D of d.properties)y(D)||(x[D.key]=E(D,f.get(D.key)??t));let v=[];for(let D of d.allOf){let R=hDr({schema:D.schema,context:r,namespace:l});if(R==null||m.has(D.schema)||m.has(R))continue;let P=Oc({schema:Aa.reference(D),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),M=FZe(rf(P));M!=="unknown"&&v.push(M)}for(let D of m){let R=NZe(r,D,l),P=r.getSchema(D,l),M=P!=null?Ule(_le(P)):t;for(let J of R.properties)if(x[J.key]==null&&!y(J)){if(g.has(J.key)){x[J.key]="unknown";continue}x[J.key]=E(J,M)}for(let J of R.allOf){if(m.has(J.schema))continue;let X=Oc({schema:Aa.reference(J),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),$=FZe(rf(X));$!=="unknown"&&!v.includes($)&&v.push($)}}let C={properties:x};v.length>0&&(C.extends=v),n.additionalProperties&&(C["extra-properties"]=!0),Ugc(n)&&(C.optional=!0);let O={name:i??d.nameOverride??d.generatedName,"path-parameters":s,"query-parameters":a,headers:c,body:C};return n.contentType!=null&&(O["content-type"]=n.contentType),n.description!=null&&(O.docs=n.description),{schemaIdsToExclude:p!=null?[p]:[],value:O}}else if(n.type==="octetStream"){let p={body:"bytes","content-type":n.contentType??Qp.APPLICATION_OCTET_STREAM,"query-parameters":a};return a!=null&&(p.name=i??o),n.description!=null&&(p.docs=n.description),{schemaIdsToExclude:[],value:p}}else if(n.type==="multipart"){let p=Object.fromEntries(n.properties.map(d=>{if(d.schema.type==="file"){let f=d.schema.isArray?"list<file>":"file";if(f=d.schema.isOptional?`optional<${f}>`:f,d.description!=null||d.contentType!=null){let m={type:f};if(d.description!=null&&(m.docs=d.description),d.contentType!=null){let g=d.contentType.split(",")[0];m["content-type"]=g}return[d.key,m]}return[d.key,f]}else{let f=Oc({schema:d.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(d.contentType||d.exploded||d.encoding){let m=typeof f=="string"?{type:f}:f;d.contentType!=null&&(m["content-type"]=d.contentType),d.encoding==="form"?m.style="form":d.encoding==="json"?m.style="json":d.exploded&&(m.style="exploded"),f=m}return[d.key,f]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??o,"path-parameters":s,"query-parameters":a,headers:c,body:{properties:p},"content-type":Qp.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else Ee(n)}function Ugc(e){return e.type==="json"&&e.required!==!0}function uUf({context:e,request:t}){if(!e.options.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;case"formUrlEncoded":return!0;default:Ee(t)}}var Vgc,Ggc=h(()=>{"use strict";aa();wt();Ac();Ey();Ft();Qgc();vlo();jZe();dlo();glo();Cjt();cZ();Ojt();NQe();IDr();RZe();cDr();Mgc();mDr();vjt();MQe();_6();Lgc();Vgc="PathParam"});function lUf({location:e,namespaceOverride:t}){return t!=null?{...e,file:NI(Us.of(t),e.file)}:e}function Wgc(e){return e.includes(".")?ti(e):e}function pUf(e){let t=e.namespace,r=e.tags.filter(c=>c!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:Us.of(`${ti(r)}.yml`),endpointId:e.summary!=null?ti(e.summary):ti(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:Us.of(qf),endpointId:ti(e.summary)}:{file:Us.of(qf),endpointId:ti(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:Us.of(qf),endpointId:Wgc(n)};let i=M7(r),o=M7(n);if(b0(i,o))return{file:Us.of("__package__.yml"),endpointId:r};let s=mUf({operationId:n,tag:r,path:e.path,method:e.method});if(s!=null)return s;let a=[];for(let c=0;c<i.length;++c){let u=i[c];if(u!=null&&u===o[c])a.push(u);else{let l=ti(r);return{file:Us.of(`${l}.yml`),endpointId:Wgc(n),tag:r}}}if(a.length>=o.length)throw new S({message:`Cannot get file for endpoint ${JSON.stringify(e)}`,code:S.Code.InternalError});return{file:Us.of(ti(a.join("_"))+".yml"),endpointId:ti(o.slice(a.length).join("_")),tag:r}}function Pjt(e){let t=e.tags[0];if(e.sdkName!=null){let r=elo({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:Us.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return lUf({namespaceOverride:e.namespace,location:pUf(e)})}function mUf({operationId:e,tag:t,path:r,method:n}){let o=`${r.split(fUf).join("_").replaceAll(dUf,"_")}_${n.toLowerCase()}`;if(e.endsWith(o))return{file:Us.of(ti(t)+".yml"),endpointId:ti(e.slice(0,-1*o.length)),tag:t}}var fUf,dUf,xlo=h(()=>{"use strict";aa();wt();Ey();Ft();Vi();RZe();fUf=new RegExp("[^a-zA-Z0-9{}]+"),dUf=new RegExp("[{}]","g")});function Hgc(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let o of r){let{endpointId:s,file:a,tag:c}=Pjt(o),u=a.split(".")[0];u!=null&&t.add(u);let l;if(o.sdkName!=null){let f=e.ir.groups;for(let m of o.sdkName.groupName){let g=typeof m=="string"?m:m.name,A=f[g];if(A==null)break;if(A.summary!=null||A.description!=null){l=f[g];break}}}let p=c==null?void 0:n.tagsById[c];e.setInState(yP.Endpoint),e.setEndpointMethod(o.method);let d=_gc({context:e,endpoint:o,declarationFile:a});e.unsetEndpointMethod(),e.unsetInState(yP.Endpoint),i=[...i,...d.schemaIdsToExclude],e.builder.addEndpoint(a,{name:s,schema:d.value,source:o.source!=null?Gle(o.source):void 0}),(p?.id!=null||p?.description!=null)&&e.builder.setServiceInfo(a,{"display-name":l?.summary??p?.id,docs:l?.description??p?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}var Kgc=h(()=>{"use strict";Ggc();Ojt();mDr();xlo()});function Jgc(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?qle(r.groupName):void 0,i=Oc({schema:Aa.primitive(r),context:e,fileContainingReference:Us.of(qf),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:rf(i),docs:r.description??void 0}})}}var Ygc=h(()=>{"use strict";aa();Ac();Ey();cZ();MQe();_6()});function $gc(e){for(let t of e.ir.webhooks){let r=AUf({webhook:t,context:e});if(r==null)continue;let n=EDr(t.sdkName,t.namespace),i={};for(let s of t.headers)i[s.name]=uZ({header:s,context:e,fileContainingReference:r.file,namespace:n});let o={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:Oc({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),signature:yUf(t.signatureVerification),examples:t.examples!=null?t.examples.map(s=>({docs:s.description,name:s.name,payload:ED(s.payload)})):void 0};t.response!=null&&t.response._visit({json:s=>{let a=Oc({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o.response={docs:s.description??void 0,type:rf(a)},s.statusCode!=null&&(o.response["status-code"]=s.statusCode)},file:s=>{o.response={docs:s.description??void 0,type:"file","status-code":s.statusCode}},bytes:s=>{o.response={docs:s.description??void 0,type:"bytes","status-code":s.statusCode}},text:s=>{o.response={docs:s.description??void 0,type:"text","status-code":s.statusCode,"content-type":s.contentType??void 0}},streamingJson:s=>{let a=Oc({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:rf(a),format:"json"}},streamingSse:s=>{let a=Oc({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:rf(a),format:"sse"}},streamingText:s=>{o["response-stream"]={docs:s.description??void 0,type:"text"}},_other:()=>{throw new S({message:"Unrecognized Response type: "+t.response?.type,code:S.Code.InternalError})}}),e.builder.addWebhook(r.file,{name:r.endpointId,schema:o}),t.description!=null&&(o.docs=t.description)}}function hUf({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:NI(Us.of(t),e.file)}:e}function gUf({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:Us.of(qf),endpointId:n};let i=M7(r),o=M7(n);if(b0(i,o))return{file:Us.of("__package__.yml"),endpointId:r};let s=[];for(let a=0;a<i.length;++a){let c=i[a];if(c!=null&&c===o[a])s.push(c);else{let u=ti(r);return{file:Us.of(`${u}.yml`),endpointId:n,tag:r}}}if(s.length>=o.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:Us.of(ti(s.join("_"))+".yml"),endpointId:ti(o.slice(s.length).join("_")),tag:r}}function AUf({webhook:e,context:t}){return e.sdkName!=null?{file:Xhc({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:hUf({namespaceOverride:e.namespace,location:gUf({webhook:e,context:t})})}function yUf(e){if(e!=null)switch(e.type){case"hmac":return{type:"hmac",header:e.header,algorithm:bUf(e.algorithm),encoding:Clo(e.encoding),"signature-prefix":e.signaturePrefix,"payload-format":Xgc(e.payloadFormat),timestamp:Zgc(e.timestamp),"body-hash-binding":IUf(e.bodyHashBinding),"url-normalization":vUf(e.notificationUrlNormalization)};case"asymmetric":return{type:"asymmetric",header:e.header,"asymmetric-algorithm":EUf(e.asymmetricAlgorithm),encoding:Clo(e.encoding),"signature-prefix":e.signaturePrefix,"jwks-url":e.jwksUrl,"key-id-header":e.keyIdHeader,"payload-format":Xgc(e.payloadFormat),timestamp:Zgc(e.timestamp)};default:return}}function bUf(e){if(e!=null)switch(e){case"sha256":return"sha256";case"sha1":return"sha1";case"sha384":return"sha384";case"sha512":return"sha512";default:return}}function Clo(e){if(e!=null)switch(e){case"base64":return"base64";case"hex":return"hex";default:return}}function EUf(e){switch(e){case"rsa-sha256":return"rsa-sha256";case"rsa-sha384":return"rsa-sha384";case"rsa-sha512":return"rsa-sha512";case"ecdsa-sha256":return"ecdsa-sha256";case"ecdsa-sha384":return"ecdsa-sha384";case"ecdsa-sha512":return"ecdsa-sha512";case"ed25519":return"ed25519";default:return"rsa-sha256"}}function Xgc(e){if(e!=null)return{components:e.components.map(SUf),delimiter:e.delimiter,"body-sort":wUf(e.bodySort)}}function IUf(e){if(e!=null)return{algorithm:xUf(e.algorithm),encoding:e.encoding!=null?Clo(e.encoding):void 0,location:CUf(e.location)}}function vUf(e){if(e!=null)return{"port-variants":e.portVariants,"legacy-query-encoding":e.legacyQueryEncoding}}function xUf(e){switch(e){case"sha256":return"sha256";case"sha1":return"sha1";case"sha384":return"sha384";case"sha512":return"sha512";default:Ee(e)}}function CUf(e){if(e.type==="queryParameter")return{type:"query-parameter",name:e.name};Ee(e.type)}function wUf(e){if(e!=null&&e==="alphabetical")return"alphabetical"}function SUf(e){switch(e){case"body":return"body";case"timestamp":return"timestamp";case"notification-url":return"notification-url";case"message-id":return"message-id";default:return"body"}}function TUf(e){switch(e){case"unix-seconds":return"unix-seconds";case"unix-millis":return"unix-millis";case"iso8601":return"iso8601";default:return}}function Zgc(e){if(e!=null)return{header:e.header,format:e.format!=null?TUf(e.format):void 0,tolerance:e.tolerance}}var eAc=h(()=>{"use strict";aa();wt();Ey();Ft();Vi();jZe();cZ();IDr();RZe();MQe();_6()});function G0e(e,t,r){switch(e.type){case"primitive":case"enum":case"literal":case"unknown":return;case"reference":{let n=e.schema;if(r.has(n))return;r.add(n);let i=tAc(n,e.namespace,t);i!=null&&G0e(i,t,r);return}case"object":for(let n of e.allOf)if(!r.has(n.schema)){r.add(n.schema);let i=tAc(n.schema,n.namespace,t);i!=null&&G0e(i,t,r)}for(let n of e.properties)G0e(n.schema,t,r);return;case"array":case"map":case"optional":case"nullable":G0e(e.value,t,r);return;case"oneOf":OUf(e.value,t,r);return;default:Ee(e)}}function OUf(e,t,r){switch(e.type){case"discriminated":for(let n of Object.values(e.schemas))G0e(n,t,r);for(let n of e.commonProperties)G0e(n.schema,t,r);return;case"undiscriminated":for(let n of e.schemas)G0e(n,t,r);return;default:Ee(e)}}function tAc(e,t,r){return t==null?r.rootSchemas[e]:r.namespacedSchemas[t]?.[e]}function _U(e,t,r){G0e(e,t,r)}function wlo(e){let t=new Set,r=new Set,{groupedSchemas:n}=e;for(let i of e.endpoints){if(i.request!=null)switch(i.request.type){case"json":case"formUrlEncoded":_U(i.request.schema,n,t);break;case"multipart":for(let o of i.request.properties)o.schema.type==="json"&&_U(o.schema.value,n,t);break;case"octetStream":break;default:Ee(i.request)}if(i.response!=null)switch(i.response.type){case"json":case"streamingJson":case"streamingSse":_U(i.response.schema,n,r);break;case"file":case"text":case"bytes":case"streamingText":break;default:Ee(i.response)}for(let o of Object.values(i.errors))o.schema!=null&&_U(o.schema,n,r);for(let o of i.pathParameters)_U(o.schema,n,r);for(let o of i.queryParameters)_U(o.schema,n,r);for(let o of i.headers)_U(o.schema,n,r)}for(let i of e.webhooks)_U(i.payload,n,r);for(let i of Object.values(e.channels)){for(let o of i.messages)_U(o.body,n,r);for(let o of i.handshake.queryParameters)_U(o.schema,n,r);for(let o of i.handshake.headers)_U(o.schema,n,r);for(let o of i.handshake.pathParameters)_U(o.schema,n,r)}return{requestReachable:t,responseReachable:r}}function PUf(e){return e.type!=="object"?!1:e.properties.some(t=>t.readonly===!0)}function Slo(e,t){let r=new Set,n=new Set,i=new Set;function o(s){for(let[a,c]of Object.entries(s)){if(!PUf(c))continue;let u=t.requestReachable.has(a),l=t.responseReachable.has(a);u&&l?r.add(a):u&&!l?n.add(a):!u&&l&&i.add(a)}}o(e.groupedSchemas.rootSchemas);for(let s of Object.values(e.groupedSchemas.namespacedSchemas))o(s);return{needsBothVariants:r,requestOnlyWithReadonly:n,responseOnlyWithReadonly:i}}var rAc=h(()=>{"use strict";wt()});function nAc({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,o]of Object.entries(e)){if(t.has(i))continue;let s=$hc(o);if(n.options.respectReadonlySchemas&&n.needsBothVariants(i)&&o.type==="object"){let u=zQe({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:"read"});n.builder.addType(s,{name:u.name??i,schema:u.schema});let l=zQe({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:l.name??i,schema:l.schema});continue}if(n.options.respectReadonlySchemas&&n.isRequestOnlyWithReadonly(i)&&o.type==="object"){let u=zQe({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:u.name??i,schema:u.schema});continue}let a;n.options.respectReadonlySchemas&&(a=n.isRequestOnly(i)?"write":"read");let c=agc({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:a});if(Vbe(c.schema)){let u=rf(c.schema);if(u===(c.name??i)||u===`optional<${c.name??i}>`||u===`nullable<${c.name??i}>`||u===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(s,{name:c.name??i,schema:c.schema})}}function iAc(e){if(e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),xgc(e),wgc(e),Tgc(e),Pgc(e),pgc(e),Jgc(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.basePathParameters!=null&&e.ir.basePathParameters.length>0){let i={};for(let o of e.ir.basePathParameters){let s={type:"string"};o.description!=null&&(s.docs=o.description),o.clientDefault!=null&&(s["client-default"]=o.clientDefault),i[o.name]=s}e.builder.setRootPathParameters(i)}if(e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(Ilo),e.options.respectReadonlySchemas&&e.options.useReadVariantForResponses){let i=wlo(e.ir),o=Slo(e.ir,i);e.setVariantPlan(o,i)}let t=Hgc(e),r=t.sdkGroups;if(e.options.respectReadonlySchemas&&!e.options.useReadVariantForResponses){let i=wlo(e.ir),o=Slo(e.ir,i);e.setVariantPlan(o,i)}e.setInState(yP.Webhook),$gc(e),e.unsetInState(yP.Webhook),e.setInState(yP.Channel);for(let i of Object.values(e.ir.channels)){let o=Ule(i.groupName);ygc({channel:i,context:e,declarationFile:o})}e.unsetInState(yP.Channel);let n=BUf({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});nAc({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,o]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))nAc({schemas:o,schemaIdsToExclude:n,namespace:i,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(o=>r.has(o))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.optimizeServiceAuth(),e.builder.build()}function BUf({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return new Set(t);let n=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(o=>Object.keys(o))]),i=new Set(t);for(let o of n)r.includes(o)||i.add(o);return i}var Ilo,qgc,vlo=h(()=>{"use strict";aa();lo();Ey();fgc();bgc();Cgc();Sgc();Ogc();Bgc();Kgc();Cjt();Ygc();eAc();rAc();Ojt();RZe();tlo();_6();Ilo="external",qgc=Us.of(qf)});var Bjt,oAc=h(()=>{"use strict";Bjt=class{context;constructor(t){this.context=t}}});var vDr,sAc=h(()=>{"use strict";Ey();Ft();vDr=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[s,a]of Object.entries(n.files)){let c=i!=null?Us.of(`${i}${"/"}${s}`):Us.of(s);t[c]=a}let o=Object.keys(n.directories).sort();for(let s of o){let a=i!=null?`${i}${"/"}${s}`:s,c=n.directories[s];r(c,a)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Us.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new S({message:`Internal error; cannot add file with path: ${t}`,code:S.Code.InternalError});return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}}});function aAc(e){return e?.header!=null}var LQe,cAc=h(()=>{"use strict";aa();lo();Ey();Vi();sAc();LQe=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;rootPathParameters=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new vDr,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":n,"display-name":i,docs:o}){let s=this.getOrCreateFile(t);s.service==null&&(s.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(s.service.auth=r),n!=null&&(s.service["base-path"]=n),i!=null&&(s.service["display-name"]=i),o!=null&&(s.docs=o)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBaseUrlEnv(t){this.rootApiFile["base-url-env"]=t}setBasePath(t){this.basePath=t}setRootPathParameters(t){Object.keys(t).length!==0&&(this.rootPathParameters=t)}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return OX(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let n of Object.values(this.rootApiFile["auth-schemes"]))aAc(n)&&t.push(n.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(aAc(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addGlobalParameter({name:t,schema:r}){this.rootApiFile["global-parameters"]==null&&(this.rootApiFile["global-parameters"]={}),this.rootApiFile["global-parameters"][t]=r}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??ti((tU(r)+"/"+JS(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Us.of(zI))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=_He(tU(UHe.of(`/${t}`)),UHe.of(`/${r}`)),i;let o=this.getOrCreateFile(t);return o.imports==null&&(o.imports={}),o.imports[i]=_He(tU(UHe.of(`/${t}`)),UHe.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===Us.of(zI))return;let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let o=i.types[r];o!=null&&(typeof o=="string"?i.types[r]={type:o,examples:[n]}:(o.examples==null&&(o.examples=[]),o.examples.push(n)))}addError(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:i.errors[r]?.type!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){let i=this.getOrCreateFile(t);if(i.errors==null)return;let o=i.errors[r];if(o==null)return;o.examples==null&&(o.examples=[]),(o.examples.some(a=>b0(a,n))??!1)||o.examples?.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(o.service.source=i),o.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=NI(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}optimizeServiceAuth(){let t=[this.packageMarkerFile,...Object.values(this.root.getAllFiles())];for(let r of t){if(r.service==null)continue;let n=Object.values(r.service.endpoints);if(n.length===0)continue;if(n.every(o=>o.auth===!0)){r.service.auth=!0;for(let o of Object.values(r.service.endpoints))delete o.auth}}}build(){let t=this.root.getAllFiles(),r=this.basePath,n=this.rootPathParameters,i=r!=null&&n==null&&!r.includes("{");if(r!=null&&i){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([s,a])=>[s,{...a,path:NI(r,a.path)}]))});for(let s of Object.values(t))s.service!=null&&(s.service={...s.service,endpoints:Object.fromEntries(Object.entries(s.service.endpoints).map(([a,c])=>[a,{...c,path:NI(r,c.path)}]))})}else r!=null&&(this.rootApiFile["base-path"]=r,n!=null&&(this.rootApiFile["path-parameters"]=n));return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===qf?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}}});var Tlo=h(()=>{"use strict";oAc();cAc()});function uAc({statusCode:e,namespace:t}){return t!=null?`${t}:${e}`:`${e}`}var xDr,lAc=h(()=>{"use strict";wt();Tlo();Ac();bao();Ojt();xDr=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;options;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;schemaNameMapping=new Map;variantPlan;reachability;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:o,authOverrides:s}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=s,this.globalHeaderOverrides=o,this.options=BQe({options:n}),this.enableUniqueErrorsPerEndpoint=this.options.enableUniqueErrorsPerEndpoint,this.referencedSchemaIds=this.options.onlyIncludeReferencedSchemas?new Set:void 0,this.builder=new LQe(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let a={};if(!this.enableUniqueErrorsPerEndpoint)for(let c of r.endpoints)for(let[u,l]of Object.entries(c.errors)){let p=uAc({statusCode:u,namespace:l.namespace}),d=a[p];d==null&&l.schema!=null?a[p]=l.schema:d!=null&&l.schema!=null&&QF(d,l.schema)||this.unknownSchema.add(p)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}setUrlId(t,r){this.urlIdMap.set(t,r)}getUrlId(t){return this.urlIdMap.get(t)}isErrorUnknownSchema({statusCode:t,namespace:r}){return this.unknownSchema.has(uAc({statusCode:t,namespace:r}))}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.options.onlyIncludeReferencedSchemas&&this.isInAnyState(yP.Channel,yP.Endpoint,yP.Webhook)}markSchemaAsReferenced(t,r){switch(t.type){case"primitive":return;case"object":this.markObjectSchemaAsReferenced(t,r);return;case"array":this.markSchemaAsReferenced(t.value,r);return;case"map":this.markSchemaAsReferenced(t.value,r);return;case"optional":this.markSchemaAsReferenced(t.value,r);return;case"reference":this.markSchemaIdAsReferenced(t.schema,r);return;case"oneOf":this.markOneofSchemaAsReferenced(t.value,r);return;case"nullable":this.markSchemaAsReferenced(t.value,r);return;case"enum":return;case"literal":return;case"unknown":return;default:Ee(t)}}markObjectSchemaAsReferenced(t,r){for(let n of t.allOf)this.markSchemaIdAsReferenced(n.schema,r);for(let n of t.properties)this.markSchemaAsReferenced(n.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let n of Object.values(t.schemas))this.markSchemaAsReferenced(n,r);return;case"undiscriminated":for(let n of t.schemas)this.markSchemaAsReferenced(n,r);return;default:Ee(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let n=this.getSchema(t,r);n!=null&&this.markSchemaAsReferenced(n,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}setSchemaFinalName(t,r){this.schemaNameMapping.set(t,r)}hasReadVariant(t){return this.schemaNameMapping.has(t)}setVariantPlan(t,r){this.variantPlan=t,this.reachability=r;let n=[this.ir.groupedSchemas.rootSchemas,...Object.values(this.ir.groupedSchemas.namespacedSchemas)];for(let i of n)for(let[o,s]of Object.entries(i))if(t.needsBothVariants.has(o)&&s.type==="object"){let a=s.nameOverride??s.generatedName;this.schemaNameMapping.set(a,`${a}Read`)}}needsBothVariants(t){return this.variantPlan?.needsBothVariants.has(t)??!1}isRequestOnlyWithReadonly(t){return this.variantPlan?.requestOnlyWithReadonly.has(t)??!1}isResponseReachable(t){return this.reachability==null?this.ir.nonRequestReferencedSchemas.has(t):this.reachability.responseReachable.has(t)}isRequestOnly(t){return this.reachability==null?!this.ir.nonRequestReferencedSchemas.has(t):this.reachability.requestReachable.has(t)&&!this.reachability.responseReachable.has(t)}getSchemaFinalName(t,r){return!this.options.respectReadonlySchemas||r==="write"?t:this.schemaNameMapping.get(t)??t}}});function Olo(e){let t=new xDr(e);return t.options.respectOptionalRequestBody&&t.logger.warn("The `respect-optional-request-body` setting is deprecated and no longer has any effect. A request body that OpenAPI does not mark as required is now always described as omittable in the IR, and each SDK generator opts in to that behaviour through its own configuration."),iAc(t)}var pAc=h(()=>{"use strict";vlo();lAc()});var CDr=h(()=>{"use strict";bao();pAc();xlo()});var DUf,fAc,RUf,kUf,FUf,NUf,Qb,jUf,QUf,Djt,Rjt,zUf,zF,dAc,mAc,hAc,gAc,AAc,yAc,bAc,EAc,IAc,vAc,xAc,CAc,wAc,SAc,TAc,OAc,PAc,Plo,MUf,LUf,BAc,WG0,HG0,KG0,JG0,YG0,XG0,QZe,ZG0,kjt,wDr,$G0,eq0,tq0,rq0,Ir,Wo=h(()=>{"use strict";DUf=Object.create,fAc=Object.defineProperty,RUf=Object.getOwnPropertyDescriptor,kUf=Object.getOwnPropertyNames,FUf=Object.getPrototypeOf,NUf=Object.prototype.hasOwnProperty,Qb=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),jUf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=kUf(t),o=0,s=i.length,a;o<s;o++)a=i[o],!NUf.call(e,a)&&a!==r&&fAc(e,a,{get:(c=>t[c]).bind(null,a),enumerable:!(n=RUf(t,a))||n.enumerable});return e},QUf=(e,t,r)=>(r=e!=null?DUf(FUf(e)):{},jUf(t||!e||!e.__esModule?fAc(r,"default",{value:e,enumerable:!0}):r,e)),Djt=Qb(((e,t)=>{function r(c){return typeof c>"u"||c===null}function n(c){return typeof c=="object"&&c!==null}function i(c){return Array.isArray(c)?c:r(c)?[]:[c]}function o(c,u){if(u){let l=Object.keys(u);for(let p=0,d=l.length;p<d;p+=1){let f=l[p];c[f]=u[f]}}return c}function s(c,u){let l="";for(let p=0;p<u;p+=1)l+=c;return l}function a(c){return c===0&&Number.NEGATIVE_INFINITY===1/c}t.exports.isNothing=r,t.exports.isObject=n,t.exports.toArray=i,t.exports.repeat=s,t.exports.isNegativeZero=a,t.exports.extend=o})),Rjt=Qb(((e,t)=>{function r(i,o){let s="",a=i.reason||"(unknown reason)";return i.mark?(i.mark.name&&(s+='in "'+i.mark.name+'" '),s+="("+(i.mark.line+1)+":"+(i.mark.column+1)+")",!o&&i.mark.snippet&&(s+=`
176
176
 
177
177
  `+i.mark.snippet),a+" "+s):a}function n(i,o){Error.call(this),this.name="YAMLException",this.reason=i,this.mark=o,this.message=r(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n.prototype.toString=function(o){return this.name+": "+r(this,o)},t.exports=n})),zUf=Qb(((e,t)=>{var r=Djt();function n(s,a,c,u,l){let p="",d="",f=Math.floor(l/2)-1;return u-a>f&&(p=" ... ",a=u-f+p.length),c-u>f&&(d=" ...",c=u+f-d.length),{str:p+s.slice(a,c).replace(/\t/g,"\u2192")+d,pos:u-a+p.length}}function i(s,a){return r.repeat(" ",a-s.length)+s}function o(s,a){if(a=Object.create(a||null),!s.buffer)return null;a.maxLength||(a.maxLength=79),typeof a.indent!="number"&&(a.indent=1),typeof a.linesBefore!="number"&&(a.linesBefore=3),typeof a.linesAfter!="number"&&(a.linesAfter=2);let c=/\r?\n|\r|\0/g,u=[0],l=[],p,d=-1;for(;p=c.exec(s.buffer);)l.push(p.index),u.push(p.index+p[0].length),s.position<=p.index&&d<0&&(d=u.length-2);d<0&&(d=u.length-1);let f="",m=Math.min(s.line+a.linesAfter,l.length).toString().length,g=a.maxLength-(a.indent+m+3);for(let y=1;y<=a.linesBefore&&!(d-y<0);y++){let E=n(s.buffer,u[d-y],l[d-y],s.position-(u[d]-u[d-y]),g);f=r.repeat(" ",a.indent)+i((s.line-y+1).toString(),m)+" | "+E.str+`
178
178
  `+f}let A=n(s.buffer,u[d],l[d],s.position,g);f+=r.repeat(" ",a.indent)+i((s.line+1).toString(),m)+" | "+A.str+`
@@ -207,7 +207,7 @@ GFS4: `),console.error(e)});zE[gP]||(Ycc=global[gP]||[],Zcc(zE,Ycc),zE.close=(fu
207
207
  Location: ${i.join("-> ")}`),Wr.unknown({nameOverride:p,generatedName:m,title:g,description:A,availability:y,namespace:a,groupName:f,example:void 0})}}function j_f(e,t,r){if(!t&&r&&e.enum!=null&&e.enum.length===1&&typeof e.enum[0]=="boolean")return e.enum[0]}function Q_f(e){if(e!=null){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase();if(t==="true")return!0;if(t==="false")return!1}}}function UZe(e){if(e.$ref.startsWith(qQe))return e.$ref.replace(qQe,"")}function qlo(e,t,r,n,i){let o=jr(e,mn.TYPE_NAME),s=HA(t,n),a=e.description,c=Hv(e),u=UZe(e);if(u==null)throw new S({message:`Invalid schema reference ${JSON.stringify(e)}`,code:S.Code.ReferenceError});return Aa.reference({generatedName:s,nameOverride:o,title:void 0,schema:u,description:a??void 0,availability:c,namespace:i.getNamespace(u),groupName:void 0,source:r})}function z_f(e){return e.oneOf==null||e.oneOf.length===0}function Ryc(e){return e.allOf==null||e.allOf.length===0}function jDr(e){return e.properties==null||Fh(e.properties)===0}function zDr(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function WU(e,t,r,n){if(e.type==="reference")return Wr.reference({...e,description:t,availability:e.availability,namespace:r,groupName:n});if(e.type==="optional"){let i=WU(e.value,t,r,n);return Wr.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i,description:t,availability:e.availability,namespace:r,groupName:n,inline:void 0})}else if(e.type==="nullable"){let i=WU(e.value,t,r,n);return Wr.nullable({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i,description:t,availability:e.availability,namespace:r,groupName:n,inline:void 0})}else if(e.type==="primitive"&&t!=null&&e.description==null)return Wr.primitive({...e,description:t});return e}function QDr(e){return Gn(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>QDr(t)):e.oneOf!=null?e.oneOf.every(t=>QDr(t)):e.anyOf!=null?e.anyOf.every(t=>QDr(t)):!1}function kyc({literal:e,wrapAsOptional:t,wrapAsNullable:r,namespace:n,groupName:i,description:o,availability:s,nameOverride:a,generatedName:c,title:u}){let l=Wr.literal({nameOverride:a,generatedName:c,title:u,value:e,namespace:n,groupName:i,description:o,availability:s});return r&&(l=Wr.nullable({nameOverride:a,generatedName:c,title:u,value:l,namespace:n,groupName:i,description:o,availability:s,inline:void 0})),t&&(l=Wr.optional({nameOverride:a,generatedName:c,title:u,value:l,namespace:n,groupName:i,description:o,availability:s,inline:void 0})),l}function S1({primitive:e,wrapAsOptional:t,wrapAsNullable:r,namespace:n,groupName:i,description:o,availability:s,generatedName:a,nameOverride:c,title:u}){i=typeof i=="string"?[i]:i;let l=Wr.primitive({nameOverride:c,generatedName:a,title:u,schema:e,description:o,availability:s,namespace:n,groupName:i});return r&&(l=Wr.nullable({nameOverride:c,generatedName:a,title:u,value:l,namespace:n,groupName:i,description:o,availability:s,inline:void 0})),t&&(l=Wr.optional({nameOverride:c,generatedName:a,title:u,value:l,namespace:n,groupName:i,description:o,availability:s,inline:void 0})),l}function M_f({schemas:e}){let t=new Set;for(let r of e){if(Gn(r))return;if(r.enum!=null&&zDr(r.enum))r.enum.forEach(n=>t.add(n));else return}return Array.from(t)}function Fyc({schemas:e,context:t}){let r={};for(let n of e){let i=Qyc({schema:n,context:t});for(let[o,s]of Object.entries(i)){let a=r[o];a!=null?a[s]=n:r[o]={[s]:n}}}for(let[n,i]of Object.entries(r))if(Object.keys(i).length===e.length){let o;for(let[s,a]of Object.entries(i)){let u=(Gn(a)?t.resolveSchemaReference(a):a).properties?.[n];if(u!=null&&!Gn(u)&&(jr(u,mn.FERN_DEFAULT)??u.default)===s){o=s;break}}return{discriminant:n,schemas:i,defaultDiscriminantValue:o}}}function Qyc({schema:e,context:t}){let r=Gn(e)?t.resolveSchemaReference(e):e;return L_f({schema:r,context:t})}function L_f({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let n of e.anyOf){let i=Qyc({schema:n,context:t});for(let[o,s]of Object.entries(i??{}))r[o]=s}return r}for(let[n,i]of Object.entries(e.properties??{})){let o=Gn(i)?t.resolveSchemaReference(i):i;o.type==="string"&&o.enum!=null&&zDr(o.enum)&&V_f(o.enum).length===1&&o.enum[0]!=null&&(r[n]=o.enum[0]);let s=zyc(o,"const");o.type==="string"&&s!=null&&(r[n]=s),n==="type"&&o.example!=null&&(r[n]=o.example)}return r}function V_f(e){if(!e)return[];let t=new Set;return e.forEach(r=>{typeof r=="string"?t.add(r.toLowerCase()):t.add(r)}),Array.from(t)}function zyc(e,t){let r=e[t];if(r!=null)return r}function U_f({schema:e,fallbackXmlName:t,logger:r}){let n=YAc({schema:e,logger:r});if(n!=null)return xyc({encodingSchema:n,fallbackXmlName:t})}var qQe,Nyc,ID=h(()=>{"use strict";wt();Ac();Ft();Vi();fu();VQe();zl();jlo();XAc();$Ac();ODr();ryc();nyc();Ljt();PDr();ayc();LZe();vyc();Cyc();kDr();Syc();Tyc();Oyc();Glo();Zlo();Mlo();$lo();epo();Hlo();Llo();pZ();zb();qQe="#/components/schemas/",Nyc=lZ()});var GZe,tpo=h(()=>{"use strict";Ft();ID();zb();GZe=class{document;taskContext;logger;DUMMY;options;namespace;static MESSAGE_REFERENCE_PREFIX="#/components/messages/";constructor({document:t,taskContext:r,options:n,namespace:i}){this.document=t,this.taskContext=r,this.logger=r.logger,this.DUMMY=this,this.options=n,this.namespace=i}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveTags(t,r){if(this.namespace==null&&t==null&&r!=null)return[r];let n=[];if(this.namespace!=null){let i={type:"namespace",name:this.namespace};n.push(i)}return n.concat(t??[])}resolveSchemaReference(t){if(!t.$ref.startsWith(qQe))throw new S({message:`Failed to resolve schema reference: ${t.$ref}`,code:S.Code.ReferenceError});let n=t.$ref.substring(qQe.length).split("/"),i=this.document.components;if(i==null||i.schemas==null)throw new S({message:"Document does not have components.schemas.",code:S.Code.ReferenceError});let[o,s,a]=n;if(o==null||o==="")throw new S({message:`${t.$ref} cannot be resolved. No schema key provided.`,code:S.Code.ReferenceError});let c=i.schemas[o];if(c==null)throw new S({message:`Schema "${o}" is undefined in document.components.schemas.`,code:S.Code.ReferenceError});if(Gn(c)&&(c=this.resolveSchemaReference(c)),s==="properties"&&a!=null){let u=c.properties?.[a];if(u==null)throw new S({message:`Property "${a}" not found on "${o}". Full ref: ${t.$ref}`,code:S.Code.ReferenceError});Gn(u)?c=this.resolveSchemaReference(u):c=u}return c}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}markReferencedByDiscriminatedUnion(t,r,n){}markSchemaWithDiscriminantValue(t,r,n){}getNamespace(t){return this.namespace}}});var LDr,Myc=h(()=>{"use strict";Ft();tpo();LDr=class extends GZe{getExampleMessageReference(t){return`#/components/messages/${t.messageId}`}resolveMessageReference(t){let r="#/components/messages/",n=this.document.components;if(n==null||n.messages==null||!t.$ref.startsWith(r))throw new S({message:`Failed to resolve message reference: ${t.$ref} in v2 components`,code:S.Code.ReferenceError});let i=t.$ref.substring(r.length),o=n.messages[i];if(o==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return o}}});function qZe(e,t){let r={};if(e!=null)return{rootSchemas:r,namespacedSchemas:{[e]:t}};let n={};for(let[i,o]of Object.entries(t))switch(o.type){case"object":case"array":case"map":case"optional":case"enum":case"literal":case"reference":case"nullable":case"primitive":{if(o.namespace==null){r[i]=o;continue}let s=o.namespace;n[s]??={},n[s][i]=o;continue}case"oneOf":case"unknown":r[i]=o;continue;default:Ee(o)}return{rootSchemas:r,namespacedSchemas:n}}var VDr=h(()=>{"use strict";wt()});function K0e(e){if(typeof e=="string")return hc.primitive(Bo.string(e));if(typeof e=="number")return Number.isInteger(e)?hc.primitive(Bo.int(e)):hc.primitive(Bo.double(e));if(typeof e=="boolean")return hc.primitive(Bo.boolean(e));if(Array.isArray(e)){let t=e.map(r=>K0e(r));return t.length===0?void 0:hc.array(t.filter(r=>r!=null))}else if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string")){let t=[];for(let[r,n]of Object.entries(e)){let i=K0e(n);i!=null&&t.push({key:Bo.string(r),value:i})}return hc.map(t)}}var UDr=h(()=>{"use strict";Ac()});function qjt(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function Lyc(e){if(e!=null&&Array.isArray(e))return e}var Vyc=h(()=>{"use strict"});function Uyc({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}var J0e,_Dr=h(()=>{"use strict";wt();Ac();Ft();UDr();Vyc();J0e=class e{schemas;nonRequestReferencedSchemas;context;constructor(t,r,n){this.schemas=t,this.nonRequestReferencedSchemas=r,this.context=n}buildExample({schema:t,exampleId:r,example:n,options:i,skipReadonly:o}){return this.buildExampleHelper({schema:t,visitedSchemaIds:new Set,exampleId:r,example:n,options:{...i,maxCheckerDepth:i.maxCheckerDepth??5},depth:0,skipReadonly:o??!1})}buildExampleHelper({exampleId:t,example:r,schema:n,depth:i,visitedSchemaIds:o,options:s,skipReadonly:a}){switch(n.type){case"enum":if(typeof r=="string"&&Uyc({schema:n,value:r}))return hc.enum(r);if(r!=null){let c=n.values.map(l=>l.value),u=e.truncateExample(r);this.context.logger.debug(`Example value ${u} is not a valid enum value${s.name!=null?` for '${s.name}'`:""}. Allowed values: [${c.join(", ")}]. Using fallback value instead.`)}return n.values[0]!=null?hc.enum(n.values[0]?.value):void 0;case"literal":return hc.literal(n.value);case"nullable":{if(r===null)return hc.null({});if(r==null&&!this.hasExample(n.value,0,o,s)&&this.exceedsMaxDepth(i,s))return hc.null({});let c=this.buildExampleHelper({schema:n.value,visitedSchemaIds:o,exampleId:t,example:r,depth:i,options:s,skipReadonly:a});return c??hc.null({})}case"optional":{if(r==null&&!this.hasExample(n.value,0,o,s)&&(s.ignoreOptionals||this.exceedsMaxDepth(i,s))||Object.is(r,null))return;let c=this.buildExampleHelper({schema:n.value,visitedSchemaIds:o,exampleId:t,example:r,depth:i,options:s,skipReadonly:a});return c!=null&&c.type==="array"&&c.value.length===0||c!=null&&c.type==="map"&&c.value.length===0||c!=null&&c.type==="object"&&Object.keys(c.properties).length===0?void 0:c}case"primitive":{let c=this.buildExampleFromPrimitive({schema:n.schema,example:r,options:s});return hc.primitive(c)}case"reference":{let c=this.schemas[n.schema];if(c!=null&&!o.has(n.schema)){o.add(n.schema);let u=c?.type==="object"&&!this.nonRequestReferencedSchemas.has(n.schema),l=this.buildExampleHelper({example:r,schema:c,exampleId:t,visitedSchemaIds:o,depth:i,options:s,skipReadonly:u||this.context.options.respectReadonlySchemas?a:!1});return o.delete(n.schema),l}return}case"oneOf":switch(n.value.type){case"discriminated":{let c={},u={},l={},p=qjt(r),d=p?.[n.value.discriminantProperty],f=n.value.schemas[d],m=[],g=this.getDiscriminatedUnionVariantSchema(n.value,p);g!=null&&m.push(g),m.push(...Object.entries(n.value.schemas));for(let A of m)if(d!=null&&f!=null&&f.type==="object"){u=this.getAllProperties(f),l=this.getAllRequiredProperties(f),c[n.value.discriminantProperty]=hc.primitive(Bo.string(d));break}else{let y=this.buildExampleHelper({exampleId:t,schema:A[1],example:void 0,visitedSchemaIds:o,depth:i,options:s,skipReadonly:a});if(y!=null){this.mergeExampleWith(y,c),c[n.value.discriminantProperty]=hc.primitive(Bo.string(A[0]));break}}for(let A of n.value.commonProperties){u[A.key]={schema:A.schema,readonly:!1};let y=this.getResolvedSchema(A.schema);y.type!=="optional"&&y.type!=="nullable"&&(l[A.key]=A.schema)}for(let[A,y]of Object.entries(u)){let E=A in l;if(E&&p?.[A]!=null){let x=this.buildExampleHelper({schema:y.schema,exampleId:t,example:p[A],visitedSchemaIds:o,depth:i+1,options:s,skipReadonly:a});if(x!=null)c[A]=x;else return}else{let x=this.buildExampleHelper({exampleId:t,schema:y.schema,example:p?.[A],visitedSchemaIds:o,depth:i+1,options:s,skipReadonly:a});if(x!=null)c[A]=x;else if(E)return}}return hc.oneOf(S0e.discriminated(c))}case"undiscriminated":{let c=this.getUnDiscriminatedUnionVariantSchema(n.value,r);if(c!=null)return this.buildExampleHelper({exampleId:t,example:r,schema:c,visitedSchemaIds:o,depth:i,options:s,skipReadonly:a});break}}return;case"unknown":if(r===null)return hc.null({});if(r!=null){let c=K0e(r);if(c!=null)return hc.unknown(c)}return s.ignoreOptionals||this.exceedsMaxDepth(i,s)?void 0:s.isParameter?hc.primitive(Bo.string(s.name??"string")):hc.map([{key:Bo.string("key"),value:hc.primitive(Bo.string("value"))}]);case"array":{let c=Lyc(r),u=[];if(c!=null&&c.length>0)for(let l of c){let p=this.buildExampleHelper({exampleId:t,example:l,schema:n.value,depth:i+1,visitedSchemaIds:o,options:s,skipReadonly:a});p!=null&&u.push(p)}else if(n.example!=null&&n.example.length>0)for(let l of n.example){let p=this.buildExampleHelper({exampleId:t,example:l,schema:n.value,depth:i+1,visitedSchemaIds:o,options:s,skipReadonly:a});p!=null&&u.push(p)}else{let l=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,depth:i+1,visitedSchemaIds:o,options:s,skipReadonly:a});l!=null&&u.push(l)}return hc.array(u)}case"map":{let c=qjt(r??n.example);if(c!=null&&Object.entries(c).length>0){let p=[];for(let[d,f]of Object.entries(c)){let m=this.buildExampleFromPrimitive({schema:n.key.schema,example:d,options:s}),g=this.buildExampleHelper({exampleId:t,example:f,schema:n.value,visitedSchemaIds:o,depth:i+1,options:s,skipReadonly:a});g!=null&&p.push({key:m,value:g})}return hc.map(p)}if(n.key.schema.type==="string"&&n.value.type==="unknown")return hc.map([{key:Bo.string("key"),value:hc.unknown(hc.primitive(Bo.string("value")))}]);let u=this.buildExampleFromPrimitive({schema:n.key.schema,example:void 0,options:{...s,name:"key"}}),l=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,visitedSchemaIds:o,depth:i+1,options:{...s,name:"value"},skipReadonly:a});return l!=null&&l.type!=="null"?hc.map([{key:u,value:l}]):hc.map([])}case"object":{let c={},u=n.fullExamples?.find(f=>f.name===t)??n.fullExamples?.find(f=>f.name==null)??n.fullExamples?.[0],l=qjt(r)??(u!=null?qjt(u.value):{})??{},p=this.getAllProperties(n),d=this.getAllRequiredProperties(n);for(let[f,m]of Object.entries(p)){if(a&&m.readonly||m.schema._visit({optional:C=>typeof C.availability=="string"&&C.availability==="Deprecated",primitive:()=>!1,object:()=>!1,array:()=>!1,map:()=>!1,enum:()=>!1,reference:()=>!1,literal:()=>!1,oneOf:()=>!1,nullable:()=>!1,unknown:()=>!1,_other:()=>!1}))continue;let g=f in d,A=Object.keys(l).includes(f),y=l[f],E=this.getSchemaExample(m.schema),x=A?y:E,v=this.buildExampleHelper({schema:m.schema,exampleId:t,example:x,visitedSchemaIds:o,depth:i+1,options:{...s,name:f},skipReadonly:a});if(g&&v!=null)c[f]=v;else{if(g)return;(A&&v!=null||!s.ignoreOptionals&&v!=null)&&(c[f]=v)}}if(n.additionalProperties){for(let[f,m]of Object.entries(l))if(!(f in c)){let g=this.buildExampleHelper({schema:Wr.unknown({example:m,title:void 0,availability:void 0,description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0}),exampleId:t,example:m,visitedSchemaIds:o,depth:i+1,options:{...s,name:f},skipReadonly:a});g!=null&&(c[f]=g)}}return hc.object({properties:c})}default:Ee(n)}}mergeExampleWith(t,r){t._visit({array:At,enum:At,literal:At,map:n=>{for(let i of n){let o=i.key;o.type==="string"&&(r[o.value]=i.value)}},object:n=>{for(let[i,o]of Object.entries(n.properties))r[i]=o},oneOf:n=>{if(n.type==="discriminated")for(let[i,o]of Object.entries(n.value))r[i]=o;else this.mergeExampleWith(n.value,r)},primitive:At,unknown:At,null:At,_other:At})}getObjectSchema(t){if(t.type==="object")return t;if(t.type==="reference"){let r=this.schemas[t.schema];if(r!=null)return this.getObjectSchema(r)}}getDiscriminatedUnionVariantSchema(t,r){let n=r?.[t.discriminantProperty];if(n==null||typeof n!="string")return Object.entries(t.schemas)[0];let i=t.schemas[n];return i==null?Object.entries(t.schemas)[0]:[n,i]}getUnDiscriminatedUnionVariantSchema(t,r){if(r==null){let o=t.schemas.find(a=>this.hasExample(a,0,new Set,{ignoreOptionals:!1,isParameter:!1}));if(o!=null)return o;let s=t.schemas.find(a=>this.hasInherentExample(a));return s??t.schemas[0]}return t.schemas.map(o=>({schema:o,heuristic:this.calcExampleHeuristic(o,r)})).sort((o,s)=>s.heuristic-o.heuristic)[0]?.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return Uyc({schema:t,value:r})?5:0;case"object":{if(!io(r))return 0;let n=this.getAllProperties(t),i=0;for(let[o,s]of Object.entries(n))r[o]!=null?(i++,i+=this.calcExampleHeuristic(s.schema,r[o])):i--;return i}case"array":{if(!Array.isArray(r))return 0;let n=0;for(let i of r)n+=this.calcExampleHeuristic(t.value,i);return n}case"map":{if(!io(r))return 0;let n=0;for(let[,i]of Object.entries(r))n+=this.calcExampleHeuristic(t.value,i);return n}case"nullable":case"optional":return this.calcExampleHeuristic(t.value,r);case"reference":{let n=this.getResolvedSchema(t);return n==null?0:this.calcExampleHeuristic(n,r)}case"oneOf":return Object.values(t.value.schemas).map(i=>this.calcExampleHeuristic(i,r)).sort((i,o)=>o-i)[0]??0;case"primitive":return r==null?0:t.schema._visit({int:()=>typeof r=="number",int64:()=>typeof r=="number",uint:()=>typeof r=="number",uint64:()=>typeof r=="number",float:()=>typeof r=="number",double:()=>typeof r=="number",string:()=>typeof r=="string",datetime:()=>typeof r=="string",datetimeRfc2822:()=>typeof r=="string",date:()=>typeof r=="string",base64:()=>typeof r=="string",boolean:()=>typeof r=="boolean",_other:()=>!0})?1:-1;default:return 0}}hasExample(t,r,n=new Set,i){if(this.exceedsMaxCheckerDepth(r,i))return!1;switch(t.type){case"array":return this.hasExample(t.value,r+1,n,i);case"enum":return t.example!=null;case"literal":return!1;case"map":return t.example!=null||t.key.schema.example!=null&&this.hasExample(t.value,r+1,n,i);case"object":{if(t.fullExamples!=null&&t.fullExamples.length>0)return!0;for(let s of t.properties)if(this.hasExample(s.schema,r+1,n,i))return!0;return!1}case"primitive":return t.schema.example!=null;case"reference":{let o=this.schemas[t.schema];if(o!=null&&!n.has(t.schema)){n.add(t.schema);let s=this.hasExample(o,r,n,i);return n.delete(t.schema),s}return!1}case"unknown":return t.example!=null;case"nullable":case"optional":return this.hasExample(t.value,r,n,i);case"oneOf":return Object.values(t.value.schemas).some(o=>this.hasExample(o,r,n,i));default:return!1}}hasInherentExample(t){switch(t.type){case"literal":return!0;case"enum":return t.values.length>0;case"optional":case"nullable":return this.hasInherentExample(t.value);case"reference":{let r=this.schemas[t.schema];return r!=null?this.hasInherentExample(r):!1}default:return!1}}exceedsMaxCheckerDepth(t,r){return t>(r.maxCheckerDepth??0)}exceedsMaxDepth(t,r){return t>(r.maxDepth??0)}getAllProperties(t){let r={};for(let n of t.properties)r[n.key]={schema:n.schema,readonly:n.readonly??!1};for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let o=this.getResolvedSchema(i);o.type==="object"&&(r={...this.getAllProperties(o),...r})}return r}getAllRequiredProperties(t){let r={};for(let n of t.properties)this.getResolvedSchema(n.schema).type!=="optional"&&(r[n.key]=n.schema);for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let o=this.getResolvedSchema(i);o.type==="object"&&(r={...this.getAllRequiredProperties(o),...r})}return r}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new S({message:`Unexpected error: Failed to resolve schema reference: ${t.schema}`,code:S.Code.InternalError});t=r}return t}getSchemaExample(t){return t._visit({primitive:r=>r.schema.example,object:r=>r.fullExamples?.[0]?.value,array:r=>r.example,map:r=>r.example,optional:r=>this.getSchemaExample(r.value),enum:r=>r.example,reference:r=>{let n=this.schemas[r.schema];return n!=null?this.getSchemaExample(n):void 0},literal:()=>{},oneOf:()=>{},nullable:r=>this.getSchemaExample(r.value),unknown:r=>r.example,_other:()=>{}})}buildExampleFromPrimitive({example:t,schema:r,options:n}){switch(r.type){case"string":return t!=null&&typeof t=="string"?Bo.string(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string",schemaType:r.type,options:n}),Bo.string(r.example??n.name??Fi.STRING));case"base64":return t!=null&&typeof t=="string"?Bo.base64(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string (base64)",schemaType:r.type,options:n}),Bo.base64(r.example??Fi.BASE64));case"boolean":return t!=null&&typeof t=="boolean"?Bo.boolean(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"boolean",schemaType:r.type,options:n}),Bo.boolean(r.example??Fi.BOOLEAN));case"date":return t!=null&&typeof t=="string"?Bo.date(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string (date)",schemaType:r.type,options:n}),Bo.date(r.example??Fi.DATE));case"datetime":return t!=null&&typeof t=="string"?Bo.datetime(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string (datetime)",schemaType:r.type,options:n}),Bo.datetime(r.example??Fi.DATE_TIME));case"datetimeRfc2822":return t!=null&&typeof t=="string"?Bo.datetimeRfc2822(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string (datetime RFC 2822)",schemaType:r.type,options:n}),Bo.datetimeRfc2822(r.example??Fi.DATE_TIME_RFC_2822));case"double":return t!=null&&typeof t=="number"?Bo.double(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (double)",schemaType:r.type,options:n}),Bo.double(r.example??Fi.DOUBLE));case"float":return t!=null&&typeof t=="number"?Bo.float(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (float)",schemaType:r.type,options:n}),Bo.float(r.example??Fi.FLOAT));case"int":return t!=null&&typeof t=="number"?Bo.int(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (int)",schemaType:r.type,options:n}),Bo.int(r.example??Fi.INT));case"int64":return t!=null&&typeof t=="number"?Bo.int64(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (int64)",schemaType:r.type,options:n}),Bo.int64(r.example??Fi.INT64));case"uint":return t!=null&&typeof t=="number"?Bo.uint(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (uint)",schemaType:r.type,options:n}),Bo.uint(r.example??Fi.UINT));case"uint64":return t!=null&&typeof t=="number"?Bo.uint64(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (uint64)",schemaType:r.type,options:n}),Bo.uint64(r.example??Fi.UINT64));default:Ee(r)}}warnTypeMismatch({example:t,expected:r,schemaType:n,options:i}){let o=i.name!=null?` for '${i.name}'`:"",s=typeof t,a=e.truncateExample(t);this.context.logger.debug(`Invalid example${o}: expected ${r} but got ${s} (${a}). The provided example does not match the '${n}' schema and will be replaced with a generated value.`)}static truncateExample(t,r=100){let n=JSON.stringify(t);return n.length<=r?n:n.slice(0,r)+"..."}}});function HU(e){switch(e.type){case"object":return Wr.object({allOf:e.allOf,properties:e.properties.map(t=>G_f(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName,fullExamples:void 0,additionalProperties:e.additionalProperties,availability:e.availability,encoding:e.encoding,source:e.source,inline:void 0,minProperties:e.minProperties,maxProperties:e.maxProperties});case"array":return Wr.array({description:e.description,availability:e.availability,value:HU(e.value),generatedName:e.generatedName,title:e.title,namespace:e.namespace,nameOverride:e.nameOverride,groupName:e.groupName,example:void 0,inline:void 0,minItems:e.minItems,maxItems:e.maxItems,default:e.default});case"enum":return Wr.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,values:e.values,default:e.default,namespace:e.namespace,groupName:e.groupName,example:void 0,source:e.source,inline:void 0});case"literal":return Wr.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName});case"nullable":return Wr.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:HU(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"optional":return Wr.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:HU(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"primitive":return Wr.primitive({description:e.description,availability:e.availability,schema:_yc(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Wr.map({description:e.description,availability:e.availability,key:Wr.primitive({description:e.key.description,availability:e.key.availability,schema:_yc(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,namespace:e.namespace,groupName:e.groupName}),value:HU(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,example:void 0,inline:void 0,minProperties:e.minProperties,maxProperties:e.maxProperties});case"reference":return Wr.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schema:e.schema,namespace:e.namespace,groupName:e.groupName,source:e.source});case"oneOf":return Wr.oneOf(__f(e.value));case"unknown":return Wr.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,example:void 0,namespace:e.namespace,groupName:e.groupName,description:e.description,availability:e.availability});default:Ee(e)}}function __f(e){switch(e.type){case"discriminated":return U6.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:HU(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,discriminantPropertyNameOverride:e.discriminantPropertyNameOverride,discriminatorContext:e.discriminatorContext,defaultDiscriminantValue:e.defaultDiscriminantValue,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,HU(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});case"undiscriminated":return U6.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,commonProperties:e.commonProperties?.map(t=>({key:t.key,schema:HU(t.schema)})),schemas:e.schemas.map(t=>HU(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});default:Ee(e)}}function _yc(e){switch(e.type){case"string":return Ui.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return Ui.base64({example:void 0});case"boolean":return Ui.boolean({default:e.default,example:void 0});case"date":return Ui.date({example:void 0});case"datetime":return Ui.datetime({example:void 0});case"datetimeRfc2822":return Ui.datetimeRfc2822({example:void 0});case"double":return Ui.double({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"float":return Ui.float({example:void 0});case"int":return Ui.int({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"int64":return Ui.int64({default:e.default,example:void 0});case"uint":return Ui.uint({default:void 0,example:void 0});case"uint64":return Ui.uint64({default:void 0,example:void 0});default:Ee(e)}}function G_f(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,xml:e.xml,schema:HU(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}var Gyc=h(()=>{"use strict";wt();Ac()});function GDr(e){return e.type!=="optional"&&e.type!=="nullable"}var rpo=h(()=>{"use strict"});function npo(e){return e==="POST"||e==="PUT"||e==="PATCH"}var qyc=h(()=>{"use strict"});function Wjt(e){if(e.type==="full")return e.request==null&&e.response==null&&e.queryParameters==null&&e.pathParameters==null&&e.headers==null;{let t=e.value;return t.request==null&&t.response==null&&t["query-parameters"]==null&&t["path-parameters"]==null&&t.headers==null}}var ipo=h(()=>{"use strict"});function q_f(e,t){let r=[];if(e.length<=1){let[i,o]=e[0]??[];if(t.length===0)return r.push({id:i,request:o,response:void 0}),r;for(let[s,a]of t)r.push({id:s??i,request:o,response:a});return r}if(t.length<=1){let[i,o]=t[0]??[];if(t.length===0)return r.push({id:i,request:void 0,response:o}),r;for(let[s,a]of e)r.push({id:s??i,request:a,response:o});return r}let n=new Set;for(let[i,o]of e){let s=t.find(([c])=>c==null)?.[1]??t[0]?.[1];if(i==null){if(s==null)continue;r.push({id:void 0,request:o,response:s});continue}let a=!1;for(let c=0;c<t.length;c++){let[u,l]=t[c];u==null||n.has(c)||i===u&&(r.push({id:i,request:o,response:l}),u!=null&&n.add(c),a=!0)}!a&&s!=null&&r.push({id:i,request:o,response:s})}for(let i=0;i<t.length;i++){if(n.has(i))continue;let[o,s]=t[i],a=e.find(([c])=>c==null)?.[1]??e[0]?.[1];a!=null&&r.push({id:o,request:a,response:s})}return r}function W_f(e){if(e!=null)return e.type==="multipart"?{type:"present",schema:K_f(e),examples:[]}:e.type==="json"||e.type==="formUrlEncoded"?{type:"present",schema:e.schema,examples:e.fullExamples??[]}:{type:"unsupported"}}function H_f(e){if(e!=null)return e.type!=="json"&&e.type!=="streamingJson"&&e.type!=="streamingSse"?{type:"unsupported"}:{type:"present",schema:e.schema,examples:e.fullExamples??[]}}function SW(e){switch(e.type){case"primitive":case"enum":case"literal":return!0;case"unknown":return SW(e);case"array":case"object":case"map":return!1;case"oneOf":switch(e.value.type){case"discriminated":return!1;case"undiscriminated":return SW(e.value.value);default:return!1}case"null":return!0;default:Ee(e)}}function K_f(e){return Wr.object({properties:e.properties.map(t=>t.schema.type==="file"?null:{key:t.key,schema:HU(t.schema.value),audiences:[],conflict:{},xml:void 0,generatedName:t.key,nameOverride:void 0,availability:void 0,readonly:void 0,writeonly:void 0,inline:void 0}).filter(sa),allOf:[],allOfPropertyConflicts:[],fullExamples:void 0,description:e.description,nameOverride:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,additionalProperties:!1,availability:void 0,encoding:void 0,source:e.source,inline:void 0,minProperties:void 0,maxProperties:void 0})}var WZe,WQe,qDr,opo=h(()=>{"use strict";wt();Ac();WZe=be(require("fs"),1),WQe=be(require("path"),1);_Dr();Gyc();rpo();qyc();ipo();qDr=class{schemas;context;globalHeaders;exampleTypeFactory;logger;missingExamples=[];constructor(t,r,n){this.schemas=t,this.context=r,this.globalHeaders=n,this.schemas=t,this.exampleTypeFactory=new J0e(t,r.nonRequestReferencedSchemas,r),this.logger=r.logger}addMissingExampleRecord(t,r,n,i,o={}){this.missingExamples.push({endpoint:t.path,method:t.method.toUpperCase(),type:r,schemaType:n,reason:i,operationSummary:t.summary,operationDescription:t.description,schemaDescription:o.schemaDescription,autoGeneratedExample:o.autoGeneratedExample})}writeMissingExamplesLog(){if(this.missingExamples.length===0)return;let t;if(this.context.source.type==="openapi"){let o=this.context.source.file,s=WQe.dirname(o),a=s;for(;a!==WQe.dirname(a);){let c=WQe.join(a,"fern");if(WZe.existsSync(c)&&WZe.statSync(c).isDirectory()){t=c;break}a=WQe.dirname(a)}t||(t=s)}else t=process.cwd();let r=t??process.cwd(),n=WQe.join(r,"schemas_missing_examples.txt"),i=["# Schemas Missing Examples Report",`# Generated on: ${new Date().toISOString()}`,`# Total missing examples: ${this.missingExamples.length}`,"",...this.missingExamples.flatMap(o=>{let s=[];if(s.push(`${o.method} ${o.endpoint} - ${o.type.toUpperCase()} (${o.schemaType}): ${o.reason}`),o.operationSummary&&s.push(` Operation: ${o.operationSummary}`),o.operationDescription&&o.operationDescription!==o.operationSummary&&s.push(` Description: ${o.operationDescription}`),o.schemaDescription&&s.push(` ${o.type==="request"?"Request":"Response"} Schema: ${o.schemaDescription}`),o.autoGeneratedExample){s.push(" Auto-generated example:");let c=JSON.stringify(o.autoGeneratedExample,null,4).split(`
208
208
  `).map(u=>` ${u}`).join(`
209
209
  `);s.push(c)}return s.push(""),s}),""].join(`
210
- `);try{WZe.writeFileSync(n,i,"utf8"),this.logger.info(`Missing examples report written to: ${n}`)}catch(o){this.logger.warn(`Failed to write missing examples report to ${n}:`,String(o))}}finalize(){}convertExampleToJson(t){switch(t.type){case"primitive":return t.value;case"array":return t.value.map(r=>this.convertExampleToJson(r));case"object":{let r={};return Object.entries(t.properties).forEach(([n,i])=>{r[n]=this.convertExampleToJson(i)}),r}case"map":{let r={};return t.value.forEach(n=>{r[String(n.key)]=this.convertExampleToJson(n.value)}),r}case"oneOf":if(t.value.type==="undiscriminated")return this.convertExampleToJson(t.value.value);{let r={};return Object.entries(t.value.value).forEach(([n,i])=>{r[n]=this.convertExampleToJson(i)}),r}case"enum":return t.value;case"literal":return t.value;case"null":return null;case"unknown":return this.convertExampleToJson(t.value);default:return t}}getSchemaDescription(t){if("description"in t)return t.description}getSchemaTypeName(t){switch(t.type){case"primitive":return`primitive (${t.schema.type})`;case"object":return t.generatedName||"object";case"array":return"array";case"map":return"map";case"optional":return`optional (${this.getSchemaTypeName(t.value)})`;case"nullable":return`nullable (${this.getSchemaTypeName(t.value)})`;case"reference":return t.generatedName||"reference";case"enum":return t.generatedName||"enum";case"literal":return"literal";case"oneOf":return"oneOf";case"unknown":return"unknown";default:return"unknown"}}buildEndpointExample(t){let r=W_f(t.request),n=H_f(t.response);if(r?.type==="unsupported"||n?.type==="unsupported")return[];let i=[];if(r!=null&&r.type==="present"){let p=this.isSchemaRequired(r.schema);if(r.examples.length===0){let d=this.exampleTypeFactory.buildExample({skipReadonly:npo(t.method),schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});d!=null?(i.push([void 0,d]),this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),"No user-provided examples found in OpenAPI spec",{schemaDescription:this.getSchemaDescription(r.schema),autoGeneratedExample:this.convertExampleToJson(d)})):this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),"Auto-generation failed (schema too complex or circular references)",{schemaDescription:this.getSchemaDescription(r.schema)})}else for(let{name:d,value:f}of r.examples){let m=this.exampleTypeFactory.buildExample({skipReadonly:npo(t.method),schema:r.schema,exampleId:d,example:f,options:{isParameter:!1,ignoreOptionals:!0}});m!=null?i.push([d,m]):this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),`Failed to build example from provided data (example id: ${d})`,{schemaDescription:this.getSchemaDescription(r.schema)})}if(p&&i.length===0)return this.logger.trace(`Failed to generate required request example for ${t.method.toUpperCase()} ${t.path}`),[]}let o=[];if(n!=null&&n.type==="present"){let p=this.isSchemaRequired(n.schema);if(n.examples.length===0){let d=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:void 0,example:void 0,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});d!=null?(t.response?.type==="json"?o.push([void 0,VU.withoutStreaming(d)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&o.push([void 0,VU.withStreaming({sse:t.response?.type==="streamingSse",events:[d]})]),this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),"No user-provided examples found in OpenAPI spec",{schemaDescription:this.getSchemaDescription(n.schema),autoGeneratedExample:this.convertExampleToJson(d)})):this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),"Auto-generation failed (schema too complex or circular references)",{schemaDescription:this.getSchemaDescription(n.schema)})}else for(let{name:d,value:f}of n.examples){let m=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:d,example:f,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});m!=null?t.response?.type==="json"?o.push([d,VU.withoutStreaming(m)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&o.push([void 0,VU.withStreaming({sse:t.response?.type==="streamingSse",events:[m]})]):this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),`Failed to build example from provided data (example id: ${d})`,{schemaDescription:this.getSchemaDescription(n.schema)})}if(p&&o.length===0)return this.logger.trace(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let s=[];for(let p of t.pathParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!SW(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for path parameter ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&s.push({name:p.name,parameterNameOverride:p.parameterNameOverride,value:f})}let a=[];for(let p of t.queryParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!SW(f)&&f.type!=="array"&&(this.logger.debug(`Expected a primitive or array example but got ${f.type} for query parameter ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&a.push({name:p.name,value:f})}let c=[];for(let p of t.headers){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!SW(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for header ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&c.push({name:p.name,value:f})}for(let p of this.globalHeaders){let d=p.schema!=null?HU(p.schema):Wr.primitive({nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,schema:Ui.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})}),f=this.exampleTypeFactory.buildExample({schema:d,exampleId:void 0,example:void 0,options:{name:p.header,isParameter:!0,ignoreOptionals:!0}});f!=null&&!SW(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for global header ${p.header} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),f!=null&&c.push({name:p.header,value:f})}let u=[];t.request!=null&&t.response!=null?u=q_f(i,o):t.request!=null?u=i.map(([p,d])=>({id:p,request:d,response:void 0})):t.response!=null&&(u=o.map(([p,d])=>({id:p,request:void 0,response:d})));let l=t.examples.filter(p=>Wjt(p)).flatMap(p=>{if(p.type==="unknown"){if(p.value!=null){let d=p.value["code-samples"];if(d!=null)return this.convertCodeSamples(d)}return}else return p.codeSamples}).filter(p=>sa(p));return u.length===0?[LU.full({name:void 0,description:void 0,pathParameters:s,queryParameters:a,headers:c,request:void 0,response:void 0,codeSamples:l})]:u.map(({id:p,request:d,response:f})=>LU.full({name:p,description:void 0,pathParameters:s,queryParameters:a,headers:c,request:d,response:f,codeSamples:l}))}convertCodeSamples(t){return t.map(r=>"language"in r?$X.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):$X.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?I1.Csharp:r.sdk,code:r.code})).filter(sa)}isSchemaRequired(t){return GDr(this.getResolvedSchema(t))}getResolvedSchema(t){return t}}});var HZe,spo=h(()=>{"use strict";Ft();opo();ID();_Dr();zb();rpo();HZe=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new J0e(t,new Set,r),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,handshake:n,source:i,namespace:o}){let s=[];for(let a of r){let c=[];for(let p of n.queryParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:a.queryParameters?.[p.name],options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});f!=null&&!SW(f)&&(f=void 0),!(d&&f==null)&&f!=null&&c.push({name:p.name,value:f})}let u=[];for(let p of n.headers){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:a.headers?.[p.name],options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});f!=null&&!SW(f)&&(f=void 0),!(d&&f==null)&&f!=null&&u.push({name:p.name,value:f})}let l=[];for(let p of a.messages){let d=t.getExampleMessageReference(p),f=t.resolveMessageReference({$ref:d}),m=Gn(f.payload)?t.resolveSchemaReference(f.payload):f.payload,g=this.exampleTypeFactory.buildExample({schema:Qa(m,!1,!1,t,[p.messageId],i,o),exampleId:void 0,example:p.value,options:{isParameter:!1,ignoreOptionals:!0}});g!=null&&l.push({messageType:p.type,payload:g,description:void 0})}s.push({name:a.summary,queryParameters:c,headers:u,description:a.description,messages:l})}return s}buildWebsocketSessionExample({handshake:t,messages:r}){let n={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},i=[];for(let s of t.queryParameters){let a=this.isSchemaRequired(s.schema),c=this.exampleTypeFactory.buildExample({schema:s.schema,exampleId:void 0,example:void 0,options:{name:s.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!SW(c)&&(c=void 0),a&&c==null)return;c!=null&&i.push({name:s.name,value:c})}let o=[];for(let s of t.headers){let a=this.isSchemaRequired(s.schema),c=this.exampleTypeFactory.buildExample({schema:s.schema,exampleId:void 0,example:void 0,options:{name:s.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!SW(c)&&(c=void 0),a&&c==null)return;c!=null&&o.push({name:s.name,value:c})}for(let s of r){let a=this.exampleTypeFactory.buildExample({schema:s.payload,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});a!=null&&n.messages.push({messageType:s.type,payload:a,description:void 0})}return n}isSchemaRequired(t){return GDr(this.getResolvedSchema(t))}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new S({message:`Unexpected error: Failed to resolve schema reference: ${t.schema}`,code:S.Code.InternalError});t=r}return t}}});var Py,WDr=h(()=>{"use strict";Py={FERN_PARAMETER_OPTIONAL:"x-fern-optional",FERN_CHANNEL_ADDRESS:"x-fern-address",FERN_DISPLAY_NAME:"x-fern-display-name",FERN_SDK_GROUP_NAME:"x-fern-sdk-group-name",FERN_SDK_METHOD_NAME:"x-fern-sdk-method-name",FERN_EXAMPLES:"x-fern-examples",BASE_PATH:"x-fern-base-path",FERN_ENUM:"x-fern-enum",IGNORE:"x-fern-ignore",FERN_PARAMETER_NAME:"x-fern-parameter-name",FERN_SERVER_NAME:"x-fern-server-name"}});function HDr(e){return jr(e,Py.FERN_EXAMPLES)??[]}var apo=h(()=>{"use strict";fu();WDr()});function KDr(e,t){return t.includes("://")?t:`${e}://${t}`}function JDr(e){return e.startsWith("/")?e:"/"+e}var cpo=h(()=>{"use strict"});function Kyc({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){let o={},s={};for(let[u,l]of Object.entries(i.components?.schemas??{})){let p=Qa(l,!1,!1,e,[u],r,e.namespace);o[u]=p}let a=new HZe(o,e),c={};for(let[u,l]of Object.entries(i.servers??{})){let p=jr(l,Py.FERN_SERVER_NAME);c[u]={name:p??u,url:KDr(l.protocol,l.url)}}for(let[u,l]of Object.entries(i.channels??{})){let p=jr(l,Py.IGNORE);if(p!=null&&p){e.logger.debug(`Channel ${u} is marked with x-fern-ignore. Skipping.`);continue}let d=[];if(l.parameters!=null)for(let[y,E]of Object.entries(l.parameters??{})){let x=jr(E,Py.FERN_PARAMETER_NAME);d.push({name:y,description:E.description,parameterNameOverride:x,schema:E.schema!=null?Qa(E.schema,!1,!1,e,t,r,e.namespace):Wr.primitive({schema:Ui.string({default:void 0,pattern:void 0,format:void 0,maxLength:void 0,minLength:void 0,example:void 0}),description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}),variableReference:void 0,availability:Hv(E),source:r,explode:void 0,clientDefault:void 0})}let f=[],m=[];if(l.bindings?.ws!=null){if(l.bindings.ws.headers!=null){let y=l.bindings.ws.headers.required??[];for(let[E,x]of Object.entries(l.bindings.ws.headers.properties??{})){if(Gn(x)){let D=e.resolveSchemaReference(x),R=y.includes(E),[P,M]=e.options.coerceOptionalSchemasToNullable?[!1,!R]:[!R,!1];f.push({name:E,schema:G6(x,P,M,e,t,void 0,r,e.namespace),description:D.description,parameterNameOverride:void 0,env:void 0,availability:Hv(D),source:r,clientDefault:void 0});continue}let v=y.includes(E),[C,O]=e.options.coerceOptionalSchemasToNullable?[!1,!v]:[!v,!1];f.push({name:E,schema:Qa(x,C,O,e,[...t,E],r,e.namespace),description:x.description,parameterNameOverride:void 0,env:void 0,availability:Hv(x),source:r,clientDefault:void 0})}}if(l.bindings.ws.query!=null){let y=l.bindings.ws.query.required??[];for(let[E,x]of Object.entries(l.bindings.ws.query.properties??{})){if(Gn(x)){let D=e.resolveSchemaReference(x),R=y.includes(E),[P,M]=e.options.coerceOptionalSchemasToNullable?[!1,!R]:[!R,!1];m.push({name:E,schema:G6(x,P,M,e,t,void 0,r,e.namespace),description:D.description,parameterNameOverride:void 0,availability:Hv(D),source:r,explode:void 0,clientDefault:void 0});continue}let v=y.includes(E),[C,O]=e.options.coerceOptionalSchemasToNullable?[!1,!v]:[!v,!1];m.push({name:E,schema:Qa(x,C,O,e,[...t,E],r,e.namespace),description:x.description,parameterNameOverride:void 0,availability:Hv(x),source:r,explode:void 0,clientDefault:void 0})}}}let g;l.publish!=null&&("oneOf"in l.publish.message?g=Wyc({generatedName:l.publish.operationId??"PublishEvent",event:l.publish,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):g=Hyc({action:"Publish",channelPath:u,message:l.publish.message,context:e,source:r}));let A;if(l.subscribe!=null&&("oneOf"in l.subscribe.message?A=Wyc({generatedName:l.subscribe.operationId??"SubscribeEvent",event:l.subscribe,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):A=Hyc({action:"Subscribe",channelPath:u,message:l.subscribe.message,context:e,source:r})),f.length>0||m.length>0||g!=null||A!=null){let y=HDr(l),E=[];if(y.length>0)E=a.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:y,handshake:{headers:f,queryParameters:m},source:r,namespace:e.namespace});else{let O=[];g!=null&&O.push({type:"publish",payload:g}),A!=null&&O.push({type:"subscribe",payload:A});let D=a.buildWebsocketSessionExample({handshake:{headers:f,queryParameters:m},messages:O});D!=null&&E.push(D)}let x=jr(l,Py.FERN_CHANNEL_ADDRESS),v=x??JDr(u),C=[];g!=null&&C.push({origin:"client",name:"publish",displayName:l.publish!=null?jr(l.publish,Py.FERN_DISPLAY_NAME):void 0,body:ld(g),methodName:l.publish!=null?jr(l.publish,Py.FERN_SDK_METHOD_NAME):void 0}),A!=null&&C.push({origin:"server",name:"subscribe",displayName:l.subscribe!=null?jr(l.subscribe,Py.FERN_DISPLAY_NAME):void 0,body:ld(A),methodName:l.subscribe!=null?jr(l.subscribe,Py.FERN_SDK_METHOD_NAME):void 0}),s[u]={audiences:jr(l,mn.AUDIENCES)??[],handshake:{headers:f.map(O=>({...O,schema:ld(O.schema),env:O.env})),queryParameters:m.map(O=>({...O,schema:ld(O.schema)})),pathParameters:d.map(O=>({...O,schema:ld(O.schema)}))},groupName:e.resolveGroupName([jr(l,Py.FERN_SDK_GROUP_NAME)??u]),messages:C,servers:(l.servers?.map(O=>c[O])??Object.values(c)).filter(O=>O!=null&&O.name!=null).map(O=>({...O,name:O.name})),summary:jr(l,Py.FERN_DISPLAY_NAME),connectMethodName:jr(l,Py.FERN_SDK_METHOD_NAME),path:v,description:l.description,examples:E,source:r}}}return{groupedSchemas:qZe(e.namespace,o),channels:s??void 0,servers:Object.values(c).map(u=>({...u,name:u.name})),basePath:jr(i,Py.BASE_PATH)}}function Wyc({generatedName:e,event:t,context:r,breadcrumbs:n,source:i,options:o,asyncApiOptions:s}){if("oneOf"in t.message&&t.message.oneOf!=null){let a=[],c=[];for(let u of t.message.oneOf){let l,p={type:"notFound"};if(Gn(u)){let d=r.resolveMessageReference(u);!Gn(d.payload)&&s.naming==="v2"?(p=d.name?{type:"name",name:d.name}:p,l={...d.payload,title:d.name??d.payload.title,description:d.name??d.payload.description}):l=d.payload}else l=u;c.push(p),a.push(l)}return H0e({description:t.description??t.message.description,availability:Hv(t.message),subtypes:a,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsOptional:!1,wrapAsNullable:!1,breadcrumbs:n,context:r,encoding:void 0,source:i,namespace:r.namespace,subtypeSuffixOverrides:s.naming==="v2"?c:[]})}}function Hyc({action:e,channelPath:t,message:r,context:n,source:i}){if(r.payload!=null){let o=r.payload;return Gn(r.payload)&&(o=n.resolveSchemaReference(r.payload)),Qa(o,!1,!1,n,[t,e],i,n.namespace)}}var Jyc=h(()=>{"use strict";Ac();fu();zl();LZe();ID();Zlo();VZe();zb();VDr();spo();WDr();apo();cpo()});var YDr,Yyc=h(()=>{"use strict";Ft();tpo();YDr=class extends GZe{getExampleMessageReference(t){let r=t.channelId??this.getDefaultChannelId();if(r==null)throw new S({message:"Cannot resolve example message reference: no channelId provided and no channels found in document",code:S.Code.InternalError});return`#/channels/${r}/messages/${t.messageId}`}getDefaultChannelId(){return Object.keys(this.document.channels??{})[0]}resolveParameterReference(t){let r="#/components/parameters/";if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(r))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let n=t.$ref.substring(r.length),i=this.document.components.parameters[n];if(i==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return"$ref"in i?this.resolveParameterReference(i):i}resolveMessageReference(t,r=!1){let n="#/channels/",i="#/components/messages/";if(t==null)throw new S({message:"Cannot resolve message reference: message is null or undefined",code:S.Code.InternalError});if(!t.$ref)throw new S({message:"Cannot resolve message reference: message.$ref is undefined or empty",code:S.Code.ReferenceError});if(t.$ref.startsWith(n)){let c=t.$ref.split("/"),u=c[2],l=c[4],p=u?.replace(/~1/g,"/").replace(/~0/g,"~");if(p==null||l==null||!this.document.channels?.[p])throw new S({message:`Failed to resolve message reference ${t.$ref} in channel ${p}`,code:S.Code.ReferenceError});let f=this.document.channels[p].messages?.[l];if(f==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return"$ref"in f&&!r?this.resolveMessageReference(f):{...f,name:l}}let o=this.document.components;if(!t.$ref.startsWith(i)||!o?.messages)throw new S({message:`Failed to resolve message reference: ${t.$ref} in v3 components`,code:S.Code.ReferenceError});let s=t.$ref.substring(i.length),a=o.messages[s];if(a==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return{...a,name:s}}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}}});function ebc({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){MDr();let o={},s={},a={},c=[],u={};e.logger.debug("Parsing V3 AsyncAPI...");let l=lZ();for(let[D,R]of Object.entries(i.components?.schemas??{})){let P=l.getUniqueSchemaId(D,e.logger,e.options.resolveSchemaCollisions);o[P]=Qa(R,!1,!1,e,[P],r,e.namespace)}for(let[D,R]of Object.entries(i.channels??{}))if(s[D]||(s[D]={}),R.messages)for(let[P,M]of Object.entries(R.messages))if(a[P]||(a[P]=[]),e.isReferenceObject(M)){let J=e.resolveMessageReference(M);a[P].push({channelId:D,payload:J.payload})}else e.isMessageWithPayload(M)&&a[P].push({channelId:D,payload:M.payload});for(let[D,R]of Object.entries(a))if(R.length===1){let P=R[0],M=P.channelId;s[M]=s[M]||{},s[M][D]=Qa(P.payload,!1,!1,e,[D],r,e.namespace)}else{c.push(D);for(let{channelId:P,payload:M}of R){let J=`${P}_${D}`;s[P]||(s[P]={}),s[P][J]=Qa(M,!1,!1,e,[J],r,e.namespace)}}let p={},d=lZ();for(let[D,R]of Object.entries(s))for(let[P,M]of Object.entries(R)){let J=d.getUniqueSchemaId(P,e.logger,e.options.resolveSchemaCollisions);p[J]=M}let f=new HZe({...o,...p},e),m={};for(let[D,R]of Object.entries(i.servers??{})){let P=jr(R,Py.FERN_SERVER_NAME);m[D]={name:P??D,url:KDr(R.protocol,R.host)}}let g={},A=Object.keys(i.channels??{});for(let[D,R]of Object.entries(i.operations??{})){if(jr(R,Py.IGNORE))continue;let P;if(R.channel==null||!("$ref"in R.channel)||R.channel.$ref==null)if(A.length===1&&A[0]!=null)P=A[0];else continue;else P=Y_f(R);g[P]||(g[P]={subscribe:[],publish:[],__parsedMessages:[]});let M=jr(R,Py.FERN_SDK_METHOD_NAME),J=jr(R,Py.FERN_DISPLAY_NAME);if(!R.messages||!Array.isArray(R.messages))continue;let X=R.messages.filter(ie=>ie!=null&&ie.$ref!=null).map(ie=>({ref:ie,methodName:M,displayName:J})),$=g[P];if($==null)throw new S({message:`Internal error: channelEvents["${P}"] is unexpectedly undefined for operation ${D}`,code:S.Code.InternalError});if(R.action==="receive")$.subscribe.push(...X);else if(R.action==="send")$.publish.push(...X);else throw new S({message:`Operation ${D} has an invalid action: ${R.action}`,code:S.Code.ValidationError})}for(let[D,R]of Object.entries(g)){let P=[];P.push(...$yc({messages:R.subscribe,channelPath:D,origin:"server",messageSchemas:s[D]??{},duplicatedMessageIds:c,context:e})),P.push(...$yc({messages:R.publish,channelPath:D,origin:"client",messageSchemas:s[D]??{},duplicatedMessageIds:c,context:e})),g[D]!=null&&(g[D].__parsedMessages=P)}for(let[D,R]of Object.entries(i.channels??{})){if(jr(R,Py.IGNORE))continue;let P=[],M=[],J=[];if(R.parameters!=null)for(let[X,$]of Object.entries(R.parameters)){let ie=e.isReferenceObject($)?e.resolveParameterReference($):$,{type:ue,parameterKey:oe}=ie.location!=null?X_f(ie.location):{type:R.address?.includes(`={${X}}`)?"query":"path",parameterKey:X},de=jr(ie,Py.FERN_PARAMETER_OPTIONAL),we=_u(ti(D))+_u(ti(X)),De=ie.schema!=null?Gn(ie.schema)?G6(ie.schema,!1,!1,e,[oe],void 0,r,e.namespace):Qa(ie.schema,!1,!1,e,[oe],r,e.namespace):Qa({...ie,type:"string",title:we,example:ie.examples?.[0],default:ie.default,enum:ie.enum,required:void 0},!1,!1,e,[oe],r,e.namespace),se=de?Wr.optional({value:De,description:void 0,availability:void 0,generatedName:"",title:we,namespace:void 0,groupName:void 0,nameOverride:void 0,inline:void 0}):De,ae={name:oe,description:ie.description,parameterNameOverride:void 0,schema:se,variableReference:void 0,availability:Hv($),source:r,explode:void 0,clientDefault:void 0};ue==="header"?P.push({...ae,env:void 0}):ue==="path"?M.push(ae):(ue==="payload"||ue==="query")&&J.push(ae)}if(R.bindings?.ws?.query!=null){let X=new Set(J.map(ie=>ie.name)),$=new Set(R.bindings.ws.query.required??[]);for(let[ie,ue]of Object.entries(R.bindings.ws.query.properties??{})){if(X.has(ie))continue;if(Gn(ue)){let De=e.resolveSchemaReference(ue),se=$.has(ie),[ae,Oe]=e.options.coerceOptionalSchemasToNullable?[!1,!se]:[!se,!1];J.push({name:ie,schema:G6(ue,ae,Oe,e,[D,ie],void 0,r,e.namespace),description:De.description,parameterNameOverride:void 0,availability:Hv(De),source:r,explode:void 0,clientDefault:void 0});continue}let oe=$.has(ie),[de,we]=e.options.coerceOptionalSchemasToNullable?[!1,!oe]:[!oe,!1];J.push({name:ie,schema:Qa(ue,de,we,e,[D,ie],r,e.namespace),description:ue.description,parameterNameOverride:void 0,availability:Hv(ue),source:r,explode:void 0,clientDefault:void 0})}}if(R.bindings?.ws?.headers!=null){let X=new Set(P.map(ie=>ie.name)),$=new Set(R.bindings.ws.headers.required??[]);for(let[ie,ue]of Object.entries(R.bindings.ws.headers.properties??{})){if(X.has(ie))continue;if(Gn(ue)){let De=e.resolveSchemaReference(ue),se=$.has(ie),[ae,Oe]=e.options.coerceOptionalSchemasToNullable?[!1,!se]:[!se,!1];P.push({name:ie,schema:G6(ue,ae,Oe,e,[D,ie],void 0,r,e.namespace),description:De.description,parameterNameOverride:void 0,env:void 0,availability:Hv(De),source:r,clientDefault:void 0});continue}let oe=$.has(ie),[de,we]=e.options.coerceOptionalSchemasToNullable?[!1,!oe]:[!oe,!1];P.push({name:ie,schema:Qa(ue,de,we,e,[D,ie],r,e.namespace),description:ue.description,parameterNameOverride:void 0,env:void 0,availability:Hv(ue),source:r,clientDefault:void 0})}}if(P.length>0||J.length>0||g[D]!=null&&(g[D].publish!=null||g[D].subscribe!=null)){let X=HDr(R),$=g[D]?.__parsedMessages??[],ie=[];try{if(X.length>0)ie=f.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:X,handshake:{headers:P,queryParameters:J},source:r,namespace:e.namespace});else{let De=[],{examplePublishMessage:se,exampleSubscribeMessage:ae}=$_f({messages:$,messageSchemas:s[D]??{}});se!=null&&De.push(se),ae!=null&&De.push(ae);let Oe=f.buildWebsocketSessionExample({handshake:{headers:P,queryParameters:J},messages:De});Oe!=null&&ie.push(Oe)}}catch(De){e.logger.warn(`Failed to build examples for channel ${D}: ${Fn(De)}`)}let ue=jr(R,Py.FERN_SDK_GROUP_NAME),oe=jr(R,Py.FERN_SDK_METHOD_NAME),de=(R.servers?.map(De=>Z_f(m,De))??Object.values(m)).map(De=>({...De,name:De.name})),we=R.address?.split("?")[0]??JDr(D);u[D]={audiences:jr(R,mn.AUDIENCES)??[],handshake:{headers:P.map(De=>({...De,schema:ld(De.schema),env:De.env})),queryParameters:J.map(De=>({...De,schema:ld(De.schema)})),pathParameters:M.map(De=>({...De,parameterNameOverride:void 0,schema:ld(De.schema)}))},groupName:e.resolveGroupName(typeof ue=="string"?[ue]:ue??[D]),messages:$,summary:jr(R,Py.FERN_DISPLAY_NAME),connectMethodName:oe,servers:de,path:we,description:R.description,examples:ie,source:r}}else e.logger.warn(`Skipping AsyncAPI channel ${D} as it does not qualify for inclusion (no headers, query params, or operations)`)}let y={...o,...p},E={},x=lZ();for(let[D,R]of Object.entries(y)){let P=x.getUniqueSchemaId(D,e.logger,e.options.resolveSchemaCollisions);E[P]=ld(R)}let v=qZe(e.namespace,o),C=Object.values(m).map(D=>({...D,name:D.name})),O=jr(i,Py.BASE_PATH);return{groupedSchemas:v,channels:u,servers:C,basePath:O}}function J_f(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Y_f(e){if(!e.channel)throw new S({message:"Operation is missing required 'channel' field",code:S.Code.ValidationError});if(!e.channel.$ref)throw new S({message:"Operation channel is missing required '$ref' field",code:S.Code.ValidationError});if(!e.channel.$ref.startsWith(Xyc))throw new S({message:`Failed to resolve channel path from operation ${e.channel.$ref}`,code:S.Code.ReferenceError});return J_f(e.channel.$ref.substring(Xyc.length))}function X_f(e){let t="https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression",[r,n]=e.split("#/");if(r==null||n==null)throw new S({message:`Invalid location format: ${e}; unable to parse message type and parameter key. See ${t} for the expected format.`,code:S.Code.ValidationError});if(!r.startsWith(upo))throw new S({message:`Invalid location format: ${e}; expected ${upo} prefix`,code:S.Code.ValidationError});let i=r.substring(upo.length);if(i!=="header"&&i!=="path"&&i!=="payload")throw new S({message:`Invalid message type: ${i}. Must be one of: header, path, payload`,code:S.Code.ValidationError});return{type:i,parameterKey:n}}function Z_f(e,t){if(!t.$ref.startsWith(Zyc))throw new S({message:`Failed to resolve server name from server ref ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(Zyc.length),n=e[r];if(n==null)throw new S({message:`Failed to find server with name ${r}`,code:S.Code.ReferenceError});return n}function $yc({messages:e,channelPath:t,origin:r,messageSchemas:n,duplicatedMessageIds:i,context:o}){let s=[];return e.forEach((a,c)=>{try{let l=o.resolveMessageReference(a.ref,!0).name;i.includes(l)&&(l=`${t}_${l}`);let p=n[l];p!=null&&s.push({origin:r,name:l??`${r}Message${c+1}`,displayName:a.displayName,body:ld(p),methodName:a.methodName})}catch(u){o.logger.warn(`Skipping message reference ${a.ref.$ref} in channel ${t}: ${Fn(u)}`)}}),s}function $_f({messages:e,messageSchemas:t}){let r=e.find(s=>s.origin==="client")?.name,n=e.find(s=>s.origin==="server")?.name,i=r!=null?t[r]:void 0,o=n!=null?t[n]:void 0;return{examplePublishMessage:i!=null&&r!=null?{type:r,payload:i}:void 0,exampleSubscribeMessage:o!=null&&n!=null?{type:n,payload:o}:void 0}}var Xyc,Zyc,upo,tbc=h(()=>{"use strict";wt();Ac();Ft();Vi();fu();TW();LZe();ID();VZe();zb();VDr();Ljt();spo();WDr();apo();cpo();Xyc="#/channels/",Zyc="#/servers/",upo="$message."});function rbc({document:e,taskContext:t,options:r,source:n,asyncApiOptions:i,namespace:o}){let s=[];if(o!=null&&s.push(o),parseFloat(e.asyncapi)<3){let a=e;a.tags?.[0]!=null?s.push(a.tags[0].name):i.naming!=="v2"&&s.push("websocket");let c=new LDr({document:a,taskContext:t,options:r,namespace:o});return Kyc({context:c,breadcrumbs:s,source:n,asyncApiOptions:i,document:a})}else{let a=e,c=new YDr({document:a,taskContext:t,options:r,namespace:o});return ebc({context:c,breadcrumbs:s,source:n,asyncApiOptions:i,document:a})}}var nbc=h(()=>{"use strict";Myc();Jyc();Yyc();tbc()});function XDr(e){if(e!=null)return e.map(t=>Object.fromEntries(Object.entries(t).map(([r,n])=>[r,n??[]])))}var lpo=h(()=>{"use strict"});function ibc(e){return jr(e,mn.ASYNC_CONFIG)}var obc=h(()=>{"use strict";fu();zl()});function abc(e,t){let r=jr(t,mn.STREAMING);if(r==null)return;if(typeof r=="boolean")return r?{type:"stream",format:"json",terminator:void 0,resumable:!1}:void 0;let n=e5f(e,r);if(r["stream-condition"]==null&&r.format!=null)return{type:"stream",format:r.format,terminator:r.terminator,resumable:n};if(r["stream-condition"]!=null)return{type:"streamCondition",format:r.format??"json",terminator:r.terminator,streamDescription:r["stream-description"],streamConditionProperty:t5f(r["stream-condition"]),streamRequestName:r["stream-request-name"],responseStream:r["response-stream"],response:r.response,resumable:n}}function e5f(e,t){return typeof t.resumable=="boolean"?t.resumable:ppo(e)??!1}function ppo(e){let t=jr(e,mn.STREAMING);if(!(t==null||typeof t=="boolean"))return typeof t.resumable=="boolean"?t.resumable:void 0}function cbc(e){let t=jr(e,mn.STREAMING);if(!(t==null||typeof t=="boolean"))return typeof t.resumable=="boolean"?t.resumable:void 0}function t5f(e){return e.startsWith(sbc)?e.slice(sbc.length):e}var sbc,ubc=h(()=>{"use strict";fu();zl();sbc="$request."});function lbc(e){let t=e;if(t.cursor!=null)return Lw.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});let r=e;if("next_uri"in r)return Lw.uri({nextUri:r.next_uri,results:r.results});let n=e;if("next_path"in n)return Lw.path({nextPath:n.next_path,results:n.results});if("offset"in e){let i=e;return Lw.offset({offset:i.offset,results:i.results,step:i.step,hasNextPage:i["has-next-page"]})}if("type"in e&&e.type==="custom"){let i=e;return Lw.custom({results:i.results})}throw new S({message:"Invalid pagination extension",code:S.Code.ValidationError})}function pbc(e,t){let r=jr(t,mn.PAGINATION);if(r!=null){if(typeof r=="boolean"){let n=jr(e,mn.PAGINATION);if(typeof n=="boolean")throw new S({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",code:S.Code.ValidationError});return n==null?void 0:lbc(n)}return lbc(r)}}var fbc=h(()=>{"use strict";Ac();Ft();fu();zl()});function dbc(e,t){for(let r of Object.keys(e))if(r.includes("text/event-stream")){let n=e[r];if(n==null)continue;let i=n,o=n.schema??i.itemSchema;return{contentType:r,schema:o??{},examples:KZe(n,t)}}}function mbc(e){let t=Object.keys(e);return t.length===1&&t[0]!=null&&t[0].includes("text/event-stream")}function r5f(e){return e.includes("json")||e==="*/*"}function Hjt({content:e,context:t}){for(let[r,n]of Object.entries(e))if(ZDr({mediaType:r,mediaTypeObject:n,context:t})!=null)return[r,n]}function ZDr({mediaType:e,mediaTypeObject:t,context:r}){if(!r5f(e))return;let n=t.schema;return{contentType:e.includes("*")?void 0:e,schema:n??{},examples:KZe(t,r)}}function Kjt({content:e,context:t}){let r=Hjt({content:e,context:t});if(!r)return;let[n,i]=r;return ZDr({mediaType:n,mediaTypeObject:i,context:t})}function hbc(e,t){for(let r of Object.keys(e)){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:KZe(n,t)}}}function KZe(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let n=jr(e,bP.EXAMPLES);return n!=null&&Object.keys(n).length>0&&r.push(...Object.entries(n).map(([i,o])=>({name:o.summary??i,value:o.value,description:o.description}))),e.examples!=null&&Object.keys(e.examples).length>0&&r.push(...Object.entries(e.examples).map(([i,o])=>{let s=Gn(o)?t.resolveExampleReference(o):o;return{name:s.summary??i,value:s.value,description:s.description}})),r}var JZe=h(()=>{"use strict";fu();zb();VQe()});function gbc(e){let t=n5f(e),r={};return fpo({obj:t,occurrences:r,breadcrumbs:[]}),r}function fpo({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let n of e)fpo({obj:n,occurrences:t,breadcrumbs:r});return}if(typeof e=="object"){if(e.$ref!=null&&typeof e.$ref=="string"){let n=e.$ref;t[n]==null?t[n]=1:t[n]+=1;return}for(let n in e)fpo({obj:e[n],occurrences:t,breadcrumbs:[...r,n]})}}}function n5f(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:r?.get!=null?Jjt(r.get):void 0,put:r?.put!=null?Jjt(r.put):void 0,post:r?.post!=null?Jjt(r.post):void 0,patch:r?.patch!=null?Jjt(r.patch):void 0,delete:r?.delete!=null?Jjt(r.delete):void 0}]))}}function Jjt(e){return{...e,requestBody:e.requestBody!=null?Gn(e.requestBody)?e.requestBody:i5f(e.requestBody):void 0}}function i5f(e){let t,r;for(let n in e.content){let i=Qp.parse(n);i!=null&&(i.isJSON()?t=e.content[n]:i.isMultipart()&&(r=e.content[n]))}return r!=null&&t!=null?{...e,content:{[Qp.MULTIPART_FORM_DATA]:r}}:e}var Abc=h(()=>{"use strict";wt();zb()});var $Dr,ybc=h(()=>{"use strict";lo();$Dr=class{endpoints;parser=new ule;constructor({context:t,options:r}){this.endpoints=r.filter?.endpoints?new Set(this.validateAndFilterEndpoints({context:t,endpoints:r.filter.endpoints})):void 0}skipEndpoint({method:t,path:r}){return this.endpoints!=null&&!this.endpoints.has(`${t} ${r}`)}hasEndpoints(){return this.endpoints!=null}validateAndFilterEndpoints({context:t,endpoints:r}){let n=[];for(let i of r){let o=this.parser.tryParse(i);if(o==null){t.logger.debug(`Ignoring configured filter endpoint "${i}"; expected format "POST /users/get"`);continue}n.push(`${o.method} ${o.path}`)}return n}}});var bbc,Ebc,Ibc,vbc,xbc,YZe,dpo=h(()=>{"use strict";Ft();fu();Abc();zb();zl();ybc();bbc="#/components/parameters/",Ebc="#/components/responses/",Ibc="#/components/examples/",vbc="#/components/requestBodies/",xbc="#/components/securitySchemes/",YZe=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;filter;namespace;schemaNamespaceMapping;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=n,this.refOccurrences=gbc(t),this.options=i,this.source=o,this.filter=new $Dr({context:r,options:i}),this.DUMMY=this.getDummy(),this.namespace=s,this.schemaNamespaceMapping=this.buildSchemaNamespaceMapping()}getNumberOfOccurrencesForRef(t){return this.refOccurrences[t.$ref]??0}resolveTagsToTagIds(t){let r=[];return this.namespace!=null&&r.push(this.namespace),r.concat(t??[])}resolveTags(t){let r=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};r.push(n)}return r.concat(t??[])}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveSchemaReference(t){let r=t.$ref.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return{"x-fern-type":"unknown"};if(Array.isArray(n)){let o=parseInt(i,10);if(isNaN(o)||o<0||o>=n.length)return{"x-fern-type":"unknown"};n=n[o]}else n=n[i]}return n==null?(this.logger.debug(`Encountered undefined reference: ${t.$ref}`),{"x-fern-type":"unknown"}):(Gn(n)&&(n=this.resolveSchemaReference(n)),n)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(bbc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(bbc.length),n=this.document.components.parameters[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveParameterReference(n):n}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(vbc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(vbc.length),n=this.document.components.requestBodies[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveRequestBodyReference(n):n}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(Ebc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(Ebc.length),n=this.document.components.responses[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveResponseReference(n):n}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(Ibc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(Ibc.length),n=this.document.components.examples[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveExampleReference(n):n}resolveSecuritySchemeReference(t){if(this.document.components==null||this.document.components.securitySchemes==null||!t.$ref.startsWith(xbc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(xbc.length),n=this.document.components.securitySchemes[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveSecuritySchemeReference(n):n}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}getNamespace(t){return this.schemaNamespaceMapping?.get(t)}buildSchemaNamespaceMapping(){let t=new Map;if(!this.document.components?.schemas)return t;for(let[r,n]of Object.entries(this.document.components.schemas))!n||Gn(n)||t.set(r,jr(n,mn.SDK_NAMESPACE)||this.namespace);return t}}});var HQe,mpo=h(()=>{"use strict";dpo();HQe=class extends YZe{constructor({document:t,taskContext:r,options:n,source:i,namespace:o}){super({document:t,taskContext:r,authHeaders:new Set,options:n,source:i,namespace:o})}getDummy(){return this}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}getReferencedSchemas(){return new Set}markReferencedByDiscriminatedUnion(t,r,n){}getReferencesFromDiscriminatedUnion(t){}excludeSchema(t){}isSchemaExcluded(t){return!1}markSchemaWithDiscriminantValue(t,r,n){}getDiscriminatedUnionMetadata(t){}}});var Bf,hpo,Zo,fZ,Yjt=h(()=>{"use strict";(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Bf||(Bf={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(hpo||(hpo={}));Zo=Bf.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fZ=e=>{switch(typeof e){case"undefined":return Zo.undefined;case"string":return Zo.string;case"number":return Number.isNaN(e)?Zo.nan:Zo.number;case"boolean":return Zo.boolean;case"function":return Zo.function;case"bigint":return Zo.bigint;case"symbol":return Zo.symbol;case"object":return Array.isArray(e)?Zo.array:e===null?Zo.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Zo.promise:typeof Map<"u"&&e instanceof Map?Zo.map:typeof Set<"u"&&e instanceof Set?Zo.set:typeof Date<"u"&&e instanceof Date?Zo.date:Zo.object;default:return Zo.unknown}}});var Qr,o5f,xQ,eRr=h(()=>{"use strict";Yjt();Qr=Bf.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),o5f=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),xQ=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bf.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};xQ.create=e=>new xQ(e)});var s5f,Wle,gpo=h(()=>{"use strict";eRr();Yjt();s5f=(e,t)=>{let r;switch(e.code){case Qr.invalid_type:e.received===Zo.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Qr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Bf.jsonStringifyReplacer)}`;break;case Qr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Bf.joinValues(e.keys,", ")}`;break;case Qr.invalid_union:r="Invalid input";break;case Qr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Bf.joinValues(e.options)}`;break;case Qr.invalid_enum_value:r=`Invalid enum value. Expected ${Bf.joinValues(e.options)}, received '${e.received}'`;break;case Qr.invalid_arguments:r="Invalid function arguments";break;case Qr.invalid_return_type:r="Invalid function return type";break;case Qr.invalid_date:r="Invalid date";break;case Qr.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Bf.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Qr.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Qr.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Qr.custom:r="Invalid input";break;case Qr.invalid_intersection_types:r="Intersection results could not be merged";break;case Qr.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Qr.not_finite:r="Number must be finite";break;default:r=t.defaultError,Bf.assertNever(e)}return{message:r}},Wle=s5f});function a5f(e){Cbc=e}function XZe(){return Cbc}var Cbc,tRr=h(()=>{"use strict";gpo();Cbc=Wle});function Do(e,t){let r=XZe(),n=Xjt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Wle?void 0:Wle].filter(i=>!!i)});e.common.issues.push(n)}var Xjt,c5f,EP,Nc,KQe,vD,rRr,nRr,Y0e,ZZe,Apo=h(()=>{"use strict";tRr();gpo();Xjt=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},c5f=[];EP=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return Nc;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Nc;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},Nc=Object.freeze({status:"aborted"}),KQe=e=>({status:"dirty",value:e}),vD=e=>({status:"valid",value:e}),rRr=e=>e.status==="aborted",nRr=e=>e.status==="dirty",Y0e=e=>e.status==="valid",ZZe=e=>typeof Promise<"u"&&e instanceof Promise});var wbc=h(()=>{"use strict"});var xa,Sbc=h(()=>{"use strict";(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(xa||(xa={}))});function fp(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}function Bbc(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function w5f(e){return new RegExp(`^${Bbc(e)}$`)}function Dbc(e){let t=`${Pbc}T${Bbc(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function S5f(e,t){return!!((t==="v4"||!t)&&y5f.test(e)||(t==="v6"||!t)&&E5f.test(e))}function T5f(e,t){if(!m5f.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function O5f(e,t){return!!((t==="v4"||!t)&&b5f.test(e)||(t==="v6"||!t)&&I5f.test(e))}function P5f(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}function $Ze(e){if(e instanceof CQ){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=KU.create($Ze(n))}return new CQ({...e._def,shape:()=>t})}else return e instanceof Jle?new Jle({...e._def,type:$Ze(e.element)}):e instanceof KU?KU.create($Ze(e.unwrap())):e instanceof mZ?mZ.create($Ze(e.unwrap())):e instanceof dZ?dZ.create(e.items.map(t=>$Ze(t))):e}function bpo(e,t){let r=fZ(e),n=fZ(t);if(e===t)return{valid:!0,data:e};if(r===Zo.object&&n===Zo.object){let i=Bf.objectKeys(t),o=Bf.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=bpo(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===Zo.array&&n===Zo.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=bpo(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===Zo.date&&n===Zo.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function Rbc(e,t){return new oze({values:e,typeName:du.ZodEnum,...fp(t)})}function Obc(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function xD(e,t={},r){return e?Z0e.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=Obc(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=Obc(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Z0e.create()}var JU,Tbc,Up,u5f,l5f,p5f,f5f,d5f,m5f,h5f,g5f,A5f,ypo,y5f,b5f,E5f,I5f,v5f,x5f,Pbc,C5f,X0e,JQe,YQe,XQe,ZQe,e$e,$Qe,eze,Z0e,Kle,OW,t$e,Jle,CQ,tze,Hle,iRr,rze,dZ,oRr,r$e,n$e,sRr,nze,ize,oze,sze,$0e,YU,KU,mZ,aze,cze,i$e,B5f,Zjt,$jt,uze,D5f,du,R5f,I,ft,k5f,F5f,Ue,N5f,j5f,Q5f,o$e,z5f,ir,M5f,Tp,re,w,L5f,po,ur,V5f,U5f,tr,_5f,G5f,q5f,fo,me,lr,W5f,H5f,K5f,J5f,Y5f,Yle,X5f,Z5f,$5f,e8f,Nh,t8f,kbc=h(()=>{"use strict";eRr();tRr();Sbc();Apo();Yjt();JU=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Tbc=(e,t)=>{if(Y0e(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new xQ(e.common.issues);return this._error=r,this._error}}};Up=class{get description(){return this._def.description}_getType(t){return fZ(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:fZ(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new EP,ctx:{common:t.parent.common,data:t.data,parsedType:fZ(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ZZe(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fZ(t)},i=this._parseSync({data:t,path:n.path,parent:n});return Tbc(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fZ(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Y0e(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Y0e(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fZ(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(ZZe(i)?i:Promise.resolve(i));return Tbc(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:Qr.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new YU({schema:this,typeName:du.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return KU.create(this,this._def)}nullable(){return mZ.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Jle.create(this)}promise(){return $0e.create(this,this._def)}or(t){return tze.create([this,t],this._def)}and(t){return rze.create(this,t,this._def)}transform(t){return new YU({...fp(this._def),schema:this,typeName:du.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new aze({...fp(this._def),innerType:this,defaultValue:r,typeName:du.ZodDefault})}brand(){return new Zjt({typeName:du.ZodBranded,type:this,...fp(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new cze({...fp(this._def),innerType:this,catchValue:r,typeName:du.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return $jt.create(this,t)}readonly(){return uze.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},u5f=/^c[^\s-]{8,}$/i,l5f=/^[0-9a-z]+$/,p5f=/^[0-9A-HJKMNP-TV-Z]{26}$/i,f5f=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,d5f=/^[a-z0-9_-]{21}$/i,m5f=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,h5f=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,g5f=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,A5f="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",y5f=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,b5f=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,E5f=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,I5f=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,v5f=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x5f=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pbc="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",C5f=new RegExp(`^${Pbc}$`);X0e=class e extends Up{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Zo.string){let o=this._getOrReturnCtx(t);return Do(o,{code:Qr.invalid_type,expected:Zo.string,received:o.parsedType}),Nc}let n=new EP,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?Do(i,{code:Qr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Do(i,{code:Qr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")g5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"email",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")ypo||(ypo=new RegExp(A5f,"u")),ypo.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"emoji",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")f5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"uuid",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")d5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"nanoid",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")u5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"cuid",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")l5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"cuid2",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")p5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"ulid",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Do(i,{validation:"url",code:Qr.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"regex",code:Qr.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Dbc(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?C5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?w5f(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?h5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"duration",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?S5f(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"ip",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?T5f(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"jwt",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?O5f(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"cidr",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?v5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"base64",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?x5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"base64url",code:Qr.invalid_string,message:o.message}),n.dirty()):Bf.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:Qr.invalid_string,...xa.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...xa.errToObj(t)})}url(t){return this._addCheck({kind:"url",...xa.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...xa.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...xa.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...xa.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...xa.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...xa.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...xa.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...xa.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...xa.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...xa.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...xa.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...xa.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...xa.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...xa.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...xa.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...xa.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...xa.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...xa.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...xa.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...xa.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...xa.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...xa.errToObj(r)})}nonempty(t){return this.min(1,xa.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};X0e.create=e=>new X0e({checks:[],typeName:du.ZodString,coerce:e?.coerce??!1,...fp(e)});JQe=class e extends Up{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Zo.number){let o=this._getOrReturnCtx(t);return Do(o,{code:Qr.invalid_type,expected:Zo.number,received:o.parsedType}),Nc}let n,i=new EP;for(let o of this._def.checks)o.kind==="int"?Bf.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?P5f(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.not_finite,message:o.message}),i.dirty()):Bf.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,xa.toString(r))}gt(t,r){return this.setLimit("min",t,!1,xa.toString(r))}lte(t,r){return this.setLimit("max",t,!0,xa.toString(r))}lt(t,r){return this.setLimit("max",t,!1,xa.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:xa.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:xa.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xa.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xa.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xa.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xa.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:xa.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:xa.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xa.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xa.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Bf.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};JQe.create=e=>new JQe({checks:[],typeName:du.ZodNumber,coerce:e?.coerce||!1,...fp(e)});YQe=class e extends Up{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Zo.bigint)return this._getInvalidInput(t);let n,i=new EP;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Bf.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Do(r,{code:Qr.invalid_type,expected:Zo.bigint,received:r.parsedType}),Nc}gte(t,r){return this.setLimit("min",t,!0,xa.toString(r))}gt(t,r){return this.setLimit("min",t,!1,xa.toString(r))}lte(t,r){return this.setLimit("max",t,!0,xa.toString(r))}lt(t,r){return this.setLimit("max",t,!1,xa.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:xa.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xa.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xa.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xa.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xa.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:xa.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};YQe.create=e=>new YQe({checks:[],typeName:du.ZodBigInt,coerce:e?.coerce??!1,...fp(e)});XQe=class extends Up{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Zo.boolean){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.boolean,received:n.parsedType}),Nc}return vD(t.data)}};XQe.create=e=>new XQe({typeName:du.ZodBoolean,coerce:e?.coerce||!1,...fp(e)});ZQe=class e extends Up{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Zo.date){let o=this._getOrReturnCtx(t);return Do(o,{code:Qr.invalid_type,expected:Zo.date,received:o.parsedType}),Nc}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return Do(o,{code:Qr.invalid_date}),Nc}let n=new EP,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Bf.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:xa.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:xa.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};ZQe.create=e=>new ZQe({checks:[],coerce:e?.coerce||!1,typeName:du.ZodDate,...fp(e)});e$e=class extends Up{_parse(t){if(this._getType(t)!==Zo.symbol){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.symbol,received:n.parsedType}),Nc}return vD(t.data)}};e$e.create=e=>new e$e({typeName:du.ZodSymbol,...fp(e)});$Qe=class extends Up{_parse(t){if(this._getType(t)!==Zo.undefined){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.undefined,received:n.parsedType}),Nc}return vD(t.data)}};$Qe.create=e=>new $Qe({typeName:du.ZodUndefined,...fp(e)});eze=class extends Up{_parse(t){if(this._getType(t)!==Zo.null){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.null,received:n.parsedType}),Nc}return vD(t.data)}};eze.create=e=>new eze({typeName:du.ZodNull,...fp(e)});Z0e=class extends Up{constructor(){super(...arguments),this._any=!0}_parse(t){return vD(t.data)}};Z0e.create=e=>new Z0e({typeName:du.ZodAny,...fp(e)});Kle=class extends Up{constructor(){super(...arguments),this._unknown=!0}_parse(t){return vD(t.data)}};Kle.create=e=>new Kle({typeName:du.ZodUnknown,...fp(e)});OW=class extends Up{_parse(t){let r=this._getOrReturnCtx(t);return Do(r,{code:Qr.invalid_type,expected:Zo.never,received:r.parsedType}),Nc}};OW.create=e=>new OW({typeName:du.ZodNever,...fp(e)});t$e=class extends Up{_parse(t){if(this._getType(t)!==Zo.undefined){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.void,received:n.parsedType}),Nc}return vD(t.data)}};t$e.create=e=>new t$e({typeName:du.ZodVoid,...fp(e)});Jle=class e extends Up{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==Zo.array)return Do(r,{code:Qr.invalid_type,expected:Zo.array,received:r.parsedType}),Nc;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Do(r,{code:s?Qr.too_big:Qr.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Do(r,{code:Qr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Do(r,{code:Qr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new JU(r,s,r.path,a)))).then(s=>EP.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new JU(r,s,r.path,a)));return EP.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:xa.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:xa.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:xa.toString(r)}})}nonempty(t){return this.min(1,t)}};Jle.create=(e,t)=>new Jle({type:e,minLength:null,maxLength:null,exactLength:null,typeName:du.ZodArray,...fp(t)});CQ=class e extends Up{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Bf.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Zo.object){let u=this._getOrReturnCtx(t);return Do(u,{code:Qr.invalid_type,expected:Zo.object,received:u.parsedType}),Nc}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof OW&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],p=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new JU(i,p,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof OW){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")a.length>0&&(Do(i,{code:Qr.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let p=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new JU(i,p,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let p=await l.key,d=await l.value;u.push({key:p,value:d,alwaysSet:l.alwaysSet})}return u}).then(u=>EP.mergeObjectSync(n,u)):EP.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return xa.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:xa.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:du.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Bf.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Bf.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return $Ze(this)}partial(t){let r={};for(let n of Bf.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Bf.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof KU;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return Rbc(Bf.objectKeys(this.shape))}};CQ.create=(e,t)=>new CQ({shape:()=>e,unknownKeys:"strip",catchall:OW.create(),typeName:du.ZodObject,...fp(t)});CQ.strictCreate=(e,t)=>new CQ({shape:()=>e,unknownKeys:"strict",catchall:OW.create(),typeName:du.ZodObject,...fp(t)});CQ.lazycreate=(e,t)=>new CQ({shape:e,unknownKeys:"strip",catchall:OW.create(),typeName:du.ZodObject,...fp(t)});tze=class extends Up{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new xQ(a.ctx.common.issues));return Do(r,{code:Qr.invalid_union,unionErrors:s}),Nc}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new xQ(c));return Do(r,{code:Qr.invalid_union,unionErrors:a}),Nc}}get options(){return this._def.options}};tze.create=(e,t)=>new tze({options:e,typeName:du.ZodUnion,...fp(t)});Hle=e=>e instanceof nze?Hle(e.schema):e instanceof YU?Hle(e.innerType()):e instanceof ize?[e.value]:e instanceof oze?e.options:e instanceof sze?Bf.objectValues(e.enum):e instanceof aze?Hle(e._def.innerType):e instanceof $Qe?[void 0]:e instanceof eze?[null]:e instanceof KU?[void 0,...Hle(e.unwrap())]:e instanceof mZ?[null,...Hle(e.unwrap())]:e instanceof Zjt||e instanceof uze?Hle(e.unwrap()):e instanceof cze?Hle(e._def.innerType):[],iRr=class e extends Up{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Zo.object)return Do(r,{code:Qr.invalid_type,expected:Zo.object,received:r.parsedType}),Nc;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Do(r,{code:Qr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Nc)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=Hle(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:du.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...fp(n)})}};rze=class extends Up{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(rRr(o)||rRr(s))return Nc;let a=bpo(o.value,s.value);return a.valid?((nRr(o)||nRr(s))&&r.dirty(),{status:r.value,value:a.data}):(Do(n,{code:Qr.invalid_intersection_types}),Nc)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};rze.create=(e,t,r)=>new rze({left:e,right:t,typeName:du.ZodIntersection,...fp(r)});dZ=class e extends Up{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Zo.array)return Do(n,{code:Qr.invalid_type,expected:Zo.array,received:n.parsedType}),Nc;if(n.data.length<this._def.items.length)return Do(n,{code:Qr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Nc;!this._def.rest&&n.data.length>this._def.items.length&&(Do(n,{code:Qr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new JU(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>EP.mergeArray(r,s)):EP.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};dZ.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new dZ({items:e,typeName:du.ZodTuple,rest:null,...fp(t)})};oRr=class e extends Up{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Zo.object)return Do(n,{code:Qr.invalid_type,expected:Zo.object,received:n.parsedType}),Nc;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new JU(n,a,n.path,a)),value:s._parse(new JU(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?EP.mergeObjectAsync(r,i):EP.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Up?new e({keyType:t,valueType:r,typeName:du.ZodRecord,...fp(n)}):new e({keyType:X0e.create(),valueType:t,typeName:du.ZodRecord,...fp(r)})}},r$e=class extends Up{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Zo.map)return Do(n,{code:Qr.invalid_type,expected:Zo.map,received:n.parsedType}),Nc;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new JU(n,a,n.path,[u,"key"])),value:o._parse(new JU(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return Nc;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return Nc;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};r$e.create=(e,t,r)=>new r$e({valueType:t,keyType:e,typeName:du.ZodMap,...fp(r)});n$e=class e extends Up{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Zo.set)return Do(n,{code:Qr.invalid_type,expected:Zo.set,received:n.parsedType}),Nc;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Do(n,{code:Qr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Do(n,{code:Qr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return Nc;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new JU(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:xa.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:xa.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};n$e.create=(e,t)=>new n$e({valueType:e,minSize:null,maxSize:null,typeName:du.ZodSet,...fp(t)});sRr=class e extends Up{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Zo.function)return Do(r,{code:Qr.invalid_type,expected:Zo.function,received:r.parsedType}),Nc;function n(a,c){return Xjt({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,XZe(),Wle].filter(u=>!!u),issueData:{code:Qr.invalid_arguments,argumentsError:c}})}function i(a,c){return Xjt({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,XZe(),Wle].filter(u=>!!u),issueData:{code:Qr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof $0e){let a=this;return vD(async function(...c){let u=new xQ([]),l=await a._def.args.parseAsync(c,o).catch(f=>{throw u.addIssue(n(c,f)),u}),p=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(p,o).catch(f=>{throw u.addIssue(i(p,f)),u})})}else{let a=this;return vD(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new xQ([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),p=a._def.returns.safeParse(l,o);if(!p.success)throw new xQ([i(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:dZ.create(t).rest(Kle.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||dZ.create([]).rest(Kle.create()),returns:r||Kle.create(),typeName:du.ZodFunction,...fp(n)})}},nze=class extends Up{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};nze.create=(e,t)=>new nze({getter:e,typeName:du.ZodLazy,...fp(t)});ize=class extends Up{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Do(r,{received:r.data,code:Qr.invalid_literal,expected:this._def.value}),Nc}return{status:"valid",value:t.data}}get value(){return this._def.value}};ize.create=(e,t)=>new ize({value:e,typeName:du.ZodLiteral,...fp(t)});oze=class e extends Up{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Do(r,{expected:Bf.joinValues(n),received:r.parsedType,code:Qr.invalid_type}),Nc}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return Do(r,{received:r.data,code:Qr.invalid_enum_value,options:n}),Nc}return vD(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};oze.create=Rbc;sze=class extends Up{_parse(t){let r=Bf.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Zo.string&&n.parsedType!==Zo.number){let i=Bf.objectValues(r);return Do(n,{expected:Bf.joinValues(i),received:n.parsedType,code:Qr.invalid_type}),Nc}if(this._cache||(this._cache=new Set(Bf.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Bf.objectValues(r);return Do(n,{received:n.data,code:Qr.invalid_enum_value,options:i}),Nc}return vD(t.data)}get enum(){return this._def.values}};sze.create=(e,t)=>new sze({values:e,typeName:du.ZodNativeEnum,...fp(t)});$0e=class extends Up{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Zo.promise&&r.common.async===!1)return Do(r,{code:Qr.invalid_type,expected:Zo.promise,received:r.parsedType}),Nc;let n=r.parsedType===Zo.promise?r.data:Promise.resolve(r.data);return vD(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$0e.create=(e,t)=>new $0e({type:e,typeName:du.ZodPromise,...fp(t)});YU=class extends Up{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===du.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{Do(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return Nc;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Nc:c.status==="dirty"?KQe(c.value):r.value==="dirty"?KQe(c.value):c});{if(r.value==="aborted")return Nc;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?Nc:a.status==="dirty"?KQe(a.value):r.value==="dirty"?KQe(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Nc:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Nc:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Y0e(s))return Nc;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Y0e(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):Nc);Bf.assertNever(i)}};YU.create=(e,t,r)=>new YU({schema:e,typeName:du.ZodEffects,effect:t,...fp(r)});YU.createWithPreprocess=(e,t,r)=>new YU({schema:t,effect:{type:"preprocess",transform:e},typeName:du.ZodEffects,...fp(r)});KU=class extends Up{_parse(t){return this._getType(t)===Zo.undefined?vD(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};KU.create=(e,t)=>new KU({innerType:e,typeName:du.ZodOptional,...fp(t)});mZ=class extends Up{_parse(t){return this._getType(t)===Zo.null?vD(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mZ.create=(e,t)=>new mZ({innerType:e,typeName:du.ZodNullable,...fp(t)});aze=class extends Up{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===Zo.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};aze.create=(e,t)=>new aze({innerType:e,typeName:du.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fp(t)});cze=class extends Up{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ZZe(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new xQ(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xQ(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};cze.create=(e,t)=>new cze({innerType:e,typeName:du.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fp(t)});i$e=class extends Up{_parse(t){if(this._getType(t)!==Zo.nan){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.nan,received:n.parsedType}),Nc}return{status:"valid",value:t.data}}};i$e.create=e=>new i$e({typeName:du.ZodNaN,...fp(e)});B5f=Symbol("zod_brand"),Zjt=class extends Up{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},$jt=class e extends Up{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Nc:o.status==="dirty"?(r.dirty(),KQe(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Nc:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:du.ZodPipeline})}},uze=class extends Up{_parse(t){let r=this._def.innerType._parse(t),n=i=>(Y0e(i)&&(i.value=Object.freeze(i.value)),i);return ZZe(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};uze.create=(e,t)=>new uze({innerType:e,typeName:du.ZodReadonly,...fp(t)});D5f={object:CQ.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(du||(du={}));R5f=(e,t={message:`Input not instance of ${e.name}`})=>xD(r=>r instanceof e,t),I=X0e.create,ft=JQe.create,k5f=i$e.create,F5f=YQe.create,Ue=XQe.create,N5f=ZQe.create,j5f=e$e.create,Q5f=$Qe.create,o$e=eze.create,z5f=Z0e.create,ir=Kle.create,M5f=OW.create,Tp=t$e.create,re=Jle.create,w=CQ.create,L5f=CQ.strictCreate,po=tze.create,ur=iRr.create,V5f=rze.create,U5f=dZ.create,tr=oRr.create,_5f=r$e.create,G5f=n$e.create,q5f=sRr.create,fo=nze.create,me=ize.create,lr=oze.create,W5f=sze.create,H5f=$0e.create,K5f=YU.create,J5f=KU.create,Y5f=mZ.create,Yle=YU.createWithPreprocess,X5f=$jt.create,Z5f=()=>I().optional(),$5f=()=>ft().optional(),e8f=()=>Ue().optional(),Nh={string:(e=>X0e.create({...e,coerce:!0})),number:(e=>JQe.create({...e,coerce:!0})),boolean:(e=>XQe.create({...e,coerce:!0})),bigint:(e=>YQe.create({...e,coerce:!0})),date:(e=>ZQe.create({...e,coerce:!0}))},t8f=Nc});var Be={};Z(Be,{BRAND:()=>B5f,DIRTY:()=>KQe,EMPTY_PATH:()=>c5f,INVALID:()=>Nc,NEVER:()=>t8f,OK:()=>vD,ParseStatus:()=>EP,Schema:()=>Up,ZodAny:()=>Z0e,ZodArray:()=>Jle,ZodBigInt:()=>YQe,ZodBoolean:()=>XQe,ZodBranded:()=>Zjt,ZodCatch:()=>cze,ZodDate:()=>ZQe,ZodDefault:()=>aze,ZodDiscriminatedUnion:()=>iRr,ZodEffects:()=>YU,ZodEnum:()=>oze,ZodError:()=>xQ,ZodFirstPartyTypeKind:()=>du,ZodFunction:()=>sRr,ZodIntersection:()=>rze,ZodIssueCode:()=>Qr,ZodLazy:()=>nze,ZodLiteral:()=>ize,ZodMap:()=>r$e,ZodNaN:()=>i$e,ZodNativeEnum:()=>sze,ZodNever:()=>OW,ZodNull:()=>eze,ZodNullable:()=>mZ,ZodNumber:()=>JQe,ZodObject:()=>CQ,ZodOptional:()=>KU,ZodParsedType:()=>Zo,ZodPipeline:()=>$jt,ZodPromise:()=>$0e,ZodReadonly:()=>uze,ZodRecord:()=>oRr,ZodSchema:()=>Up,ZodSet:()=>n$e,ZodString:()=>X0e,ZodSymbol:()=>e$e,ZodTransformer:()=>YU,ZodTuple:()=>dZ,ZodType:()=>Up,ZodUndefined:()=>$Qe,ZodUnion:()=>tze,ZodUnknown:()=>Kle,ZodVoid:()=>t$e,addIssueToContext:()=>Do,any:()=>z5f,array:()=>re,bigint:()=>F5f,boolean:()=>Ue,coerce:()=>Nh,custom:()=>xD,date:()=>N5f,datetimeRegex:()=>Dbc,defaultErrorMap:()=>Wle,discriminatedUnion:()=>ur,effect:()=>K5f,enum:()=>lr,function:()=>q5f,getErrorMap:()=>XZe,getParsedType:()=>fZ,instanceof:()=>R5f,intersection:()=>V5f,isAborted:()=>rRr,isAsync:()=>ZZe,isDirty:()=>nRr,isValid:()=>Y0e,late:()=>D5f,lazy:()=>fo,literal:()=>me,makeIssue:()=>Xjt,map:()=>_5f,nan:()=>k5f,nativeEnum:()=>W5f,never:()=>M5f,null:()=>o$e,nullable:()=>Y5f,number:()=>ft,object:()=>w,objectUtil:()=>hpo,oboolean:()=>e8f,onumber:()=>$5f,optional:()=>J5f,ostring:()=>Z5f,pipeline:()=>X5f,preprocess:()=>Yle,promise:()=>H5f,quotelessJson:()=>o5f,record:()=>tr,set:()=>G5f,setErrorMap:()=>a5f,strictObject:()=>L5f,string:()=>I,symbol:()=>j5f,transformer:()=>K5f,tuple:()=>U5f,undefined:()=>Q5f,union:()=>po,unknown:()=>ir,util:()=>Bf,void:()=>Tp});var Epo=h(()=>{"use strict";tRr();Apo();wbc();Yjt();kbc();eRr()});var jn=h(()=>{"use strict";Epo();Epo()});var r8f,Ipo,Fbc=h(()=>{"use strict";jn();r8f=Be.object({lang:Be.string(),label:Be.optional(Be.string()),source:Be.string()}),Ipo=Be.array(r8f)});var Nbc,jbc=h(()=>{"use strict";Nbc={README_EXT:"x-readme"}});function n8f(e){if(!Array.isArray(e))return!1;for(let t of e)if(!io(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function Qbc(e){let t=jr(e,Nbc.README_EXT);if(!io(t))return[];let r=t["code-samples"];if(!n8f(r))return[];let n=[];for(let i of r)n.push({name:i.name,language:i.language,code:i.code,install:i.install,docs:void 0});return n}var zbc=h(()=>{"use strict";wt();fu();jbc()});function i8f(e){return io(e)&&typeof e.$ref=="string"}function o8f(e,t){if(e!=null){if(typeof e=="string")return e;if(i8f(e)){let r=(0,cRr.resolve)(t??process.cwd(),e.$ref);if((0,aRr.existsSync)(r))try{return(0,aRr.readFileSync)(r,"utf-8")}catch{return}}}}function s8f(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!io(n))continue;let o=o8f(n.code,t);o!=null&&r.push({...n,code:o})}return r}function Mbc(e,t,r){let n=jr(t,mn.EXAMPLES),i=r.source.type==="openapi"?(0,cRr.dirname)(r.source.file):void 0,s=(n??[]).map(p=>{if(!io(p))return p;let f=p["code-samples"];if(f!=null){let m=s8f(f,i);return{...p,"code-samples":m}}return p}).filter(p=>{let d=Fd.serialization.ExampleEndpointCallSchema.parse(p);return d.ok||r.logger.error(`Failed to parse x-fern-example in ${e.path}/${e.method}`),d.ok}),a=Njt(t,bP.REDOCLY_CODE_SAMPLES_KEBAB,Ipo,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],u=[...Njt(t,bP.REDOCLY_CODE_SAMPLES_CAMEL,Ipo,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...a];u.length>0&&s.push({"code-samples":u.map(p=>({name:p.label??p.lang,language:p.lang,code:p.source,install:void 0,docs:void 0}))});let l=Qbc(t);return l.length>0&&s.push({"code-samples":l}),s.map(LU.unknown)}var aRr,cRr,Lbc=h(()=>{"use strict";wt();lo();Ac();aRr=require("fs"),cRr=require("path");fu();Fbc();VQe();zl();zbc()});function Vbc(e){let t=jr(e,mn.AVAILABILITY);if(t==="ga"||t==="generally-available")return Zh.GenerallyAvailable;if(t==="beta"||t==="pre-release")return Zh.Beta;if(t==="deprecated")return Zh.Deprecated;if(t==="alpha")return Zh.Alpha;if(t==="preview")return Zh.Preview;if(t==="legacy")return Zh.Legacy;if(e.deprecated)return Zh.Deprecated}var Ubc=h(()=>{"use strict";Ac();fu();zl()});function _bc(e){let t=jr(e,mn.RETRIES);if(t!=null&&t.disabled===!0)return mm.RetriesConfiguration.disabled(t.disabled)}var Gbc=h(()=>{"use strict";Ac();fu();zl()});function a8f(e){return e["x-fern-default"]??e.default}function qbc(e){let t=jr(e,mn.FERN_GLOBAL_PARAMETERS),r=[];for(let n of t??[])typeof n.name=="string"&&r.push({name:n.name,parameterName:n["parameter-name"],in:n.in,target:n.target,type:n.type,env:n.env,default:a8f(n),optional:n.optional,apply:n.apply,docs:n.docs});return r}function Wbc(e){let t=jr(e,mn.FERN_GLOBAL_PARAMETER);if(t!=null){if(typeof t=="string")return[t];if(Array.isArray(t))return t.filter(r=>typeof r=="string")}}var vpo=h(()=>{"use strict";fu();zl()});function uRr(e,t){let r=e.variables!=null&&Object.keys(e.variables).length>0,n=u8f(e);return{url:p8f({url:e.url,variables:e.variables??{}}),description:e.description,name:f8f(e,t),audiences:jr(e,mn.AUDIENCES),urlTemplate:r?e.url:void 0,variables:r&&e.variables!=null?l8f(e.variables):void 0,defaultUrl:r?n:void 0}}function u8f(e){let t=e[c8f];if(typeof t=="string")return t.endsWith("/")&&t!=="/"?t.slice(0,-1):t}function l8f(e){return Object.entries(e).map(([t,r])=>({id:t,default:r.default,values:r.enum}))}function p8f({url:e,variables:t}){let r=Object.fromEntries(Object.entries(t).map(([n,i])=>[n,i.default]));for(let[n,i]of Object.entries(r))e=e.replace(`{${n}}`,encodeURIComponent(i));return e}function f8f(e,t){let r=jr(e,[mn.SERVER_NAME_V1,mn.SERVER_NAME_V2]);if(r!=null)return r;if(e.description?.toLowerCase()==="production")return"Production";if(e.description?.toLowerCase()==="sandbox")return"Sandbox";if(t?.groupMultiApiEnvironments&&e.description!=null&&e.description.trim()!==""){let n=e.description.toLowerCase();return n==="prd"?"Production":n==="sbx"?"Sandbox":n==="staging"||n==="stg"?"Staging":n==="development"||n==="dev"?"Development":e.description}}var c8f,xpo=h(()=>{"use strict";fu();zl();c8f="x-fern-default-url"});function Hbc(e){return jr(e,mn.PARAMETER_NAME)}var Kbc=h(()=>{"use strict";fu();zl()});function Jbc(e){return jr(e,mn.SDK_VARIABLE)}var Ybc=h(()=>{"use strict";fu();zl()});function lRr({path:e,httpMethod:t,parameters:r,context:n,requestBreadcrumbs:i,source:o}){let s={pathParameters:[],queryParameters:[],headers:[]};for(let a of r){let c=Gn(a)?n.resolveParameterReference(a):a,u=jr(a,mn.IGNORE)??jr(c,mn.IGNORE);if(u!=null&&u){n.logger.debug(`${t.toUpperCase()} ${e} has a parameter marked with x-fern-ignore. Skipping.`);continue}let l=c.required??!1,p=Hv(c),d=[...i,c.name],f=HA(d,n.options.preserveSchemaIds),m=c.in==="header",[g,A]=n.options.coerceOptionalSchemasToNullable&&!m?[!1,!l]:[!l,!1],y=d8f(c,n),E=y!=null?Qa(y,g,A,n,d,o,n.namespace,!1,new Set,A8f(c,n)):l?Wr.primitive({nameOverride:void 0,generatedName:f,title:void 0,schema:Ui.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:qU({schema:c,logger:n.logger})}),description:void 0,availability:p,namespace:void 0,groupName:void 0}):Wr.optional({nameOverride:void 0,generatedName:f,title:void 0,value:Wr.primitive({nameOverride:void 0,generatedName:f,title:void 0,schema:Ui.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:qU({schema:c,logger:n.logger})}),description:void 0,availability:void 0,namespace:void 0,groupName:void 0}),description:void 0,availability:p,namespace:void 0,groupName:void 0,inline:void 0});if(c.in==="header"&&c.schema!=null&&!Gn(c.schema)&&c.schema.default!=null){let C=c.schema.default;typeof C=="string"&&C.length>0&&(E=Wr.literal({nameOverride:void 0,generatedName:f,title:void 0,value:Ty.string(C),description:void 0,availability:p,namespace:void 0,groupName:void 0}))}let x=jr(a,mn.FERN_DEFAULT)??jr(c,mn.FERN_DEFAULT),v={name:c.name,schema:E,description:h8f(c),parameterNameOverride:Hbc(c),availability:p,source:o,clientDefault:x};c.in==="query"?s.queryParameters.push({...v,explode:g8f(c)}):c.in==="path"?s.pathParameters.push({...v,variableReference:Jbc(c),explode:y8f(c)}):c.in==="header"?!m8f.has(c.name.toLowerCase())&&!n.authHeaders.has(c.name)?s.headers.push({...v,env:void 0}):n.logger.debug(`Ignoring ${c.name} header, in ${t.toUpperCase()} ${e}`):n.logger.warn(`Skipping ${c.in} parameter, ${c.name}, in ${t.toUpperCase()} ${e}`)}return s}function d8f(e,t){return e.schema!=null?e.schema:!t.options.respectParameterContent||e.in!=="header"||e.content==null?void 0:Hjt({content:e.content,context:t})?.[1].schema}function h8f(e){if(e.description!=null)return e.description;if(!(e.schema==null||Gn(e.schema)))return e.schema.description}function g8f(e){let t=e.style??"form",r=e.explode;if(r!==void 0)return t==="form"||t==="deepObject"?r===!0?void 0:r:r===!1?void 0:r}function A8f(e,t){let r=NDr({schema:e,logger:t.logger});return r??qU({schema:e,logger:t.logger})}function y8f(e){let t=e.explode;if(t!==void 0)return t===!1?void 0:t}var m8f,Cpo=h(()=>{"use strict";Ac();fu();LZe();ID();epo();pZ();zb();zl();Kbc();Ybc();JZe();m8f=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"])});function b8f({content:e,context:t}){for(let[r,n]of Object.entries(e))if(Zbc({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function Zbc({mediaType:e,mediaTypeObject:t,context:r}){if(Qp.parse(e)?.isURLEncoded())return{schema:t.schema,contentType:e,examples:KZe(t,r)}}function E8f({content:e,context:t}){for(let[r,n]of Object.entries(e))if($bc({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function $bc({mediaType:e,mediaTypeObject:t,context:r}){if(Qp.parse(e)?.isMultipart())return{schema:t.schema,encoding:t.encoding,examples:KZe(t,r)}}function e0c({mediaType:e}){return Qp.parse(e)?.isBinary()??!1}function I8f({content:e}){for(let[t,r]of Object.entries(e))if(e0c({mediaType:t}))return[t,r]}function v8f(e,t){let r=Gn(e)?wpo(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([n,i])=>!Gn(i)&&i.type==="string"&&(i.format==="binary"||i.format==null&&i.contentMediaType==="application/octet-stream"))!=null}function fRr({content:e,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a}){let c=I8f({content:e});if(c){let[f,m]=c;return hZ({mediaType:f,mediaTypeObject:m,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a})}let u=E8f({content:e,context:n}),l=Hjt({content:e,context:n}),p=x8f({json:l,multipart:u,document:r,visitor:{json:([f,m])=>hZ({mediaType:f,mediaTypeObject:m,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a}),multipart:([f,m])=>hZ({mediaType:f,mediaTypeObject:m,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a}),neither:()=>{}}});if(p)return p;let d=b8f({content:e,context:n});if(d){let[f,m]=d;return hZ({mediaType:f,mediaTypeObject:m,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a})}}function x8f({json:e,multipart:t,document:r,visitor:n}){if(!e&&!t)return n.neither();let[,i]=e??[void 0,void 0],[,o]=t??[void 0,void 0];return!i?.schema&&!o?.schema?e&&(i?.example!=null||i?.examples!=null&&Object.keys(i.examples).length>0)?n.json(e):n.neither():i?.schema&&o?.schema?i.schema&&v8f(i.schema,r)?n.multipart(t):n.json(e):i?.schema?n.json(e):o?.schema?n.multipart(t):n.neither()}function hZ({mediaType:e,mediaTypeObject:t,description:r,document:n,context:i,requestBreadcrumbs:o,source:s,namespace:a,bodyRequired:c}){let u=C8f({mediaTypeObject:t});if(e0c({mediaType:e}))return kF.octetStream({description:r,source:s,sdkMethodName:u,contentType:e});let l=$bc({mediaType:e,mediaTypeObject:t,context:i}),p=l?.schema,d=l?.encoding,f=l?.examples;if(p){let A=Gn(p)?wpo(p,n):{id:void 0,schema:p},y=Qa(A.schema,!1,!1,i,o,s,a,!1),E=[];if(y.type==="object"){let x=new Set(A.schema.required??[]);for(let v of y.properties){let C=x.has(v.key),{isFile:O,isOptional:D,isArray:R,description:P}=pRr({schema:v.schema,isOptional:!C});if(O){let M=Xbc(v.key,d);E.push({key:v.key,schema:eZ.file({isOptional:D,isArray:R,description:P}),description:P,contentType:M,exploded:!1,encoding:M==null?i.options.defaultFormParameterEncoding:void 0})}else{let M=Xbc(v.key,d);E.push({key:v.key,schema:eZ.json(v.schema),description:void 0,contentType:M,exploded:d?.[v.key]?.explode,encoding:M==null?i.options.defaultFormParameterEncoding:S8f(M)})}}}return kF.multipart({name:Gn(p)&&i.getNumberOfOccurrencesForRef(p)===1?A.id:void 0,description:A.schema.description,properties:E,source:s,sdkMethodName:u,fullExamples:f})}let m=ZDr({mediaType:e,mediaTypeObject:t,context:i});if(m){let A=Qa(m.schema,!1,!1,i,o,s,a,!0);return kF.json({description:void 0,schema:A,contentType:m.contentType,required:c,fullExamples:m.examples,additionalProperties:!Gn(m.schema)&&Vjt(m.schema.additionalProperties,i.options),source:s,sdkMethodName:u})}let g=Zbc({mediaType:e,mediaTypeObject:t,context:i});if(g!=null&&g.schema!=null){let A=Qa(g.schema,!1,!1,i,o,s,a,!1);return kF.formUrlEncoded({schema:A,description:r,contentType:g.contentType,source:s,fullExamples:g.examples,additionalProperties:!1,sdkMethodName:u})}}function C8f({mediaTypeObject:e}){return jr(e,mn.SDK_METHOD_NAME)}function S8f(e){return e?w8f[e]:void 0}function wpo(e,t){if(!e.$ref.startsWith(qQe))throw new S({message:`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`,code:S.Code.ReferenceError});let r=UZe(e);if(r==null)throw new S({message:`Failed to resolve schema reference because missing schema id: ${e.$ref}`,code:S.Code.ReferenceError});let n=t.components?.schemas?.[r];if(n==null)throw new S({message:`Failed to resolve schema reference because missing: ${e.$ref}`,code:S.Code.ReferenceError});return Gn(n)?wpo(n,t):{id:r,schema:n}}function pRr({schema:e,isOptional:t,isArray:r,description:n}){return O8f(e)?pRr({schema:e.value,isOptional:!0,isArray:r,description:e.description}):P8f(e)?pRr({schema:e.value,isOptional:t,isArray:r,description:e.description}):B8f(e)?pRr({schema:e.value,isOptional:t,isArray:!0,description:e.description}):T8f(e)?{isFile:!0,isOptional:t??!1,isArray:r??!1,description:n??e.description}:{isFile:!1,isOptional:t??!1,isArray:r??!1,description:void 0}}function T8f(e){return e.type==="primitive"&&e.schema.type==="string"&&e.schema.format==="binary"}function O8f(e){return e.type==="optional"}function P8f(e){return e.type==="nullable"}function B8f(e){return e.type==="array"}function Xbc(e,t){return t?.[e]?.contentType}var w8f,Spo=h(()=>{"use strict";wt();Ac();Ft();fu();PDr();ID();zb();zl();JZe();w8f={"application/json":"json"}});function r0c(e){switch(e.toUpperCase()){case D8f:return 400;case R8f:return 500;default:return}}var Tpo,D8f,R8f,Opo,t0c,Ppo=h(()=>{"use strict";Tpo={400:"BadRequestError",401:"UnauthorizedError",402:"PaymentRequiredError",403:"ForbiddenError",404:"NotFoundError",405:"MethodNotAllowedError",406:"NotAcceptableError",407:"ProxyAuthenticationRequiredError",408:"RequestTimeoutError",409:"ConflictError",410:"GoneError",411:"LengthRequiredError",412:"PreconditionFailedError",413:"ContentTooLargeError",414:"URITooLongError",415:"UnsupportedMediaTypeError",416:"RangeNotSatisfiableError",417:"ExpectationFailedError",418:"ImATeapotError",419:"AuthenticationTimeoutError",420:"MethodFailureError",421:"MisdirectedRequestError",422:"UnprocessableEntityError",423:"LockedError",424:"FailedDependencyError",425:"TooEarlyError",426:"UpgradeRequiredError",428:"PreconditionError",429:"TooManyRequestsError",430:"RequestHeaderFieldsTooLargeError",431:"RequestHeaderFieldsTooLargeError",444:"NoResponseError",449:"RetryWithError",450:"BlockedByWindowsParentalControlsError",451:"UnavailableForLegalReasonsError",498:"InvalidTokenError",499:"ClientClosedRequestError",500:"InternalServerError",501:"NotImplementedError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError",505:"HTTPVersionNotSupportedError",506:"VariantAlsoNegotiatesError",507:"InsufficientStorageError",508:"LoopDetectedError",509:"BandwidthLimitExceededError",510:"NotExtendedError",511:"NetworkAuthenticationRequiredError"},D8f="4XX",R8f="5XX",Opo={400:"ClientRequestError",500:"ServerError"},t0c=new Set([...Object.values(Tpo),...Object.values(Opo)])});function dRr({operationContext:e,responses:t,context:r,responseBreadcrumbs:n,responseStatusCode:i,streamFormat:o,streamTerminator:s,streamResumable:a,source:c}){if(t==null)return{value:void 0,errors:{}};let u=F8f({responses:t,context:r,source:c,namespace:r.namespace}),l=!1,p=!1,d;for(let f of i!=null?[i]:k8f){let m=t[f];if(m==null)continue;l=!0;let g=typeof f=="string"?parseInt(f):f;if(d==null){let A=n0c({operationContext:e,response:m,context:r,responseBreadcrumbs:n,streamFormat:o,streamTerminator:s,streamResumable:a,source:c,namespace:r.namespace,statusCode:g});A!=null?d=A:g===204&&(p=!0)}else if(g===204){let A=Gn(m)?r.resolveResponseReference(m):m;Kjt({context:r,content:A.content??{}})!=null&&r.logger.warn(`${e.method.toUpperCase()} ${e.path}: the 204 response declares a body, but a 204 (No Content) response cannot include one. Ignoring the declared 204 body and treating the success response as optional.`),p=!0}}if(p&&d!=null&&d.type==="json"){let f=d.schema;f.type!=="optional"&&(d=Ug.json({...d,schema:Wr.optional({value:f,description:f.type==="reference"?f.description:void 0,nameOverride:void 0,generatedName:"",groupName:void 0,namespace:void 0,availability:void 0,title:void 0,inline:void 0})}))}if(d==null&&!l&&t.default!=null&&(d=n0c({operationContext:e,response:t.default,context:r,responseBreadcrumbs:n,streamFormat:o,streamTerminator:s,streamResumable:a,source:c,namespace:r.namespace})),d!=null)switch(d.type){case"json":return{value:d,errors:u};case"streamingJson":case"streamingSse":return{value:d,errors:u};case"bytes":case"file":case"text":case"streamingText":return{value:d,errors:u};default:Ee(d)}return{value:void 0,errors:u}}function n0c({operationContext:e,streamFormat:t,streamTerminator:r,streamResumable:n,response:i,context:o,responseBreadcrumbs:s,source:a,namespace:c,statusCode:u}){let l=Gn(i)?o.resolveResponseReference(i):i;if(l.content!=null&&Object.entries(l.content).find(([m,g])=>{if(g.schema==null)return!1;let A=Gn(g.schema)?o.resolveSchemaReference(g.schema):g.schema;return A.type==="string"&&(A.format==="binary"||A.format==null&&A.contentMediaType==="application/octet-stream")}))return o.options.useBytesForBinaryResponse&&t==null?Ug.bytes({description:l.description,source:a,statusCode:u}):Ug.file({description:l.description,source:a,statusCode:u});let p=dbc(l.content??{},o);if(p!=null&&t!=null)switch(t){case"json":return Ug.streamingJson({statusCode:u,description:l.description,responseProperty:jr(e.operation,mn.RESPONSE_PROPERTY),terminator:r,resumable:void 0,fullExamples:p.examples,schema:Qa(p.schema,!1,!1,o,s,a,c),source:a});case"sse":return Ug.streamingSse({description:l.description,responseProperty:void 0,terminator:r,resumable:n,fullExamples:p.examples,schema:Qa(p.schema,!1,!1,o,s,a,c),source:a,statusCode:u})}let d=Kjt({context:o,content:l.content??{}});if(d){if(t!=null)switch(t){case"json":return Ug.streamingJson({description:l.description,responseProperty:void 0,terminator:r,resumable:void 0,fullExamples:d.examples,schema:Qa(d.schema,!1,!1,o,s,a,c),source:a,statusCode:u});case"sse":return Ug.streamingSse({description:l.description,responseProperty:void 0,terminator:r,resumable:n,fullExamples:d.examples,schema:Qa(d.schema,!1,!1,o,s,a,c),source:a,statusCode:u})}return Ug.json({description:l.description,schema:Qa(d.schema,!1,!1,o,s,a,c),responseProperty:jr(e.operation,mn.RESPONSE_PROPERTY),terminator:void 0,resumable:void 0,fullExamples:d.examples,source:a,statusCode:u})}for(let[f,m]of Object.entries(l.content??{})){let g=Qp.parse(f);if(g!=null){if(g.isOctetStream()||g.isPDF()||g.isAudio()||g.isImage()||g.isVideo()||g.isMultiPartMixed())return Ug.file({description:l.description,source:a,statusCode:u});if(g.isText()&&!f.includes("event-stream")){let A=m.schema,y=g.isPlainText()?void 0:f;if(A==null)return Ug.text({description:l.description,source:a,statusCode:u,contentType:y});let E=Gn(A)?o.resolveSchemaReference(A):A;return E.type==="string"&&E.format==="byte"?Ug.file({description:l.description,source:a,statusCode:u}):Ug.text({description:l.description,source:a,statusCode:u,contentType:y})}}}}function F8f({responses:e,context:t,source:r,namespace:n}){let i={};for(let[o,s]of Object.entries(e)){if(o==="default")continue;let a=r0c(o),c=a!=null,u=a??parseInt(o);if(u<400||u>600)continue;let l=Gn(s)?t.resolveResponseReference(s):s,p=hbc(l.content??{},t),d=c?Opo[u]:Tpo[u];if(d==null){t.logger.warn(`No error name found for status code ${o}`);continue}let f=t.options.namespacedErrors?jr(l,mn.SDK_NAMESPACE):void 0,m=c?o.toUpperCase():u.toString();i[m]={statusCode:u,isWildcardStatusCode:c?!0:void 0,nameOverride:void 0,generatedName:d,description:l.description,schema:Qa(p?.schema??{},!1,!1,t,[d,"Body"],r,f??n),fullExamples:p?.examples,namespace:f,source:r}}return i}var k8f,Bpo=h(()=>{"use strict";wt();Ac();fu();ID();zb();zl();Ppo();JZe();k8f=["200","201","202","204"]});function Xle({operationContext:e,context:t,responseStatusCode:r,suffix:n,streamFormat:i,streamTerminator:o,streamResumable:s,source:a,streamRequestNameOverride:c}){let{document:u,operation:l,path:p,method:d,baseBreadcrumbs:f,pathItem:m}=e,g=jr(l,mn.IDEMPOTENT),A=jr(l,[mn.REQUEST_NAME_V1,mn.REQUEST_NAME_V2]),y=[...f,"Request"],E=lRr({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:y,path:p,httpMethod:d,source:a}),x=/{([^}]+)}/g,v=[...p.matchAll(x)].map(ue=>ue[1]).filter(ue=>ue!==void 0),C=[...p.matchAll(x)].map(ue=>ue[1]);switch(t.options.pathParameterOrder){case wn.PathParameterOrder.SpecOrder:{let ue=C.filter(oe=>!E.pathParameters.some(de=>de.name===oe));if(ue.length>0)for(let oe of ue)E.pathParameters.push({name:oe??"",variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:a,schema:Wr.primitive({schema:Ui.string({default:void 0,example:void 0,format:void 0,maxLength:void 0,minLength:void 0,pattern:void 0}),description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0,availability:void 0,title:void 0}),description:void 0,explode:void 0,clientDefault:void 0})}break;case wn.PathParameterOrder.UrlOrder:if(v.length>0){let ue=new Map(E.pathParameters.map(we=>[we.name,we])),oe=[],de=new Set;for(let we of v){let De=ue.get(we);de.add(we),De?oe.push(De):oe.push({name:we,variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:a,schema:Wr.primitive({schema:Ui.string({default:void 0,example:void 0,format:void 0,maxLength:void 0,minLength:void 0,pattern:void 0}),description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0,availability:void 0,title:void 0}),description:void 0,explode:void 0,clientDefault:void 0})}for(let we of E.pathParameters)de.has(we.name)||oe.push(we);E.pathParameters=oe}break;default:Ee(t.options.pathParameterOrder)}let O=(()=>{if(e.method==="GET")return[void 0];if(!l.requestBody)return[void 0];let ue=Gn(l.requestBody)?t.resolveRequestBodyReference(l.requestBody):l.requestBody,oe=Object.values(ue.content).every(we=>N8f({mediaTypeObject:we})!=null),de=[];if(oe)return de.push(...Object.entries(ue.content).map(([we,De])=>{let se=hZ({mediaType:we,mediaTypeObject:De,description:ue.description,document:u,context:new HQe({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:y,source:a,namespace:t.namespace,bodyRequired:ue.required});return o0c({context:t,convertedParameters:E})&&se!=null&&(se.type==="json"||se.type==="formUrlEncoded")&&se.schema.type!=="object"&&l.requestBody!=null?se=hZ({mediaType:we,mediaTypeObject:De,description:ue.description,document:u,context:t,requestBreadcrumbs:[...y,"Body"],source:a,namespace:t.namespace,bodyRequired:ue.required}):l.requestBody!=null&&(se=hZ({mediaType:we,mediaTypeObject:De,description:ue.description,document:u,context:t,requestBreadcrumbs:[...y],source:a,namespace:t.namespace,bodyRequired:ue.required})),se}).filter(we=>we!=null)),de.length===0?[void 0]:de;{let we=fRr({content:ue.content,description:ue.description,document:u,context:new HQe({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:y,source:a,namespace:t.namespace,bodyRequired:ue.required});return o0c({context:t,convertedParameters:E})&&we!=null&&(we.type==="json"||we.type==="formUrlEncoded")&&we.schema.type!=="object"&&l.requestBody!=null?we=fRr({content:ue.content,description:ue.description,document:u,context:t,requestBreadcrumbs:[...y,"Body"],source:a,namespace:t.namespace,bodyRequired:ue.required}):l.requestBody!=null&&(we=fRr({content:ue.content,description:ue.description,document:u,context:t,requestBreadcrumbs:[...y],source:a,namespace:t.namespace,bodyRequired:ue.required})),[we]}})(),D=O.length>1,R=[...f,"Response"],P=dRr({operationContext:e,streamFormat:i,streamTerminator:o,streamResumable:s,responses:l.responses,context:t,responseBreadcrumbs:R,responseStatusCode:r,source:a}),M=_bc(l),J=Vbc(l),X=Mbc(e,l,t),$=jr(l,mn.SERVER_NAME_V2),ie=jr(l,mn.SUBTITLE);return O.map(ue=>({summary:l.summary,subtitle:ie??void 0,internal:jr(l,bP.INTERNAL),idempotent:g,audiences:jr(l,mn.AUDIENCES)??[],operationId:l.operationId!=null&&n!=null?l.operationId+"_"+n:l.operationId,tags:t.options.ignoreTags?[]:t.resolveTagsToTagIds(l.tags),namespace:t.namespace,sdkName:j8f({operationContext:e,request:ue}),pathParameters:E.pathParameters,queryParameters:E.queryParameters,headers:E.headers,requestNameOverride:c??A??void 0,generatedRequestName:M8f({baseBreadcrumbs:f,requestBreadcrumbs:y,isMultipleRequests:D,request:ue,context:t}),request:ue,response:P.value,errors:P.errors,servers:$!=null?[{name:$,url:void 0,audiences:void 0}]:(l.servers??m.servers??[]).map(oe=>uRr(oe,{groupMultiApiEnvironments:t.options.groupMultiApiEnvironments})),description:l.description,authed:z8f(l,u),security:Q8f(l),availability:J,method:d,path:p,examples:X,pagination:e.pagination,source:a,retries:M,globalParameterIds:Wbc(l)}))}function i0c({breadcrumbs:e,request:t}){return t?[...e,t.type]:e}function N8f({mediaTypeObject:e}){return jr(e,mn.SDK_METHOD_NAME)}function j8f({operationContext:e,request:t}){return!t||!t.sdkMethodName?e.sdkMethodName:e.sdkMethodName?{groupName:[...e.sdkMethodName.groupName],methodName:t.sdkMethodName??e.sdkMethodName.methodName}:{groupName:[],methodName:t.sdkMethodName}}function Q8f(e){return XDr(e.security)}function z8f(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function o0c({context:e,convertedParameters:t}){return e.options.inlinePathParameters&&t.pathParameters.length>0||t.queryParameters.length>0||t.headers.length>0}function M8f({baseBreadcrumbs:e,requestBreadcrumbs:t,isMultipleRequests:r,request:n,context:i}){let o=r?i0c({breadcrumbs:t,request:n}):t,s=HA(o,i.options.preserveSchemaIds);if(!i.options.disambiguateRequestNames)return s;let a=i.document.components?.schemas;if(a==null||!Object.keys(a).some(p=>HA([p],i.options.preserveSchemaIds)===s))return s;let u=[...e,"Body"],l=r?i0c({breadcrumbs:u,request:n}):u;return HA(l,i.options.preserveSchemaIds)}var mRr=h(()=>{"use strict";aa();wt();Ac();fu();pZ();zb();lpo();mpo();VQe();zl();Lbc();Ubc();Gbc();vpo();xpo();Cpo();Spo();Bpo()});function a0c({operationContext:e,context:t,asyncExtension:r,source:n}){let{operation:i,pathItemParameters:o,operationParameters:s}=e,a=r.discriminant.name,c=r.discriminant.value,u=r["response-status-code"],l=s0c({context:t,headerToIgnore:a,parameters:o}),p=s0c({context:t,headerToIgnore:a,parameters:s}),d=Xle({operationContext:{...e,pathItemParameters:l,operationParameters:p,operation:{...i,responses:Object.fromEntries(Object.entries(i.responses).filter(([m])=>parseInt(m)!==u))}},context:t,streamFormat:void 0,source:n}),f=Xle({operationContext:{...e,pathItemParameters:l,operationParameters:p,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:u,streamFormat:void 0,source:n});return f.forEach(m=>{m.headers.push({name:a,schema:Wr.literal({nameOverride:void 0,generatedName:HA([a],t.options.preserveSchemaIds),title:void 0,description:void 0,availability:void 0,value:Ty.string(c),namespace:void 0,groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:n,clientDefault:void 0})}),{sync:d,async:f}}function s0c({context:e,headerToIgnore:t,parameters:r}){return r.filter(n=>{let i=Gn(n)?e.resolveParameterReference(n):n;return!(i.in==="header"&&i.name===t)})}var c0c=h(()=>{"use strict";Ac();pZ();zb();mRr()});function f0c({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:Xle({operationContext:e,context:t,streamFormat:r.format,streamTerminator:r.terminator,streamResumable:r.resumable,source:t.source}),nonStreaming:[]};case"streamCondition":{let n=u0c({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0}),i=l0c({operation:e.operation,response:r.responseStream}),o=(()=>{if(r.streamRequestName!=null)return r.streamRequestName;if(n?.schemaReference!=null){let l=t.resolveSchemaReference(n.schemaReference),p=jr(l,mn.TYPE_NAME);if(p!=null)return`${p}Streaming`}})(),s=Xle({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+Dpo}:void 0,operation:{...e.operation,description:r.streamDescription??e.operation.description,requestBody:n?.requestBody,responses:i},baseBreadcrumbs:[...e.baseBreadcrumbs,Dpo]},context:t,streamFormat:r.format,streamTerminator:r.terminator,streamResumable:r.resumable,suffix:Dpo,source:t.source,streamRequestNameOverride:o});s.forEach(l=>{l.examples=l.examples.filter(p=>p0c(p,t)!==!1)});let a=u0c({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),c=l0c({operation:e.operation,response:r.response}),u=Xle({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:a?.requestBody,responses:c}},context:t,source:t.source});return u.forEach(l=>{l.examples=l.examples.filter(p=>p0c(p,t)!==!0)}),{streaming:s,nonStreaming:u}}default:Ee(r)}}function u0c({context:e,operation:t,streamingExtension:r,isStreaming:n}){if(t.requestBody==null)return;let i=Gn(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,o=Kjt({content:i.content,context:e});if(o==null)return;let s=Gn(o.schema)?e.resolveSchemaReference(o.schema):o.schema;if(s.allOf==null&&s.properties==null&&s.oneOf==null&&s.anyOf==null)return;let a=s.properties?.[r.streamConditionProperty];a!=null&&Gn(a)&&(a=void 0);let c={...s,properties:{...s.properties,[r.streamConditionProperty]:{...a??{},type:"boolean","x-fern-boolean-literal":n}},title:void 0,required:[...s.required??[],r.streamConditionProperty]};return{requestBody:{required:i.required,content:{[Qp.APPLICATION_JSON]:{schema:c}}},schemaReference:Gn(o.schema)?o.schema:void 0}}function l0c({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[Qp.APPLICATION_JSON]:{schema:t}}}}}function p0c(e,t){return e._visit({unknown:r=>{let n=Fd.serialization.ExampleEndpointCallSchema.parse(r);if(n.ok&&n.value.response!=null)return n.value.response.stream!=null},full:()=>{},_other:()=>{}})}var Dpo,d0c=h(()=>{"use strict";wt();lo();fu();zb();zl();JZe();mRr();Dpo="stream"});function L8f(e){return A0c.includes(e)}function V8f(e){switch(e){case"unix-seconds":return mm.WebhookTimestampFormat.UnixSeconds;case"unix-millis":return mm.WebhookTimestampFormat.UnixMillis;case"iso8601":return mm.WebhookTimestampFormat.Iso8601}}function m0c(e){if(e!=null)return{header:e.header,format:e.format!=null?V8f(e.format):void 0,tolerance:e.tolerance}}function h0c(e){if(e!=null)return{components:e.components.map(t=>{switch(t){case"body":return mm.WebhookPayloadComponent.Body;case"timestamp":return mm.WebhookPayloadComponent.Timestamp;case"notification-url":return mm.WebhookPayloadComponent.NotificationUrl;case"message-id":return mm.WebhookPayloadComponent.MessageId}}),delimiter:e.delimiter,bodySort:U8f(e["body-sort"])}}function U8f(e){if(e!=null&&e==="alphabetical")return mm.WebhookPayloadBodySort.Alphabetical}function _8f(e,t){if(e!=null){if(!L8f(e.algorithm)){t.warn(`Ignoring webhook body-hash-binding: unsupported algorithm "${e.algorithm}". Supported algorithms are: ${A0c.join(", ")}.`);return}if(e.location?.type!=="query-parameter"){t.warn(`Ignoring webhook body-hash-binding: unsupported location type "${e.location?.type}". The only supported location is "query-parameter".`);return}return{algorithm:q8f(e.algorithm),encoding:Rpo(e.encoding),location:W8f(e.location)}}}function G8f(e,t){if(e==null)return;let r=e["port-variants"],n=e["legacy-query-encoding"];if(r!=null&&typeof r!="boolean"){t.warn(`Ignoring webhook url-normalization: "port-variants" must be a boolean, got "${typeof r}".`);return}if(n!=null&&typeof n!="boolean"){t.warn(`Ignoring webhook url-normalization: "legacy-query-encoding" must be a boolean, got "${typeof n}".`);return}if(!r&&!n){t.warn('Ignoring webhook url-normalization: enable at least one of "port-variants" or "legacy-query-encoding".');return}return{portVariants:r??!1,legacyQueryEncoding:n??!1}}function q8f(e){switch(e){case"sha256":return mm.WebhookBodyHashAlgorithm.Sha256;case"sha1":return mm.WebhookBodyHashAlgorithm.Sha1;case"sha384":return mm.WebhookBodyHashAlgorithm.Sha384;case"sha512":return mm.WebhookBodyHashAlgorithm.Sha512;default:Ee(e)}}function W8f(e){if(e.type==="query-parameter")return mm.WebhookBodyHashLocation.queryParameter({name:e.name});Ee(e.type)}function H8f(e){if(e!=null)switch(e){case"sha256":return mm.WebhookSignatureAlgorithm.Sha256;case"sha1":return mm.WebhookSignatureAlgorithm.Sha1;case"sha384":return mm.WebhookSignatureAlgorithm.Sha384;case"sha512":return mm.WebhookSignatureAlgorithm.Sha512}}function Rpo(e){if(e!=null)switch(e){case"base64":return mm.WebhookSignatureEncoding.Base64;case"hex":return mm.WebhookSignatureEncoding.Hex}}function K8f(e){if(e!=null)switch(e){case"rsa-sha256":return mm.AsymmetricAlgorithm.RsaSha256;case"rsa-sha384":return mm.AsymmetricAlgorithm.RsaSha384;case"rsa-sha512":return mm.AsymmetricAlgorithm.RsaSha512;case"ecdsa-sha256":return mm.AsymmetricAlgorithm.EcdsaSha256;case"ecdsa-sha384":return mm.AsymmetricAlgorithm.EcdsaSha384;case"ecdsa-sha512":return mm.AsymmetricAlgorithm.EcdsaSha512;case"ed25519":return mm.AsymmetricAlgorithm.Ed25519}}function y0c(e,t){if(e.type==="hmac")return mm.WebhookSignatureVerification.hmac({header:e.header,algorithm:H8f(e.algorithm),encoding:Rpo(e.encoding),signaturePrefix:e["signature-prefix"],payloadFormat:h0c(e["payload-format"]),timestamp:m0c(e.timestamp),bodyHashBinding:_8f(e["body-hash-binding"],t),notificationUrlNormalization:G8f(e["url-normalization"],t)});if(e.type==="asymmetric"){let r=K8f(e["asymmetric-algorithm"]);return r==null?void 0:mm.WebhookSignatureVerification.asymmetric({header:e.header,asymmetricAlgorithm:r,encoding:Rpo(e.encoding),signaturePrefix:e["signature-prefix"],jwksUrl:e["jwks-url"],keyIdHeader:e["key-id-header"],payloadFormat:h0c(e["payload-format"]),timestamp:m0c(e.timestamp)})}}function g0c(e,t){let r=jr(e,mn.WEBHOOK_SIGNATURE);if(!(r==null||typeof r=="boolean"))return y0c(r,t)}function b0c(e,t,r){let n=jr(t,mn.WEBHOOK_SIGNATURE);return n!=null?typeof n=="boolean"?g0c(e,r):y0c(n,r):g0c(e,r)}var A0c,E0c=h(()=>{"use strict";wt();Ac();fu();zl();A0c=["sha256","sha1","sha384","sha512"]});function v0c({context:e,operationContext:t,source:r}){let{document:n,operation:i,path:o,method:s,baseBreadcrumbs:a,sdkMethodName:c}=t,u=[...a,"Payload"],l=[...a,"Response"],p=lRr({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:u,path:o,httpMethod:s,source:r});if(s!=="POST"&&s!=="GET")return e.logger.warn(`Skipping webhook ${s.toUpperCase()} ${o}: Only POST and GET methods are currently supported`),[];let d=i.operationId??Y8f({path:o,method:s,sdkMethodName:c}),f=i.responses?dRr({operationContext:t,streamFormat:void 0,responses:i.responses,context:e,responseBreadcrumbs:l,source:r}):void 0,m=b0c(n,i,e.logger);if(i.requestBody==null){if(p.queryParameters.length===0)return e.logger.error(`Skipping webhook ${s.toUpperCase()} ${o}: Missing a request body and no query parameters`),[];let A=p.queryParameters.map(x=>({key:x.name,schema:x.schema,readonly:void 0,writeonly:void 0,audiences:[],conflict:{},nameOverride:x.parameterNameOverride,generatedName:HA([...u,x.name],e.options.preserveSchemaIds),availability:x.availability,xml:void 0})),y=Wr.object({description:i.description,properties:A,nameOverride:void 0,generatedName:HA(u,e.options.preserveSchemaIds),title:void 0,allOf:[],allOfPropertyConflicts:[],namespace:e.namespace,groupName:void 0,fullExamples:void 0,additionalProperties:!1,availability:void 0,encoding:void 0,source:r,inline:void 0,minProperties:void 0,maxProperties:void 0});return[{summary:i.summary,audiences:jr(i,mn.AUDIENCES)??[],sdkName:c,namespace:e.namespace,method:s,operationId:d,tags:e.resolveTagsToTagIds(i.tags),headers:p.headers,generatedPayloadName:HA(u,e.options.preserveSchemaIds),payload:y,signatureVerification:m,multipartFormData:void 0,response:f?.value,description:i.description,examples:[],source:r}]}let g=Gn(i.requestBody)?e.resolveRequestBodyReference(i.requestBody):i.requestBody;return Object.entries(g.content).map(([A,y])=>hZ({mediaType:A,mediaTypeObject:y,description:g.description,document:n,context:e,requestBreadcrumbs:[...a,"Payload"],source:r,namespace:e.namespace,bodyRequired:g.required})).filter(A=>A!=null).map(A=>{if(A==null||A.type!=="json"&&A.type!=="formUrlEncoded"&&A.type!=="multipart"){e.logger.error(`Skipping webhook ${o} because non-json, non-formUrlEncoded, and non-multipart request body`);return}let y,E;return A.type==="multipart"?(y={name:A.name,properties:A.properties,description:A.description,source:A.source},E=Wr.unknown({nameOverride:void 0,generatedName:HA(u,e.options.preserveSchemaIds),title:void 0,description:A.description,availability:void 0,namespace:e.namespace,groupName:void 0,example:void 0})):E=A.schema,{summary:i.summary,audiences:jr(i,mn.AUDIENCES)??[],sdkName:c,namespace:e.namespace,method:s,operationId:d,tags:e.resolveTagsToTagIds(i.tags),headers:p.headers,generatedPayloadName:HA(u,e.options.preserveSchemaIds),payload:E,signatureVerification:m,multipartFormData:y,response:f?.value,description:i.description,examples:J8f(A.fullExamples),source:r}}).filter(A=>A!=null)}function J8f(e){if(e==null)return[];let t=[];for(let r of e){let n=K0e(r.value);n!=null&&t.push({description:r.description,name:r.name,payload:n})}return t}function Y8f({path:e,method:t,sdkMethodName:r}){if(r?.methodName!=null)return r.methodName;let n=X8f(e);if(n===e.toLowerCase())return e;let i=(0,I0c.createHash)("sha256").update(e).digest("hex").slice(0,8);return Z8f(`${n}_${t.toLowerCase()}_${i}`)}function X8f(e){return e.replace(/[{$}#]/g,"").replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/_+/g,"_").toLowerCase().slice(0,64)}function Z8f(e){return e.split("_").map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}var I0c,x0c=h(()=>{"use strict";Ac();I0c=require("crypto");fu();UDr();pZ();zb();zl();E0c();Cpo();Spo();Bpo()});function kpo({context:e,pathItemContext:t,operation:r,convertToWebhook:n}){let i=jr(r,mn.IGNORE);if(i!=null&&i){e.logger.debug(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let o=$8f(r,e),s=pbc(e.document,r),a={...t,sdkMethodName:o,baseBreadcrumbs:e9f({operation:r,sdkMethodName:o,httpMethod:t.method,path:t.path,shouldUseIdiomaticRequestNames:e.options.shouldUseIdiomaticRequestNames}),operation:r,operationParameters:r.parameters??[],pagination:s};if(n)return{type:"webhook",value:v0c({context:e,operationContext:a,source:e.source})};let c=abc(e.document,r);if(c==null&&t9f({operation:r,context:e})&&(c={type:"stream",format:"sse",terminator:void 0,resumable:cbc(r)??ppo(e.document)??!1}),c!=null){let p=f0c({context:e,operationContext:a,streamingExtension:c});return p!=null?{type:"streaming",streaming:p.streaming,nonStreaming:p.nonStreaming}:void 0}let u=ibc(r);if(u!=null){let p=a0c({context:e,operationContext:a,asyncExtension:u,source:e.source});return{type:"async",async:p.async,sync:p.sync}}return{type:"http",value:Xle({context:e,operationContext:a,streamFormat:void 0,source:e.source})}}function $8f(e,t){let r=jr(e,mn.SDK_METHOD_NAME),n=jr(e,mn.SDK_GROUP_NAME)??[];if(r!=null){let i=typeof n=="string"?[n]:n;return i=t.resolveGroupName(i),{groupName:i,methodName:r}}}function e9f({sdkMethodName:e,operation:t,httpMethod:r,path:n,shouldUseIdiomaticRequestNames:i}){let o=[];if(e!=null){if(i&&o.push(e.methodName),e.groupName.length>0){let s=e.groupName[e.groupName.length-1];s!=null&&o.push(typeof s=="string"?s:s.name)}i||o.push(e.methodName)}else t.operationId!=null?o.push(t.operationId):o.push(ti(`${r}_${n.split("/").join("_")}`));return o}function t9f({operation:e,context:t}){if(e.responses==null)return!1;for(let[r,n]of Object.entries(e.responses)){let i=parseInt(r);if(isNaN(i)||i<200||i>=300)continue;let o=Gn(n)?t.resolveResponseReference(n):n;if(o.content!=null&&mbc(o.content))return!0}return!1}var C0c=h(()=>{"use strict";Vi();fu();zb();zl();obc();ubc();fbc();JZe();c0c();mRr();d0c();x0c()});function w0c(e,t,r,n){let i=[],o=T0c(t),s={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let a of o){if(n.filter.skipEndpoint({method:a.method,path:e})){n.logger.debug(`Skipping endpoint "${a.method} ${e}"`);continue}let c=r9f({operation:a.operation}),u=kpo({context:n,pathItemContext:{...s,method:a.method},operation:a.operation,convertToWebhook:c});u&&i.push(u)}return i}function S0c(e,t,r,n){let i=[],o=T0c(t),s={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let a of o){if(n.filter.skipEndpoint({method:a.method,path:e})){n.logger.debug(`Skipping endpoint "${a.method} ${e}"`);continue}let c=kpo({context:n,pathItemContext:{...s,method:a.method},operation:a.operation,convertToWebhook:!0});c&&i.push(c)}return i}function T0c(e){let t=[];return e.get!=null&&t.push({method:E1.Get,operation:e.get}),e.post!=null&&t.push({method:E1.Post,operation:e.post}),e.put!=null&&t.push({method:E1.Put,operation:e.put}),e.delete!=null&&t.push({method:E1.Delete,operation:e.delete}),e.patch!=null&&t.push({method:E1.Patch,operation:e.patch}),e.head!=null&&t.push({method:E1.Head,operation:e.head}),t}function r9f({operation:e}){return jr(e,[mn.WEBHOOK])??!1}var O0c=h(()=>{"use strict";Ac();fu();zl();C0c()});function P0c(e){let t=jr(e,mn.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=jr(e,mn.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}var B0c=h(()=>{"use strict";fu();zl()});function D0c(e){return jr(e,mn.FERN_BASIC_AUTH)}var R0c=h(()=>{"use strict";fu();zl()});function F0c(e,t,r,n){if(Gn(e)){if(n==null)throw new S({message:`Converting referenced security schemes requires context: ${JSON.stringify(e)}`,code:S.Code.InternalError});let i=n.resolveSecuritySchemeReference(e);return k0c(i,t,r)}return k0c(e,t,r)}function k0c(e,t,r){try{if(e.type==="apiKey"&&e.in==="header"){let n=jr(e,bP.BEARER_FORMAT),i=jr(e,mn.FERN_HEADER_AUTH);return b1.header({headerName:e.name,prefix:n!=null?"Bearer":i?.prefix,headerVariableName:i?.name??jr(e,mn.HEADER_VARIABLE_NAME),headerEnvVar:i?.env,headerPlaceholder:i?.placeholder})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="bearer"){let n=jr(e,mn.FERN_BEARER_TOKEN);return b1.bearer({tokenVariableName:n?.name??jr(e,mn.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:n?.env,tokenPlaceholder:n?.placeholder})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="basic"){let n=D0c(e),i=P0c(e);return b1.basic({usernameVariableName:n?.username?.name??i.usernameVariable,usernameEnvVar:n?.username?.env,usernamePlaceholder:n?.username?.placeholder,passwordVariableName:n?.password?.name??i.passwordVariable,passwordEnvVar:n?.password?.env,passwordPlaceholder:n?.password?.placeholder})}else{if(e.type==="openIdConnect")return b1.bearer({tokenVariableName:void 0,tokenEnvVar:void 0,tokenPlaceholder:void 0});if(e.type==="oauth2")return b1.oauth({scopesEnum:n9f(e,t)})}}catch(n){r.logger.debug(`Error converting security scheme: ${n?.message}`)}r.logger.debug(`Skipping security scheme: ${JSON.stringify(e,null)} - not currently supported. Please reach out to Fern support team!`)}function n9f(e,t){let r=e.flows.authorizationCode?.scopes??e.flows.clientCredentials?.scopes??e.flows.implicit?.scopes??e.flows.password?.scopes;if(r!=null){let n=W0e({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([o,s])=>[o,{description:s}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsOptional:!1,wrapAsNullable:!1,namespace:void 0,groupName:void 0,context:void 0,source:t,inline:void 0}),i=ld(n);if(i.type==="enum")return i}}var N0c=h(()=>{"use strict";Ac();Ft();fu();kDr();VZe();zb();VQe();zl();B0c();R0c()});function j0c({document:e,context:t}){return Njt(e,mn.GROUPS,i9f,t.logger)}var i9f,Q0c=h(()=>{"use strict";jn();fu();zl();i9f=Be.record(Be.string(),Be.object({summary:Be.string().optional(),description:Be.string().optional()}))});function z0c({context:e,document:t}){return jr(t,mn.FERN_VERSION)??void 0}var M0c=h(()=>{"use strict";fu();zl()});function L0c(e){let t=jr(e,mn.FERN_GLOBAL_HEADERS),r=[];for(let n of t??[])r.push({header:n.header,name:n.name,optional:n.optional,env:n.env,clientDefault:n["x-fern-default"],schema:n.type!=null?Mjt({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}var V0c=h(()=>{"use strict";fu();zl();ODr()});function U0c(e){let t=jr(e,mn.FERN_IDEMPOTENCY_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?Mjt({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}var _0c=h(()=>{"use strict";fu();zl();ODr()});function G0c(e,t){let r=jr(e,mn.SDK_VARIABLES);return r==null?{}:Object.fromEntries(Object.entries(r).map(([n,i])=>{if(i.type==="string")return[n,{nameOverride:void 0,generatedName:HA([n],t),title:i.title,schema:Ku.string({default:_Ze(i),pattern:i.pattern,format:i.format,minLength:i.minLength,maxLength:i.maxLength}),description:i.description,availability:void 0,namespace:void 0,groupName:void 0}];throw new S({message:`Variable ${n} has unsupported schema ${JSON.stringify(i)}`,code:S.Code.ValidationError})}))}var q0c=h(()=>{"use strict";Ac();Ft();fu();$lo();pZ();zl()});function W0c(e){return jr(e,o9f)??{}}var o9f,H0c=h(()=>{"use strict";fu();o9f="webhooks"});var eQt,K0c=h(()=>{"use strict";dpo();mpo();eQt=class extends YZe{nonRequestReferencedSchemas=new Set;twoOrMoreRequestsReferencedSchemas=new Set;singleRequestReferencedSchemas=new Set;discriminatedUnionReferences={};discriminatedUnionMetadata={};schemasToExclude=new Set;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s}){super({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s})}getDummy(){return new HQe({document:this.document,taskContext:this.taskContext,options:this.options,source:this.source,namespace:this.namespace})}markSchemaAsReferencedByNonRequest(t){this.nonRequestReferencedSchemas.add(t)}markSchemaAsReferencedByRequest(t){this.singleRequestReferencedSchemas.has(t)?this.twoOrMoreRequestsReferencedSchemas.add(t):this.singleRequestReferencedSchemas.add(t)}getReferencedSchemas(){return new Set([...this.nonRequestReferencedSchemas,...this.twoOrMoreRequestsReferencedSchemas])}markReferencedByDiscriminatedUnion(t,r,n){let i=this.discriminatedUnionReferences[t.$ref];i!=null?(i.discriminants.add(r),i.numReferences+=n):this.discriminatedUnionReferences[t.$ref]={discriminants:new Set([r]),numReferences:n}}getReferencesFromDiscriminatedUnion(t){return this.discriminatedUnionReferences[t.$ref]}markSchemaWithDiscriminantValue(t,r,n){let i=this.discriminatedUnionMetadata[t.$ref];i!=null?i.discriminants.set(r,n):this.discriminatedUnionMetadata[t.$ref]={discriminants:new Map([[r,n]])}}getDiscriminatedUnionMetadata(t){return this.discriminatedUnionMetadata[t.$ref]}excludeSchema(t){this.schemasToExclude.add(t)}isSchemaExcluded(t){return this.schemasToExclude.has(t)}}});function J0c(e){return jr(e,mn.RESOLUTIONS)}var Y0c=h(()=>{"use strict";fu();zl()});function X0c({openapi:e}){let t=J0c(e);if(t==null)return e;let r={};for(let n of t){let i=`#/components/schemas/${n.name}`;for(let o of n.resolutions)e=s9f({openapi:e,schemaReference:o,schemaName:n.name}),e=Z0c({openapi:e,replaceReference:o,schemaReference:i,replacedReferences:r}),r={...r,...Object.fromEntries(n.resolutions.map(s=>[i,s]))}}return e}function s9f({openapi:e,schemaReference:t,schemaName:r}){let n=t.replace("#/","").split("/").map(o=>o.replaceAll("~1","/")),i=e;for(let o of n){let s=i[o];if(s==null)return e;i=s}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=i,e}function Z0c({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:n}){let i=Object.keys(n).filter(c=>t.startsWith(c)).sort((c,u)=>u.length-c.length)[0];if(i!=null){let c=n[i];if(c!=null){let u=r.replace(i,c);return Z0c({openapi:e,replaceReference:t,schemaReference:u,replacedReferences:{}})}}let o=t.replace("#/","").split("/").map(c=>c.replaceAll("~1","/")),s=e;for(let c of o.slice(0,-1)){let u=s[c];if(u==null)return e;s=u}let a=o[o.length-1];return a==null||(s[a]={$ref:r}),e}var $0c=h(()=>{"use strict";Y0c()});function tEc({openApi:e,taskContext:t,options:r,source:n,namespace:i}){e=zjt({document:e,options:r,logger:t.logger}),e=X0c({openapi:e}),MDr();let o=new eQt({document:e,taskContext:t,authHeaders:new Set,options:r,source:n,namespace:i}),s=Object.fromEntries(Object.entries(e.components?.securitySchemes??{}).map(([oe,de])=>{let we=F0c(de,n,t,o);return we==null?null:[oe,we]}).filter(oe=>oe!==null)),a=XDr(e.security?.filter(oe=>oe!=null)),c=new Set(Object.entries(s).map(([oe,de])=>de.type==="basic"||de.type==="bearer"||de.type==="oauth"?"Authorization":de.type==="header"?de.headerName:null).filter(oe=>oe!=null)),u=G0c(e,r.preserveSchemaIds),l=L0c(e),p=qbc(e),d=U0c(e),f=r.audiences??[],m=[],g=[],A=new eQt({document:e,taskContext:t,authHeaders:c,options:r,source:n,namespace:i});A.filter.hasEndpoints()&&t.logger.debug("Endpoint filter applied...");let y=LAc(e);if(y?.pathsIncludeBasePath){let oe=jjt({openApi:e,basePath:y.basePath,rootPathParameterNames:new Set(y.pathParameters.map(de=>de.name))});for(let de of oe)t.logger.warn(de)}let E=r.respectPerSpecBasePath&&y!=null&&y.pathParameters.length===0?y.basePath:void 0;Object.entries(e.paths??{}).forEach(([oe,de])=>{if(de==null)return;let we=w0c(oe,de,e,A);for(let De of we){let se=eEc({operation:De});if(!(f.length>0&&!f.some(ae=>se.includes(ae))))switch(De.type){case"async":m.push(...tQt(De.sync,E)),m.push(...tQt(De.async,E));break;case"http":m.push(...tQt(De.value,E));break;case"streaming":m.push(...tQt(De.streaming,E)),De.nonStreaming&&m.push(...tQt(De.nonStreaming,E));break;case"webhook":g.push(...De.value);break;default:Ee(De)}}}),Object.entries(W0c(e)).forEach(([oe,de])=>{if(de==null)return;t.logger.debug(`Converting path ${oe}`);let we=S0c(oe,de,e,A);for(let De of we){let se=eEc({operation:De});f.length>0&&!f.some(ae=>se.includes(ae))||g.push(...De.value)}});let x=Object.fromEntries(Object.entries(e.components?.schemas??{}).map(([oe,de])=>{let we=jr(de,mn.SDK_NAMESPACE);if(!Gn(de)){let De=jr(de,mn.IGNORE);if(De!=null&&De)return[];if(t0c.has(oe))return[oe,Qa({...de,"x-fern-type-name":`${oe}Body`},!1,!1,A,[oe],n,we??i)]}return[oe,Qa(de,!1,!1,A,[oe],n,we??i)]}).filter(oe=>oe.length>0)),v=a9f(x,A,n),C=l9f(v,A),O=lZ(),D={};for(let[oe,de]of Object.entries(C)){let we=ld(de);if(A.isSchemaExcluded(oe))continue;let De=O.getUniqueSchemaId(oe,A.logger,r.resolveSchemaCollisions);D[De]=we}let R=new J0e(C,A.nonRequestReferencedSchemas,A),P=g.map(oe=>{let we=oe.examples;if(!r.disableExamples&&we.length===0){let De=R.buildExample({schema:oe.payload,exampleId:void 0,example:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});De!=null&&(we=[{name:void 0,description:void 0,payload:De}])}return{...oe,payload:ld(oe.payload),examples:we}}),M=new qDr(C,A,l),J=m.map(oe=>{let de=oe.examples,we=de;if(!r.disableExamples&&(de.length===0||de.every(Wjt))){let ae=M.buildEndpointExample(oe);ae.length>0&&(we=[...ae,...de.filter(Oe=>!Wjt(Oe))])}let De=oe.request,se=oe.response;return{...oe,request:De?.type==="json"||De?.type==="formUrlEncoded"?{...De,schema:ld(De.schema)}:De,response:se?.type==="json"?{...se,schema:ld(se.schema)}:se,queryParameters:oe.queryParameters.map(ae=>({description:ae.description,name:ae.name,schema:ld(ae.schema),parameterNameOverride:ae.parameterNameOverride,explode:ae.explode,availability:ae.availability,source:ae.source,clientDefault:ae.clientDefault})),pathParameters:oe.pathParameters.map(ae=>({description:ae.description,name:ae.name,schema:ld(ae.schema),parameterNameOverride:ae.parameterNameOverride,variableReference:ae.variableReference,availability:ae.availability,source:ae.source,clientDefault:ae.clientDefault})),headers:oe.headers.map(ae=>({description:ae.description,name:ae.name,schema:ld(ae.schema),parameterNameOverride:ae.parameterNameOverride,env:ae.env,availability:ae.availability,source:ae.source,clientDefault:ae.clientDefault})),examples:we,errors:up(oe.errors,ae=>{let Oe=ae.fullExamples?.map(Ie=>{let Fe=K0e(Ie.value);if(Fe!=null)return{name:Ie.name,description:Ie.description,example:Fe}}).filter(sa);if(Oe?.length===0){let Ie=R.buildExample({schema:ae.schema,example:void 0,exampleId:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});Ie!=null&&Oe.push({name:void 0,description:void 0,example:Ie})}return{generatedName:ae.generatedName,nameOverride:ae.nameOverride,isWildcardStatusCode:ae.isWildcardStatusCode,schema:ld(ae.schema),description:ae.description,source:ae.source,examples:Oe,namespace:ae.namespace}}),retries:oe.retries,globalParameterIds:oe.globalParameterIds}});M.finalize();let X=j0c({document:e,context:A}),$=jr(e,mn.BASE_URL_ENV),ie;return $!=null&&(typeof $=="string"&&$.length>0?ie=$:t.logger.warn(`Expected a non-empty string value for ${mn.BASE_URL_ENV}; ignoring.`)),{apiVersion:z0c({context:A,document:e}),specVersion:e.info.version!=null&&e.info.version.length>0?e.info.version:void 0,baseUrlEnv:ie,basePath:y!=null&&(!r.respectPerSpecBasePath||y.pathParameters.length>0)?y.basePath:void 0,basePathParameters:y!=null&&y.pathParameters.length>0?y.pathParameters:void 0,title:e.info.title??"",description:e.info.description,groups:Object.fromEntries(Object.entries(X??{}).map(([oe,de])=>[oe,{summary:de.summary??void 0,description:de.description??void 0}])),servers:(e.servers??[]).map(oe=>uRr(oe,{groupMultiApiEnvironments:r.groupMultiApiEnvironments})),websocketServers:[],tags:{tagsById:Object.fromEntries((e.tags??[]).map(oe=>[oe.name,{id:oe.name,description:oe.description}])),orderedTagIds:e.tags?.map(oe=>oe.name)},endpoints:J,webhooks:P,channels:{},groupedSchemas:qZe(i,D),securitySchemes:s,security:a,hasEndpointsMarkedInternal:J.some(oe=>oe.internal),nonRequestReferencedSchemas:A.getReferencedSchemas(),variables:u,globalHeaders:l,globalParameters:p.length>0?p:void 0,idempotencyHeaders:d}}function a9f(e,t,r){if(t.options.removeDiscriminantsFromSchemas===wn.RemoveDiscriminantsFromSchemas.Never)return e;let n=u9f(e,t),i={};for(let[o,s]of Object.entries(e)){if(s.type!=="object"){i[o]=s;continue}let a={$ref:`#/components/schemas/${o}`},c=t.getReferencesFromDiscriminatedUnion(a);if(c==null){i[o]=s;continue}if(t.getReferencedSchemas().has(o)){i[o]=s;continue}let l={...s,type:"object",properties:s.properties.filter(d=>!c.discriminants.has(d.key)),allOfPropertyConflicts:s.allOfPropertyConflicts.filter(d=>!c.discriminants.has(d.propertyKey)),source:r};i[o]=l;let p=Fpo({schema:s,schemas:e});for(let d of[...new Set(p)]){if(n.has(d))continue;let f=i[d]??e[d];f==null||f.type!=="object"||(i[d]={...f,type:"object",properties:f.properties.filter(m=>!c.discriminants.has(m.key)),allOfPropertyConflicts:f.allOfPropertyConflicts.filter(m=>!c.discriminants.has(m.propertyKey))})}}return i}function c9f(e,t){if(t==null||t==="/")return e;let r=t.replace(/\/+$/,"");if(e===r||e.startsWith(`${r}/`))return e;let n=e.replace(/^\/+/,"");return n.length>0?`${r}/${n}`:r}function tQt(e,t){return t==null||t==="/"?e:e.map(r=>({...r,path:c9f(r.path,t)}))}function u9f(e,t){let r=new Set;for(let[n,i]of Object.entries(e)){if(i.type!=="object")continue;let o={$ref:`#/components/schemas/${n}`};if(t.getReferencesFromDiscriminatedUnion(o)==null)for(let s of Fpo({schema:i,schemas:e}))r.add(s)}return r}function l9f(e,t){let r={};for(let[n,i]of Object.entries(e)){if(i.type!=="object"){r[n]=i;continue}let o={$ref:`#/components/schemas/${n}`},s=t.getDiscriminatedUnionMetadata(o);if(s==null){r[n]=i;continue}let a=[];for(let u of i.properties)if(s.discriminants.has(u.key)){let l=s.discriminants.get(u.key);l!=null&&a.push({...u,schema:Wr.literal({nameOverride:void 0,generatedName:HA([i.generatedName,l],t.options.preserveSchemaIds),title:void 0,value:Ty.string(l),namespace:void 0,groupName:void 0,description:void 0,availability:i.availability})})}else a.push(u);let c={...i,type:"object",properties:a};r[n]=c}return r}function Fpo({schema:e,schemas:t}){let r=[];for(let n of e.allOf){r.push(n.schema);let i=t[n.schema];i!=null&&i.type==="object"&&r.push(...Fpo({schema:i,schemas:t}))}return r}function hRr(e){return[...new Set(e)]}function eEc({operation:e}){let t=[];switch(e.type){case"async":t=hRr(e.async.flatMap(r=>r.audiences));break;case"http":t=hRr(e.value.flatMap(r=>r.audiences));break;case"streaming":t=hRr(e.streaming.flatMap(r=>r.audiences));break;case"webhook":t=hRr(e.value.flatMap(r=>r.audiences));break;default:Ee(e)}return t}var rEc=h(()=>{"use strict";aa();wt();Ac();Vi();fu();ID();UDr();_Dr();VZe();pZ();zb();VDr();lpo();Ljt();O0c();N0c();xpo();Ppo();opo();zl();Dlo();Q0c();M0c();V0c();vpo();_0c();q0c();Flo();H0c();ipo();K0c();$0c()});function lze({context:e,documents:t,options:r}){let n={apiVersion:void 0,specVersion:void 0,baseUrlEnv:void 0,title:void 0,description:void 0,basePath:void 0,basePathParameters:void 0,servers:[],websocketServers:[],tags:{tagsById:{},orderedTagIds:void 0},hasEndpointsMarkedInternal:!1,endpoints:[],webhooks:[],channels:{},groupedSchemas:{rootSchemas:{},namespacedSchemas:{}},variables:{},nonRequestReferencedSchemas:new Set,securitySchemes:{},security:void 0,globalHeaders:[],globalParameters:void 0,idempotencyHeaders:[],groups:{}},i=0;for(let o of t)try{let s=o.source!=null?o.source:bD.openapi({file:"<memory>"});switch(o.type){case"openapi":{let a=tEc({taskContext:e,openApi:o.value,options:GU({options:o.settings,overrides:r}),source:s,namespace:o.namespace});n=y9f(n,a,GU({options:o.settings,overrides:r}),e),i++;break}case"asyncapi":{let a=rbc({document:o.value,taskContext:e,options:GU({options:o.settings,overrides:r}),source:s,asyncApiOptions:p9f({options:o.settings}),namespace:o.namespace});a.servers!=null&&(n.websocketServers=[...n.websocketServers,...a.servers.map(c=>({...c,audiences:void 0,description:void 0,defaultUrl:void 0,urlTemplate:void 0,variables:void 0}))]),a.channels!=null&&(n.channels={...n.channels,...a.channels}),a.groupedSchemas!=null&&(n.groupedSchemas=gRr(n.groupedSchemas,a.groupedSchemas,r)),a.basePath!=null&&(n.basePath=a.basePath),i++;break}default:Ee(o)}}catch(s){e.logger.error(`Failed to parse ${o.type} document ${o.type==="openapi"?o.value.info?.title:o.source?.file}`),s instanceof Error&&e.logger.error(s.message,s.stack?`
210
+ `);try{WZe.writeFileSync(n,i,"utf8"),this.logger.info(`Missing examples report written to: ${n}`)}catch(o){this.logger.warn(`Failed to write missing examples report to ${n}:`,String(o))}}finalize(){}convertExampleToJson(t){switch(t.type){case"primitive":return t.value;case"array":return t.value.map(r=>this.convertExampleToJson(r));case"object":{let r={};return Object.entries(t.properties).forEach(([n,i])=>{r[n]=this.convertExampleToJson(i)}),r}case"map":{let r={};return t.value.forEach(n=>{r[String(n.key)]=this.convertExampleToJson(n.value)}),r}case"oneOf":if(t.value.type==="undiscriminated")return this.convertExampleToJson(t.value.value);{let r={};return Object.entries(t.value.value).forEach(([n,i])=>{r[n]=this.convertExampleToJson(i)}),r}case"enum":return t.value;case"literal":return t.value;case"null":return null;case"unknown":return this.convertExampleToJson(t.value);default:return t}}getSchemaDescription(t){if("description"in t)return t.description}getSchemaTypeName(t){switch(t.type){case"primitive":return`primitive (${t.schema.type})`;case"object":return t.generatedName||"object";case"array":return"array";case"map":return"map";case"optional":return`optional (${this.getSchemaTypeName(t.value)})`;case"nullable":return`nullable (${this.getSchemaTypeName(t.value)})`;case"reference":return t.generatedName||"reference";case"enum":return t.generatedName||"enum";case"literal":return"literal";case"oneOf":return"oneOf";case"unknown":return"unknown";default:return"unknown"}}buildEndpointExample(t){let r=W_f(t.request),n=H_f(t.response);if(r?.type==="unsupported"||n?.type==="unsupported")return[];let i=[];if(r!=null&&r.type==="present"){let p=this.isSchemaRequired(r.schema);if(r.examples.length===0){let d=this.exampleTypeFactory.buildExample({skipReadonly:npo(t.method),schema:r.schema,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});d!=null?(i.push([void 0,d]),this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),"No user-provided examples found in OpenAPI spec",{schemaDescription:this.getSchemaDescription(r.schema),autoGeneratedExample:this.convertExampleToJson(d)})):this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),"Auto-generation failed (schema too complex or circular references)",{schemaDescription:this.getSchemaDescription(r.schema)})}else for(let{name:d,value:f}of r.examples){let m=this.exampleTypeFactory.buildExample({skipReadonly:npo(t.method),schema:r.schema,exampleId:d,example:f,options:{isParameter:!1,ignoreOptionals:!0}});m!=null?i.push([d,m]):this.addMissingExampleRecord(t,"request",this.getSchemaTypeName(r.schema),`Failed to build example from provided data (example id: ${d})`,{schemaDescription:this.getSchemaDescription(r.schema)})}if(p&&i.length===0)return this.logger.trace(`Failed to generate required request example for ${t.method.toUpperCase()} ${t.path}`),[]}let o=[];if(n!=null&&n.type==="present"){let p=this.isSchemaRequired(n.schema);if(n.examples.length===0){let d=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:void 0,example:void 0,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});d!=null?(t.response?.type==="json"?o.push([void 0,VU.withoutStreaming(d)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&o.push([void 0,VU.withStreaming({sse:t.response?.type==="streamingSse",events:[d]})]),this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),"No user-provided examples found in OpenAPI spec",{schemaDescription:this.getSchemaDescription(n.schema),autoGeneratedExample:this.convertExampleToJson(d)})):this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),"Auto-generation failed (schema too complex or circular references)",{schemaDescription:this.getSchemaDescription(n.schema)})}else for(let{name:d,value:f}of n.examples){let m=this.exampleTypeFactory.buildExample({skipReadonly:!1,schema:n.schema,exampleId:d,example:f,options:{maxDepth:this.context.options.exampleGeneration?.response?.["max-depth"]??3,isParameter:!1,ignoreOptionals:!1}});m!=null?t.response?.type==="json"?o.push([d,VU.withoutStreaming(m)]):(t.response?.type==="streamingJson"||t.response?.type==="streamingSse")&&o.push([void 0,VU.withStreaming({sse:t.response?.type==="streamingSse",events:[m]})]):this.addMissingExampleRecord(t,"response",this.getSchemaTypeName(n.schema),`Failed to build example from provided data (example id: ${d})`,{schemaDescription:this.getSchemaDescription(n.schema)})}if(p&&o.length===0)return this.logger.trace(`Failed to generate required response example for ${t.method.toUpperCase()} ${t.path}`),[]}let s=[];for(let p of t.pathParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!SW(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for path parameter ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&s.push({name:p.name,parameterNameOverride:p.parameterNameOverride,value:f})}let a=[];for(let p of t.queryParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!SW(f)&&f.type!=="array"&&(this.logger.debug(`Expected a primitive or array example but got ${f.type} for query parameter ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&a.push({name:p.name,value:f})}let c=[];for(let p of t.headers){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:void 0,options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});if(f!=null&&!SW(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for header ${p.name} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),d&&f==null)return[];f!=null&&c.push({name:p.name,value:f})}for(let p of this.globalHeaders){let d=p.schema!=null?HU(p.schema):Wr.primitive({nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,schema:Ui.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})}),f=this.exampleTypeFactory.buildExample({schema:d,exampleId:void 0,example:void 0,options:{name:p.header,isParameter:!0,ignoreOptionals:!0}});f!=null&&!SW(f)&&(this.logger.debug(`Expected a primitive example but got ${f.type} for global header ${p.header} for ${t.method.toUpperCase()} ${t.path}`),f=void 0),f!=null&&c.push({name:p.header,value:f})}let u=[];t.request!=null&&t.response!=null?u=q_f(i,o):t.request!=null?u=i.map(([p,d])=>({id:p,request:d,response:void 0})):t.response!=null&&(u=o.map(([p,d])=>({id:p,request:void 0,response:d})));let l=t.examples.filter(p=>Wjt(p)).flatMap(p=>{if(p.type==="unknown"){if(p.value!=null){let d=p.value["code-samples"];if(d!=null)return this.convertCodeSamples(d)}return}else return p.codeSamples}).filter(p=>sa(p));return u.length===0?[LU.full({name:void 0,description:void 0,pathParameters:s,queryParameters:a,headers:c,request:void 0,response:void 0,codeSamples:l})]:u.map(({id:p,request:d,response:f})=>LU.full({name:p,description:void 0,pathParameters:s,queryParameters:a,headers:c,request:d,response:f,codeSamples:l}))}convertCodeSamples(t){return t.map(r=>"language"in r?$X.language({name:r.name??void 0,description:r.docs??void 0,language:r.language,code:r.code,install:r.install??void 0}):$X.sdk({name:r.name??void 0,description:r.docs??void 0,sdk:r.sdk==="c#"?I1.Csharp:r.sdk,code:r.code})).filter(sa)}isSchemaRequired(t){return GDr(this.getResolvedSchema(t))}getResolvedSchema(t){return t}}});var HZe,spo=h(()=>{"use strict";Ft();opo();ID();_Dr();zb();rpo();HZe=class{exampleTypeFactory;schemas;constructor(t,r){this.exampleTypeFactory=new J0e(t,new Set,r),this.schemas=t}buildWebsocketSessionExamplesForExtension({context:t,extensionExamples:r,handshake:n,source:i,namespace:o}){let s=[];for(let a of r){let c=[];for(let p of n.queryParameters){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:a.queryParameters?.[p.name],options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});f!=null&&!SW(f)&&(f=void 0),!(d&&f==null)&&f!=null&&c.push({name:p.name,value:f})}let u=[];for(let p of n.headers){let d=this.isSchemaRequired(p.schema),f=this.exampleTypeFactory.buildExample({schema:p.schema,exampleId:void 0,example:a.headers?.[p.name],options:{name:p.name,isParameter:!0,ignoreOptionals:!0}});f!=null&&!SW(f)&&(f=void 0),!(d&&f==null)&&f!=null&&u.push({name:p.name,value:f})}let l=[];for(let p of a.messages){let d=t.getExampleMessageReference(p),f=t.resolveMessageReference({$ref:d}),m=Gn(f.payload)?t.resolveSchemaReference(f.payload):f.payload,g=this.exampleTypeFactory.buildExample({schema:Qa(m,!1,!1,t,[p.messageId],i,o),exampleId:void 0,example:p.value,options:{isParameter:!1,ignoreOptionals:!0}});g!=null&&l.push({messageType:p.type,payload:g,description:void 0})}s.push({name:a.summary,queryParameters:c,headers:u,description:a.description,messages:l})}return s}buildWebsocketSessionExample({handshake:t,messages:r}){let n={name:void 0,queryParameters:[],headers:[],description:void 0,messages:[]},i=[];for(let s of t.queryParameters){let a=this.isSchemaRequired(s.schema),c=this.exampleTypeFactory.buildExample({schema:s.schema,exampleId:void 0,example:void 0,options:{name:s.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!SW(c)&&(c=void 0),a&&c==null)return;c!=null&&i.push({name:s.name,value:c})}let o=[];for(let s of t.headers){let a=this.isSchemaRequired(s.schema),c=this.exampleTypeFactory.buildExample({schema:s.schema,exampleId:void 0,example:void 0,options:{name:s.name,isParameter:!0,ignoreOptionals:!0}});if(c!=null&&!SW(c)&&(c=void 0),a&&c==null)return;c!=null&&o.push({name:s.name,value:c})}for(let s of r){let a=this.exampleTypeFactory.buildExample({schema:s.payload,exampleId:void 0,example:void 0,options:{isParameter:!1,ignoreOptionals:!0}});a!=null&&n.messages.push({messageType:s.type,payload:a,description:void 0})}return n}isSchemaRequired(t){return GDr(this.getResolvedSchema(t))}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new S({message:`Unexpected error: Failed to resolve schema reference: ${t.schema}`,code:S.Code.InternalError});t=r}return t}}});var Py,WDr=h(()=>{"use strict";Py={FERN_PARAMETER_OPTIONAL:"x-fern-optional",FERN_CHANNEL_ADDRESS:"x-fern-address",FERN_DISPLAY_NAME:"x-fern-display-name",FERN_SDK_GROUP_NAME:"x-fern-sdk-group-name",FERN_SDK_METHOD_NAME:"x-fern-sdk-method-name",FERN_EXAMPLES:"x-fern-examples",BASE_PATH:"x-fern-base-path",FERN_ENUM:"x-fern-enum",IGNORE:"x-fern-ignore",FERN_PARAMETER_NAME:"x-fern-parameter-name",FERN_SERVER_NAME:"x-fern-server-name"}});function HDr(e){return jr(e,Py.FERN_EXAMPLES)??[]}var apo=h(()=>{"use strict";fu();WDr()});function KDr(e,t){return t.includes("://")?t:`${e}://${t}`}function JDr(e){return e.startsWith("/")?e:"/"+e}var cpo=h(()=>{"use strict"});function Kyc({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){let o={},s={};for(let[u,l]of Object.entries(i.components?.schemas??{})){let p=Qa(l,!1,!1,e,[u],r,e.namespace);o[u]=p}let a=new HZe(o,e),c={};for(let[u,l]of Object.entries(i.servers??{})){let p=jr(l,Py.FERN_SERVER_NAME);c[u]={name:p??u,url:KDr(l.protocol,l.url)}}for(let[u,l]of Object.entries(i.channels??{})){let p=jr(l,Py.IGNORE);if(p!=null&&p){e.logger.debug(`Channel ${u} is marked with x-fern-ignore. Skipping.`);continue}let d=[];if(l.parameters!=null)for(let[y,E]of Object.entries(l.parameters??{})){let x=jr(E,Py.FERN_PARAMETER_NAME);d.push({name:y,description:E.description,parameterNameOverride:x,schema:E.schema!=null?Qa(E.schema,!1,!1,e,t,r,e.namespace):Wr.primitive({schema:Ui.string({default:void 0,pattern:void 0,format:void 0,maxLength:void 0,minLength:void 0,example:void 0}),description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}),variableReference:void 0,availability:Hv(E),source:r,explode:void 0,clientDefault:void 0})}let f=[],m=[];if(l.bindings?.ws!=null){if(l.bindings.ws.headers!=null){let y=l.bindings.ws.headers.required??[];for(let[E,x]of Object.entries(l.bindings.ws.headers.properties??{})){if(Gn(x)){let D=e.resolveSchemaReference(x),R=y.includes(E),[P,M]=e.options.coerceOptionalSchemasToNullable?[!1,!R]:[!R,!1];f.push({name:E,schema:G6(x,P,M,e,t,void 0,r,e.namespace),description:D.description,parameterNameOverride:void 0,env:void 0,availability:Hv(D),source:r,clientDefault:void 0});continue}let v=y.includes(E),[C,O]=e.options.coerceOptionalSchemasToNullable?[!1,!v]:[!v,!1];f.push({name:E,schema:Qa(x,C,O,e,[...t,E],r,e.namespace),description:x.description,parameterNameOverride:void 0,env:void 0,availability:Hv(x),source:r,clientDefault:void 0})}}if(l.bindings.ws.query!=null){let y=l.bindings.ws.query.required??[];for(let[E,x]of Object.entries(l.bindings.ws.query.properties??{})){if(Gn(x)){let D=e.resolveSchemaReference(x),R=y.includes(E),[P,M]=e.options.coerceOptionalSchemasToNullable?[!1,!R]:[!R,!1];m.push({name:E,schema:G6(x,P,M,e,t,void 0,r,e.namespace),description:D.description,parameterNameOverride:void 0,availability:Hv(D),source:r,explode:void 0,clientDefault:void 0});continue}let v=y.includes(E),[C,O]=e.options.coerceOptionalSchemasToNullable?[!1,!v]:[!v,!1];m.push({name:E,schema:Qa(x,C,O,e,[...t,E],r,e.namespace),description:x.description,parameterNameOverride:void 0,availability:Hv(x),source:r,explode:void 0,clientDefault:void 0})}}}let g;l.publish!=null&&("oneOf"in l.publish.message?g=Wyc({generatedName:l.publish.operationId??"PublishEvent",event:l.publish,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):g=Hyc({action:"Publish",channelPath:u,message:l.publish.message,context:e,source:r}));let A;if(l.subscribe!=null&&("oneOf"in l.subscribe.message?A=Wyc({generatedName:l.subscribe.operationId??"SubscribeEvent",event:l.subscribe,breadcrumbs:t,context:e,source:r,options:e.options,asyncApiOptions:n}):A=Hyc({action:"Subscribe",channelPath:u,message:l.subscribe.message,context:e,source:r})),f.length>0||m.length>0||g!=null||A!=null){let y=HDr(l),E=[];if(y.length>0)E=a.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:y,handshake:{headers:f,queryParameters:m},source:r,namespace:e.namespace});else{let O=[];g!=null&&O.push({type:"publish",payload:g}),A!=null&&O.push({type:"subscribe",payload:A});let D=a.buildWebsocketSessionExample({handshake:{headers:f,queryParameters:m},messages:O});D!=null&&E.push(D)}let x=jr(l,Py.FERN_CHANNEL_ADDRESS),v=x??JDr(u),C=[];g!=null&&C.push({origin:"client",name:"publish",displayName:l.publish!=null?jr(l.publish,Py.FERN_DISPLAY_NAME):void 0,description:l.publish?.description,body:ld(g),methodName:l.publish!=null?jr(l.publish,Py.FERN_SDK_METHOD_NAME):void 0}),A!=null&&C.push({origin:"server",name:"subscribe",displayName:l.subscribe!=null?jr(l.subscribe,Py.FERN_DISPLAY_NAME):void 0,description:l.subscribe?.description,body:ld(A),methodName:l.subscribe!=null?jr(l.subscribe,Py.FERN_SDK_METHOD_NAME):void 0}),s[u]={audiences:jr(l,mn.AUDIENCES)??[],handshake:{headers:f.map(O=>({...O,schema:ld(O.schema),env:O.env})),queryParameters:m.map(O=>({...O,schema:ld(O.schema)})),pathParameters:d.map(O=>({...O,schema:ld(O.schema)}))},groupName:e.resolveGroupName([jr(l,Py.FERN_SDK_GROUP_NAME)??u]),messages:C,servers:(l.servers?.map(O=>c[O])??Object.values(c)).filter(O=>O!=null&&O.name!=null).map(O=>({...O,name:O.name})),summary:jr(l,Py.FERN_DISPLAY_NAME),connectMethodName:jr(l,Py.FERN_SDK_METHOD_NAME),path:v,description:l.description,examples:E,source:r}}}return{groupedSchemas:qZe(e.namespace,o),channels:s??void 0,servers:Object.values(c).map(u=>({...u,name:u.name})),basePath:jr(i,Py.BASE_PATH)}}function Wyc({generatedName:e,event:t,context:r,breadcrumbs:n,source:i,options:o,asyncApiOptions:s}){if("oneOf"in t.message&&t.message.oneOf!=null){let a=[],c=[];for(let u of t.message.oneOf){let l,p={type:"notFound"};if(Gn(u)){let d=r.resolveMessageReference(u);!Gn(d.payload)&&s.naming==="v2"?(p=d.name?{type:"name",name:d.name}:p,l={...d.payload,title:d.name??d.payload.title,description:d.name??d.payload.description}):l=d.payload}else l=u;c.push(p),a.push(l)}return H0e({description:t.description??t.message.description,availability:Hv(t.message),subtypes:a,nameOverride:t.operationId,generatedName:e,title:t.message.title,groupName:void 0,wrapAsOptional:!1,wrapAsNullable:!1,breadcrumbs:n,context:r,encoding:void 0,source:i,namespace:r.namespace,subtypeSuffixOverrides:s.naming==="v2"?c:[]})}}function Hyc({action:e,channelPath:t,message:r,context:n,source:i}){if(r.payload!=null){let o=r.payload;return Gn(r.payload)&&(o=n.resolveSchemaReference(r.payload)),Qa(o,!1,!1,n,[t,e],i,n.namespace)}}var Jyc=h(()=>{"use strict";Ac();fu();zl();LZe();ID();Zlo();VZe();zb();VDr();spo();WDr();apo();cpo()});var YDr,Yyc=h(()=>{"use strict";Ft();tpo();YDr=class extends GZe{getExampleMessageReference(t){let r=t.channelId??this.getDefaultChannelId();if(r==null)throw new S({message:"Cannot resolve example message reference: no channelId provided and no channels found in document",code:S.Code.InternalError});return`#/channels/${r}/messages/${t.messageId}`}getDefaultChannelId(){return Object.keys(this.document.channels??{})[0]}resolveParameterReference(t){let r="#/components/parameters/";if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(r))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let n=t.$ref.substring(r.length),i=this.document.components.parameters[n];if(i==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return"$ref"in i?this.resolveParameterReference(i):i}resolveMessageReference(t,r=!1){let n="#/channels/",i="#/components/messages/";if(t==null)throw new S({message:"Cannot resolve message reference: message is null or undefined",code:S.Code.InternalError});if(!t.$ref)throw new S({message:"Cannot resolve message reference: message.$ref is undefined or empty",code:S.Code.ReferenceError});if(t.$ref.startsWith(n)){let c=t.$ref.split("/"),u=c[2],l=c[4],p=u?.replace(/~1/g,"/").replace(/~0/g,"~");if(p==null||l==null||!this.document.channels?.[p])throw new S({message:`Failed to resolve message reference ${t.$ref} in channel ${p}`,code:S.Code.ReferenceError});let f=this.document.channels[p].messages?.[l];if(f==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return"$ref"in f&&!r?this.resolveMessageReference(f):{...f,name:l}}let o=this.document.components;if(!t.$ref.startsWith(i)||!o?.messages)throw new S({message:`Failed to resolve message reference: ${t.$ref} in v3 components`,code:S.Code.ReferenceError});let s=t.$ref.substring(i.length),a=o.messages[s];if(a==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return{...a,name:s}}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}}});function ebc({context:e,breadcrumbs:t,source:r,asyncApiOptions:n,document:i}){MDr();let o={},s={},a={},c=[],u={};e.logger.debug("Parsing V3 AsyncAPI...");let l=lZ();for(let[D,R]of Object.entries(i.components?.schemas??{})){let P=l.getUniqueSchemaId(D,e.logger,e.options.resolveSchemaCollisions);o[P]=Qa(R,!1,!1,e,[P],r,e.namespace)}for(let[D,R]of Object.entries(i.channels??{}))if(s[D]||(s[D]={}),R.messages)for(let[P,M]of Object.entries(R.messages))if(a[P]||(a[P]=[]),e.isReferenceObject(M)){let J=e.resolveMessageReference(M);a[P].push({channelId:D,payload:J.payload})}else e.isMessageWithPayload(M)&&a[P].push({channelId:D,payload:M.payload});for(let[D,R]of Object.entries(a))if(R.length===1){let P=R[0],M=P.channelId;s[M]=s[M]||{},s[M][D]=Qa(P.payload,!1,!1,e,[D],r,e.namespace)}else{c.push(D);for(let{channelId:P,payload:M}of R){let J=`${P}_${D}`;s[P]||(s[P]={}),s[P][J]=Qa(M,!1,!1,e,[J],r,e.namespace)}}let p={},d=lZ();for(let[D,R]of Object.entries(s))for(let[P,M]of Object.entries(R)){let J=d.getUniqueSchemaId(P,e.logger,e.options.resolveSchemaCollisions);p[J]=M}let f=new HZe({...o,...p},e),m={};for(let[D,R]of Object.entries(i.servers??{})){let P=jr(R,Py.FERN_SERVER_NAME);m[D]={name:P??D,url:KDr(R.protocol,R.host)}}let g={},A=Object.keys(i.channels??{});for(let[D,R]of Object.entries(i.operations??{})){if(jr(R,Py.IGNORE))continue;let P;if(R.channel==null||!("$ref"in R.channel)||R.channel.$ref==null)if(A.length===1&&A[0]!=null)P=A[0];else continue;else P=Y_f(R);g[P]||(g[P]={subscribe:[],publish:[],__parsedMessages:[]});let M=jr(R,Py.FERN_SDK_METHOD_NAME),J=jr(R,Py.FERN_DISPLAY_NAME);if(!R.messages||!Array.isArray(R.messages))continue;let X=R.messages.filter(ie=>ie!=null&&ie.$ref!=null).map(ie=>({ref:ie,methodName:M,displayName:J})),$=g[P];if($==null)throw new S({message:`Internal error: channelEvents["${P}"] is unexpectedly undefined for operation ${D}`,code:S.Code.InternalError});if(R.action==="receive")$.subscribe.push(...X);else if(R.action==="send")$.publish.push(...X);else throw new S({message:`Operation ${D} has an invalid action: ${R.action}`,code:S.Code.ValidationError})}for(let[D,R]of Object.entries(g)){let P=[];P.push(...$yc({messages:R.subscribe,channelPath:D,origin:"server",messageSchemas:s[D]??{},duplicatedMessageIds:c,context:e})),P.push(...$yc({messages:R.publish,channelPath:D,origin:"client",messageSchemas:s[D]??{},duplicatedMessageIds:c,context:e})),g[D]!=null&&(g[D].__parsedMessages=P)}for(let[D,R]of Object.entries(i.channels??{})){if(jr(R,Py.IGNORE))continue;let P=[],M=[],J=[];if(R.parameters!=null)for(let[X,$]of Object.entries(R.parameters)){let ie=e.isReferenceObject($)?e.resolveParameterReference($):$,{type:ue,parameterKey:oe}=ie.location!=null?X_f(ie.location):{type:R.address?.includes(`={${X}}`)?"query":"path",parameterKey:X},de=jr(ie,Py.FERN_PARAMETER_OPTIONAL),we=_u(ti(D))+_u(ti(X)),De=ie.schema!=null?Gn(ie.schema)?G6(ie.schema,!1,!1,e,[oe],void 0,r,e.namespace):Qa(ie.schema,!1,!1,e,[oe],r,e.namespace):Qa({...ie,type:"string",title:we,example:ie.examples?.[0],default:ie.default,enum:ie.enum,required:void 0},!1,!1,e,[oe],r,e.namespace),se=de?Wr.optional({value:De,description:void 0,availability:void 0,generatedName:"",title:we,namespace:void 0,groupName:void 0,nameOverride:void 0,inline:void 0}):De,ae={name:oe,description:ie.description,parameterNameOverride:void 0,schema:se,variableReference:void 0,availability:Hv($),source:r,explode:void 0,clientDefault:void 0};ue==="header"?P.push({...ae,env:void 0}):ue==="path"?M.push(ae):(ue==="payload"||ue==="query")&&J.push(ae)}if(R.bindings?.ws?.query!=null){let X=new Set(J.map(ie=>ie.name)),$=new Set(R.bindings.ws.query.required??[]);for(let[ie,ue]of Object.entries(R.bindings.ws.query.properties??{})){if(X.has(ie))continue;if(Gn(ue)){let De=e.resolveSchemaReference(ue),se=$.has(ie),[ae,Oe]=e.options.coerceOptionalSchemasToNullable?[!1,!se]:[!se,!1];J.push({name:ie,schema:G6(ue,ae,Oe,e,[D,ie],void 0,r,e.namespace),description:De.description,parameterNameOverride:void 0,availability:Hv(De),source:r,explode:void 0,clientDefault:void 0});continue}let oe=$.has(ie),[de,we]=e.options.coerceOptionalSchemasToNullable?[!1,!oe]:[!oe,!1];J.push({name:ie,schema:Qa(ue,de,we,e,[D,ie],r,e.namespace),description:ue.description,parameterNameOverride:void 0,availability:Hv(ue),source:r,explode:void 0,clientDefault:void 0})}}if(R.bindings?.ws?.headers!=null){let X=new Set(P.map(ie=>ie.name)),$=new Set(R.bindings.ws.headers.required??[]);for(let[ie,ue]of Object.entries(R.bindings.ws.headers.properties??{})){if(X.has(ie))continue;if(Gn(ue)){let De=e.resolveSchemaReference(ue),se=$.has(ie),[ae,Oe]=e.options.coerceOptionalSchemasToNullable?[!1,!se]:[!se,!1];P.push({name:ie,schema:G6(ue,ae,Oe,e,[D,ie],void 0,r,e.namespace),description:De.description,parameterNameOverride:void 0,env:void 0,availability:Hv(De),source:r,clientDefault:void 0});continue}let oe=$.has(ie),[de,we]=e.options.coerceOptionalSchemasToNullable?[!1,!oe]:[!oe,!1];P.push({name:ie,schema:Qa(ue,de,we,e,[D,ie],r,e.namespace),description:ue.description,parameterNameOverride:void 0,env:void 0,availability:Hv(ue),source:r,clientDefault:void 0})}}if(P.length>0||J.length>0||g[D]!=null&&(g[D].publish!=null||g[D].subscribe!=null)){let X=HDr(R),$=g[D]?.__parsedMessages??[],ie=[];try{if(X.length>0)ie=f.buildWebsocketSessionExamplesForExtension({context:e,extensionExamples:X,handshake:{headers:P,queryParameters:J},source:r,namespace:e.namespace});else{let De=[],{examplePublishMessage:se,exampleSubscribeMessage:ae}=$_f({messages:$,messageSchemas:s[D]??{}});se!=null&&De.push(se),ae!=null&&De.push(ae);let Oe=f.buildWebsocketSessionExample({handshake:{headers:P,queryParameters:J},messages:De});Oe!=null&&ie.push(Oe)}}catch(De){e.logger.warn(`Failed to build examples for channel ${D}: ${Fn(De)}`)}let ue=jr(R,Py.FERN_SDK_GROUP_NAME),oe=jr(R,Py.FERN_SDK_METHOD_NAME),de=(R.servers?.map(De=>Z_f(m,De))??Object.values(m)).map(De=>({...De,name:De.name})),we=R.address?.split("?")[0]??JDr(D);u[D]={audiences:jr(R,mn.AUDIENCES)??[],handshake:{headers:P.map(De=>({...De,schema:ld(De.schema),env:De.env})),queryParameters:J.map(De=>({...De,schema:ld(De.schema)})),pathParameters:M.map(De=>({...De,parameterNameOverride:void 0,schema:ld(De.schema)}))},groupName:e.resolveGroupName(typeof ue=="string"?[ue]:ue??[D]),messages:$,summary:jr(R,Py.FERN_DISPLAY_NAME),connectMethodName:oe,servers:de,path:we,description:R.description,examples:ie,source:r}}else e.logger.warn(`Skipping AsyncAPI channel ${D} as it does not qualify for inclusion (no headers, query params, or operations)`)}let y={...o,...p},E={},x=lZ();for(let[D,R]of Object.entries(y)){let P=x.getUniqueSchemaId(D,e.logger,e.options.resolveSchemaCollisions);E[P]=ld(R)}let v=qZe(e.namespace,o),C=Object.values(m).map(D=>({...D,name:D.name})),O=jr(i,Py.BASE_PATH);return{groupedSchemas:v,channels:u,servers:C,basePath:O}}function J_f(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Y_f(e){if(!e.channel)throw new S({message:"Operation is missing required 'channel' field",code:S.Code.ValidationError});if(!e.channel.$ref)throw new S({message:"Operation channel is missing required '$ref' field",code:S.Code.ValidationError});if(!e.channel.$ref.startsWith(Xyc))throw new S({message:`Failed to resolve channel path from operation ${e.channel.$ref}`,code:S.Code.ReferenceError});return J_f(e.channel.$ref.substring(Xyc.length))}function X_f(e){let t="https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression",[r,n]=e.split("#/");if(r==null||n==null)throw new S({message:`Invalid location format: ${e}; unable to parse message type and parameter key. See ${t} for the expected format.`,code:S.Code.ValidationError});if(!r.startsWith(upo))throw new S({message:`Invalid location format: ${e}; expected ${upo} prefix`,code:S.Code.ValidationError});let i=r.substring(upo.length);if(i!=="header"&&i!=="path"&&i!=="payload")throw new S({message:`Invalid message type: ${i}. Must be one of: header, path, payload`,code:S.Code.ValidationError});return{type:i,parameterKey:n}}function Z_f(e,t){if(!t.$ref.startsWith(Zyc))throw new S({message:`Failed to resolve server name from server ref ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(Zyc.length),n=e[r];if(n==null)throw new S({message:`Failed to find server with name ${r}`,code:S.Code.ReferenceError});return n}function $yc({messages:e,channelPath:t,origin:r,messageSchemas:n,duplicatedMessageIds:i,context:o}){let s=[];return e.forEach((a,c)=>{try{let u=o.resolveMessageReference(a.ref,!0),l=o.resolveMessageReference(a.ref),p=u.name;i.includes(p)&&(p=`${t}_${p}`);let d=n[p];d!=null&&s.push({origin:r,name:p??`${r}Message${c+1}`,displayName:a.displayName,description:l.description??l.summary,body:ld(d),methodName:a.methodName})}catch(u){o.logger.warn(`Skipping message reference ${a.ref.$ref} in channel ${t}: ${Fn(u)}`)}}),s}function $_f({messages:e,messageSchemas:t}){let r=e.find(s=>s.origin==="client")?.name,n=e.find(s=>s.origin==="server")?.name,i=r!=null?t[r]:void 0,o=n!=null?t[n]:void 0;return{examplePublishMessage:i!=null&&r!=null?{type:r,payload:i}:void 0,exampleSubscribeMessage:o!=null&&n!=null?{type:n,payload:o}:void 0}}var Xyc,Zyc,upo,tbc=h(()=>{"use strict";wt();Ac();Ft();Vi();fu();TW();LZe();ID();VZe();zb();VDr();Ljt();spo();WDr();apo();cpo();Xyc="#/channels/",Zyc="#/servers/",upo="$message."});function rbc({document:e,taskContext:t,options:r,source:n,asyncApiOptions:i,namespace:o}){let s=[];if(o!=null&&s.push(o),parseFloat(e.asyncapi)<3){let a=e;a.tags?.[0]!=null?s.push(a.tags[0].name):i.naming!=="v2"&&s.push("websocket");let c=new LDr({document:a,taskContext:t,options:r,namespace:o});return Kyc({context:c,breadcrumbs:s,source:n,asyncApiOptions:i,document:a})}else{let a=e,c=new YDr({document:a,taskContext:t,options:r,namespace:o});return ebc({context:c,breadcrumbs:s,source:n,asyncApiOptions:i,document:a})}}var nbc=h(()=>{"use strict";Myc();Jyc();Yyc();tbc()});function XDr(e){if(e!=null)return e.map(t=>Object.fromEntries(Object.entries(t).map(([r,n])=>[r,n??[]])))}var lpo=h(()=>{"use strict"});function ibc(e){return jr(e,mn.ASYNC_CONFIG)}var obc=h(()=>{"use strict";fu();zl()});function abc(e,t){let r=jr(t,mn.STREAMING);if(r==null)return;if(typeof r=="boolean")return r?{type:"stream",format:"json",terminator:void 0,resumable:!1}:void 0;let n=e5f(e,r);if(r["stream-condition"]==null&&r.format!=null)return{type:"stream",format:r.format,terminator:r.terminator,resumable:n};if(r["stream-condition"]!=null)return{type:"streamCondition",format:r.format??"json",terminator:r.terminator,streamDescription:r["stream-description"],streamConditionProperty:t5f(r["stream-condition"]),streamRequestName:r["stream-request-name"],responseStream:r["response-stream"],response:r.response,resumable:n}}function e5f(e,t){return typeof t.resumable=="boolean"?t.resumable:ppo(e)??!1}function ppo(e){let t=jr(e,mn.STREAMING);if(!(t==null||typeof t=="boolean"))return typeof t.resumable=="boolean"?t.resumable:void 0}function cbc(e){let t=jr(e,mn.STREAMING);if(!(t==null||typeof t=="boolean"))return typeof t.resumable=="boolean"?t.resumable:void 0}function t5f(e){return e.startsWith(sbc)?e.slice(sbc.length):e}var sbc,ubc=h(()=>{"use strict";fu();zl();sbc="$request."});function lbc(e){let t=e;if(t.cursor!=null)return Lw.cursor({cursor:t.cursor,nextCursor:t.next_cursor,results:t.results});let r=e;if("next_uri"in r)return Lw.uri({nextUri:r.next_uri,results:r.results});let n=e;if("next_path"in n)return Lw.path({nextPath:n.next_path,results:n.results});if("offset"in e){let i=e;return Lw.offset({offset:i.offset,results:i.results,step:i.step,hasNextPage:i["has-next-page"]})}if("type"in e&&e.type==="custom"){let i=e;return Lw.custom({results:i.results})}throw new S({message:"Invalid pagination extension",code:S.Code.ValidationError})}function pbc(e,t){let r=jr(t,mn.PAGINATION);if(r!=null){if(typeof r=="boolean"){let n=jr(e,mn.PAGINATION);if(typeof n=="boolean")throw new S({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",code:S.Code.ValidationError});return n==null?void 0:lbc(n)}return lbc(r)}}var fbc=h(()=>{"use strict";Ac();Ft();fu();zl()});function dbc(e,t){for(let r of Object.keys(e))if(r.includes("text/event-stream")){let n=e[r];if(n==null)continue;let i=n,o=n.schema??i.itemSchema;return{contentType:r,schema:o??{},examples:KZe(n,t)}}}function mbc(e){let t=Object.keys(e);return t.length===1&&t[0]!=null&&t[0].includes("text/event-stream")}function r5f(e){return e.includes("json")||e==="*/*"}function Hjt({content:e,context:t}){for(let[r,n]of Object.entries(e))if(ZDr({mediaType:r,mediaTypeObject:n,context:t})!=null)return[r,n]}function ZDr({mediaType:e,mediaTypeObject:t,context:r}){if(!r5f(e))return;let n=t.schema;return{contentType:e.includes("*")?void 0:e,schema:n??{},examples:KZe(t,r)}}function Kjt({content:e,context:t}){let r=Hjt({content:e,context:t});if(!r)return;let[n,i]=r;return ZDr({mediaType:n,mediaTypeObject:i,context:t})}function hbc(e,t){for(let r of Object.keys(e)){let n=e[r];if(n==null)continue;return{schema:n.schema??{},examples:KZe(n,t)}}}function KZe(e,t){let r=[];e.example!=null&&r.push({name:void 0,value:e.example,description:void 0});let n=jr(e,bP.EXAMPLES);return n!=null&&Object.keys(n).length>0&&r.push(...Object.entries(n).map(([i,o])=>({name:o.summary??i,value:o.value,description:o.description}))),e.examples!=null&&Object.keys(e.examples).length>0&&r.push(...Object.entries(e.examples).map(([i,o])=>{let s=Gn(o)?t.resolveExampleReference(o):o;return{name:s.summary??i,value:s.value,description:s.description}})),r}var JZe=h(()=>{"use strict";fu();zb();VQe()});function gbc(e){let t=n5f(e),r={};return fpo({obj:t,occurrences:r,breadcrumbs:[]}),r}function fpo({obj:e,occurrences:t,breadcrumbs:r}){if(e!=null){if(Array.isArray(e)){for(let n of e)fpo({obj:n,occurrences:t,breadcrumbs:r});return}if(typeof e=="object"){if(e.$ref!=null&&typeof e.$ref=="string"){let n=e.$ref;t[n]==null?t[n]=1:t[n]+=1;return}for(let n in e)fpo({obj:e[n],occurrences:t,breadcrumbs:[...r,n]})}}}function n5f(e){return{...e,paths:Object.fromEntries(Object.entries(e.paths??{}).map(([t,r])=>[t,{...r,get:r?.get!=null?Jjt(r.get):void 0,put:r?.put!=null?Jjt(r.put):void 0,post:r?.post!=null?Jjt(r.post):void 0,patch:r?.patch!=null?Jjt(r.patch):void 0,delete:r?.delete!=null?Jjt(r.delete):void 0}]))}}function Jjt(e){return{...e,requestBody:e.requestBody!=null?Gn(e.requestBody)?e.requestBody:i5f(e.requestBody):void 0}}function i5f(e){let t,r;for(let n in e.content){let i=Qp.parse(n);i!=null&&(i.isJSON()?t=e.content[n]:i.isMultipart()&&(r=e.content[n]))}return r!=null&&t!=null?{...e,content:{[Qp.MULTIPART_FORM_DATA]:r}}:e}var Abc=h(()=>{"use strict";wt();zb()});var $Dr,ybc=h(()=>{"use strict";lo();$Dr=class{endpoints;parser=new ule;constructor({context:t,options:r}){this.endpoints=r.filter?.endpoints?new Set(this.validateAndFilterEndpoints({context:t,endpoints:r.filter.endpoints})):void 0}skipEndpoint({method:t,path:r}){return this.endpoints!=null&&!this.endpoints.has(`${t} ${r}`)}hasEndpoints(){return this.endpoints!=null}validateAndFilterEndpoints({context:t,endpoints:r}){let n=[];for(let i of r){let o=this.parser.tryParse(i);if(o==null){t.logger.debug(`Ignoring configured filter endpoint "${i}"; expected format "POST /users/get"`);continue}n.push(`${o.method} ${o.path}`)}return n}}});var bbc,Ebc,Ibc,vbc,xbc,YZe,dpo=h(()=>{"use strict";Ft();fu();Abc();zb();zl();ybc();bbc="#/components/parameters/",Ebc="#/components/responses/",Ibc="#/components/examples/",vbc="#/components/requestBodies/",xbc="#/components/securitySchemes/",YZe=class{logger;document;taskContext;authHeaders;refOccurrences;DUMMY;options;source;filter;namespace;schemaNamespaceMapping;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s}){this.document=t,this.logger=r.logger,this.taskContext=r,this.authHeaders=n,this.refOccurrences=gbc(t),this.options=i,this.source=o,this.filter=new $Dr({context:r,options:i}),this.DUMMY=this.getDummy(),this.namespace=s,this.schemaNamespaceMapping=this.buildSchemaNamespaceMapping()}getNumberOfOccurrencesForRef(t){return this.refOccurrences[t.$ref]??0}resolveTagsToTagIds(t){let r=[];return this.namespace!=null&&r.push(this.namespace),r.concat(t??[])}resolveTags(t){let r=[];if(this.namespace!=null){let n={type:"namespace",name:this.namespace};r.push(n)}return r.concat(t??[])}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveSchemaReference(t){let r=t.$ref.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return{"x-fern-type":"unknown"};if(Array.isArray(n)){let o=parseInt(i,10);if(isNaN(o)||o<0||o>=n.length)return{"x-fern-type":"unknown"};n=n[o]}else n=n[i]}return n==null?(this.logger.debug(`Encountered undefined reference: ${t.$ref}`),{"x-fern-type":"unknown"}):(Gn(n)&&(n=this.resolveSchemaReference(n)),n)}resolveParameterReference(t){if(this.document.components==null||this.document.components.parameters==null||!t.$ref.startsWith(bbc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(bbc.length),n=this.document.components.parameters[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveParameterReference(n):n}resolveRequestBodyReference(t){if(this.document.components==null||this.document.components.requestBodies==null||!t.$ref.startsWith(vbc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(vbc.length),n=this.document.components.requestBodies[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveRequestBodyReference(n):n}resolveResponseReference(t){if(this.document.components==null||this.document.components.responses==null||!t.$ref.startsWith(Ebc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(Ebc.length),n=this.document.components.responses[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveResponseReference(n):n}resolveExampleReference(t){if(this.document.components==null||this.document.components.examples==null||!t.$ref.startsWith(Ibc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(Ibc.length),n=this.document.components.examples[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveExampleReference(n):n}resolveSecuritySchemeReference(t){if(this.document.components==null||this.document.components.securitySchemes==null||!t.$ref.startsWith(xbc))throw new S({message:`Failed to resolve ${t.$ref}`,code:S.Code.ReferenceError});let r=t.$ref.substring(xbc.length),n=this.document.components.securitySchemes[r];if(n==null)throw new S({message:`${t.$ref} is undefined`,code:S.Code.ReferenceError});return Gn(n)?this.resolveSecuritySchemeReference(n):n}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}getNamespace(t){return this.schemaNamespaceMapping?.get(t)}buildSchemaNamespaceMapping(){let t=new Map;if(!this.document.components?.schemas)return t;for(let[r,n]of Object.entries(this.document.components.schemas))!n||Gn(n)||t.set(r,jr(n,mn.SDK_NAMESPACE)||this.namespace);return t}}});var HQe,mpo=h(()=>{"use strict";dpo();HQe=class extends YZe{constructor({document:t,taskContext:r,options:n,source:i,namespace:o}){super({document:t,taskContext:r,authHeaders:new Set,options:n,source:i,namespace:o})}getDummy(){return this}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}getReferencedSchemas(){return new Set}markReferencedByDiscriminatedUnion(t,r,n){}getReferencesFromDiscriminatedUnion(t){}excludeSchema(t){}isSchemaExcluded(t){return!1}markSchemaWithDiscriminantValue(t,r,n){}getDiscriminatedUnionMetadata(t){}}});var Bf,hpo,Zo,fZ,Yjt=h(()=>{"use strict";(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return e.objectValues(s)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},e.find=(i,o)=>{for(let s of i)if(o(s))return s},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Bf||(Bf={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(hpo||(hpo={}));Zo=Bf.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fZ=e=>{switch(typeof e){case"undefined":return Zo.undefined;case"string":return Zo.string;case"number":return Number.isNaN(e)?Zo.nan:Zo.number;case"boolean":return Zo.boolean;case"function":return Zo.function;case"bigint":return Zo.bigint;case"symbol":return Zo.symbol;case"object":return Array.isArray(e)?Zo.array:e===null?Zo.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Zo.promise:typeof Map<"u"&&e instanceof Map?Zo.map:typeof Set<"u"&&e instanceof Set?Zo.set:typeof Date<"u"&&e instanceof Date?Zo.date:Zo.object;default:return Zo.unknown}}});var Qr,o5f,xQ,eRr=h(()=>{"use strict";Yjt();Qr=Bf.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),o5f=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),xQ=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bf.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};xQ.create=e=>new xQ(e)});var s5f,Wle,gpo=h(()=>{"use strict";eRr();Yjt();s5f=(e,t)=>{let r;switch(e.code){case Qr.invalid_type:e.received===Zo.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Qr.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Bf.jsonStringifyReplacer)}`;break;case Qr.unrecognized_keys:r=`Unrecognized key(s) in object: ${Bf.joinValues(e.keys,", ")}`;break;case Qr.invalid_union:r="Invalid input";break;case Qr.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Bf.joinValues(e.options)}`;break;case Qr.invalid_enum_value:r=`Invalid enum value. Expected ${Bf.joinValues(e.options)}, received '${e.received}'`;break;case Qr.invalid_arguments:r="Invalid function arguments";break;case Qr.invalid_return_type:r="Invalid function return type";break;case Qr.invalid_date:r="Invalid date";break;case Qr.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Bf.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Qr.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case Qr.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case Qr.custom:r="Invalid input";break;case Qr.invalid_intersection_types:r="Intersection results could not be merged";break;case Qr.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Qr.not_finite:r="Number must be finite";break;default:r=t.defaultError,Bf.assertNever(e)}return{message:r}},Wle=s5f});function a5f(e){Cbc=e}function XZe(){return Cbc}var Cbc,tRr=h(()=>{"use strict";gpo();Cbc=Wle});function Do(e,t){let r=XZe(),n=Xjt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Wle?void 0:Wle].filter(i=>!!i)});e.common.issues.push(n)}var Xjt,c5f,EP,Nc,KQe,vD,rRr,nRr,Y0e,ZZe,Apo=h(()=>{"use strict";tRr();gpo();Xjt=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...i,path:o,message:a}},c5f=[];EP=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return Nc;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Nc;o.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:t.value,value:n}}},Nc=Object.freeze({status:"aborted"}),KQe=e=>({status:"dirty",value:e}),vD=e=>({status:"valid",value:e}),rRr=e=>e.status==="aborted",nRr=e=>e.status==="dirty",Y0e=e=>e.status==="valid",ZZe=e=>typeof Promise<"u"&&e instanceof Promise});var wbc=h(()=>{"use strict"});var xa,Sbc=h(()=>{"use strict";(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(xa||(xa={}))});function fp(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:i}}function Bbc(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function w5f(e){return new RegExp(`^${Bbc(e)}$`)}function Dbc(e){let t=`${Pbc}T${Bbc(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function S5f(e,t){return!!((t==="v4"||!t)&&y5f.test(e)||(t==="v6"||!t)&&E5f.test(e))}function T5f(e,t){if(!m5f.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function O5f(e,t){return!!((t==="v4"||!t)&&b5f.test(e)||(t==="v6"||!t)&&I5f.test(e))}function P5f(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return o%s/10**i}function $Ze(e){if(e instanceof CQ){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=KU.create($Ze(n))}return new CQ({...e._def,shape:()=>t})}else return e instanceof Jle?new Jle({...e._def,type:$Ze(e.element)}):e instanceof KU?KU.create($Ze(e.unwrap())):e instanceof mZ?mZ.create($Ze(e.unwrap())):e instanceof dZ?dZ.create(e.items.map(t=>$Ze(t))):e}function bpo(e,t){let r=fZ(e),n=fZ(t);if(e===t)return{valid:!0,data:e};if(r===Zo.object&&n===Zo.object){let i=Bf.objectKeys(t),o=Bf.objectKeys(e).filter(a=>i.indexOf(a)!==-1),s={...e,...t};for(let a of o){let c=bpo(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===Zo.array&&n===Zo.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let s=e[o],a=t[o],c=bpo(s,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===Zo.date&&n===Zo.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}function Rbc(e,t){return new oze({values:e,typeName:du.ZodEnum,...fp(t)})}function Obc(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function xD(e,t={},r){return e?Z0e.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(s=>{if(!s){let a=Obc(t,n),c=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:c})}});if(!o){let s=Obc(t,n),a=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:a})}}):Z0e.create()}var JU,Tbc,Up,u5f,l5f,p5f,f5f,d5f,m5f,h5f,g5f,A5f,ypo,y5f,b5f,E5f,I5f,v5f,x5f,Pbc,C5f,X0e,JQe,YQe,XQe,ZQe,e$e,$Qe,eze,Z0e,Kle,OW,t$e,Jle,CQ,tze,Hle,iRr,rze,dZ,oRr,r$e,n$e,sRr,nze,ize,oze,sze,$0e,YU,KU,mZ,aze,cze,i$e,B5f,Zjt,$jt,uze,D5f,du,R5f,I,ft,k5f,F5f,Ue,N5f,j5f,Q5f,o$e,z5f,ir,M5f,Tp,re,w,L5f,po,ur,V5f,U5f,tr,_5f,G5f,q5f,fo,me,lr,W5f,H5f,K5f,J5f,Y5f,Yle,X5f,Z5f,$5f,e8f,Nh,t8f,kbc=h(()=>{"use strict";eRr();tRr();Sbc();Apo();Yjt();JU=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Tbc=(e,t)=>{if(Y0e(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new xQ(e.common.issues);return this._error=r,this._error}}};Up=class{get description(){return this._def.description}_getType(t){return fZ(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:fZ(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new EP,ctx:{common:t.parent.common,data:t.data,parsedType:fZ(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(ZZe(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fZ(t)},i=this._parseSync({data:t,path:n.path,parent:n});return Tbc(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fZ(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Y0e(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Y0e(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fZ(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(ZZe(i)?i:Promise.resolve(i));return Tbc(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=t(i),a=()=>o.addIssue({code:Qr.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new YU({schema:this,typeName:du.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return KU.create(this,this._def)}nullable(){return mZ.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Jle.create(this)}promise(){return $0e.create(this,this._def)}or(t){return tze.create([this,t],this._def)}and(t){return rze.create(this,t,this._def)}transform(t){return new YU({...fp(this._def),schema:this,typeName:du.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new aze({...fp(this._def),innerType:this,defaultValue:r,typeName:du.ZodDefault})}brand(){return new Zjt({typeName:du.ZodBranded,type:this,...fp(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new cze({...fp(this._def),innerType:this,catchValue:r,typeName:du.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return $jt.create(this,t)}readonly(){return uze.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},u5f=/^c[^\s-]{8,}$/i,l5f=/^[0-9a-z]+$/,p5f=/^[0-9A-HJKMNP-TV-Z]{26}$/i,f5f=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,d5f=/^[a-z0-9_-]{21}$/i,m5f=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,h5f=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,g5f=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,A5f="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",y5f=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,b5f=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,E5f=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,I5f=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,v5f=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x5f=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pbc="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",C5f=new RegExp(`^${Pbc}$`);X0e=class e extends Up{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Zo.string){let o=this._getOrReturnCtx(t);return Do(o,{code:Qr.invalid_type,expected:Zo.string,received:o.parsedType}),Nc}let n=new EP,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=t.data.length>o.value,a=t.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(t,i),s?Do(i,{code:Qr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Do(i,{code:Qr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")g5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"email",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")ypo||(ypo=new RegExp(A5f,"u")),ypo.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"emoji",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")f5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"uuid",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")d5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"nanoid",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")u5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"cuid",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")l5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"cuid2",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")p5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"ulid",code:Qr.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),Do(i,{validation:"url",code:Qr.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"regex",code:Qr.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?Dbc(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?C5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?w5f(o).test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?h5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"duration",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?S5f(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"ip",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?T5f(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"jwt",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?O5f(t.data,o.version)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"cidr",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?v5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"base64",code:Qr.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?x5f.test(t.data)||(i=this._getOrReturnCtx(t,i),Do(i,{validation:"base64url",code:Qr.invalid_string,message:o.message}),n.dirty()):Bf.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:Qr.invalid_string,...xa.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...xa.errToObj(t)})}url(t){return this._addCheck({kind:"url",...xa.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...xa.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...xa.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...xa.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...xa.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...xa.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...xa.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...xa.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...xa.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...xa.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...xa.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...xa.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...xa.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...xa.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...xa.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...xa.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...xa.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...xa.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...xa.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...xa.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...xa.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...xa.errToObj(r)})}nonempty(t){return this.min(1,xa.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};X0e.create=e=>new X0e({checks:[],typeName:du.ZodString,coerce:e?.coerce??!1,...fp(e)});JQe=class e extends Up{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Zo.number){let o=this._getOrReturnCtx(t);return Do(o,{code:Qr.invalid_type,expected:Zo.number,received:o.parsedType}),Nc}let n,i=new EP;for(let o of this._def.checks)o.kind==="int"?Bf.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?P5f(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.not_finite,message:o.message}),i.dirty()):Bf.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,xa.toString(r))}gt(t,r){return this.setLimit("min",t,!1,xa.toString(r))}lte(t,r){return this.setLimit("max",t,!0,xa.toString(r))}lt(t,r){return this.setLimit("max",t,!1,xa.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:xa.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:xa.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:xa.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:xa.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:xa.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:xa.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:xa.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:xa.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:xa.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:xa.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Bf.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};JQe.create=e=>new JQe({checks:[],typeName:du.ZodNumber,coerce:e?.coerce||!1,...fp(e)});YQe=class e extends Up{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Zo.bigint)return this._getInvalidInput(t);let n,i=new EP;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),Do(n,{code:Qr.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Bf.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return Do(r,{code:Qr.invalid_type,expected:Zo.bigint,received:r.parsedType}),Nc}gte(t,r){return this.setLimit("min",t,!0,xa.toString(r))}gt(t,r){return this.setLimit("min",t,!1,xa.toString(r))}lte(t,r){return this.setLimit("max",t,!0,xa.toString(r))}lt(t,r){return this.setLimit("max",t,!1,xa.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:xa.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:xa.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:xa.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:xa.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:xa.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:xa.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};YQe.create=e=>new YQe({checks:[],typeName:du.ZodBigInt,coerce:e?.coerce??!1,...fp(e)});XQe=class extends Up{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Zo.boolean){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.boolean,received:n.parsedType}),Nc}return vD(t.data)}};XQe.create=e=>new XQe({typeName:du.ZodBoolean,coerce:e?.coerce||!1,...fp(e)});ZQe=class e extends Up{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Zo.date){let o=this._getOrReturnCtx(t);return Do(o,{code:Qr.invalid_type,expected:Zo.date,received:o.parsedType}),Nc}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return Do(o,{code:Qr.invalid_date}),Nc}let n=new EP,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),Do(i,{code:Qr.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Bf.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:xa.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:xa.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};ZQe.create=e=>new ZQe({checks:[],coerce:e?.coerce||!1,typeName:du.ZodDate,...fp(e)});e$e=class extends Up{_parse(t){if(this._getType(t)!==Zo.symbol){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.symbol,received:n.parsedType}),Nc}return vD(t.data)}};e$e.create=e=>new e$e({typeName:du.ZodSymbol,...fp(e)});$Qe=class extends Up{_parse(t){if(this._getType(t)!==Zo.undefined){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.undefined,received:n.parsedType}),Nc}return vD(t.data)}};$Qe.create=e=>new $Qe({typeName:du.ZodUndefined,...fp(e)});eze=class extends Up{_parse(t){if(this._getType(t)!==Zo.null){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.null,received:n.parsedType}),Nc}return vD(t.data)}};eze.create=e=>new eze({typeName:du.ZodNull,...fp(e)});Z0e=class extends Up{constructor(){super(...arguments),this._any=!0}_parse(t){return vD(t.data)}};Z0e.create=e=>new Z0e({typeName:du.ZodAny,...fp(e)});Kle=class extends Up{constructor(){super(...arguments),this._unknown=!0}_parse(t){return vD(t.data)}};Kle.create=e=>new Kle({typeName:du.ZodUnknown,...fp(e)});OW=class extends Up{_parse(t){let r=this._getOrReturnCtx(t);return Do(r,{code:Qr.invalid_type,expected:Zo.never,received:r.parsedType}),Nc}};OW.create=e=>new OW({typeName:du.ZodNever,...fp(e)});t$e=class extends Up{_parse(t){if(this._getType(t)!==Zo.undefined){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.void,received:n.parsedType}),Nc}return vD(t.data)}};t$e.create=e=>new t$e({typeName:du.ZodVoid,...fp(e)});Jle=class e extends Up{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==Zo.array)return Do(r,{code:Qr.invalid_type,expected:Zo.array,received:r.parsedType}),Nc;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Do(r,{code:s?Qr.too_big:Qr.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Do(r,{code:Qr.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Do(r,{code:Qr.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new JU(r,s,r.path,a)))).then(s=>EP.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new JU(r,s,r.path,a)));return EP.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:xa.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:xa.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:xa.toString(r)}})}nonempty(t){return this.min(1,t)}};Jle.create=(e,t)=>new Jle({type:e,minLength:null,maxLength:null,exactLength:null,typeName:du.ZodArray,...fp(t)});CQ=class e extends Up{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Bf.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Zo.object){let u=this._getOrReturnCtx(t);return Do(u,{code:Qr.invalid_type,expected:Zo.object,received:u.parsedType}),Nc}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof OW&&this._def.unknownKeys==="strip"))for(let u in i.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=o[u],p=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new JU(i,p,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof OW){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")a.length>0&&(Do(i,{code:Qr.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let p=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new JU(i,p,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let p=await l.key,d=await l.value;u.push({key:p,value:d,alwaysSet:l.alwaysSet})}return u}).then(u=>EP.mergeObjectSync(n,u)):EP.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return xa.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:xa.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:du.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Bf.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Bf.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return $Ze(this)}partial(t){let r={};for(let n of Bf.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Bf.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof KU;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return Rbc(Bf.objectKeys(this.shape))}};CQ.create=(e,t)=>new CQ({shape:()=>e,unknownKeys:"strip",catchall:OW.create(),typeName:du.ZodObject,...fp(t)});CQ.strictCreate=(e,t)=>new CQ({shape:()=>e,unknownKeys:"strict",catchall:OW.create(),typeName:du.ZodObject,...fp(t)});CQ.lazycreate=(e,t)=>new CQ({shape:e,unknownKeys:"strip",catchall:OW.create(),typeName:du.ZodObject,...fp(t)});tze=class extends Up{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new xQ(a.ctx.common.issues));return Do(r,{code:Qr.invalid_union,unionErrors:s}),Nc}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(c=>new xQ(c));return Do(r,{code:Qr.invalid_union,unionErrors:a}),Nc}}get options(){return this._def.options}};tze.create=(e,t)=>new tze({options:e,typeName:du.ZodUnion,...fp(t)});Hle=e=>e instanceof nze?Hle(e.schema):e instanceof YU?Hle(e.innerType()):e instanceof ize?[e.value]:e instanceof oze?e.options:e instanceof sze?Bf.objectValues(e.enum):e instanceof aze?Hle(e._def.innerType):e instanceof $Qe?[void 0]:e instanceof eze?[null]:e instanceof KU?[void 0,...Hle(e.unwrap())]:e instanceof mZ?[null,...Hle(e.unwrap())]:e instanceof Zjt||e instanceof uze?Hle(e.unwrap()):e instanceof cze?Hle(e._def.innerType):[],iRr=class e extends Up{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Zo.object)return Do(r,{code:Qr.invalid_type,expected:Zo.object,received:r.parsedType}),Nc;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Do(r,{code:Qr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Nc)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let s=Hle(o.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);i.set(a,o)}}return new e({typeName:du.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...fp(n)})}};rze=class extends Up{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,s)=>{if(rRr(o)||rRr(s))return Nc;let a=bpo(o.value,s.value);return a.valid?((nRr(o)||nRr(s))&&r.dirty(),{status:r.value,value:a.data}):(Do(n,{code:Qr.invalid_intersection_types}),Nc)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};rze.create=(e,t,r)=>new rze({left:e,right:t,typeName:du.ZodIntersection,...fp(r)});dZ=class e extends Up{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Zo.array)return Do(n,{code:Qr.invalid_type,expected:Zo.array,received:n.parsedType}),Nc;if(n.data.length<this._def.items.length)return Do(n,{code:Qr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Nc;!this._def.rest&&n.data.length>this._def.items.length&&(Do(n,{code:Qr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new JU(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>EP.mergeArray(r,s)):EP.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};dZ.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new dZ({items:e,typeName:du.ZodTuple,rest:null,...fp(t)})};oRr=class e extends Up{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Zo.object)return Do(n,{code:Qr.invalid_type,expected:Zo.object,received:n.parsedType}),Nc;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new JU(n,a,n.path,a)),value:s._parse(new JU(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?EP.mergeObjectAsync(r,i):EP.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Up?new e({keyType:t,valueType:r,typeName:du.ZodRecord,...fp(n)}):new e({keyType:X0e.create(),valueType:t,typeName:du.ZodRecord,...fp(r)})}},r$e=class extends Up{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Zo.map)return Do(n,{code:Qr.invalid_type,expected:Zo.map,received:n.parsedType}),Nc;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:i._parse(new JU(n,a,n.path,[u,"key"])),value:o._parse(new JU(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return Nc;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return Nc;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};r$e.create=(e,t,r)=>new r$e({valueType:t,keyType:e,typeName:du.ZodMap,...fp(r)});n$e=class e extends Up{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Zo.set)return Do(n,{code:Qr.invalid_type,expected:Zo.set,received:n.parsedType}),Nc;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Do(n,{code:Qr.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Do(n,{code:Qr.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return Nc;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new JU(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:xa.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:xa.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};n$e.create=(e,t)=>new n$e({valueType:e,minSize:null,maxSize:null,typeName:du.ZodSet,...fp(t)});sRr=class e extends Up{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Zo.function)return Do(r,{code:Qr.invalid_type,expected:Zo.function,received:r.parsedType}),Nc;function n(a,c){return Xjt({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,XZe(),Wle].filter(u=>!!u),issueData:{code:Qr.invalid_arguments,argumentsError:c}})}function i(a,c){return Xjt({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,XZe(),Wle].filter(u=>!!u),issueData:{code:Qr.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof $0e){let a=this;return vD(async function(...c){let u=new xQ([]),l=await a._def.args.parseAsync(c,o).catch(f=>{throw u.addIssue(n(c,f)),u}),p=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(p,o).catch(f=>{throw u.addIssue(i(p,f)),u})})}else{let a=this;return vD(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new xQ([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),p=a._def.returns.safeParse(l,o);if(!p.success)throw new xQ([i(l,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:dZ.create(t).rest(Kle.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||dZ.create([]).rest(Kle.create()),returns:r||Kle.create(),typeName:du.ZodFunction,...fp(n)})}},nze=class extends Up{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};nze.create=(e,t)=>new nze({getter:e,typeName:du.ZodLazy,...fp(t)});ize=class extends Up{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return Do(r,{received:r.data,code:Qr.invalid_literal,expected:this._def.value}),Nc}return{status:"valid",value:t.data}}get value(){return this._def.value}};ize.create=(e,t)=>new ize({value:e,typeName:du.ZodLiteral,...fp(t)});oze=class e extends Up{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return Do(r,{expected:Bf.joinValues(n),received:r.parsedType,code:Qr.invalid_type}),Nc}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return Do(r,{received:r.data,code:Qr.invalid_enum_value,options:n}),Nc}return vD(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};oze.create=Rbc;sze=class extends Up{_parse(t){let r=Bf.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Zo.string&&n.parsedType!==Zo.number){let i=Bf.objectValues(r);return Do(n,{expected:Bf.joinValues(i),received:n.parsedType,code:Qr.invalid_type}),Nc}if(this._cache||(this._cache=new Set(Bf.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Bf.objectValues(r);return Do(n,{received:n.data,code:Qr.invalid_enum_value,options:i}),Nc}return vD(t.data)}get enum(){return this._def.values}};sze.create=(e,t)=>new sze({values:e,typeName:du.ZodNativeEnum,...fp(t)});$0e=class extends Up{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Zo.promise&&r.common.async===!1)return Do(r,{code:Qr.invalid_type,expected:Zo.promise,received:r.parsedType}),Nc;let n=r.parsedType===Zo.promise?r.data:Promise.resolve(r.data);return vD(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$0e.create=(e,t)=>new $0e({type:e,typeName:du.ZodPromise,...fp(t)});YU=class extends Up{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===du.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:s=>{Do(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return Nc;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?Nc:c.status==="dirty"?KQe(c.value):r.value==="dirty"?KQe(c.value):c});{if(r.value==="aborted")return Nc;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?Nc:a.status==="dirty"?KQe(a.value):r.value==="dirty"?KQe(a.value):a}}if(i.type==="refinement"){let s=a=>{let c=i.refinement(a,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Nc:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?Nc:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Y0e(s))return Nc;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>Y0e(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):Nc);Bf.assertNever(i)}};YU.create=(e,t,r)=>new YU({schema:e,typeName:du.ZodEffects,effect:t,...fp(r)});YU.createWithPreprocess=(e,t,r)=>new YU({schema:t,effect:{type:"preprocess",transform:e},typeName:du.ZodEffects,...fp(r)});KU=class extends Up{_parse(t){return this._getType(t)===Zo.undefined?vD(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};KU.create=(e,t)=>new KU({innerType:e,typeName:du.ZodOptional,...fp(t)});mZ=class extends Up{_parse(t){return this._getType(t)===Zo.null?vD(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mZ.create=(e,t)=>new mZ({innerType:e,typeName:du.ZodNullable,...fp(t)});aze=class extends Up{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===Zo.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};aze.create=(e,t)=>new aze({innerType:e,typeName:du.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...fp(t)});cze=class extends Up{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ZZe(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new xQ(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new xQ(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};cze.create=(e,t)=>new cze({innerType:e,typeName:du.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...fp(t)});i$e=class extends Up{_parse(t){if(this._getType(t)!==Zo.nan){let n=this._getOrReturnCtx(t);return Do(n,{code:Qr.invalid_type,expected:Zo.nan,received:n.parsedType}),Nc}return{status:"valid",value:t.data}}};i$e.create=e=>new i$e({typeName:du.ZodNaN,...fp(e)});B5f=Symbol("zod_brand"),Zjt=class extends Up{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},$jt=class e extends Up{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Nc:o.status==="dirty"?(r.dirty(),KQe(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Nc:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:du.ZodPipeline})}},uze=class extends Up{_parse(t){let r=this._def.innerType._parse(t),n=i=>(Y0e(i)&&(i.value=Object.freeze(i.value)),i);return ZZe(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};uze.create=(e,t)=>new uze({innerType:e,typeName:du.ZodReadonly,...fp(t)});D5f={object:CQ.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(du||(du={}));R5f=(e,t={message:`Input not instance of ${e.name}`})=>xD(r=>r instanceof e,t),I=X0e.create,ft=JQe.create,k5f=i$e.create,F5f=YQe.create,Ue=XQe.create,N5f=ZQe.create,j5f=e$e.create,Q5f=$Qe.create,o$e=eze.create,z5f=Z0e.create,ir=Kle.create,M5f=OW.create,Tp=t$e.create,re=Jle.create,w=CQ.create,L5f=CQ.strictCreate,po=tze.create,ur=iRr.create,V5f=rze.create,U5f=dZ.create,tr=oRr.create,_5f=r$e.create,G5f=n$e.create,q5f=sRr.create,fo=nze.create,me=ize.create,lr=oze.create,W5f=sze.create,H5f=$0e.create,K5f=YU.create,J5f=KU.create,Y5f=mZ.create,Yle=YU.createWithPreprocess,X5f=$jt.create,Z5f=()=>I().optional(),$5f=()=>ft().optional(),e8f=()=>Ue().optional(),Nh={string:(e=>X0e.create({...e,coerce:!0})),number:(e=>JQe.create({...e,coerce:!0})),boolean:(e=>XQe.create({...e,coerce:!0})),bigint:(e=>YQe.create({...e,coerce:!0})),date:(e=>ZQe.create({...e,coerce:!0}))},t8f=Nc});var Be={};Z(Be,{BRAND:()=>B5f,DIRTY:()=>KQe,EMPTY_PATH:()=>c5f,INVALID:()=>Nc,NEVER:()=>t8f,OK:()=>vD,ParseStatus:()=>EP,Schema:()=>Up,ZodAny:()=>Z0e,ZodArray:()=>Jle,ZodBigInt:()=>YQe,ZodBoolean:()=>XQe,ZodBranded:()=>Zjt,ZodCatch:()=>cze,ZodDate:()=>ZQe,ZodDefault:()=>aze,ZodDiscriminatedUnion:()=>iRr,ZodEffects:()=>YU,ZodEnum:()=>oze,ZodError:()=>xQ,ZodFirstPartyTypeKind:()=>du,ZodFunction:()=>sRr,ZodIntersection:()=>rze,ZodIssueCode:()=>Qr,ZodLazy:()=>nze,ZodLiteral:()=>ize,ZodMap:()=>r$e,ZodNaN:()=>i$e,ZodNativeEnum:()=>sze,ZodNever:()=>OW,ZodNull:()=>eze,ZodNullable:()=>mZ,ZodNumber:()=>JQe,ZodObject:()=>CQ,ZodOptional:()=>KU,ZodParsedType:()=>Zo,ZodPipeline:()=>$jt,ZodPromise:()=>$0e,ZodReadonly:()=>uze,ZodRecord:()=>oRr,ZodSchema:()=>Up,ZodSet:()=>n$e,ZodString:()=>X0e,ZodSymbol:()=>e$e,ZodTransformer:()=>YU,ZodTuple:()=>dZ,ZodType:()=>Up,ZodUndefined:()=>$Qe,ZodUnion:()=>tze,ZodUnknown:()=>Kle,ZodVoid:()=>t$e,addIssueToContext:()=>Do,any:()=>z5f,array:()=>re,bigint:()=>F5f,boolean:()=>Ue,coerce:()=>Nh,custom:()=>xD,date:()=>N5f,datetimeRegex:()=>Dbc,defaultErrorMap:()=>Wle,discriminatedUnion:()=>ur,effect:()=>K5f,enum:()=>lr,function:()=>q5f,getErrorMap:()=>XZe,getParsedType:()=>fZ,instanceof:()=>R5f,intersection:()=>V5f,isAborted:()=>rRr,isAsync:()=>ZZe,isDirty:()=>nRr,isValid:()=>Y0e,late:()=>D5f,lazy:()=>fo,literal:()=>me,makeIssue:()=>Xjt,map:()=>_5f,nan:()=>k5f,nativeEnum:()=>W5f,never:()=>M5f,null:()=>o$e,nullable:()=>Y5f,number:()=>ft,object:()=>w,objectUtil:()=>hpo,oboolean:()=>e8f,onumber:()=>$5f,optional:()=>J5f,ostring:()=>Z5f,pipeline:()=>X5f,preprocess:()=>Yle,promise:()=>H5f,quotelessJson:()=>o5f,record:()=>tr,set:()=>G5f,setErrorMap:()=>a5f,strictObject:()=>L5f,string:()=>I,symbol:()=>j5f,transformer:()=>K5f,tuple:()=>U5f,undefined:()=>Q5f,union:()=>po,unknown:()=>ir,util:()=>Bf,void:()=>Tp});var Epo=h(()=>{"use strict";tRr();Apo();wbc();Yjt();kbc();eRr()});var jn=h(()=>{"use strict";Epo();Epo()});var r8f,Ipo,Fbc=h(()=>{"use strict";jn();r8f=Be.object({lang:Be.string(),label:Be.optional(Be.string()),source:Be.string()}),Ipo=Be.array(r8f)});var Nbc,jbc=h(()=>{"use strict";Nbc={README_EXT:"x-readme"}});function n8f(e){if(!Array.isArray(e))return!1;for(let t of e)if(!io(t)||typeof t.language!="string"||typeof t.code!="string")return!1;return!0}function Qbc(e){let t=jr(e,Nbc.README_EXT);if(!io(t))return[];let r=t["code-samples"];if(!n8f(r))return[];let n=[];for(let i of r)n.push({name:i.name,language:i.language,code:i.code,install:i.install,docs:void 0});return n}var zbc=h(()=>{"use strict";wt();fu();jbc()});function i8f(e){return io(e)&&typeof e.$ref=="string"}function o8f(e,t){if(e!=null){if(typeof e=="string")return e;if(i8f(e)){let r=(0,cRr.resolve)(t??process.cwd(),e.$ref);if((0,aRr.existsSync)(r))try{return(0,aRr.readFileSync)(r,"utf-8")}catch{return}}}}function s8f(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!io(n))continue;let o=o8f(n.code,t);o!=null&&r.push({...n,code:o})}return r}function Mbc(e,t,r){let n=jr(t,mn.EXAMPLES),i=r.source.type==="openapi"?(0,cRr.dirname)(r.source.file):void 0,s=(n??[]).map(p=>{if(!io(p))return p;let f=p["code-samples"];if(f!=null){let m=s8f(f,i);return{...p,"code-samples":m}}return p}).filter(p=>{let d=Fd.serialization.ExampleEndpointCallSchema.parse(p);return d.ok||r.logger.error(`Failed to parse x-fern-example in ${e.path}/${e.method}`),d.ok}),a=Njt(t,bP.REDOCLY_CODE_SAMPLES_KEBAB,Ipo,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],u=[...Njt(t,bP.REDOCLY_CODE_SAMPLES_CAMEL,Ipo,r.logger,[...e.baseBreadcrumbs,`${e.method} ${e.path}`])??[],...a];u.length>0&&s.push({"code-samples":u.map(p=>({name:p.label??p.lang,language:p.lang,code:p.source,install:void 0,docs:void 0}))});let l=Qbc(t);return l.length>0&&s.push({"code-samples":l}),s.map(LU.unknown)}var aRr,cRr,Lbc=h(()=>{"use strict";wt();lo();Ac();aRr=require("fs"),cRr=require("path");fu();Fbc();VQe();zl();zbc()});function Vbc(e){let t=jr(e,mn.AVAILABILITY);if(t==="ga"||t==="generally-available")return Zh.GenerallyAvailable;if(t==="beta"||t==="pre-release")return Zh.Beta;if(t==="deprecated")return Zh.Deprecated;if(t==="alpha")return Zh.Alpha;if(t==="preview")return Zh.Preview;if(t==="legacy")return Zh.Legacy;if(e.deprecated)return Zh.Deprecated}var Ubc=h(()=>{"use strict";Ac();fu();zl()});function _bc(e){let t=jr(e,mn.RETRIES);if(t!=null&&t.disabled===!0)return mm.RetriesConfiguration.disabled(t.disabled)}var Gbc=h(()=>{"use strict";Ac();fu();zl()});function a8f(e){return e["x-fern-default"]??e.default}function qbc(e){let t=jr(e,mn.FERN_GLOBAL_PARAMETERS),r=[];for(let n of t??[])typeof n.name=="string"&&r.push({name:n.name,parameterName:n["parameter-name"],in:n.in,target:n.target,type:n.type,env:n.env,default:a8f(n),optional:n.optional,apply:n.apply,docs:n.docs});return r}function Wbc(e){let t=jr(e,mn.FERN_GLOBAL_PARAMETER);if(t!=null){if(typeof t=="string")return[t];if(Array.isArray(t))return t.filter(r=>typeof r=="string")}}var vpo=h(()=>{"use strict";fu();zl()});function uRr(e,t){let r=e.variables!=null&&Object.keys(e.variables).length>0,n=u8f(e);return{url:p8f({url:e.url,variables:e.variables??{}}),description:e.description,name:f8f(e,t),audiences:jr(e,mn.AUDIENCES),urlTemplate:r?e.url:void 0,variables:r&&e.variables!=null?l8f(e.variables):void 0,defaultUrl:r?n:void 0}}function u8f(e){let t=e[c8f];if(typeof t=="string")return t.endsWith("/")&&t!=="/"?t.slice(0,-1):t}function l8f(e){return Object.entries(e).map(([t,r])=>({id:t,default:r.default,values:r.enum}))}function p8f({url:e,variables:t}){let r=Object.fromEntries(Object.entries(t).map(([n,i])=>[n,i.default]));for(let[n,i]of Object.entries(r))e=e.replace(`{${n}}`,encodeURIComponent(i));return e}function f8f(e,t){let r=jr(e,[mn.SERVER_NAME_V1,mn.SERVER_NAME_V2]);if(r!=null)return r;if(e.description?.toLowerCase()==="production")return"Production";if(e.description?.toLowerCase()==="sandbox")return"Sandbox";if(t?.groupMultiApiEnvironments&&e.description!=null&&e.description.trim()!==""){let n=e.description.toLowerCase();return n==="prd"?"Production":n==="sbx"?"Sandbox":n==="staging"||n==="stg"?"Staging":n==="development"||n==="dev"?"Development":e.description}}var c8f,xpo=h(()=>{"use strict";fu();zl();c8f="x-fern-default-url"});function Hbc(e){return jr(e,mn.PARAMETER_NAME)}var Kbc=h(()=>{"use strict";fu();zl()});function Jbc(e){return jr(e,mn.SDK_VARIABLE)}var Ybc=h(()=>{"use strict";fu();zl()});function lRr({path:e,httpMethod:t,parameters:r,context:n,requestBreadcrumbs:i,source:o}){let s={pathParameters:[],queryParameters:[],headers:[]};for(let a of r){let c=Gn(a)?n.resolveParameterReference(a):a,u=jr(a,mn.IGNORE)??jr(c,mn.IGNORE);if(u!=null&&u){n.logger.debug(`${t.toUpperCase()} ${e} has a parameter marked with x-fern-ignore. Skipping.`);continue}let l=c.required??!1,p=Hv(c),d=[...i,c.name],f=HA(d,n.options.preserveSchemaIds),m=c.in==="header",[g,A]=n.options.coerceOptionalSchemasToNullable&&!m?[!1,!l]:[!l,!1],y=d8f(c,n),E=y!=null?Qa(y,g,A,n,d,o,n.namespace,!1,new Set,A8f(c,n)):l?Wr.primitive({nameOverride:void 0,generatedName:f,title:void 0,schema:Ui.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:qU({schema:c,logger:n.logger})}),description:void 0,availability:p,namespace:void 0,groupName:void 0}):Wr.optional({nameOverride:void 0,generatedName:f,title:void 0,value:Wr.primitive({nameOverride:void 0,generatedName:f,title:void 0,schema:Ui.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:qU({schema:c,logger:n.logger})}),description:void 0,availability:void 0,namespace:void 0,groupName:void 0}),description:void 0,availability:p,namespace:void 0,groupName:void 0,inline:void 0});if(c.in==="header"&&c.schema!=null&&!Gn(c.schema)&&c.schema.default!=null){let C=c.schema.default;typeof C=="string"&&C.length>0&&(E=Wr.literal({nameOverride:void 0,generatedName:f,title:void 0,value:Ty.string(C),description:void 0,availability:p,namespace:void 0,groupName:void 0}))}let x=jr(a,mn.FERN_DEFAULT)??jr(c,mn.FERN_DEFAULT),v={name:c.name,schema:E,description:h8f(c),parameterNameOverride:Hbc(c),availability:p,source:o,clientDefault:x};c.in==="query"?s.queryParameters.push({...v,explode:g8f(c)}):c.in==="path"?s.pathParameters.push({...v,variableReference:Jbc(c),explode:y8f(c)}):c.in==="header"?!m8f.has(c.name.toLowerCase())&&!n.authHeaders.has(c.name)?s.headers.push({...v,env:void 0}):n.logger.debug(`Ignoring ${c.name} header, in ${t.toUpperCase()} ${e}`):n.logger.warn(`Skipping ${c.in} parameter, ${c.name}, in ${t.toUpperCase()} ${e}`)}return s}function d8f(e,t){return e.schema!=null?e.schema:!t.options.respectParameterContent||e.in!=="header"||e.content==null?void 0:Hjt({content:e.content,context:t})?.[1].schema}function h8f(e){if(e.description!=null)return e.description;if(!(e.schema==null||Gn(e.schema)))return e.schema.description}function g8f(e){let t=e.style??"form",r=e.explode;if(r!==void 0)return t==="form"||t==="deepObject"?r===!0?void 0:r:r===!1?void 0:r}function A8f(e,t){let r=NDr({schema:e,logger:t.logger});return r??qU({schema:e,logger:t.logger})}function y8f(e){let t=e.explode;if(t!==void 0)return t===!1?void 0:t}var m8f,Cpo=h(()=>{"use strict";Ac();fu();LZe();ID();epo();pZ();zb();zl();Kbc();Ybc();JZe();m8f=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"])});function b8f({content:e,context:t}){for(let[r,n]of Object.entries(e))if(Zbc({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function Zbc({mediaType:e,mediaTypeObject:t,context:r}){if(Qp.parse(e)?.isURLEncoded())return{schema:t.schema,contentType:e,examples:KZe(t,r)}}function E8f({content:e,context:t}){for(let[r,n]of Object.entries(e))if($bc({mediaType:r,mediaTypeObject:n,context:t}))return[r,n]}function $bc({mediaType:e,mediaTypeObject:t,context:r}){if(Qp.parse(e)?.isMultipart())return{schema:t.schema,encoding:t.encoding,examples:KZe(t,r)}}function e0c({mediaType:e}){return Qp.parse(e)?.isBinary()??!1}function I8f({content:e}){for(let[t,r]of Object.entries(e))if(e0c({mediaType:t}))return[t,r]}function v8f(e,t){let r=Gn(e)?wpo(e,t):{id:void 0,schema:e};return Object.entries(r.schema.properties??{}).find(([n,i])=>!Gn(i)&&i.type==="string"&&(i.format==="binary"||i.format==null&&i.contentMediaType==="application/octet-stream"))!=null}function fRr({content:e,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a}){let c=I8f({content:e});if(c){let[f,m]=c;return hZ({mediaType:f,mediaTypeObject:m,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a})}let u=E8f({content:e,context:n}),l=Hjt({content:e,context:n}),p=x8f({json:l,multipart:u,document:r,visitor:{json:([f,m])=>hZ({mediaType:f,mediaTypeObject:m,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a}),multipart:([f,m])=>hZ({mediaType:f,mediaTypeObject:m,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a}),neither:()=>{}}});if(p)return p;let d=b8f({content:e,context:n});if(d){let[f,m]=d;return hZ({mediaType:f,mediaTypeObject:m,description:t,document:r,context:n,requestBreadcrumbs:i,source:o,namespace:s,bodyRequired:a})}}function x8f({json:e,multipart:t,document:r,visitor:n}){if(!e&&!t)return n.neither();let[,i]=e??[void 0,void 0],[,o]=t??[void 0,void 0];return!i?.schema&&!o?.schema?e&&(i?.example!=null||i?.examples!=null&&Object.keys(i.examples).length>0)?n.json(e):n.neither():i?.schema&&o?.schema?i.schema&&v8f(i.schema,r)?n.multipart(t):n.json(e):i?.schema?n.json(e):o?.schema?n.multipart(t):n.neither()}function hZ({mediaType:e,mediaTypeObject:t,description:r,document:n,context:i,requestBreadcrumbs:o,source:s,namespace:a,bodyRequired:c}){let u=C8f({mediaTypeObject:t});if(e0c({mediaType:e}))return kF.octetStream({description:r,source:s,sdkMethodName:u,contentType:e});let l=$bc({mediaType:e,mediaTypeObject:t,context:i}),p=l?.schema,d=l?.encoding,f=l?.examples;if(p){let A=Gn(p)?wpo(p,n):{id:void 0,schema:p},y=Qa(A.schema,!1,!1,i,o,s,a,!1),E=[];if(y.type==="object"){let x=new Set(A.schema.required??[]);for(let v of y.properties){let C=x.has(v.key),{isFile:O,isOptional:D,isArray:R,description:P}=pRr({schema:v.schema,isOptional:!C});if(O){let M=Xbc(v.key,d);E.push({key:v.key,schema:eZ.file({isOptional:D,isArray:R,description:P}),description:P,contentType:M,exploded:!1,encoding:M==null?i.options.defaultFormParameterEncoding:void 0})}else{let M=Xbc(v.key,d);E.push({key:v.key,schema:eZ.json(v.schema),description:void 0,contentType:M,exploded:d?.[v.key]?.explode,encoding:M==null?i.options.defaultFormParameterEncoding:S8f(M)})}}}return kF.multipart({name:Gn(p)&&i.getNumberOfOccurrencesForRef(p)===1?A.id:void 0,description:A.schema.description,properties:E,source:s,sdkMethodName:u,fullExamples:f})}let m=ZDr({mediaType:e,mediaTypeObject:t,context:i});if(m){let A=Qa(m.schema,!1,!1,i,o,s,a,!0);return kF.json({description:void 0,schema:A,contentType:m.contentType,required:c,fullExamples:m.examples,additionalProperties:!Gn(m.schema)&&Vjt(m.schema.additionalProperties,i.options),source:s,sdkMethodName:u})}let g=Zbc({mediaType:e,mediaTypeObject:t,context:i});if(g!=null&&g.schema!=null){let A=Qa(g.schema,!1,!1,i,o,s,a,!1);return kF.formUrlEncoded({schema:A,description:r,contentType:g.contentType,source:s,fullExamples:g.examples,additionalProperties:!1,sdkMethodName:u})}}function C8f({mediaTypeObject:e}){return jr(e,mn.SDK_METHOD_NAME)}function S8f(e){return e?w8f[e]:void 0}function wpo(e,t){if(!e.$ref.startsWith(qQe))throw new S({message:`Failed to resolve schema reference because of unsupported prefix: ${e.$ref}`,code:S.Code.ReferenceError});let r=UZe(e);if(r==null)throw new S({message:`Failed to resolve schema reference because missing schema id: ${e.$ref}`,code:S.Code.ReferenceError});let n=t.components?.schemas?.[r];if(n==null)throw new S({message:`Failed to resolve schema reference because missing: ${e.$ref}`,code:S.Code.ReferenceError});return Gn(n)?wpo(n,t):{id:r,schema:n}}function pRr({schema:e,isOptional:t,isArray:r,description:n}){return O8f(e)?pRr({schema:e.value,isOptional:!0,isArray:r,description:e.description}):P8f(e)?pRr({schema:e.value,isOptional:t,isArray:r,description:e.description}):B8f(e)?pRr({schema:e.value,isOptional:t,isArray:!0,description:e.description}):T8f(e)?{isFile:!0,isOptional:t??!1,isArray:r??!1,description:n??e.description}:{isFile:!1,isOptional:t??!1,isArray:r??!1,description:void 0}}function T8f(e){return e.type==="primitive"&&e.schema.type==="string"&&e.schema.format==="binary"}function O8f(e){return e.type==="optional"}function P8f(e){return e.type==="nullable"}function B8f(e){return e.type==="array"}function Xbc(e,t){return t?.[e]?.contentType}var w8f,Spo=h(()=>{"use strict";wt();Ac();Ft();fu();PDr();ID();zb();zl();JZe();w8f={"application/json":"json"}});function r0c(e){switch(e.toUpperCase()){case D8f:return 400;case R8f:return 500;default:return}}var Tpo,D8f,R8f,Opo,t0c,Ppo=h(()=>{"use strict";Tpo={400:"BadRequestError",401:"UnauthorizedError",402:"PaymentRequiredError",403:"ForbiddenError",404:"NotFoundError",405:"MethodNotAllowedError",406:"NotAcceptableError",407:"ProxyAuthenticationRequiredError",408:"RequestTimeoutError",409:"ConflictError",410:"GoneError",411:"LengthRequiredError",412:"PreconditionFailedError",413:"ContentTooLargeError",414:"URITooLongError",415:"UnsupportedMediaTypeError",416:"RangeNotSatisfiableError",417:"ExpectationFailedError",418:"ImATeapotError",419:"AuthenticationTimeoutError",420:"MethodFailureError",421:"MisdirectedRequestError",422:"UnprocessableEntityError",423:"LockedError",424:"FailedDependencyError",425:"TooEarlyError",426:"UpgradeRequiredError",428:"PreconditionError",429:"TooManyRequestsError",430:"RequestHeaderFieldsTooLargeError",431:"RequestHeaderFieldsTooLargeError",444:"NoResponseError",449:"RetryWithError",450:"BlockedByWindowsParentalControlsError",451:"UnavailableForLegalReasonsError",498:"InvalidTokenError",499:"ClientClosedRequestError",500:"InternalServerError",501:"NotImplementedError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError",505:"HTTPVersionNotSupportedError",506:"VariantAlsoNegotiatesError",507:"InsufficientStorageError",508:"LoopDetectedError",509:"BandwidthLimitExceededError",510:"NotExtendedError",511:"NetworkAuthenticationRequiredError"},D8f="4XX",R8f="5XX",Opo={400:"ClientRequestError",500:"ServerError"},t0c=new Set([...Object.values(Tpo),...Object.values(Opo)])});function dRr({operationContext:e,responses:t,context:r,responseBreadcrumbs:n,responseStatusCode:i,streamFormat:o,streamTerminator:s,streamResumable:a,source:c}){if(t==null)return{value:void 0,errors:{}};let u=F8f({responses:t,context:r,source:c,namespace:r.namespace}),l=!1,p=!1,d;for(let f of i!=null?[i]:k8f){let m=t[f];if(m==null)continue;l=!0;let g=typeof f=="string"?parseInt(f):f;if(d==null){let A=n0c({operationContext:e,response:m,context:r,responseBreadcrumbs:n,streamFormat:o,streamTerminator:s,streamResumable:a,source:c,namespace:r.namespace,statusCode:g});A!=null?d=A:g===204&&(p=!0)}else if(g===204){let A=Gn(m)?r.resolveResponseReference(m):m;Kjt({context:r,content:A.content??{}})!=null&&r.logger.warn(`${e.method.toUpperCase()} ${e.path}: the 204 response declares a body, but a 204 (No Content) response cannot include one. Ignoring the declared 204 body and treating the success response as optional.`),p=!0}}if(p&&d!=null&&d.type==="json"){let f=d.schema;f.type!=="optional"&&(d=Ug.json({...d,schema:Wr.optional({value:f,description:f.type==="reference"?f.description:void 0,nameOverride:void 0,generatedName:"",groupName:void 0,namespace:void 0,availability:void 0,title:void 0,inline:void 0})}))}if(d==null&&!l&&t.default!=null&&(d=n0c({operationContext:e,response:t.default,context:r,responseBreadcrumbs:n,streamFormat:o,streamTerminator:s,streamResumable:a,source:c,namespace:r.namespace})),d!=null)switch(d.type){case"json":return{value:d,errors:u};case"streamingJson":case"streamingSse":return{value:d,errors:u};case"bytes":case"file":case"text":case"streamingText":return{value:d,errors:u};default:Ee(d)}return{value:void 0,errors:u}}function n0c({operationContext:e,streamFormat:t,streamTerminator:r,streamResumable:n,response:i,context:o,responseBreadcrumbs:s,source:a,namespace:c,statusCode:u}){let l=Gn(i)?o.resolveResponseReference(i):i;if(l.content!=null&&Object.entries(l.content).find(([m,g])=>{if(g.schema==null)return!1;let A=Gn(g.schema)?o.resolveSchemaReference(g.schema):g.schema;return A.type==="string"&&(A.format==="binary"||A.format==null&&A.contentMediaType==="application/octet-stream")}))return o.options.useBytesForBinaryResponse&&t==null?Ug.bytes({description:l.description,source:a,statusCode:u}):Ug.file({description:l.description,source:a,statusCode:u});let p=dbc(l.content??{},o);if(p!=null&&t!=null)switch(t){case"json":return Ug.streamingJson({statusCode:u,description:l.description,responseProperty:jr(e.operation,mn.RESPONSE_PROPERTY),terminator:r,resumable:void 0,fullExamples:p.examples,schema:Qa(p.schema,!1,!1,o,s,a,c),source:a});case"sse":return Ug.streamingSse({description:l.description,responseProperty:void 0,terminator:r,resumable:n,fullExamples:p.examples,schema:Qa(p.schema,!1,!1,o,s,a,c),source:a,statusCode:u})}let d=Kjt({context:o,content:l.content??{}});if(d){if(t!=null)switch(t){case"json":return Ug.streamingJson({description:l.description,responseProperty:void 0,terminator:r,resumable:void 0,fullExamples:d.examples,schema:Qa(d.schema,!1,!1,o,s,a,c),source:a,statusCode:u});case"sse":return Ug.streamingSse({description:l.description,responseProperty:void 0,terminator:r,resumable:n,fullExamples:d.examples,schema:Qa(d.schema,!1,!1,o,s,a,c),source:a,statusCode:u})}return Ug.json({description:l.description,schema:Qa(d.schema,!1,!1,o,s,a,c),responseProperty:jr(e.operation,mn.RESPONSE_PROPERTY),terminator:void 0,resumable:void 0,fullExamples:d.examples,source:a,statusCode:u})}for(let[f,m]of Object.entries(l.content??{})){let g=Qp.parse(f);if(g!=null){if(g.isOctetStream()||g.isPDF()||g.isAudio()||g.isImage()||g.isVideo()||g.isMultiPartMixed())return Ug.file({description:l.description,source:a,statusCode:u});if(g.isText()&&!f.includes("event-stream")){let A=m.schema,y=g.isPlainText()?void 0:f;if(A==null)return Ug.text({description:l.description,source:a,statusCode:u,contentType:y});let E=Gn(A)?o.resolveSchemaReference(A):A;return E.type==="string"&&E.format==="byte"?Ug.file({description:l.description,source:a,statusCode:u}):Ug.text({description:l.description,source:a,statusCode:u,contentType:y})}}}}function F8f({responses:e,context:t,source:r,namespace:n}){let i={};for(let[o,s]of Object.entries(e)){if(o==="default")continue;let a=r0c(o),c=a!=null,u=a??parseInt(o);if(u<400||u>600)continue;let l=Gn(s)?t.resolveResponseReference(s):s,p=hbc(l.content??{},t),d=c?Opo[u]:Tpo[u];if(d==null){t.logger.warn(`No error name found for status code ${o}`);continue}let f=t.options.namespacedErrors?jr(l,mn.SDK_NAMESPACE):void 0,m=c?o.toUpperCase():u.toString();i[m]={statusCode:u,isWildcardStatusCode:c?!0:void 0,nameOverride:void 0,generatedName:d,description:l.description,schema:Qa(p?.schema??{},!1,!1,t,[d,"Body"],r,f??n),fullExamples:p?.examples,namespace:f,source:r}}return i}var k8f,Bpo=h(()=>{"use strict";wt();Ac();fu();ID();zb();zl();Ppo();JZe();k8f=["200","201","202","204"]});function Xle({operationContext:e,context:t,responseStatusCode:r,suffix:n,streamFormat:i,streamTerminator:o,streamResumable:s,source:a,streamRequestNameOverride:c}){let{document:u,operation:l,path:p,method:d,baseBreadcrumbs:f,pathItem:m}=e,g=jr(l,mn.IDEMPOTENT),A=jr(l,[mn.REQUEST_NAME_V1,mn.REQUEST_NAME_V2]),y=[...f,"Request"],E=lRr({parameters:[...e.pathItemParameters,...e.operationParameters],context:t,requestBreadcrumbs:y,path:p,httpMethod:d,source:a}),x=/{([^}]+)}/g,v=[...p.matchAll(x)].map(ue=>ue[1]).filter(ue=>ue!==void 0),C=[...p.matchAll(x)].map(ue=>ue[1]);switch(t.options.pathParameterOrder){case wn.PathParameterOrder.SpecOrder:{let ue=C.filter(oe=>!E.pathParameters.some(de=>de.name===oe));if(ue.length>0)for(let oe of ue)E.pathParameters.push({name:oe??"",variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:a,schema:Wr.primitive({schema:Ui.string({default:void 0,example:void 0,format:void 0,maxLength:void 0,minLength:void 0,pattern:void 0}),description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0,availability:void 0,title:void 0}),description:void 0,explode:void 0,clientDefault:void 0})}break;case wn.PathParameterOrder.UrlOrder:if(v.length>0){let ue=new Map(E.pathParameters.map(we=>[we.name,we])),oe=[],de=new Set;for(let we of v){let De=ue.get(we);de.add(we),De?oe.push(De):oe.push({name:we,variableReference:void 0,parameterNameOverride:void 0,availability:void 0,source:a,schema:Wr.primitive({schema:Ui.string({default:void 0,example:void 0,format:void 0,maxLength:void 0,minLength:void 0,pattern:void 0}),description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0,availability:void 0,title:void 0}),description:void 0,explode:void 0,clientDefault:void 0})}for(let we of E.pathParameters)de.has(we.name)||oe.push(we);E.pathParameters=oe}break;default:Ee(t.options.pathParameterOrder)}let O=(()=>{if(e.method==="GET")return[void 0];if(!l.requestBody)return[void 0];let ue=Gn(l.requestBody)?t.resolveRequestBodyReference(l.requestBody):l.requestBody,oe=Object.values(ue.content).every(we=>N8f({mediaTypeObject:we})!=null),de=[];if(oe)return de.push(...Object.entries(ue.content).map(([we,De])=>{let se=hZ({mediaType:we,mediaTypeObject:De,description:ue.description,document:u,context:new HQe({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:y,source:a,namespace:t.namespace,bodyRequired:ue.required});return o0c({context:t,convertedParameters:E})&&se!=null&&(se.type==="json"||se.type==="formUrlEncoded")&&se.schema.type!=="object"&&l.requestBody!=null?se=hZ({mediaType:we,mediaTypeObject:De,description:ue.description,document:u,context:t,requestBreadcrumbs:[...y,"Body"],source:a,namespace:t.namespace,bodyRequired:ue.required}):l.requestBody!=null&&(se=hZ({mediaType:we,mediaTypeObject:De,description:ue.description,document:u,context:t,requestBreadcrumbs:[...y],source:a,namespace:t.namespace,bodyRequired:ue.required})),se}).filter(we=>we!=null)),de.length===0?[void 0]:de;{let we=fRr({content:ue.content,description:ue.description,document:u,context:new HQe({document:t.document,taskContext:t.taskContext,options:t.options,source:t.source,namespace:t.namespace}),requestBreadcrumbs:y,source:a,namespace:t.namespace,bodyRequired:ue.required});return o0c({context:t,convertedParameters:E})&&we!=null&&(we.type==="json"||we.type==="formUrlEncoded")&&we.schema.type!=="object"&&l.requestBody!=null?we=fRr({content:ue.content,description:ue.description,document:u,context:t,requestBreadcrumbs:[...y,"Body"],source:a,namespace:t.namespace,bodyRequired:ue.required}):l.requestBody!=null&&(we=fRr({content:ue.content,description:ue.description,document:u,context:t,requestBreadcrumbs:[...y],source:a,namespace:t.namespace,bodyRequired:ue.required})),[we]}})(),D=O.length>1,R=[...f,"Response"],P=dRr({operationContext:e,streamFormat:i,streamTerminator:o,streamResumable:s,responses:l.responses,context:t,responseBreadcrumbs:R,responseStatusCode:r,source:a}),M=_bc(l),J=Vbc(l),X=Mbc(e,l,t),$=jr(l,mn.SERVER_NAME_V2),ie=jr(l,mn.SUBTITLE);return O.map(ue=>({summary:l.summary,subtitle:ie??void 0,internal:jr(l,bP.INTERNAL),idempotent:g,audiences:jr(l,mn.AUDIENCES)??[],operationId:l.operationId!=null&&n!=null?l.operationId+"_"+n:l.operationId,tags:t.options.ignoreTags?[]:t.resolveTagsToTagIds(l.tags),namespace:t.namespace,sdkName:j8f({operationContext:e,request:ue}),pathParameters:E.pathParameters,queryParameters:E.queryParameters,headers:E.headers,requestNameOverride:c??A??void 0,generatedRequestName:M8f({baseBreadcrumbs:f,requestBreadcrumbs:y,isMultipleRequests:D,request:ue,context:t}),request:ue,response:P.value,errors:P.errors,servers:$!=null?[{name:$,url:void 0,audiences:void 0}]:(l.servers??m.servers??[]).map(oe=>uRr(oe,{groupMultiApiEnvironments:t.options.groupMultiApiEnvironments})),description:l.description,authed:z8f(l,u),security:Q8f(l),availability:J,method:d,path:p,examples:X,pagination:e.pagination,source:a,retries:M,globalParameterIds:Wbc(l)}))}function i0c({breadcrumbs:e,request:t}){return t?[...e,t.type]:e}function N8f({mediaTypeObject:e}){return jr(e,mn.SDK_METHOD_NAME)}function j8f({operationContext:e,request:t}){return!t||!t.sdkMethodName?e.sdkMethodName:e.sdkMethodName?{groupName:[...e.sdkMethodName.groupName],methodName:t.sdkMethodName??e.sdkMethodName.methodName}:{groupName:[],methodName:t.sdkMethodName}}function Q8f(e){return XDr(e.security)}function z8f(e,t){return e.security!=null?Object.keys(e.security).length>0:t.security!=null?Object.keys(t.security).length>0:!1}function o0c({context:e,convertedParameters:t}){return e.options.inlinePathParameters&&t.pathParameters.length>0||t.queryParameters.length>0||t.headers.length>0}function M8f({baseBreadcrumbs:e,requestBreadcrumbs:t,isMultipleRequests:r,request:n,context:i}){let o=r?i0c({breadcrumbs:t,request:n}):t,s=HA(o,i.options.preserveSchemaIds);if(!i.options.disambiguateRequestNames)return s;let a=i.document.components?.schemas;if(a==null||!Object.keys(a).some(p=>HA([p],i.options.preserveSchemaIds)===s))return s;let u=[...e,"Body"],l=r?i0c({breadcrumbs:u,request:n}):u;return HA(l,i.options.preserveSchemaIds)}var mRr=h(()=>{"use strict";aa();wt();Ac();fu();pZ();zb();lpo();mpo();VQe();zl();Lbc();Ubc();Gbc();vpo();xpo();Cpo();Spo();Bpo()});function a0c({operationContext:e,context:t,asyncExtension:r,source:n}){let{operation:i,pathItemParameters:o,operationParameters:s}=e,a=r.discriminant.name,c=r.discriminant.value,u=r["response-status-code"],l=s0c({context:t,headerToIgnore:a,parameters:o}),p=s0c({context:t,headerToIgnore:a,parameters:s}),d=Xle({operationContext:{...e,pathItemParameters:l,operationParameters:p,operation:{...i,responses:Object.fromEntries(Object.entries(i.responses).filter(([m])=>parseInt(m)!==u))}},context:t,streamFormat:void 0,source:n}),f=Xle({operationContext:{...e,pathItemParameters:l,operationParameters:p,baseBreadcrumbs:[...e.baseBreadcrumbs,"async"]},context:t,suffix:"async",responseStatusCode:u,streamFormat:void 0,source:n});return f.forEach(m=>{m.headers.push({name:a,schema:Wr.literal({nameOverride:void 0,generatedName:HA([a],t.options.preserveSchemaIds),title:void 0,description:void 0,availability:void 0,value:Ty.string(c),namespace:void 0,groupName:void 0}),description:void 0,parameterNameOverride:void 0,env:void 0,availability:void 0,source:n,clientDefault:void 0})}),{sync:d,async:f}}function s0c({context:e,headerToIgnore:t,parameters:r}){return r.filter(n=>{let i=Gn(n)?e.resolveParameterReference(n):n;return!(i.in==="header"&&i.name===t)})}var c0c=h(()=>{"use strict";Ac();pZ();zb();mRr()});function f0c({operationContext:e,context:t,streamingExtension:r}){switch(r.type){case"stream":return{streaming:Xle({operationContext:e,context:t,streamFormat:r.format,streamTerminator:r.terminator,streamResumable:r.resumable,source:t.source}),nonStreaming:[]};case"streamCondition":{let n=u0c({context:t,operation:e.operation,streamingExtension:r,isStreaming:!0}),i=l0c({operation:e.operation,response:r.responseStream}),o=(()=>{if(r.streamRequestName!=null)return r.streamRequestName;if(n?.schemaReference!=null){let l=t.resolveSchemaReference(n.schemaReference),p=jr(l,mn.TYPE_NAME);if(p!=null)return`${p}Streaming`}})(),s=Xle({operationContext:{...e,sdkMethodName:e.sdkMethodName!=null?{groupName:e.sdkMethodName.groupName,methodName:e.sdkMethodName.methodName+"_"+Dpo}:void 0,operation:{...e.operation,description:r.streamDescription??e.operation.description,requestBody:n?.requestBody,responses:i},baseBreadcrumbs:[...e.baseBreadcrumbs,Dpo]},context:t,streamFormat:r.format,streamTerminator:r.terminator,streamResumable:r.resumable,suffix:Dpo,source:t.source,streamRequestNameOverride:o});s.forEach(l=>{l.examples=l.examples.filter(p=>p0c(p,t)!==!1)});let a=u0c({context:t,operation:e.operation,streamingExtension:r,isStreaming:!1}),c=l0c({operation:e.operation,response:r.response}),u=Xle({streamFormat:void 0,operationContext:{...e,operation:{...e.operation,requestBody:a?.requestBody,responses:c}},context:t,source:t.source});return u.forEach(l=>{l.examples=l.examples.filter(p=>p0c(p,t)!==!0)}),{streaming:s,nonStreaming:u}}default:Ee(r)}}function u0c({context:e,operation:t,streamingExtension:r,isStreaming:n}){if(t.requestBody==null)return;let i=Gn(t.requestBody)?e.resolveRequestBodyReference(t.requestBody):t.requestBody,o=Kjt({content:i.content,context:e});if(o==null)return;let s=Gn(o.schema)?e.resolveSchemaReference(o.schema):o.schema;if(s.allOf==null&&s.properties==null&&s.oneOf==null&&s.anyOf==null)return;let a=s.properties?.[r.streamConditionProperty];a!=null&&Gn(a)&&(a=void 0);let c={...s,properties:{...s.properties,[r.streamConditionProperty]:{...a??{},type:"boolean","x-fern-boolean-literal":n}},title:void 0,required:[...s.required??[],r.streamConditionProperty]};return{requestBody:{required:i.required,content:{[Qp.APPLICATION_JSON]:{schema:c}}},schemaReference:Gn(o.schema)?o.schema:void 0}}function l0c({operation:e,response:t}){return{...e.responses,200:{description:"",content:{[Qp.APPLICATION_JSON]:{schema:t}}}}}function p0c(e,t){return e._visit({unknown:r=>{let n=Fd.serialization.ExampleEndpointCallSchema.parse(r);if(n.ok&&n.value.response!=null)return n.value.response.stream!=null},full:()=>{},_other:()=>{}})}var Dpo,d0c=h(()=>{"use strict";wt();lo();fu();zb();zl();JZe();mRr();Dpo="stream"});function L8f(e){return A0c.includes(e)}function V8f(e){switch(e){case"unix-seconds":return mm.WebhookTimestampFormat.UnixSeconds;case"unix-millis":return mm.WebhookTimestampFormat.UnixMillis;case"iso8601":return mm.WebhookTimestampFormat.Iso8601}}function m0c(e){if(e!=null)return{header:e.header,format:e.format!=null?V8f(e.format):void 0,tolerance:e.tolerance}}function h0c(e){if(e!=null)return{components:e.components.map(t=>{switch(t){case"body":return mm.WebhookPayloadComponent.Body;case"timestamp":return mm.WebhookPayloadComponent.Timestamp;case"notification-url":return mm.WebhookPayloadComponent.NotificationUrl;case"message-id":return mm.WebhookPayloadComponent.MessageId}}),delimiter:e.delimiter,bodySort:U8f(e["body-sort"])}}function U8f(e){if(e!=null&&e==="alphabetical")return mm.WebhookPayloadBodySort.Alphabetical}function _8f(e,t){if(e!=null){if(!L8f(e.algorithm)){t.warn(`Ignoring webhook body-hash-binding: unsupported algorithm "${e.algorithm}". Supported algorithms are: ${A0c.join(", ")}.`);return}if(e.location?.type!=="query-parameter"){t.warn(`Ignoring webhook body-hash-binding: unsupported location type "${e.location?.type}". The only supported location is "query-parameter".`);return}return{algorithm:q8f(e.algorithm),encoding:Rpo(e.encoding),location:W8f(e.location)}}}function G8f(e,t){if(e==null)return;let r=e["port-variants"],n=e["legacy-query-encoding"];if(r!=null&&typeof r!="boolean"){t.warn(`Ignoring webhook url-normalization: "port-variants" must be a boolean, got "${typeof r}".`);return}if(n!=null&&typeof n!="boolean"){t.warn(`Ignoring webhook url-normalization: "legacy-query-encoding" must be a boolean, got "${typeof n}".`);return}if(!r&&!n){t.warn('Ignoring webhook url-normalization: enable at least one of "port-variants" or "legacy-query-encoding".');return}return{portVariants:r??!1,legacyQueryEncoding:n??!1}}function q8f(e){switch(e){case"sha256":return mm.WebhookBodyHashAlgorithm.Sha256;case"sha1":return mm.WebhookBodyHashAlgorithm.Sha1;case"sha384":return mm.WebhookBodyHashAlgorithm.Sha384;case"sha512":return mm.WebhookBodyHashAlgorithm.Sha512;default:Ee(e)}}function W8f(e){if(e.type==="query-parameter")return mm.WebhookBodyHashLocation.queryParameter({name:e.name});Ee(e.type)}function H8f(e){if(e!=null)switch(e){case"sha256":return mm.WebhookSignatureAlgorithm.Sha256;case"sha1":return mm.WebhookSignatureAlgorithm.Sha1;case"sha384":return mm.WebhookSignatureAlgorithm.Sha384;case"sha512":return mm.WebhookSignatureAlgorithm.Sha512}}function Rpo(e){if(e!=null)switch(e){case"base64":return mm.WebhookSignatureEncoding.Base64;case"hex":return mm.WebhookSignatureEncoding.Hex}}function K8f(e){if(e!=null)switch(e){case"rsa-sha256":return mm.AsymmetricAlgorithm.RsaSha256;case"rsa-sha384":return mm.AsymmetricAlgorithm.RsaSha384;case"rsa-sha512":return mm.AsymmetricAlgorithm.RsaSha512;case"ecdsa-sha256":return mm.AsymmetricAlgorithm.EcdsaSha256;case"ecdsa-sha384":return mm.AsymmetricAlgorithm.EcdsaSha384;case"ecdsa-sha512":return mm.AsymmetricAlgorithm.EcdsaSha512;case"ed25519":return mm.AsymmetricAlgorithm.Ed25519}}function y0c(e,t){if(e.type==="hmac")return mm.WebhookSignatureVerification.hmac({header:e.header,algorithm:H8f(e.algorithm),encoding:Rpo(e.encoding),signaturePrefix:e["signature-prefix"],payloadFormat:h0c(e["payload-format"]),timestamp:m0c(e.timestamp),bodyHashBinding:_8f(e["body-hash-binding"],t),notificationUrlNormalization:G8f(e["url-normalization"],t)});if(e.type==="asymmetric"){let r=K8f(e["asymmetric-algorithm"]);return r==null?void 0:mm.WebhookSignatureVerification.asymmetric({header:e.header,asymmetricAlgorithm:r,encoding:Rpo(e.encoding),signaturePrefix:e["signature-prefix"],jwksUrl:e["jwks-url"],keyIdHeader:e["key-id-header"],payloadFormat:h0c(e["payload-format"]),timestamp:m0c(e.timestamp)})}}function g0c(e,t){let r=jr(e,mn.WEBHOOK_SIGNATURE);if(!(r==null||typeof r=="boolean"))return y0c(r,t)}function b0c(e,t,r){let n=jr(t,mn.WEBHOOK_SIGNATURE);return n!=null?typeof n=="boolean"?g0c(e,r):y0c(n,r):g0c(e,r)}var A0c,E0c=h(()=>{"use strict";wt();Ac();fu();zl();A0c=["sha256","sha1","sha384","sha512"]});function v0c({context:e,operationContext:t,source:r}){let{document:n,operation:i,path:o,method:s,baseBreadcrumbs:a,sdkMethodName:c}=t,u=[...a,"Payload"],l=[...a,"Response"],p=lRr({parameters:[...t.pathItemParameters,...t.operationParameters],context:e,requestBreadcrumbs:u,path:o,httpMethod:s,source:r});if(s!=="POST"&&s!=="GET")return e.logger.warn(`Skipping webhook ${s.toUpperCase()} ${o}: Only POST and GET methods are currently supported`),[];let d=i.operationId??Y8f({path:o,method:s,sdkMethodName:c}),f=i.responses?dRr({operationContext:t,streamFormat:void 0,responses:i.responses,context:e,responseBreadcrumbs:l,source:r}):void 0,m=b0c(n,i,e.logger);if(i.requestBody==null){if(p.queryParameters.length===0)return e.logger.error(`Skipping webhook ${s.toUpperCase()} ${o}: Missing a request body and no query parameters`),[];let A=p.queryParameters.map(x=>({key:x.name,schema:x.schema,readonly:void 0,writeonly:void 0,audiences:[],conflict:{},nameOverride:x.parameterNameOverride,generatedName:HA([...u,x.name],e.options.preserveSchemaIds),availability:x.availability,xml:void 0})),y=Wr.object({description:i.description,properties:A,nameOverride:void 0,generatedName:HA(u,e.options.preserveSchemaIds),title:void 0,allOf:[],allOfPropertyConflicts:[],namespace:e.namespace,groupName:void 0,fullExamples:void 0,additionalProperties:!1,availability:void 0,encoding:void 0,source:r,inline:void 0,minProperties:void 0,maxProperties:void 0});return[{summary:i.summary,audiences:jr(i,mn.AUDIENCES)??[],sdkName:c,namespace:e.namespace,method:s,operationId:d,tags:e.resolveTagsToTagIds(i.tags),headers:p.headers,generatedPayloadName:HA(u,e.options.preserveSchemaIds),payload:y,signatureVerification:m,multipartFormData:void 0,response:f?.value,description:i.description,examples:[],source:r}]}let g=Gn(i.requestBody)?e.resolveRequestBodyReference(i.requestBody):i.requestBody;return Object.entries(g.content).map(([A,y])=>hZ({mediaType:A,mediaTypeObject:y,description:g.description,document:n,context:e,requestBreadcrumbs:[...a,"Payload"],source:r,namespace:e.namespace,bodyRequired:g.required})).filter(A=>A!=null).map(A=>{if(A==null||A.type!=="json"&&A.type!=="formUrlEncoded"&&A.type!=="multipart"){e.logger.error(`Skipping webhook ${o} because non-json, non-formUrlEncoded, and non-multipart request body`);return}let y,E;return A.type==="multipart"?(y={name:A.name,properties:A.properties,description:A.description,source:A.source},E=Wr.unknown({nameOverride:void 0,generatedName:HA(u,e.options.preserveSchemaIds),title:void 0,description:A.description,availability:void 0,namespace:e.namespace,groupName:void 0,example:void 0})):E=A.schema,{summary:i.summary,audiences:jr(i,mn.AUDIENCES)??[],sdkName:c,namespace:e.namespace,method:s,operationId:d,tags:e.resolveTagsToTagIds(i.tags),headers:p.headers,generatedPayloadName:HA(u,e.options.preserveSchemaIds),payload:E,signatureVerification:m,multipartFormData:y,response:f?.value,description:i.description,examples:J8f(A.fullExamples),source:r}}).filter(A=>A!=null)}function J8f(e){if(e==null)return[];let t=[];for(let r of e){let n=K0e(r.value);n!=null&&t.push({description:r.description,name:r.name,payload:n})}return t}function Y8f({path:e,method:t,sdkMethodName:r}){if(r?.methodName!=null)return r.methodName;let n=X8f(e);if(n===e.toLowerCase())return e;let i=(0,I0c.createHash)("sha256").update(e).digest("hex").slice(0,8);return Z8f(`${n}_${t.toLowerCase()}_${i}`)}function X8f(e){return e.replace(/[{$}#]/g,"").replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/_+/g,"_").toLowerCase().slice(0,64)}function Z8f(e){return e.split("_").map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}var I0c,x0c=h(()=>{"use strict";Ac();I0c=require("crypto");fu();UDr();pZ();zb();zl();E0c();Cpo();Spo();Bpo()});function kpo({context:e,pathItemContext:t,operation:r,convertToWebhook:n}){let i=jr(r,mn.IGNORE);if(i!=null&&i){e.logger.debug(`${t.method.toUpperCase()} ${t.path} is marked with x-fern-ignore. Skipping.`);return}let o=$8f(r,e),s=pbc(e.document,r),a={...t,sdkMethodName:o,baseBreadcrumbs:e9f({operation:r,sdkMethodName:o,httpMethod:t.method,path:t.path,shouldUseIdiomaticRequestNames:e.options.shouldUseIdiomaticRequestNames}),operation:r,operationParameters:r.parameters??[],pagination:s};if(n)return{type:"webhook",value:v0c({context:e,operationContext:a,source:e.source})};let c=abc(e.document,r);if(c==null&&t9f({operation:r,context:e})&&(c={type:"stream",format:"sse",terminator:void 0,resumable:cbc(r)??ppo(e.document)??!1}),c!=null){let p=f0c({context:e,operationContext:a,streamingExtension:c});return p!=null?{type:"streaming",streaming:p.streaming,nonStreaming:p.nonStreaming}:void 0}let u=ibc(r);if(u!=null){let p=a0c({context:e,operationContext:a,asyncExtension:u,source:e.source});return{type:"async",async:p.async,sync:p.sync}}return{type:"http",value:Xle({context:e,operationContext:a,streamFormat:void 0,source:e.source})}}function $8f(e,t){let r=jr(e,mn.SDK_METHOD_NAME),n=jr(e,mn.SDK_GROUP_NAME)??[];if(r!=null){let i=typeof n=="string"?[n]:n;return i=t.resolveGroupName(i),{groupName:i,methodName:r}}}function e9f({sdkMethodName:e,operation:t,httpMethod:r,path:n,shouldUseIdiomaticRequestNames:i}){let o=[];if(e!=null){if(i&&o.push(e.methodName),e.groupName.length>0){let s=e.groupName[e.groupName.length-1];s!=null&&o.push(typeof s=="string"?s:s.name)}i||o.push(e.methodName)}else t.operationId!=null?o.push(t.operationId):o.push(ti(`${r}_${n.split("/").join("_")}`));return o}function t9f({operation:e,context:t}){if(e.responses==null)return!1;for(let[r,n]of Object.entries(e.responses)){let i=parseInt(r);if(isNaN(i)||i<200||i>=300)continue;let o=Gn(n)?t.resolveResponseReference(n):n;if(o.content!=null&&mbc(o.content))return!0}return!1}var C0c=h(()=>{"use strict";Vi();fu();zb();zl();obc();ubc();fbc();JZe();c0c();mRr();d0c();x0c()});function w0c(e,t,r,n){let i=[],o=T0c(t),s={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let a of o){if(n.filter.skipEndpoint({method:a.method,path:e})){n.logger.debug(`Skipping endpoint "${a.method} ${e}"`);continue}let c=r9f({operation:a.operation}),u=kpo({context:n,pathItemContext:{...s,method:a.method},operation:a.operation,convertToWebhook:c});u&&i.push(u)}return i}function S0c(e,t,r,n){let i=[],o=T0c(t),s={document:r,pathItem:t,path:e,pathItemParameters:t.parameters??[]};for(let a of o){if(n.filter.skipEndpoint({method:a.method,path:e})){n.logger.debug(`Skipping endpoint "${a.method} ${e}"`);continue}let c=kpo({context:n,pathItemContext:{...s,method:a.method},operation:a.operation,convertToWebhook:!0});c&&i.push(c)}return i}function T0c(e){let t=[];return e.get!=null&&t.push({method:E1.Get,operation:e.get}),e.post!=null&&t.push({method:E1.Post,operation:e.post}),e.put!=null&&t.push({method:E1.Put,operation:e.put}),e.delete!=null&&t.push({method:E1.Delete,operation:e.delete}),e.patch!=null&&t.push({method:E1.Patch,operation:e.patch}),e.head!=null&&t.push({method:E1.Head,operation:e.head}),t}function r9f({operation:e}){return jr(e,[mn.WEBHOOK])??!1}var O0c=h(()=>{"use strict";Ac();fu();zl();C0c()});function P0c(e){let t=jr(e,mn.BASIC_AUTH_USERNAME_VARIABLE_NAME),r=jr(e,mn.BASIC_AUTH_PASSWORD_VARIABLE_NAME);return{usernameVariable:t,passwordVariable:r}}var B0c=h(()=>{"use strict";fu();zl()});function D0c(e){return jr(e,mn.FERN_BASIC_AUTH)}var R0c=h(()=>{"use strict";fu();zl()});function F0c(e,t,r,n){if(Gn(e)){if(n==null)throw new S({message:`Converting referenced security schemes requires context: ${JSON.stringify(e)}`,code:S.Code.InternalError});let i=n.resolveSecuritySchemeReference(e);return k0c(i,t,r)}return k0c(e,t,r)}function k0c(e,t,r){try{if(e.type==="apiKey"&&e.in==="header"){let n=jr(e,bP.BEARER_FORMAT),i=jr(e,mn.FERN_HEADER_AUTH);return b1.header({headerName:e.name,prefix:n!=null?"Bearer":i?.prefix,headerVariableName:i?.name??jr(e,mn.HEADER_VARIABLE_NAME),headerEnvVar:i?.env,headerPlaceholder:i?.placeholder})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="bearer"){let n=jr(e,mn.FERN_BEARER_TOKEN);return b1.bearer({tokenVariableName:n?.name??jr(e,mn.BEARER_TOKEN_VARIABLE_NAME),tokenEnvVar:n?.env,tokenPlaceholder:n?.placeholder})}else if(e.type==="http"&&e.scheme?.toLowerCase()==="basic"){let n=D0c(e),i=P0c(e);return b1.basic({usernameVariableName:n?.username?.name??i.usernameVariable,usernameEnvVar:n?.username?.env,usernamePlaceholder:n?.username?.placeholder,passwordVariableName:n?.password?.name??i.passwordVariable,passwordEnvVar:n?.password?.env,passwordPlaceholder:n?.password?.placeholder})}else{if(e.type==="openIdConnect")return b1.bearer({tokenVariableName:void 0,tokenEnvVar:void 0,tokenPlaceholder:void 0});if(e.type==="oauth2")return b1.oauth({scopesEnum:n9f(e,t)})}}catch(n){r.logger.debug(`Error converting security scheme: ${n?.message}`)}r.logger.debug(`Skipping security scheme: ${JSON.stringify(e,null)} - not currently supported. Please reach out to Fern support team!`)}function n9f(e,t){let r=e.flows.authorizationCode?.scopes??e.flows.clientCredentials?.scopes??e.flows.implicit?.scopes??e.flows.password?.scopes;if(r!=null){let n=W0e({nameOverride:void 0,generatedName:"OauthScope",title:void 0,enumValues:Object.keys(r),fernEnum:Object.fromEntries(Object.entries(r).map(([o,s])=>[o,{description:s}])),_default:void 0,description:void 0,availability:void 0,enumVarNames:void 0,wrapAsOptional:!1,wrapAsNullable:!1,namespace:void 0,groupName:void 0,context:void 0,source:t,inline:void 0}),i=ld(n);if(i.type==="enum")return i}}var N0c=h(()=>{"use strict";Ac();Ft();fu();kDr();VZe();zb();VQe();zl();B0c();R0c()});function j0c({document:e,context:t}){return Njt(e,mn.GROUPS,i9f,t.logger)}var i9f,Q0c=h(()=>{"use strict";jn();fu();zl();i9f=Be.record(Be.string(),Be.object({summary:Be.string().optional(),description:Be.string().optional()}))});function z0c({context:e,document:t}){return jr(t,mn.FERN_VERSION)??void 0}var M0c=h(()=>{"use strict";fu();zl()});function L0c(e){let t=jr(e,mn.FERN_GLOBAL_HEADERS),r=[];for(let n of t??[])r.push({header:n.header,name:n.name,optional:n.optional,env:n.env,clientDefault:n["x-fern-default"],schema:n.type!=null?Mjt({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}var V0c=h(()=>{"use strict";fu();zl();ODr()});function U0c(e){let t=jr(e,mn.FERN_IDEMPOTENCY_HEADERS),r=[];for(let n of t??[])r.push({...n,schema:n.type!=null?Mjt({fernType:n.type,description:void 0,availability:void 0,generatedName:n.name??n.header,title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0}):void 0});return r}var _0c=h(()=>{"use strict";fu();zl();ODr()});function G0c(e,t){let r=jr(e,mn.SDK_VARIABLES);return r==null?{}:Object.fromEntries(Object.entries(r).map(([n,i])=>{if(i.type==="string")return[n,{nameOverride:void 0,generatedName:HA([n],t),title:i.title,schema:Ku.string({default:_Ze(i),pattern:i.pattern,format:i.format,minLength:i.minLength,maxLength:i.maxLength}),description:i.description,availability:void 0,namespace:void 0,groupName:void 0}];throw new S({message:`Variable ${n} has unsupported schema ${JSON.stringify(i)}`,code:S.Code.ValidationError})}))}var q0c=h(()=>{"use strict";Ac();Ft();fu();$lo();pZ();zl()});function W0c(e){return jr(e,o9f)??{}}var o9f,H0c=h(()=>{"use strict";fu();o9f="webhooks"});var eQt,K0c=h(()=>{"use strict";dpo();mpo();eQt=class extends YZe{nonRequestReferencedSchemas=new Set;twoOrMoreRequestsReferencedSchemas=new Set;singleRequestReferencedSchemas=new Set;discriminatedUnionReferences={};discriminatedUnionMetadata={};schemasToExclude=new Set;constructor({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s}){super({document:t,taskContext:r,authHeaders:n,options:i,source:o,namespace:s})}getDummy(){return new HQe({document:this.document,taskContext:this.taskContext,options:this.options,source:this.source,namespace:this.namespace})}markSchemaAsReferencedByNonRequest(t){this.nonRequestReferencedSchemas.add(t)}markSchemaAsReferencedByRequest(t){this.singleRequestReferencedSchemas.has(t)?this.twoOrMoreRequestsReferencedSchemas.add(t):this.singleRequestReferencedSchemas.add(t)}getReferencedSchemas(){return new Set([...this.nonRequestReferencedSchemas,...this.twoOrMoreRequestsReferencedSchemas])}markReferencedByDiscriminatedUnion(t,r,n){let i=this.discriminatedUnionReferences[t.$ref];i!=null?(i.discriminants.add(r),i.numReferences+=n):this.discriminatedUnionReferences[t.$ref]={discriminants:new Set([r]),numReferences:n}}getReferencesFromDiscriminatedUnion(t){return this.discriminatedUnionReferences[t.$ref]}markSchemaWithDiscriminantValue(t,r,n){let i=this.discriminatedUnionMetadata[t.$ref];i!=null?i.discriminants.set(r,n):this.discriminatedUnionMetadata[t.$ref]={discriminants:new Map([[r,n]])}}getDiscriminatedUnionMetadata(t){return this.discriminatedUnionMetadata[t.$ref]}excludeSchema(t){this.schemasToExclude.add(t)}isSchemaExcluded(t){return this.schemasToExclude.has(t)}}});function J0c(e){return jr(e,mn.RESOLUTIONS)}var Y0c=h(()=>{"use strict";fu();zl()});function X0c({openapi:e}){let t=J0c(e);if(t==null)return e;let r={};for(let n of t){let i=`#/components/schemas/${n.name}`;for(let o of n.resolutions)e=s9f({openapi:e,schemaReference:o,schemaName:n.name}),e=Z0c({openapi:e,replaceReference:o,schemaReference:i,replacedReferences:r}),r={...r,...Object.fromEntries(n.resolutions.map(s=>[i,s]))}}return e}function s9f({openapi:e,schemaReference:t,schemaName:r}){let n=t.replace("#/","").split("/").map(o=>o.replaceAll("~1","/")),i=e;for(let o of n){let s=i[o];if(s==null)return e;i=s}return e.components==null&&(e.components={}),e.components.schemas==null&&(e.components.schemas={}),e.components.schemas[r]=i,e}function Z0c({openapi:e,replaceReference:t,schemaReference:r,replacedReferences:n}){let i=Object.keys(n).filter(c=>t.startsWith(c)).sort((c,u)=>u.length-c.length)[0];if(i!=null){let c=n[i];if(c!=null){let u=r.replace(i,c);return Z0c({openapi:e,replaceReference:t,schemaReference:u,replacedReferences:{}})}}let o=t.replace("#/","").split("/").map(c=>c.replaceAll("~1","/")),s=e;for(let c of o.slice(0,-1)){let u=s[c];if(u==null)return e;s=u}let a=o[o.length-1];return a==null||(s[a]={$ref:r}),e}var $0c=h(()=>{"use strict";Y0c()});function tEc({openApi:e,taskContext:t,options:r,source:n,namespace:i}){e=zjt({document:e,options:r,logger:t.logger}),e=X0c({openapi:e}),MDr();let o=new eQt({document:e,taskContext:t,authHeaders:new Set,options:r,source:n,namespace:i}),s=Object.fromEntries(Object.entries(e.components?.securitySchemes??{}).map(([oe,de])=>{let we=F0c(de,n,t,o);return we==null?null:[oe,we]}).filter(oe=>oe!==null)),a=XDr(e.security?.filter(oe=>oe!=null)),c=new Set(Object.entries(s).map(([oe,de])=>de.type==="basic"||de.type==="bearer"||de.type==="oauth"?"Authorization":de.type==="header"?de.headerName:null).filter(oe=>oe!=null)),u=G0c(e,r.preserveSchemaIds),l=L0c(e),p=qbc(e),d=U0c(e),f=r.audiences??[],m=[],g=[],A=new eQt({document:e,taskContext:t,authHeaders:c,options:r,source:n,namespace:i});A.filter.hasEndpoints()&&t.logger.debug("Endpoint filter applied...");let y=LAc(e);if(y?.pathsIncludeBasePath){let oe=jjt({openApi:e,basePath:y.basePath,rootPathParameterNames:new Set(y.pathParameters.map(de=>de.name))});for(let de of oe)t.logger.warn(de)}let E=r.respectPerSpecBasePath&&y!=null&&y.pathParameters.length===0?y.basePath:void 0;Object.entries(e.paths??{}).forEach(([oe,de])=>{if(de==null)return;let we=w0c(oe,de,e,A);for(let De of we){let se=eEc({operation:De});if(!(f.length>0&&!f.some(ae=>se.includes(ae))))switch(De.type){case"async":m.push(...tQt(De.sync,E)),m.push(...tQt(De.async,E));break;case"http":m.push(...tQt(De.value,E));break;case"streaming":m.push(...tQt(De.streaming,E)),De.nonStreaming&&m.push(...tQt(De.nonStreaming,E));break;case"webhook":g.push(...De.value);break;default:Ee(De)}}}),Object.entries(W0c(e)).forEach(([oe,de])=>{if(de==null)return;t.logger.debug(`Converting path ${oe}`);let we=S0c(oe,de,e,A);for(let De of we){let se=eEc({operation:De});f.length>0&&!f.some(ae=>se.includes(ae))||g.push(...De.value)}});let x=Object.fromEntries(Object.entries(e.components?.schemas??{}).map(([oe,de])=>{let we=jr(de,mn.SDK_NAMESPACE);if(!Gn(de)){let De=jr(de,mn.IGNORE);if(De!=null&&De)return[];if(t0c.has(oe))return[oe,Qa({...de,"x-fern-type-name":`${oe}Body`},!1,!1,A,[oe],n,we??i)]}return[oe,Qa(de,!1,!1,A,[oe],n,we??i)]}).filter(oe=>oe.length>0)),v=a9f(x,A,n),C=l9f(v,A),O=lZ(),D={};for(let[oe,de]of Object.entries(C)){let we=ld(de);if(A.isSchemaExcluded(oe))continue;let De=O.getUniqueSchemaId(oe,A.logger,r.resolveSchemaCollisions);D[De]=we}let R=new J0e(C,A.nonRequestReferencedSchemas,A),P=g.map(oe=>{let we=oe.examples;if(!r.disableExamples&&we.length===0){let De=R.buildExample({schema:oe.payload,exampleId:void 0,example:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});De!=null&&(we=[{name:void 0,description:void 0,payload:De}])}return{...oe,payload:ld(oe.payload),examples:we}}),M=new qDr(C,A,l),J=m.map(oe=>{let de=oe.examples,we=de;if(!r.disableExamples&&(de.length===0||de.every(Wjt))){let ae=M.buildEndpointExample(oe);ae.length>0&&(we=[...ae,...de.filter(Oe=>!Wjt(Oe))])}let De=oe.request,se=oe.response;return{...oe,request:De?.type==="json"||De?.type==="formUrlEncoded"?{...De,schema:ld(De.schema)}:De,response:se?.type==="json"?{...se,schema:ld(se.schema)}:se,queryParameters:oe.queryParameters.map(ae=>({description:ae.description,name:ae.name,schema:ld(ae.schema),parameterNameOverride:ae.parameterNameOverride,explode:ae.explode,availability:ae.availability,source:ae.source,clientDefault:ae.clientDefault})),pathParameters:oe.pathParameters.map(ae=>({description:ae.description,name:ae.name,schema:ld(ae.schema),parameterNameOverride:ae.parameterNameOverride,variableReference:ae.variableReference,availability:ae.availability,source:ae.source,clientDefault:ae.clientDefault})),headers:oe.headers.map(ae=>({description:ae.description,name:ae.name,schema:ld(ae.schema),parameterNameOverride:ae.parameterNameOverride,env:ae.env,availability:ae.availability,source:ae.source,clientDefault:ae.clientDefault})),examples:we,errors:up(oe.errors,ae=>{let Oe=ae.fullExamples?.map(Ie=>{let Fe=K0e(Ie.value);if(Fe!=null)return{name:Ie.name,description:Ie.description,example:Fe}}).filter(sa);if(Oe?.length===0){let Ie=R.buildExample({schema:ae.schema,example:void 0,exampleId:void 0,skipReadonly:!1,options:{ignoreOptionals:!1,isParameter:!1}});Ie!=null&&Oe.push({name:void 0,description:void 0,example:Ie})}return{generatedName:ae.generatedName,nameOverride:ae.nameOverride,isWildcardStatusCode:ae.isWildcardStatusCode,schema:ld(ae.schema),description:ae.description,source:ae.source,examples:Oe,namespace:ae.namespace}}),retries:oe.retries,globalParameterIds:oe.globalParameterIds}});M.finalize();let X=j0c({document:e,context:A}),$=jr(e,mn.BASE_URL_ENV),ie;return $!=null&&(typeof $=="string"&&$.length>0?ie=$:t.logger.warn(`Expected a non-empty string value for ${mn.BASE_URL_ENV}; ignoring.`)),{apiVersion:z0c({context:A,document:e}),specVersion:e.info.version!=null&&e.info.version.length>0?e.info.version:void 0,baseUrlEnv:ie,basePath:y!=null&&(!r.respectPerSpecBasePath||y.pathParameters.length>0)?y.basePath:void 0,basePathParameters:y!=null&&y.pathParameters.length>0?y.pathParameters:void 0,title:e.info.title??"",description:e.info.description,groups:Object.fromEntries(Object.entries(X??{}).map(([oe,de])=>[oe,{summary:de.summary??void 0,description:de.description??void 0}])),servers:(e.servers??[]).map(oe=>uRr(oe,{groupMultiApiEnvironments:r.groupMultiApiEnvironments})),websocketServers:[],tags:{tagsById:Object.fromEntries((e.tags??[]).map(oe=>[oe.name,{id:oe.name,description:oe.description}])),orderedTagIds:e.tags?.map(oe=>oe.name)},endpoints:J,webhooks:P,channels:{},groupedSchemas:qZe(i,D),securitySchemes:s,security:a,hasEndpointsMarkedInternal:J.some(oe=>oe.internal),nonRequestReferencedSchemas:A.getReferencedSchemas(),variables:u,globalHeaders:l,globalParameters:p.length>0?p:void 0,idempotencyHeaders:d}}function a9f(e,t,r){if(t.options.removeDiscriminantsFromSchemas===wn.RemoveDiscriminantsFromSchemas.Never)return e;let n=u9f(e,t),i={};for(let[o,s]of Object.entries(e)){if(s.type!=="object"){i[o]=s;continue}let a={$ref:`#/components/schemas/${o}`},c=t.getReferencesFromDiscriminatedUnion(a);if(c==null){i[o]=s;continue}if(t.getReferencedSchemas().has(o)){i[o]=s;continue}let l={...s,type:"object",properties:s.properties.filter(d=>!c.discriminants.has(d.key)),allOfPropertyConflicts:s.allOfPropertyConflicts.filter(d=>!c.discriminants.has(d.propertyKey)),source:r};i[o]=l;let p=Fpo({schema:s,schemas:e});for(let d of[...new Set(p)]){if(n.has(d))continue;let f=i[d]??e[d];f==null||f.type!=="object"||(i[d]={...f,type:"object",properties:f.properties.filter(m=>!c.discriminants.has(m.key)),allOfPropertyConflicts:f.allOfPropertyConflicts.filter(m=>!c.discriminants.has(m.propertyKey))})}}return i}function c9f(e,t){if(t==null||t==="/")return e;let r=t.replace(/\/+$/,"");if(e===r||e.startsWith(`${r}/`))return e;let n=e.replace(/^\/+/,"");return n.length>0?`${r}/${n}`:r}function tQt(e,t){return t==null||t==="/"?e:e.map(r=>({...r,path:c9f(r.path,t)}))}function u9f(e,t){let r=new Set;for(let[n,i]of Object.entries(e)){if(i.type!=="object")continue;let o={$ref:`#/components/schemas/${n}`};if(t.getReferencesFromDiscriminatedUnion(o)==null)for(let s of Fpo({schema:i,schemas:e}))r.add(s)}return r}function l9f(e,t){let r={};for(let[n,i]of Object.entries(e)){if(i.type!=="object"){r[n]=i;continue}let o={$ref:`#/components/schemas/${n}`},s=t.getDiscriminatedUnionMetadata(o);if(s==null){r[n]=i;continue}let a=[];for(let u of i.properties)if(s.discriminants.has(u.key)){let l=s.discriminants.get(u.key);l!=null&&a.push({...u,schema:Wr.literal({nameOverride:void 0,generatedName:HA([i.generatedName,l],t.options.preserveSchemaIds),title:void 0,value:Ty.string(l),namespace:void 0,groupName:void 0,description:void 0,availability:i.availability})})}else a.push(u);let c={...i,type:"object",properties:a};r[n]=c}return r}function Fpo({schema:e,schemas:t}){let r=[];for(let n of e.allOf){r.push(n.schema);let i=t[n.schema];i!=null&&i.type==="object"&&r.push(...Fpo({schema:i,schemas:t}))}return r}function hRr(e){return[...new Set(e)]}function eEc({operation:e}){let t=[];switch(e.type){case"async":t=hRr(e.async.flatMap(r=>r.audiences));break;case"http":t=hRr(e.value.flatMap(r=>r.audiences));break;case"streaming":t=hRr(e.streaming.flatMap(r=>r.audiences));break;case"webhook":t=hRr(e.value.flatMap(r=>r.audiences));break;default:Ee(e)}return t}var rEc=h(()=>{"use strict";aa();wt();Ac();Vi();fu();ID();UDr();_Dr();VZe();pZ();zb();VDr();lpo();Ljt();O0c();N0c();xpo();Ppo();opo();zl();Dlo();Q0c();M0c();V0c();vpo();_0c();q0c();Flo();H0c();ipo();K0c();$0c()});function lze({context:e,documents:t,options:r}){let n={apiVersion:void 0,specVersion:void 0,baseUrlEnv:void 0,title:void 0,description:void 0,basePath:void 0,basePathParameters:void 0,servers:[],websocketServers:[],tags:{tagsById:{},orderedTagIds:void 0},hasEndpointsMarkedInternal:!1,endpoints:[],webhooks:[],channels:{},groupedSchemas:{rootSchemas:{},namespacedSchemas:{}},variables:{},nonRequestReferencedSchemas:new Set,securitySchemes:{},security:void 0,globalHeaders:[],globalParameters:void 0,idempotencyHeaders:[],groups:{}},i=0;for(let o of t)try{let s=o.source!=null?o.source:bD.openapi({file:"<memory>"});switch(o.type){case"openapi":{let a=tEc({taskContext:e,openApi:o.value,options:GU({options:o.settings,overrides:r}),source:s,namespace:o.namespace});n=y9f(n,a,GU({options:o.settings,overrides:r}),e),i++;break}case"asyncapi":{let a=rbc({document:o.value,taskContext:e,options:GU({options:o.settings,overrides:r}),source:s,asyncApiOptions:p9f({options:o.settings}),namespace:o.namespace});a.servers!=null&&(n.websocketServers=[...n.websocketServers,...a.servers.map(c=>({...c,audiences:void 0,description:void 0,defaultUrl:void 0,urlTemplate:void 0,variables:void 0}))]),a.channels!=null&&(n.channels={...n.channels,...a.channels}),a.groupedSchemas!=null&&(n.groupedSchemas=gRr(n.groupedSchemas,a.groupedSchemas,r)),a.basePath!=null&&(n.basePath=a.basePath),i++;break}default:Ee(o)}}catch(s){e.logger.error(`Failed to parse ${o.type} document ${o.type==="openapi"?o.value.info?.title:o.source?.file}`),s instanceof Error&&e.logger.error(s.message,s.stack?`
211
211
  `+s.stack:"")}return n}function p9f({options:e,overrides:t}){return{naming:t?.naming??e?.asyncApiNaming??KAc.naming}}function Qpo(e){return String(e.description||e.name||e["x-fern-server-name"]||"default").trim()}function rQt(e){return iEc(Qpo(e))}function iEc(e){let t=e.toUpperCase();return t==="PRODUCTION"||t==="PRD"||t==="PROD"?"PRD":t==="SANDBOX"||t==="SBX"?"SBX":t==="STAGING"||t==="STG"?"STG":t==="PERFORMANCE"||t==="PRF"||t==="PERF"?"PRF":t==="E2E"||t==="E_2_E"?"E2E":t==="QAL"||t==="QUALITY"?"QAL":e}function f9f(e){try{let n=new URL(e).hostname.split("."),i=new Set(["api","www","service","services","example","com","org","net","io"]);for(let s of n){let a=s.split("-")[0],c=a&&a.length>2?a:s;if(c&&!i.has(c.toLowerCase())&&c.length>2)return c.toLowerCase()}let o=n[0];return o&&o.length>0?o.toLowerCase():"api"}catch{let t=e.match(/https?:\/\/([^./-]+)/);return t&&t[1]?t[1].toLowerCase():"api"}}function Npo(e,t){if(!(e==null&&t==null))return[...e??[],...t??[]]}function jpo(e,t){let r=e??[],n=t??[];if(r.length===0&&n.length===0)return;let i=new Map;for(let o of[...r,...n]){let s=Object.keys(o).sort(),a={};for(let u of s)a[u]=o[u]??[];let c=JSON.stringify(a);i.has(c)||i.set(c,o)}return Array.from(i.values())}function d9f(e,t){if(g9f(e))return!0;if(e.length===0||t.length===0||e.length!==t.length)return!1;let r=new Map;for(let o of e){if(o.type==="grouped")continue;let s=rQt(o);r.set(s,o.url)}let n=!0,i=!0;for(let o of t){if(o.type==="grouped")continue;let s=rQt(o),a=r.get(s);a?a===o.url&&(i=!1):n=!1}return n&&i}function m9f(e){let t=new Set;return e.filter(r=>{if(r.type==="grouped")return!0;let n=`${rQt(r)}\0${r.url}`;return t.has(n)?!1:(t.add(n),!0)})}function h9f(e){return e.defaultUrl??e.url}function nEc(e){if(e.length===0||!e[0])return"api";let t=e[0];return t.type==="grouped"?Object.keys(t.urls)[0]??"api":f9f(h9f(t))}function g9f(e){return e.some(t=>t.type==="grouped")}function A9f(e,t,r,n){return r?.respectPerSpecBasePath===!0&&e.basePath!=null&&t.basePath!=null&&e.basePath!==t.basePath&&n.failWithoutThrowing(`Conflicting parameterized x-fern-base-path values: '${e.basePath}' and '${t.basePath}'.`),{basePath:e.basePath??t.basePath,basePathParameters:e.basePathParameters??t.basePathParameters}}function y9f(e,t,r,n){let i=A9f(e,t,r,n);if(!(r?.groupMultiApiEnvironments===!0))return{apiVersion:e.apiVersion??t.apiVersion,specVersion:e.specVersion??t.specVersion,baseUrlEnv:e.baseUrlEnv??t.baseUrlEnv,title:e.title??t.title,description:e.description??t.description,basePath:i.basePath,basePathParameters:i.basePathParameters,servers:[...e.servers,...t.servers],websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:[...e.endpoints,...t.endpoints],webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:gRr(e.groupedSchemas,t.groupedSchemas,r),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:jpo(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,globalParameters:Npo(e.globalParameters,t.globalParameters),idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}};if(d9f(e.servers,t.servers)){let a=[],c=[],u=nEc(t.servers),l=new Map,p=new Map,d=nEc(e.servers);for(let g of e.servers)if(g.type==="grouped"){let A=g.name??"default",y=iEc(A);p.has(y)||p.set(y,A),l.has(y)||l.set(y,{});let E=l.get(y);if(E)for(let[x,v]of Object.entries(g.urls))E[x]=v}else{let A=rQt(g);p.has(A)||p.set(A,Qpo(g)),l.has(A)||l.set(A,{});let y=l.get(A);y&&(y[d]={url:g.url,audiences:g.audiences,defaultUrl:g.defaultUrl,urlTemplate:g.urlTemplate,variables:g.variables})}for(let g of t.servers){let A=rQt(g);p.has(A)||p.set(A,Qpo(g)),l.has(A)||l.set(A,{});let y=l.get(A);y&&(y[u]={url:g.url,audiences:g.audiences,defaultUrl:g.defaultUrl,urlTemplate:g.urlTemplate,variables:g.variables})}for(let[g,A]of l.entries()){let y=p.get(g)??g,E={type:"grouped",name:y,description:`${y} environment`,urls:A};a.push(E)}let f=e.endpoints.map(g=>{let A=g.__apiName;return A?{...g,type:"multi-api",apiName:A,servers:[{name:A,url:void 0,audiences:void 0}]}:{...g,type:"multi-api",apiName:d,servers:[{name:d,url:void 0,audiences:void 0}]}}),m=t.endpoints.map(g=>({...g,type:"multi-api",apiName:u,servers:[{name:u,url:void 0,audiences:void 0}]}));return c=[...f,...m],{apiVersion:e.apiVersion??t.apiVersion,specVersion:e.specVersion??t.specVersion,baseUrlEnv:e.baseUrlEnv??t.baseUrlEnv,title:e.title??t.title,description:e.description??t.description,basePath:i.basePath,basePathParameters:i.basePathParameters,servers:a,websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:c.map(g=>{if(g.type==="multi-api"){let{type:E,apiName:x,servers:v,...C}=g;return{...C,__apiName:x,servers:v}}let{type:A,...y}=g;return y}),webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:gRr(e.groupedSchemas,t.groupedSchemas,r),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:jpo(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,globalParameters:Npo(e.globalParameters,t.globalParameters),idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}}}return{apiVersion:e.apiVersion??t.apiVersion,specVersion:e.specVersion??t.specVersion,baseUrlEnv:e.baseUrlEnv??t.baseUrlEnv,title:e.title??t.title,description:e.description??t.description,basePath:i.basePath,basePathParameters:i.basePathParameters,servers:m9f([...e.servers,...t.servers]),websocketServers:[...e.websocketServers,...t.websocketServers],tags:{tagsById:{...e.tags.tagsById,...t.tags.tagsById},orderedTagIds:e.tags.orderedTagIds==null&&t.tags.orderedTagIds==null?void 0:[...e.tags.orderedTagIds??[],...t.tags.orderedTagIds??[]]},hasEndpointsMarkedInternal:e.hasEndpointsMarkedInternal||t.hasEndpointsMarkedInternal,endpoints:[...e.endpoints,...t.endpoints],webhooks:[...e.webhooks,...t.webhooks],channels:{...e.channels,...t.channels},groupedSchemas:gRr(e.groupedSchemas,t.groupedSchemas,r),variables:{...e.variables,...t.variables},nonRequestReferencedSchemas:new Set([...e.nonRequestReferencedSchemas,...t.nonRequestReferencedSchemas]),securitySchemes:{...e.securitySchemes,...t.securitySchemes},security:jpo(e.security,t.security),globalHeaders:e.globalHeaders!=null?[...e.globalHeaders,...t.globalHeaders??[]]:void 0,globalParameters:Npo(e.globalParameters,t.globalParameters),idempotencyHeaders:e.idempotencyHeaders!=null?[...e.idempotencyHeaders,...t.idempotencyHeaders??[]]:void 0,groups:{...e.groups,...t.groups}}}function gRr(e,t,r){let n=lZ(),i=r?.resolveSchemaCollisions??!1,o={...e.rootSchemas};for(let[s,a]of Object.entries(t.rootSchemas)){let c=n.getUniqueSchemaId(s,void 0,i);o[c]=a}e.rootSchemas=o;for(let[s,a]of Object.entries(t.namespacedSchemas))if(e.namespacedSchemas[s]!=null){let c=e.namespacedSchemas[s];for(let[u,l]of Object.entries(a)){let p=n.getUniqueSchemaId(u,void 0,i);c[p]=l}}else e.namespacedSchemas[s]=a;return e}var oEc=h(()=>{"use strict";wt();Ac();JAc();nbc();rEc();Nlo();Ljt()});var TW=h(()=>{"use strict";FAc();jAc();VQe();zl();Dlo();Flo();Nlo();oEc()});var s$e=b((X$0,pze)=>{"use strict";function sEc(e){return typeof e>"u"||e===null}function b9f(e){return typeof e=="object"&&e!==null}function E9f(e){return Array.isArray(e)?e:sEc(e)?[]:[e]}function I9f(e,t){if(t){let r=Object.keys(t);for(let n=0,i=r.length;n<i;n+=1){let o=r[n];e[o]=t[o]}}return e}function v9f(e,t){let r="";for(let n=0;n<t;n+=1)r+=e;return r}function x9f(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}pze.exports.isNothing=sEc;pze.exports.isObject=b9f;pze.exports.toArray=E9f;pze.exports.repeat=v9f;pze.exports.isNegativeZero=x9f;pze.exports.extend=I9f});var a$e=b((Z$0,cEc)=>{"use strict";function aEc(e,t){let r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
212
212
 
213
213
  `+e.mark.snippet),n+" "+r):n}function nQt(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=aEc(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}nQt.prototype=Object.create(Error.prototype);nQt.prototype.constructor=nQt;nQt.prototype.toString=function(t){return this.name+": "+aEc(this,t)};cEc.exports=nQt});var lEc=b(($$0,uEc)=>{"use strict";var iQt=s$e();function zpo(e,t,r,n,i){let o="",s="",a=Math.floor(i/2)-1;return n-t>a&&(o=" ... ",t=n-a+o.length),r-n>a&&(s=" ...",r=n+a-s.length),{str:o+e.slice(t,r).replace(/\t/g,"\u2192")+s,pos:n-t+o.length}}function Mpo(e,t){return iQt.repeat(" ",t-e.length)+e}function C9f(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);let r=/\r?\n|\r|\0/g,n=[0],i=[],o,s=-1;for(;o=r.exec(e.buffer);)i.push(o.index),n.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);let a="",c=Math.min(e.line+t.linesAfter,i.length).toString().length,u=t.maxLength-(t.indent+c+3);for(let p=1;p<=t.linesBefore&&!(s-p<0);p++){let d=zpo(e.buffer,n[s-p],i[s-p],e.position-(n[s]-n[s-p]),u);a=iQt.repeat(" ",t.indent)+Mpo((e.line-p+1).toString(),c)+" | "+d.str+`
@@ -738,7 +738,7 @@ ${s.commentBefore}`:o}e.comment=r.after.join(`
738
738
  `)),a.length>0&&Xrm(s,a),s}throw o}}async function Yrm(e){let t=await(0,W1u.readFile)(e,"utf-8");return e.toLowerCase().endsWith(".json")?JSON.parse(t):Ir.load(t)}function Xrm(e,t){if(typeof e!="object"||e==null)return;let r=new Set;for(let n of t)n.ref.startsWith("#/")&&r.add(n.ref);tNo(e,r)}function tNo(e,t){if(typeof e!="object"||e==null)return;if(Array.isArray(e)){for(let n=0;n<e.length;n++){let i=e[n];q1u(i,t)?e[n]={type:"object","x-fern-circular-ref":!0}:tNo(i,t)}return}let r=e;for(let n of Object.keys(r)){let i=r[n];q1u(i,t)?r[n]={type:"object","x-fern-circular-ref":!0}:tNo(i,t)}}function q1u(e,t){if(typeof e!="object"||e==null||Array.isArray(e))return!1;let r=e;return typeof r.$ref=="string"&&t.has(r.$ref)}var gUt,W1u,H1u=h(()=>{"use strict";Pc();gUt=be(hzt(),1),W1u=require("fs/promises");Wo();L1u();G1u()});async function rNo(e,t,r){await Z_r(e,t,r,"",void 0)}async function Z_r(e,t,r,n,i){if(Array.isArray(e)){await Promise.all(e.map((o,s)=>Z_r(o,t,r,`${n}[${s}]`,i)));return}if(io(e))for(let[o,s]of Object.entries(e)){let a=n===""?o:`${n}.${o}`;if(o==="description"&&!(i!=null&&Zrm.has(i))){if(typeof s=="string"||s==null)continue;if($rm(s)){e[o]=await rnm(s.$ref,t,r,a);continue}if(enm(s)){r.logger.warn(`OpenAPI description at "${a}" is a \`$ref\` object we can't resolve (${tnm(s)}). Descriptions must be plain strings, and we only inline relative \`.md\` file refs. Coercing to empty string so generation can continue.`),e[o]="";continue}await Z_r(s,t,r,a,o)}else await Z_r(s,t,r,a,o)}}function $rm(e){if(!io(e))return!1;let t=Object.keys(e);if(t.length!==1||t[0]!=="$ref")return!1;let r=e.$ref;return typeof r!="string"||r.length===0||r.startsWith("#")||r.startsWith("http://")||r.startsWith("https://")?!1:r.toLowerCase().endsWith(".md")}function enm(e){return io(e)&&typeof e.$ref=="string"&&e.$ref.length>0}function tnm(e){let t=e.$ref,r=Object.keys(e).filter(i=>i!=="$ref"),n=r.length>0?`, sibling keys: ${r.map(i=>`"${i}"`).join(", ")}`:"";return`target="${t}"${n}`}async function rnm(e,t,r,n){let i=(0,J1u.resolve)(t,e);try{return(await(0,K1u.readFile)(i,"utf-8")).trimEnd()}catch(o){return r.logger.warn(`Failed to resolve markdown description $ref at "${n}" \u2192 "${e}" (${i}): ${o instanceof Error?o.message:String(o)}. Coercing to empty string so generation can continue.`),""}}var K1u,J1u,Zrm,Y1u=h(()=>{"use strict";wt();K1u=require("fs/promises"),J1u=require("path");Zrm=new Set(["properties","patternProperties"])});function nnm(e,t){if(t.includes(e))return e;for(let r of t){let n=r.replace(/\{[^}]+\}/g,"([^/]+)");if(new RegExp(`^${n}$`).test(e))return r}}async function d3e({context:e,absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:r,absolutePathToOpenAPIOverlays:n,loadAiExamples:i=!1}){let o=await(0,nNo.readFile)(t,"utf-8"),s;try{s=Ir.load(o)}catch(p){if(!(p instanceof Ir.YAMLException))throw p;let f=`Failed to parse ${X1u.default.relative(process.cwd(),t)}: ${p.reason}`;throw p.mark!=null&&(f+=`
739
739
  at line ${p.mark.line+1}, column ${p.mark.column+1}`,p.mark.snippet&&(f+=`
740
740
 
741
- ${p.mark.snippet}`)),new S({message:f,code:S.Code.ParseError})}await rNo(s,sn(t),e);let a=await X_r({absolutePathToOpenAPI:t,logger:e.logger,parsed:s}),c=[];r!=null?Array.isArray(r)?c=r:c=[r]:typeof a=="object"&&a[mn.OPENAPI_OVERIDES_FILEPATH]!=null&&(c=[ze(sn(t),ve.of(a[mn.OPENAPI_OVERIDES_FILEPATH]))]);let u=a;for(let p of c)u=await hit({absoluteFilePathToOverrides:p,context:e,data:u,allowNullKeys:inm}),await rNo(u,sn(p),e),u=await X_r({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:p,parsed:u,logger:e.logger});if(n!=null&&(u=await Q1u({absoluteFilePathToOverlay:n,absoluteFilePathToOpenAPI:t,context:e,data:u})),i){let p=ze(sn(t),ve.of("ai_examples_override.yml"));try{let d=await(0,nNo.readFile)(p,"utf-8"),f=Ir.load(d);if(f?.paths&&u.paths){for(let[m,g]of Object.entries(f.paths))if(g&&typeof g=="object")for(let[A,y]of Object.entries(g)){let E=A.toLowerCase(),x=u.paths[m];if(!x&&u.paths){let v=nnm(m,Object.keys(u.paths));v&&(x=u.paths[v],e.logger.debug(`Matched override path "${m}" to OpenAPI path "${v}" using pattern matching`))}if(x&&typeof x=="object"){let C=x[E];if(C&&typeof C=="object"){let O=C;!O["x-fern-examples"]&&y["x-fern-examples"]&&(O["x-fern-examples"]=y["x-fern-examples"],e.logger.debug(`Added AI examples for ${A.toUpperCase()} ${m} from override file`))}}}}e.logger.debug(`Processed AI examples from ${p}`)}catch{}}return u!==a&&c.length===0||n!=null?await X_r({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverlays:n,parsed:u,logger:e.logger}):u}var X1u,nNo,inm,iNo=h(()=>{"use strict";X1u=be(require("path"),1);Yt();TW();Ft();nNo=require("fs/promises");Wo();z1u();K_r();H1u();Y1u();inm=["examples","example",mn.EXAMPLES,bP.REDOCLY_CODE_SAMPLES_CAMEL,bP.REDOCLY_CODE_SAMPLES_KEBAB]});var Z1u,ide,oNo=h(()=>{"use strict";Pc();Yt();Ac();TW();Z1u=require("fs/promises");fwu();Y2o();X2o();iNo();ide=class{absoluteFilePath;constructor(t){this.absoluteFilePath=t}async loadDocuments({context:t,specs:r,loadAiExamples:n=!1}){return(await Promise.all(r.map(o=>this.loadDocument({context:t,spec:o,loadAiExamples:n})))).filter(o=>o!=null)}async loadDocument({context:t,spec:r,loadAiExamples:n}){try{let i=(await(0,Z1u.readFile)(r.absoluteFilepath)).toString(),o=Oo(this.absoluteFilePath,r.source.file);r.source.relativePathToDependency!=null&&(o=ze(r.source.relativePathToDependency,o));let s=r.source.type==="protobuf"?bD.protobuf({file:o}):bD.openapi({file:o});if(i.includes("openapi")||i.includes("swagger"))try{let a=await d3e({absolutePathToOpenAPI:r.absoluteFilepath,context:t,absolutePathToOpenAPIOverrides:r.absoluteFilepathToOverrides,absolutePathToOpenAPIOverlays:r.absoluteFilepathToOverlays,loadAiExamples:n});if(vAo(a))return{type:"openapi",value:await XFo({document:a,settings:r.settings}),source:s,namespace:r.namespace,settings:GU({options:r.settings})};if(JF(a)){(!a.schemes||a.schemes.length===0)&&(a.schemes=["https"]);let c=await b2(a,{context:t});return{type:"openapi",value:await XFo({document:c,settings:r.settings}),source:s,namespace:r.namespace,settings:GU({options:r.settings})}}}catch(a){t.logger.debug(`Failed to parse OpenAPI document at ${r.absoluteFilepath}: ${a}. Skipping...`);return}if(i.includes("asyncapi"))try{return{type:"asyncapi",value:await Ait({context:t,absoluteFilePath:r.absoluteFilepath,absoluteFilePathToOverrides:r.absoluteFilepathToOverrides}),source:s,namespace:r.namespace,settings:GU({options:r.settings})}}catch(a){t.logger.error(`Failed to parse AsyncAPI document at ${r.absoluteFilepath}: ${a}. Skipping...`);return}if(i.includes("openrpc"))try{return{type:"asyncapi",value:await Ait({context:t,absoluteFilePath:r.absoluteFilepath,absoluteFilePathToOverrides:r.absoluteFilepathToOverrides}),source:s,namespace:r.namespace,settings:GU({options:r.settings})}}catch(a){t.logger.error(`Failed to parse OpenRPC document at ${r.absoluteFilepath}: ${a}. Skipping...`);return}t.logger.warn(`${r.absoluteFilepath} is not a valid OpenAPI, AsyncAPI, or OpenRPC file. Skipping...`);return}catch(i){t.logger.error(`Failed to read or process file ${r.absoluteFilepath}: ${i}. Skipping...`);return}}}});var Ji,$_r=h(()=>{"use strict";_n();Ji=class e{breadcrumbs=[];context;static STRING=Ut.TypeReference.primitive({v1:"STRING",v2:Ut.PrimitiveTypeV2.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=Ut.TypeReference.container(Ut.ContainerType.optional(e.STRING));constructor({breadcrumbs:t=[],context:r}){this.breadcrumbs=t,this.context=r}}});var sNo,$1u,eTu=h(()=>{"use strict";sNo=class{_map;_path;_lastScalar;_fragments;_count;constructor(){this._map={},this._path=[],this._lastScalar="",this._fragments=[],this._count=0}get map(){return this._map}resolveNode(t,r){if(t.path==="."&&(r="."),!this._map[r]){let{line:n,position:i,lineStart:o}=t;this._map[r]={line:n,position:i,lineStart:o}}t.children&&t.children.length>0&&t.children.forEach(n=>{this.resolveNode(n,(r==="."?"":r)+"."+n.path)})}iterFragments(t,r){for(let n=this._fragments.length-1;n>=0;n--){if(!this._fragments[n].path.startsWith(t)||this._fragments[n].path===t)continue;let i=this._fragments.pop();r(i)}}handleState(t,r){if(t==="close"){let n=r.result,i=r.kind,o=this._path.join(".");if(i==="scalar"){this._path.pop(),this._lastScalar=`${n}`;let{line:s,position:a,lineStart:c}=r;this._path.length===0?this._map["."+n]={line:s,position:a,lineStart:c}:this._fragments.push({path:this._path.join(".")+"."+n,line:s,position:a,lineStart:c})}else if(i==="mapping"){let s={path:o,children:[],line:0,position:0,lineStart:0},a=0;this.iterFragments(o,c=>{a++,!((!c.children||c.children.length===0)&&a%2===1)&&(this._path.length===1?this.resolveNode(c,c.path):(s.children.push({...c,path:c.path.slice(o.length+1)}),s.line=c.line,s.position=c.position,s.lineStart=c.lineStart))}),s.children&&s.children.length>0&&this._fragments.push(s),this._path.pop()}else if(i==="sequence"){let s={path:o,children:[],line:0,position:0,lineStart:0},a=new Set,c=n.length;this.iterFragments(o,u=>{a.has(u.position)||(c--,a.add(u.position),this._path.length===1?this.resolveNode(u,`${o}.${c}`):(s.children.push({...u,path:c.toString()}),s.line=u.line,s.position=u.position,s.lineStart=u.lineStart))}),s.children&&s.children.length>0&&this._fragments.push(s),this._path.pop()}else this._path.pop()}if(t==="open"){if(this._count===0){let{line:n,position:i,lineStart:o}=r;this._map["."]={line:n,position:i,lineStart:o}}this._path.push(this._lastScalar),this._count++}}listen(){return this.handleState.bind(this)}lookup(t){let r=t instanceof Array?t.map(i=>`${i}`).join("."):`${t}`;r.startsWith(".")||(r="."+r),r.startsWith("..")&&(r=r.slice(1)),r=r.replace(/\[/g,".").replace(/\]/g,"");let n=this._map[r];if(n)return{line:n.line+1,column:n.position-n.lineStart+1,position:n.position}}},$1u=sNo});var tTu,G0,$_,aNo,AUt=h(()=>{"use strict";Yt();jb();tTu=require("fs/promises");Wo();eTu();(function(e){e.WARNING="warning",e.ERROR="error"})(G0||(G0={}));$_=class{errors=[];logger;breadcrumbToLineNumberMapper;relativeFilepathToSpec;constructor({logger:t,relativeFilepathToSpec:r}){this.logger=t,this.relativeFilepathToSpec=r,r&&(this.breadcrumbToLineNumberMapper=new aNo({logger:t,relativePathToFile:ve.of(r)}))}collect(t){this.errors.push(t)}getErrors(){return this.errors}hasErrors(){return this.errors.length>0}dedupe(){let t=[],r=new Set,n=0;for(let i of this.errors){let o=i.path?i.path.join("->"):"",s=`${i.message}|${i.level||G0.WARNING}|${o}`;r.has(s)?n++:(r.add(s),t.push(i))}return this.errors=t,n}getErrorStats(){this.dedupe();let t=0,r=0;for(let n of this.errors)n.level===G0.ERROR?t++:(n.level===G0.WARNING||n.level===void 0)&&r++;return{numErrors:t,numWarnings:r}}async logErrors({logWarnings:t}){this.dedupe();for(let r of this.errors){let n=r.level??G0.WARNING;if(!(n===G0.WARNING&&!t))switch(n){case G0.ERROR:if(this.logger.log(Hn.Debug,r.message),r.path&&r.path.length>0){let i=await this.breadcrumbToLineNumberMapper?.getSourceLocation(r.path),o=i?`${this.relativeFilepathToSpec}:${i.line}:${i.column}`:r.path.join(" -> ");this.logger.log(Hn.Debug,` - at location (${o})`)}break;case G0.WARNING:if(this.logger.log(Hn.Warn,r.message),r.path&&r.path.length>0){let i=await this.breadcrumbToLineNumberMapper?.getSourceLocation(r.path),o=i?`${this.relativeFilepathToSpec}:${i.line}:${i.column}`:r.path.join(" -> ");this.logger.log(Hn.Warn,` - at location (${o})`)}r.resolution&&this.logger.log(Hn.Warn,` - resolution: ${r.resolution}`);break}}}},aNo=class{logger;relativePathToFile;map=new $1u;initialized=!1;constructor({relativePathToFile:t,logger:r}){this.relativePathToFile=t,this.logger=r}async initialize(){if(!this.initialized)try{let t=await(0,tTu.readFile)(this.relativePathToFile,"utf-8");Ir.load(t,{listener:this.map.listen()}),this.initialized=!0}catch(t){this.logger.log(Hn.Warn,`Failed to initialize line number mapping for ${this.relativePathToFile}: ${JSON.stringify(t)}`)}}async getSourceLocation(t){return this.initialized||await this.initialize(),this.map.lookup(t)}}});function onm(e){return"deprecated"in e&&e.deprecated===!0}var Wb,rTu=h(()=>{"use strict";F_();_n();Wo();Vi();AUt();Uo();Wb=class e{args;spec;settings;errorCollector;logger;generationLanguage;smartCasing;casingsGenerator;namespace;exampleGenerationArgs;authOverrides;environmentOverrides;globalHeaderOverrides;enableUniqueErrorsPerEndpoint;generateV1Examples;documentBaseDir;constructor(t){this.args=t,this.spec=t.spec,this.settings=t.settings,this.errorCollector=t.errorCollector,this.logger=t.logger,this.generationLanguage=t.generationLanguage,this.smartCasing=t.smartCasing,this.namespace=t.namespace,this.casingsGenerator=Zw({generationLanguage:t.generationLanguage,keywords:void 0,smartCasing:t.smartCasing}),this.exampleGenerationArgs=t.exampleGenerationArgs,this.authOverrides=t.authOverrides,this.environmentOverrides=t.environmentOverrides,this.globalHeaderOverrides=t.globalHeaderOverrides,this.enableUniqueErrorsPerEndpoint=t.enableUniqueErrorsPerEndpoint,this.generateV1Examples=t.generateV1Examples,this.documentBaseDir=t.documentBaseDir}static BREADCRUMBS_TO_IGNORE=["properties","allOf","anyOf"];convertBreadcrumbsToName(t){let r=t.filter((i,o)=>!(/^\d+$/.test(i)||e.BREADCRUMBS_TO_IGNORE.includes(i)||o===0&&i==="components"||o===1&&i==="schemas"||t[0]==="paths"&&(o===0||o===1&&["get","post","put","delete","patch"].includes(i)||o===2&&t[1]!=null&&["get","post","put","delete","patch"].includes(t[1])&&i==="parameters"))),n=ti(r.join("_"));return n.charAt(0).toUpperCase()+n.slice(1)}createFernFilepath(t={}){let r=this.namespace!=null?[this.casingsGenerator.generateName(this.namespace)]:[],n=t.name!=null?this.casingsGenerator.generateName(t.name):void 0;return{allParts:n?[...r,n]:r,packagePath:r,file:n}}resolveReference({reference:t,breadcrumbs:r,skipErrorCollector:n}){let i=this.spec,o=t.$ref.replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(s=>s.replace(/~1/g,"/"));for(let s of o){if(typeof i!="object"||i==null)return n||this.errorCollector.collect({level:G0.ERROR,message:this.getErrorMessageForMissingRef({reference:t}),path:r}),{resolved:!1};i=i[s]}return i==null?(n||this.errorCollector.collect({level:G0.ERROR,message:this.getErrorMessageForMissingRef({reference:t}),path:r}),{resolved:!1}):{resolved:!0,value:i}}getErrorMessageForMissingRef({reference:t}){let r=t.$ref.replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/");return r.length>=3&&r[0]==="components"&&r[1]==="schemas"?`Schema ${r[2]} does not exist`:`${t.$ref} does not exist`}async resolveMaybeExternalReference(t){let r=this.spec,n,i=!1,o=null,s;if(this.isExternalReference(t.$ref)){i=!0;let u=t.$ref.split("#"),l=u[0];if(n=u[1],!l)return{resolved:!1};s=l;let p=await fetch(l);if(!p.ok)return{resolved:!1};try{let d=await p.text();try{o=JSON.parse(d),r=o}catch{o=Ir.load(d),r=o}if(r==null)return{resolved:!1}}catch{return{resolved:!1}}if(!n)return{resolved:!0,value:r}}let a=n??t.$ref;if(a==null||typeof a!="string")return{resolved:!1};let c=a.replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(u=>u.replace(/~1/g,"/"));for(let u of c){if(typeof r!="object"||r==null)return{resolved:!1};r=r[u]}if(r==null)return{resolved:!1};if(i&&typeof r=="object"&&r!==null){let u=new Set;u.add(t.$ref),r=await this.resolveNestedExternalReferences(r,o,u,s)}return{resolved:!0,value:r}}async resolveNestedExternalReferences(t,r,n,i){if(t===null||typeof t!="object")return t;if(Array.isArray(t)){let s=[];for(let a of t)s.push(await this.resolveNestedExternalReferences(a,r,n,i));return s}if(this.isReferenceObject(t)){let s=t.$ref;if(this.isExternalReference(s)){if(n.has(s))return t;n.add(s);let a=await this.resolveMaybeExternalReference({$ref:s});if(n.delete(s),a.resolved)return a.value}else{let a=`${i}${s}`;if(n.has(a))return t;n.add(a);let c=r,u=s.substring(2).split("/").map(l=>l.replace(/~1/g,"/").replace(/~0/g,"~"));for(let l of u){if(typeof c!="object"||c===null)return t;c=c[l]}if(c!=null){let l=await this.resolveNestedExternalReferences(c,r,n,i);return n.delete(s),l}n.delete(s)}return t}let o={};for(let[s,a]of Object.entries(t))typeof a=="object"&&a!==null?o[s]=await this.resolveNestedExternalReferences(a,r,n,i):o[s]=a;return o}getExamplesFromSchema({schema:t,breadcrumbs:r}){if(t==null)return[];let n=t.example!=null?[t.example]:[];return t.examples!=null&&(Array.isArray(t.examples)?n.push(...t.examples):this.errorCollector.collect({message:"Received non-array schema examples",path:r})),n}getNamedExamplesFromMediaTypeObject({mediaTypeObject:t,breadcrumbs:r,defaultExampleName:n}){if(t==null)return[];let i=[];if(t.example!=null){let o=this.generateUniqueName({prefix:n??`${r.join("_")}_example`,existingNames:[]});i.push([o,{value:t.example}])}return t.examples!=null&&i.push(...Object.entries(t.examples)),i}resolveMaybeReference({schemaOrReference:t,breadcrumbs:r,skipErrorCollector:n}){if(this.isReferenceObject(t)){let i=this.resolveReference({reference:t,breadcrumbs:r,skipErrorCollector:n});return i.resolved?i.value:void 0}return t}resolveExampleRecursively({example:t,breadcrumbs:r,maxDepth:n=10}){let i=t,o=0;for(;this.isReferenceObject(i);){if(o>=n){this.errorCollector.collect({message:`Maximum reference depth (${n}) exceeded while resolving example reference`,path:r});return}let s=this.resolveReference({reference:i,breadcrumbs:r,skipErrorCollector:!0});if(!s.resolved)return;i=s.value,o++}return i}resolveExample(t){if(!this.isReferenceObject(t))return t;let r=this.resolveReference({reference:t});return r.resolved?this.returnExampleValue(r.value):void 0}resolveExampleWithValue(t){if(!this.isReferenceObject(t))return this.returnExampleValue(t);let r=this.resolveReference({reference:t});return r.resolved?this.returnExampleValue(r.value):void 0}returnExampleValue(t){return this.isExampleWithValue(t)?t.value:t}getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let o=this.resolveReference({reference:r});if(!o.resolved)return;r=o.value}let{readOnly:n,writeOnly:i}=this.getReadOnlyWriteOnlyFromSchema(r);if(!(n&&i)){if(n)return Ut.ObjectPropertyAccess.ReadOnly;if(i)return Ut.ObjectPropertyAccess.WriteOnly}}getReadOnlyWriteOnlyFromSchema(t){if(t.allOf&&t.allOf.length>0){let r=!0,n=!0;for(let i of t.allOf){let o=i;if(this.isReferenceObject(i)){let a=this.resolveReference({reference:i});if(!a.resolved)continue;o=a.value}let s=this.getReadOnlyWriteOnlyFromSchema(o);r=r&&s.readOnly,n=n&&s.writeOnly}return{readOnly:r,writeOnly:n}}else return{readOnly:!!t.readOnly,writeOnly:!!t.writeOnly}}getAudiences({operation:t,breadcrumbs:r}){let i=new ux.AudienceExtension({operation:t,breadcrumbs:r,context:this}).convert();if(i!=null)return i.audiences}getAvailability({node:t,breadcrumbs:r}){let n=new Set;for(;this.isReferenceObject(t);){let i=this.getDeclaredAvailability({node:t,breadcrumbs:r});if(i!=null)return i;if(n.has(t.$ref))return;n.add(t.$ref);let o=this.resolveReference({reference:t});if(!o.resolved)return;t=o.value}return this.getDeclaredAvailability({node:t,breadcrumbs:r})}getDeclaredAvailability({node:t,breadcrumbs:r}){let i=new ux.FernAvailabilityExtension({node:t,breadcrumbs:r,context:this}).convert();if(i!=null)return{status:i,message:void 0};if(onm(t))return{status:Xm.Deprecated,message:void 0}}getNamespacedSchemaId(t){if(this.namespace==null)return t;let r=`${this.namespace}:`;return t.startsWith(r)?t:`${r}${t}`}getRawSchemaId(t){if(this.namespace==null)return t;let r=`${this.namespace}:`;return t.startsWith(r)?t.slice(r.length):t}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return this.getNamespacedSchemaId(r[1])}getRawSchemaNameFromReference(t){let r=t.$ref.match(/\/schemas\/([^/]+)/);if(!(!r||!r[1]))return r[1]}createNamedTypeReference(t,r){return Jr.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(t),typeId:this.getNamespacedSchemaId(t),displayName:r,default:void 0,inline:!1})}typeReferenceToDeclaredTypeName(t){if(t.type==="named")return{typeId:t.typeId,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:t.name,displayName:t.displayName}}removeSchemaFromInlinedTypes({id:t,inlinedTypes:r}){let n=this.getNamespacedSchemaId(t);return Object.fromEntries(Object.entries(r).filter(([i])=>i!==n))}static maybeTrimPrefix(t,r){return t.startsWith(r)?t.slice(r.length):t}generateUniqueName({prefix:t,existingNames:r}){if(!r.includes(t))return t;let n=0;for(;r.includes(`${t}_${n}`);)n++;return`${t}_${n}`}isReferenceObject(t){return typeof t=="object"&&t!==null&&"$ref"in t}isExternalReference(t){return typeof t=="string"&&(t.startsWith("http://")||t.startsWith("https://"))}isReferenceObjectWithIdentifier(t){return this.isReferenceObject(t)&&("title"in t||"name"in t||"messageId"in t||"summary"in t)}isExampleWithSummary(t){return typeof t=="object"&&t!=null&&"summary"in t&&typeof t.summary=="string"&&t.summary.length>0}isExampleWithValue(t){return typeof t=="object"&&t!=null&&"value"in t}isOptional(t){return t.type==="container"&&t.container.type==="optional"}isNullable(t){return t.type==="container"&&t.container.type==="nullable"}isList(t){return t.type==="container"&&t.container.type==="list"}isFile(t){return t.type==="primitive"&&t.primitive.v2?.type==="string"&&t.primitive.v2.validation?.format==="binary"}getAsString(t){if(typeof t=="string")return t}getAsInteger(t){if(typeof t=="number"&&Number.isInteger(t))return t}getAsNumber(t){if(typeof t=="number")return t}getAsBoolean(t){if(typeof t=="boolean")return t}getAsArray(t){if(Array.isArray(t))return t}getAsObject(t){if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}getGroup({groupParts:t,namespace:r}){let n=[];return r!=null&&n.push(r),n.push(...t??[]),n}isObjectSchemaType(t){return t.type==="object"||t.properties!=null}}});var Yo,JD=h(()=>{"use strict";Yo=class{breadcrumbs;context;constructor(t){this.breadcrumbs=t.breadcrumbs,this.context=t.context}getExtensionValue(t,r){if(typeof t!="object"||t==null)return;let n=t[this.key];if(n!=null)return n;if(r!=null)return t[r]}}});var yit,cNo=h(()=>{"use strict";JD();yit=class extends Yo{operation;key="x-fern-audiences";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=Array.isArray(t)?t.filter(n=>typeof n=="string"):typeof t=="string"?[t]:[];if(r.length!==0)return{audiences:r}}}});var e5r,nTu=h(()=>{"use strict";_n();JD();e5r=class extends Yo{node;key="x-fern-availability";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(t==null||typeof t!="string")return;switch(t.toUpperCase().replace(/[-_\s]/g,"_")){case"IN_DEVELOPMENT":return Xm.InDevelopment;case"PRE_RELEASE":return Xm.PreRelease;case"GENERAL_AVAILABILITY":case"GA":case"STABLE":return Xm.GeneralAvailability;case"DEPRECATED":return Xm.Deprecated;case"ALPHA":return Xm.Alpha;case"BETA":return Xm.Beta;case"PREVIEW":return Xm.Preview;case"LEGACY":return Xm.Legacy;default:return}}}});var bit,uNo=h(()=>{"use strict";JD();bit=class extends Yo{node;key="x-fern-discriminated";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(t!=null&&typeof t=="boolean")return t}}});var Eit,lNo=h(()=>{"use strict";JD();Eit=class extends Yo{node;key="x-fern-discriminator-context";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(t==="data"||t==="protocol")return t}}});var snm,anm,iTu,oTu=h(()=>{"use strict";jn();snm=Be.object({snake:Be.string().optional(),camel:Be.string().optional(),screamingSnake:Be.string().optional(),pascal:Be.string().optional()}),anm=Be.object({description:Be.string().optional(),name:Be.string().optional(),casing:snm.optional()}),iTu=Be.record(anm)});var Iit,pNo=h(()=>{"use strict";JD();oTu();Iit=class extends Yo{schema;key="x-fern-enum";constructor({breadcrumbs:t,schema:r,context:n}){super({breadcrumbs:t,context:n}),this.schema=r}convert(){let t=this.getExtensionValue(this.schema);if(t==null)return;let r=iTu.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-enum extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data}}});var m3e,sTu=h(()=>{"use strict";JD();m3e=class extends Yo{operation;key="x-fern-ignore";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-ignore",path:this.breadcrumbs});return}return t}}}});var t5r,aTu=h(()=>{"use strict";JD();t5r=class extends Yo{parameter;key="x-fern-optional";constructor({breadcrumbs:t,parameter:r,context:n}){super({breadcrumbs:t,context:n}),this.parameter=r}convert(){let t=this.getExtensionValue(this.parameter);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-optional",path:this.breadcrumbs});return}return t}}}});var r5r,cTu=h(()=>{"use strict";JD();r5r=class extends Yo{operation;key="x-fern-sdk-group-name";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=Array.isArray(t)?t.filter(n=>typeof n=="string"):typeof t=="string"?[t]:[];if(r.length!==0)return{groups:r}}}});var n5r,uTu=h(()=>{"use strict";JD();n5r=class extends Yo{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null&&typeof t=="string")return{methodName:t}}}});var i5r,lTu=h(()=>{"use strict";JD();i5r=class extends Yo{operation;key="x-fern-server-name";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation,"x-name");if(!(t==null||typeof t!="string"))return t}}});var o5r,pTu=h(()=>{"use strict";JD();o5r=class extends Yo{schema;key="x-fern-type";constructor({breadcrumbs:t,schema:r,context:n}){super({breadcrumbs:t,context:n}),this.schema=r}convert(){let t=this.getExtensionValue(this.schema);if(t!=null&&typeof t=="string")return t}}});var s5r,fTu=h(()=>{"use strict";JD();s5r=class extends Yo{schema;key="x-fern-type-name";constructor({breadcrumbs:t,schema:r,context:n}){super({breadcrumbs:t,context:n}),this.schema=r}convert(){let t=this.getExtensionValue(this.schema);if(typeof t=="string")return t}}});function cnm({isText:e,isAttribute:t}){return e?tQ.Text:t?tQ.Attribute:tQ.Element}function hTu(e){return typeof e=="object"&&e!=null}function a5r(e,t){if(!(typeof e!="object"||e==null))return e[t]}function fNo(...e){return e.find(t=>t!=null)}var dTu,mTu,vit,xit,c5r=h(()=>{"use strict";_n();JD();dTu="x-fern-xml-text",mTu="x-fern-xml-list-separator",vit=class extends Yo{schema;fallbackName;key="xml";constructor({breadcrumbs:t,schema:r,fallbackName:n,context:i}){super({breadcrumbs:t,context:i}),this.schema=r,this.fallbackName=n}convert(){let t=this.getExtensionValue(this.schema);if(hTu(t))return{name:typeof t.name=="string"?t.name:this.fallbackName,namespace:typeof t.namespace=="string"?t.namespace:void 0,prefix:typeof t.prefix=="string"?t.prefix:void 0}}},xit=class extends Yo{propertySchema;resolvedPropertySchema;key="xml";constructor({breadcrumbs:t,propertySchema:r,resolvedPropertySchema:n,context:i}){super({breadcrumbs:t,context:i}),this.propertySchema=r,this.resolvedPropertySchema=n}convert(){let t=this.propertySchema,r=this.resolvedPropertySchema,n=fNo(this.getExtensionValue(t),this.getExtensionValue(r)),i=fNo(a5r(t,dTu),a5r(r,dTu)),o=fNo(a5r(t,mTu),a5r(r,mTu)),s=hTu(n)?n:{};return{kind:cnm({isText:i===!0,isAttribute:s.attribute===!0}),name:typeof s.name=="string"?s.name:void 0,wrapped:typeof s.wrapped=="boolean"?s.wrapped:void 0,listSeparator:typeof o=="string"?o:void 0}}}});var ux={};Z(ux,{AudienceExtension:()=>yit,FernAvailabilityExtension:()=>e5r,FernDiscriminatedExtension:()=>bit,FernDiscriminatorContextExtension:()=>Eit,FernEnumExtension:()=>Iit,FernIgnoreExtension:()=>m3e,FernOptionalExtension:()=>t5r,FernTypeExtension:()=>o5r,FernTypeNameExtension:()=>s5r,SdkGroupNameExtension:()=>r5r,SdkMethodNameExtension:()=>n5r,ServerFromOperationNameExtension:()=>i5r,XmlPropertyExtension:()=>xit,XmlSchemaExtension:()=>vit});var dNo=h(()=>{"use strict";cNo();nTu();uNo();lNo();pNo();sTu();aTu();cTu();uTu();lTu();pTu();fTu();c5r()});var kH,gTu=h(()=>{"use strict";_n();tc();Vi();$_r();dNo();kH=class extends Ji{ir;audiences;irGraph;constructor({breadcrumbs:t=[],context:r,audiences:n}){super({breadcrumbs:t,context:r}),this.audiences=n,this.irGraph=new n6e(n),this.ir={auth:{docs:void 0,requirement:Ut.AuthSchemesRequirement.All,schemes:[]},selfHosted:!1,types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:Ut.ErrorDiscriminationStrategy.statusCode(),variables:[],globalParameters:void 0,serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:this.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,idempotencyKeyGeneration:void 0,webhookSignatureVerification:void 0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}},audiences:void 0,generationMetadata:void 0,apiPlayground:void 0,casingsConfig:void 0,specVersion:void 0}}removeXFernIgnores({document:t,breadcrumbs:r=[]}){return Array.isArray(t)?t.filter((n,i)=>!new m3e({breadcrumbs:[...r,String(i)],operation:n,context:this.context}).convert()).map((n,i)=>this.removeXFernIgnores({document:n,breadcrumbs:[...r,String(i)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([n,i])=>!new m3e({breadcrumbs:[...r,n],operation:i,context:this.context}).convert()).map(([n,i])=>[n,this.removeXFernIgnores({document:i,breadcrumbs:[...r,n]})])):t}finalizeIr(){let t=Object.values(this.ir.services).some(a=>a.endpoints.some(c=>c.response?.body?.type==="streaming")),r=Object.values(this.ir.services).some(a=>a.endpoints.some(c=>c.pagination!=null)),n=Object.values(this.ir.services).some(a=>a.endpoints.some(c=>c.response?.body?.type==="fileDownload"));this.ir.sdkConfig={...this.ir.sdkConfig,hasStreamingEndpoints:t,hasPaginatedEndpoints:r,hasFileDownloadEndpoints:n},V3t(this.ir,{onWarning:a=>this.context.logger.warn(a)});let i={...this.ir,apiName:this.context.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:this.context.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})},audiences:this.audiences.type==="select"?this.audiences.audiences:void 0};this.irGraph.hasNoAudiences()||(i=this.filterIrForAudiences(i)),j3t({ir:i});let o=this.context.exampleGenerationArgs,s=T1o({ir:i,exampleGeneration:o,logger:this.context.logger});if(this.context.generateV1Examples){let a=z3t({ir:i,exampleGeneration:o});return{...i,...a,...s}}return{...i,...s}}filterIrForAudiences(t){return{...L3t(t,this.irGraph.build()),sdkConfig:t.sdkConfig,subpackages:t.subpackages,rootPackage:t.rootPackage}}async resolveAllExternalRefs({spec:t}){let r=[t];for(;r.length>0;){let n=r.shift();n!=null&&(Array.isArray(n)?await this.resolveExternalRefsInArray(n,r):typeof n=="object"&&await this.resolveExternalRefsInObject(n,r))}return t}async resolveExternalRefsInArray(t,r){for(let n=0;n<t.length;n++)t[n]=await this.resolveReferenceChain(t[n],r)}async resolveExternalRefsInObject(t,r){for(let[n,i]of Object.entries(t))t[n]=await this.resolveReferenceChain(i,r)}async resolveReferenceChain(t,r){let n=t;if(!this.context.isReferenceObject(n))return r.push(n),t;for(;this.context.isReferenceObject(n);){let i=this.context.isExternalReference(n.$ref),o=await this.context.resolveMaybeExternalReference(n);if(o.resolved){if(n=o.value,i)return n}else return t}return t}shouldAddServerToCollectedServers({server:t,currentServers:r,specType:n="openapi"}){return n==="openapi"?!r.some(i=>i.url===t.url&&"x-fern-server-name"in i&&"x-fern-server-name"in t&&i["x-fern-server-name"]===t["x-fern-server-name"]):!r.some(i=>i.url===t.url&&"name"in i&&"name"in t&&i.name===t.name)}addEndpointToIr({endpoint:t,audiences:r,endpointGroup:n,endpointGroupDisplayName:i,endpointGroupDescription:o,serviceName:s,inlinedRequestPropertiesByAudience:a,queryParametersByAudience:c}){let u=this.context.getGroup({groupParts:n,namespace:this.context.namespace}),l=this.getOrCreatePackage({group:n});l!==this.ir.rootPackage&&l.docs==null&&o!=null&&(l.docs=o);let p=[...u].map(m=>this.context.casingsGenerator.generateName(m)),d=p[p.length-1];l.service==null&&(l.service=s??`service_${u.map(m=>ti(m)).join("/")}`),this.ir.services[l.service]==null&&(this.ir.services[l.service]=this.createNewService({allParts:p,finalpart:d,endpointGroupDisplayName:i})),this.ir.services[l.service]?.endpoints.push(t);let f=this.ir.services[l.service];f!=null&&(this.irGraph.addEndpoint(f,t),this.irGraph.markEndpointForAudience(f.name,[t],r),a!=null&&Object.keys(a).length>0&&this.irGraph.markInlinedRequestPropertiesForAudiences(t.id,a),c!=null&&Object.keys(c).length>0&&this.irGraph.markQueryParametersForAudiences(t.id,c))}addWebhookToIr({webhook:t,operationId:r,audiences:n,group:i,inlinedPayloadPropertiesByAudience:o}){let s=i?.join(".")??r,a=this.getOrCreatePackage({group:i});this.ir.webhookGroups[s]==null&&(this.ir.webhookGroups[s]=[]),this.ir.webhookGroups[s].push(t),a.webhooks=s;let c=this.context.createFernFilepath();this.irGraph.addWebhook(c,t),n!=null&&this.irGraph.markWebhookForAudiences(c,t,n),t.id!=null&&o!=null&&Object.keys(o).length>0&&this.irGraph.markInlinedWebhookPayloadPropertiesForAudiences(t.id,o)}addWebsocketChannelToIr({websocketChannel:t,channelPath:r,audiences:n,websocketGroup:i}){let o=ti(i?.join(".")),s=ti(r),a=this.context.namespace?`${ti(this.context.namespace)}/`:"",c=o?`channel_${a}${o}`:`channel_${a}${s}`,u=i?this.getOrCreatePackage({group:i}):this.getOrCreatePackage({group:[s]});this.ir.websocketChannels={...this.ir.websocketChannels,[c]:t},c!==""?u.websocket==null&&(u.websocket=c):this.ir.rootPackage.websocket="";let l=this.context.createFernFilepath();this.irGraph.addChannel(l,c,t),n!=null&&this.irGraph.markChannelForAudiences(l,c,n)}addAuthToIR(t){this.ir.auth=t}addErrorsToIr(t){this.ir.errors=t;for(let r of Object.values(t))this.irGraph.addError(r)}addGlobalHeadersToIr(t){this.ir.headers=t}addEnvironmentsToIr({environmentConfig:t,audiences:r}){if(this.ir.environments=t,t==null)return;let n=t.environments.environments,i=r==null||n.every(o=>o.audiences==null);for(let o of n)this.irGraph.markEnvironmentForAudiences(o,r?.[o.id]??[],i)}addTypeToRootPackage(t){this.ir.rootPackage.types.push(t)}addSchemaOutputToIr(t,r){let{convertedSchema:n,inlinedTypes:i}=r,o=this.context.getNamespacedSchemaId(t),a=Object.keys(i).some(c=>c===o)?`${o}Wrapper`:o;this.addTypeToPackage(a),this.addTypesToIr({...i,[a]:n})}addTypeToPackage(t){let r=this.context.getGroup({groupParts:[],namespace:this.context.namespace});this.getOrCreatePackage({group:r}).types.push(t)}addTypesToIr(t){Object.assign(this.ir.types,Object.fromEntries(Object.entries(t).map(([r,n])=>[r,n.typeDeclaration])));for(let r of Object.values(t))this.irGraph.addType({declaredTypeName:r.typeDeclaration.name,descendantTypeIds:r.typeDeclaration.referencedTypes,descendantTypeIdsByAudience:{},propertiesByAudience:r.propertiesByAudience,descendantFilepaths:new Set}),this.irGraph.markTypeForAudiences(r.typeDeclaration.name,r.audiences)}updateEndpointsWithDefaultUrl(t){if(t!=null)for(let r of Object.values(this.ir.services))for(let n of r.endpoints)n.baseUrl==null&&(n.baseUrl=t)}createNewService({allParts:t,finalpart:r,endpointGroupDisplayName:n}){return{name:{fernFilepath:{allParts:t,packagePath:t.slice(0,-1),file:r}},displayName:n,basePath:M0(""),headers:[],pathParameters:[],availability:void 0,endpoints:[],transport:void 0,encoding:void 0,audiences:void 0}}createPackage(t={}){return{fernFilepath:this.context.createFernFilepath(t),service:void 0,types:[],errors:[],subpackages:[],docs:void 0,webhooks:void 0,websocket:void 0,hasEndpointsInTree:!1,hasWebSocketInTree:void 0,navigationConfig:void 0}}getOrCreatePackage({group:t}){let r=[];if(this.context.namespace!=null&&r.push(this.context.namespace),r.push(...(t??[]).map(i=>ti(i))),r.length==0)return this.ir.rootPackage;let n=this.ir.rootPackage;for(let i=0;i<r.length;i++){let o=r[i]??"",a=`subpackage_${r.slice(0,i+1).join("/")}`;this.ir.subpackages[a]==null&&(this.ir.subpackages[a]={name:this.context.casingsGenerator.generateName(o),displayName:void 0,...this.createPackage({name:o})});let c=this.ir.subpackages[a];n.subpackages.includes(a)||n.subpackages.push(a),n=c}return n}}});function h3e(e){return typeof e=="object"&&e!==null&&!("$ref"in e)}function pnm(e){if(!h3e(e))return!1;if("nullable"in e&&e.nullable===!0)return!0;let t=r=>Array.isArray(r)&&r.some(n=>h3e(n)&&n.type==="null");return t(e.anyOf)||t(e.oneOf)}function fnm(e){return e.type==="array"||e.properties||e.oneOf||e.anyOf||e.allOf||e.additionalProperties?!1:!!(e.type==="string"||e.type==="number"||e.type==="integer"||e.type==="boolean"||e.const!==void 0||Array.isArray(e.enum)&&e.enum.length>0)}function yTu(e){if(e.const!==void 0)return e.const;if(Array.isArray(e.enum)&&e.enum.length>0)return e.enum[0]}var unm,ATu,lnm,nS,nxe=h(()=>{"use strict";wt();Uo();unm=/^literal<\s*(?:"(.*)"|(true|false))\s*>$/,ATu=new WeakMap,lnm=new Set(["type","properties","required","allOf","description","title","deprecated","readOnly","writeOnly","xml","externalDocs","discriminator"]);nS=class e extends Ji{MAX_DEPTH=12;EXAMPLE_STRING=Fi.STRING;EXAMPLE_NUMBER=Fi.DOUBLE;EXAMPLE_BOOLEAN=Fi.BOOLEAN;EXAMPLE_INTEGER=Fi.INT;EXAMPLE_DATE=Fi.DATE;EXAMPLE_DATE_TIME=Fi.DATE_TIME;schema;example;depth;exampleGenerationStrategy;generateOptionalProperties;seenRefs;sharedState;constructor({breadcrumbs:t,context:r,schema:n,example:i,depth:o=0,exampleGenerationStrategy:s,generateOptionalProperties:a=!1,seenRefs:c=new Set}){super({breadcrumbs:t,context:r}),this.example=i,this.schema=n,this.depth=o,this.exampleGenerationStrategy=s,this.generateOptionalProperties=a,this.seenRefs=c;let u=ATu.get(r);u!=null?this.sharedState=u:(this.sharedState={mergedAllOfProperties:new WeakMap,mergeOnlyAllOfSchemas:new WeakMap},ATu.set(r,this.sharedState))}convert(){if(this.depth>this.MAX_DEPTH)return{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:typeof this.example<"u"?this.example:{},errors:[]};if(this.context.isReferenceObject(this.schema)){let n=this.schema.$ref;if(this.seenRefs.has(n))return{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:this.example,errors:[]}}let t=this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(t==null)return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[{message:"Schema is not resolvable",path:this.breadcrumbs}]};if(typeof t!="object")return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[{message:`Schema should be an object: ${JSON.stringify(t,null,2)}`,path:this.breadcrumbs}]};if("nullable"in t&&t.nullable===!0&&this.example===null)return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};let r=this.maybeConvertLiteralFernType(t);return r??(Array.isArray(t.type)?this.convertSchemaTypeArray({resolvedSchema:t}):t.type=="null"?this.convertNull():t.type=="boolean"?this.convertBoolean():t.enum!=null?this.convertEnum(t):t.type=="number"?this.convertNumber():t.type=="string"?this.convertString():t.type=="integer"?this.convertInteger():t.type=="array"?this.convertArray({resolvedSchema:t}):"oneOf"in t&&t.oneOf!=null?this.convertOneOf({resolvedSchema:t}):"anyOf"in t&&t.anyOf!=null?this.convertAnyOf({resolvedSchema:t}):t.type=="object"||t.properties!=null||t.allOf!=null?this.convertObject({resolvedSchema:t}):typeof t=="object"&&Object.keys(t).length===0?{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:this.example,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[{message:`Unsupported schema type: ${JSON.stringify(t,null,2)}`,path:this.breadcrumbs}]})}convertNull(){let t=this.example===null;return t?{isValid:t,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[{message:`Example is not null: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}convertBoolean(){let t=typeof this.example=="boolean";if(t)return{isValid:t,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};let r=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs})?.default:this.schema.default,n=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs})?.const:this.schema.const;return typeof r=="boolean"||typeof n=="boolean"?{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n??r,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:this.maybeResolveSchemaExample(this.schema)??this.EXAMPLE_BOOLEAN,errors:[{message:`Example is not a boolean: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}convertEnum(t){let r=t.enum?.includes(this.example)??!1;if(r)return{isValid:r,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};let n=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0})?.default:this.schema.default;return n!==void 0&&t.enum?.includes(n)?{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n,errors:[]}:{isValid:r,coerced:!1,usedProvidedExample:!1,validExample:t.enum?.[0],errors:[{message:`Example is not one of the allowed enum values: ${JSON.stringify(t.enum,null,2)}`,path:this.breadcrumbs}]}}convertNumber(){if(typeof this.example=="number")return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};let t=Number(this.example);if(!isNaN(t))return{isValid:!0,coerced:!0,usedProvidedExample:!0,validExample:t,errors:[]};let r=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0}):this.schema,n=r?.default;return typeof n=="number"?{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:this.adjustNumberToConstraints(this.maybeResolveSchemaExample(this.schema)??this.EXAMPLE_NUMBER,r),errors:[{message:`Example is not a number: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}adjustNumberToConstraints(t,r){if(r==null)return this.context.logger.debug("[ExampleConverter.adjustNumberToConstraints] Schema object is null, returning original number","number:",t.toString()),t;let{minimum:n,maximum:i,exclusiveMinimum:o,exclusiveMaximum:s}=r,a;o!=null?typeof o=="boolean"?a=n!=null?n+Math.max(Number.EPSILON,Math.abs(n)*1e-10):void 0:a=o+Math.max(Number.EPSILON,Math.abs(o)*1e-10):n!=null&&(a=n);let c;return s!=null?typeof s=="boolean"?c=i!=null?i-Math.max(Number.EPSILON,Math.abs(i)*Number.EPSILON):void 0:c=s-Math.max(Number.EPSILON,Math.abs(s)*Number.EPSILON):i!=null&&(c=i),a!==void 0&&c!==void 0?(t<a||t>c)&&(t=a+(c-a)/2):a!==void 0&&t<a?t=a+Math.abs(a*.1):c!==void 0&&t>c&&(t=c-Math.abs(c*.1)),Number(Number(t).toPrecision(3))}convertString(){if(typeof this.example=="string")return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};if(typeof this.example!="object"&&!Array.isArray(this.example)&&this.example!=null)return{isValid:!0,coerced:!0,usedProvidedExample:!0,validExample:String(this.example),errors:[]};let t=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0})?.default:this.schema.default;if(typeof t=="string")return{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:t,errors:[]};let r=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0}):this.schema,n=r?.format==="date"?this.EXAMPLE_DATE:r?.format==="date-time"?this.EXAMPLE_DATE_TIME:this.EXAMPLE_STRING;return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:this.maybeResolveSchemaExample(this.schema)??n,errors:[{message:`Example cannot be converted to string: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}convertInteger(){if(typeof this.example=="number"&&Number.isInteger(this.example))return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};if(typeof this.example=="string"){let r=Number(this.example);if(!isNaN(r)&&Number.isInteger(r))return{isValid:!0,coerced:!0,usedProvidedExample:!0,validExample:r,errors:[]}}let t=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0})?.default:this.schema.default;return typeof t=="number"&&Number.isInteger(t)?{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:t,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:this.maybeResolveSchemaExample(this.schema)??this.EXAMPLE_INTEGER,errors:[{message:`Example is not an integer: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}convertArray({resolvedSchema:t}){if(t.type!="array")return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[]};t.items==null&&(t.items={type:"string"});let r=this.example==null,n=this.example??t.example,o=(Array.isArray(n)?n:[n]).map(c=>new e({breadcrumbs:[...this.breadcrumbs,"items"],context:this.context,schema:t.items,example:c,depth:this.depth,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert()),s=o.every(c=>c?.isValid??!1)&&!r,a=!r&&o.some(c=>c.usedProvidedExample);return{isValid:s,coerced:!1,usedProvidedExample:a,validExample:o.map(c=>c.validExample),errors:s?[]:o.flatMap(c=>c.errors)}}convertObject({resolvedSchema:t}){if(t.type=="object"&&t.properties==null&&t.allOf==null)return{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:this.example??{},errors:[]};let r=typeof this.example!="object"||this.example==null?{}:this.example,n=this.example===void 0&&this.canGenerateFromMergedAllOf(t),{mergedProperties:i,mergedRequired:o}=this.mergeAllOfProperties(t,new Set,0,n),s=Object.entries(i).map(([y,E])=>{if(typeof E!="object")return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};if(this.isDeprecatedProperty(E)&&!this.isRequiredProperty({key:y,resolvedSchema:t}))return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};if("readOnly"in E&&E.readOnly===!0&&"writeOnly"in E&&E.writeOnly===!0)return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};if("readOnly"in E&&E.readOnly===!0&&this.exampleGenerationStrategy==="request")return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};if("writeOnly"in E&&E.writeOnly===!0&&this.exampleGenerationStrategy==="response")return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};let x=pnm(E),v=!(y in r)||!x&&r[y]==null||x&&r[y]===void 0,C=!o.includes(y);if(v&&C){if(this.example===void 0&&this.generateOptionalProperties){let O=this.maybeResolveSchemaExample(E),D=new e({breadcrumbs:[...this.breadcrumbs,y],context:this.context,schema:E,example:O,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()});return{key:y,result:D.convert()}}return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}}}else{let O=r[y],D=O!==void 0?O:this.maybeResolveSchemaExample(E),P=new e({breadcrumbs:[...this.breadcrumbs,y],context:this.context,schema:E,example:D,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();return{key:y,result:P}}}),a=n?[]:(t.allOf??[]).map((y,E)=>{let x=this.context.resolveMaybeReference({schemaOrReference:y,breadcrumbs:[...this.breadcrumbs,`allOf[${E}]`],skipErrorCollector:!0});return x&&this.isConstraintOnlySchema(x)?{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:this.example,errors:[]}:new e({breadcrumbs:[...this.breadcrumbs,`allOf[${E}]`],context:this.context,schema:{...t,...y,allOf:void 0},example:this.example,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert()}),c=this.example!==void 0&&(s.some(({result:y})=>y.usedProvidedExample)||a.some(y=>y.usedProvidedExample)),u=Object.fromEntries(s.map(({key:y,result:E})=>[y,E.validExample]).filter(([y,E])=>E!==void 0));for(let y of a)if(typeof y.validExample=="object"&&y.validExample!==null){let E=y.validExample,x=Object.fromEntries(Object.entries(E).filter(([v,C])=>C!==void 0));for(let[v,C]of Object.entries(x))(!(v in u)||u[v]==null)&&(u[v]=C)}let l=[],p=this.collectAllPropertyKeys(t),d=Object.keys(r).filter(y=>!p.has(y)),f=this.schemaHasPatternProperties(t),m=f?d:[],g=f?[]:d;if(m.forEach(y=>{l.push({key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:r[y],errors:[]}})}),g.length>0)if(t.additionalProperties===!1)g.forEach(y=>{let E=[...this.breadcrumbs,y].join("."),x={message:`Found unexpected property '${y}' in example. This property does not exist in the schema${E?` at path: ${E}`:""}`,path:[...this.breadcrumbs,y]};l.push({key:y,result:{isValid:!1,coerced:!1,usedProvidedExample:!0,validExample:void 0,errors:[x]}})});else if(t.additionalProperties===!0||t.additionalProperties===void 0)g.forEach(y=>{l.push({key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:r[y],errors:[]}})});else{let y=t.additionalProperties;g.forEach(E=>{let v=new e({breadcrumbs:[...this.breadcrumbs,E],context:this.context,schema:y,example:r[E],depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();l.push({key:E,result:v})})}for(let{key:y,result:E}of l)E.validExample!==void 0&&u[y]===void 0&&(u[y]=E.validExample);let A=s.every(y=>y.result.isValid)&&a.every(y=>y.isValid)&&l.every(({result:y})=>y.isValid);if(Object.keys(u).length===0){let y=a.find(E=>E.validExample!==void 0&&(typeof E.validExample!="object"||E.validExample===null));y&&(u=y.validExample)}return{isValid:A,coerced:!1,usedProvidedExample:c,validExample:u,errors:[...s.flatMap(({result:y})=>y.errors),...a.flatMap(y=>y.errors),...l.flatMap(({result:y})=>y.errors)]}}convertSchemaTypeArray({resolvedSchema:t}){if(!Array.isArray(t.type))return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[]};if(t.type.length===1)return new e({breadcrumbs:this.breadcrumbs,context:this.context,schema:{...t,type:t.type[0]},example:this.example,depth:this.depth,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();let r=t.type.map((a,c)=>new e({breadcrumbs:[...this.breadcrumbs,`type[${c}]`],context:this.context,schema:{...t,type:a},example:this.example,depth:this.depth,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert()),n=r.some(a=>a?.isValid??!1),o=r.find(a=>a.isValid)?.validExample??r[0]?.validExample??null,s=r.some(a=>a.usedProvidedExample);return{isValid:n,coerced:!1,usedProvidedExample:s,validExample:o,errors:n?[]:r.flatMap(a=>a?.errors??[])}}convertUnion({resolvedSchema:t,unionType:r}){let n=r==="oneOf"?t.oneOf:t.anyOf;if(!(r in t)||n==null)return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[]};let i=this.example!==void 0?this.example:this.maybeResolveSchemaExample(t);if(this.example===void 0){let d=[];for(let m of n){if(!m)continue;let g=this.context.resolveMaybeReference({schemaOrReference:m,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});g&&d.push(g)}if(d.length>0&&d.every(m=>fnm(m))){let m=d.findIndex(g=>yTu(g)!==void 0);if(m!==-1){let g=n[m],A=d[m];if(g&&A){let y=yTu(A),x=new e({breadcrumbs:[...this.breadcrumbs,`${r}[${m}]`],context:this.context,schema:r==="oneOf"?{...t,...g,oneOf:void 0}:g,example:y,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();if(x.isValid)return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:x.validExample,errors:[]}}}}}let o=[],s=null,a=null;for(let d=0;d<n.length;d++){let f=n[d];if(!f)continue;let m=r==="oneOf"?{...t,...f,oneOf:void 0}:f,g=i!==void 0?i:this.maybeResolveSchemaExample(m),y=new e({breadcrumbs:[...this.breadcrumbs,`${r}[${d}]`],context:this.context,schema:m,example:g,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();if(y.isValid&&!y.coerced&&y.usedProvidedExample)return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:y.validExample,errors:[]};if(y.isValid&&!y.coerced&&this.example===void 0)return{isValid:!0,coerced:!1,usedProvidedExample:y.usedProvidedExample,validExample:y.validExample,errors:[]};o.push(y),y.isValid&&y.usedProvidedExample&&a===null&&(a=y),y.isValid&&s===null&&(s=y)}let c=a??s,u=c!==null,l=c?.validExample??o[0]?.validExample,p=c?.usedProvidedExample??!1;return{isValid:u,coerced:!1,usedProvidedExample:p,validExample:l,errors:u?[]:o.flatMap(d=>d.errors)}}convertOneOf({resolvedSchema:t}){return this.convertUnion({resolvedSchema:t,unionType:"oneOf"})}convertAnyOf({resolvedSchema:t}){return this.convertUnion({resolvedSchema:t,unionType:"anyOf"})}getMaybeUpdatedSeenRefs(){let t=new Set(this.seenRefs);return this.context.isReferenceObject(this.schema)&&t.add(this.schema.$ref),t}maybeResolveSchemaExample(t){if("example"in t)return t.example;if("examples"in t){let n=t.examples;if(Array.isArray(n)&&n.length>0)return n[0];if(n!=null&&typeof n=="object")return Object.values(n)[0]}let r=this.context.resolveMaybeReference({schemaOrReference:t,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(r!=null){if("example"in r)return r.example;if("examples"in r){let n=r.examples;return Array.isArray(n)&&n.length>0?n[0]:Object.values(n??{})[0]}}}maybeConvertLiteralFernType(t){let r=t["x-fern-type"];if(typeof r!="string")return;let n=r.match(unm);if(n!=null){if(n[1]!=null)return{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n[1],errors:[]};if(n[2]!=null)return{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n[2]==="true",errors:[]}}}mergeAllOfProperties(t,r=new Set,n=0,i=!1){if(i){let p=this.sharedState.mergedAllOfProperties.get(t)?.get(n);if(p!=null)return p}let o=t.properties??{},s=t.required??[];if(n>this.MAX_DEPTH||t.allOf==null||t.allOf.length===0){let p={mergedProperties:o,mergedRequired:s};return i&&this.cacheMergedAllOfProperties(t,n,p),p}let a={},c=new Set(s);for(let p of t.allOf){let d=this.context.resolveMaybeReference({schemaOrReference:p,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(d==null)continue;let f=this.context.isReferenceObject(p)?p.$ref:void 0;if(!(f!=null&&r.has(f))){if(d.allOf!=null&&d.allOf.length>0){let m=new Set(r);f!=null&&m.add(f);let g=this.mergeAllOfProperties(d,m,n+1,i);for(let A of g.mergedRequired)c.add(A);for(let[A,y]of Object.entries(g.mergedProperties))if(typeof y=="object"&&y!==null){let E=a[A];E!=null&&h3e(E)&&h3e(y)?a[A]={...E,...y}:a[A]=y}continue}if(d.required!=null)for(let m of d.required)c.add(m);if(d.properties!=null){for(let[m,g]of Object.entries(d.properties))if(typeof g=="object"&&g!==null){let A=a[m];A!=null&&h3e(A)&&h3e(g)?a[m]={...A,...g}:a[m]=g}}}}let u={...o};for(let[p,d]of Object.entries(u)){let f=a[p];if(f==null||!h3e(d))continue;let m="$ref"in f?this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0}):f;m!=null&&(u[p]={...m,...d})}for(let[p,d]of Object.entries(a))p in u||(u[p]=d);let l={mergedProperties:u,mergedRequired:[...c]};return i&&this.cacheMergedAllOfProperties(t,n,l),l}cacheMergedAllOfProperties(t,r,n){let i=this.sharedState.mergedAllOfProperties.get(t);i!=null?i.set(r,n):this.sharedState.mergedAllOfProperties.set(t,new Map([[r,n]]))}canGenerateFromMergedAllOf(t,r=new WeakSet){if(t.allOf==null||t.allOf.length===0||!this.isMergeOnlyObjectSchema(t))return!1;let n=this.sharedState.mergeOnlyAllOfSchemas.get(t);if(n!=null)return n;if(r.has(t))return!1;r.add(t);let i=t.allOf.every(o=>{let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});return s==null||!this.isMergeOnlyObjectSchema(s)?!1:s.allOf==null||s.allOf.length===0?!0:this.canGenerateFromMergedAllOf(s,r)});return r.delete(t),this.sharedState.mergeOnlyAllOfSchemas.set(t,i),i}isMergeOnlyObjectSchema(t){return t.type!=null&&t.type!=="object"||t.type==null&&t.properties==null&&t.allOf==null?!1:Object.keys(t).every(r=>lnm.has(r))}isConstraintOnlySchema(t){if(typeof t!="object"||t===null||t.type!==void 0||t.properties!==void 0||t.allOf!==void 0||t.oneOf!==void 0||t.anyOf!==void 0||"items"in t||t.additionalProperties!==void 0||t.enum!==void 0||t.const!==void 0)return!1;let r=new Set(["required","description","title","deprecated","readOnly","writeOnly","nullable","example","examples","default","minLength","maxLength","minimum","maximum","exclusiveMinimum","exclusiveMaximum","minItems","maxItems","uniqueItems","pattern","format"]),n=Object.keys(t);return n.length>0&&n.every(i=>r.has(i))}isDeprecatedProperty(t){return t!=null&&"availability"in t&&t.availability==="deprecated"}isRequiredProperty({key:t,resolvedSchema:r}){return r.required?.includes(t)??!1}collectAllPropertyKeys(t,r=new Set){let n=new Set;if(t.properties)for(let i of Object.keys(t.properties))n.add(i);for(let i of t.allOf??[]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)){r.add(s);let a=this.collectAllPropertyKeys(o,r);for(let c of a)n.add(c)}}}for(let i of[...t.oneOf??[],...t.anyOf??[]]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)){r.add(s);let a=this.collectAllPropertyKeys(o,r);for(let c of a)n.add(c)}}}return n}schemaHasPatternProperties(t,r=new Set){let n=t.patternProperties;if(n&&typeof n=="object"&&Object.keys(n).length>0)return!0;for(let i of[...t.allOf??[],...t.oneOf??[],...t.anyOf??[]]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)&&(r.add(s),this.schemaHasPatternProperties(o,r)))return!0}}return!1}}});function bTu(e){return _v({type:e,_default:void 0,validation:void 0,visitor:{primitive:t=>{switch(t.v1){case"BASE_64":return Jr.primitive({v1:"BASE_64",v2:hi.base64({})});case"BOOLEAN":return Jr.primitive({v1:"BOOLEAN",v2:hi.boolean({default:void 0})});case"DATE":return Jr.primitive({v1:"DATE",v2:hi.date({})});case"DATE_TIME":return Jr.primitive({v1:"DATE_TIME",v2:hi.dateTime({})});case"DATE_TIME_RFC_2822":return Jr.primitive({v1:"DATE_TIME_RFC_2822",v2:hi.dateTimeRfc2822({})});case"FLOAT":return Jr.primitive({v1:"FLOAT",v2:hi.float({default:void 0,validation:void 0})});case"DOUBLE":return Jr.primitive({v1:"DOUBLE",v2:hi.double({default:void 0,validation:void 0})});case"UINT":return Jr.primitive({v1:"UINT",v2:hi.uint({default:void 0,validation:void 0})});case"UINT_64":return Jr.primitive({v1:"UINT_64",v2:hi.uint64({default:void 0,validation:void 0})});case"INTEGER":return Jr.primitive({v1:"INTEGER",v2:hi.integer({default:void 0,validation:void 0})});case"LONG":return Jr.primitive({v1:"LONG",v2:hi.long({default:void 0,validation:void 0})});case"STRING":return Jr.primitive({v1:"STRING",v2:hi.string({default:void 0,validation:void 0})});case"UUID":return Jr.primitive({v1:"UUID",v2:hi.uuid({})});case"BIG_INTEGER":return Jr.primitive({v1:"BIG_INTEGER",v2:hi.bigInteger({default:void 0})});default:return}},unknown:()=>Jr.unknown(),map:({keyType:t,valueType:r})=>{if(!(t==null||r==null))return Jr.container(gs.map({keyType:t,valueType:r}))},list:t=>{if(t!=null)return Jr.container(gs.list(t))},optional:t=>{if(t!=null)return Jr.container(gs.optional(t))},nullable:t=>{if(t!=null)return Jr.container(gs.nullable(t))},set:t=>{if(t!=null)return Jr.container(gs.set(t))},literal:t=>Jr.container(gs.literal(t._visit({string:r=>w0.string(r),boolean:r=>w0.boolean(r),_other:()=>{throw new S({message:"Unexpected literal type",code:S.Code.InternalError})}}))),named:()=>{}}})}var ETu=h(()=>{"use strict";lo();_n();Ft()});var ixe,u5r=h(()=>{"use strict";_n();tc();Uo();ixe=class extends Ji{schema;maybeFernEnum;forwardCompatible;constructor({context:t,breadcrumbs:r,schema:n,maybeFernEnum:i,forwardCompatible:o}){super({context:t,breadcrumbs:r}),this.schema=n,this.maybeFernEnum=i,this.forwardCompatible=o??!1}convert(){if(!this.schema.enum)return;let r=this.schema.enum.filter(i=>typeof i=="string"||typeof i=="number").map(i=>{let o=i.toString(),s=this.maybeFernEnum?.[o],a=s?.name??o;return{name:this.context.casingsGenerator.generateNameAndWireValue({name:a,wireValue:o}),docs:s?.description,availability:void 0,casing:s?.casing}});if(r.length===0){this.context.errorCollector.collect({message:`Received enum schema with no valid values: ${JSON.stringify(this.schema)}`,path:this.breadcrumbs});return}let n=this.context.getAsString(this.schema.default);return{type:vc.enum({default:n!=null?r.find(i=>nr(i.name)===n):void 0,values:r,forwardCompatible:this.forwardCompatible||void 0})}}}});var l5r,ITu=h(()=>{"use strict";_n();Uo();yUt();g3e();l5r=class extends Ji{schemaOrReferenceOrBoolean;constructor({context:t,breadcrumbs:r,schemaOrReferenceOrBoolean:n}){super({context:t,breadcrumbs:r}),this.schemaOrReferenceOrBoolean=n}convert(){let t=this.tryConvertUnknownMap();if(t!=null)return t;let r=this.tryConvertTypedMap();if(r!=null)return r}tryConvertUnknownMap(){if(typeof this.schemaOrReferenceOrBoolean=="boolean"){let t=Jr.container(gs.map({keyType:Ji.STRING,valueType:Jr.unknown()}));return{type:vc.alias({aliasOf:t,resolvedType:t}),referencedTypes:new Set,inlinedTypes:{}}}}tryConvertTypedMap(){if(typeof this.schemaOrReferenceOrBoolean=="boolean")return;let r=new oT({context:this.context,breadcrumbs:this.breadcrumbs,schemaOrReference:this.schemaOrReferenceOrBoolean}).convert();if(r!=null){let n=Jr.container(gs.map({keyType:Ji.STRING,valueType:r.type})),i=new Set;for(let o of r.schema?.typeDeclaration.referencedTypes??[])i.add(o);for(let o of Object.keys(r.inlinedTypes))i.add(o);return FH(r.type,i),{type:vc.alias({aliasOf:n,resolvedType:n}),referencedTypes:i,inlinedTypes:r.inlinedTypes}}}}});function CTu(e,t,r){let n=wTu(t,r),i={};for(let o of n)i=mNo(i,o);return ynm(i,e),i}function wTu(e,t,r){let n=r??new Set,i=[];for(let o of e)if(Array.isArray(o.allOf)&&o.allOf.length>0){let{allOf:s,...a}=o,c=[];for(let u of s)if("$ref"in u){if(t==null)continue;let l=u.$ref;if(n.has(l))continue;n.add(l);let p=t(u);p!=null&&c.push(p)}else c.push(u);i.push(...wTu(c,t,n)),Object.keys(a).length>0&&i.push(a)}else i.push(o);return i}function mNo(e,t){let r={...e};for(let[n,i]of Object.entries(t)){if(i===void 0||gnm.includes(n))continue;let o=r[n];if(n==="required"){let s=Array.isArray(o)?o:[],a=Array.isArray(i)?i:[];r[n]=[...new Set([...s,...a])];continue}if(n==="properties"){r[n]=Anm(o??{},i);continue}if(n==="items"){oxe(o)&&oxe(i)?r[n]=mNo(o,i):r[n]=i;continue}if(vTu.includes(n)){oxe(o)&&oxe(i)?r[n]=STu(o,i):r[n]=i;continue}if(xTu.includes(n)){r[n]=!!o||!!i;continue}if(mnm.includes(n)){typeof o=="number"&&typeof i=="number"?r[n]=Math.max(o,i):r[n]=i;continue}if(hnm.includes(n)){typeof o=="number"&&typeof i=="number"?r[n]=Math.min(o,i):r[n]=i;continue}r[n]=i}return r}function Anm(e,t){let r={...e};for(let[n,i]of Object.entries(t)){let o=r[n];oxe(o)&&oxe(i)?r[n]=mNo(o,i):r[n]=i}return r}function STu(e,t){let r={...e};for(let[n,i]of Object.entries(t)){let o=r[n];oxe(o)&&oxe(i)?r[n]=STu(o,i):r[n]=i}return r}function ynm(e,t){for(let r of dnm){let n=t[r];n!=null&&(e[r]=n)}for(let r of vTu){let n=t[r];n!=null&&(e[r]=n)}for(let r of xTu)t[r]===!0&&(e[r]=!0)}function oxe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var dnm,vTu,xTu,mnm,hnm,gnm,TTu=h(()=>{"use strict";dnm=["description","title","format","type","discriminator","xml","externalDocs","extensions"],vTu=["example","default"],xTu=["deprecated","readOnly","writeOnly","uniqueItems","nullable"],mnm=["minimum","exclusiveMinimum","minLength","minItems","minProperties"],hnm=["maximum","exclusiveMaximum","maxLength","maxItems","maxProperties"],gnm=["allOf","oneOf","anyOf"]});var Cit,hNo=h(()=>{"use strict";wt();_n();tc();c5r();Uo();yUt();Cit=class extends Ji{schema;xmlEncoding;constructor({context:t,breadcrumbs:r,schema:n,id:i}){super({context:t,breadcrumbs:r}),this.schema=n,this.xmlEncoding=new vit({breadcrumbs:this.breadcrumbs,schema:n,fallbackName:i,context:t}).convert()}convert(){let t=typeof this.schema.additionalProperties=="boolean"&&this.schema.additionalProperties;if(!this.schema.properties&&!this.schema.allOf)return{type:vc.object({properties:[],extends:[],extendedProperties:[],extraProperties:t,deferredUnionBaseProperties:void 0}),propertiesByAudience:{},inlinedTypes:{},referencedTypes:new Set,xmlEncoding:this.xmlEncoding};let{convertedProperties:r,inlinedTypesFromProperties:n,referencedTypes:i,propertiesByAudience:o}=A3e({properties:this.schema.properties??{},required:this.schema.required??[],breadcrumbs:this.breadcrumbs,context:this.context,errorCollector:this.context.errorCollector,withinXmlElement:this.xmlEncoding!=null}),s=[],a=i,c=this.schema.required!=null&&this.schema.required.length>0,u=n,l=o,p={};for(let d of this.schema.allOf??[])if(this.context.isReferenceObject(d)){let f=this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:this.breadcrumbs});if(f?.properties!=null)for(let[m,g]of Object.entries(f.properties))!this.context.isReferenceObject(g)&&p[m]==null&&(p[m]=g)}for(let[d,f]of(this.schema.allOf??[]).entries()){let m=[...this.breadcrumbs,"allOf",d.toString()],g,A=!1;if(this.context.isReferenceObject(f)){let D=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:m});if(D==null){this.context.logger.debug?.(`[ObjectSchemaConverter] allOf[${d}] reference could not be resolved. Skipping: ${JSON.stringify(f)}`);continue}if(g=D,typeof g.additionalProperties=="boolean"&&g.additionalProperties&&(t=!0),!c||Object.keys(g.properties??{}).every(R=>!this.schema.required?.includes(R))){this.addTypeReferenceToExtends({reference:f,breadcrumbs:m,extends_:s,referencedTypes:a});continue}}else g=f,A=!0;typeof g.additionalProperties=="boolean"&&g.additionalProperties&&(t=!0);let y=g.oneOf??g.anyOf;if(y!=null&&g.type==null&&g.properties==null){let D=new Set(r.map(R=>nr(R.name)));for(let[R,P]of y.entries()){let M=[...m,g.oneOf!=null?"oneOf":"anyOf",R.toString()],J=this.context.isReferenceObject(P)?this.context.resolveMaybeReference({schemaOrReference:P,breadcrumbs:M}):P;if(J==null)continue;let X={};for(let[De,se]of Object.entries(J.properties??{}))!this.context.isReferenceObject(se)&&"not"in se||(X[De]=se);let $=Object.keys(X).filter(De=>!D.has(De));if($.length===0)continue;let ie={};for(let De of $){let se=X[De];se!=null&&(ie[De]=se,D.add(De))}let{convertedProperties:ue,inlinedTypesFromProperties:oe,referencedTypes:de,propertiesByAudience:we}=A3e({properties:ie,required:[],breadcrumbs:M,context:this.context,errorCollector:this.context.errorCollector,withinXmlElement:this.xmlEncoding!=null});r.push(...ue),u={...u,...oe},l={...l,...we},de.forEach(De=>{a.add(De)})}continue}let E=g.properties??{};if(A){E={};for(let[D,R]of Object.entries(g.properties??{})){let P=p[D];P!=null&&!this.context.isReferenceObject(R)?E[D]={...P,...R}:E[D]=R}}let{convertedProperties:x,inlinedTypesFromProperties:v,referencedTypes:C,propertiesByAudience:O}=A3e({properties:E,required:[...this.schema.required??[],...g.required??[],..._ue(g)],breadcrumbs:m,context:this.context,errorCollector:this.context.errorCollector,withinXmlElement:this.xmlEncoding!=null});r.push(...x),u={...u,...v},l={...l,...O},C.forEach(D=>{a.add(D)})}for(let d of Object.keys(u))a.add(d);return{type:vc.object({properties:r,extends:s.map(d=>this.context.typeReferenceToDeclaredTypeName(d)).filter(sa),extendedProperties:[],extraProperties:t,deferredUnionBaseProperties:void 0}),propertiesByAudience:l,referencedTypes:a,inlinedTypes:u,xmlEncoding:this.xmlEncoding}}addTypeReferenceToExtends({reference:t,breadcrumbs:r,extends_:n,referencedTypes:i}){let o=this.context.convertReferenceToTypeReference({reference:t,breadcrumbs:r});o.ok&&n.push(o.reference);let s=this.context.getTypeIdFromSchemaReference(t);s!=null&&i.add(s)}}});function bnm(e){return e.type==="union"&&e.types.length===0}function Enm({schema:e,discriminantProperty:t}){let r=e.properties?.[t];if(r==null||"$ref"in r)return;let n=r.const;if(typeof n=="string")return n;if(r.enum?.length===1&&typeof r.enum[0]=="string")return r.enum[0]}var y3e,gNo=h(()=>{"use strict";_n();uNo();lNo();pNo();Uo();yUt();u5r();p5r();g3e();y3e=class extends Ji{schema;id;constructor({context:t,breadcrumbs:r,schema:n,id:i,inlinedTypes:o}){super({context:t,breadcrumbs:r}),this.schema=n,this.id=i}convert(){if(this.shouldConvertAsNullableSchemaOrReference())return this.convertAsNullableSchemaOrReference();if(new bit({context:this.context,breadcrumbs:this.breadcrumbs,node:this.schema}).convert()===!1)return this.convertAsUndiscriminatedUnion();if(this.schema.discriminator!=null){let n=this.convertAsDiscriminatedUnion();return n!=null&&!bnm(n.type)?n:this.convertAsUndiscriminatedUnion()??n}if(this.context.settings.inferForwardCompatible){let n=this.convertAsOpenEndedEnum();if(n!=null)return n}return this.convertAsUndiscriminatedUnion()}convertAsOpenEndedEnum(){let t=this.schema.oneOf??this.schema.anyOf;if(t==null||t.length!==2)return;let r,n=!1;for(let c of t){let u;if(this.context.isReferenceObject(c)){let l=this.context.resolveReference({reference:c,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});l.resolved&&(u=l.value)}else u=c;u!=null&&(u.enum!=null&&u.enum.length>1&&(u.type==="string"||u.type==null)?r=u:u.type==="string"&&u.enum==null&&(n=!0))}if(r==null||!n)return;let o=new Iit({breadcrumbs:this.breadcrumbs,schema:r,context:this.context}).convert(),a=new ixe({context:this.context,breadcrumbs:this.breadcrumbs,schema:r,maybeFernEnum:o,forwardCompatible:!0}).convert();if(a!=null)return{...a,referencedTypes:new Set,inlinedTypes:{}}}filterDiscriminantFromSchema(t,r){if(t.properties==null||!(r in t.properties))return t;let{[r]:n,...i}=t.properties,o=t.required?.filter(s=>s!==r);return{...t,properties:i,required:o}}getVariants(t){let r=this.schema.discriminator?.mapping;if(r!=null){let o=[];for(let[s,a]of Object.entries(r)){let c=this.context.getTypeIdFromSchemaReference({$ref:a});c!=null&&o.push({discriminant:s,typeId:c,ref:a,schema:this.resolveVariantSchema({$ref:a}),breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",s]})}return o}let n=this.schema.oneOf??this.schema.anyOf??[],i=[];for(let[o,s]of n.entries()){let a=this.resolveVariantSchema(s),c=a!=null?Enm({schema:a,discriminantProperty:t}):void 0;if(!this.context.isReferenceObject(s)){if(c==null)return[];i.push({discriminant:c,typeId:this.context.convertBreadcrumbsToName([`${this.id}_${o}`]),schema:a,breadcrumbs:[...this.breadcrumbs,`oneOf[${o}]`]});continue}let u=s.$ref,l=u.split("/").pop(),p=this.context.getTypeIdFromSchemaReference(s),d=c??l;if(p==null||d==null)return[];i.push({discriminant:d,typeId:p,ref:u,schema:a,breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",d]})}return i}resolveVariantSchema(t){if(!this.context.isReferenceObject(t))return t;let r=this.context.resolveReference({reference:t,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});return r.resolved?r.value:void 0}convertAsDiscriminatedUnion(){if(this.schema.discriminator==null)return;let t=this.schema.discriminator.propertyName,r=[],n=new Set,i={};for(let{discriminant:l,typeId:p,ref:d,schema:f,breadcrumbs:m}of this.getVariants(t)){let g=d!=null?{$ref:d}:f;if(f?.properties!=null&&t in f.properties&&(g=this.filterDiscriminantFromSchema(f,t)),g==null)continue;let A=new oT({context:this.context,schemaOrReference:g,schemaIdOverride:p??void 0,breadcrumbs:m});p!=null&&n.add(p);let y=A.convert();if(y?.type!=null&&p!=null){for(let D of Object.keys(y?.inlinedTypes??{}))n.add(D);for(let D of y.schema?.typeDeclaration.referencedTypes??[])n.add(D);let E=this.context.casingsGenerator.generateNameAndWireValue({name:l,wireValue:l}),x=d?.split("/").pop()??p,v=f?.title,C=f?.description,O=v??l??x;y.schema?.typeDeclaration!=null&&v!=null&&(y.schema.typeDeclaration.name.displayName=v),r.push({docs:C,discriminantValue:E,availability:y.availability,displayName:O,shape:s1.samePropertiesAsObject({typeId:p,name:this.context.casingsGenerator.generateName(x),fernFilepath:{allParts:[],packagePath:[],file:void 0},displayName:O})}),i={...i,...y.inlinedTypes}}}let{convertedProperties:o,referencedTypes:s,inlinedTypesFromProperties:a}=A3e({properties:this.schema.properties??{},required:this.schema.required??[],breadcrumbs:this.breadcrumbs,context:this.context,errorCollector:this.context.errorCollector});n=new Set([...n,...s]);let c=[];for(let[l,p]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",l.toString()];if(this.context.isReferenceObject(p)){let f=this.context.convertReferenceToTypeReference({reference:p,breadcrumbs:d});if(f.ok){let g=this.context.typeReferenceToDeclaredTypeName(f.reference);g!=null&&c.push(g)}let m=this.context.getTypeIdFromSchemaReference(p);m!=null&&n.add(m);continue}}for(let l of Object.keys({...i,...a}))n.add(l);let u=new Eit({context:this.context,breadcrumbs:[...this.breadcrumbs,"discriminator"],node:this.schema.discriminator});return{type:vc.union({baseProperties:o,inheritedBaseProperties:[],discriminant:this.context.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:c,types:r,default:void 0,discriminatorContext:u.convert()}),referencedTypes:n,inlinedTypes:{...i,...a}}}convertAsUndiscriminatedUnion(){if(!this.schema.oneOf&&!this.schema.anyOf||this.schema.anyOf?.length===0&&this.schema.oneOf?.length===0)return;let t=[],r=new Set,n={};for(let[a,c]of[...(this.schema.oneOf??[]).entries(),...(this.schema.anyOf??[]).entries()]){if(this.context.isReferenceObject(c)){let g;if(this.context.isReferenceObjectWithIdentifier(c))g=this.context.convertReferenceToTypeReference({reference:c,displayNameOverride:c.summary??c.title??c.name??c.messageId,displayNameOverrideSource:"reference_identifier"});else{let y=this.getDiscriminatorKeyForRef(c);y!=null?g=this.context.convertReferenceToTypeReference({reference:c,displayNameOverride:y,displayNameOverrideSource:"discriminator_key"}):g=this.context.convertReferenceToTypeReference({reference:c,breadcrumbs:this.breadcrumbs})}if(g.ok){let y=this.context.resolveReference({reference:c,breadcrumbs:this.breadcrumbs}),E=y.resolved?y.value.description:void 0;t.push({type:g.reference,docs:E})}let A=this.context.getTypeIdFromSchemaReference(c);A!=null&&r.add(A);continue}let l=Object.keys(this.schema.properties??{}).length>0?void 0:this.extendSubSchema(c),p=this.context.convertBreadcrumbsToName([`${this.id}_${a}`]),d=c.title,m=new sxe({context:this.context,id:p,nameOverride:d,breadcrumbs:[...this.breadcrumbs,`oneOf[${a}]`],schema:l??c}).convert();if(m!=null){let g=m.convertedSchema.typeDeclaration.shape;if(g.type==="alias"&&this.typeReferenceIsWrappedPrimitive(g.aliasOf))t.push({type:g.aliasOf,docs:c.description});else if(g.type==="object"&&g.properties.length===0&&g.extends.length===0)t.push({type:Jr.container(gs.map({keyType:Ji.STRING,valueType:Jr.unknown()})),docs:c.description});else{t.push({type:this.context.createNamedTypeReference(p,d),docs:c.description});let A=this.context.getNamespacedSchemaId(p);n={...n,...m.inlinedTypes,[A]:m.convertedSchema}}m.convertedSchema.typeDeclaration.referencedTypes.forEach(A=>{r.add(A)})}}let{convertedProperties:i,referencedTypes:o,inlinedTypesFromProperties:s}=A3e({properties:this.schema.properties??{},required:this.schema.required??[],breadcrumbs:this.breadcrumbs,context:this.context,errorCollector:this.context.errorCollector});for(let a of Object.keys(s))r.add(a);for(let a of o)r.add(a);return{type:vc.undiscriminatedUnion({members:t,baseProperties:i.length>0?i:void 0}),referencedTypes:r,inlinedTypes:{...n,...s}}}shouldConvertAsNullableSchemaOrReference(){return this.schema.oneOf!=null?this.schema.oneOf.some(t=>t&&typeof t=="object"&&"type"in t&&t.type==="null"):this.schema.anyOf!=null?this.schema.anyOf.some(t=>t&&typeof t=="object"&&"type"in t&&t.type==="null"):!1}removeNullFromOneOfOrAnyOf(){let t=this.schema.oneOf??this.schema.anyOf,r=this.schema.oneOf!=null?"oneOf":"anyOf";if(t==null)return;let n=t.filter(i=>!(typeof i=="object"&&i!==null&&"type"in i&&i.type==="null"));if(n.length===0){this.context.errorCollector.collect({message:`Received ${r} schema with no valid non-null types`,path:this.breadcrumbs});return}return n.length===1?{...this.schema,[r]:void 0,...n[0]}:{...this.schema,[r]:n}}convertAsNullableSchemaOrReference(){let t=this.removeNullFromOneOfOrAnyOf();if(t==null)return;let n=new oT({context:this.context,breadcrumbs:this.breadcrumbs,schemaOrReference:t}).convert();if(n==null)return;let i=this.wrapInNullable(n.type);return{type:vc.alias({aliasOf:i,resolvedType:i}),referencedTypes:n.schema?.typeDeclaration.referencedTypes??new Set,inlinedTypes:n.inlinedTypes}}typeReferenceIsWrappedPrimitive(t){switch(t.type){case"container":return this.containerTypeIsWrappedPrimitive(t.container);case"named":return!1;case"primitive":return!0;case"unknown":return!0;default:return!1}}containerTypeIsWrappedPrimitive(t){switch(t.type){case"list":return this.typeReferenceIsWrappedPrimitive(t.list);case"map":return this.typeReferenceIsWrappedPrimitive(t.keyType)&&this.typeReferenceIsWrappedPrimitive(t.valueType);case"nullable":return this.typeReferenceIsWrappedPrimitive(t.nullable);case"optional":return this.typeReferenceIsWrappedPrimitive(t.optional);case"set":return this.typeReferenceIsWrappedPrimitive(t.set);case"literal":return!0;default:return!1}}wrapInNullable(t){return Jr.container(gs.nullable(t))}mergeIntoObjectSchema(t,r){return{...t,properties:{...r,...t.properties??{}}}}extendSubSchema(t){if(Object.entries(this.schema.properties??{}).length===0)return t;if(t.type==="object")return this.mergeIntoObjectSchema(t,this.schema.properties??{});this.context.isObjectSchemaType(t)||this.context.errorCollector.collect({message:"Received additional object properties for oneOf/anyOf that are not objects",path:this.breadcrumbs})}getDiscriminatorKeyForRef(t){return Object.entries(this.schema.discriminator?.mapping??{}).find(([r,n])=>n===t.$ref)?.[0]}}});var wit,ANo=h(()=>{"use strict";_n();Uo();wit=class extends Ji{schema;constructor({context:t,breadcrumbs:r,schema:n}){super({context:t,breadcrumbs:r}),this.schema=n}convert(){switch(this.schema.type){case"string":{let t=this.context.getAsString(this.schema.const);if(t!=null)return Jr.container(gs.literal(w0.string(t)));if(this.schema.format==="date-time-rfc-2822")return Jr.primitive({v1:as.DateTimeRfc2822,v2:hi.dateTimeRfc2822({})});if(this.context.settings.typeDatesAsStrings===!1){if(this.schema.format==="date")return Jr.primitive({v1:as.Date,v2:hi.date({})});if(this.schema.format==="date-time")return Jr.primitive({v1:as.DateTime,v2:hi.dateTime({})})}return Jr.primitive({v1:"STRING",v2:hi.string({default:this.context.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":switch(this.schema.format){case"double":return Jr.primitive({v1:"DOUBLE",v2:hi.double({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return Jr.primitive({v1:"FLOAT",v2:hi.float({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return Jr.primitive({v1:"INTEGER",v2:hi.integer({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return Jr.primitive({v1:"LONG",v2:hi.long({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint32":return Jr.primitive({v1:"UINT",v2:hi.uint({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return Jr.primitive({v1:"UINT_64",v2:hi.uint64({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return Jr.primitive({v1:"DOUBLE",v2:hi.double({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"integer":switch(this.schema.format){case"double":return Jr.primitive({v1:"DOUBLE",v2:hi.double({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return Jr.primitive({v1:"FLOAT",v2:hi.float({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return Jr.primitive({v1:"INTEGER",v2:hi.integer({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return Jr.primitive({v1:"LONG",v2:hi.long({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint32":return Jr.primitive({v1:"UINT",v2:hi.uint({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return Jr.primitive({v1:"UINT_64",v2:hi.uint64({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return Jr.primitive({v1:"INTEGER",v2:hi.integer({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let t=this.context.getAsBoolean(this.schema.const);return t!=null?Jr.container(gs.literal(w0.boolean(t))):Jr.primitive({v1:"BOOLEAN",v2:hi.boolean({default:this.context.getAsBoolean(this.schema.default)})})}default:return}}getNumberValidation(t){let r=t.minimum,n=t.maximum,i,o;return typeof t.exclusiveMinimum=="boolean"?i=t.exclusiveMinimum:typeof t.exclusiveMinimum=="number"&&(r=t.exclusiveMinimum,i=!0),typeof t.exclusiveMaximum=="boolean"?o=t.exclusiveMaximum:typeof t.exclusiveMaximum=="number"&&(n=t.exclusiveMaximum,o=!0),{max:n,min:r,exclusiveMax:o,exclusiveMin:i,multipleOf:t.multipleOf}}getStringValidation(t){let r=t.format??(t.contentMediaType==="application/octet-stream"?"binary":void 0);return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:r}}}});function vnm(e){let t=_ue(e);return t.length===0?e:{...e,required:[...new Set([...e.required??[],...t])]}}var Inm,sxe,p5r=h(()=>{"use strict";wt();_n();Uo();ETu();nxe();yNo();u5r();ITu();TTu();hNo();gNo();ANo();Inm=["description","example","title","default","deprecated","readOnly","writeOnly","xml","externalDocs","extensions"],sxe=class e extends Ji{static MAX_DISTRIBUTED_VARIANTS=64;schema;id;inlined;audiences;nameOverride;visitedRefs;constructor({context:t,breadcrumbs:r,schema:n,id:i,inlined:o=!1,nameOverride:s,visitedRefs:a}){super({context:t,breadcrumbs:r}),this.schema=n,this.id=i,this.inlined=o,this.nameOverride=s,this.visitedRefs=a??new Set,this.audiences=this.context.getAudiences({operation:this.schema,breadcrumbs:this.breadcrumbs})??[]}convert(){let t=this.tryConvertFernTypeDeclaration();if(t!=null)return t;let r=this.tryConvertEnumSchema();if(r!=null)return r;let n=this.tryDistributeAllOfOverOneOf();if(n!=null)return n;let i=this.tryConvertSingularAllOfSchema();if(i!=null)return i;let o=this.tryConvertPrimitiveSchema();if(o!=null)return o;let s=this.tryConvertArraySchema();if(s!=null)return s;let a=this.tryConvertTypeArraySchema();if(a!=null)return a;let c=this.tryConvertSiblingAnyOfConstraint();if(c!=null)return c;let u=this.tryConvertSiblingOneOfConstraint();if(u!=null)return u;let l=this.tryConvertOneOfAnyOfSchema();if(l!=null)return l;let p=this.tryConvertMapSchema();if(p!=null)return p;let d=this.tryConvertDiscriminatorMappingSchema();if(d!=null)return d;let f=this.tryConvertObjectAllOfSchema();if(f!=null)return f;let m=this.tryConvertUntypedSchema();if(m!=null)return m;this.context.errorCollector.collect({message:`Failed to convert schema object: ${JSON.stringify(this.schema,null,2)}`,path:this.breadcrumbs})}tryConvertEnumSchema(){if(!this.schema.enum?.length)return;let r=new ux.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema,context:this.context}).convert(),i=new ixe({context:this.context,breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:r}).convert();if(i!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:i.type,referencedTypes:new Set}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:{}}}tryConvertSingularAllOfSchema(){if(this.schemaOnlyHasAllowedKeys(["allOf","type","title"])&&this.schema.allOf?.length===1&&this.schema.allOf[0]!=null){let r=this.schema.allOf[0];if(this.context.isReferenceObject(r)){let i=r.$ref;if(this.visitedRefs.has(i))return}let n=this.context.resolveMaybeReference({schemaOrReference:r,breadcrumbs:this.breadcrumbs});if(n!=null){let i=this.context.isReferenceObject(r)?new Set([...this.visitedRefs,r.$ref]):this.visitedRefs,s=new e({context:this.context,breadcrumbs:[...this.breadcrumbs,"allOf","0"],schema:n,id:this.id,inlined:this.inlined,visitedRefs:i}).convert();if(s?.convertedSchema.typeDeclaration?.shape.type!=="object"){if(s!=null){let a=s.convertedSchema.typeDeclaration;this.schema.description!=null&&a.docs==null&&(a.docs=this.schema.description);let c=this.context.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs});c!=null&&a.availability==null&&(a.availability=c)}return s}}}if(this.schemaOnlyHasAllowedKeys(["allOf","type","title"])&&Array.isArray(this.schema.allOf)&&this.schema.allOf.length>=1){let r=new Set,n=[],i=!1;for(let c of this.schema.allOf??[]){let u;if(this.context.isReferenceObject(c)){let p=c.$ref;if(this.visitedRefs.has(p)){i=!0;break}if(r.has(p))continue;r.add(p);let d=this.context.resolveMaybeReference({schemaOrReference:c,breadcrumbs:this.breadcrumbs});if(d==null)return;u=d}else u=c;let l=u.oneOf??u.anyOf;if(!this.context.isReferenceObject(c)&&l!=null&&u.type==null&&u.properties==null){let p={};for(let d of l){let f=this.context.isReferenceObject(d)?this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:this.breadcrumbs}):d;if(f!=null)for(let[m,g]of Object.entries(f.properties??{}))!this.context.isReferenceObject(g)&&"not"in g||m in p||(p[m]=g)}Object.keys(p).length>0&&n.push({properties:p});continue}n.push(vnm(u))}if(i)return;let o=CTu(this.schema,n,c=>{let u=this.context.resolveMaybeReference({schemaOrReference:c,breadcrumbs:this.breadcrumbs});if(!(u!=null&&this.context.isReferenceObject(u)))return u}),s=new Set([...this.visitedRefs,...r]);return new e({context:this.context,breadcrumbs:this.breadcrumbs,schema:o,id:this.id,inlined:this.inlined,visitedRefs:s}).convert()}}tryDistributeAllOfOverOneOf(){if(!this.context.settings.preserveOneOfInAllOf)return;let t=this.schema.allOf;if(!Array.isArray(t)||t.length===0||this.schema.oneOf!=null||this.schema.anyOf!=null)return;let r=this.getDistributableUnions(t),n=r[0];if(n==null)return;let i=r.reduce((c,u)=>c*u.variants.length,1);if(i>e.MAX_DISTRIBUTED_VARIANTS){this.context.logger.warn(`Not distributing allOf over its ${r.length} unions at ${this.breadcrumbs.join(".")}: it would produce ${i} variants (max ${e.MAX_DISTRIBUTED_VARIANTS}).`);return}let o=t.filter((c,u)=>u!==n.index);(this.schema.properties!=null||this.schema.required!=null)&&o.push({type:"object",properties:this.schema.properties,required:this.schema.required});let s={...this.schema};return delete s.allOf,delete s.properties,delete s.required,new e({context:this.context,breadcrumbs:this.breadcrumbs,schema:{...s,oneOf:n.variants.map(c=>{let u=this.getVariantTitle(c);return{...u!=null?{title:u}:{},allOf:[c,...o]}})},id:this.id,inlined:this.inlined,nameOverride:this.nameOverride,visitedRefs:this.visitedRefs}).convert()}getVariantTitle(t){return this.context.isReferenceObject(t)?this.context.resolveMaybeReference({schemaOrReference:t,breadcrumbs:this.breadcrumbs})?.title??t.$ref.split("/").pop():t.title}getDistributableUnions(t){let r=[];for(let[n,i]of t.entries()){let o=this.context.isReferenceObject(i)?this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs}):i;if(o==null||o.properties!=null||o.type!=null&&o.type!=="object"||o.discriminator!=null)continue;let s=o.oneOf??o.anyOf;s==null||s.length===0||r.push({index:n,variants:s})}return r}tryConvertPrimitiveSchema(){let r=new wit({context:this.context,schema:this.schema}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:vc.alias({aliasOf:r,resolvedType:r}),referencedTypes:new Set}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:{}}}tryConvertArraySchema(){if(this.schema.type==="array"){let r=new Sit({context:this.context,breadcrumbs:this.breadcrumbs,schema:this.schema}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:vc.alias({aliasOf:r.typeReference,resolvedType:r.typeReference}),referencedTypes:r.referencedTypes}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:r.inlinedTypes}}}tryConvertTypeArraySchema(){if(Array.isArray(this.schema.type)&&this.schema.type.length>0)return this.schema.type.length===1?this.schema.type=this.schema.type[0]:(this.schema.oneOf=this.schema.type.map(t=>({type:t})),this.schema.type=void 0),this.convert()}tryConvertSiblingAnyOfConstraint(){if(!this.context.settings.anyOfSiblingPropertiesAsObject||!zNe(this.schema))return;this.context.logger.debug(`Treating the anyOf at ${this.breadcrumbs.join(".")} as an "at least one of" constraint over its sibling properties rather than a union, and converting the schema as an object.`);let{anyOf:t,...r}=this.schema;return new e({id:this.id,context:this.context,breadcrumbs:this.breadcrumbs,schema:r,inlined:this.inlined,nameOverride:this.nameOverride,visitedRefs:this.visitedRefs}).convert()}tryConvertSiblingOneOfConstraint(){if(!MNe(this.schema)||new ux.FernDiscriminatedExtension({context:this.context,breadcrumbs:this.breadcrumbs,node:this.schema}).convert()===!0)return;this.context.logger.debug(`Treating the oneOf at ${this.breadcrumbs.join(".")} as an "exactly one of" constraint over its sibling properties rather than a union, and converting the schema as an object.`);let r=_ue(this.schema),{oneOf:n,...i}=this.schema;return r.length>0&&(i.required=[...new Set([...i.required??[],...r])]),new e({id:this.id,context:this.context,breadcrumbs:this.breadcrumbs,schema:i,inlined:this.inlined,nameOverride:this.nameOverride,visitedRefs:this.visitedRefs}).convert()}tryConvertOneOfAnyOfSchema(){if(this.schema.oneOf!=null||this.schema.anyOf!=null){let r=new y3e({id:this.id,context:this.context,breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:r.type,referencedTypes:r.referencedTypes}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:r.inlinedTypes}}}tryConvertMapSchema(){if((typeof this.schema.additionalProperties=="object"||typeof this.schema.additionalProperties=="boolean")&&this.schema.additionalProperties!=null&&!this.schema.properties&&!this.schema.allOf){if(typeof this.schema.additionalProperties=="boolean"&&this.schema.additionalProperties===!1)return;let r=new l5r({context:this.context,breadcrumbs:this.breadcrumbs,schemaOrReferenceOrBoolean:this.schema.additionalProperties}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:r.type,referencedTypes:r.referencedTypes}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:r.inlinedTypes}}}tryConvertDiscriminatorMappingSchema(){if(this.schema.discriminator?.mapping!=null&&Object.keys(this.schema.discriminator.mapping).length>0&&this.schema.oneOf==null&&this.schema.anyOf==null){let t={...this.schema,oneOf:Object.values(this.schema.discriminator.mapping).map(i=>({$ref:i}))},n=new y3e({id:this.id,context:this.context,breadcrumbs:this.breadcrumbs,schema:t,inlinedTypes:{}}).convert();if(n!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:n.type,referencedTypes:n.referencedTypes}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:n.inlinedTypes}}}tryConvertObjectAllOfSchema(){if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let r=new Cit({context:this.context,breadcrumbs:this.breadcrumbs,schema:this.schema,id:this.id}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:r.type,referencedTypes:r.referencedTypes,encoding:r.xmlEncoding!=null?{json:void 0,proto:void 0,xml:r.xmlEncoding}:void 0}),audiences:this.audiences,propertiesByAudience:r.propertiesByAudience},inlinedTypes:r.inlinedTypes}}}tryConvertUntypedSchema(){if(this.isUntypedSchema())return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:vc.alias({aliasOf:Jr.unknown(),resolvedType:Jr.unknown()}),referencedTypes:new Set}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:{}}}tryConvertFernTypeDeclaration(){let r=new ux.FernTypeExtension({breadcrumbs:this.breadcrumbs,schema:this.schema,context:this.context}).convert();if(r==null)return;let n=bTu(r);if(n!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:vc.alias({aliasOf:n,resolvedType:n}),referencedTypes:new Set,omitV2Examples:!0}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:{}}}createTypeDeclaration({shape:t,referencedTypes:r,omitV2Examples:n,encoding:i}){return{name:this.convertDeclaredTypeName(),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:i,availability:this.context.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs}),docs:this.schema.description,referencedTypes:r,source:void 0,inline:this.inlined,v2Examples:n?void 0:this.convertSchemaExamples()}}convertDeclaredTypeName(){let t=this.context.getRawSchemaId(this.id);return{typeId:this.context.getNamespacedSchemaId(this.id),fernFilepath:this.context.createFernFilepath(),name:this.context.casingsGenerator.generateName(t),displayName:this.nameOverride}}schemaOnlyHasAllowedKeys(t){let r=[...Inm,...t];return Object.keys(this.schema).every(i=>r.includes(i))}isUntypedSchema(){return!!(this.schema&&typeof this.schema=="object"&&!("oneOf"in this.schema)&&!("anyOf"in this.schema)&&!("allOf"in this.schema)&&!("items"in this.schema)&&!("properties"in this.schema))}convertSchemaExamples(){let t={userSpecifiedExamples:{},autogeneratedExamples:{}},r=this.context.getExamplesFromSchema({schema:this.schema,breadcrumbs:this.breadcrumbs});if(r.length===0){let n=this.generateOrValidateExample({example:void 0,ignoreErrors:!0});return t.autogeneratedExamples={[`${this.id}_example_autogenerated`]:n},t}return t.userSpecifiedExamples=this.convertUserSpecifiedExamples(r),t}convertUserSpecifiedExamples(t){let r={};for(let[n,i]of t.entries()){let o=this.context.resolveExample(i),s=`${this.id}_example_${n}`,a=this.generateOrValidateExample({example:o,exampleName:s});r[s]=a}return r}generateOrValidateExample({example:t}){let r=new nS({breadcrumbs:this.breadcrumbs,context:this.context,schema:this.schema,example:t}),{validExample:n}=r.convert();return n}}});function Cnm(e){return Object.keys(e).every(t=>xnm.has(t))}var oT,xnm,g3e=h(()=>{"use strict";_n();Uo();p5r();oT=class extends Ji{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({context:t,breadcrumbs:r,schemaOrReference:n,schemaIdOverride:i,wrapAsOptional:o=!1,wrapAsNullable:s=!1}){super({context:t,breadcrumbs:r}),this.schemaOrReference=n,this.schemaIdOverride=i,this.wrapAsOptional=o,this.wrapAsNullable=s}convert(){let t=this.maybeConvertReferenceObject({schemaOrReference:this.schemaOrReference});if(t!=null)return t;let r=this.maybeConvertSingularAllOfReferenceObject();return r??this.convertSchemaObject({schema:this.schemaOrReference})}maybeConvertReferenceObject({schemaOrReference:t}){if(this.context.isReferenceObject(t)){let r=this.context.convertReferenceToTypeReference({reference:t,breadcrumbs:this.breadcrumbs});if(r.ok)return{type:this.wrapTypeReference(r.reference),inlinedTypes:r.inlinedTypes??{},availability:this.context.getAvailability({node:t,breadcrumbs:this.breadcrumbs})}}}maybeConvertSingularAllOfReferenceObject(){if(this.context.isReferenceObject(this.schemaOrReference)||this.schemaOrReference.allOf==null)return;if(this.schemaOrReference.allOf.length===1){let i=this.schemaOrReference.allOf[0];if(this.context.isReferenceObject(i)){let o=this.context.convertReferenceToTypeReference({reference:i,breadcrumbs:this.breadcrumbs});if(o.ok)return{type:this.wrapTypeReference(o.reference),inlinedTypes:o.inlinedTypes??{},availability:this.getAvailabilityOfSelfOrReference(i)}}return}let t=this.schemaOrReference.allOf.filter(i=>this.context.isReferenceObject(i)),r=this.schemaOrReference.allOf.filter(i=>typeof i=="object"&&i!==null&&!this.context.isReferenceObject(i)),n=t.length===1?t[0]:void 0;if(n!=null&&r.every(i=>Cnm(i))){let i=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:this.breadcrumbs});if(i!=null&&i.type!=="object"&&!i.properties&&!i.allOf&&!i.oneOf&&!i.anyOf&&!i.format){let o=this.context.convertReferenceToTypeReference({reference:n,breadcrumbs:this.breadcrumbs});if(o.ok)return{type:this.wrapTypeReference(o.reference),inlinedTypes:o.inlinedTypes??{},availability:this.getAvailabilityOfSelfOrReference(n)}}}}getAvailabilityOfSelfOrReference(t){for(let r of[...this.getSelfAndInlineAllOfElements(),t]){let n=this.context.getAvailability({node:r,breadcrumbs:this.breadcrumbs});if(n!=null)return n}}getSelfAndInlineAllOfElements(){return this.context.isReferenceObject(this.schemaOrReference)||this.schemaOrReference.allOf==null?[this.schemaOrReference]:[this.schemaOrReference,...this.schemaOrReference.allOf.filter(t=>!this.context.isReferenceObject(t))]}convertSchemaObject({schema:t}){let r=this.schemaIdOverride??this.context.convertBreadcrumbsToName(this.breadcrumbs),n=this.context.getNamespacedSchemaId(r),i=new sxe({context:this.context,breadcrumbs:this.breadcrumbs,schema:t,id:r}),o=this.context.getAvailability({node:t,breadcrumbs:this.breadcrumbs}),s=i.convert();if(s!=null){let a=s.convertedSchema.typeDeclaration.shape;return a.type==="alias"?{type:this.wrapTypeReference(a.aliasOf),schema:s.convertedSchema,inlinedTypes:s.inlinedTypes,availability:o}:{type:this.wrapTypeReference(this.context.createNamedTypeReference(r)),schema:s.convertedSchema,inlinedTypes:{...s.inlinedTypes,[n]:s.convertedSchema},availability:o}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return Jr.container(gs.optional(t))}wrapInNullable(t){return Jr.container(gs.nullable(t))}},xnm=new Set(["description","title","deprecated","readOnly","writeOnly","xml","externalDocs","x-fern-type-name"])});function A3e({properties:e,required:t,breadcrumbs:r,context:n,errorCollector:i,withinXmlElement:o=!1}){let s=[],a={},c={},u=new Set;for(let[l,p]of Object.entries(e??{})){let d=[...r,"properties",l];if(typeof p!="object"){i.collect({message:`Schema property ${l} should be an object`,path:d});continue}let f=Snm(r,p,n)??n.convertBreadcrumbsToName(d),m="nullable"in p?p.nullable:!1,A=new oT({context:n,breadcrumbs:d,schemaOrReference:p,schemaIdOverride:f,wrapAsOptional:!t.includes(l),wrapAsNullable:m}).convert();if(A!=null){let y=n.resolveMaybeReference({schemaOrReference:p,breadcrumbs:d,skipErrorCollector:!0});s.push({name:n.casingsGenerator.generateNameAndWireValue({name:l,wireValue:l}),valueType:A.type,docs:p.description??A.schema?.typeDeclaration.docs,availability:A.availability,propertyAccess:n.getPropertyAccess(p),defaultValue:y?.default,xml:o?new xit({breadcrumbs:d,propertySchema:p,resolvedPropertySchema:y??void 0,context:n}).convert():void 0,v2Examples:A.schema?.typeDeclaration?.v2Examples??wnm({propertySchema:p,breadcrumbs:d,context:n,propertyId:f})}),a={...a,...A.inlinedTypes},A.schema?.typeDeclaration.referencedTypes!=null&&A.schema.typeDeclaration.referencedTypes.forEach(E=>{u.add(E)}),FH(A.type,u);for(let E of A.schema?.audiences??[])c[E]==null&&(c[E]=new Set),c[E].add(l)}}for(let l of Object.keys(a))u.add(l);return{convertedProperties:s,propertiesByAudience:c,inlinedTypesFromProperties:a,referencedTypes:u}}function wnm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n}){let i=r.resolveMaybeReference({schemaOrReference:e,breadcrumbs:t,skipErrorCollector:!0}),o=r.getExamplesFromSchema({schema:i??void 0,breadcrumbs:t});if(o.length>0){let u={};for(let[l,p]of o.entries()){let d=r.resolveExample(p),f=`${n}_example_${l}`,m=new nS({breadcrumbs:t,context:r,schema:e,example:d}),{validExample:g}=m.convert();u[f]=g}return{userSpecifiedExamples:u,autogeneratedExamples:{}}}let s=`${n}_example_autogenerated`,a=new nS({breadcrumbs:t,context:r,schema:e,example:void 0,generateOptionalProperties:!0}),{validExample:c}=a.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{[s]:c}}}function Snm(e,t,r){return r.isReferenceObject(t)?void 0:new ux.FernTypeNameExtension({breadcrumbs:e,schema:t,context:r}).convert()}function FH(e,t){switch(e.type){case"named":t.add(e.typeId);return;case"primitive":case"unknown":return;case"container":Tnm(e.container,t);return}}function Tnm(e,t){switch(e.type){case"list":FH(e.list,t);return;case"set":FH(e.set,t);return;case"optional":FH(e.optional,t);return;case"nullable":FH(e.nullable,t);return;case"map":FH(e.keyType,t),FH(e.valueType,t);return;case"literal":return}}var yUt=h(()=>{"use strict";nxe();g3e();c5r();Uo()});var Sit,yNo=h(()=>{"use strict";_n();Uo();yUt();g3e();Sit=class e extends Ji{static LIST_UNKNOWN=Jr.container(gs.list(Jr.unknown()));schema;constructor({context:t,breadcrumbs:r,schema:n}){super({context:t,breadcrumbs:r}),this.schema=n}convert(){if(this.schema.items!=null){Array.isArray(this.schema.items)&&(this.schema.items={oneOf:this.schema.items});let r=new oT({context:this.context,breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert();if(r!=null){let n=new Set;for(let i of r.schema?.typeDeclaration.referencedTypes??[])n.add(i);return r.inlinedTypes!=null&&Object.values(r.inlinedTypes).forEach(i=>{i.typeDeclaration.referencedTypes.forEach(o=>{n.add(o)})}),FH(r.type,n),{typeReference:Jr.container(gs.list(r.type)),referencedTypes:n,inlinedTypes:r.inlinedTypes}}}return{typeReference:e.LIST_UNKNOWN,referencedTypes:new Set,inlinedTypes:{}}}}});var bNo={};Z(bNo,{ArraySchemaConverter:()=>Sit,EnumSchemaConverter:()=>ixe,ObjectSchemaConverter:()=>Cit,OneOfSchemaConverter:()=>y3e,PrimitiveSchemaConverter:()=>wit,SchemaConverter:()=>sxe,SchemaOrReferenceConverter:()=>oT});var ENo=h(()=>{"use strict";yNo();u5r();hNo();gNo();ANo();p5r();g3e()});var f5r,OTu=h(()=>{"use strict";Vi();Uo();nxe();ENo();f5r=class extends Ji{group;method;constructor({context:t,breadcrumbs:r,group:n,method:i}){super({context:t,breadcrumbs:r}),this.group=n,this.method=i}parseMediaTypeObject({mediaTypeObject:t,resolveSchema:r,contentType:n,schemaId:i}){if(t.schema==null)return;if(r){let c=this.context.resolveMaybeReference({schemaOrReference:t.schema,breadcrumbs:[...this.breadcrumbs,"content",n]});if(c==null)return;t.schema=c}let s=new oT({context:this.context,breadcrumbs:[...this.breadcrumbs,"content",n,"schema"],schemaOrReference:t.schema,schemaIdOverride:i}).convert();if(s==null)return;let a=t.examples!=null?Object.fromEntries(Object.entries(t.examples).map(([c,u])=>{if(this.context.isReferenceObject(u)){let l=this.context.resolveReference({reference:u,breadcrumbs:[...this.breadcrumbs,"content",n,"examples"],skipErrorCollector:!0});return l.resolved?[c,l.value.value??l.value]:null}return[c,u.value??u]}).filter(c=>c!=null)):void 0;return{...s,examples:a}}parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:r}){let i=new oT({context:this.context,breadcrumbs:[...this.breadcrumbs],schemaOrReference:t,schemaIdOverride:r}).convert();if(i!=null)return{...i,examples:void 0}}getIdForExample({key:t,example:r,usedExampleNames:n}){if(this.context.isExampleWithSummary(r)){let i=r.summary;if(!n.has(i))return i;let o=`${i} (${t})`;return n.has(o)?t:o}return t}convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:r,exampleGenerationStrategy:n}){let i={userSpecifiedExamples:{},autogeneratedExamples:{}},o=t?.schema,s=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:t,breadcrumbs:this.breadcrumbs,defaultExampleName:`${[...this.group,this.method].join("_")}_example`}),a=new Set;for(let[c,u]of s){let l=this.context.resolveExampleWithValue(u),p=this.context.resolveExampleRecursively({example:u,breadcrumbs:this.breadcrumbs}),d=this.getIdForExample({key:c,example:p,usedExampleNames:a});a.add(d),l!=null&&(o!=null?i.userSpecifiedExamples[d]=this.generateOrValidateExample({schema:o,example:l,exampleGenerationStrategy:n,exampleName:d}):i.userSpecifiedExamples[d]=l)}if(o!=null&&Object.keys(i.userSpecifiedExamples).length===0){let c=this.getExamplesFromSchemaOrReference(o);c.length>1&&c.forEach((u,l)=>{let p=`Example ${l+1}`;i.userSpecifiedExamples[p]=this.generateOrValidateExample({schema:o,example:u,exampleGenerationStrategy:n,exampleName:p})})}if(Object.keys(i.userSpecifiedExamples).length===0&&o!=null){let c=ti(`${[...this.group,this.method].join("_")}_example`);i.autogeneratedExamples[c]=this.generateOrValidateExample({schema:o,example:void 0,ignoreErrors:!0,generateOptionalProperties:r,exampleGenerationStrategy:n,exampleName:c})}return i}getExamplesFromSchemaOrReference(t){let r=new Set,n=t;for(;this.context.isReferenceObject(n);){if(r.has(n.$ref))return[];r.add(n.$ref);let i=this.context.resolveReference({reference:n,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(!i.resolved)return[];n=i.value}return this.context.getExamplesFromSchema({schema:n,breadcrumbs:this.breadcrumbs})}generateOrValidateExample({schema:t,example:r,generateOptionalProperties:n,exampleGenerationStrategy:i}){let o=this.context.resolveMaybeReference({schemaOrReference:t,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(o==null)return;let s=this.context.getExamplesFromSchema({schema:o,breadcrumbs:this.breadcrumbs}),a=new nS({breadcrumbs:this.breadcrumbs,context:this.context,schema:o,example:r??s[0],generateOptionalProperties:n??!1,exampleGenerationStrategy:i}),{validExample:c}=a.convert();return c}}});var d5r,PTu=h(()=>{"use strict";Uo();nxe();d5r=class extends Ji{parameter;constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r}),this.parameter=n}convertToOutput({schema:t,typeReference:r,inlinedTypes:n}){let i=this.context.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs}),o=this.context.resolveMaybeReference({schemaOrReference:t,breadcrumbs:this.breadcrumbs}),s=this.getParameterSchemaWithExampleOverride({schema:o}),a=o?.default,c=this.getParameterDescription({schema:t});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:this.context.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:c,valueType:r??Ji.OPTIONAL_STRING,allowMultiple:this.parameter.explode??!1,clientDefault:void 0,defaultValue:a,v2Examples:this.convertParameterExamples({schema:s??t,originalSchema:t}),availability:i,explode:this.getExplodeForQueryParameter()},inlinedTypes:n};case"header":return{type:"header",parameter:{name:this.context.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:c,valueType:r??Ji.OPTIONAL_STRING,env:void 0,clientDefault:void 0,defaultValue:a,v2Examples:this.convertParameterExamples({schema:s??t,originalSchema:t}),availability:i},inlinedTypes:n};case"path":return{type:"path",parameter:{name:this.context.casingsGenerator.generateName(this.parameter.name),docs:c,valueType:r??Ji.STRING,location:"ENDPOINT",variable:void 0,clientDefault:void 0,v2Examples:this.convertParameterExamples({schema:s??t,originalSchema:t}),explode:this.getExplodeForPathParameter()},inlinedTypes:n};default:return}}getParameterDescription({schema:t}){if(this.parameter.description!=null)return this.parameter.description;if("description"in t&&typeof t.description=="string")return t.description}getParameterSchemaWithExampleOverride({schema:t}){if(t!=null)return t.type==="string"&&t.example==null?{...t,example:this.parameter.name}:t}convertParameterExamples({schema:t,originalSchema:r}){let n={userSpecifiedExamples:{},autogeneratedExamples:{}},i=this.parameter.example,o=this.parameter.examples;for(let[s,a]of Object.entries(o??{})){let c=this.context.resolveExampleWithValue(a);c!=null&&(n.userSpecifiedExamples[s]=this.generateOrValidateExample({schema:t,example:c,exampleName:s}))}if(i!=null){let s=this.context.generateUniqueName({prefix:`${this.parameter.name}_example`,existingNames:Object.keys(n.userSpecifiedExamples)});n.userSpecifiedExamples[s]=this.generateOrValidateExample({schema:t,example:i,exampleName:s})}if(Object.keys(n.userSpecifiedExamples).length===0){let s=this.context.getExamplesFromSchema({schema:this.resolveSchemaChain(r),breadcrumbs:this.breadcrumbs});for(let a of s){let c=this.context.generateUniqueName({prefix:`${this.parameter.name}_example`,existingNames:Object.keys(n.userSpecifiedExamples)});n.userSpecifiedExamples[c]=this.generateOrValidateExample({schema:t,example:this.context.resolveExample(a),exampleName:c})}}if(Object.keys(n.userSpecifiedExamples).length===0){let s=`${this.parameter.name}_example`;n.autogeneratedExamples[s]=this.generateOrValidateExample({schema:t,example:void 0,ignoreErrors:!0,exampleName:s})}return n}resolveSchemaChain(t){let r=new Set,n=t;for(;this.context.isReferenceObject(n);){if(r.has(n.$ref))return;r.add(n.$ref);let i=this.context.resolveReference({reference:n,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(!i.resolved)return;n=i.value}return n}generateOrValidateExample({schema:t,example:r}){let n=new nS({breadcrumbs:this.breadcrumbs,context:this.context,schema:t,example:r}),{validExample:i}=n.convert();return i}getExplodeForQueryParameter(){let t=this.parameter.style??"form",r=this.parameter.explode;if(r!==void 0)return t==="form"||t==="deepObject"?r===!0?void 0:r:r===!1?void 0:r}getExplodeForPathParameter(){let t=this.parameter.explode;if(t!==void 0)return t===!1?void 0:t}}});var INo={};Z(INo,{AbstractMediaTypeObjectConverter:()=>f5r,AbstractParameterConverter:()=>d5r});var BTu=h(()=>{"use strict";OTu();PTu()});function Tit({context:e,breadcrumbs:t,headers:r}){let n=[],i={},o=t??[];if(r==null)return{headers:n,inlinedTypes:i};for(let[s,a]of Object.entries(r)){let c=e.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...o,"headers",s]});if(c==null)continue;let u=Onm({context:e,header:c}),l=u?.schema,p=c.required===!0,d=y=>p?y:Jr.container(gs.optional(y)),f=d(Ji.STRING),m,g=e.getAvailability({node:c,breadcrumbs:[...o,"headers",s]});if(l!=null)if(m=e.resolveMaybeReference({schemaOrReference:l,breadcrumbs:[...o,"headers",s,"schema"]}),m?.type==="number"||m?.type==="integer")f=d(Jr.primitive({v1:m.type==="integer"?"INTEGER":"DOUBLE",v2:m.type==="integer"?hi.integer({default:void 0,validation:void 0}):hi.double({default:void 0,validation:void 0})}));else if(m?.type==="boolean")f=d(Jr.primitive({v1:"BOOLEAN",v2:hi.boolean({default:void 0})}));else{let y=new oT({context:e,breadcrumbs:[...o,"headers",s,"schema"],schemaOrReference:l,wrapAsOptional:!p,schemaIdOverride:e.convertBreadcrumbsToName([...o,"headers",s])}).convert();if(y!=null){f=y.type;for(let[E,x]of Object.entries(y.inlinedTypes))i[E]=x}}let A=Pnm({context:e,breadcrumbs:o,header:c,headerName:s,schema:l,mediaTypeObject:u?.mediaTypeObject});n.push({name:e.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),docs:c.description,valueType:f,env:void 0,v2Examples:A,availability:g,clientDefault:void 0,defaultValue:m?.default})}return{headers:n,inlinedTypes:i}}function Onm({context:e,header:t}){if(t.schema!=null)return{schema:t.schema};if(!(!e.settings.respectParameterContent||t.content==null)){for(let[r,n]of Object.entries(t.content))if(n.schema!=null&&Qp.parse(r)?.isJSON())return{schema:n.schema,mediaTypeObject:n}}}function Pnm({context:e,breadcrumbs:t,header:r,headerName:n,schema:i,mediaTypeObject:o}){let s={userSpecifiedExamples:{},autogeneratedExamples:{}},a=r.example,c=r.examples;for(let[u,l]of Object.entries(c??{})){let p=e.resolveExampleWithValue(l);p!=null&&(s.userSpecifiedExamples[u]=bUt({context:e,breadcrumbs:t,schema:i,example:p}))}if(a!=null){let u=e.generateUniqueName({prefix:`${n}_example`,existingNames:Object.keys(s.userSpecifiedExamples)});s.userSpecifiedExamples[u]=bUt({context:e,breadcrumbs:t,schema:i,example:a})}if(Object.keys(s.userSpecifiedExamples).length===0&&o!=null)for(let[u,l]of e.getNamedExamplesFromMediaTypeObject({mediaTypeObject:o,breadcrumbs:[...t,"headers",n,"content"],defaultExampleName:`${n}_example`})){let p=e.resolveExampleWithValue(l);if(p!=null){let d=e.generateUniqueName({prefix:u,existingNames:Object.keys(s.userSpecifiedExamples)});s.userSpecifiedExamples[d]=bUt({context:e,breadcrumbs:t,schema:i,example:p})}}if(Object.keys(s.userSpecifiedExamples).length===0&&i!=null){let u=e.getExamplesFromSchema({schema:Bnm({context:e,schema:i,breadcrumbs:[...t,"headers",n,"schema"]}),breadcrumbs:[...t,"headers",n,"schema"]});for(let l of u){let p=e.generateUniqueName({prefix:`${n}_example`,existingNames:Object.keys(s.userSpecifiedExamples)});s.userSpecifiedExamples[p]=bUt({context:e,breadcrumbs:t,schema:i,example:e.resolveExample(l)})}}if(Object.keys(s.userSpecifiedExamples).length===0&&i!=null){let u=`${n}_example`;s.autogeneratedExamples[u]=bUt({context:e,breadcrumbs:t,schema:i,example:void 0,ignoreErrors:!0})}return s}function Bnm({context:e,schema:t,breadcrumbs:r}){let n=new Set,i=t;for(;e.isReferenceObject(i);){if(n.has(i.$ref))return;n.add(i.$ref);let o=e.resolveReference({reference:i,breadcrumbs:r,skipErrorCollector:!0});if(!o.resolved)return;i=o.value}return i}function bUt({context:e,breadcrumbs:t,schema:r,example:n,ignoreErrors:i}){if(r==null)return n;let o=new nS({breadcrumbs:t,context:e,schema:r,example:n}),{validExample:s,errors:a}=o.convert();return i||a.forEach(c=>{e.errorCollector.collect({message:c.message,path:c.path})}),s}var DTu=h(()=>{"use strict";wt();_n();$_r();nxe();g3e()});var m5r,RTu=h(()=>{"use strict";JD();m5r=class extends Yo{server;key="x-fern-server-name";constructor({breadcrumbs:t,server:r,context:n}){super({breadcrumbs:t,context:n}),this.server=r}convert(){let t=this.getExtensionValue(this.server,"x-name");if(!(t==null||typeof t!="string"))return t}}});var kTu,Dnm,C3,FTu=h(()=>{"use strict";wt();_n();cNo();RTu();Uo();kTu="Base",Dnm="x-fern-default-url",C3=class e extends Ji{servers;endpointLevelServers;baseUrlEnvVar;constructor({breadcrumbs:t,context:r,servers:n,endpointLevelServers:i,baseUrlEnvVar:o}){super({breadcrumbs:t,context:r}),this.servers=n,this.endpointLevelServers=i,this.baseUrlEnvVar=o}convert(){if(this.servers==null||this.servers.length===0||this.servers[0]==null)return;if(this.endpointLevelServers!=null&&this.endpointLevelServers.length>0){let n=this.getDefaultBaseUrlName(),i={id:n,name:this.context.casingsGenerator.generateName(n)},o=this.endpointLevelServers.map(c=>{let u=e.getServerName({server:c,context:this.context});return{id:u,name:this.context.casingsGenerator.generateName(u)}}).filter((c,u,l)=>l.findIndex(p=>p.id===c.id)===u),s=[i,...o],a=this.servers.map(c=>{let u=e.getServerName({server:c,context:this.context}),l=this.endpointLevelServers?.map(g=>[e.getServerName({server:g,context:this.context}),this.getServerUrl(g)]),p=e.getServerAudiences({server:c,context:this.context}),{defaultUrls:d,urlTemplates:f,urlVariables:m}=this.buildMultiUrlTemplateFields({defaultBaseUrlId:n,topLevelServer:c,endpointServers:this.endpointLevelServers??[]});return{id:u,name:this.context.casingsGenerator.generateName(u),urls:{[n]:this.getServerUrl(c),...Object.fromEntries(l??[])},docs:c.description,audiences:p,defaultUrls:d,urlTemplates:f,urlVariables:m}});return{value:{defaultEnvironment:a[0]?.id,baseUrlEnvVar:this.baseUrlEnvVar,environments:x0.multipleBaseUrls({baseUrls:s,environments:a})},defaultUrl:i.id}}let t=this.extractFernDefaultUrl(),r=this.servers.map(n=>{let i=e.getServerName({server:n,context:this.context}),o=e.getServerAudiences({server:n,context:this.context});return n.variables!=null&&Object.keys(n.variables).length>0&&n.variables!=null?{id:i,name:this.context.casingsGenerator.generateName(i),url:this.maybeRemoveTrailingSlashIfNotEmpty(this.getServerUrl(n)),audiences:o,defaultUrl:t,urlTemplate:this.maybeRemoveTrailingSlashIfNotEmpty(n.url),urlVariables:this.convertServerVariables(n.variables),docs:n.description}:{id:i,name:this.context.casingsGenerator.generateName(i),url:this.maybeRemoveTrailingSlashIfNotEmpty(this.getServerUrl(n)),audiences:o,defaultUrl:void 0,urlTemplate:void 0,urlVariables:void 0,docs:n.description}}).filter(sa);return{value:{defaultEnvironment:r[0]?.id,baseUrlEnvVar:this.baseUrlEnvVar,environments:x0.singleBaseUrl({environments:r})},defaultUrl:r[0]?.id}}convertServerVariables(t){return Object.entries(t).map(([r,n])=>({id:r,name:this.context.casingsGenerator.generateName(r),default:n.default,values:n.enum}))}static getServerExtensionName({server:t,context:r}){return new m5r({breadcrumbs:[],server:t,context:r}).convert()}static getServerAudiences({server:t,context:r}){return new yit({breadcrumbs:[],operation:t,context:r}).convert()?.audiences}static getServerName({server:t,context:r}){return t.name!=null?t.name:e.getServerExtensionName({server:t,context:r})??t.description??t.url}getServerUrl(t){if(t.variables==null)return t.url;let r=t.url;for(let[n,i]of Object.entries(t.variables))i.default!=null&&(r=r.replace(`{${n}}`,encodeURIComponent(i.default)));return r}getDefaultBaseUrlName(){return this.servers==null||this.servers.length===0||this.servers[0]==null?kTu:e.getServerExtensionName({server:this.servers[0],context:this.context})??kTu}maybeRemoveTrailingSlashIfNotEmpty(t){return t.endsWith("/")&&t!=="/"?t.slice(0,-1):t}buildMultiUrlTemplateFields({defaultBaseUrlId:t,topLevelServer:r,endpointServers:n}){let i={},o={},s={},a=!1;if(r.variables!=null&&Object.keys(r.variables).length>0){a=!0;let c=this.extractFernDefaultUrlFromServer(r);c!=null&&(i[t]=c),o[t]=this.maybeRemoveTrailingSlashIfNotEmpty(r.url),s[t]=this.convertServerVariables(r.variables)}for(let c of n){let u=e.getServerName({server:c,context:this.context});if(c.variables!=null&&Object.keys(c.variables).length>0){a=!0;let l=this.extractFernDefaultUrlFromServer(c);l!=null&&(i[u]=l),o[u]=this.maybeRemoveTrailingSlashIfNotEmpty(c.url),s[u]=this.convertServerVariables(c.variables)}}return a?{defaultUrls:Object.keys(i).length>0?i:void 0,urlTemplates:o,urlVariables:s}:{defaultUrls:void 0,urlTemplates:void 0,urlVariables:void 0}}extractFernDefaultUrlFromServer(t){let r=t[Dnm];if(typeof r=="string")return this.maybeRemoveTrailingSlashIfNotEmpty(r)}extractFernDefaultUrl(){if(this.servers!=null)for(let t of this.servers){let r=this.extractFernDefaultUrlFromServer(t);if(r!=null)return r}}}});var wm={};Z(wm,{AbstractConverters:()=>INo,ExampleConverter:()=>nS,SchemaConverters:()=>bNo,ServersConverter:()=>C3,convertResponseHeaders:()=>Tit});var vNo=h(()=>{"use strict";BTu();nxe();DTu();ENo();FTu()});var b3e,NTu=h(()=>{"use strict";nxe();AUt();b3e=class{context;constructor({context:t}){this.context=t}validateExample({example:t,schema:r,breadcrumbs:n,exampleGenerationStrategy:i}){return new nS({breadcrumbs:n,context:this.context,schema:r,example:t,depth:0,exampleGenerationStrategy:i,generateOptionalProperties:!1}).convert()}validateEndpointExample({exampleToValidate:t}){let r=[],n=[],i=!0,o=!1,s,a=[t.endpointPath,t.method];if(t.requestExample!==void 0&&t.requestSchema!==void 0){let u=this.validateExample({example:t.requestExample,schema:t.requestSchema,breadcrumbs:[...a,"request"],exampleGenerationStrategy:"request"});if(!u.isValid){i=!1;let l=t.exampleSource==="human"?G0.WARNING:G0.ERROR;r.push(...u.errors.map(p=>({...p,level:l,message:`Invalid request example: ${p.message}`})))}u.coerced&&(o=!0,n.push({level:G0.WARNING,message:"Request example was coerced to match schema",path:[...a,"request"]})),s={request:u.validExample}}let c=this.getResponseSchemaForValidation(t);if(t.responseExample!==void 0&&c!==void 0){let u=this.validateExample({example:t.responseExample,schema:c,breadcrumbs:[...a,"response"],exampleGenerationStrategy:"response"});if(!u.isValid){i=!1;let l=t.exampleSource==="human"?G0.WARNING:G0.ERROR;r.push(...u.errors.map(p=>({...p,level:l,message:`Invalid response example: ${p.message}`})))}u.coerced&&(o=!0,n.push({level:G0.WARNING,message:"Response example was coerced to match schema",path:[...a,"response"]})),s={...typeof s=="object"&&s!==null?s:{},response:u.validExample}}return{isValid:i,errors:r,warnings:n,endpointPath:t.endpointPath,method:t.method,exampleSource:t.exampleSource,exampleName:t.exampleName,validExample:s,coerced:o}}getResponseSchemaForValidation(t){let{responseStatusCode:r,responseSchemas:n,responseSchema:i}=t;return n&&Object.keys(n).length>0?r&&n[r]?n[r]:n[200]??n[201]:i}validateAiExamples({aiExamples:t,spec:r}){let n=[],i=[];for(let o of t){let{requestSchema:s,responseSchema:a,responseSchemas:c}=this.getSchemasForEndpoint({spec:r,endpointPath:o.endpointPath,method:o.method}),u={endpointPath:o.endpointPath,method:o.method,exampleSource:"ai",requestExample:o.request?.body,responseExample:o.response?.body,requestSchema:s,responseSchema:a,responseSchemas:c},l=this.validateEndpointExample({exampleToValidate:u}),p=this.hasUnexpectedProperties({requestExample:o.request?.body,responseExample:o.response?.body,requestSchema:s,responseSchema:a}),d=l.errors.length>0||l.warnings.length>0;!l.isValid||d||p?i.push({example:o,validationResult:l}):n.push(o)}return{validExamples:n,invalidExamples:i}}hasUnexpectedProperties({requestExample:t,responseExample:r,requestSchema:n,responseSchema:i}){return!!(t&&n&&this.exampleHasUnexpectedProperties(t,n)||r&&i&&this.exampleHasUnexpectedProperties(r,i))}exampleHasUnexpectedProperties(t,r){if(!t||typeof t!="object"||t===null)return!1;let n=this.context.resolveMaybeReference({schemaOrReference:r,breadcrumbs:[],skipErrorCollector:!0});if(!n||!n.properties&&!n.allOf&&!n.oneOf&&!n.anyOf||this.schemaHasPatternProperties(n))return!1;let i=t,o=this.collectAllPropertyKeys(n);return Object.keys(i).some(a=>!o.has(a))}collectAllPropertyKeys(t,r=new Set){let n=new Set;if(t.properties)for(let i of Object.keys(t.properties))n.add(i);for(let i of t.allOf??[]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:[],skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)){r.add(s);let a=this.collectAllPropertyKeys(o,r);for(let c of a)n.add(c)}}}for(let i of[...t.oneOf??[],...t.anyOf??[]]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:[],skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)){r.add(s);let a=this.collectAllPropertyKeys(o,r);for(let c of a)n.add(c)}}}return n}schemaHasPatternProperties(t,r=new Set){let n=t.patternProperties;if(n&&typeof n=="object"&&Object.keys(n).length>0)return!0;for(let i of[...t.allOf??[],...t.oneOf??[],...t.anyOf??[]]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:[],skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)&&(r.add(s),this.schemaHasPatternProperties(o,r)))return!0}}return!1}validateHumanExamples({spec:t}){let r=[],n=0,i=0,o=0,s=[],a=[];if(!t.paths)return{endpoints:r,totalExamples:n,validExamples:i,invalidExamples:o,hasInvalidHumanExamples:!1,hasInvalidAiExamples:!1,invalidHumanExamples:s,invalidAiExamples:a};for(let[c,u]of Object.entries(t.paths)){if(!u)continue;let l=["get","post","put","delete","patch","options","head","trace"];for(let p of l){let d=u[p];if(!d)continue;let f=[],{requestSchema:m,responseSchema:g,responseSchemas:A}=this.getSchemasForOperation({operation:d}),y=this.extractExamplesFromOperation({operation:d,path:c,method:p});for(let E of y){n++;let x={endpointPath:c,method:p,exampleName:E.name,exampleSource:E.source,requestExample:E.request,responseExample:E.response,requestSchema:m,responseSchema:g,responseStatusCode:E.statusCode,responseSchemas:A},v=this.validateEndpointExample({exampleToValidate:x});f.push(v),v.isValid?i++:(o++,E.source==="human"?s.push(v):E.source==="ai"&&a.push(v))}f.length>0&&r.push({endpointPath:c,method:p,results:f,hasInvalidExamples:f.some(E=>!E.isValid),invalidExampleCount:f.filter(E=>!E.isValid).length})}}return{endpoints:r,totalExamples:n,validExamples:i,invalidExamples:o,hasInvalidHumanExamples:s.length>0,hasInvalidAiExamples:a.length>0,invalidHumanExamples:s,invalidAiExamples:a}}getSchemasForEndpoint({spec:t,endpointPath:r,method:n}){let i=t.paths?.[r];if(!i)return{responseSchemas:{}};let o=i[n.toLowerCase()];return!o||typeof o!="object"||!("responses"in o)?{responseSchemas:{}}:this.getSchemasForOperation({operation:o})}getSchemasForOperation({operation:t}){let r,n,i={};if(t.requestBody&&!this.context.isReferenceObject(t.requestBody)){let s=t.requestBody.content?.["application/json"];s?.schema&&(r=s.schema)}if(t.responses){for(let[o,s]of Object.entries(t.responses)){if(!s||this.context.isReferenceObject(s))continue;let c=s.content?.["application/json"];c?.schema&&(i[o]=c.schema)}n=i[200]??i[201]}return{requestSchema:r,responseSchema:n,responseSchemas:i}}extractExamplesFromOperation({operation:t,path:r,method:n}){let i=[];if(t.requestBody&&!this.context.isReferenceObject(t.requestBody)){let a=t.requestBody.content?.["application/json"];if(a?.example!==void 0&&i.push({name:`${n}_${r}_request_example`,source:"openapi",request:a.example}),a?.examples)for(let[c,u]of Object.entries(a.examples)){let l=this.context.isReferenceObject(u)?this.context.resolveExample(u):u;l&&typeof l=="object"&&"value"in l&&i.push({name:c,source:"human",request:l.value})}}if(t.responses)for(let[s,a]of Object.entries(t.responses)){if(!a||this.context.isReferenceObject(a))continue;let u=a.content?.["application/json"];if(u?.example!==void 0){let l=i.find(p=>p.request!==void 0&&p.response===void 0);l?(l.response=u.example,l.statusCode=s):i.push({name:`${n}_${r}_response_${s}_example`,source:"openapi",response:u.example,statusCode:s})}if(u?.examples)for(let[l,p]of Object.entries(u.examples)){let d=this.context.isReferenceObject(p)?this.context.resolveExample(p):p;if(d&&typeof d=="object"&&"value"in d){let f=i.find(m=>m.name===l);f?(f.response=d.value,f.statusCode=s):i.push({name:l,source:"human",response:d.value,statusCode:s})}}}let o=t["x-fern-examples"];if(Array.isArray(o)){for(let s of o)if(typeof s=="object"&&s!==null){let a=s;i.push({name:a.name,source:"human",request:a.request?.body,response:a.response?.body})}}return i}}});function jTu({tags:e,errorCollector:t}){for(let r of e)if(Oit.test(r.name)){let n=[...r.name].filter(i=>Oit.test(i));t.collect({level:G0.ERROR,message:`Tag name "${r.name}" contains non-ASCII characters: ${n.join(", ")}. Non-ASCII characters in tag names will be included in URL paths and HTTP headers, which only support ASCII characters. This will cause runtime errors (ERR_INVALID_CHAR).`,path:["tags",r.name],resolution:`Remove non-ASCII characters from the tag name. For example, rename "${r.name}" to "${r.name.replace(Oit,"").trim()}".`})}}function QTu({description:e,path:t,errorCollector:r}){Rnm.test(e)&&r.collect({level:G0.ERROR,message:'Description contains "---" frontmatter delimiters which will cause YAML parsing failures in the generated docs site. The docs renderer interprets content between "---" delimiters as YAML frontmatter, which will fail if the content is not valid YAML.',path:t,resolution:'Remove the "---" delimiters from the description.'})}function xNo({spec:e,errorCollector:t}){if(Array.isArray(e.tags)){let n=e.tags.filter(i=>typeof i=="object"&&i!=null&&"name"in i&&typeof i.name=="string");jTu({tags:n,errorCollector:t})}let r=["get","post","put","delete","patch","options","head","trace"];if(e.paths!=null&&typeof e.paths=="object"){let n=new Set;for(let[i,o]of Object.entries(e.paths)){if(o==null||typeof o!="object")continue;let s=o;for(let a of r){let c=s[a];if(c==null||typeof c!="object")continue;let u=c;if(typeof u.description=="string"&&QTu({description:u.description,path:["paths",i,a,"description"],errorCollector:t}),Array.isArray(u.tags)&&!Array.isArray(e.tags)){for(let l of u.tags)if(typeof l=="string"&&!n.has(l)&&Oit.test(l)){n.add(l);let p=[...l].filter(d=>Oit.test(d));t.collect({level:G0.ERROR,message:`Tag name "${l}" contains non-ASCII characters: ${p.join(", ")}. Non-ASCII characters in tag names will be included in URL paths and HTTP headers, which only support ASCII characters. This will cause runtime errors (ERR_INVALID_CHAR).`,path:["paths",i,a,"tags"],resolution:`Remove non-ASCII characters from the tag name. For example, rename "${l}" to "${l.replace(Oit,"").trim()}".`})}}}}}}var Oit,Rnm,zTu=h(()=>{"use strict";AUt();Oit=new RegExp("[^\\x00-\\x7F]"),Rnm=/(?:^|\n)\s*---\s*(?:\n|$)/});var h5r,knm,MTu=h(()=>{"use strict";h5r={400:"BadRequestError",401:"UnauthorizedError",402:"PaymentRequiredError",403:"ForbiddenError",404:"NotFoundError",405:"MethodNotAllowedError",406:"NotAcceptableError",407:"ProxyAuthenticationRequiredError",408:"RequestTimeoutError",409:"ConflictError",410:"GoneError",411:"LengthRequiredError",412:"PreconditionFailedError",413:"ContentTooLargeError",414:"URITooLongError",415:"UnsupportedMediaTypeError",416:"RangeNotSatisfiableError",417:"ExpectationFailedError",418:"ImATeapotError",419:"AuthenticationTimeoutError",420:"MethodFailureError",421:"MisdirectedRequestError",422:"UnprocessableEntityError",423:"LockedError",424:"FailedDependencyError",425:"TooEarlyError",426:"UpgradeRequiredError",428:"PreconditionError",429:"TooManyRequestsError",430:"RequestHeaderFieldsTooLargeError",431:"RequestHeaderFieldsTooLargeError",444:"NoResponseError",449:"RetryWithError",450:"BlockedByWindowsParentalControlsError",451:"UnavailableForLegalReasonsError",498:"InvalidTokenError",499:"ClientClosedRequestError",500:"InternalServerError",501:"NotImplementedError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError",505:"HTTPVersionNotSupportedError",506:"VariantAlsoNegotiatesError",507:"InsufficientStorageError",508:"LoopDetectedError",509:"BandwidthLimitExceededError",510:"NotExtendedError",511:"NetworkAuthenticationRequiredError"},knm=new Set(Object.values(h5r))});function CNo(e){if(e!=null)return e.map(t=>Object.fromEntries(Object.entries(t).map(([r,n])=>[r,n??[]])))}var LTu=h(()=>{"use strict"});var Uo=h(()=>{"use strict";$_r();rTu();JD();gTu();vNo();vNo();AUt();NTu();dNo();zTu();MTu();LTu()});var Fnm,Nnm,VTu,UTu=h(()=>{"use strict";jn();Fnm=Be.object({type:Be.string(),channelId:Be.string().optional(),messageId:Be.string(),value:Be.any()}),Nnm=Be.object({summary:Be.string().optional(),description:Be.string().optional(),"query-parameters":Be.record(Be.string()).optional(),headers:Be.record(Be.string()).optional(),messages:Be.array(Fnm)}),VTu=Be.array(Nnm)});var g5r,_Tu=h(()=>{"use strict";Uo();UTu();g5r=class extends Yo{channel;baseDir;key="x-fern-examples";constructor({breadcrumbs:t,channel:r,context:n,baseDir:i}){super({breadcrumbs:t??[],context:n}),this.channel=r,this.baseDir=i}convert(){let t=this.getExtensionValue(this.channel);if(t==null)return;let r=VTu.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-examples extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data.map(n=>({summary:n.summary,description:n.description,queryParameters:n["query-parameters"],headers:n.headers,messages:n.messages.map(i=>({type:i.type,channelId:i.channelId,messageId:i.messageId,value:i.value}))}))}}});var Pit,wNo=h(()=>{"use strict";Uo();_Tu();Pit=class extends Ji{channel;channelPath;inlinedTypes={};websocketGroup;constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o}){super({context:t,breadcrumbs:r}),this.websocketGroup=n,this.channel=i,this.channelPath=o}convertExamples({fullPath:t,baseUrl:r,asyncApiVersion:n}){let o=new g5r({context:this.context,breadcrumbs:this.breadcrumbs,channel:this.channel,baseDir:this.context.documentBaseDir}).convert();return o==null?{}:Object.fromEntries(o.map((s,a)=>[a.toString(),{channel:{method:"GET",path:t},baseUrl:t,environment:r,auth:void 0,pathParameters:{},queryParameters:s.queryParameters,headers:s.headers,messages:s.messages.map(c=>({type:n==="v2"?c.type:c.messageId,body:c.value}))}]))}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}}});var jnm,NH,EUt=h(()=>{"use strict";_n();Uo();jnm="x-fern-server-name",NH=class e extends Ji{servers;constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r}),this.servers=n}convert(){if(this.servers==null||Object.keys(this.servers).length===0)return;let t=[],r;for(let[n,i]of Object.entries(this.servers)){let o=e.getServerName(n,i),s=this.buildSingleBaseUrlEnvironment(this.context,o,i);t.push(s),r==null&&(r=s.id)}return{defaultEnvironment:r,baseUrlEnvVar:void 0,environments:x0.singleBaseUrl({environments:t})}}static getServerName(t,r){if(r!=null&&typeof r=="object"){let n=r[jnm];if(typeof n=="string"&&n.length>0)return n}return t}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}}});var axe,SNo=h(()=>{"use strict";Uo();axe=class extends wm.AbstractConverters.AbstractParameterConverter{parameterNamePrefix;constructor({context:t,breadcrumbs:r,parameter:n,parameterNamePrefix:i}){super({context:t,breadcrumbs:r,parameter:n}),this.parameterNamePrefix=i}convert(){let t,r={},i=new ux.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter,context:this.context}).convert()??this.parameter.required===!1,o=this.parameter.schema??{...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.example??this.parameter.name,examples:Object.values(this.parameter.examples??{}),deprecated:this.parameter.deprecated,required:void 0},a=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameterNamePrefix?`${this.parameterNamePrefix}_${this.parameter.name}`:this.parameter.name,schemaOrReference:o,wrapAsOptional:i}).convert();return a!=null&&(t=a.type,r=a.inlinedTypes??{}),this.convertToOutput({schema:o,typeReference:t,inlinedTypes:r})}}});var A5r,GTu=h(()=>{"use strict";Uo();A5r=class extends Yo{channel;key="x-fern-address";constructor({breadcrumbs:t,channel:r,context:n}){super({breadcrumbs:t,context:n}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}}});var cxe,TNo=h(()=>{"use strict";Uo();cxe=class extends Yo{node;key="x-fern-display-name";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(!(t==null||typeof t!="string"))return t}}});var uxe,ONo=h(()=>{"use strict";Uo();uxe=class extends Yo{node;key="x-fern-explorer";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-explorer",path:this.breadcrumbs});return}return t}}}});var y5r,qTu=h(()=>{"use strict";Uo();y5r=class extends Yo{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(!(t==null||typeof t!="string"))return t}}});var b5r,WTu=h(()=>{"use strict";_n();tc();Uo();Vi();wNo();EUt();SNo();GTu();TNo();ONo();qTu();b5r=class extends Pit{inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o}){super({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o})}convert(){let t=[],r=[],n=[],o=new cxe({breadcrumbs:this.breadcrumbs,node:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".");this.channel.parameters&&this.convertPathParameters({context:this.context,pathParameters:t}),this.channel.bindings?.ws!=null&&(this.convertHeaders({context:this.context,headers:n}),this.convertBindingQueryParameters({context:this.context,queryParameters:r}));let s;this.channel.subscribe!=null&&(s=this.convertMessage({context:this.context,operation:this.channel.subscribe,origin:"server"}));let a;this.channel.publish!=null&&(a=this.convertMessage({context:this.context,operation:this.channel.publish,origin:"client"}));let c=[];s!=null&&c.push(s),a!=null&&c.push(a);let l=new A5r({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert(),p=this.transformToValidPath(l??this.channelPath),d=this.resolveServerName(this.channel.servers?.[0])??this.resolveServerName(Object.keys(this.context.spec.servers??{})[0]),f=M0(p),m=ti(this.channelPath),g=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[],A=this.hasServerSecurity()||this.context.authOverrides?.auth!=null,y=new uxe({context:this.context,breadcrumbs:this.breadcrumbs,node:this.context.spec}).convert(),x=new uxe({context:this.context,breadcrumbs:this.breadcrumbs,node:this.channel}).convert()??y;return{channel:{name:this.context.casingsGenerator.generateName(m),displayName:o,connectMethodName:void 0,baseUrl:d,path:f,auth:A,headers:n,queryParameters:r,pathParameters:t,messages:c,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:p,baseUrl:d,asyncApiVersion:"v2"})},apiPlayground:x},audiences:g,inlinedTypes:this.inlinedTypes}}hasServerSecurity(){let t=this.context.spec.servers??{};if(this.channel.servers&&this.channel.servers.length>0){for(let r of this.channel.servers){let n=t[r];if(n?.security&&n.security.length>0)return!0}return!1}for(let r of Object.values(t)){let n=r;if(n.security&&n.security.length>0)return!0}return!1}convertMessage({context:t,operation:r,origin:n}){let i,o=n==="server"?"subscribe":"publish",s=[...this.breadcrumbs,o],a=t.resolveMaybeReference({schemaOrReference:r.message,breadcrumbs:s});a!=null&&(r.message=a);let c=JNe(ti(`${this.channelPath}_${o}`)).replace(/ /g,"");if("oneOf"in r.message){let l=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:s,schemaOrReference:r.message,schemaIdOverride:c}).convert();l!=null&&l.schema!=null&&(i=l.schema,this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes})}else if(t.isMessageWithPayload(r.message)){let u=t.resolveMaybeReference({schemaOrReference:r.message.payload,breadcrumbs:s});if(u!=null){let p=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:s,schemaOrReference:u,schemaIdOverride:c}).convert();p!=null&&p.schema!=null&&(i=p.schema,this.inlinedTypes={...this.inlinedTypes,...p.inlinedTypes})}}if(i!=null){let u=i,l=Jr.named({fernFilepath:t.createFernFilepath(),name:u.typeDeclaration.name.name,typeId:u.typeDeclaration.name.typeId,displayName:void 0,default:void 0,inline:!1}),p=cP.reference({bodyType:l,docs:r.description}),d=n==="server"?"subscribe":"publish",m=new cxe({breadcrumbs:[...this.breadcrumbs,d],node:r,context:this.context}).convert()??d;return{type:d,displayName:m,origin:n,body:p,availability:t.getAvailability({node:r,breadcrumbs:this.breadcrumbs}),docs:r.description,methodName:this.getOperationMethodName(r)}}}convertPathParameters({context:t,pathParameters:r}){for(let[n,i]of Object.entries(this.channel.parameters??{})){let o=t.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs});if(o==null)continue;let a=new axe({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...o,name:n,in:"path",description:o.description,required:o.required??!0},parameterNamePrefix:this.channelPath}).convert();a!=null&&(this.inlinedTypes={...this.inlinedTypes,...a.inlinedTypes},a.type==="path"&&r.push(a.parameter))}}convertHeaders({context:t,headers:r}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[i,o]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let s=t.resolveMaybeReference({schemaOrReference:o,breadcrumbs:[...this.breadcrumbs,i]});if(s==null)continue;let c=new axe({context:this.context,breadcrumbs:[...this.breadcrumbs,i],parameter:{name:i,in:"header",required:n.includes(i),schema:s,description:"description"in s?s.description:void 0},parameterNamePrefix:this.channelPath}).convert();c!=null&&c.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},r.push(c.parameter))}}}resolveServerName(t){if(t==null)return;let r=this.context.spec.servers;if(r!=null&&t in r){let n=r[t];return NH.getServerName(t,n)}return t}getOperationMethodName(t){return new y5r({breadcrumbs:this.breadcrumbs,operation:t,context:this.context}).convert()}convertBindingQueryParameters({context:t,queryParameters:r}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[i,o]of Object.entries(this.channel.bindings.ws.query.properties??{})){let s=t.resolveMaybeReference({schemaOrReference:o,breadcrumbs:[...this.breadcrumbs,i]});if(s==null)continue;let c=new axe({context:this.context,breadcrumbs:[...this.breadcrumbs,i],parameter:{name:i,in:"query",required:n.includes(i),schema:s,description:"description"in s?s.description:void 0,deprecated:s.deprecated??!1},parameterNamePrefix:this.channelPath}).convert();c!=null&&c.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},r.push(c.parameter))}}}}});var E5r,HTu=h(()=>{"use strict";EUt();E5r=class extends NH{constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r,servers:n})}buildSingleBaseUrlEnvironment(t,r,n){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(n.protocol,n.url),docs:void 0,audiences:void 0,defaultUrl:void 0,urlTemplate:void 0,urlVariables:void 0}}}});var PNo,KTu,BNo,I5r,JTu=h(()=>{"use strict";_n();tc();Ft();wNo();EUt();SNo();TNo();ONo();PNo="$message.",KTu="#/channels/",BNo="#/servers/",I5r=class extends Pit{operations;inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o,operations:s}){super({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o}),this.operations=s}convert(){let t=[],r=[],n=[],o=new cxe({breadcrumbs:this.breadcrumbs,node:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".")??this.channelPath;this.channel.parameters&&this.convertChannelParameters({pathParameters:t,queryParameters:r,headers:n,channelPath:this.channelPath});let s=Object.entries(this.operations).reduce((A,[y,E])=>{try{this.getChannelPathFromOperation(E)===this.channelPath&&(A[y]=E)}catch{}return A},{}),a=[];for(let[A,y]of Object.entries(s)){let x=new cxe({breadcrumbs:[...this.breadcrumbs,A],node:y,context:this.context}).convert()??A;for(let v of y.messages){let C=this.context.convertReferenceToTypeReference({reference:v});if(C.ok){let O=cP.reference({bodyType:C.reference,docs:y.description});a.push({type:A,displayName:x,origin:y.action==="send"?"client":"server",body:O,availability:this.context.getAvailability({node:y,breadcrumbs:this.breadcrumbs}),docs:y.description,methodName:void 0})}}}let c=this.resolveChannelServersFromReference(this.channel.servers??[])??this.resolveFirstServerName(),u=this.transformToValidPath(this.channel.address??this.channelPath),l=M0(u),p=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[],d=this.hasServerSecurity()||this.context.authOverrides?.auth!=null,f=new uxe({context:this.context,breadcrumbs:this.breadcrumbs,node:this.context.spec}).convert(),g=new uxe({context:this.context,breadcrumbs:this.breadcrumbs,node:this.channel}).convert()??f;return{channel:{name:this.context.casingsGenerator.generateName(o),displayName:o,connectMethodName:void 0,baseUrl:c,path:l,auth:d,headers:n,queryParameters:r,pathParameters:t,messages:a,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:u,baseUrl:c,asyncApiVersion:"v3"})},apiPlayground:g},audiences:p,inlinedTypes:this.inlinedTypes}}hasServerSecurity(){let r=this.context.spec.servers??{};if(this.channel.servers&&this.channel.servers.length>0){for(let n of this.channel.servers){let i=n.$ref.replace(BNo,""),o=r[i];if(o?.security&&o.security.length>0)return!0}return!1}for(let n of Object.values(r))if(n.security&&n.security.length>0)return!0;return!1}convertChannelParameters({pathParameters:t,queryParameters:r,headers:n,channelPath:i}){for(let o of Object.values(this.channel.parameters??{})){let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:[...this.breadcrumbs,"parameters"]});if(s==null)continue;let a=this.convertChannelParameterLocation(s.location);if(a==null)continue;let{type:c,parameterKey:u}=a,p=new axe({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...s,name:u,in:c},parameterNamePrefix:this.channelPath}).convert();if(p!=null)switch(this.inlinedTypes={...this.inlinedTypes,...p.inlinedTypes},p.type){case"path":t.push(p.parameter);break;case"query":r.push(p.parameter);break;case"header":n.push(p.parameter);break}}}convertChannelParameterLocation(t){try{let[r,n]=t.split("#/");if(r==null||n==null){this.context.errorCollector.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!r.startsWith(PNo)){this.context.errorCollector.collect({message:`Invalid location format: ${t}; expected ${PNo} prefix`,path:this.breadcrumbs});return}let i=r.substring(PNo.length);if(i!=="header"&&i!=="path"&&i!=="payload"){this.context.errorCollector.collect({message:`Invalid message type: ${i}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return i==="payload"?{type:"query",parameterKey:n}:{type:i,parameterKey:n}}catch{this.context.errorCollector.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveChannelServersFromReference(t){if(t==null||t.length===0||t[0]==null)return;let r=t[0];if(!r.$ref.startsWith(BNo)){this.context.errorCollector.collect({message:`Failed to resolve server name from server ref ${r.$ref}`,path:this.breadcrumbs});return}let n=r.$ref.substring(BNo.length);if(n==null){this.context.errorCollector.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}let i=this.context.spec.servers;if(i!=null&&n in i){let o=i[n];return NH.getServerName(n,o)}return n}resolveFirstServerName(){let t=this.context.spec.servers;if(t==null)return;let r=Object.keys(t)[0];if(r==null)return;let n=t[r];return NH.getServerName(r,n)}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(KTu))throw new S({message:`Failed to resolve channel path from operation ${t.channel.$ref}`,code:S.Code.ReferenceError});return t.channel.$ref.substring(KTu.length)}}});var v5r,YTu=h(()=>{"use strict";EUt();v5r=class extends NH{constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r,servers:n})}buildSingleBaseUrlEnvironment(t,r,n){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(n.protocol,n.host),docs:void 0,audiences:void 0,defaultUrl:void 0,urlTemplate:void 0,urlVariables:void 0}}}});var IUt,XTu=h(()=>{"use strict";_n();tc();Uo();WTu();HTu();JTu();YTu();IUt=class extends kH{constructor({context:t,breadcrumbs:r,audiences:n}){super({context:t,breadcrumbs:r,audiences:n})}async convert(){return this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.isAsyncAPIV3(this.context)?this.convertChannelMessages():this.convertComponentMessages(),this.convertSchemas(),this.convertServers(),this.convertSecuritySchemes(),this.convertChannels(),this.finalizeIr()}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}convertChannelMessages(){let t=this.context.spec;for(let[r,n]of Object.entries(t.channels??{}))for(let[i,o]of Object.entries(n.messages??{})){if(!this.context.isMessageWithPayload(o)&&!this.context.isReferenceObject(o))continue;let s=["channels",r,"messages",i],a=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:s});if(!this.context.isMessageWithPayload(a))continue;let c=this.context.resolveMaybeReference({schemaOrReference:a.payload,breadcrumbs:s});if(c==null)continue;let u=`${r}_${i}`;this.convertSchema({id:u,breadcrumbs:s,schema:c})}}convertComponentMessages(){for(let[t,r]of Object.entries(this.context.spec.components?.messages??{})){if(r.payload==null)continue;let n=["components","messages",t],i=this.context.resolveMaybeReference({schemaOrReference:r.payload,breadcrumbs:n});i!=null&&this.convertSchema({id:t,breadcrumbs:n,schema:i})}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{}))this.convertSchema({id:t,breadcrumbs:["components","schemas",t],schema:r})}convertSchema({id:t,breadcrumbs:r,schema:n}){let o=new wm.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:r,schema:n}).convert();o!=null&&this.addSchemaOutputToIr(t,o)}convertServers(){let t;if(this.isAsyncAPIV3(this.context)){let r=this.context.spec.servers;t=new v5r({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}else{let r=this.context.spec.servers;t=new E5r({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}this.addEnvironmentsToIr({environmentConfig:t})}convertSecuritySchemes(){if(this.context.authOverrides){let r=R3t({rawApiFileSchema:this.context.authOverrides,casingsGenerator:this.context.casingsGenerator});this.addAuthToIR({requirement:r.requirement,schemes:r.schemes,docs:r.docs});return}let t=this.convertAsyncApiSecuritySchemes();t.length>0&&this.addAuthToIR({requirement:t.length===1?"ALL":"ANY",schemes:t,docs:void 0})}convertAsyncApiSecuritySchemes(){let t=[];for(let[r,n]of Object.entries(this.context.spec.components?.securitySchemes??{})){let i=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:["components","securitySchemes",r]});if(i==null)continue;let o=this.convertSecurityScheme({securityScheme:i,schemeId:r});o!=null&&t.push(o)}return t}convertSecurityScheme({securityScheme:t,schemeId:r}){switch(t.type){case"http":{if(t.scheme?.toLowerCase()==="bearer")return Sp.bearer({key:r,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,tokenPlaceholder:void 0,docs:t.description,playgroundDocs:void 0});if(t.scheme?.toLowerCase()==="basic")return Sp.basic({key:r,username:this.context.casingsGenerator.generateName("username"),password:this.context.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,usernameOmit:!1,passwordOmit:!1,usernamePlaceholder:void 0,passwordPlaceholder:void 0,docs:t.description,playgroundDocs:void 0});break}case"apiKey":{if(t.in==="header")return Sp.header({key:r,name:{name:this.context.casingsGenerator.generateName("apiKey"),wireValue:t.name},valueType:Ji.OPTIONAL_STRING,prefix:void 0,headerEnvVar:void 0,headerPlaceholder:void 0,docs:t.description,playgroundDocs:void 0});break}case"oauth2":return Sp.bearer({key:r,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,tokenPlaceholder:void 0,docs:t.description,playgroundDocs:void 0})}}convertChannels(){for(let[t,r]of Object.entries(this.context.spec.channels??{})){let i=new ux.SdkGroupNameExtension({breadcrumbs:["channels",t],operation:r,context:this.context}).convert()?.groups,o;if(this.isAsyncAPIV3(this.context)){let a=this.context.spec.operations??{};o=new I5r({context:this.context,breadcrumbs:["channels",t],websocketGroup:i,channel:r,channelPath:t,operations:a}).convert()}else o=new b5r({context:this.context,breadcrumbs:["channels",t],websocketGroup:i,channel:r,channelPath:t}).convert();o!=null&&(this.addWebsocketChannelToIr({websocketChannel:o.channel,channelPath:t,audiences:o.audiences,websocketGroup:i}),this.addTypesToIr(o.inlinedTypes))}}}});var vUt,ZTu=h(()=>{"use strict";_n();Uo();vUt=class extends Wb{isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let o,s=t.$ref.match(/^.*\/schemas\/(.+)$/),a=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),c=t.$ref.match(/^.*\/messages\/(.+)$/);if(s&&s[1])return o=s[1],this.convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o});if(a&&a[2]){let u=a[1],l=a[2];return o=`${u}_${l}`,this.convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o})}else return c&&c[1]?(o=c[1],this.convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o})):{ok:!1}}convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o}){let s=this.resolveReference({reference:t,breadcrumbs:r});if(!s.resolved)return{ok:!1};let a;if(i==="reference_identifier")a=n??s.value.title;else if(i==="discriminator_key")a=s.value.title??n;else{let c=t.$ref.split("/").pop()??o;a=s.value.title??c}return{ok:!0,reference:Jr.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(o),typeId:o,displayName:a,default:void 0,inline:!1})}}convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o}){let s=this.resolveReference({reference:t,breadcrumbs:r});if(!s.resolved)return{ok:!1};let a;if(i==="reference_identifier")a=n??s.value.name;else if(i==="discriminator_key")a=s.value.name??n;else{let c=t.$ref.split("/").pop()??o;a=s.value.name??c}return{ok:!0,reference:Jr.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(o),typeId:o,displayName:a,default:void 0,inline:!1})}}convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o}){let s=this.resolveReference({reference:t,breadcrumbs:r});if(!s.resolved)return{ok:!1};let a;if(i==="reference_identifier")a=n??s.value.messageId??s.value.name;else if(i==="discriminator_key")a=s.value.messageId??s.value.name??n;else{let c=t.$ref.split("/").pop()??o;a=s.value.messageId??s.value.name??c}return{ok:!0,reference:Jr.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(o),typeId:o,displayName:a,default:void 0,inline:!1})}}}});var $Tu=h(()=>{"use strict";XTu();ZTu()});function znm(e){let t=new Set,r,n=new RegExp(Qnm.source,"g");for(;(r=n.exec(e))!=null;)r[1]!=null&&t.add(r[1]);return t}var Qnm,x5r,eOu=h(()=>{"use strict";Uo();Qnm=/\{([^}]+)\}/g,x5r=class extends Yo{document;key="x-fern-base-path";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t=="string")return this.parseString(t);if(typeof t=="object"&&!Array.isArray(t))return this.parseStructured(t);this.context.errorCollector.collect({message:"Expected `x-fern-base-path` to be a string or object",path:this.breadcrumbs})}}parseString(t){if(this.validatePath(t))return{path:t,parameters:[],pathsIncludeBasePath:!1}}parseStructured(t){let r=t.path;if(typeof r!="string"){this.context.errorCollector.collect({message:"`x-fern-base-path.path` must be a string",path:this.breadcrumbs});return}if(!this.validatePath(r))return;let n=znm(r),i=t.parameters;if(i!=null&&(typeof i!="object"||Array.isArray(i))){this.context.errorCollector.collect({message:"`x-fern-base-path.parameters` must be an object map",path:[...this.breadcrumbs,"parameters"]});return}let o=i??{};for(let c of Object.keys(o))if(!n.has(c)){this.context.errorCollector.collect({message:`Parameter '${c}' does not appear in the base path '${r}'`,path:[...this.breadcrumbs,"parameters",c]});return}let s=[];for(let c of n){let u=o[c];if(u==null){s.push({name:c,type:"string",default:void 0,docs:void 0});continue}if(typeof u!="object"||Array.isArray(u)){this.context.errorCollector.collect({message:`Parameter '${c}' must be an object`,path:[...this.breadcrumbs,"parameters",c]});return}let l=u,p=typeof l.type=="string"?l.type:"string",d=typeof l.docs=="string"?l.docs:void 0;s.push({name:c,type:p,default:l.default,docs:d})}let a=t["paths-include-base-path"]===!0;return{path:r,parameters:s,pathsIncludeBasePath:a}}validatePath(t){return t.startsWith("/")?!0:(this.context.errorCollector.collect({message:"`x-fern-base-path` path must start with '/'",path:this.breadcrumbs}),!1)}}});var C5r,tOu=h(()=>{"use strict";Uo();C5r=class extends Yo{document;key="x-fern-base-url-env";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t!="string"||t.length===0){this.context.errorCollector.collect({message:"Expected a non-empty string value for x-fern-base-url-env",path:this.breadcrumbs});return}return t}}}});var w5r,rOu=h(()=>{"use strict";Uo();w5r=class extends Yo{document;key="x-fern-global-headers";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-headers",path:this.breadcrumbs});return}return t}}}});function Mnm(e){let r=e["x-fern-default"]??e.default;if(typeof r=="string"||typeof r=="boolean"||typeof r=="number")return r}var S5r,nOu=h(()=>{"use strict";Uo();S5r=class extends Yo{document;key="x-fern-global-parameters";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t==null)return;if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-parameters",path:this.breadcrumbs});return}let r=[];for(let[n,i]of t.entries()){if(typeof i!="object"||i==null||Array.isArray(i)){this.context.errorCollector.collect({message:`x-fern-global-parameters[${n}] must be an object`,path:[...this.breadcrumbs,`${n}`]});continue}let o=i;if(typeof o.name!="string"){this.context.errorCollector.collect({message:`x-fern-global-parameters[${n}].name is required and must be a string`,path:[...this.breadcrumbs,`${n}`,"name"]});continue}r.push({name:o.name,"parameter-name":typeof o["parameter-name"]=="string"?o["parameter-name"]:void 0,in:typeof o.in=="string"?o.in:void 0,target:typeof o.target=="string"?o.target:void 0,env:typeof o.env=="string"?o.env:void 0,default:Mnm(o),optional:typeof o.optional=="boolean"?o.optional:void 0,apply:typeof o.apply=="string"?o.apply:void 0,type:typeof o.type=="string"?o.type:void 0,docs:typeof o.docs=="string"?o.docs:void 0})}return r.length>0?r:void 0}}});function Lnm(e){if(e!=null){if(typeof e=="string")return Ut.Literal.string(e);if(typeof e=="boolean")return Ut.Literal.boolean(e)}}function iOu({globalHeaderOverrides:e,context:t}){let r=[];for(let[n,i]of Object.entries(e.headers??{}))if(typeof i=="string")r.push({name:t.casingsGenerator.generateNameAndWireValue({name:n,wireValue:n}),valueType:Ji.STRING,env:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},availability:void 0,docs:void 0,clientDefault:void 0,defaultValue:void 0});else{let o=i.name??n;r.push({name:t.casingsGenerator.generateNameAndWireValue({name:o,wireValue:n}),valueType:Ji.STRING,env:i.env,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},availability:void 0,docs:i.docs,clientDefault:Lnm(i.default),defaultValue:i.default})}return r}var oOu=h(()=>{"use strict";_n();Uo()});function Vnm(e){if(e!=null){if(typeof e=="string")return Ut.Literal.string(e);if(typeof e=="boolean")return Ut.Literal.boolean(e)}}function sOu({globalHeaders:e,context:t}){return e.map(r=>({name:t.casingsGenerator.generateNameAndWireValue({name:r.name??"",wireValue:r.header}),valueType:r.optional?Ji.OPTIONAL_STRING:Ji.STRING,env:r.env,v2Examples:r.optional?void 0:Unm({header:r,context:t}),availability:void 0,docs:void 0,clientDefault:Vnm(r["x-fern-default"]),defaultValue:void 0}))}function Unm({header:e,context:t}){let r=new nS({breadcrumbs:[],context:t,schema:{type:"string"},example:e.header}),{validExample:n}=r.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{globalHeaderExample:n}}}var aOu=h(()=>{"use strict";_n();Uo()});function _nm(e,t,r,n){if(e!=null){if(typeof e=="boolean"){if(t!=null&&t!=="boolean"){n.errorCollector.collect({message:`Default value is a boolean but type is '${t}'; expected a ${t} value`,path:[...r,"default"]});return}return Ut.Literal.boolean(e)}if(typeof e=="string"){if(t==="boolean"){n.errorCollector.collect({message:"Default value is a string but type is 'boolean'; expected a boolean value",path:[...r,"default"]});return}if(t==="integer"||t==="double"||t==="number"){n.errorCollector.collect({message:`Default value is a string but type is '${t}'; expected a numeric value`,path:[...r,"default"]});return}return Ut.Literal.string(e)}if(typeof e=="number"){if(t==="boolean"){n.errorCollector.collect({message:"Default value is a number but type is 'boolean'; expected a boolean value",path:[...r,"default"]});return}if(t==="string"){n.errorCollector.collect({message:"Default value is a number but type is 'string'; expected a string value",path:[...r,"default"]});return}if(t==="integer"&&!Number.isInteger(e)){n.errorCollector.collect({message:`Default value ${e} is not an integer`,path:[...r,"default"]});return}return Ut.Literal.string(String(e))}n.errorCollector.collect({message:`Default value has unsupported type '${typeof e}'; expected a string, number, or boolean`,path:[...r,"default"]})}}function Gnm(e,t,r){switch(e){case void 0:case"body":return Ut.GlobalParameterLocation.Body;case"query":return Ut.GlobalParameterLocation.Query;case"header":return Ut.GlobalParameterLocation.Header;case"path":return Ut.GlobalParameterLocation.Path;default:return r.errorCollector.collect({message:`Invalid global parameter location '${e}'; expected one of: body, query, header, path`,path:t}),Ut.GlobalParameterLocation.Body}}function qnm(e,t,r){switch(e){case void 0:return;case"explicit":return Ut.GlobalParameterApplyMode.Explicit;case"auto":return Ut.GlobalParameterApplyMode.Auto;default:r.errorCollector.collect({message:`Invalid global parameter apply mode '${e}'; expected one of: explicit, auto`,path:t});return}}function Wnm(e,t){let r=Hnm(e);return t===!0?Ut.TypeReference.container(Ut.ContainerType.optional(r)):r}function Hnm(e){switch(e){case"boolean":return Ut.TypeReference.primitive({v1:"BOOLEAN",v2:Ut.PrimitiveTypeV2.boolean({default:void 0})});case"integer":return Ut.TypeReference.primitive({v1:"INTEGER",v2:Ut.PrimitiveTypeV2.integer({default:void 0,validation:void 0})});case"double":case"number":return Ut.TypeReference.primitive({v1:"DOUBLE",v2:Ut.PrimitiveTypeV2.double({default:void 0,validation:void 0})});default:return Ji.STRING}}function Knm(e){return e.target!=null?e.target:e.name}function cOu({globalParameters:e,context:t}){let r=new Map;for(let[n,i]of e.entries()){let o=r.get(i.name);o!=null?t.errorCollector.collect({message:`Duplicate global parameter name '${i.name}' at index ${n} (first seen at index ${o}). Each global parameter must have a unique name.`,path:["x-fern-global-parameters",`${n}`,"name"]}):r.set(i.name,n)}return e.map((n,i)=>({param:n,index:i})).filter(({param:n,index:i})=>r.get(n.name)===i).map(({param:n,index:i})=>{let o=["x-fern-global-parameters",`${i}`],s=Gnm(n.in,[...o,"in"],t),a=n["parameter-name"]??n.name;return{id:n.name,name:t.casingsGenerator.generateNameAndWireValue({name:a,wireValue:n.name}),location:s,target:Knm(n),valueType:Wnm(n.type,n.optional),env:n.env,clientDefault:_nm(n.default,n.type,o,t),optional:n.optional,apply:qnm(n.apply,[...o,"apply"],t),docs:n.docs}})}var uOu=h(()=>{"use strict";_n();Uo()});var T5r,lOu=h(()=>{"use strict";wt();Uo();T5r=class extends wm.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r,parameter:n})}convert(){let t,r={},n=this.getSchema();if(n!=null){let i=this.context.convertBreadcrumbsToName([...this.breadcrumbs,this.parameter.name]),s=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,this.parameter.name,"schema"],schemaOrReference:n,wrapAsOptional:this.parameter.required==null||!this.parameter.required,schemaIdOverride:i}).convert();s!=null&&(t=s.type,r=s.inlinedTypes??{})}return this.convertToOutput({schema:n??{type:"string"},typeReference:t,inlinedTypes:r})}getSchema(){if(this.parameter.schema!=null)return this.parameter.schema;if(!(!this.context.settings.respectParameterContent||this.parameter.in!=="header"||this.parameter.content==null)){for(let[t,r]of Object.entries(this.parameter.content))if(r.schema!=null&&Qp.parse(t)?.isJSON())return r.schema}}}});function Ynm({encoding:e}){if(e){if(e.explode)return"exploded";if(e.style==="form")return"form";if(e.contentType)return Jnm[e.contentType]}}var O5r,Jnm,pOu=h(()=>{"use strict";wt();_n();tc();Uo();O5r=class extends wm.AbstractConverters.AbstractMediaTypeObjectConverter{contentType;mediaType;description;required;schemaId;streamingExtension;queryParameters;constructor({context:t,breadcrumbs:r,contentType:n,mediaType:i,description:o,required:s,group:a,method:c,streamingExtension:u,queryParameters:l}){super({context:t,breadcrumbs:r,group:a,method:c}),this.contentType=n,this.mediaType=i,this.description=o,this.required=s,this.schemaId=[...this.group,this.method,"Request"].join("_"),this.streamingExtension=u,this.queryParameters=l??[]}get bodyRequired(){return this.required===!1?!1:void 0}convert(){return this.streamingExtension?.type=="streamCondition"?this.convertStreamConditionRequestBody():this.convertNonStreamConditionRequestBody()}convertStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleStreamConditionJsonOrFormContent({contentType:this.contentType})}convertNonStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleJsonOrFormContent({contentType:this.contentType});if(Qp.parse(this.contentType)?.isMultipart())return this.handleMultipartContent({contentType:this.contentType});if(this.isBinaryContentType())return this.handleBinaryContent({contentType:this.contentType})}isOrderedJsonOrFormContentType(){let t=Qp.parse(this.contentType);return t?t.isJSON()||t.isURLEncoded()||t.isPlainText()||t.isCSV()||t.isHTML()||t.isXML()||t.isDNS()||t.isApplicationText():!1}isBinaryContentType(){let t=Qp.parse(this.contentType);return t?t.isBinary():!1}handleJsonOrFormContent({contentType:t}){let r=this.mediaType;if(r==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});if(n==null)return this.handleSchemalessJsonContent({contentType:t,mediaTypeObject:r});let i=n.schema?.typeDeclaration.shape;return i?.type==="object"?this.hasBodyQueryParameterOverlap(i.properties)?{requestBody:ad.reference({contentType:t,docs:this.description,requestBodyType:n.type,required:this.bodyRequired,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n.inlinedTypes??{}}:{requestBody:ad.inlinedRequestBody({contentType:t,docs:this.description??n.schema?.typeDeclaration.docs,name:this.context.casingsGenerator.generateName(this.schemaId),extendedProperties:i.extendedProperties,extends:i.extends,properties:i.properties,extraProperties:i.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:n.inlinedTypes}),inlinedPropertiesByAudience:n.schema?.propertiesByAudience}:{requestBody:ad.reference({contentType:t,docs:this.description,requestBodyType:n.type,required:this.bodyRequired,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n.inlinedTypes??{}}}handleSchemalessJsonContent({contentType:t,mediaTypeObject:r}){if(!(r.example!=null||r.examples!=null&&Object.keys(r.examples).length>0))return;let i={userSpecifiedExamples:{},autogeneratedExamples:{}},o=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:r,breadcrumbs:this.breadcrumbs,defaultExampleName:`${[...this.group,this.method].join("_")}_example`}),s=new Set;for(let[a,c]of o){let u=this.context.resolveExampleWithValue(c),l=this.context.resolveExampleRecursively({example:c,breadcrumbs:this.breadcrumbs}),p=a;if(this.context.isExampleWithSummary(l)){let d=l.summary;s.has(d)||(p=d)}s.add(p),u!=null&&(i.userSpecifiedExamples[p]=u)}return{requestBody:ad.reference({contentType:t,docs:this.description,requestBodyType:Jr.unknown(),required:this.bodyRequired,v2Examples:i}),streamRequestBody:void 0,inlinedTypes:{}}}handleMultipartContent({contentType:t}){let r=this.mediaType;if(r==null||r.schema==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,resolveSchema:!0,contentType:t});if(n==null)return;let i=n.schema?.typeDeclaration.shape;if(i?.type==="object")return{requestBody:ad.fileUpload({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),properties:i.properties.map(o=>{let s=r.encoding?.[nr(o.name)];return this.convertRequestBodyProperty({property:o,contentType:t,encoding:s})}),v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:n.inlinedTypes}),examples:n.examples}}handleBinaryContent({contentType:t}){let r=this.mediaType;if(r==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});return{requestBody:ad.bytes({contentType:t,isOptional:this.required===!1,docs:this.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n?.inlinedTypes??{}}}convertRequestBodyProperty({property:t,contentType:r,encoding:n}){let{isFile:i,isOptional:o,isArray:s}=this.recursivelyCheckTypeReferenceIsFile({typeReference:t.valueType});return i?s?uC.file($j.fileArray({key:t.name,isOptional:o,contentType:r,docs:t.docs})):uC.file($j.file({key:t.name,isOptional:o,contentType:r,docs:t.docs})):uC.bodyProperty({...t,contentType:n?.contentType??r,style:Ynm({encoding:n}),name:t.name})}handleStreamConditionJsonOrFormContent({contentType:t}){if(this.streamingExtension?.type!=="streamCondition")return;let r=this.mediaType;if(r==null||r.schema==null)return;let n=this.context.resolveMaybeReference({schemaOrReference:r.schema,breadcrumbs:[...this.breadcrumbs,"content",t,"schema"]});if(n==null)return;let i=n.properties?.[this.streamingExtension.streamConditionProperty];if(i!=null&&this.context.isReferenceObject(i)&&(i=void 0),i==null){if(n.oneOf==null&&n.anyOf==null)return;i={type:"boolean"}}let o=this.buildStreamConditionRequestBody({streamConditionProperty:i,resolvedMediaTypeSchema:n,isStreaming:!0,contentType:t,mediaTypeObject:r}),s=this.buildStreamConditionRequestBody({streamConditionProperty:i,resolvedMediaTypeSchema:n,isStreaming:!1,contentType:t,mediaTypeObject:r});if(!(o==null||s==null))return{requestBody:s.requestBody,streamRequestBody:o.requestBody,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:{...o.inlinedTypes,...s.inlinedTypes}})}}buildStreamConditionRequestBody({streamConditionProperty:t,resolvedMediaTypeSchema:r,isStreaming:n,contentType:i,mediaTypeObject:o}){if(this.streamingExtension==null||this.streamingExtension.type!=="streamCondition")return;let s={...r,properties:{...r.properties,[this.streamingExtension.streamConditionProperty]:{...t,type:"boolean",const:n}},required:[...r.required??[],this.streamingExtension.streamConditionProperty]},a={...o,schema:s},c=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:this.schemaId,contentType:i});if(c==null)return;let u=c.schema?.typeDeclaration.shape;return u?.type==="object"?{requestBody:ad.inlinedRequestBody({contentType:i,docs:this.description??c.schema?.typeDeclaration.docs,name:this.context.casingsGenerator.generateName(n?this.streamingExtension?.streamRequestName??`${this.schemaId}_streaming`:this.schemaId),extendedProperties:u.extendedProperties,extends:u.extends,properties:u.properties,extraProperties:u.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:a,exampleGenerationStrategy:"request"})}),inlinedTypes:c.inlinedTypes}:{requestBody:ad.reference({contentType:i,docs:this.description,requestBodyType:c.type,required:this.bodyRequired,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:a,exampleGenerationStrategy:"request"})}),inlinedTypes:c.inlinedTypes??{}}}recursivelyCheckTypeReferenceIsFile({typeReference:t,isOptional:r,isArray:n}){return this.context.isList(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.list,isOptional:r,isArray:!0}):this.context.isOptional(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.optional,isOptional:!0,isArray:n}):this.context.isNullable(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.nullable,isOptional:r,isArray:n}):{isFile:this.context.isFile(t),isOptional:r??!1,isArray:n??!1}}hasBodyQueryParameterOverlap(t){if(this.queryParameters.length===0)return!1;let r=new Set(this.queryParameters.map(n=>nr(n.name).toLowerCase()));return t.some(n=>r.has(nr(n.name).toLowerCase()))}},Jnm={"application/json":"json"}});function $nm(e){return e?.header!=null}var Xnm,Znm,Bit,DNo=h(()=>{"use strict";wt();_n();tc();Uo();Vi();lOu();pOu();Xnm=/{([^}]+)}/g,Znm=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]),Bit=class extends Ji{operation;method;path;pathItemParameters;inlinedTypes={};constructor({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s}){super({context:t,breadcrumbs:r}),this.operation=n,this.method=i,this.path=o,this.pathItemParameters=s??[]}convertHttpMethod(){switch(this.method){case"get":return am.Get;case"post":return am.Post;case"put":return am.Put;case"delete":return am.Delete;case"patch":return am.Patch;case"head":return am.Head;default:return}}convertParameters({breadcrumbs:t}){let r=[],n=[],i=[],o=this.mergeParameters(this.pathItemParameters,this.operation.parameters??[]);if(o.length===0)return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:n,headers:i};for(let s of o){let a=this.context.resolveMaybeReference({schemaOrReference:s,breadcrumbs:t});if(a==null)continue;let u=new T5r({context:this.context,breadcrumbs:t,parameter:a}).convert();if(u!=null)switch(this.inlinedTypes={...this.inlinedTypes,...u.inlinedTypes},u.type){case"path":r.push(u.parameter);break;case"query":n.push(u.parameter);break;case"header":{let l=zr(u.parameter.name),p=nr(u.parameter.name),d=!1,f=this.context.authOverrides?.["auth-schemes"];if(f!=null){for(let g of Object.values(f))if($nm(g)&&g.header.toLowerCase()===p.toLowerCase()){d=!0;break}}let m=this.context.globalHeaderNames;if(m!=null){for(let g of m)if(g.toLowerCase()===p.toLowerCase()){d=!0;break}}!Znm.has(l.toLowerCase())&&!d&&i.push(u.parameter);break}}}return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:n,headers:i}}mergeParameters(t,r){if(t.length===0)return r;if(r.length===0)return t;let n=new Set;for(let o of r){let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:this.breadcrumbs});s!=null&&n.add(`${s.in}:${s.name}`)}return[...t.filter(o=>{let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:this.breadcrumbs});return s==null?!1:!n.has(`${s.in}:${s.name}`)}),...r]}checkMissingPathParameters(t){let n=[...this.path.matchAll(Xnm)].map(i=>i[1]).filter(i=>!t.some(o=>zr(o.name)===i));for(let i of n){if(i==null)continue;let o=`${i}_example`;t.push({name:this.context.casingsGenerator.generateName(i),valueType:Ji.STRING,docs:void 0,location:"ENDPOINT",variable:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{[o]:this.generateStringParameterExample({example:i})}},explode:void 0,clientDefault:void 0})}}convertRequestBody({breadcrumbs:t,group:r,method:n,streamingExtension:i,queryParameters:o}){if(this.operation.requestBody==null)return;let s=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:t});if(s==null)return null;let a=[];for(let[c,u]of Object.entries(s.content)){let p=new O5r({context:this.context,breadcrumbs:t,contentType:c,mediaType:u,description:s.description,required:s.required,group:r??[],method:n,streamingExtension:i,queryParameters:o}).convert();p!=null&&(this.inlinedTypes={...this.inlinedTypes,...p.inlinedTypes},a.push({requestBody:p.requestBody,streamRequestBody:p.streamRequestBody,examples:p.examples,inlinedPropertiesByAudience:p.inlinedPropertiesByAudience}))}return a}computeGroupNameAndLocationFromExtensions(){let r=new ux.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.methodName,i=new ux.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.groups??[];if(r!=null)return{group:i,method:r}}evaluateMethodNameFromOperation(){let t=this.operation.operationId;return t??(this.operation.summary!=null?ti(this.operation.summary):ti(`${this.method}_${this.path.split("/").join("_")}`))}sanitizeMethodName(t){return t.includes(".")?ti(t):t}computeGroupNameFromTagAndOperationId(){let t=this.operation.tags?.[0],r=this.evaluateMethodNameFromOperation();if(t==null)return{method:this.sanitizeMethodName(r)};let n=this.context.settings.respectOperationIdWordBoundaries,i=M7(t,n),o=M7(r,n);return b0(i,o)?{method:t}:this.computeGroupAndMethodFromTokens({tag:t,tagTokens:i,methodName:r,methodNameTokens:o})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,methodName:n,methodNameTokens:i}){if(r.some((a,c)=>a!==i[c]))return{group:[t],method:this.sanitizeMethodName(n)};let s=i.slice(r.length);return s[0]!=null&&/^\d/.test(s[0])?{group:[t],method:this.sanitizeMethodName(n)}:{group:[t],method:ti(s.join("_"))}}generateStringParameterExample({example:t}){let r=new wm.ExampleConverter({breadcrumbs:this.breadcrumbs,context:this.context,schema:{type:"string"},example:t}),{validExample:n}=r.convert();return n}}});var Dit,RNo=h(()=>{"use strict";_n();DNo();Dit=class extends Bit{constructor({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s}){super({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s})}convert(){if(this.operation.requestBody==null){this.context.errorCollector.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let t=this.convertHttpMethod();if(t==null)return;if(t!=="POST"&&t!=="GET"){this.context.errorCollector.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:r,method:n}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),i=[...this.breadcrumbs,"Payload"],{headers:o,queryParameters:s}=this.convertParameters({breadcrumbs:i}),a=this.convertRequestBody({breadcrumbs:i,group:r,method:n,streamingExtension:void 0,queryParameters:s});if(a==null)return;let c=a[0]?.requestBody;if(c==null)return;let u=c.type==="inlinedRequestBody"?a[0]?.inlinedPropertiesByAudience:void 0,l,p;if(c.type==="inlinedRequestBody")l=a1.inlinedPayload({name:c.name,extends:c.extends,properties:c.properties});else if(c.type==="reference")l=a1.reference({payloadType:c.requestBodyType,docs:c.docs});else if(c.type==="fileUpload")p={name:c.name,properties:c.properties,docs:c.docs,v2Examples:c.v2Examples,contentType:c.contentType},l=a1.inlinedPayload({name:c.name,extends:[],properties:[]});else return;let d=this.convertWebhookResponses();return{audiences:this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],group:r,inlinedPayloadPropertiesByAudience:u,webhook:{id:`${r?.join(".")??""}.${n}`,name:this.context.casingsGenerator.generateName(n),displayName:this.operation.summary,method:t,headers:o,payload:l,signatureVerification:void 0,fileUploadPayload:p,responses:d.length>0?d:void 0,examples:[],availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),docs:this.operation.description,v2Examples:{autogeneratedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(c.v2Examples?.autogeneratedExamples??{}),userSpecifiedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(c.v2Examples?.userSpecifiedExamples??{})}},inlinedTypes:this.inlinedTypes}}convertWebhookResponses(){let t=[];if(this.operation.responses==null)return t;for(let[r,n]of Object.entries(this.operation.responses)){let i=/^\d[Xx]{2}$/.test(r),o;if(i)o=parseInt(r.charAt(0))*100;else if(o=parseInt(r),isNaN(o))continue;let a=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:[...this.breadcrumbs,"responses",r]})?.description;t.push({statusCode:o,isWildcardStatusCode:i?!0:void 0,body:void 0,docs:a})}return t}getWebhookV2ExamplesFromRequestBodyV2Examples(t){return Object.fromEntries(Object.entries(t).map(([r,n])=>[r,{name:r,payload:n}]))}}});var fOu,dOu=h(()=>{"use strict";fOu=["get","post","put","delete","patch","head"]});var P5r,mOu=h(()=>{"use strict";Uo();P5r=class extends Yo{operation;key="x-fern-global-parameter";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;if(typeof t=="string")return[t];if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected value for x-fern-global-parameter; expected a string or array of strings",path:this.breadcrumbs});return}let r=[];for(let[n,i]of t.entries()){if(typeof i!="string"){this.context.errorCollector.collect({message:`x-fern-global-parameter[${n}] must be a string`,path:[...this.breadcrumbs,`${n}`]});continue}r.push(i)}return r.length>0?r:void 0}}});var B5r,hOu=h(()=>{"use strict";Uo();B5r=class extends Yo{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return t}}}});var eim,tim,rim,nim,kNo,gOu=h(()=>{"use strict";jn();eim=Be.object({cursor:Be.string(),next_cursor:Be.string(),results:Be.string()}),tim=Be.object({offset:Be.string(),results:Be.string(),step:Be.string().optional(),"has-next-page":Be.string().optional()}),rim=Be.object({next_uri:Be.string(),results:Be.string()}),nim=Be.object({next_path:Be.string(),results:Be.string()}),kNo=Be.union([Be.boolean(),eim,tim,rim,nim])});var FNo,lxe,D5r,AOu=h(()=>{"use strict";Uo();gOu();FNo="$request.",lxe="$response.",D5r=class extends Yo{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:n,context:i}){super({breadcrumbs:t,context:i}),this.operation=r,this.document=n}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=kNo.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean"){let n=this.getExtensionValue(this.document);if(n==null)return;if(typeof n=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let i=kNo.safeParse(n);if(!i.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${i.error.message}`,path:this.breadcrumbs});return}if(typeof i.data=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:i.data})}if(typeof r.data=="boolean"){this.context.errorCollector.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:r.data})}convertPaginationConfig({config:t}){let r=t;if("cursor"in r)return{type:"cursor",cursor:Wb.maybeTrimPrefix(r.cursor,FNo),nextCursor:Wb.maybeTrimPrefix(r.next_cursor,lxe),results:Wb.maybeTrimPrefix(r.results,lxe)};let n=t;if("next_uri"in n)return{type:"uri",nextUri:Wb.maybeTrimPrefix(n.next_uri,lxe),results:Wb.maybeTrimPrefix(n.results,lxe)};let i=t;if("next_path"in i)return{type:"path",nextPath:Wb.maybeTrimPrefix(i.next_path,lxe),results:Wb.maybeTrimPrefix(i.results,lxe)};let o=t;return{type:"offset",offset:Wb.maybeTrimPrefix(o.offset,FNo),results:Wb.maybeTrimPrefix(o.results,lxe),step:o.step!=null?Wb.maybeTrimPrefix(o.step,FNo):void 0,hasNextPage:o["has-next-page"]!=null?Wb.maybeTrimPrefix(o["has-next-page"],lxe):void 0}}}});function NNo(e){let t=e["x-fern-streaming"];if(t==null||typeof t=="boolean")return;let r=t.resumable;return typeof r=="boolean"?r:void 0}var iim,oim,sim,R5r,yOu=h(()=>{"use strict";Uo();jn();iim="$request.",oim=Be.object({"stream-condition":Be.string().optional(),format:Be.enum(["sse","json"]).optional(),"stream-description":Be.string().optional(),"stream-request-name":Be.string().optional(),"response-stream":Be.any(),response:Be.any(),terminator:Be.string().optional(),resumable:Be.boolean().optional()}),sim=Be.union([Be.boolean(),oim]),R5r=class extends Yo{document;operation;key="x-fern-streaming";constructor({breadcrumbs:t,document:r,operation:n,context:i}){super({breadcrumbs:t,context:i}),this.document=r,this.operation=n}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=sim.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-streaming extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean")return r.data?{type:"stream",format:"json",terminator:void 0,resumable:!1}:void 0;let n=r.data.resumable??NNo(this.document)??!1;if(r.data["stream-condition"]==null&&r.data.format!=null)return{type:"stream",format:r.data.format,terminator:r.data.terminator,resumable:n};if(r.data["stream-condition"]==null){this.context.errorCollector.collect({message:"Missing stream-condition property without specified format.",path:this.breadcrumbs});return}return{type:"streamCondition",format:r.data.format??"json",terminator:r.data.terminator,streamDescription:r.data["stream-description"],streamConditionProperty:Wb.maybeTrimPrefix(r.data["stream-condition"],iim),streamRequestName:r.data["stream-request-name"],responseStream:r.data["response-stream"],response:r.data.response,resumable:n}}}});var k5r,bOu=h(()=>{"use strict";Uo();k5r=class extends Yo{operation;key="x-fern-subtitle";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"Received unexpected non-string value for x-fern-subtitle",path:this.breadcrumbs});return}return t}}}});var F5r,EOu=h(()=>{"use strict";Uo();F5r=class extends Yo{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return t}}}});function aim(e){return io(e)&&typeof e.$ref=="string"}function cim(e,t){if(e!=null){if(typeof e=="string")return e;if(aim(e)){let r=(0,IOu.resolve)(t??process.cwd(),e.$ref);if((0,j5r.existsSync)(r))try{return(0,j5r.readFileSync)(r,"utf-8")}catch{return}}}}var j5r,IOu,N5r,vOu=h(()=>{"use strict";wt();Uo();j5r=require("fs"),IOu=require("path");N5r=class extends Yo{operation;baseDir;key="x-codeSamples";constructor({context:t,breadcrumbs:r,operation:n,baseDir:i}){super({breadcrumbs:r,context:t}),this.operation=n,this.baseDir=i}convert(){let t=io(this.operation)?this.operation:{},r=t["x-codeSamples"],n=t["x-code-samples"],i=Array.isArray(r)?r:[],o=Array.isArray(n)?n:[],s=[...i,...o];if(s.length===0)return;let a=[];for(let c of s){if(!io(c))continue;let u=c,l=u.lang,p=u.label,d=u.source;if(typeof l!="string")continue;let f=cim(d,this.baseDir);f!=null&&a.push({name:typeof p=="string"?p:l,language:l,code:f,install:void 0,docs:void 0})}if(a.length!==0)return[{"code-samples":a}]}}});function uim(e){return io(e)&&typeof e.$ref=="string"}function lim(e,t){if(e!=null){if(typeof e=="string")return e;if(uim(e)){let r=(0,xOu.resolve)(t??process.cwd(),e.$ref);if((0,z5r.existsSync)(r))try{return(0,z5r.readFileSync)(r,"utf-8")}catch{return}}}}function pim(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!io(n))continue;let o=lim(n.code,t);o!=null&&r.push({...n,code:o})}return r}var z5r,xOu,Q5r,COu=h(()=>{"use strict";wt();lo();Uo();z5r=require("fs"),xOu=require("path");Q5r=class extends Yo{operation;baseDir;key="x-fern-examples";constructor({context:t,breadcrumbs:r,operation:n,baseDir:i}){super({breadcrumbs:r,context:t}),this.operation=n,this.baseDir=i}convert(){let t=this.getExtensionValue(this.operation);return t==null?void 0:(Array.isArray(t)?t:[]).map(o=>{if(!io(o))return o;let a=o["code-samples"];if(a!=null){let c=pim(a,this.baseDir);return{...o,"code-samples":c}}return o}).filter(o=>{let s=Fd.serialization.ExampleEndpointCallSchema.parse(o);return s.ok||this.context.errorCollector.collect({message:`Failed to parse x-fern-example in ${this.breadcrumbs.join(".")}`,path:this.breadcrumbs}),s.ok})}}});var xUt,wOu=h(()=>{"use strict";Uo();xUt=class extends Yo{document;key="x-fern-explorer";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-explorer",path:this.breadcrumbs});return}return t}}}});var CUt,SOu=h(()=>{"use strict";wt();_n();Uo();CUt=class extends wm.AbstractConverters.AbstractMediaTypeObjectConverter{responseBody;statusCode;streamingExtension;convertedResponseHeaders;constructor({context:t,breadcrumbs:r,responseBody:n,group:i,method:o,statusCode:s,streamingExtension:a}){super({context:t,breadcrumbs:r,group:i,method:o}),this.responseBody=n,this.statusCode=s,this.streamingExtension=a}convert(){if(parseInt(this.statusCode)===204){this.responseBody.content!=null&&Object.keys(this.responseBody.content).length>0&&this.context.errorCollector.collect({message:"A 204 (No Content) response declares a body, but a 204 response cannot include one. Ignoring the declared body and treating the success response as optional.",path:this.breadcrumbs});return}return this.shouldConvertAsStreaming()?this.convertStreamingResponseBody():this.convertNonStreamingResponseBody()}convertStreamingResponseBody(){if(this.streamingExtension!=null){if(this.streamingExtension.type=="streamCondition"){let t=this.streamingExtension.responseStream,r=this.streamingExtension.response,n=[...this.group,this.method,"Response",this.statusCode].join("_"),i=`${n}_streaming`,o=this.parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:i}),s=this.parseMediaTypeSchemaOrReference({schemaOrReference:r,schemaId:n});return this.convertStreamConditionResponse({convertedStreamingSchema:o,convertedNonStreamingSchema:s})}if(this.streamingExtension.type==="stream"){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}),n=this.streamingExtension.format==="sse"?[...r.filter(i=>i.includes("text/event-stream")),...r.filter(i=>!i.includes("text/event-stream"))]:r;for(let i of n){let o=this.responseBody.content?.[i];if(o==null)continue;let s=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:this.streamingExtension.format});if(s!=null)return this.convertStreamingResponse({mediaTypeObject:o,convertedSchema:s})}}}}convertNonStreamingResponseBody(){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}).filter(o=>o.includes("json"));for(let o of r){let s=this.responseBody.content?.[o];if(s==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:s,schemaId:t,contentType:o});if(a!=null&&this.shouldReturnJsonResponse(o))return this.returnJsonResponse({mediaTypeObject:s,convertedSchema:a})}let n=Object.keys(this.responseBody.content??{}).filter(o=>!o.includes("json"));for(let o of n){let s=this.responseBody.content?.[o];if(s==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:s,schemaId:t,contentType:o});if(a!=null){if(this.isBinarySchema(a))return this.shouldReturnBytesResponse()?this.returnBytesResponse({mediaTypeObject:s}):this.returnFileDownloadResponse({mediaTypeObject:s});if(this.shouldReturnTextResponse(o))return this.returnTextResponse({mediaTypeObject:s,contentType:o})}}let i=parseInt(this.statusCode);if(!isNaN(i)&&i>=200&&i<300&&i!==204){let o=r.map(c=>this.responseBody.content?.[c]).find(c=>c!=null),s={schema:{type:"object",description:"Empty response body"},...o?.examples!=null&&{examples:o.examples},...o?.example!=null&&{example:o.example}},a=this.parseMediaTypeObject({mediaTypeObject:s,schemaId:t,contentType:"application/json",resolveSchema:!0});if(a!=null)return this.returnJsonResponse({mediaTypeObject:s,convertedSchema:a})}}convertStreamConditionResponse({convertedStreamingSchema:t,convertedNonStreamingSchema:r}){if(t==null||r==null)return;let n=this.responseBody.description;return this.streamingExtension?.type==="streamCondition"&&this.streamingExtension.streamDescription!=null&&(n=this.streamingExtension.streamDescription),{responseBody:Cu.json(NE.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:r.schema?.typeDeclaration.v2Examples})),streamResponseBody:Cu.streaming(jI.json({docs:n,payload:t.type,terminator:this.streamingExtension?.terminator,v2Examples:t.schema?.typeDeclaration.v2Examples})),inlinedTypes:{...t.inlinedTypes,...r.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},headers:this.convertResponseHeaders().headers}}convertStreamingResponse({mediaTypeObject:t,convertedSchema:r}){if(this.streamingExtension==null)return;switch(this.streamingExtension.format){case"json":return{responseBody:Cu.streaming(jI.json({docs:this.responseBody.description,payload:r.type,terminator:this.streamingExtension?.terminator,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:{...r.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},examples:r.examples,headers:this.convertResponseHeaders().headers};case"sse":return{responseBody:Cu.streaming(jI.sse({docs:this.responseBody.description,payload:r.type,terminator:this.streamingExtension?.terminator,resumable:this.streamingExtension?.resumable,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:{...r.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},examples:r.examples,headers:this.convertResponseHeaders().headers};default:return}}returnJsonResponse({mediaTypeObject:t,convertedSchema:r}){return{responseBody:Cu.json(NE.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:{...r.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},examples:r.examples,headers:this.convertResponseHeaders().headers}}returnBytesResponse({mediaTypeObject:t}){return{responseBody:Cu.bytes({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:this.convertResponseHeaders().inlinedTypes,headers:this.convertResponseHeaders().headers}}returnFileDownloadResponse({mediaTypeObject:t}){return{responseBody:Cu.fileDownload({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:this.convertResponseHeaders().inlinedTypes,headers:this.convertResponseHeaders().headers}}returnTextResponse({mediaTypeObject:t,contentType:r}){return{responseBody:Cu.text({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"}),contentType:Qp.parse(r)?.isPlainText()?void 0:r}),streamResponseBody:void 0,inlinedTypes:this.convertResponseHeaders().inlinedTypes,headers:this.convertResponseHeaders().headers}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}shouldConvertAsStreaming(){return this.streamingExtension!=null}shouldReturnJsonResponse(t){return t.includes("json")}shouldReturnBytesResponse(){return this.context.settings.useBytesForBinaryResponse&&this.streamingExtension==null}shouldReturnTextResponse(t){return Qp.parse(t)?.isText()??!1}convertResponseHeaders(){return this.convertedResponseHeaders??=Tit({context:this.context,breadcrumbs:this.breadcrumbs,headers:this.responseBody.headers}),this.convertedResponseHeaders}}});function TOu(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}var M5r,OOu=h(()=>{"use strict";_n();Uo();M5r=class extends wm.AbstractConverters.AbstractMediaTypeObjectConverter{responseError;statusCode;methodName;isWildcardStatusCode;convertedResponseHeaders;constructor({context:t,breadcrumbs:r,responseError:n,group:i,method:o,methodName:s,statusCode:a,isWildcardStatusCode:c}){super({context:t,breadcrumbs:r,group:i,method:o}),this.responseError=n,this.statusCode=a,this.methodName=s,this.isWildcardStatusCode=c}convert(){if(!this.responseError.content){let n=this.getErrorNameForStatusCode(this.statusCode,this.isWildcardStatusCode);if(n==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}let i=this.getErrorIdFromErrorName(n);return{error:{error:{name:this.context.casingsGenerator.generateName(i),fernFilepath:{allParts:[],packagePath:[],file:void 0},errorId:i},docs:this.responseError.description},errorType:Jr.unknown(),displayName:n,statusCode:this.statusCode,isWildcardStatusCode:this.isWildcardStatusCode,inlinedTypes:this.convertResponseHeaders().inlinedTypes,examples:{},headers:this.convertResponseHeaders().headers}}let t=Object.keys(this.responseError.content).filter(n=>n.includes("json")),r=this.getErrorNameForStatusCode(this.statusCode,this.isWildcardStatusCode);if(r==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}for(let n of[...t]){let i=this.responseError.content?.[n];if(i==null)continue;let o=this.parseMediaTypeObject({mediaTypeObject:i,schemaId:TOu(`${this.methodName}Request${r}`),contentType:n});if(o==null)continue;let s=this.getErrorIdFromErrorName(r);if(o.schema!=null)return this.constructErrorConverterOutput({errorName:r,errorId:s,fernFilepath:o.schema.typeDeclaration.name.fernFilepath,convertedSchema:o,mediaTypeObject:i});if(o.type.type==="named")return this.constructErrorConverterOutput({errorName:r,errorId:s,fernFilepath:o.type.fernFilepath,convertedSchema:o,mediaTypeObject:i})}}constructErrorConverterOutput({errorName:t,errorId:r,fernFilepath:n,convertedSchema:i,mediaTypeObject:o}){return{error:{error:{name:this.context.casingsGenerator.generateName(r),fernFilepath:n,errorId:r},docs:this.responseError.description},errorType:i.type,displayName:t,statusCode:this.statusCode,isWildcardStatusCode:this.isWildcardStatusCode,inlinedTypes:{...i.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},examples:this.convertErrorExamples({mediaTypeObject:o}),headers:this.convertResponseHeaders().headers}}convertErrorExamples({mediaTypeObject:t}){let r=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:t,breadcrumbs:this.breadcrumbs,defaultExampleName:`${[...this.group,this.method].join("_")}_error_example`});if(r.length===0)return;let n=new Set,i={};for(let[o,s]of r){let a=this.context.resolveExampleWithValue(s),c=this.context.resolveExampleRecursively({example:s,breadcrumbs:this.breadcrumbs}),u=this.getIdForErrorExample({key:o,example:c,usedExampleNames:n});n.add(u),a!=null&&(i[u]=a)}return Object.keys(i).length>0?i:void 0}getIdForErrorExample({key:t,example:r,usedExampleNames:n}){if(this.context.isExampleWithSummary(r)){let i=r.summary;if(!n.has(i))return i;let o=`${i} (${t})`;return n.has(o)?t:o}return t}getErrorNameForStatusCode(t,r){if(r){if(t===400)return"ClientRequestError";if(t===500)return"ServerError"}return h5r[t]}getErrorIdFromErrorName(t){return this.context.enableUniqueErrorsPerEndpoint?TOu(`${this.methodName}Request${t}`):t}convertResponseHeaders(){return this.convertedResponseHeaders??=Tit({context:this.context,breadcrumbs:this.breadcrumbs,headers:this.responseError.headers}),this.convertedResponseHeaders}}});var L5r,POu=h(()=>{"use strict";lo();_n();tc();TW();Uo();Vi();vOu();COu();wOu();SOu();OOu();DNo();L5r=class e extends Bit{idempotent;subtitle;globalParameterIds;idToAuthScheme;topLevelServers;pathLevelServers;streamingExtension;static AUTHORIZATION_HEADER="Authorization";constructor({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s,idempotent:a,subtitle:c,globalParameterIds:u,idToAuthScheme:l,topLevelServers:p,pathLevelServers:d,streamingExtension:f}){super({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s}),this.idempotent=a,this.subtitle=c,this.globalParameterIds=u,this.idToAuthScheme=l,this.topLevelServers=p,this.pathLevelServers=d,this.streamingExtension=f}convert(){let t=this.convertHttpMethod();if(t==null)return;let{group:r,method:n}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),i=this.getGroupDisplayName(r),o=this.getGroupDescription(r),{headers:s,pathParameters:a,queryParameters:c}=this.convertParameters({breadcrumbs:[...this.breadcrumbs,"parameters"]}),u=this.collectQueryParameterAudiences({breadcrumbs:[...this.breadcrumbs,"parameters"]}),l=this.convertRequestBody({breadcrumbs:[...this.breadcrumbs,"requestBody"],group:r,method:n,streamingExtension:this.streamingExtension,queryParameters:c}),p=l?.[0]?.requestBody,d=l?.[0]?.streamRequestBody,f=l?.[0]?.inlinedPropertiesByAudience,m={requestBodies:l?.map(se=>se.requestBody)},g=this.convertResponseBody({breadcrumbs:[...this.breadcrumbs,"responses"],group:r,method:n,streamingExtension:this.streamingExtension}),A=g?.response,y=g?.streamResponse,E=g!=null?g.errors:[],x={},v=E.map(se=>se.error),C=M0(this.path),O=this.getEndpointBaseUrl(),D=this.getEndpointBaseUrls(),R=this.convertExamples({httpPath:C,httpMethod:t,baseUrl:O});if(Object.keys(R.examples).length===0&&Object.keys(R.streamExamples).length===0){let se=this.synthesizeEndpointExamplesFromNativeRequestBody({httpPath:C,httpMethod:t,baseUrl:O});if(se!=null)for(let[ae,Oe]of Object.entries(se))R.examples[ae]=Oe}if(Object.keys(R.examples).length===0&&Object.keys(R.streamExamples).length===0&&l!=null&&l.length>1){let se=this.synthesizeEndpointExamplesFromPerContentTypeRequestBodies({convertedRequestBodies:l,httpPath:C,httpMethod:t,baseUrl:O});if(se!=null)for(let[ae,Oe]of Object.entries(se))R.examples[ae]=Oe}let P=new Set(this.operation.security?.flatMap(se=>Object.keys(se))??[]),M=this.authSchemeToHeaders(Array.from(P));M.length>0&&s.push(...M);for(let se of E){let ae=se.error,Oe=se.errorType,Ie=ae.error.errorId,Fe=se.examples;x[Ie]={name:ae.error,displayName:se.displayName,discriminantValue:{name:ae.error.name,wireValue:Ie},type:Oe,statusCode:se.statusCode,isWildcardStatusCode:se.isWildcardStatusCode,docs:ae.docs,examples:[],v2Examples:{userSpecifiedExamples:Fe??{},autogeneratedExamples:{}},headers:se.headers}}let J=this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],$=new xUt({context:this.context,breadcrumbs:this.breadcrumbs,document:this.context.spec}).convert(),oe=new xUt({context:this.context,breadcrumbs:this.breadcrumbs,document:this.operation}).convert()??$,de={displayName:this.operation.summary,subtitle:this.subtitle,method:t,baseUrl:O,v2BaseUrls:D,path:C,pathParameters:a,queryParameters:c,headers:s.filter((se,ae,Oe)=>ae===Oe.findIndex(Ie=>nr(Ie.name)===nr(se.name))),responseHeaders:g?.responseHeaders,sdkRequest:void 0,errors:v,auth:this.computeEndpointAuth(),security:this.computeEndpointSecurity(),availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:C,allPathParameters:a,pagination:void 0,transport:void 0,source:uD.openapi(),audiences:J,retries:void 0,globalParameters:this.globalParameterIds,apiPlayground:oe},we=this.context.namespace!=null?[this.context.namespace]:[],De=r?.map(se=>ti(se));return we.push(...De??[]),{audiences:J,group:r,groupDisplayName:i,groupDescription:o,errors:x,endpoint:{...de,id:`endpoint_${we.join("/")}.${n}`,name:this.context.casingsGenerator.generateName(n),requestBody:p,v2RequestBodies:m,response:A,docs:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:R.examples},v2Responses:{responses:g?.v2Responses}},streamEndpoint:y!=null&&y.body!=null?{...de,id:`endpoint_${we.join("/")}.${n}_stream`,name:this.context.casingsGenerator.generateName(`${n}_stream`),requestBody:d,v2RequestBodies:void 0,response:y,docs:this.streamingExtension?.type==="streamCondition"?this.streamingExtension.streamDescription??this.operation.description:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:R.streamExamples},v2Responses:{responses:[{statusCode:200,isWildcardStatusCode:void 0,body:y.body,docs:y.docs}]}}:void 0,inlinedTypes:this.inlinedTypes,servers:this.filterOutTopLevelServers(this.operation.servers??this.pathLevelServers??[]),inlinedRequestPropertiesByAudience:f,queryParametersByAudience:u}}collectQueryParameterAudiences({breadcrumbs:t}){let r=this.mergeParameters(this.pathItemParameters,this.operation.parameters??[]);if(r.length===0)return;let n={},i=!1;for(let o of r){let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:t,skipErrorCollector:!0});if(s==null||s.in!=="query")continue;let a=this.context.getAudiences({operation:s,breadcrumbs:t})??[];if(a.length!==0){i=!0;for(let c of a)n[c]==null&&(n[c]=new Set),n[c].add(s.name)}}return i?n:void 0}convertResponseBody({breadcrumbs:t,group:r,method:n,streamingExtension:i}){if(this.operation.responses==null)return;let o,s=!1,a=!1;for(let[c,u]of Object.entries(this.operation.responses)){let l=/^[45]XX$/i.test(c),p,d=!1;if(l)p=parseInt(c.charAt(0))*100,d=!0;else{if(p=parseInt(c),isNaN(p)||p<200||p>=300&&p<400)continue;d=p>=400&&p<600}if(o==null&&(o={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{},responseHeaders:[]}),p>=200&&p<300){let f=this.context.resolveMaybeReference({schemaOrReference:u,breadcrumbs:[...t,c]});if(f==null)continue;let g=new CUt({context:this.context,breadcrumbs:[...t,c],responseBody:f,group:r??[],method:n,statusCode:c,streamingExtension:i}).convert();if(g==null){a=!0,o.response==null&&(o.response={statusCode:p,isWildcardStatusCode:l?!0:void 0,body:void 0,docs:f.description});continue}g!=null&&(this.inlinedTypes={...this.inlinedTypes,...g.inlinedTypes},s||(s=!0,o.response={statusCode:p,isWildcardStatusCode:l?!0:void 0,body:g.responseBody,docs:f.description},o.streamResponse={statusCode:p,isWildcardStatusCode:l?!0:void 0,body:g.streamResponseBody,docs:f.description},g.headers!=null&&(o.responseHeaders=g.headers)),o.v2Responses=[...o.v2Responses??[],{statusCode:p,isWildcardStatusCode:l?!0:void 0,body:g.responseBody,docs:f.description}])}if(d){let f=this.context.resolveMaybeReference({schemaOrReference:u,breadcrumbs:[...t,c]});if(f==null)continue;let g=new M5r({context:this.context,breadcrumbs:[...t,c],responseError:f,group:r??[],method:n,methodName:this.evaluateMethodNameFromOperation(),statusCode:p,isWildcardStatusCode:l?!0:void 0}).convert();g!=null&&(this.inlinedTypes={...this.inlinedTypes,...g.inlinedTypes},o.errors.push(g))}}if(this.streamingExtension!=null){o==null&&(o={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{},responseHeaders:[]});let u=new CUt({context:this.context,breadcrumbs:[...t,"stream"],responseBody:{description:""},group:r??[],method:n,statusCode:"stream",streamingExtension:i}).convert();u!=null&&(this.inlinedTypes={...this.inlinedTypes,...u.inlinedTypes},o.response={statusCode:200,isWildcardStatusCode:void 0,body:u.responseBody,docs:void 0},o.streamResponse={statusCode:200,isWildcardStatusCode:void 0,body:u.streamResponseBody,docs:void 0},o.v2Responses=[{statusCode:200,isWildcardStatusCode:void 0,body:u.responseBody,docs:void 0}])}if(a&&s&&o?.response?.body!=null){let c=o.response.body;if(c.type==="json"&&c.value.type==="response"){let u=c.value.responseBodyType;(u.type!=="container"||u.container.type!=="optional")&&(o.response={...o.response,body:Cu.json(NE.response({...c.value,responseBodyType:Jr.container(gs.optional(u))}))})}}return o}computeEndpointAuth(){return this.operation.security!=null&&this.operation.security.length===0?!1:this.operation.security!=null&&this.operation.security.length>0?!0:this.context.spec.security!=null&&this.context.spec.security.length>0||this.shouldApplyDefaultAuthOverrides()}computeEndpointSecurity(){return this.operation.security!=null&&this.operation.security.length===0?[]:this.context.authOverrides?.auth!=null&&!this.usesEndpointSecurity()?this.getDefaultSecurityFromAuthOverrides():CNo(this.operation.security??this.context.spec.security)}usesEndpointSecurity(){let t=this.context.authOverrides?.auth;return t!=null&&HJe(t)}shouldApplyDefaultAuthOverrides(){if(!this.context.authOverrides?.auth||this.usesEndpointSecurity())return!1;let t=this.context.spec.security!=null&&this.context.spec.security.length>0,r=this.operation.security!=null&&this.operation.security.length>0;return!(t||r)}getDefaultSecurityFromAuthOverrides(){if(!this.context.authOverrides?.auth)return;let t=this.context.authOverrides.auth;if(typeof t=="string"){let r={};return r[t]=[],[r]}if(typeof t=="object"&&"any"in t){let r=t.any;if(Array.isArray(r))return r.map(n=>{let i=typeof n=="string"?n:n.scheme,o={};return o[i]=[],o})}}authSchemeToHeaders(t){let r=[];for(let n of t){let i=this.idToAuthScheme?.[n];if(i==null)continue;let o={valueType:Ji.STRING,availability:void 0,docs:void 0,env:void 0,v2Examples:void 0,clientDefault:void 0,defaultValue:void 0};switch(i.type){case"bearer":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...o});break;case"basic":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...o});break;case"header":r.push({name:i.name,...o});break}}return r}convertExamples({httpPath:t,httpMethod:r,baseUrl:n}){let o=new Q5r({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert()??[],a=new N5r({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert()??[],u=o.some(l=>Array.isArray(l["code-samples"])&&l["code-samples"].length>0)?o:[...o,...a];return u.length===0?{examples:{},streamExamples:{}}:this.streamingExtension?.type==="streamCondition"?this.convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:u}):{examples:this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:u}),streamExamples:{}}}synthesizeEndpointExamplesFromNativeRequestBody({httpPath:t,httpMethod:r,baseUrl:n}){if(this.operation.requestBody==null)return;let i=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:[...this.breadcrumbs,"requestBody"]});if(i==null)return;let o=this.extractNativeResponseExample(),s={};for(let[,a]of Object.entries(i.content)){if(a.schema!=null)continue;let c=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:a,breadcrumbs:[...this.breadcrumbs,"requestBody"],defaultExampleName:"Example"});for(let[u,l]of c){let p=this.context.resolveExampleWithValue(l);p!=null&&(s[u]={displayName:void 0,contentType:void 0,request:{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,{})},baseUrl:void 0,environment:n,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:p},response:o,codeSamples:void 0})}}return Object.keys(s).length>0?s:void 0}extractNativeResponseExample(){if(this.operation.responses!=null)for(let[t,r]of Object.entries(this.operation.responses)){let n=parseInt(t);if(isNaN(n)||n<200||n>=300)continue;let i=this.context.resolveMaybeReference({schemaOrReference:r,breadcrumbs:[...this.breadcrumbs,"responses",t]});if(i?.content!=null)for(let[,o]of Object.entries(i.content)){let s=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:o,breadcrumbs:[...this.breadcrumbs,"responses",t],defaultExampleName:"Example"});for(let[,a]of s){let c=this.context.resolveExampleWithValue(a);if(c!=null)return{docs:void 0,statusCode:n,body:Ut.V2HttpEndpointResponseBody.json(c)}}}}}synthesizeEndpointExamplesFromPerContentTypeRequestBodies({convertedRequestBodies:t,httpPath:r,httpMethod:n,baseUrl:i}){let o={},s=this.extractNativeResponseExamplesByContentType();for(let a of t){let c=a.requestBody,u=c.contentType,l=c.v2Examples;if(l==null)continue;let p=l.userSpecifiedExamples;if(Object.keys(p).length===0)continue;let d=u!=null?s.get(u):void 0;for(let[f,m]of Object.entries(p)){let g=t.length>1&&u!=null?`${f} (${u})`:f;o[g]={displayName:t.length>1?g:void 0,contentType:u??void 0,request:{docs:void 0,endpoint:{method:n,path:this.buildExamplePath(r,{})},baseUrl:void 0,environment:i,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:m},response:d??this.extractNativeResponseExample()??void 0,codeSamples:void 0}}}return Object.keys(o).length>0?o:void 0}extractNativeResponseExamplesByContentType(){let t=new Map;if(this.operation.responses==null)return t;for(let[r,n]of Object.entries(this.operation.responses)){let i=parseInt(r);if(isNaN(i)||i<200||i>=300)continue;let o=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:[...this.breadcrumbs,"responses",r]});if(o?.content!=null)for(let[s,a]of Object.entries(o.content)){if(t.has(s))continue;let c=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:a,breadcrumbs:[...this.breadcrumbs,"responses",r],defaultExampleName:"Example"});for(let[,u]of c){let l=this.context.resolveExampleWithValue(u);if(l!=null){t.set(s,{docs:void 0,statusCode:i,body:Ut.V2HttpEndpointResponseBody.json(l)});break}}}}return t}convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:i}){let o=i.filter(u=>!(u.response!=null&&"stream"in u.response)),s=i.filter(u=>u.response!=null&&"stream"in u.response),a=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:o}),c=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:s});return{examples:a,streamExamples:c}}convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:i}){return Object.fromEntries(i.map((o,s)=>[this.getExampleName({example:o,exampleIndex:s}),{displayName:void 0,contentType:void 0,request:o.request!=null||o["path-parameters"]!=null||o["query-parameters"]!=null||o.headers!=null?{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,o["path-parameters"]??{})},baseUrl:void 0,environment:n,auth:void 0,pathParameters:o["path-parameters"]??{},queryParameters:o["query-parameters"]??{},headers:o.headers??{},requestBody:o.request??void 0}:void 0,response:o.response!=null?{docs:void 0,statusCode:void 0,body:this.getExampleResponseBody({example:o})}:void 0,codeSamples:o["code-samples"]?.map(a=>{let c=("language"in a?a.language:a.sdk)??void 0;return{name:a.name,docs:void 0,language:c,code:a.code}})}]))}getExampleName({example:t,exampleIndex:r}){return t.name??t["code-samples"]?.[0]?.name??`Example_${r}`}getExampleResponseBody({example:t}){if(t.response!=null){if("stream"in t.response)return Ut.V2HttpEndpointResponseBody.stream(t.response.stream);if("body"in t.response)return Ut.V2HttpEndpointResponseBody.json(t.response.body)}}getEndpointBaseUrl(){let r=new ux.ServerFromOperationNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert();if(r!=null)return this.context.logger.debug(`[getEndpointBaseUrl] Endpoint ${this.method.toUpperCase()} ${this.path} specifies a server with "${mn.SERVER_NAME_V2}" extension. Returning server type: ${r}`),r;let n=this.operation.servers?.[0]??this.pathLevelServers?.[0];if(n==null)return;let o=this.topLevelServers?.find(s=>s.url===n.url)??n;return C3.getServerName({server:o,context:this.context})}getEndpointBaseUrls(){if(new ux.ServerFromOperationNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()!=null)return;let n=this.operation.servers??this.pathLevelServers;return n?.map(o=>{let a=this.topLevelServers?.find(c=>c.url===o.url)??o;return C3.getServerName({server:a,context:this.context})})}buildExamplePath(t,r){return t.head+t.parts.map(n=>`${r[n.pathParameter]?.toString()??n.pathParameter}${n.tail}`).join("")}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers?.some(n=>n.url===r.url))}getGroupDisplayName(t){let r=this.operation.tags?.[0];r!=null&&(r=this.context.getDisplayNameForTag(r));let n=t?.[t.length-1];if(n!=null&&r!=null)return r.toLowerCase().replaceAll(" ","")===n?r:void 0}getGroupDescription(t){let r=this.operation.tags?.[0],n=t?.[t.length-1];if(!(r==null||n==null)&&ti(r)===ti(n))return this.context.getDescriptionForTag(r)}}});var jNo,V5r,BOu=h(()=>{"use strict";Uo();jNo=be(Qjt(),1);dOu();mOu();hOu();AOu();yOu();bOu();EOu();POu();RNo();V5r=class extends Ji{pathItem;path;idToAuthScheme;topLevelServers;declaredGlobalParameterIds;constructor({context:t,breadcrumbs:r,pathItem:n,path:i,idToAuthScheme:o,topLevelServers:s,declaredGlobalParameterIds:a}){super({context:t,breadcrumbs:r}),this.pathItem=n,this.path=i,this.idToAuthScheme=o,this.topLevelServers=s,this.declaredGlobalParameterIds=a}convert(){let t=[],r=[],n={};for(let i of fOu){let o=this.pathItem[i];if(o==null)continue;let s=[...this.breadcrumbs,i],a=this.tryParseAsWebhook({operationBreadcrumbs:s,operation:o,method:i,context:this.context});if(a!=null){r.push(a),Object.assign(n,a.inlinedTypes);continue}let u=new R5r({breadcrumbs:s,document:this.context.spec,operation:o,context:this.context}).convert();u==null&&this.operationHasTextEventStreamResponse(o)&&(u={type:"stream",format:"sse",terminator:void 0,resumable:NNo(this.context.spec)??!1});let l=this.tryParseAsHttpEndpoint({operationBreadcrumbs:s,operation:o,method:i,streamingExtension:u});l!=null&&(t.push(l),Object.assign(n,l.inlinedTypes))}return{endpoints:t,webhooks:r,inlinedTypes:n}}tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:n,context:i}){return new F5r({breadcrumbs:n,operation:t,context:i}).convert()?new Dit({context:this.context,breadcrumbs:n,operation:t,method:jNo.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,pathItemParameters:this.pathItem.parameters}).convert():void 0}operationHasTextEventStreamResponse(t){if(t.responses==null)return!1;for(let[r,n]of Object.entries(t.responses)){let i=parseInt(r);if(isNaN(i)||i<200||i>=300)continue;let o=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:this.breadcrumbs});if(o?.content==null)continue;let s=Object.keys(o.content);if(s.length===1&&s[0]?.includes("text/event-stream"))return!0}return!1}tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:n,streamingExtension:i}){new D5r({breadcrumbs:n,operation:t,document:this.context.spec,context:this.context}).convert()!=null;let c=new B5r({breadcrumbs:n,operation:t,context:this.context}).convert(),l=new k5r({breadcrumbs:n,operation:t,context:this.context}).convert(),d=new P5r({breadcrumbs:n,operation:t,context:this.context}).convert();if(d!=null&&this.declaredGlobalParameterIds!=null){let m=[];for(let g of d)this.declaredGlobalParameterIds.has(g)?m.push(g):this.context.errorCollector.collect({message:`x-fern-global-parameter references undeclared global parameter '${g}'. Declared parameters: ${[...this.declaredGlobalParameterIds].join(", ")}`,path:[...n,"x-fern-global-parameter"]});d=m.length>0?m:void 0}return new L5r({context:this.context,breadcrumbs:n,operation:t,method:jNo.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,pathItemParameters:this.pathItem.parameters,idempotent:c,subtitle:l,globalParameterIds:d,idToAuthScheme:this.idToAuthScheme,topLevelServers:this.topLevelServers,pathLevelServers:this.pathItem.servers,streamingExtension:i}).convert()}}});var U5r,DOu=h(()=>{"use strict";_n();Uo();U5r=class extends Ji{securityScheme;schemeId;constructor({context:t,breadcrumbs:r,securityScheme:n,schemeId:i}){super({context:t,breadcrumbs:r}),this.securityScheme=n,this.schemeId=i}getExtension(t){return this.securityScheme[t]}convert(){let t=this.getExtension("x-fern-playground-description");switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme?.toLowerCase()==="bearer"){let r=this.getExtension("x-fern-bearer"),n=r?.name??"token",i=r?.env,o=r?.placeholder;return Sp.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName(n),tokenEnvVar:i,tokenPlaceholder:o,docs:this.securityScheme.description,playgroundDocs:t})}if(this.securityScheme.scheme?.toLowerCase()==="basic"){let r=this.getExtension("x-fern-basic"),n=r?.username?.name??"username",i=r?.password?.name??"password",o=r?.username?.env,s=r?.password?.env,a=r?.username?.placeholder,c=r?.password?.placeholder;return Sp.basic({key:this.schemeId,username:this.context.casingsGenerator.generateName(n),password:this.context.casingsGenerator.generateName(i),usernameEnvVar:o,passwordEnvVar:s,usernameOmit:!1,passwordOmit:!1,usernamePlaceholder:a,passwordPlaceholder:c,docs:this.securityScheme.description,playgroundDocs:t})}break}case"apiKey":{if(this.securityScheme.in==="header"){let r=this.getExtension("x-fern-header"),n=r?.name??"apiKey",i=r?.env,o=r?.prefix,s=r?.placeholder;return Sp.header({key:this.schemeId,name:{name:this.context.casingsGenerator.generateName(n),wireValue:this.securityScheme.name},valueType:Ji.OPTIONAL_STRING,prefix:o,headerEnvVar:i,headerPlaceholder:s,docs:this.securityScheme.description,playgroundDocs:t})}break}case"oauth2":return Sp.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,tokenPlaceholder:void 0,docs:this.securityScheme.description,playgroundDocs:t})}}}});function fim(e){if(e!=null){if(typeof e=="string")return w0.string(e);if(typeof e=="boolean")return w0.boolean(e)}}var ROu,wUt,kOu=h(()=>{"use strict";lo();_n();tc();TW();Uo();ROu=be(Qjt(),1);eOu();tOu();rOu();nOu();oOu();aOu();uOu();RNo();BOu();DOu();wUt=class extends kH{constructor({breadcrumbs:t,context:r,audiences:n}){super({breadcrumbs:t,context:r,audiences:n})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.context.spec=zjt({document:this.context.spec,options:this.context.settings,logger:this.context.logger}),xNo({spec:this.context.spec,errorCollector:this.context.errorCollector}),this.overrideOpenApiAuthWithGeneratorsAuth(),this.convertSecuritySchemes(),this.convertGlobalHeaders(),this.convertGlobalParameters(),this.convertBasePath(),this.convertSchemas(),this.convertWebhooks();let{endpointLevelServers:t,errors:r}=this.convertPaths();this.addErrorsToIr(r);let{defaultUrl:n}=this.convertServers({endpointLevelServers:t});this.updateEndpointsWithDefaultUrl(n);let i=this.context.spec.info?.title?.trim();return i&&i!=='""'&&(this.ir.apiDisplayName=i),this.finalizeIr()}convertGlobalHeaders(){if(this.context.globalHeaderOverrides){let n=iOu({globalHeaderOverrides:this.context.globalHeaderOverrides,context:this.context});this.addGlobalHeadersToIr(n),this.context.setGlobalHeaders(n);return}let r=new w5r({breadcrumbs:["x-fern-global-headers"],document:this.context.spec,context:this.context}).convert();if(r!=null){let n=sOu({globalHeaders:r,context:this.context});this.addGlobalHeadersToIr(n),this.context.setGlobalHeaders(n)}}convertGlobalParameters(){let r=new S5r({breadcrumbs:["x-fern-global-parameters"],document:this.context.spec,context:this.context}).convert();if(r!=null){let n=cOu({globalParameters:r,context:this.context});if(this.ir.globalParameters=n,this.ir.headers.length>0){let i=new Set(this.ir.headers.map(o=>{let s=o.name;return(typeof s=="string"?s:s.wireValue).toLowerCase()}));for(let o of r){let s=(o.target??o.name).toLowerCase();o.in==="header"&&i.has(s)&&this.context.logger.warn(`Global parameter "${o.name}" (in: header, target: "${o.target??o.name}") overlaps with an x-fern-global-headers entry. The x-fern-global-parameters definition takes precedence.`)}}}}convertBasePath(){let r=new x5r({breadcrumbs:["x-fern-base-path"],document:this.context.spec,context:this.context}).convert();if(r!=null){this.ir.basePath=M0(r.path);for(let n of r.parameters)n.type!=="string"&&this.context.errorCollector.collect({message:`x-fern-base-path parameter '${n.name}' uses type '${n.type}' which is not yet supported; treating as string`,path:["x-fern-base-path","parameters",n.name]}),this.ir.pathParameters.push({name:this.context.casingsGenerator.generateName(n.name),valueType:Ji.STRING,docs:n.docs,location:Ut.PathParameterLocation.Root,variable:void 0,clientDefault:fim(n.default),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},explode:void 0});if(r.pathsIncludeBasePath){let n=jjt({openApi:this.context.spec,basePath:r.path,rootPathParameterNames:new Set(r.parameters.map(i=>i.name))});for(let i of n)this.context.errorCollector.collect({message:i,path:["x-fern-base-path","paths-include-base-path"]})}}}convertSecuritySchemes(){let t=this.convertOpenApiSecuritySchemes();if(this.context.authOverrides){let r=new Map(t.map(n=>[n.key,n.docs]));this.convertAuthOverrides(r,this.context.authOverrides);return}t.length>0&&this.addAuthToIR({requirement:t.length===1?"ALL":"ANY",schemes:t,docs:void 0})}convertAuthOverrides(t,r){let n={...r,"auth-schemes":Object.fromEntries(Object.entries(r["auth-schemes"]??{}).map(([o,s])=>[o,{...s}]))};for(let[o,s]of Object.entries(n["auth-schemes"]))!s.docs&&t.has(o)&&(s.docs=t.get(o));let i=R3t({rawApiFileSchema:n,casingsGenerator:this.context.casingsGenerator});this.addAuthToIR({requirement:i.requirement,schemes:i.schemes,docs:i.docs})}convertOpenApiSecuritySchemes(){let t=[];for(let[r,n]of Object.entries(this.context.spec.components?.securitySchemes??{})){let i=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:["components","securitySchemes",r]});if(i==null)continue;let s=new U5r({context:this.context,breadcrumbs:["components","securitySchemes",r],securityScheme:i,schemeId:r}).convert();s!=null&&t.push(s)}return t}convertServers({endpointLevelServers:t}){let n=new C5r({breadcrumbs:["x-fern-base-url-env"],document:this.context.spec,context:this.context}).convert();if(this.context.environmentOverrides){let s=k3t({rawApiFileSchema:this.context.environmentOverrides,casingsGenerator:this.context.casingsGenerator});return s!=null&&this.addEnvironmentsToIr({environmentConfig:{...s.environmentsConfig,baseUrlEnvVar:s.environmentsConfig.baseUrlEnvVar??n},audiences:s.audiences}),{defaultUrl:this.context.environmentOverrides["default-url"]}}let o=new C3({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t,baseUrlEnvVar:n}).convert();return this.addEnvironmentsToIr({environmentConfig:o?.value}),{defaultUrl:o?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let i=new wm.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();i!=null&&this.addSchemaOutputToIr(t,i)}}convertWebhooks(){for(let[t,r]of Object.entries(this.context.spec.webhooks??{})){if(r==null){this.context.errorCollector.collect({message:"Skipping empty webhook",path:this.breadcrumbs});continue}if(!("post"in r)||r.post==null){this.context.errorCollector.collect({message:"Skipping webhook as it is not a POST method",path:this.breadcrumbs});continue}let n=r.post.operationId??t,i=r.post.operationId!=null?r.post:{...r.post,operationId:n},s=new Dit({context:this.context,breadcrumbs:["webhooks",n],operation:i,method:ROu.OpenAPIV3.HttpMethods.POST,path:n}).convert();s!=null&&(this.addWebhookToIr({webhook:s.webhook,operationId:n,audiences:s.audiences,group:s.group,inlinedPayloadPropertiesByAudience:s.inlinedPayloadPropertiesByAudience}),this.addTypesToIr(s.inlinedTypes))}}convertPaths(){let t=[],r={},n=this.ir.globalParameters!=null?new Set(this.ir.globalParameters.map(i=>i.id)):void 0;for(let[i,o]of Object.entries(this.context.spec.paths??{})){if(o==null)continue;let a=new V5r({context:this.context,breadcrumbs:["paths",i],topLevelServers:this.context.spec.servers,pathItem:o,path:i,declaredGlobalParameterIds:n}).convert();if(a!=null){for(let c of a.endpoints){if(c.streamEndpoint!=null&&this.addEndpointToIr({endpoint:c.streamEndpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName,endpointGroupDescription:c.groupDescription,inlinedRequestPropertiesByAudience:c.inlinedRequestPropertiesByAudience,queryParametersByAudience:c.queryParametersByAudience}),this.addEndpointToIr({endpoint:c.endpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName,endpointGroupDescription:c.groupDescription,inlinedRequestPropertiesByAudience:c.inlinedRequestPropertiesByAudience,queryParametersByAudience:c.queryParametersByAudience}),c.servers)for(let u of c.servers)this.shouldAddServerToCollectedServers({server:u,currentServers:t})&&t.push(u);if(c.errors)for(let[u,l]of Object.entries(c.errors))r[u]=l}for(let c of a.webhooks){let u=this.context.getGroup({groupParts:c.group,namespace:this.context.namespace});this.addWebhookToIr({webhook:c.webhook,operationId:u.join("."),group:u,audiences:c.audiences,inlinedPayloadPropertiesByAudience:c.inlinedPayloadPropertiesByAudience})}this.addTypesToIr(a.inlinedTypes)}}return{endpointLevelServers:t,errors:r}}overrideOpenApiAuthWithGeneratorsAuth(){if(!this.context.authOverrides?.["auth-schemes"])return;let t=this.context.authOverrides.auth;if(t!=null&&HJe(t))return;let r={};for(let n of Object.keys(this.context.authOverrides["auth-schemes"]))r[n]=[];this.context.spec.security=[r],this.removeEndpointSpecificAuth()}removeEndpointSpecificAuth(){if(this.context.spec.paths)for(let t of Object.values(this.context.spec.paths)){if(!t)continue;let r=["get","post","put","patch","delete","options","head","trace"];for(let n of r){let i=t[n];i?.security!=null&&i.security.length>0&&delete i.security}}}}});var _5r,FOu=h(()=>{"use strict";Uo();_5r=class extends Yo{tag;key="x-displayName";constructor({breadcrumbs:t,tag:r,context:n}){super({breadcrumbs:t,context:n}),this.tag=r}convert(){if(typeof this.tag!="object"||this.tag==null)return;let t=this.tag[this.key];if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"x-displayName extension must be a string",path:this.breadcrumbs});return}if(t.trim().length!==0)return{displayName:t}}}}});var ode,NOu=h(()=>{"use strict";_n();tc();Uo();FOu();ode=class extends Wb{globalHeaderNames;tagToDisplayName={};tagToDescription=new Map;tagDescriptionsIndexed=!1;isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let o=this.getTypeIdFromSchemaReference(t);if(o==null)return{ok:!1};let s=t.$ref.split("/").pop()??o,a=this.resolveReference({reference:t,breadcrumbs:r});if(!a.resolved)return{ok:!1};let c;i==="reference_identifier"?c=n??a.value.title:i==="discriminator_key"?c=a.value.title??n:c=a.value.title??s;let u;if(o.includes("/")){let p=new wm.SchemaConverters.SchemaConverter({context:this,breadcrumbs:r??[],schema:a.value,id:o}).convert();p!=null&&(u={[o]:p.convertedSchema})}return{ok:!0,reference:Jr.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(s),typeId:o,default:void 0,inline:!1,displayName:c}),inlinedTypes:u}}setGlobalHeaders(t){this.globalHeaderNames=t.map(r=>nr(r.name))}getDisplayNameForTag(t){if(Object.keys(this.tagToDisplayName).length===0)for(let r of this.spec.tags??[]){let i=new _5r({breadcrumbs:["tags",r.name],tag:r,context:this}).convert()?.displayName??r.name;this.tagToDisplayName[r.name]=i}return this.tagToDisplayName[t]??t}getDescriptionForTag(t){if(!this.tagDescriptionsIndexed){this.tagDescriptionsIndexed=!0;for(let r of this.spec.tags??[])r.description!=null&&r.description.trim().length>0&&this.tagToDescription.set(r.name,r.description)}return this.tagToDescription.get(t)}}});function zNo({ir:e,authOverrides:t}){if(!t["auth-schemes"]||!e.auth)return e;let r=t["auth-schemes"],n=[];for(let i of e.auth.schemes){if(i.type!=="bearer"){n.push(i);continue}let o=r[i.key];if(o==null){n.push(i);continue}let s=vle(o,{header:()=>{},basic:()=>{},tokenBearer:()=>{},inferredBearer:()=>{},oauth:a=>mim({ir:e,key:i.key,oauthScheme:a})});n.push(s??i)}return{...e,auth:{...e.auth,schemes:n}}}function mim({ir:e,key:t,oauthScheme:r}){if(r.type!=="client-credentials")return;let n=r["get-token"];if(n==null)return;let i=jOu({ir:e,endpointRef:n.endpoint});if(i==null)return;let{endpoint:o,serviceId:s,subpackageId:a}=i,c=n["request-properties"],u=n["response-properties"],l=QNo({ir:e,endpoint:o,wireValue:jH(c?.["client-id"],"client_id")}),p=QNo({ir:e,endpoint:o,wireValue:jH(c?.["client-secret"],"client_secret")}),d=Rit({ir:e,endpoint:o,wireValue:jH(u?.["access-token"],"access_token")});if(!(l==null||p==null||d==null))return Sp.oauth({key:t,docs:r.docs,playgroundDocs:r["playground-docs"],configuration:aD.clientCredentials({clientIdEnvVar:r["client-id-env"],clientSecretEnvVar:r["client-secret-env"],tokenPrefix:r["token-prefix"],tokenHeader:r["token-header"],scopes:r.scopes,tokenEndpoint:{endpointReference:{endpointId:o.id,serviceId:s,subpackageId:a},requestProperties:{clientId:l,clientSecret:p,scopes:void 0,customProperties:Aim({ir:e,endpoint:o,excludeWireValues:[jH(c?.["client-id"],"client_id"),jH(c?.["client-secret"],"client_secret")]})},responseProperties:{accessToken:d,expiresIn:Rit({ir:e,endpoint:o,wireValue:jH(u?.["expires-in"],"expires_in")}),refreshToken:Rit({ir:e,endpoint:o,wireValue:jH(u?.["refresh-token"],"refresh_token")})}},refreshEndpoint:r["refresh-token"]!=null?him({ir:e,refreshTokenConfig:r["refresh-token"]}):void 0})})}function him({ir:e,refreshTokenConfig:t}){let r=jOu({ir:e,endpointRef:t.endpoint});if(r==null)return;let{endpoint:n,serviceId:i,subpackageId:o}=r,s=t["request-properties"],a=t["response-properties"],c=QNo({ir:e,endpoint:n,wireValue:jH(s?.["refresh-token"],"refresh_token")}),u=Rit({ir:e,endpoint:n,wireValue:jH(a?.["access-token"],"access_token")});if(!(c==null||u==null))return{endpointReference:{endpointId:n.id,serviceId:i,subpackageId:o},requestProperties:{refreshToken:c},responseProperties:{accessToken:u,expiresIn:Rit({ir:e,endpoint:n,wireValue:jH(a?.["expires-in"],"expires_in")}),refreshToken:Rit({ir:e,endpoint:n,wireValue:jH(a?.["refresh-token"],"refresh_token")})}}}function jOu({ir:e,endpointRef:t}){let r=t.trim().split(/\s+/);if(r.length!==2)return;let n=dim[r[0]?.toUpperCase()??""],i=r[1]?.replace(/\/+$/,"");if(!(n==null||i==null))for(let[o,s]of Object.entries(e.services))for(let a of s.endpoints){if(a.method!==n)continue;if(gim(a.fullPath)===i){let u=Object.entries(e.subpackages).find(([,l])=>l.service===o)?.[0];return{endpoint:a,serviceId:o,subpackageId:u}}}}function gim(e){let t=e.head;for(let r of e.parts)t+=`{${r.pathParameter}}${r.tail}`;return t.replace(/\/+$/,"")}function jH(e,t){return e==null?t:e.match(/^\$(?:request|response)\.(.+)$/)?.[1]??e}function QOu(e,t){return e.find(r=>nr(r.name)===t)}function MNo(e,t){let r=e.types[t];if(r?.shape.type==="object")return r.shape.properties}function QNo({ir:e,endpoint:t,wireValue:r}){if(t.requestBody==null)return;let n;t.requestBody.type==="inlinedRequestBody"?n=t.requestBody.properties.map(o=>({...o,xml:void 0})):t.requestBody.type==="reference"&&t.requestBody.requestBodyType.type==="named"&&(n=MNo(e,t.requestBody.requestBodyType.typeId));let i=n!=null?QOu(n,r):void 0;if(i!=null)return{propertyPath:void 0,property:oP.body({...i})}}function Aim({ir:e,endpoint:t,excludeWireValues:r}){if(t.requestBody==null)return;let n;if(t.requestBody.type==="inlinedRequestBody"?n=t.requestBody.properties.map(s=>({...s,xml:void 0})):t.requestBody.type==="reference"&&t.requestBody.requestBodyType.type==="named"&&(n=MNo(e,t.requestBody.requestBodyType.typeId)),n==null)return;let i=new Set(r),o=n.filter(s=>!i.has(nr(s.name))).map(s=>({propertyPath:void 0,property:oP.body({...s})}));return o.length>0?o:void 0}function Rit({ir:e,endpoint:t,wireValue:r}){if(t.response?.body?.type!=="json")return;let n=t.response.body.value.responseBodyType;if(n.type!=="named")return;let i=MNo(e,n.typeId),o=i!=null?QOu(i,r):void 0;if(o!=null)return{propertyPath:void 0,property:o}}var dim,zOu=h(()=>{"use strict";lo();_n();tc();dim={GET:am.Get,POST:am.Post,PUT:am.Put,PATCH:am.Patch,DELETE:am.Delete}});var G5r=h(()=>{"use strict";kOu();NOu();zOu()});var yim,bim,Eim,q5r,MOu=h(()=>{"use strict";wt();Uo();jn();yim=Be.object({description:Be.string().optional(),required:Be.boolean().optional(),deprecated:Be.boolean().optional(),allowEmptyValue:Be.boolean().optional(),style:Be.string().optional(),explode:Be.boolean().optional(),allowReserved:Be.boolean().optional(),schema:Be.any().optional(),example:Be.any().optional(),examples:Be.record(Be.string(),Be.any()).optional(),content:Be.record(Be.string(),Be.any()).optional()}),bim=yim.extend({name:Be.string(),in:Be.string()}),Eim=Be.array(bim),q5r=class extends Yo{operation;key="x-fern-parameters";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null)try{return Eim.parse(t)}catch(r){this.context.errorCollector.collect({message:`Failed to parse x-fern-parameters extension: ${Fn(r)}`,path:this.breadcrumbs});return}}}});var W5r,LOu=h(()=>{"use strict";_n();tc();Uo();W5r=class extends Ji{method;pathParameters;queryParameters;headers;topLevelServers;constructor({context:t,breadcrumbs:r,method:n,pathParameters:i=[],queryParameters:o=[],headers:s=[],topLevelServers:a=[]}){super({context:t,breadcrumbs:r}),this.method=n,this.pathParameters=i,this.queryParameters=o,this.headers=s,this.topLevelServers=a}convert(){let t={},r="";for(let u of this.pathParameters)r+=`/{${zr(u.name)}}`;let n=M0(r),i=[];for(let[u,l]of this.method.params.entries()){let p;if(this.context.isReferenceObject(l)){let g=this.context.resolveReference({reference:l});if(g.resolved)p=g.value;else continue}else p=l;let d=[this.method.name,"Param",p.name].join("_"),m=new wm.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"Param",p.name],schemaIdOverride:d,context:this.context,schemaOrReference:p.schema,wrapAsOptional:!p.required}).convert();m!=null&&(i.push({docs:p.description,availability:this.context.getAvailability({node:l,breadcrumbs:[...this.breadcrumbs,"parameters"]}),name:this.context.casingsGenerator.generateNameAndWireValue({name:p.name,wireValue:p.name}),valueType:m.type,defaultValue:p.schema!=null&&typeof p.schema=="object"?p.schema.default:void 0,v2Examples:m.schema?.typeDeclaration.v2Examples,propertyAccess:void 0}),t={...m.inlinedTypes,...t,...m.schema!=null?{[d]:m.schema}:{}})}let o;if(this.method.result!=null){let u=this.context.resolveMaybeReference({schemaOrReference:this.method.result,breadcrumbs:[...this.breadcrumbs,"result"]});if(u!=null){let l=new wm.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"result"],context:this.context,schemaOrReference:u.schema}),p=[this.method.name,"Result"].join("_"),d=l.convert();d!=null&&(o={docs:u.description,v2Examples:d.schema?.typeDeclaration.v2Examples,responseBodyType:d.type},t={...d.inlinedTypes,...t,...d.schema!=null?{[p]:d.schema}:{}})}}let s=this.getEndpointBaseUrls(),a=this.context.getAudiences({operation:this.method,breadcrumbs:this.breadcrumbs})??[];return{endpoint:{baseUrl:void 0,v2BaseUrls:s,basePath:void 0,auth:!1,security:void 0,method:"POST",id:this.method.name,docs:this.method.description,name:this.context.casingsGenerator.generateName(this.method.name),headers:this.headers,displayName:this.method.name,subtitle:void 0,pathParameters:this.pathParameters,queryParameters:this.queryParameters,allPathParameters:this.pathParameters,path:n,fullPath:n,requestBody:i.length>0?ad.inlinedRequestBody({name:this.context.casingsGenerator.generateName([this.method.name,"Request"].join("_")),docs:void 0,properties:i,extends:[],extendedProperties:[],contentType:"application/json",extraProperties:!1,v2Examples:void 0}):void 0,v2RequestBodies:void 0,sdkRequest:void 0,response:o!=null?{body:Cu.json(NE.response(o)),statusCode:void 0,isWildcardStatusCode:void 0,docs:o.docs}:void 0,v2Responses:void 0,errors:[],idempotent:!1,pagination:void 0,userSpecifiedExamples:[],autogeneratedExamples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples(r)},transport:void 0,availability:void 0,source:uD.openrpc(),audiences:a,retries:void 0,globalParameters:void 0,apiPlayground:void 0,responseHeaders:[]},audiences:a,inlinedTypes:t,servers:this.filterOutTopLevelServers(this.method.servers??[])}}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers.some(n=>n.url===r.url))}getEndpointBaseUrls(){let t=this.method.servers;return t?.map(n=>{if(this.topLevelServers.find(a=>a.name===n.name&&a.url!==n.url)!=null)return n.url;let s=this.topLevelServers.find(a=>a.url===n.url)??n;return C3.getServerName({server:s,context:this.context})})}convertExamples(t){let r={},n={};for(let o of this.pathParameters){let s=Object.values(o.v2Examples?.userSpecifiedExamples??{})[0],a=Object.values(o.v2Examples?.autogeneratedExamples??{})[0],c=s!==void 0?s:a;c!==void 0&&(n[zr(o.name)]=c)}let i=0;if(this.method.examples&&this.method.examples.length>0){for(let o of this.method.examples??[]){let s;if(this.context.isReferenceObject(o)){let l=this.context.resolveReference({reference:o});if(l.resolved)s=l.value;else continue}else s=o;let a;if(s.result)if(this.context.isReferenceObject(s.result)){let l=this.context.resolveReference({reference:s.result});l.resolved&&(a=l.value)}else a=s.result;let c=s.name??`Example ${i+1}`,u=[];if(s.params&&Array.isArray(s.params)){u=[];for(let l of s.params)if(this.context.isReferenceObject(l)){let p=this.context.resolveReference({reference:l});if(p.resolved)u.push(p.value);else continue}else u.push(l)}r[c]={displayName:void 0,contentType:void 0,request:{docs:void 0,endpoint:{method:"POST",path:t},baseUrl:void 0,environment:void 0,auth:void 0,pathParameters:n,queryParameters:{},headers:{},requestBody:u.map(l=>l.value)??void 0},response:{docs:void 0,statusCode:void 0,body:a?.value?Ut.V2HttpEndpointResponseBody.json({jsonrpc:"2.0",id:s.examplePairedRequest?.id||"1",result:a.value}):void 0},codeSamples:[]}}++i}return r}}});var H5r,VOu=h(()=>{"use strict";Uo();H5r=class extends wm.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r,parameter:n})}convert(){let t,r={};if(this.parameter.schema!=null){let i=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert();i!=null&&(t=i.type,r=i.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}}});var SUt,UOu=h(()=>{"use strict";Uo();MOu();LOu();VOu();SUt=class extends kH{constructor({context:t,breadcrumbs:r,audiences:n}){super({context:t,breadcrumbs:r,audiences:n})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.convertSchemas();let{endpointLevelServers:t}=this.convertMethods(),{defaultUrl:r}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(r),this.finalizeIr()}convertServers({endpointLevelServers:t}){let n=new C3({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:n?.value}),{defaultUrl:n?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let i=new wm.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();i!=null&&this.addSchemaOutputToIr(t,i)}}convertMethods(){let t=[],n=new q5r({context:this.context,breadcrumbs:["methods"],operation:this.context.spec}).convert(),i=[],o=[],s=[];if(n&&n.length>0)for(let[c,u]of n.entries()){let p=new H5r({context:this.context,breadcrumbs:[...this.breadcrumbs,`x-fern-parameters[${c}]`],parameter:u}).convert();if(p!=null)switch(p.type){case"path":{i.push(p.parameter);break}case"query":{o.push(p.parameter);break}case"header":{s.push(p.parameter);break}}}let a=this.context.getGroup({groupParts:[],namespace:this.context.namespace});for(let c of this.context.spec.methods??[]){let u=this.context.resolveMaybeReference({schemaOrReference:c,breadcrumbs:["methods"]});if(u==null)continue;let p=new W5r({context:this.context,breadcrumbs:["methods"],method:u,pathParameters:i,queryParameters:o,headers:s,topLevelServers:this.context.spec.servers}).convert();if(p!=null&&(this.addEndpointToIr({endpoint:p.endpoint,audiences:p.audiences,endpointGroup:a,serviceName:"service_root"}),this.addTypesToIr(p.inlinedTypes),p.servers))for(let d of p.servers)this.shouldAddServerToCollectedServers({server:d,currentServers:t,specType:"openrpc"})&&t.push(this.maybeDeduplicateServerName(d))}return{endpointLevelServers:t}}maybeDeduplicateServerName(t){return this.context.spec.servers?.find(n=>n.name===t.name&&n.url!==t.url)?{...t,name:t.url}:t}}});var TUt,_Ou=h(()=>{"use strict";_n();Uo();TUt=class extends Wb{isReferenceObject(t){return t!=null&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let o=this.getTypeIdFromSchemaReference(t);if(o==null)return{ok:!1};let s=this.resolveReference({reference:t,breadcrumbs:r});if(!s.resolved)return{ok:!1};let a;if(i==="reference_identifier")a=n??s.value.title;else if(i==="discriminator_key")a=s.value.title??n;else{let c=t.$ref.split("/").pop()??o;a=s.value.title??c}return{ok:!0,reference:Jr.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(o),typeId:o,displayName:a,default:void 0,inline:!1})}}}});var GOu=h(()=>{"use strict";UOu();_Ou()});var qOu,WOu=h(()=>{"use strict";qOu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});function Iim(e){return typeof e=="string"&&qOu.test(e)}var LNo,HOu=h(()=>{"use strict";WOu();LNo=Iim});function KOu(e,t=0){return(qP[e[t+0]]+qP[e[t+1]]+qP[e[t+2]]+qP[e[t+3]]+"-"+qP[e[t+4]]+qP[e[t+5]]+"-"+qP[e[t+6]]+qP[e[t+7]]+"-"+qP[e[t+8]]+qP[e[t+9]]+"-"+qP[e[t+10]]+qP[e[t+11]]+qP[e[t+12]]+qP[e[t+13]]+qP[e[t+14]]+qP[e[t+15]]).toLowerCase()}var qP,JOu=h(()=>{"use strict";qP=[];for(let e=0;e<256;++e)qP.push((e+256).toString(16).slice(1))});function VNo(){return crypto.getRandomValues(vim)}var vim,YOu=h(()=>{"use strict";vim=new Uint8Array(16)});function xim(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():Cim(e,t,r)}function Cim(e,t,r){e=e||{};let n=e.random??e.rng?.()??VNo();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return KOu(n)}var YD,XOu=h(()=>{"use strict";YOu();JOu();YD=xim});var kit=h(()=>{"use strict";XOu();HOu()});async function UNo({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let n=(await(0,ZOu.readFile)(t)).toString(),i;try{i=JSON.parse(n)}catch{i=Ir.load(n)}let o=[];r!=null&&(Array.isArray(r)?o=r:o=[r]);let s=i;for(let a of o)s=await hit({absoluteFilePathToOverrides:a,context:e,data:s});return s}var ZOu,$Ou=h(()=>{"use strict";ZOu=require("fs/promises");Wo();K_r()});var ePu=h(()=>{"use strict";$Ou()});function WNo(){let e=K5r.default.platform(),t=K5r.default.arch(),r;switch(e){case"linux":r="Linux";break;case"darwin":r="Darwin";break;case"win32":r="Windows";break;default:throw new S({message:`Unsupported platform: ${e}`,code:S.Code.EnvironmentError})}let n;switch(t){case"x64":n="x86_64";break;case"arm64":n=e==="linux"?"aarch64":"arm64";break;default:throw new S({message:`Unsupported architecture: ${t}`,code:S.Code.EnvironmentError})}return{os:r,arch:n,extension:r==="Windows"?".exe":""}}function PUt(){let e=K5r.default.homedir();return Mt.of(qNo.default.join(e,Sim,Tim))}function Oim(){let{extension:e}=WNo(),t=PUt();return ze(t,ve.of(`${OUt}-${sde}${e}`))}function Pim(){let{extension:e}=WNo(),t=PUt();return ze(t,ve.of(`${OUt}${e}`))}function Bim(){let e=PUt();return ze(e,ve.of(`${OUt}.version`))}function Dim(){let e=PUt();return qNo.default.join(e,`${OUt}.lock`)}function Rim(){let{os:e,arch:t,extension:r}=WNo();return`${wim}/${sde}/${OUt}-${e}-${t}${r}`}async function rPu(e){try{return await(0,Hb.access)(e),!0}catch{return!1}}async function kim(e){let t=Dim(),r=Date.now()+tPu;for(;Date.now()<r;)try{return await(0,Hb.mkdir)(t,{recursive:!1}),GNo(t,e)}catch{e.debug(`Waiting for buf lock on ${t}...`),await new Promise(n=>setTimeout(n,_No))}e.debug(`Buf lock timed out after ${tPu}ms, breaking stale lock`);try{await(0,Hb.rm)(t,{recursive:!0})}catch(n){e.debug(`Failed to remove stale buf lock: ${n instanceof Error?n.message:String(n)}`)}try{await(0,Hb.mkdir)(t,{recursive:!1})}catch{let n=Math.max(_No*5,r-Date.now()),i=Date.now()+n;for(;Date.now()<i;)try{return await(0,Hb.mkdir)(t,{recursive:!1}),GNo(t,e)}catch{e.debug(`Waiting for buf lock on ${t} (post-break retry)...`),await new Promise(o=>setTimeout(o,_No))}throw new S({message:"Failed to acquire buf lock after timeout and retry",code:S.Code.InternalError})}return GNo(t,e)}function GNo(e,t){return async()=>{try{await(0,Hb.rm)(e,{recursive:!0})}catch(r){t.debug(`Failed to release buf lock: ${r instanceof Error?r.message:String(r)}`)}}}async function BUt(e){try{let t=PUt();await(0,Hb.mkdir)(t,{recursive:!0});let r=await kim(e);try{return await Fim(e)}finally{await r()}}catch(t){e.debug(`Failed to resolve buf: ${t instanceof Error?t.message:String(t)}`);return}}async function Fim(e){let t=Oim(),r=Pim(),n=Bim();if(await rPu(t))return await Nim(n,e)===sde&&await rPu(r)?(e.info(`Using cached buf ${sde}`),r):(await nPu(t,r),await(0,Hb.writeFile)(n,sde),e.info(`Updated buf to ${sde}`),r);let i=Rim();e.info(`Downloading buf ${sde}...`);let o=Mt.of(`${t}.download`);try{let s=await fetch(i,{redirect:"follow"});if(!s.ok){e.debug(`Failed to download buf: ${s.status} ${s.statusText}`);return}let a=await s.arrayBuffer();return await(0,Hb.writeFile)(o,new Uint8Array(a)),await(0,Hb.chmod)(o,493),await(0,Hb.rename)(o,t),await nPu(t,r),await(0,Hb.writeFile)(n,sde),e.info(`Downloaded buf ${sde}`),r}catch(s){e.debug(`Failed to download buf: ${s instanceof Error?s.message:String(s)}`);try{await(0,Hb.rm)(o,{force:!0})}catch(a){e.debug(`Failed to clean up partial buf download: ${a instanceof Error?a.message:String(a)}`)}return}}async function Nim(e,t){try{return(await(0,Hb.readFile)(e,"utf-8")).trim()}catch(r){t.debug(`Failed to read buf version marker: ${r instanceof Error?r.message:String(r)}`);return}}async function nPu(e,t){let r=Mt.of(`${t}.tmp`);await(0,Hb.copyFile)(e,r),await(0,Hb.chmod)(r,493),await(0,Hb.rename)(r,t)}var Hb,K5r,qNo,sde,wim,OUt,Sim,Tim,tPu,_No,HNo=h(()=>{"use strict";Yt();Ft();Hb=require("fs/promises"),K5r=be(require("os"),1),qNo=be(require("path"),1),sde="v1.50.0",wim="https://github.com/bufbuild/buf/releases/download",OUt="buf",Sim=".fern",Tim="bin",tPu=12e4,_No=200});function RUt(e){return e.includes("server hosted at that remote is unavailable")||e.includes("fetch failed")||e.includes("failed to connect")||e.includes("network")||e.includes("ENOTFOUND")||e.includes("ETIMEDOUT")||e.includes("TIMEDOUT")||e.includes("timed out")||e.includes("ECONNREFUSED")||e.includes("ECONNRESET")||e.includes("socket hang up")}async function kUt(e,t,r=5e3){return DUt!==void 0?DUt:(KNo==null&&(KNo=jim(e,t,r)),KNo)}async function jim(e,t,r){t.debug(`Detecting air-gapped mode by checking connectivity to ${e}`);let n=3,i;for(let o=1;o<=n;o++)try{return await(await fetch(e,{method:"GET",signal:AbortSignal.timeout(r)})).body?.cancel().catch(()=>{}),DUt=!1,t.debug("Network check succeeded - not in air-gapped mode"),!1}catch(s){let a=Fn(s),c=s instanceof Error&&s.cause?` (cause: ${Fn(s.cause)})`:"";if(i=`${a}${c}`,!RUt(a))return DUt=!1,!1;if(o<n){let u=o*500;t.debug(`Network check attempt ${o}/${n} failed: ${i} \u2014 retrying in ${u}ms`),await new Promise(l=>setTimeout(l,u))}}return DUt=!0,t.debug(`Network check failed after ${n} attempts - entering air-gapped mode: ${i}`),!0}async function FUt(e,t,r="buf"){let n=ze(e,ve.of("buf.lock")),i=!1;try{await(0,E3e.access)(n),i=!0,t.debug(`Found buf.lock at: ${n}`)}catch{t.debug(`No buf.lock found at: ${n}`)}if(!i)return!1;let o=Mt.of((await iPu.default.dir()).path);try{let s=ze(e,ve.of("buf.yaml"));try{await(0,E3e.cp)(s,ze(o,ve.of("buf.yaml"))),await(0,E3e.cp)(n,ze(o,ve.of("buf.lock")))}catch{return!1}try{return await MQ(t,r,["dep","update"],{cwd:o,stdio:"pipe",timeout:3e4}),t.debug("Network check succeeded - not in air-gapped mode"),!1}catch(a){let c=Fn(a);return RUt(c)?(t.debug(`Network check failed - entering air-gapped mode: ${c.substring(0,100)}`),!0):!1}}finally{try{await(0,E3e.rm)(o,{recursive:!0,force:!0})}catch{}}}async function NUt(e){let t=h_("which",{cwd:Mt.of(process.cwd()),logger:void 0,doNotPipeOutput:!0});try{let n=(await t(["buf"])).stdout?.trim();return n?e.debug(`Found buf on PATH: ${n}`):e.debug("Found buf on PATH"),"buf"}catch{e.debug("buf not found on PATH, attempting auto-download");let r=await BUt(e);if(r!=null)return e.debug(`Using auto-downloaded buf: ${r}`),r;throw new S({message:"Missing required dependency; please install 'buf' to continue (e.g. 'brew install buf').",code:S.Code.EnvironmentError})}}var E3e,iPu,DUt,KNo,oPu,Qim,sPu,aPu,cPu,uPu,jUt,lPu,pPu,fPu,J5r=h(()=>{"use strict";wt();Yt();Q0();Ft();E3e=require("fs/promises"),iPu=be(kE(),1);HNo();oPu="buf.gen.yaml",Qim="output",sPu=`${Qim}/ir.json`,aPu="protoc-gen-fern",cPu=`version: v1
741
+ ${p.mark.snippet}`)),new S({message:f,code:S.Code.ParseError})}await rNo(s,sn(t),e);let a=await X_r({absolutePathToOpenAPI:t,logger:e.logger,parsed:s}),c=[];r!=null?Array.isArray(r)?c=r:c=[r]:typeof a=="object"&&a[mn.OPENAPI_OVERIDES_FILEPATH]!=null&&(c=[ze(sn(t),ve.of(a[mn.OPENAPI_OVERIDES_FILEPATH]))]);let u=a;for(let p of c)u=await hit({absoluteFilePathToOverrides:p,context:e,data:u,allowNullKeys:inm}),await rNo(u,sn(p),e),u=await X_r({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverrides:p,parsed:u,logger:e.logger});if(n!=null&&(u=await Q1u({absoluteFilePathToOverlay:n,absoluteFilePathToOpenAPI:t,context:e,data:u})),i){let p=ze(sn(t),ve.of("ai_examples_override.yml"));try{let d=await(0,nNo.readFile)(p,"utf-8"),f=Ir.load(d);if(f?.paths&&u.paths){for(let[m,g]of Object.entries(f.paths))if(g&&typeof g=="object")for(let[A,y]of Object.entries(g)){let E=A.toLowerCase(),x=u.paths[m];if(!x&&u.paths){let v=nnm(m,Object.keys(u.paths));v&&(x=u.paths[v],e.logger.debug(`Matched override path "${m}" to OpenAPI path "${v}" using pattern matching`))}if(x&&typeof x=="object"){let C=x[E];if(C&&typeof C=="object"){let O=C;!O["x-fern-examples"]&&y["x-fern-examples"]&&(O["x-fern-examples"]=y["x-fern-examples"],e.logger.debug(`Added AI examples for ${A.toUpperCase()} ${m} from override file`))}}}}e.logger.debug(`Processed AI examples from ${p}`)}catch{}}return u!==a&&c.length===0||n!=null?await X_r({absolutePathToOpenAPI:t,absolutePathToOpenAPIOverlays:n,parsed:u,logger:e.logger}):u}var X1u,nNo,inm,iNo=h(()=>{"use strict";X1u=be(require("path"),1);Yt();TW();Ft();nNo=require("fs/promises");Wo();z1u();K_r();H1u();Y1u();inm=["examples","example",mn.EXAMPLES,bP.REDOCLY_CODE_SAMPLES_CAMEL,bP.REDOCLY_CODE_SAMPLES_KEBAB]});var Z1u,ide,oNo=h(()=>{"use strict";Pc();Yt();Ac();TW();Z1u=require("fs/promises");fwu();Y2o();X2o();iNo();ide=class{absoluteFilePath;constructor(t){this.absoluteFilePath=t}async loadDocuments({context:t,specs:r,loadAiExamples:n=!1}){return(await Promise.all(r.map(o=>this.loadDocument({context:t,spec:o,loadAiExamples:n})))).filter(o=>o!=null)}async loadDocument({context:t,spec:r,loadAiExamples:n}){try{let i=(await(0,Z1u.readFile)(r.absoluteFilepath)).toString(),o=Oo(this.absoluteFilePath,r.source.file);r.source.relativePathToDependency!=null&&(o=ze(r.source.relativePathToDependency,o));let s=r.source.type==="protobuf"?bD.protobuf({file:o}):bD.openapi({file:o});if(i.includes("openapi")||i.includes("swagger"))try{let a=await d3e({absolutePathToOpenAPI:r.absoluteFilepath,context:t,absolutePathToOpenAPIOverrides:r.absoluteFilepathToOverrides,absolutePathToOpenAPIOverlays:r.absoluteFilepathToOverlays,loadAiExamples:n});if(vAo(a))return{type:"openapi",value:await XFo({document:a,settings:r.settings}),source:s,namespace:r.namespace,settings:GU({options:r.settings})};if(JF(a)){(!a.schemes||a.schemes.length===0)&&(a.schemes=["https"]);let c=await b2(a,{context:t});return{type:"openapi",value:await XFo({document:c,settings:r.settings}),source:s,namespace:r.namespace,settings:GU({options:r.settings})}}}catch(a){t.logger.debug(`Failed to parse OpenAPI document at ${r.absoluteFilepath}: ${a}. Skipping...`);return}if(i.includes("asyncapi"))try{return{type:"asyncapi",value:await Ait({context:t,absoluteFilePath:r.absoluteFilepath,absoluteFilePathToOverrides:r.absoluteFilepathToOverrides}),source:s,namespace:r.namespace,settings:GU({options:r.settings})}}catch(a){t.logger.error(`Failed to parse AsyncAPI document at ${r.absoluteFilepath}: ${a}. Skipping...`);return}if(i.includes("openrpc"))try{return{type:"asyncapi",value:await Ait({context:t,absoluteFilePath:r.absoluteFilepath,absoluteFilePathToOverrides:r.absoluteFilepathToOverrides}),source:s,namespace:r.namespace,settings:GU({options:r.settings})}}catch(a){t.logger.error(`Failed to parse OpenRPC document at ${r.absoluteFilepath}: ${a}. Skipping...`);return}t.logger.warn(`${r.absoluteFilepath} is not a valid OpenAPI, AsyncAPI, or OpenRPC file. Skipping...`);return}catch(i){t.logger.error(`Failed to read or process file ${r.absoluteFilepath}: ${i}. Skipping...`);return}}}});var Ji,$_r=h(()=>{"use strict";_n();Ji=class e{breadcrumbs=[];context;static STRING=Ut.TypeReference.primitive({v1:"STRING",v2:Ut.PrimitiveTypeV2.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=Ut.TypeReference.container(Ut.ContainerType.optional(e.STRING));constructor({breadcrumbs:t=[],context:r}){this.breadcrumbs=t,this.context=r}}});var sNo,$1u,eTu=h(()=>{"use strict";sNo=class{_map;_path;_lastScalar;_fragments;_count;constructor(){this._map={},this._path=[],this._lastScalar="",this._fragments=[],this._count=0}get map(){return this._map}resolveNode(t,r){if(t.path==="."&&(r="."),!this._map[r]){let{line:n,position:i,lineStart:o}=t;this._map[r]={line:n,position:i,lineStart:o}}t.children&&t.children.length>0&&t.children.forEach(n=>{this.resolveNode(n,(r==="."?"":r)+"."+n.path)})}iterFragments(t,r){for(let n=this._fragments.length-1;n>=0;n--){if(!this._fragments[n].path.startsWith(t)||this._fragments[n].path===t)continue;let i=this._fragments.pop();r(i)}}handleState(t,r){if(t==="close"){let n=r.result,i=r.kind,o=this._path.join(".");if(i==="scalar"){this._path.pop(),this._lastScalar=`${n}`;let{line:s,position:a,lineStart:c}=r;this._path.length===0?this._map["."+n]={line:s,position:a,lineStart:c}:this._fragments.push({path:this._path.join(".")+"."+n,line:s,position:a,lineStart:c})}else if(i==="mapping"){let s={path:o,children:[],line:0,position:0,lineStart:0},a=0;this.iterFragments(o,c=>{a++,!((!c.children||c.children.length===0)&&a%2===1)&&(this._path.length===1?this.resolveNode(c,c.path):(s.children.push({...c,path:c.path.slice(o.length+1)}),s.line=c.line,s.position=c.position,s.lineStart=c.lineStart))}),s.children&&s.children.length>0&&this._fragments.push(s),this._path.pop()}else if(i==="sequence"){let s={path:o,children:[],line:0,position:0,lineStart:0},a=new Set,c=n.length;this.iterFragments(o,u=>{a.has(u.position)||(c--,a.add(u.position),this._path.length===1?this.resolveNode(u,`${o}.${c}`):(s.children.push({...u,path:c.toString()}),s.line=u.line,s.position=u.position,s.lineStart=u.lineStart))}),s.children&&s.children.length>0&&this._fragments.push(s),this._path.pop()}else this._path.pop()}if(t==="open"){if(this._count===0){let{line:n,position:i,lineStart:o}=r;this._map["."]={line:n,position:i,lineStart:o}}this._path.push(this._lastScalar),this._count++}}listen(){return this.handleState.bind(this)}lookup(t){let r=t instanceof Array?t.map(i=>`${i}`).join("."):`${t}`;r.startsWith(".")||(r="."+r),r.startsWith("..")&&(r=r.slice(1)),r=r.replace(/\[/g,".").replace(/\]/g,"");let n=this._map[r];if(n)return{line:n.line+1,column:n.position-n.lineStart+1,position:n.position}}},$1u=sNo});var tTu,G0,$_,aNo,AUt=h(()=>{"use strict";Yt();jb();tTu=require("fs/promises");Wo();eTu();(function(e){e.WARNING="warning",e.ERROR="error"})(G0||(G0={}));$_=class{errors=[];logger;breadcrumbToLineNumberMapper;relativeFilepathToSpec;constructor({logger:t,relativeFilepathToSpec:r}){this.logger=t,this.relativeFilepathToSpec=r,r&&(this.breadcrumbToLineNumberMapper=new aNo({logger:t,relativePathToFile:ve.of(r)}))}collect(t){this.errors.push(t)}getErrors(){return this.errors}hasErrors(){return this.errors.length>0}dedupe(){let t=[],r=new Set,n=0;for(let i of this.errors){let o=i.path?i.path.join("->"):"",s=`${i.message}|${i.level||G0.WARNING}|${o}`;r.has(s)?n++:(r.add(s),t.push(i))}return this.errors=t,n}getErrorStats(){this.dedupe();let t=0,r=0;for(let n of this.errors)n.level===G0.ERROR?t++:(n.level===G0.WARNING||n.level===void 0)&&r++;return{numErrors:t,numWarnings:r}}async logErrors({logWarnings:t}){this.dedupe();for(let r of this.errors){let n=r.level??G0.WARNING;if(!(n===G0.WARNING&&!t))switch(n){case G0.ERROR:if(this.logger.log(Hn.Debug,r.message),r.path&&r.path.length>0){let i=await this.breadcrumbToLineNumberMapper?.getSourceLocation(r.path),o=i?`${this.relativeFilepathToSpec}:${i.line}:${i.column}`:r.path.join(" -> ");this.logger.log(Hn.Debug,` - at location (${o})`)}break;case G0.WARNING:if(this.logger.log(Hn.Warn,r.message),r.path&&r.path.length>0){let i=await this.breadcrumbToLineNumberMapper?.getSourceLocation(r.path),o=i?`${this.relativeFilepathToSpec}:${i.line}:${i.column}`:r.path.join(" -> ");this.logger.log(Hn.Warn,` - at location (${o})`)}r.resolution&&this.logger.log(Hn.Warn,` - resolution: ${r.resolution}`);break}}}},aNo=class{logger;relativePathToFile;map=new $1u;initialized=!1;constructor({relativePathToFile:t,logger:r}){this.relativePathToFile=t,this.logger=r}async initialize(){if(!this.initialized)try{let t=await(0,tTu.readFile)(this.relativePathToFile,"utf-8");Ir.load(t,{listener:this.map.listen()}),this.initialized=!0}catch(t){this.logger.log(Hn.Warn,`Failed to initialize line number mapping for ${this.relativePathToFile}: ${JSON.stringify(t)}`)}}async getSourceLocation(t){return this.initialized||await this.initialize(),this.map.lookup(t)}}});function onm(e){return"deprecated"in e&&e.deprecated===!0}var Wb,rTu=h(()=>{"use strict";F_();_n();Wo();Vi();AUt();Uo();Wb=class e{args;spec;settings;errorCollector;logger;generationLanguage;smartCasing;casingsGenerator;namespace;exampleGenerationArgs;authOverrides;environmentOverrides;globalHeaderOverrides;enableUniqueErrorsPerEndpoint;generateV1Examples;documentBaseDir;constructor(t){this.args=t,this.spec=t.spec,this.settings=t.settings,this.errorCollector=t.errorCollector,this.logger=t.logger,this.generationLanguage=t.generationLanguage,this.smartCasing=t.smartCasing,this.namespace=t.namespace,this.casingsGenerator=Zw({generationLanguage:t.generationLanguage,keywords:void 0,smartCasing:t.smartCasing}),this.exampleGenerationArgs=t.exampleGenerationArgs,this.authOverrides=t.authOverrides,this.environmentOverrides=t.environmentOverrides,this.globalHeaderOverrides=t.globalHeaderOverrides,this.enableUniqueErrorsPerEndpoint=t.enableUniqueErrorsPerEndpoint,this.generateV1Examples=t.generateV1Examples,this.documentBaseDir=t.documentBaseDir}static BREADCRUMBS_TO_IGNORE=["properties","allOf","anyOf"];convertBreadcrumbsToName(t){let r=t.filter((i,o)=>!(/^\d+$/.test(i)||e.BREADCRUMBS_TO_IGNORE.includes(i)||o===0&&i==="components"||o===1&&i==="schemas"||t[0]==="paths"&&(o===0||o===1&&["get","post","put","delete","patch"].includes(i)||o===2&&t[1]!=null&&["get","post","put","delete","patch"].includes(t[1])&&i==="parameters"))),n=ti(r.join("_"));return n.charAt(0).toUpperCase()+n.slice(1)}createFernFilepath(t={}){let r=this.namespace!=null?[this.casingsGenerator.generateName(this.namespace)]:[],n=t.name!=null?this.casingsGenerator.generateName(t.name):void 0;return{allParts:n?[...r,n]:r,packagePath:r,file:n}}resolveReference({reference:t,breadcrumbs:r,skipErrorCollector:n}){let i=this.spec,o=t.$ref.replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(s=>s.replace(/~1/g,"/"));for(let s of o){if(typeof i!="object"||i==null)return n||this.errorCollector.collect({level:G0.ERROR,message:this.getErrorMessageForMissingRef({reference:t}),path:r}),{resolved:!1};i=i[s]}return i==null?(n||this.errorCollector.collect({level:G0.ERROR,message:this.getErrorMessageForMissingRef({reference:t}),path:r}),{resolved:!1}):{resolved:!0,value:i}}getErrorMessageForMissingRef({reference:t}){let r=t.$ref.replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/");return r.length>=3&&r[0]==="components"&&r[1]==="schemas"?`Schema ${r[2]} does not exist`:`${t.$ref} does not exist`}async resolveMaybeExternalReference(t){let r=this.spec,n,i=!1,o=null,s;if(this.isExternalReference(t.$ref)){i=!0;let u=t.$ref.split("#"),l=u[0];if(n=u[1],!l)return{resolved:!1};s=l;let p=await fetch(l);if(!p.ok)return{resolved:!1};try{let d=await p.text();try{o=JSON.parse(d),r=o}catch{o=Ir.load(d),r=o}if(r==null)return{resolved:!1}}catch{return{resolved:!1}}if(!n)return{resolved:!0,value:r}}let a=n??t.$ref;if(a==null||typeof a!="string")return{resolved:!1};let c=a.replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(u=>u.replace(/~1/g,"/"));for(let u of c){if(typeof r!="object"||r==null)return{resolved:!1};r=r[u]}if(r==null)return{resolved:!1};if(i&&typeof r=="object"&&r!==null){let u=new Set;u.add(t.$ref),r=await this.resolveNestedExternalReferences(r,o,u,s)}return{resolved:!0,value:r}}async resolveNestedExternalReferences(t,r,n,i){if(t===null||typeof t!="object")return t;if(Array.isArray(t)){let s=[];for(let a of t)s.push(await this.resolveNestedExternalReferences(a,r,n,i));return s}if(this.isReferenceObject(t)){let s=t.$ref;if(this.isExternalReference(s)){if(n.has(s))return t;n.add(s);let a=await this.resolveMaybeExternalReference({$ref:s});if(n.delete(s),a.resolved)return a.value}else{let a=`${i}${s}`;if(n.has(a))return t;n.add(a);let c=r,u=s.substring(2).split("/").map(l=>l.replace(/~1/g,"/").replace(/~0/g,"~"));for(let l of u){if(typeof c!="object"||c===null)return t;c=c[l]}if(c!=null){let l=await this.resolveNestedExternalReferences(c,r,n,i);return n.delete(s),l}n.delete(s)}return t}let o={};for(let[s,a]of Object.entries(t))typeof a=="object"&&a!==null?o[s]=await this.resolveNestedExternalReferences(a,r,n,i):o[s]=a;return o}getExamplesFromSchema({schema:t,breadcrumbs:r}){if(t==null)return[];let n=t.example!=null?[t.example]:[];return t.examples!=null&&(Array.isArray(t.examples)?n.push(...t.examples):this.errorCollector.collect({message:"Received non-array schema examples",path:r})),n}getNamedExamplesFromMediaTypeObject({mediaTypeObject:t,breadcrumbs:r,defaultExampleName:n}){if(t==null)return[];let i=[];if(t.example!=null){let o=this.generateUniqueName({prefix:n??`${r.join("_")}_example`,existingNames:[]});i.push([o,{value:t.example}])}return t.examples!=null&&i.push(...Object.entries(t.examples)),i}resolveMaybeReference({schemaOrReference:t,breadcrumbs:r,skipErrorCollector:n}){if(this.isReferenceObject(t)){let i=this.resolveReference({reference:t,breadcrumbs:r,skipErrorCollector:n});return i.resolved?i.value:void 0}return t}resolveExampleRecursively({example:t,breadcrumbs:r,maxDepth:n=10}){let i=t,o=0;for(;this.isReferenceObject(i);){if(o>=n){this.errorCollector.collect({message:`Maximum reference depth (${n}) exceeded while resolving example reference`,path:r});return}let s=this.resolveReference({reference:i,breadcrumbs:r,skipErrorCollector:!0});if(!s.resolved)return;i=s.value,o++}return i}resolveExample(t){if(!this.isReferenceObject(t))return t;let r=this.resolveReference({reference:t});return r.resolved?this.returnExampleValue(r.value):void 0}resolveExampleWithValue(t){if(!this.isReferenceObject(t))return this.returnExampleValue(t);let r=this.resolveReference({reference:t});return r.resolved?this.returnExampleValue(r.value):void 0}returnExampleValue(t){return this.isExampleWithValue(t)?t.value:t}getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let o=this.resolveReference({reference:r});if(!o.resolved)return;r=o.value}let{readOnly:n,writeOnly:i}=this.getReadOnlyWriteOnlyFromSchema(r);if(!(n&&i)){if(n)return Ut.ObjectPropertyAccess.ReadOnly;if(i)return Ut.ObjectPropertyAccess.WriteOnly}}getReadOnlyWriteOnlyFromSchema(t){if(t.allOf&&t.allOf.length>0){let r=!0,n=!0;for(let i of t.allOf){let o=i;if(this.isReferenceObject(i)){let a=this.resolveReference({reference:i});if(!a.resolved)continue;o=a.value}let s=this.getReadOnlyWriteOnlyFromSchema(o);r=r&&s.readOnly,n=n&&s.writeOnly}return{readOnly:r,writeOnly:n}}else return{readOnly:!!t.readOnly,writeOnly:!!t.writeOnly}}getAudiences({operation:t,breadcrumbs:r}){let i=new ux.AudienceExtension({operation:t,breadcrumbs:r,context:this}).convert();if(i!=null)return i.audiences}getAvailability({node:t,breadcrumbs:r}){let n=new Set;for(;this.isReferenceObject(t);){let i=this.getDeclaredAvailability({node:t,breadcrumbs:r});if(i!=null)return i;if(n.has(t.$ref))return;n.add(t.$ref);let o=this.resolveReference({reference:t});if(!o.resolved)return;t=o.value}return this.getDeclaredAvailability({node:t,breadcrumbs:r})}getDeclaredAvailability({node:t,breadcrumbs:r}){let i=new ux.FernAvailabilityExtension({node:t,breadcrumbs:r,context:this}).convert();if(i!=null)return{status:i,message:void 0};if(onm(t))return{status:Xm.Deprecated,message:void 0}}getNamespacedSchemaId(t){if(this.namespace==null)return t;let r=`${this.namespace}:`;return t.startsWith(r)?t:`${r}${t}`}getRawSchemaId(t){if(this.namespace==null)return t;let r=`${this.namespace}:`;return t.startsWith(r)?t.slice(r.length):t}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return this.getNamespacedSchemaId(r[1])}getRawSchemaNameFromReference(t){let r=t.$ref.match(/\/schemas\/([^/]+)/);if(!(!r||!r[1]))return r[1]}createNamedTypeReference(t,r){return Jr.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(t),typeId:this.getNamespacedSchemaId(t),displayName:r,default:void 0,inline:!1})}typeReferenceToDeclaredTypeName(t){if(t.type==="named")return{typeId:t.typeId,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:t.name,displayName:t.displayName}}removeSchemaFromInlinedTypes({id:t,inlinedTypes:r}){let n=this.getNamespacedSchemaId(t);return Object.fromEntries(Object.entries(r).filter(([i])=>i!==n))}static maybeTrimPrefix(t,r){return t.startsWith(r)?t.slice(r.length):t}generateUniqueName({prefix:t,existingNames:r}){if(!r.includes(t))return t;let n=0;for(;r.includes(`${t}_${n}`);)n++;return`${t}_${n}`}isReferenceObject(t){return typeof t=="object"&&t!==null&&"$ref"in t}isExternalReference(t){return typeof t=="string"&&(t.startsWith("http://")||t.startsWith("https://"))}isReferenceObjectWithIdentifier(t){return this.isReferenceObject(t)&&("title"in t||"name"in t||"messageId"in t||"summary"in t)}isExampleWithSummary(t){return typeof t=="object"&&t!=null&&"summary"in t&&typeof t.summary=="string"&&t.summary.length>0}isExampleWithValue(t){return typeof t=="object"&&t!=null&&"value"in t}isOptional(t){return t.type==="container"&&t.container.type==="optional"}isNullable(t){return t.type==="container"&&t.container.type==="nullable"}isList(t){return t.type==="container"&&t.container.type==="list"}isFile(t){return t.type==="primitive"&&t.primitive.v2?.type==="string"&&t.primitive.v2.validation?.format==="binary"}getAsString(t){if(typeof t=="string")return t}getAsInteger(t){if(typeof t=="number"&&Number.isInteger(t))return t}getAsNumber(t){if(typeof t=="number")return t}getAsBoolean(t){if(typeof t=="boolean")return t}getAsArray(t){if(Array.isArray(t))return t}getAsObject(t){if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}getGroup({groupParts:t,namespace:r}){let n=[];return r!=null&&n.push(r),n.push(...t??[]),n}isObjectSchemaType(t){return t.type==="object"||t.properties!=null}}});var Yo,JD=h(()=>{"use strict";Yo=class{breadcrumbs;context;constructor(t){this.breadcrumbs=t.breadcrumbs,this.context=t.context}getExtensionValue(t,r){if(typeof t!="object"||t==null)return;let n=t[this.key];if(n!=null)return n;if(r!=null)return t[r]}}});var yit,cNo=h(()=>{"use strict";JD();yit=class extends Yo{operation;key="x-fern-audiences";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=Array.isArray(t)?t.filter(n=>typeof n=="string"):typeof t=="string"?[t]:[];if(r.length!==0)return{audiences:r}}}});var e5r,nTu=h(()=>{"use strict";_n();JD();e5r=class extends Yo{node;key="x-fern-availability";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(t==null||typeof t!="string")return;switch(t.toUpperCase().replace(/[-_\s]/g,"_")){case"IN_DEVELOPMENT":return Xm.InDevelopment;case"PRE_RELEASE":return Xm.PreRelease;case"GENERAL_AVAILABILITY":case"GA":case"STABLE":return Xm.GeneralAvailability;case"DEPRECATED":return Xm.Deprecated;case"ALPHA":return Xm.Alpha;case"BETA":return Xm.Beta;case"PREVIEW":return Xm.Preview;case"LEGACY":return Xm.Legacy;default:return}}}});var bit,uNo=h(()=>{"use strict";JD();bit=class extends Yo{node;key="x-fern-discriminated";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(t!=null&&typeof t=="boolean")return t}}});var Eit,lNo=h(()=>{"use strict";JD();Eit=class extends Yo{node;key="x-fern-discriminator-context";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(t==="data"||t==="protocol")return t}}});var snm,anm,iTu,oTu=h(()=>{"use strict";jn();snm=Be.object({snake:Be.string().optional(),camel:Be.string().optional(),screamingSnake:Be.string().optional(),pascal:Be.string().optional()}),anm=Be.object({description:Be.string().optional(),name:Be.string().optional(),casing:snm.optional()}),iTu=Be.record(anm)});var Iit,pNo=h(()=>{"use strict";JD();oTu();Iit=class extends Yo{schema;key="x-fern-enum";constructor({breadcrumbs:t,schema:r,context:n}){super({breadcrumbs:t,context:n}),this.schema=r}convert(){let t=this.getExtensionValue(this.schema);if(t==null)return;let r=iTu.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-enum extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data}}});var m3e,sTu=h(()=>{"use strict";JD();m3e=class extends Yo{operation;key="x-fern-ignore";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-ignore",path:this.breadcrumbs});return}return t}}}});var t5r,aTu=h(()=>{"use strict";JD();t5r=class extends Yo{parameter;key="x-fern-optional";constructor({breadcrumbs:t,parameter:r,context:n}){super({breadcrumbs:t,context:n}),this.parameter=r}convert(){let t=this.getExtensionValue(this.parameter);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-optional",path:this.breadcrumbs});return}return t}}}});var r5r,cTu=h(()=>{"use strict";JD();r5r=class extends Yo{operation;key="x-fern-sdk-group-name";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=Array.isArray(t)?t.filter(n=>typeof n=="string"):typeof t=="string"?[t]:[];if(r.length!==0)return{groups:r}}}});var n5r,uTu=h(()=>{"use strict";JD();n5r=class extends Yo{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null&&typeof t=="string")return{methodName:t}}}});var i5r,lTu=h(()=>{"use strict";JD();i5r=class extends Yo{operation;key="x-fern-server-name";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation,"x-name");if(!(t==null||typeof t!="string"))return t}}});var o5r,pTu=h(()=>{"use strict";JD();o5r=class extends Yo{schema;key="x-fern-type";constructor({breadcrumbs:t,schema:r,context:n}){super({breadcrumbs:t,context:n}),this.schema=r}convert(){let t=this.getExtensionValue(this.schema);if(t!=null&&typeof t=="string")return t}}});var s5r,fTu=h(()=>{"use strict";JD();s5r=class extends Yo{schema;key="x-fern-type-name";constructor({breadcrumbs:t,schema:r,context:n}){super({breadcrumbs:t,context:n}),this.schema=r}convert(){let t=this.getExtensionValue(this.schema);if(typeof t=="string")return t}}});function cnm({isText:e,isAttribute:t}){return e?tQ.Text:t?tQ.Attribute:tQ.Element}function hTu(e){return typeof e=="object"&&e!=null}function a5r(e,t){if(!(typeof e!="object"||e==null))return e[t]}function fNo(...e){return e.find(t=>t!=null)}var dTu,mTu,vit,xit,c5r=h(()=>{"use strict";_n();JD();dTu="x-fern-xml-text",mTu="x-fern-xml-list-separator",vit=class extends Yo{schema;fallbackName;key="xml";constructor({breadcrumbs:t,schema:r,fallbackName:n,context:i}){super({breadcrumbs:t,context:i}),this.schema=r,this.fallbackName=n}convert(){let t=this.getExtensionValue(this.schema);if(hTu(t))return{name:typeof t.name=="string"?t.name:this.fallbackName,namespace:typeof t.namespace=="string"?t.namespace:void 0,prefix:typeof t.prefix=="string"?t.prefix:void 0}}},xit=class extends Yo{propertySchema;resolvedPropertySchema;key="xml";constructor({breadcrumbs:t,propertySchema:r,resolvedPropertySchema:n,context:i}){super({breadcrumbs:t,context:i}),this.propertySchema=r,this.resolvedPropertySchema=n}convert(){let t=this.propertySchema,r=this.resolvedPropertySchema,n=fNo(this.getExtensionValue(t),this.getExtensionValue(r)),i=fNo(a5r(t,dTu),a5r(r,dTu)),o=fNo(a5r(t,mTu),a5r(r,mTu)),s=hTu(n)?n:{};return{kind:cnm({isText:i===!0,isAttribute:s.attribute===!0}),name:typeof s.name=="string"?s.name:void 0,wrapped:typeof s.wrapped=="boolean"?s.wrapped:void 0,listSeparator:typeof o=="string"?o:void 0}}}});var ux={};Z(ux,{AudienceExtension:()=>yit,FernAvailabilityExtension:()=>e5r,FernDiscriminatedExtension:()=>bit,FernDiscriminatorContextExtension:()=>Eit,FernEnumExtension:()=>Iit,FernIgnoreExtension:()=>m3e,FernOptionalExtension:()=>t5r,FernTypeExtension:()=>o5r,FernTypeNameExtension:()=>s5r,SdkGroupNameExtension:()=>r5r,SdkMethodNameExtension:()=>n5r,ServerFromOperationNameExtension:()=>i5r,XmlPropertyExtension:()=>xit,XmlSchemaExtension:()=>vit});var dNo=h(()=>{"use strict";cNo();nTu();uNo();lNo();pNo();sTu();aTu();cTu();uTu();lTu();pTu();fTu();c5r()});var kH,gTu=h(()=>{"use strict";_n();tc();Vi();$_r();dNo();kH=class extends Ji{ir;audiences;irGraph;constructor({breadcrumbs:t=[],context:r,audiences:n}){super({breadcrumbs:t,context:r}),this.audiences=n,this.irGraph=new n6e(n),this.ir={auth:{docs:void 0,requirement:Ut.AuthSchemesRequirement.All,schemes:[]},selfHosted:!1,types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:Ut.ErrorDiscriminationStrategy.statusCode(),variables:[],globalParameters:void 0,serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:this.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,idempotencyKeyGeneration:void 0,webhookSignatureVerification:void 0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}},audiences:void 0,generationMetadata:void 0,apiPlayground:void 0,casingsConfig:void 0,specVersion:void 0}}removeXFernIgnores({document:t,breadcrumbs:r=[]}){return Array.isArray(t)?t.filter((n,i)=>!new m3e({breadcrumbs:[...r,String(i)],operation:n,context:this.context}).convert()).map((n,i)=>this.removeXFernIgnores({document:n,breadcrumbs:[...r,String(i)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([n,i])=>!new m3e({breadcrumbs:[...r,n],operation:i,context:this.context}).convert()).map(([n,i])=>[n,this.removeXFernIgnores({document:i,breadcrumbs:[...r,n]})])):t}finalizeIr(){let t=Object.values(this.ir.services).some(a=>a.endpoints.some(c=>c.response?.body?.type==="streaming")),r=Object.values(this.ir.services).some(a=>a.endpoints.some(c=>c.pagination!=null)),n=Object.values(this.ir.services).some(a=>a.endpoints.some(c=>c.response?.body?.type==="fileDownload"));this.ir.sdkConfig={...this.ir.sdkConfig,hasStreamingEndpoints:t,hasPaginatedEndpoints:r,hasFileDownloadEndpoints:n},V3t(this.ir,{onWarning:a=>this.context.logger.warn(a)});let i={...this.ir,apiName:this.context.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:this.context.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})},audiences:this.audiences.type==="select"?this.audiences.audiences:void 0};this.irGraph.hasNoAudiences()||(i=this.filterIrForAudiences(i)),j3t({ir:i});let o=this.context.exampleGenerationArgs,s=T1o({ir:i,exampleGeneration:o,logger:this.context.logger});if(this.context.generateV1Examples){let a=z3t({ir:i,exampleGeneration:o});return{...i,...a,...s}}return{...i,...s}}filterIrForAudiences(t){return{...L3t(t,this.irGraph.build()),sdkConfig:t.sdkConfig,subpackages:t.subpackages,rootPackage:t.rootPackage}}async resolveAllExternalRefs({spec:t}){let r=[t];for(;r.length>0;){let n=r.shift();n!=null&&(Array.isArray(n)?await this.resolveExternalRefsInArray(n,r):typeof n=="object"&&await this.resolveExternalRefsInObject(n,r))}return t}async resolveExternalRefsInArray(t,r){for(let n=0;n<t.length;n++)t[n]=await this.resolveReferenceChain(t[n],r)}async resolveExternalRefsInObject(t,r){for(let[n,i]of Object.entries(t))t[n]=await this.resolveReferenceChain(i,r)}async resolveReferenceChain(t,r){let n=t;if(!this.context.isReferenceObject(n))return r.push(n),t;for(;this.context.isReferenceObject(n);){let i=this.context.isExternalReference(n.$ref),o=await this.context.resolveMaybeExternalReference(n);if(o.resolved){if(n=o.value,i)return n}else return t}return t}shouldAddServerToCollectedServers({server:t,currentServers:r,specType:n="openapi"}){return n==="openapi"?!r.some(i=>i.url===t.url&&"x-fern-server-name"in i&&"x-fern-server-name"in t&&i["x-fern-server-name"]===t["x-fern-server-name"]):!r.some(i=>i.url===t.url&&"name"in i&&"name"in t&&i.name===t.name)}addEndpointToIr({endpoint:t,audiences:r,endpointGroup:n,endpointGroupDisplayName:i,endpointGroupDescription:o,serviceName:s,inlinedRequestPropertiesByAudience:a,queryParametersByAudience:c}){let u=this.context.getGroup({groupParts:n,namespace:this.context.namespace}),l=this.getOrCreatePackage({group:n});l!==this.ir.rootPackage&&l.docs==null&&o!=null&&(l.docs=o);let p=[...u].map(m=>this.context.casingsGenerator.generateName(m)),d=p[p.length-1];l.service==null&&(l.service=s??`service_${u.map(m=>ti(m)).join("/")}`),this.ir.services[l.service]==null&&(this.ir.services[l.service]=this.createNewService({allParts:p,finalpart:d,endpointGroupDisplayName:i})),this.ir.services[l.service]?.endpoints.push(t);let f=this.ir.services[l.service];f!=null&&(this.irGraph.addEndpoint(f,t),this.irGraph.markEndpointForAudience(f.name,[t],r),a!=null&&Object.keys(a).length>0&&this.irGraph.markInlinedRequestPropertiesForAudiences(t.id,a),c!=null&&Object.keys(c).length>0&&this.irGraph.markQueryParametersForAudiences(t.id,c))}addWebhookToIr({webhook:t,operationId:r,audiences:n,group:i,inlinedPayloadPropertiesByAudience:o}){let s=i?.join(".")??r,a=this.getOrCreatePackage({group:i});this.ir.webhookGroups[s]==null&&(this.ir.webhookGroups[s]=[]),this.ir.webhookGroups[s].push(t),a.webhooks=s;let c=this.context.createFernFilepath();this.irGraph.addWebhook(c,t),n!=null&&this.irGraph.markWebhookForAudiences(c,t,n),t.id!=null&&o!=null&&Object.keys(o).length>0&&this.irGraph.markInlinedWebhookPayloadPropertiesForAudiences(t.id,o)}addWebsocketChannelToIr({websocketChannel:t,channelPath:r,audiences:n,websocketGroup:i}){let o=ti(i?.join(".")),s=ti(r),a=this.context.namespace?`${ti(this.context.namespace)}/`:"",c=o?`channel_${a}${o}`:`channel_${a}${s}`,u=i?this.getOrCreatePackage({group:i}):this.getOrCreatePackage({group:[s]});this.ir.websocketChannels={...this.ir.websocketChannels,[c]:t},c!==""?u.websocket==null&&(u.websocket=c):this.ir.rootPackage.websocket="";let l=this.context.createFernFilepath();this.irGraph.addChannel(l,c,t),n!=null&&this.irGraph.markChannelForAudiences(l,c,n)}addAuthToIR(t){this.ir.auth=t}addErrorsToIr(t){this.ir.errors=t;for(let r of Object.values(t))this.irGraph.addError(r)}addGlobalHeadersToIr(t){this.ir.headers=t}addEnvironmentsToIr({environmentConfig:t,audiences:r}){if(this.ir.environments=t,t==null)return;let n=t.environments.environments,i=r==null||n.every(o=>o.audiences==null);for(let o of n)this.irGraph.markEnvironmentForAudiences(o,r?.[o.id]??[],i)}addTypeToRootPackage(t){this.ir.rootPackage.types.push(t)}addSchemaOutputToIr(t,r){let{convertedSchema:n,inlinedTypes:i}=r,o=this.context.getNamespacedSchemaId(t),a=Object.keys(i).some(c=>c===o)?`${o}Wrapper`:o;this.addTypeToPackage(a),this.addTypesToIr({...i,[a]:n})}addTypeToPackage(t){let r=this.context.getGroup({groupParts:[],namespace:this.context.namespace});this.getOrCreatePackage({group:r}).types.push(t)}addTypesToIr(t){Object.assign(this.ir.types,Object.fromEntries(Object.entries(t).map(([r,n])=>[r,n.typeDeclaration])));for(let r of Object.values(t))this.irGraph.addType({declaredTypeName:r.typeDeclaration.name,descendantTypeIds:r.typeDeclaration.referencedTypes,descendantTypeIdsByAudience:{},propertiesByAudience:r.propertiesByAudience,descendantFilepaths:new Set}),this.irGraph.markTypeForAudiences(r.typeDeclaration.name,r.audiences)}updateEndpointsWithDefaultUrl(t){if(t!=null)for(let r of Object.values(this.ir.services))for(let n of r.endpoints)n.baseUrl==null&&(n.baseUrl=t)}createNewService({allParts:t,finalpart:r,endpointGroupDisplayName:n}){return{name:{fernFilepath:{allParts:t,packagePath:t.slice(0,-1),file:r}},displayName:n,basePath:M0(""),headers:[],pathParameters:[],availability:void 0,endpoints:[],transport:void 0,encoding:void 0,audiences:void 0}}createPackage(t={}){return{fernFilepath:this.context.createFernFilepath(t),service:void 0,types:[],errors:[],subpackages:[],docs:void 0,webhooks:void 0,websocket:void 0,hasEndpointsInTree:!1,hasWebSocketInTree:void 0,navigationConfig:void 0}}getOrCreatePackage({group:t}){let r=[];if(this.context.namespace!=null&&r.push(this.context.namespace),r.push(...(t??[]).map(i=>ti(i))),r.length==0)return this.ir.rootPackage;let n=this.ir.rootPackage;for(let i=0;i<r.length;i++){let o=r[i]??"",a=`subpackage_${r.slice(0,i+1).join("/")}`;this.ir.subpackages[a]==null&&(this.ir.subpackages[a]={name:this.context.casingsGenerator.generateName(o),displayName:void 0,...this.createPackage({name:o})});let c=this.ir.subpackages[a];n.subpackages.includes(a)||n.subpackages.push(a),n=c}return n}}});function h3e(e){return typeof e=="object"&&e!==null&&!("$ref"in e)}function pnm(e){if(!h3e(e))return!1;if("nullable"in e&&e.nullable===!0)return!0;let t=r=>Array.isArray(r)&&r.some(n=>h3e(n)&&n.type==="null");return t(e.anyOf)||t(e.oneOf)}function fnm(e){return e.type==="array"||e.properties||e.oneOf||e.anyOf||e.allOf||e.additionalProperties?!1:!!(e.type==="string"||e.type==="number"||e.type==="integer"||e.type==="boolean"||e.const!==void 0||Array.isArray(e.enum)&&e.enum.length>0)}function yTu(e){if(e.const!==void 0)return e.const;if(Array.isArray(e.enum)&&e.enum.length>0)return e.enum[0]}var unm,ATu,lnm,nS,nxe=h(()=>{"use strict";wt();Uo();unm=/^literal<\s*(?:"(.*)"|(true|false))\s*>$/,ATu=new WeakMap,lnm=new Set(["type","properties","required","allOf","description","title","deprecated","readOnly","writeOnly","xml","externalDocs","discriminator"]);nS=class e extends Ji{MAX_DEPTH=12;EXAMPLE_STRING=Fi.STRING;EXAMPLE_NUMBER=Fi.DOUBLE;EXAMPLE_BOOLEAN=Fi.BOOLEAN;EXAMPLE_INTEGER=Fi.INT;EXAMPLE_DATE=Fi.DATE;EXAMPLE_DATE_TIME=Fi.DATE_TIME;schema;example;depth;exampleGenerationStrategy;generateOptionalProperties;seenRefs;sharedState;constructor({breadcrumbs:t,context:r,schema:n,example:i,depth:o=0,exampleGenerationStrategy:s,generateOptionalProperties:a=!1,seenRefs:c=new Set}){super({breadcrumbs:t,context:r}),this.example=i,this.schema=n,this.depth=o,this.exampleGenerationStrategy=s,this.generateOptionalProperties=a,this.seenRefs=c;let u=ATu.get(r);u!=null?this.sharedState=u:(this.sharedState={mergedAllOfProperties:new WeakMap,mergeOnlyAllOfSchemas:new WeakMap},ATu.set(r,this.sharedState))}convert(){if(this.depth>this.MAX_DEPTH)return{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:typeof this.example<"u"?this.example:{},errors:[]};if(this.context.isReferenceObject(this.schema)){let n=this.schema.$ref;if(this.seenRefs.has(n))return{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:this.example,errors:[]}}let t=this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(t==null)return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[{message:"Schema is not resolvable",path:this.breadcrumbs}]};if(typeof t!="object")return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[{message:`Schema should be an object: ${JSON.stringify(t,null,2)}`,path:this.breadcrumbs}]};if("nullable"in t&&t.nullable===!0&&this.example===null)return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};let r=this.maybeConvertLiteralFernType(t);return r??(Array.isArray(t.type)?this.convertSchemaTypeArray({resolvedSchema:t}):t.type=="null"?this.convertNull():t.type=="boolean"?this.convertBoolean():t.enum!=null?this.convertEnum(t):t.type=="number"?this.convertNumber():t.type=="string"?this.convertString():t.type=="integer"?this.convertInteger():t.type=="array"?this.convertArray({resolvedSchema:t}):"oneOf"in t&&t.oneOf!=null?this.convertOneOf({resolvedSchema:t}):"anyOf"in t&&t.anyOf!=null?this.convertAnyOf({resolvedSchema:t}):t.type=="object"||t.properties!=null||t.allOf!=null?this.convertObject({resolvedSchema:t}):typeof t=="object"&&Object.keys(t).length===0?{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:this.example,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[{message:`Unsupported schema type: ${JSON.stringify(t,null,2)}`,path:this.breadcrumbs}]})}convertNull(){let t=this.example===null;return t?{isValid:t,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[{message:`Example is not null: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}convertBoolean(){let t=typeof this.example=="boolean";if(t)return{isValid:t,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};let r=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs})?.default:this.schema.default,n=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs})?.const:this.schema.const;return typeof r=="boolean"||typeof n=="boolean"?{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n??r,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:this.maybeResolveSchemaExample(this.schema)??this.EXAMPLE_BOOLEAN,errors:[{message:`Example is not a boolean: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}convertEnum(t){let r=t.enum?.includes(this.example)??!1;if(r)return{isValid:r,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};let n=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0})?.default:this.schema.default;return n!==void 0&&t.enum?.includes(n)?{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n,errors:[]}:{isValid:r,coerced:!1,usedProvidedExample:!1,validExample:t.enum?.[0],errors:[{message:`Example is not one of the allowed enum values: ${JSON.stringify(t.enum,null,2)}`,path:this.breadcrumbs}]}}convertNumber(){if(typeof this.example=="number")return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};let t=Number(this.example);if(!isNaN(t))return{isValid:!0,coerced:!0,usedProvidedExample:!0,validExample:t,errors:[]};let r=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0}):this.schema,n=r?.default;return typeof n=="number"?{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:this.adjustNumberToConstraints(this.maybeResolveSchemaExample(this.schema)??this.EXAMPLE_NUMBER,r),errors:[{message:`Example is not a number: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}adjustNumberToConstraints(t,r){if(r==null)return this.context.logger.debug("[ExampleConverter.adjustNumberToConstraints] Schema object is null, returning original number","number:",t.toString()),t;let{minimum:n,maximum:i,exclusiveMinimum:o,exclusiveMaximum:s}=r,a;o!=null?typeof o=="boolean"?a=n!=null?n+Math.max(Number.EPSILON,Math.abs(n)*1e-10):void 0:a=o+Math.max(Number.EPSILON,Math.abs(o)*1e-10):n!=null&&(a=n);let c;return s!=null?typeof s=="boolean"?c=i!=null?i-Math.max(Number.EPSILON,Math.abs(i)*Number.EPSILON):void 0:c=s-Math.max(Number.EPSILON,Math.abs(s)*Number.EPSILON):i!=null&&(c=i),a!==void 0&&c!==void 0?(t<a||t>c)&&(t=a+(c-a)/2):a!==void 0&&t<a?t=a+Math.abs(a*.1):c!==void 0&&t>c&&(t=c-Math.abs(c*.1)),Number(Number(t).toPrecision(3))}convertString(){if(typeof this.example=="string")return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};if(typeof this.example!="object"&&!Array.isArray(this.example)&&this.example!=null)return{isValid:!0,coerced:!0,usedProvidedExample:!0,validExample:String(this.example),errors:[]};let t=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0})?.default:this.schema.default;if(typeof t=="string")return{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:t,errors:[]};let r=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0}):this.schema,n=r?.format==="date"?this.EXAMPLE_DATE:r?.format==="date-time"?this.EXAMPLE_DATE_TIME:this.EXAMPLE_STRING;return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:this.maybeResolveSchemaExample(this.schema)??n,errors:[{message:`Example cannot be converted to string: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}convertInteger(){if(typeof this.example=="number"&&Number.isInteger(this.example))return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:this.example,errors:[]};if(typeof this.example=="string"){let r=Number(this.example);if(!isNaN(r)&&Number.isInteger(r))return{isValid:!0,coerced:!0,usedProvidedExample:!0,validExample:r,errors:[]}}let t=this.context.isReferenceObject(this.schema)?this.context.resolveMaybeReference({schemaOrReference:this.schema,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0})?.default:this.schema.default;return typeof t=="number"&&Number.isInteger(t)?{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:t,errors:[]}:{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:this.maybeResolveSchemaExample(this.schema)??this.EXAMPLE_INTEGER,errors:[{message:`Example is not an integer: ${JSON.stringify(this.example,null,2)}`,path:this.breadcrumbs}]}}convertArray({resolvedSchema:t}){if(t.type!="array")return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[]};t.items==null&&(t.items={type:"string"});let r=this.example==null,n=this.example??t.example,o=(Array.isArray(n)?n:[n]).map(c=>new e({breadcrumbs:[...this.breadcrumbs,"items"],context:this.context,schema:t.items,example:c,depth:this.depth,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert()),s=o.every(c=>c?.isValid??!1)&&!r,a=!r&&o.some(c=>c.usedProvidedExample);return{isValid:s,coerced:!1,usedProvidedExample:a,validExample:o.map(c=>c.validExample),errors:s?[]:o.flatMap(c=>c.errors)}}convertObject({resolvedSchema:t}){if(t.type=="object"&&t.properties==null&&t.allOf==null)return{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:this.example??{},errors:[]};let r=typeof this.example!="object"||this.example==null?{}:this.example,n=this.example===void 0&&this.canGenerateFromMergedAllOf(t),{mergedProperties:i,mergedRequired:o}=this.mergeAllOfProperties(t,new Set,0,n),s=Object.entries(i).map(([y,E])=>{if(typeof E!="object")return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};if(this.isDeprecatedProperty(E)&&!this.isRequiredProperty({key:y,resolvedSchema:t}))return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};if("readOnly"in E&&E.readOnly===!0&&"writeOnly"in E&&E.writeOnly===!0)return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};if("readOnly"in E&&E.readOnly===!0&&this.exampleGenerationStrategy==="request")return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};if("writeOnly"in E&&E.writeOnly===!0&&this.exampleGenerationStrategy==="response")return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}};let x=pnm(E),v=!(y in r)||!x&&r[y]==null||x&&r[y]===void 0,C=!o.includes(y);if(v&&C){if(this.example===void 0&&this.generateOptionalProperties){let O=this.maybeResolveSchemaExample(E),D=new e({breadcrumbs:[...this.breadcrumbs,y],context:this.context,schema:E,example:O,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()});return{key:y,result:D.convert()}}return{key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:void 0,errors:[]}}}else{let O=r[y],D=O!==void 0?O:this.maybeResolveSchemaExample(E),P=new e({breadcrumbs:[...this.breadcrumbs,y],context:this.context,schema:E,example:D,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();return{key:y,result:P}}}),a=n?[]:(t.allOf??[]).map((y,E)=>{let x=this.context.resolveMaybeReference({schemaOrReference:y,breadcrumbs:[...this.breadcrumbs,`allOf[${E}]`],skipErrorCollector:!0});return x&&this.isConstraintOnlySchema(x)?{isValid:!0,coerced:!1,usedProvidedExample:this.example!==void 0,validExample:this.example,errors:[]}:new e({breadcrumbs:[...this.breadcrumbs,`allOf[${E}]`],context:this.context,schema:{...t,...y,allOf:void 0},example:this.example,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert()}),c=this.example!==void 0&&(s.some(({result:y})=>y.usedProvidedExample)||a.some(y=>y.usedProvidedExample)),u=Object.fromEntries(s.map(({key:y,result:E})=>[y,E.validExample]).filter(([y,E])=>E!==void 0));for(let y of a)if(typeof y.validExample=="object"&&y.validExample!==null){let E=y.validExample,x=Object.fromEntries(Object.entries(E).filter(([v,C])=>C!==void 0));for(let[v,C]of Object.entries(x))(!(v in u)||u[v]==null)&&(u[v]=C)}let l=[],p=this.collectAllPropertyKeys(t),d=Object.keys(r).filter(y=>!p.has(y)),f=this.schemaHasPatternProperties(t),m=f?d:[],g=f?[]:d;if(m.forEach(y=>{l.push({key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:r[y],errors:[]}})}),g.length>0)if(t.additionalProperties===!1)g.forEach(y=>{let E=[...this.breadcrumbs,y].join("."),x={message:`Found unexpected property '${y}' in example. This property does not exist in the schema${E?` at path: ${E}`:""}`,path:[...this.breadcrumbs,y]};l.push({key:y,result:{isValid:!1,coerced:!1,usedProvidedExample:!0,validExample:void 0,errors:[x]}})});else if(t.additionalProperties===!0||t.additionalProperties===void 0)g.forEach(y=>{l.push({key:y,result:{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:r[y],errors:[]}})});else{let y=t.additionalProperties;g.forEach(E=>{let v=new e({breadcrumbs:[...this.breadcrumbs,E],context:this.context,schema:y,example:r[E],depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();l.push({key:E,result:v})})}for(let{key:y,result:E}of l)E.validExample!==void 0&&u[y]===void 0&&(u[y]=E.validExample);let A=s.every(y=>y.result.isValid)&&a.every(y=>y.isValid)&&l.every(({result:y})=>y.isValid);if(Object.keys(u).length===0){let y=a.find(E=>E.validExample!==void 0&&(typeof E.validExample!="object"||E.validExample===null));y&&(u=y.validExample)}return{isValid:A,coerced:!1,usedProvidedExample:c,validExample:u,errors:[...s.flatMap(({result:y})=>y.errors),...a.flatMap(y=>y.errors),...l.flatMap(({result:y})=>y.errors)]}}convertSchemaTypeArray({resolvedSchema:t}){if(!Array.isArray(t.type))return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[]};if(t.type.length===1)return new e({breadcrumbs:this.breadcrumbs,context:this.context,schema:{...t,type:t.type[0]},example:this.example,depth:this.depth,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();let r=t.type.map((a,c)=>new e({breadcrumbs:[...this.breadcrumbs,`type[${c}]`],context:this.context,schema:{...t,type:a},example:this.example,depth:this.depth,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert()),n=r.some(a=>a?.isValid??!1),o=r.find(a=>a.isValid)?.validExample??r[0]?.validExample??null,s=r.some(a=>a.usedProvidedExample);return{isValid:n,coerced:!1,usedProvidedExample:s,validExample:o,errors:n?[]:r.flatMap(a=>a?.errors??[])}}convertUnion({resolvedSchema:t,unionType:r}){let n=r==="oneOf"?t.oneOf:t.anyOf;if(!(r in t)||n==null)return{isValid:!1,coerced:!1,usedProvidedExample:!1,validExample:null,errors:[]};let i=this.example!==void 0?this.example:this.maybeResolveSchemaExample(t);if(this.example===void 0){let d=[];for(let m of n){if(!m)continue;let g=this.context.resolveMaybeReference({schemaOrReference:m,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});g&&d.push(g)}if(d.length>0&&d.every(m=>fnm(m))){let m=d.findIndex(g=>yTu(g)!==void 0);if(m!==-1){let g=n[m],A=d[m];if(g&&A){let y=yTu(A),x=new e({breadcrumbs:[...this.breadcrumbs,`${r}[${m}]`],context:this.context,schema:r==="oneOf"?{...t,...g,oneOf:void 0}:g,example:y,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();if(x.isValid)return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:x.validExample,errors:[]}}}}}let o=[],s=null,a=null;for(let d=0;d<n.length;d++){let f=n[d];if(!f)continue;let m=r==="oneOf"?{...t,...f,oneOf:void 0}:f,g=i!==void 0?i:this.maybeResolveSchemaExample(m),y=new e({breadcrumbs:[...this.breadcrumbs,`${r}[${d}]`],context:this.context,schema:m,example:g,depth:this.depth+1,generateOptionalProperties:this.generateOptionalProperties,exampleGenerationStrategy:this.exampleGenerationStrategy,seenRefs:this.getMaybeUpdatedSeenRefs()}).convert();if(y.isValid&&!y.coerced&&y.usedProvidedExample)return{isValid:!0,coerced:!1,usedProvidedExample:!0,validExample:y.validExample,errors:[]};if(y.isValid&&!y.coerced&&this.example===void 0)return{isValid:!0,coerced:!1,usedProvidedExample:y.usedProvidedExample,validExample:y.validExample,errors:[]};o.push(y),y.isValid&&y.usedProvidedExample&&a===null&&(a=y),y.isValid&&s===null&&(s=y)}let c=a??s,u=c!==null,l=c?.validExample??o[0]?.validExample,p=c?.usedProvidedExample??!1;return{isValid:u,coerced:!1,usedProvidedExample:p,validExample:l,errors:u?[]:o.flatMap(d=>d.errors)}}convertOneOf({resolvedSchema:t}){return this.convertUnion({resolvedSchema:t,unionType:"oneOf"})}convertAnyOf({resolvedSchema:t}){return this.convertUnion({resolvedSchema:t,unionType:"anyOf"})}getMaybeUpdatedSeenRefs(){let t=new Set(this.seenRefs);return this.context.isReferenceObject(this.schema)&&t.add(this.schema.$ref),t}maybeResolveSchemaExample(t){if("example"in t)return t.example;if("examples"in t){let n=t.examples;if(Array.isArray(n)&&n.length>0)return n[0];if(n!=null&&typeof n=="object")return Object.values(n)[0]}let r=this.context.resolveMaybeReference({schemaOrReference:t,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(r!=null){if("example"in r)return r.example;if("examples"in r){let n=r.examples;return Array.isArray(n)&&n.length>0?n[0]:Object.values(n??{})[0]}}}maybeConvertLiteralFernType(t){let r=t["x-fern-type"];if(typeof r!="string")return;let n=r.match(unm);if(n!=null){if(n[1]!=null)return{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n[1],errors:[]};if(n[2]!=null)return{isValid:!0,coerced:!1,usedProvidedExample:!1,validExample:n[2]==="true",errors:[]}}}mergeAllOfProperties(t,r=new Set,n=0,i=!1){if(i){let p=this.sharedState.mergedAllOfProperties.get(t)?.get(n);if(p!=null)return p}let o=t.properties??{},s=t.required??[];if(n>this.MAX_DEPTH||t.allOf==null||t.allOf.length===0){let p={mergedProperties:o,mergedRequired:s};return i&&this.cacheMergedAllOfProperties(t,n,p),p}let a={},c=new Set(s);for(let p of t.allOf){let d=this.context.resolveMaybeReference({schemaOrReference:p,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(d==null)continue;let f=this.context.isReferenceObject(p)?p.$ref:void 0;if(!(f!=null&&r.has(f))){if(d.allOf!=null&&d.allOf.length>0){let m=new Set(r);f!=null&&m.add(f);let g=this.mergeAllOfProperties(d,m,n+1,i);for(let A of g.mergedRequired)c.add(A);for(let[A,y]of Object.entries(g.mergedProperties))if(typeof y=="object"&&y!==null){let E=a[A];E!=null&&h3e(E)&&h3e(y)?a[A]={...E,...y}:a[A]=y}continue}if(d.required!=null)for(let m of d.required)c.add(m);if(d.properties!=null){for(let[m,g]of Object.entries(d.properties))if(typeof g=="object"&&g!==null){let A=a[m];A!=null&&h3e(A)&&h3e(g)?a[m]={...A,...g}:a[m]=g}}}}let u={...o};for(let[p,d]of Object.entries(u)){let f=a[p];if(f==null||!h3e(d))continue;let m="$ref"in f?this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0}):f;m!=null&&(u[p]={...m,...d})}for(let[p,d]of Object.entries(a))p in u||(u[p]=d);let l={mergedProperties:u,mergedRequired:[...c]};return i&&this.cacheMergedAllOfProperties(t,n,l),l}cacheMergedAllOfProperties(t,r,n){let i=this.sharedState.mergedAllOfProperties.get(t);i!=null?i.set(r,n):this.sharedState.mergedAllOfProperties.set(t,new Map([[r,n]]))}canGenerateFromMergedAllOf(t,r=new WeakSet){if(t.allOf==null||t.allOf.length===0||!this.isMergeOnlyObjectSchema(t))return!1;let n=this.sharedState.mergeOnlyAllOfSchemas.get(t);if(n!=null)return n;if(r.has(t))return!1;r.add(t);let i=t.allOf.every(o=>{let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});return s==null||!this.isMergeOnlyObjectSchema(s)?!1:s.allOf==null||s.allOf.length===0?!0:this.canGenerateFromMergedAllOf(s,r)});return r.delete(t),this.sharedState.mergeOnlyAllOfSchemas.set(t,i),i}isMergeOnlyObjectSchema(t){return t.type!=null&&t.type!=="object"||t.type==null&&t.properties==null&&t.allOf==null?!1:Object.keys(t).every(r=>lnm.has(r))}isConstraintOnlySchema(t){if(typeof t!="object"||t===null||t.type!==void 0||t.properties!==void 0||t.allOf!==void 0||t.oneOf!==void 0||t.anyOf!==void 0||"items"in t||t.additionalProperties!==void 0||t.enum!==void 0||t.const!==void 0)return!1;let r=new Set(["required","description","title","deprecated","readOnly","writeOnly","nullable","example","examples","default","minLength","maxLength","minimum","maximum","exclusiveMinimum","exclusiveMaximum","minItems","maxItems","uniqueItems","pattern","format"]),n=Object.keys(t);return n.length>0&&n.every(i=>r.has(i))}isDeprecatedProperty(t){return t!=null&&"availability"in t&&t.availability==="deprecated"}isRequiredProperty({key:t,resolvedSchema:r}){return r.required?.includes(t)??!1}collectAllPropertyKeys(t,r=new Set){let n=new Set;if(t.properties)for(let i of Object.keys(t.properties))n.add(i);for(let i of t.allOf??[]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)){r.add(s);let a=this.collectAllPropertyKeys(o,r);for(let c of a)n.add(c)}}}for(let i of[...t.oneOf??[],...t.anyOf??[]]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)){r.add(s);let a=this.collectAllPropertyKeys(o,r);for(let c of a)n.add(c)}}}return n}schemaHasPatternProperties(t,r=new Set){let n=t.patternProperties;if(n&&typeof n=="object"&&Object.keys(n).length>0)return!0;for(let i of[...t.allOf??[],...t.oneOf??[],...t.anyOf??[]]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)&&(r.add(s),this.schemaHasPatternProperties(o,r)))return!0}}return!1}}});function bTu(e){return _v({type:e,_default:void 0,validation:void 0,visitor:{primitive:t=>{switch(t.v1){case"BASE_64":return Jr.primitive({v1:"BASE_64",v2:hi.base64({})});case"BOOLEAN":return Jr.primitive({v1:"BOOLEAN",v2:hi.boolean({default:void 0})});case"DATE":return Jr.primitive({v1:"DATE",v2:hi.date({})});case"DATE_TIME":return Jr.primitive({v1:"DATE_TIME",v2:hi.dateTime({})});case"DATE_TIME_RFC_2822":return Jr.primitive({v1:"DATE_TIME_RFC_2822",v2:hi.dateTimeRfc2822({})});case"FLOAT":return Jr.primitive({v1:"FLOAT",v2:hi.float({default:void 0,validation:void 0})});case"DOUBLE":return Jr.primitive({v1:"DOUBLE",v2:hi.double({default:void 0,validation:void 0})});case"UINT":return Jr.primitive({v1:"UINT",v2:hi.uint({default:void 0,validation:void 0})});case"UINT_64":return Jr.primitive({v1:"UINT_64",v2:hi.uint64({default:void 0,validation:void 0})});case"INTEGER":return Jr.primitive({v1:"INTEGER",v2:hi.integer({default:void 0,validation:void 0})});case"LONG":return Jr.primitive({v1:"LONG",v2:hi.long({default:void 0,validation:void 0})});case"STRING":return Jr.primitive({v1:"STRING",v2:hi.string({default:void 0,validation:void 0})});case"UUID":return Jr.primitive({v1:"UUID",v2:hi.uuid({})});case"BIG_INTEGER":return Jr.primitive({v1:"BIG_INTEGER",v2:hi.bigInteger({default:void 0})});default:return}},unknown:()=>Jr.unknown(),map:({keyType:t,valueType:r})=>{if(!(t==null||r==null))return Jr.container(gs.map({keyType:t,valueType:r}))},list:t=>{if(t!=null)return Jr.container(gs.list(t))},optional:t=>{if(t!=null)return Jr.container(gs.optional(t))},nullable:t=>{if(t!=null)return Jr.container(gs.nullable(t))},set:t=>{if(t!=null)return Jr.container(gs.set(t))},literal:t=>Jr.container(gs.literal(t._visit({string:r=>w0.string(r),boolean:r=>w0.boolean(r),_other:()=>{throw new S({message:"Unexpected literal type",code:S.Code.InternalError})}}))),named:()=>{}}})}var ETu=h(()=>{"use strict";lo();_n();Ft()});var ixe,u5r=h(()=>{"use strict";_n();tc();Uo();ixe=class extends Ji{schema;maybeFernEnum;forwardCompatible;constructor({context:t,breadcrumbs:r,schema:n,maybeFernEnum:i,forwardCompatible:o}){super({context:t,breadcrumbs:r}),this.schema=n,this.maybeFernEnum=i,this.forwardCompatible=o??!1}convert(){if(!this.schema.enum)return;let r=this.schema.enum.filter(i=>typeof i=="string"||typeof i=="number").map(i=>{let o=i.toString(),s=this.maybeFernEnum?.[o],a=s?.name??o;return{name:this.context.casingsGenerator.generateNameAndWireValue({name:a,wireValue:o}),docs:s?.description,availability:void 0,casing:s?.casing}});if(r.length===0){this.context.errorCollector.collect({message:`Received enum schema with no valid values: ${JSON.stringify(this.schema)}`,path:this.breadcrumbs});return}let n=this.context.getAsString(this.schema.default);return{type:vc.enum({default:n!=null?r.find(i=>nr(i.name)===n):void 0,values:r,forwardCompatible:this.forwardCompatible||void 0})}}}});var l5r,ITu=h(()=>{"use strict";_n();Uo();yUt();g3e();l5r=class extends Ji{schemaOrReferenceOrBoolean;constructor({context:t,breadcrumbs:r,schemaOrReferenceOrBoolean:n}){super({context:t,breadcrumbs:r}),this.schemaOrReferenceOrBoolean=n}convert(){let t=this.tryConvertUnknownMap();if(t!=null)return t;let r=this.tryConvertTypedMap();if(r!=null)return r}tryConvertUnknownMap(){if(typeof this.schemaOrReferenceOrBoolean=="boolean"){let t=Jr.container(gs.map({keyType:Ji.STRING,valueType:Jr.unknown()}));return{type:vc.alias({aliasOf:t,resolvedType:t}),referencedTypes:new Set,inlinedTypes:{}}}}tryConvertTypedMap(){if(typeof this.schemaOrReferenceOrBoolean=="boolean")return;let r=new oT({context:this.context,breadcrumbs:this.breadcrumbs,schemaOrReference:this.schemaOrReferenceOrBoolean}).convert();if(r!=null){let n=Jr.container(gs.map({keyType:Ji.STRING,valueType:r.type})),i=new Set;for(let o of r.schema?.typeDeclaration.referencedTypes??[])i.add(o);for(let o of Object.keys(r.inlinedTypes))i.add(o);return FH(r.type,i),{type:vc.alias({aliasOf:n,resolvedType:n}),referencedTypes:i,inlinedTypes:r.inlinedTypes}}}}});function CTu(e,t,r){let n=wTu(t,r),i={};for(let o of n)i=mNo(i,o);return ynm(i,e),i}function wTu(e,t,r){let n=r??new Set,i=[];for(let o of e)if(Array.isArray(o.allOf)&&o.allOf.length>0){let{allOf:s,...a}=o,c=[];for(let u of s)if("$ref"in u){if(t==null)continue;let l=u.$ref;if(n.has(l))continue;n.add(l);let p=t(u);p!=null&&c.push(p)}else c.push(u);i.push(...wTu(c,t,n)),Object.keys(a).length>0&&i.push(a)}else i.push(o);return i}function mNo(e,t){let r={...e};for(let[n,i]of Object.entries(t)){if(i===void 0||gnm.includes(n))continue;let o=r[n];if(n==="required"){let s=Array.isArray(o)?o:[],a=Array.isArray(i)?i:[];r[n]=[...new Set([...s,...a])];continue}if(n==="properties"){r[n]=Anm(o??{},i);continue}if(n==="items"){oxe(o)&&oxe(i)?r[n]=mNo(o,i):r[n]=i;continue}if(vTu.includes(n)){oxe(o)&&oxe(i)?r[n]=STu(o,i):r[n]=i;continue}if(xTu.includes(n)){r[n]=!!o||!!i;continue}if(mnm.includes(n)){typeof o=="number"&&typeof i=="number"?r[n]=Math.max(o,i):r[n]=i;continue}if(hnm.includes(n)){typeof o=="number"&&typeof i=="number"?r[n]=Math.min(o,i):r[n]=i;continue}r[n]=i}return r}function Anm(e,t){let r={...e};for(let[n,i]of Object.entries(t)){let o=r[n];oxe(o)&&oxe(i)?r[n]=mNo(o,i):r[n]=i}return r}function STu(e,t){let r={...e};for(let[n,i]of Object.entries(t)){let o=r[n];oxe(o)&&oxe(i)?r[n]=STu(o,i):r[n]=i}return r}function ynm(e,t){for(let r of dnm){let n=t[r];n!=null&&(e[r]=n)}for(let r of vTu){let n=t[r];n!=null&&(e[r]=n)}for(let r of xTu)t[r]===!0&&(e[r]=!0)}function oxe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var dnm,vTu,xTu,mnm,hnm,gnm,TTu=h(()=>{"use strict";dnm=["description","title","format","type","discriminator","xml","externalDocs","extensions"],vTu=["example","default"],xTu=["deprecated","readOnly","writeOnly","uniqueItems","nullable"],mnm=["minimum","exclusiveMinimum","minLength","minItems","minProperties"],hnm=["maximum","exclusiveMaximum","maxLength","maxItems","maxProperties"],gnm=["allOf","oneOf","anyOf"]});var Cit,hNo=h(()=>{"use strict";wt();_n();tc();c5r();Uo();yUt();Cit=class extends Ji{schema;xmlEncoding;constructor({context:t,breadcrumbs:r,schema:n,id:i}){super({context:t,breadcrumbs:r}),this.schema=n,this.xmlEncoding=new vit({breadcrumbs:this.breadcrumbs,schema:n,fallbackName:i,context:t}).convert()}convert(){let t=typeof this.schema.additionalProperties=="boolean"&&this.schema.additionalProperties;if(!this.schema.properties&&!this.schema.allOf)return{type:vc.object({properties:[],extends:[],extendedProperties:[],extraProperties:t,deferredUnionBaseProperties:void 0}),propertiesByAudience:{},inlinedTypes:{},referencedTypes:new Set,xmlEncoding:this.xmlEncoding};let{convertedProperties:r,inlinedTypesFromProperties:n,referencedTypes:i,propertiesByAudience:o}=A3e({properties:this.schema.properties??{},required:this.schema.required??[],breadcrumbs:this.breadcrumbs,context:this.context,errorCollector:this.context.errorCollector,withinXmlElement:this.xmlEncoding!=null}),s=[],a=i,c=this.schema.required!=null&&this.schema.required.length>0,u=n,l=o,p={};for(let d of this.schema.allOf??[])if(this.context.isReferenceObject(d)){let f=this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:this.breadcrumbs});if(f?.properties!=null)for(let[m,g]of Object.entries(f.properties))!this.context.isReferenceObject(g)&&p[m]==null&&(p[m]=g)}for(let[d,f]of(this.schema.allOf??[]).entries()){let m=[...this.breadcrumbs,"allOf",d.toString()],g,A=!1;if(this.context.isReferenceObject(f)){let D=this.context.resolveMaybeReference({schemaOrReference:f,breadcrumbs:m});if(D==null){this.context.logger.debug?.(`[ObjectSchemaConverter] allOf[${d}] reference could not be resolved. Skipping: ${JSON.stringify(f)}`);continue}if(g=D,typeof g.additionalProperties=="boolean"&&g.additionalProperties&&(t=!0),!c||Object.keys(g.properties??{}).every(R=>!this.schema.required?.includes(R))){this.addTypeReferenceToExtends({reference:f,breadcrumbs:m,extends_:s,referencedTypes:a});continue}}else g=f,A=!0;typeof g.additionalProperties=="boolean"&&g.additionalProperties&&(t=!0);let y=g.oneOf??g.anyOf;if(y!=null&&g.type==null&&g.properties==null){let D=new Set(r.map(R=>nr(R.name)));for(let[R,P]of y.entries()){let M=[...m,g.oneOf!=null?"oneOf":"anyOf",R.toString()],J=this.context.isReferenceObject(P)?this.context.resolveMaybeReference({schemaOrReference:P,breadcrumbs:M}):P;if(J==null)continue;let X={};for(let[De,se]of Object.entries(J.properties??{}))!this.context.isReferenceObject(se)&&"not"in se||(X[De]=se);let $=Object.keys(X).filter(De=>!D.has(De));if($.length===0)continue;let ie={};for(let De of $){let se=X[De];se!=null&&(ie[De]=se,D.add(De))}let{convertedProperties:ue,inlinedTypesFromProperties:oe,referencedTypes:de,propertiesByAudience:we}=A3e({properties:ie,required:[],breadcrumbs:M,context:this.context,errorCollector:this.context.errorCollector,withinXmlElement:this.xmlEncoding!=null});r.push(...ue),u={...u,...oe},l={...l,...we},de.forEach(De=>{a.add(De)})}continue}let E=g.properties??{};if(A){E={};for(let[D,R]of Object.entries(g.properties??{})){let P=p[D];P!=null&&!this.context.isReferenceObject(R)?E[D]={...P,...R}:E[D]=R}}let{convertedProperties:x,inlinedTypesFromProperties:v,referencedTypes:C,propertiesByAudience:O}=A3e({properties:E,required:[...this.schema.required??[],...g.required??[],..._ue(g)],breadcrumbs:m,context:this.context,errorCollector:this.context.errorCollector,withinXmlElement:this.xmlEncoding!=null});r.push(...x),u={...u,...v},l={...l,...O},C.forEach(D=>{a.add(D)})}for(let d of Object.keys(u))a.add(d);return{type:vc.object({properties:r,extends:s.map(d=>this.context.typeReferenceToDeclaredTypeName(d)).filter(sa),extendedProperties:[],extraProperties:t,deferredUnionBaseProperties:void 0}),propertiesByAudience:l,referencedTypes:a,inlinedTypes:u,xmlEncoding:this.xmlEncoding}}addTypeReferenceToExtends({reference:t,breadcrumbs:r,extends_:n,referencedTypes:i}){let o=this.context.convertReferenceToTypeReference({reference:t,breadcrumbs:r});o.ok&&n.push(o.reference);let s=this.context.getTypeIdFromSchemaReference(t);s!=null&&i.add(s)}}});function bnm(e){return e.type==="union"&&e.types.length===0}function Enm({schema:e,discriminantProperty:t}){let r=e.properties?.[t];if(r==null||"$ref"in r)return;let n=r.const;if(typeof n=="string")return n;if(r.enum?.length===1&&typeof r.enum[0]=="string")return r.enum[0]}var y3e,gNo=h(()=>{"use strict";_n();uNo();lNo();pNo();Uo();yUt();u5r();p5r();g3e();y3e=class extends Ji{schema;id;constructor({context:t,breadcrumbs:r,schema:n,id:i,inlinedTypes:o}){super({context:t,breadcrumbs:r}),this.schema=n,this.id=i}convert(){if(this.shouldConvertAsNullableSchemaOrReference())return this.convertAsNullableSchemaOrReference();if(new bit({context:this.context,breadcrumbs:this.breadcrumbs,node:this.schema}).convert()===!1)return this.convertAsUndiscriminatedUnion();if(this.schema.discriminator!=null){let n=this.convertAsDiscriminatedUnion();return n!=null&&!bnm(n.type)?n:this.convertAsUndiscriminatedUnion()??n}if(this.context.settings.inferForwardCompatible){let n=this.convertAsOpenEndedEnum();if(n!=null)return n}return this.convertAsUndiscriminatedUnion()}convertAsOpenEndedEnum(){let t=this.schema.oneOf??this.schema.anyOf;if(t==null||t.length!==2)return;let r,n=!1;for(let c of t){let u;if(this.context.isReferenceObject(c)){let l=this.context.resolveReference({reference:c,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});l.resolved&&(u=l.value)}else u=c;u!=null&&(u.enum!=null&&u.enum.length>1&&(u.type==="string"||u.type==null)?r=u:u.type==="string"&&u.enum==null&&(n=!0))}if(r==null||!n)return;let o=new Iit({breadcrumbs:this.breadcrumbs,schema:r,context:this.context}).convert(),a=new ixe({context:this.context,breadcrumbs:this.breadcrumbs,schema:r,maybeFernEnum:o,forwardCompatible:!0}).convert();if(a!=null)return{...a,referencedTypes:new Set,inlinedTypes:{}}}filterDiscriminantFromSchema(t,r){if(t.properties==null||!(r in t.properties))return t;let{[r]:n,...i}=t.properties,o=t.required?.filter(s=>s!==r);return{...t,properties:i,required:o}}getVariants(t){let r=this.schema.discriminator?.mapping;if(r!=null){let o=[];for(let[s,a]of Object.entries(r)){let c=this.context.getTypeIdFromSchemaReference({$ref:a});c!=null&&o.push({discriminant:s,typeId:c,ref:a,schema:this.resolveVariantSchema({$ref:a}),breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",s]})}return o}let n=this.schema.oneOf??this.schema.anyOf??[],i=[];for(let[o,s]of n.entries()){let a=this.resolveVariantSchema(s),c=a!=null?Enm({schema:a,discriminantProperty:t}):void 0;if(!this.context.isReferenceObject(s)){if(c==null)return[];i.push({discriminant:c,typeId:this.context.convertBreadcrumbsToName([`${this.id}_${o}`]),schema:a,breadcrumbs:[...this.breadcrumbs,`oneOf[${o}]`]});continue}let u=s.$ref,l=u.split("/").pop(),p=this.context.getTypeIdFromSchemaReference(s),d=c??l;if(p==null||d==null)return[];i.push({discriminant:d,typeId:p,ref:u,schema:a,breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",d]})}return i}resolveVariantSchema(t){if(!this.context.isReferenceObject(t))return t;let r=this.context.resolveReference({reference:t,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});return r.resolved?r.value:void 0}convertAsDiscriminatedUnion(){if(this.schema.discriminator==null)return;let t=this.schema.discriminator.propertyName,r=[],n=new Set,i={};for(let{discriminant:l,typeId:p,ref:d,schema:f,breadcrumbs:m}of this.getVariants(t)){let g=d!=null?{$ref:d}:f;if(f?.properties!=null&&t in f.properties&&(g=this.filterDiscriminantFromSchema(f,t)),g==null)continue;let A=new oT({context:this.context,schemaOrReference:g,schemaIdOverride:p??void 0,breadcrumbs:m});p!=null&&n.add(p);let y=A.convert();if(y?.type!=null&&p!=null){for(let D of Object.keys(y?.inlinedTypes??{}))n.add(D);for(let D of y.schema?.typeDeclaration.referencedTypes??[])n.add(D);let E=this.context.casingsGenerator.generateNameAndWireValue({name:l,wireValue:l}),x=d?.split("/").pop()??p,v=f?.title,C=f?.description,O=v??l??x;y.schema?.typeDeclaration!=null&&v!=null&&(y.schema.typeDeclaration.name.displayName=v),r.push({docs:C,discriminantValue:E,availability:y.availability,displayName:O,shape:s1.samePropertiesAsObject({typeId:p,name:this.context.casingsGenerator.generateName(x),fernFilepath:{allParts:[],packagePath:[],file:void 0},displayName:O})}),i={...i,...y.inlinedTypes}}}let{convertedProperties:o,referencedTypes:s,inlinedTypesFromProperties:a}=A3e({properties:this.schema.properties??{},required:this.schema.required??[],breadcrumbs:this.breadcrumbs,context:this.context,errorCollector:this.context.errorCollector});n=new Set([...n,...s]);let c=[];for(let[l,p]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",l.toString()];if(this.context.isReferenceObject(p)){let f=this.context.convertReferenceToTypeReference({reference:p,breadcrumbs:d});if(f.ok){let g=this.context.typeReferenceToDeclaredTypeName(f.reference);g!=null&&c.push(g)}let m=this.context.getTypeIdFromSchemaReference(p);m!=null&&n.add(m);continue}}for(let l of Object.keys({...i,...a}))n.add(l);let u=new Eit({context:this.context,breadcrumbs:[...this.breadcrumbs,"discriminator"],node:this.schema.discriminator});return{type:vc.union({baseProperties:o,inheritedBaseProperties:[],discriminant:this.context.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:c,types:r,default:void 0,discriminatorContext:u.convert()}),referencedTypes:n,inlinedTypes:{...i,...a}}}convertAsUndiscriminatedUnion(){if(!this.schema.oneOf&&!this.schema.anyOf||this.schema.anyOf?.length===0&&this.schema.oneOf?.length===0)return;let t=[],r=new Set,n={};for(let[a,c]of[...(this.schema.oneOf??[]).entries(),...(this.schema.anyOf??[]).entries()]){if(this.context.isReferenceObject(c)){let g;if(this.context.isReferenceObjectWithIdentifier(c))g=this.context.convertReferenceToTypeReference({reference:c,displayNameOverride:c.summary??c.title??c.name??c.messageId,displayNameOverrideSource:"reference_identifier"});else{let y=this.getDiscriminatorKeyForRef(c);y!=null?g=this.context.convertReferenceToTypeReference({reference:c,displayNameOverride:y,displayNameOverrideSource:"discriminator_key"}):g=this.context.convertReferenceToTypeReference({reference:c,breadcrumbs:this.breadcrumbs})}if(g.ok){let y=this.context.resolveReference({reference:c,breadcrumbs:this.breadcrumbs}),E=y.resolved?y.value.description:void 0;t.push({type:g.reference,docs:E})}let A=this.context.getTypeIdFromSchemaReference(c);A!=null&&r.add(A);continue}let l=Object.keys(this.schema.properties??{}).length>0?void 0:this.extendSubSchema(c),p=this.context.convertBreadcrumbsToName([`${this.id}_${a}`]),d=c.title,m=new sxe({context:this.context,id:p,nameOverride:d,breadcrumbs:[...this.breadcrumbs,`oneOf[${a}]`],schema:l??c}).convert();if(m!=null){let g=m.convertedSchema.typeDeclaration.shape;if(g.type==="alias"&&this.typeReferenceIsWrappedPrimitive(g.aliasOf))t.push({type:g.aliasOf,docs:c.description});else if(g.type==="object"&&g.properties.length===0&&g.extends.length===0)t.push({type:Jr.container(gs.map({keyType:Ji.STRING,valueType:Jr.unknown()})),docs:c.description});else{t.push({type:this.context.createNamedTypeReference(p,d),docs:c.description});let A=this.context.getNamespacedSchemaId(p);n={...n,...m.inlinedTypes,[A]:m.convertedSchema}}m.convertedSchema.typeDeclaration.referencedTypes.forEach(A=>{r.add(A)})}}let{convertedProperties:i,referencedTypes:o,inlinedTypesFromProperties:s}=A3e({properties:this.schema.properties??{},required:this.schema.required??[],breadcrumbs:this.breadcrumbs,context:this.context,errorCollector:this.context.errorCollector});for(let a of Object.keys(s))r.add(a);for(let a of o)r.add(a);return{type:vc.undiscriminatedUnion({members:t,baseProperties:i.length>0?i:void 0}),referencedTypes:r,inlinedTypes:{...n,...s}}}shouldConvertAsNullableSchemaOrReference(){return this.schema.oneOf!=null?this.schema.oneOf.some(t=>t&&typeof t=="object"&&"type"in t&&t.type==="null"):this.schema.anyOf!=null?this.schema.anyOf.some(t=>t&&typeof t=="object"&&"type"in t&&t.type==="null"):!1}removeNullFromOneOfOrAnyOf(){let t=this.schema.oneOf??this.schema.anyOf,r=this.schema.oneOf!=null?"oneOf":"anyOf";if(t==null)return;let n=t.filter(i=>!(typeof i=="object"&&i!==null&&"type"in i&&i.type==="null"));if(n.length===0){this.context.errorCollector.collect({message:`Received ${r} schema with no valid non-null types`,path:this.breadcrumbs});return}return n.length===1?{...this.schema,[r]:void 0,...n[0]}:{...this.schema,[r]:n}}convertAsNullableSchemaOrReference(){let t=this.removeNullFromOneOfOrAnyOf();if(t==null)return;let n=new oT({context:this.context,breadcrumbs:this.breadcrumbs,schemaOrReference:t}).convert();if(n==null)return;let i=this.wrapInNullable(n.type);return{type:vc.alias({aliasOf:i,resolvedType:i}),referencedTypes:n.schema?.typeDeclaration.referencedTypes??new Set,inlinedTypes:n.inlinedTypes}}typeReferenceIsWrappedPrimitive(t){switch(t.type){case"container":return this.containerTypeIsWrappedPrimitive(t.container);case"named":return!1;case"primitive":return!0;case"unknown":return!0;default:return!1}}containerTypeIsWrappedPrimitive(t){switch(t.type){case"list":return this.typeReferenceIsWrappedPrimitive(t.list);case"map":return this.typeReferenceIsWrappedPrimitive(t.keyType)&&this.typeReferenceIsWrappedPrimitive(t.valueType);case"nullable":return this.typeReferenceIsWrappedPrimitive(t.nullable);case"optional":return this.typeReferenceIsWrappedPrimitive(t.optional);case"set":return this.typeReferenceIsWrappedPrimitive(t.set);case"literal":return!0;default:return!1}}wrapInNullable(t){return Jr.container(gs.nullable(t))}mergeIntoObjectSchema(t,r){return{...t,properties:{...r,...t.properties??{}}}}extendSubSchema(t){if(Object.entries(this.schema.properties??{}).length===0)return t;if(t.type==="object")return this.mergeIntoObjectSchema(t,this.schema.properties??{});this.context.isObjectSchemaType(t)||this.context.errorCollector.collect({message:"Received additional object properties for oneOf/anyOf that are not objects",path:this.breadcrumbs})}getDiscriminatorKeyForRef(t){return Object.entries(this.schema.discriminator?.mapping??{}).find(([r,n])=>n===t.$ref)?.[0]}}});var wit,ANo=h(()=>{"use strict";_n();Uo();wit=class extends Ji{schema;constructor({context:t,breadcrumbs:r,schema:n}){super({context:t,breadcrumbs:r}),this.schema=n}convert(){switch(this.schema.type){case"string":{let t=this.context.getAsString(this.schema.const);if(t!=null)return Jr.container(gs.literal(w0.string(t)));if(this.schema.format==="date-time-rfc-2822")return Jr.primitive({v1:as.DateTimeRfc2822,v2:hi.dateTimeRfc2822({})});if(this.context.settings.typeDatesAsStrings===!1){if(this.schema.format==="date")return Jr.primitive({v1:as.Date,v2:hi.date({})});if(this.schema.format==="date-time")return Jr.primitive({v1:as.DateTime,v2:hi.dateTime({})})}return Jr.primitive({v1:"STRING",v2:hi.string({default:this.context.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":switch(this.schema.format){case"double":return Jr.primitive({v1:"DOUBLE",v2:hi.double({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return Jr.primitive({v1:"FLOAT",v2:hi.float({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return Jr.primitive({v1:"INTEGER",v2:hi.integer({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return Jr.primitive({v1:"LONG",v2:hi.long({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint32":return Jr.primitive({v1:"UINT",v2:hi.uint({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return Jr.primitive({v1:"UINT_64",v2:hi.uint64({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return Jr.primitive({v1:"DOUBLE",v2:hi.double({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"integer":switch(this.schema.format){case"double":return Jr.primitive({v1:"DOUBLE",v2:hi.double({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return Jr.primitive({v1:"FLOAT",v2:hi.float({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return Jr.primitive({v1:"INTEGER",v2:hi.integer({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return Jr.primitive({v1:"LONG",v2:hi.long({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint32":return Jr.primitive({v1:"UINT",v2:hi.uint({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return Jr.primitive({v1:"UINT_64",v2:hi.uint64({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return Jr.primitive({v1:"INTEGER",v2:hi.integer({default:this.context.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let t=this.context.getAsBoolean(this.schema.const);return t!=null?Jr.container(gs.literal(w0.boolean(t))):Jr.primitive({v1:"BOOLEAN",v2:hi.boolean({default:this.context.getAsBoolean(this.schema.default)})})}default:return}}getNumberValidation(t){let r=t.minimum,n=t.maximum,i,o;return typeof t.exclusiveMinimum=="boolean"?i=t.exclusiveMinimum:typeof t.exclusiveMinimum=="number"&&(r=t.exclusiveMinimum,i=!0),typeof t.exclusiveMaximum=="boolean"?o=t.exclusiveMaximum:typeof t.exclusiveMaximum=="number"&&(n=t.exclusiveMaximum,o=!0),{max:n,min:r,exclusiveMax:o,exclusiveMin:i,multipleOf:t.multipleOf}}getStringValidation(t){let r=t.format??(t.contentMediaType==="application/octet-stream"?"binary":void 0);return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:r}}}});function vnm(e){let t=_ue(e);return t.length===0?e:{...e,required:[...new Set([...e.required??[],...t])]}}var Inm,sxe,p5r=h(()=>{"use strict";wt();_n();Uo();ETu();nxe();yNo();u5r();ITu();TTu();hNo();gNo();ANo();Inm=["description","example","title","default","deprecated","readOnly","writeOnly","xml","externalDocs","extensions"],sxe=class e extends Ji{static MAX_DISTRIBUTED_VARIANTS=64;schema;id;inlined;audiences;nameOverride;visitedRefs;constructor({context:t,breadcrumbs:r,schema:n,id:i,inlined:o=!1,nameOverride:s,visitedRefs:a}){super({context:t,breadcrumbs:r}),this.schema=n,this.id=i,this.inlined=o,this.nameOverride=s,this.visitedRefs=a??new Set,this.audiences=this.context.getAudiences({operation:this.schema,breadcrumbs:this.breadcrumbs})??[]}convert(){let t=this.tryConvertFernTypeDeclaration();if(t!=null)return t;let r=this.tryConvertEnumSchema();if(r!=null)return r;let n=this.tryDistributeAllOfOverOneOf();if(n!=null)return n;let i=this.tryConvertSingularAllOfSchema();if(i!=null)return i;let o=this.tryConvertPrimitiveSchema();if(o!=null)return o;let s=this.tryConvertArraySchema();if(s!=null)return s;let a=this.tryConvertTypeArraySchema();if(a!=null)return a;let c=this.tryConvertSiblingAnyOfConstraint();if(c!=null)return c;let u=this.tryConvertSiblingOneOfConstraint();if(u!=null)return u;let l=this.tryConvertOneOfAnyOfSchema();if(l!=null)return l;let p=this.tryConvertMapSchema();if(p!=null)return p;let d=this.tryConvertDiscriminatorMappingSchema();if(d!=null)return d;let f=this.tryConvertObjectAllOfSchema();if(f!=null)return f;let m=this.tryConvertUntypedSchema();if(m!=null)return m;this.context.errorCollector.collect({message:`Failed to convert schema object: ${JSON.stringify(this.schema,null,2)}`,path:this.breadcrumbs})}tryConvertEnumSchema(){if(!this.schema.enum?.length)return;let r=new ux.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema,context:this.context}).convert(),i=new ixe({context:this.context,breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:r}).convert();if(i!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:i.type,referencedTypes:new Set}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:{}}}tryConvertSingularAllOfSchema(){if(this.schemaOnlyHasAllowedKeys(["allOf","type","title"])&&this.schema.allOf?.length===1&&this.schema.allOf[0]!=null){let r=this.schema.allOf[0];if(this.context.isReferenceObject(r)){let i=r.$ref;if(this.visitedRefs.has(i))return}let n=this.context.resolveMaybeReference({schemaOrReference:r,breadcrumbs:this.breadcrumbs});if(n!=null){let i=this.context.isReferenceObject(r)?new Set([...this.visitedRefs,r.$ref]):this.visitedRefs,s=new e({context:this.context,breadcrumbs:[...this.breadcrumbs,"allOf","0"],schema:n,id:this.id,inlined:this.inlined,visitedRefs:i}).convert();if(s?.convertedSchema.typeDeclaration?.shape.type!=="object"){if(s!=null){let a=s.convertedSchema.typeDeclaration;this.schema.description!=null&&a.docs==null&&(a.docs=this.schema.description);let c=this.context.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs});c!=null&&a.availability==null&&(a.availability=c)}return s}}}if(this.schemaOnlyHasAllowedKeys(["allOf","type","title"])&&Array.isArray(this.schema.allOf)&&this.schema.allOf.length>=1){let r=new Set,n=[],i=!1;for(let c of this.schema.allOf??[]){let u;if(this.context.isReferenceObject(c)){let p=c.$ref;if(this.visitedRefs.has(p)){i=!0;break}if(r.has(p))continue;r.add(p);let d=this.context.resolveMaybeReference({schemaOrReference:c,breadcrumbs:this.breadcrumbs});if(d==null)return;u=d}else u=c;let l=u.oneOf??u.anyOf;if(!this.context.isReferenceObject(c)&&l!=null&&u.type==null&&u.properties==null){let p={};for(let d of l){let f=this.context.isReferenceObject(d)?this.context.resolveMaybeReference({schemaOrReference:d,breadcrumbs:this.breadcrumbs}):d;if(f!=null)for(let[m,g]of Object.entries(f.properties??{}))!this.context.isReferenceObject(g)&&"not"in g||m in p||(p[m]=g)}Object.keys(p).length>0&&n.push({properties:p});continue}n.push(vnm(u))}if(i)return;let o=CTu(this.schema,n,c=>{let u=this.context.resolveMaybeReference({schemaOrReference:c,breadcrumbs:this.breadcrumbs});if(!(u!=null&&this.context.isReferenceObject(u)))return u}),s=new Set([...this.visitedRefs,...r]);return new e({context:this.context,breadcrumbs:this.breadcrumbs,schema:o,id:this.id,inlined:this.inlined,visitedRefs:s}).convert()}}tryDistributeAllOfOverOneOf(){if(!this.context.settings.preserveOneOfInAllOf)return;let t=this.schema.allOf;if(!Array.isArray(t)||t.length===0||this.schema.oneOf!=null||this.schema.anyOf!=null)return;let r=this.getDistributableUnions(t),n=r[0];if(n==null)return;let i=r.reduce((c,u)=>c*u.variants.length,1);if(i>e.MAX_DISTRIBUTED_VARIANTS){this.context.logger.warn(`Not distributing allOf over its ${r.length} unions at ${this.breadcrumbs.join(".")}: it would produce ${i} variants (max ${e.MAX_DISTRIBUTED_VARIANTS}).`);return}let o=t.filter((c,u)=>u!==n.index);(this.schema.properties!=null||this.schema.required!=null)&&o.push({type:"object",properties:this.schema.properties,required:this.schema.required});let s={...this.schema};return delete s.allOf,delete s.properties,delete s.required,new e({context:this.context,breadcrumbs:this.breadcrumbs,schema:{...s,oneOf:n.variants.map(c=>{let u=this.getVariantTitle(c);return{...u!=null?{title:u}:{},allOf:[c,...o]}})},id:this.id,inlined:this.inlined,nameOverride:this.nameOverride,visitedRefs:this.visitedRefs}).convert()}getVariantTitle(t){return this.context.isReferenceObject(t)?this.context.resolveMaybeReference({schemaOrReference:t,breadcrumbs:this.breadcrumbs})?.title??t.$ref.split("/").pop():t.title}getDistributableUnions(t){let r=[];for(let[n,i]of t.entries()){let o=this.context.isReferenceObject(i)?this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs}):i;if(o==null||o.properties!=null||o.type!=null&&o.type!=="object"||o.discriminator!=null)continue;let s=o.oneOf??o.anyOf;s==null||s.length===0||r.push({index:n,variants:s})}return r}tryConvertPrimitiveSchema(){let r=new wit({context:this.context,schema:this.schema}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:vc.alias({aliasOf:r,resolvedType:r}),referencedTypes:new Set}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:{}}}tryConvertArraySchema(){if(this.schema.type==="array"){let r=new Sit({context:this.context,breadcrumbs:this.breadcrumbs,schema:this.schema}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:vc.alias({aliasOf:r.typeReference,resolvedType:r.typeReference}),referencedTypes:r.referencedTypes}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:r.inlinedTypes}}}tryConvertTypeArraySchema(){if(Array.isArray(this.schema.type)&&this.schema.type.length>0)return this.schema.type.length===1?this.schema.type=this.schema.type[0]:(this.schema.oneOf=this.schema.type.map(t=>({type:t})),this.schema.type=void 0),this.convert()}tryConvertSiblingAnyOfConstraint(){if(!this.context.settings.anyOfSiblingPropertiesAsObject||!zNe(this.schema))return;this.context.logger.debug(`Treating the anyOf at ${this.breadcrumbs.join(".")} as an "at least one of" constraint over its sibling properties rather than a union, and converting the schema as an object.`);let{anyOf:t,...r}=this.schema;return new e({id:this.id,context:this.context,breadcrumbs:this.breadcrumbs,schema:r,inlined:this.inlined,nameOverride:this.nameOverride,visitedRefs:this.visitedRefs}).convert()}tryConvertSiblingOneOfConstraint(){if(!MNe(this.schema)||new ux.FernDiscriminatedExtension({context:this.context,breadcrumbs:this.breadcrumbs,node:this.schema}).convert()===!0)return;this.context.logger.debug(`Treating the oneOf at ${this.breadcrumbs.join(".")} as an "exactly one of" constraint over its sibling properties rather than a union, and converting the schema as an object.`);let r=_ue(this.schema),{oneOf:n,...i}=this.schema;return r.length>0&&(i.required=[...new Set([...i.required??[],...r])]),new e({id:this.id,context:this.context,breadcrumbs:this.breadcrumbs,schema:i,inlined:this.inlined,nameOverride:this.nameOverride,visitedRefs:this.visitedRefs}).convert()}tryConvertOneOfAnyOfSchema(){if(this.schema.oneOf!=null||this.schema.anyOf!=null){let r=new y3e({id:this.id,context:this.context,breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:r.type,referencedTypes:r.referencedTypes}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:r.inlinedTypes}}}tryConvertMapSchema(){if((typeof this.schema.additionalProperties=="object"||typeof this.schema.additionalProperties=="boolean")&&this.schema.additionalProperties!=null&&!this.schema.properties&&!this.schema.allOf){if(typeof this.schema.additionalProperties=="boolean"&&this.schema.additionalProperties===!1)return;let r=new l5r({context:this.context,breadcrumbs:this.breadcrumbs,schemaOrReferenceOrBoolean:this.schema.additionalProperties}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:r.type,referencedTypes:r.referencedTypes}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:r.inlinedTypes}}}tryConvertDiscriminatorMappingSchema(){if(this.schema.discriminator?.mapping!=null&&Object.keys(this.schema.discriminator.mapping).length>0&&this.schema.oneOf==null&&this.schema.anyOf==null){let t={...this.schema,oneOf:Object.values(this.schema.discriminator.mapping).map(i=>({$ref:i}))},n=new y3e({id:this.id,context:this.context,breadcrumbs:this.breadcrumbs,schema:t,inlinedTypes:{}}).convert();if(n!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:n.type,referencedTypes:n.referencedTypes}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:n.inlinedTypes}}}tryConvertObjectAllOfSchema(){if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let r=new Cit({context:this.context,breadcrumbs:this.breadcrumbs,schema:this.schema,id:this.id}).convert();if(r!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:r.type,referencedTypes:r.referencedTypes,encoding:r.xmlEncoding!=null?{json:void 0,proto:void 0,xml:r.xmlEncoding}:void 0}),audiences:this.audiences,propertiesByAudience:r.propertiesByAudience},inlinedTypes:r.inlinedTypes}}}tryConvertUntypedSchema(){if(this.isUntypedSchema())return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:vc.alias({aliasOf:Jr.unknown(),resolvedType:Jr.unknown()}),referencedTypes:new Set}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:{}}}tryConvertFernTypeDeclaration(){let r=new ux.FernTypeExtension({breadcrumbs:this.breadcrumbs,schema:this.schema,context:this.context}).convert();if(r==null)return;let n=bTu(r);if(n!=null)return{convertedSchema:{typeDeclaration:this.createTypeDeclaration({shape:vc.alias({aliasOf:n,resolvedType:n}),referencedTypes:new Set,omitV2Examples:!0}),audiences:this.audiences,propertiesByAudience:{}},inlinedTypes:{}}}createTypeDeclaration({shape:t,referencedTypes:r,omitV2Examples:n,encoding:i}){return{name:this.convertDeclaredTypeName(),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:i,availability:this.context.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs}),docs:this.schema.description,referencedTypes:r,source:void 0,inline:this.inlined,v2Examples:n?void 0:this.convertSchemaExamples()}}convertDeclaredTypeName(){let t=this.context.getRawSchemaId(this.id);return{typeId:this.context.getNamespacedSchemaId(this.id),fernFilepath:this.context.createFernFilepath(),name:this.context.casingsGenerator.generateName(t),displayName:this.nameOverride}}schemaOnlyHasAllowedKeys(t){let r=[...Inm,...t];return Object.keys(this.schema).every(i=>r.includes(i))}isUntypedSchema(){return!!(this.schema&&typeof this.schema=="object"&&!("oneOf"in this.schema)&&!("anyOf"in this.schema)&&!("allOf"in this.schema)&&!("items"in this.schema)&&!("properties"in this.schema))}convertSchemaExamples(){let t={userSpecifiedExamples:{},autogeneratedExamples:{}},r=this.context.getExamplesFromSchema({schema:this.schema,breadcrumbs:this.breadcrumbs});if(r.length===0){let n=this.generateOrValidateExample({example:void 0,ignoreErrors:!0});return t.autogeneratedExamples={[`${this.id}_example_autogenerated`]:n},t}return t.userSpecifiedExamples=this.convertUserSpecifiedExamples(r),t}convertUserSpecifiedExamples(t){let r={};for(let[n,i]of t.entries()){let o=this.context.resolveExample(i),s=`${this.id}_example_${n}`,a=this.generateOrValidateExample({example:o,exampleName:s});r[s]=a}return r}generateOrValidateExample({example:t}){let r=new nS({breadcrumbs:this.breadcrumbs,context:this.context,schema:this.schema,example:t}),{validExample:n}=r.convert();return n}}});function Cnm(e){return Object.keys(e).every(t=>xnm.has(t))}var oT,xnm,g3e=h(()=>{"use strict";_n();Uo();p5r();oT=class extends Ji{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({context:t,breadcrumbs:r,schemaOrReference:n,schemaIdOverride:i,wrapAsOptional:o=!1,wrapAsNullable:s=!1}){super({context:t,breadcrumbs:r}),this.schemaOrReference=n,this.schemaIdOverride=i,this.wrapAsOptional=o,this.wrapAsNullable=s}convert(){let t=this.maybeConvertReferenceObject({schemaOrReference:this.schemaOrReference});if(t!=null)return t;let r=this.maybeConvertSingularAllOfReferenceObject();return r??this.convertSchemaObject({schema:this.schemaOrReference})}maybeConvertReferenceObject({schemaOrReference:t}){if(this.context.isReferenceObject(t)){let r=this.context.convertReferenceToTypeReference({reference:t,breadcrumbs:this.breadcrumbs});if(r.ok)return{type:this.wrapTypeReference(r.reference),inlinedTypes:r.inlinedTypes??{},availability:this.context.getAvailability({node:t,breadcrumbs:this.breadcrumbs})}}}maybeConvertSingularAllOfReferenceObject(){if(this.context.isReferenceObject(this.schemaOrReference)||this.schemaOrReference.allOf==null)return;if(this.schemaOrReference.allOf.length===1){let i=this.schemaOrReference.allOf[0];if(this.context.isReferenceObject(i)){let o=this.context.convertReferenceToTypeReference({reference:i,breadcrumbs:this.breadcrumbs});if(o.ok)return{type:this.wrapTypeReference(o.reference),inlinedTypes:o.inlinedTypes??{},availability:this.getAvailabilityOfSelfOrReference(i)}}return}let t=this.schemaOrReference.allOf.filter(i=>this.context.isReferenceObject(i)),r=this.schemaOrReference.allOf.filter(i=>typeof i=="object"&&i!==null&&!this.context.isReferenceObject(i)),n=t.length===1?t[0]:void 0;if(n!=null&&r.every(i=>Cnm(i))){let i=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:this.breadcrumbs});if(i!=null&&i.type!=="object"&&!i.properties&&!i.allOf&&!i.oneOf&&!i.anyOf&&!i.format){let o=this.context.convertReferenceToTypeReference({reference:n,breadcrumbs:this.breadcrumbs});if(o.ok)return{type:this.wrapTypeReference(o.reference),inlinedTypes:o.inlinedTypes??{},availability:this.getAvailabilityOfSelfOrReference(n)}}}}getAvailabilityOfSelfOrReference(t){for(let r of[...this.getSelfAndInlineAllOfElements(),t]){let n=this.context.getAvailability({node:r,breadcrumbs:this.breadcrumbs});if(n!=null)return n}}getSelfAndInlineAllOfElements(){return this.context.isReferenceObject(this.schemaOrReference)||this.schemaOrReference.allOf==null?[this.schemaOrReference]:[this.schemaOrReference,...this.schemaOrReference.allOf.filter(t=>!this.context.isReferenceObject(t))]}convertSchemaObject({schema:t}){let r=this.schemaIdOverride??this.context.convertBreadcrumbsToName(this.breadcrumbs),n=this.context.getNamespacedSchemaId(r),i=new sxe({context:this.context,breadcrumbs:this.breadcrumbs,schema:t,id:r}),o=this.context.getAvailability({node:t,breadcrumbs:this.breadcrumbs}),s=i.convert();if(s!=null){let a=s.convertedSchema.typeDeclaration.shape;return a.type==="alias"?{type:this.wrapTypeReference(a.aliasOf),schema:s.convertedSchema,inlinedTypes:s.inlinedTypes,availability:o}:{type:this.wrapTypeReference(this.context.createNamedTypeReference(r)),schema:s.convertedSchema,inlinedTypes:{...s.inlinedTypes,[n]:s.convertedSchema},availability:o}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return Jr.container(gs.optional(t))}wrapInNullable(t){return Jr.container(gs.nullable(t))}},xnm=new Set(["description","title","deprecated","readOnly","writeOnly","xml","externalDocs","x-fern-type-name"])});function A3e({properties:e,required:t,breadcrumbs:r,context:n,errorCollector:i,withinXmlElement:o=!1}){let s=[],a={},c={},u=new Set;for(let[l,p]of Object.entries(e??{})){let d=[...r,"properties",l];if(typeof p!="object"){i.collect({message:`Schema property ${l} should be an object`,path:d});continue}let f=Snm(r,p,n)??n.convertBreadcrumbsToName(d),m="nullable"in p?p.nullable:!1,A=new oT({context:n,breadcrumbs:d,schemaOrReference:p,schemaIdOverride:f,wrapAsOptional:!t.includes(l),wrapAsNullable:m}).convert();if(A!=null){let y=n.resolveMaybeReference({schemaOrReference:p,breadcrumbs:d,skipErrorCollector:!0});s.push({name:n.casingsGenerator.generateNameAndWireValue({name:l,wireValue:l}),valueType:A.type,docs:p.description??A.schema?.typeDeclaration.docs,availability:A.availability,propertyAccess:n.getPropertyAccess(p),defaultValue:y?.default,xml:o?new xit({breadcrumbs:d,propertySchema:p,resolvedPropertySchema:y??void 0,context:n}).convert():void 0,v2Examples:A.schema?.typeDeclaration?.v2Examples??wnm({propertySchema:p,breadcrumbs:d,context:n,propertyId:f})}),a={...a,...A.inlinedTypes},A.schema?.typeDeclaration.referencedTypes!=null&&A.schema.typeDeclaration.referencedTypes.forEach(E=>{u.add(E)}),FH(A.type,u);for(let E of A.schema?.audiences??[])c[E]==null&&(c[E]=new Set),c[E].add(l)}}for(let l of Object.keys(a))u.add(l);return{convertedProperties:s,propertiesByAudience:c,inlinedTypesFromProperties:a,referencedTypes:u}}function wnm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n}){let i=r.resolveMaybeReference({schemaOrReference:e,breadcrumbs:t,skipErrorCollector:!0}),o=r.getExamplesFromSchema({schema:i??void 0,breadcrumbs:t});if(o.length>0){let u={};for(let[l,p]of o.entries()){let d=r.resolveExample(p),f=`${n}_example_${l}`,m=new nS({breadcrumbs:t,context:r,schema:e,example:d}),{validExample:g}=m.convert();u[f]=g}return{userSpecifiedExamples:u,autogeneratedExamples:{}}}let s=`${n}_example_autogenerated`,a=new nS({breadcrumbs:t,context:r,schema:e,example:void 0,generateOptionalProperties:!0}),{validExample:c}=a.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{[s]:c}}}function Snm(e,t,r){return r.isReferenceObject(t)?void 0:new ux.FernTypeNameExtension({breadcrumbs:e,schema:t,context:r}).convert()}function FH(e,t){switch(e.type){case"named":t.add(e.typeId);return;case"primitive":case"unknown":return;case"container":Tnm(e.container,t);return}}function Tnm(e,t){switch(e.type){case"list":FH(e.list,t);return;case"set":FH(e.set,t);return;case"optional":FH(e.optional,t);return;case"nullable":FH(e.nullable,t);return;case"map":FH(e.keyType,t),FH(e.valueType,t);return;case"literal":return}}var yUt=h(()=>{"use strict";nxe();g3e();c5r();Uo()});var Sit,yNo=h(()=>{"use strict";_n();Uo();yUt();g3e();Sit=class e extends Ji{static LIST_UNKNOWN=Jr.container(gs.list(Jr.unknown()));schema;constructor({context:t,breadcrumbs:r,schema:n}){super({context:t,breadcrumbs:r}),this.schema=n}convert(){if(this.schema.items!=null){Array.isArray(this.schema.items)&&(this.schema.items={oneOf:this.schema.items});let r=new oT({context:this.context,breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert();if(r!=null){let n=new Set;for(let i of r.schema?.typeDeclaration.referencedTypes??[])n.add(i);return r.inlinedTypes!=null&&Object.values(r.inlinedTypes).forEach(i=>{i.typeDeclaration.referencedTypes.forEach(o=>{n.add(o)})}),FH(r.type,n),{typeReference:Jr.container(gs.list(r.type)),referencedTypes:n,inlinedTypes:r.inlinedTypes}}}return{typeReference:e.LIST_UNKNOWN,referencedTypes:new Set,inlinedTypes:{}}}}});var bNo={};Z(bNo,{ArraySchemaConverter:()=>Sit,EnumSchemaConverter:()=>ixe,ObjectSchemaConverter:()=>Cit,OneOfSchemaConverter:()=>y3e,PrimitiveSchemaConverter:()=>wit,SchemaConverter:()=>sxe,SchemaOrReferenceConverter:()=>oT});var ENo=h(()=>{"use strict";yNo();u5r();hNo();gNo();ANo();p5r();g3e()});var f5r,OTu=h(()=>{"use strict";Vi();Uo();nxe();ENo();f5r=class extends Ji{group;method;constructor({context:t,breadcrumbs:r,group:n,method:i}){super({context:t,breadcrumbs:r}),this.group=n,this.method=i}parseMediaTypeObject({mediaTypeObject:t,resolveSchema:r,contentType:n,schemaId:i}){if(t.schema==null)return;if(r){let c=this.context.resolveMaybeReference({schemaOrReference:t.schema,breadcrumbs:[...this.breadcrumbs,"content",n]});if(c==null)return;t.schema=c}let s=new oT({context:this.context,breadcrumbs:[...this.breadcrumbs,"content",n,"schema"],schemaOrReference:t.schema,schemaIdOverride:i}).convert();if(s==null)return;let a=t.examples!=null?Object.fromEntries(Object.entries(t.examples).map(([c,u])=>{if(this.context.isReferenceObject(u)){let l=this.context.resolveReference({reference:u,breadcrumbs:[...this.breadcrumbs,"content",n,"examples"],skipErrorCollector:!0});return l.resolved?[c,l.value.value??l.value]:null}return[c,u.value??u]}).filter(c=>c!=null)):void 0;return{...s,examples:a}}parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:r}){let i=new oT({context:this.context,breadcrumbs:[...this.breadcrumbs],schemaOrReference:t,schemaIdOverride:r}).convert();if(i!=null)return{...i,examples:void 0}}getIdForExample({key:t,example:r,usedExampleNames:n}){if(this.context.isExampleWithSummary(r)){let i=r.summary;if(!n.has(i))return i;let o=`${i} (${t})`;return n.has(o)?t:o}return t}convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:r,exampleGenerationStrategy:n}){let i={userSpecifiedExamples:{},autogeneratedExamples:{}},o=t?.schema,s=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:t,breadcrumbs:this.breadcrumbs,defaultExampleName:`${[...this.group,this.method].join("_")}_example`}),a=new Set;for(let[c,u]of s){let l=this.context.resolveExampleWithValue(u),p=this.context.resolveExampleRecursively({example:u,breadcrumbs:this.breadcrumbs}),d=this.getIdForExample({key:c,example:p,usedExampleNames:a});a.add(d),l!=null&&(o!=null?i.userSpecifiedExamples[d]=this.generateOrValidateExample({schema:o,example:l,exampleGenerationStrategy:n,exampleName:d}):i.userSpecifiedExamples[d]=l)}if(o!=null&&Object.keys(i.userSpecifiedExamples).length===0){let c=this.getExamplesFromSchemaOrReference(o);c.length>1&&c.forEach((u,l)=>{let p=`Example ${l+1}`;i.userSpecifiedExamples[p]=this.generateOrValidateExample({schema:o,example:u,exampleGenerationStrategy:n,exampleName:p})})}if(Object.keys(i.userSpecifiedExamples).length===0&&o!=null){let c=ti(`${[...this.group,this.method].join("_")}_example`);i.autogeneratedExamples[c]=this.generateOrValidateExample({schema:o,example:void 0,ignoreErrors:!0,generateOptionalProperties:r,exampleGenerationStrategy:n,exampleName:c})}return i}getExamplesFromSchemaOrReference(t){let r=new Set,n=t;for(;this.context.isReferenceObject(n);){if(r.has(n.$ref))return[];r.add(n.$ref);let i=this.context.resolveReference({reference:n,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(!i.resolved)return[];n=i.value}return this.context.getExamplesFromSchema({schema:n,breadcrumbs:this.breadcrumbs})}generateOrValidateExample({schema:t,example:r,generateOptionalProperties:n,exampleGenerationStrategy:i}){let o=this.context.resolveMaybeReference({schemaOrReference:t,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(o==null)return;let s=this.context.getExamplesFromSchema({schema:o,breadcrumbs:this.breadcrumbs}),a=new nS({breadcrumbs:this.breadcrumbs,context:this.context,schema:o,example:r??s[0],generateOptionalProperties:n??!1,exampleGenerationStrategy:i}),{validExample:c}=a.convert();return c}}});var d5r,PTu=h(()=>{"use strict";Uo();nxe();d5r=class extends Ji{parameter;constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r}),this.parameter=n}convertToOutput({schema:t,typeReference:r,inlinedTypes:n}){let i=this.context.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs}),o=this.context.resolveMaybeReference({schemaOrReference:t,breadcrumbs:this.breadcrumbs}),s=this.getParameterSchemaWithExampleOverride({schema:o}),a=o?.default,c=this.getParameterDescription({schema:t});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:this.context.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:c,valueType:r??Ji.OPTIONAL_STRING,allowMultiple:this.parameter.explode??!1,clientDefault:void 0,defaultValue:a,v2Examples:this.convertParameterExamples({schema:s??t,originalSchema:t}),availability:i,explode:this.getExplodeForQueryParameter()},inlinedTypes:n};case"header":return{type:"header",parameter:{name:this.context.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:c,valueType:r??Ji.OPTIONAL_STRING,env:void 0,clientDefault:void 0,defaultValue:a,v2Examples:this.convertParameterExamples({schema:s??t,originalSchema:t}),availability:i},inlinedTypes:n};case"path":return{type:"path",parameter:{name:this.context.casingsGenerator.generateName(this.parameter.name),docs:c,valueType:r??Ji.STRING,location:"ENDPOINT",variable:void 0,clientDefault:void 0,v2Examples:this.convertParameterExamples({schema:s??t,originalSchema:t}),explode:this.getExplodeForPathParameter()},inlinedTypes:n};default:return}}getParameterDescription({schema:t}){if(this.parameter.description!=null)return this.parameter.description;if("description"in t&&typeof t.description=="string")return t.description}getParameterSchemaWithExampleOverride({schema:t}){if(t!=null)return t.type==="string"&&t.example==null?{...t,example:this.parameter.name}:t}convertParameterExamples({schema:t,originalSchema:r}){let n={userSpecifiedExamples:{},autogeneratedExamples:{}},i=this.parameter.example,o=this.parameter.examples;for(let[s,a]of Object.entries(o??{})){let c=this.context.resolveExampleWithValue(a);c!=null&&(n.userSpecifiedExamples[s]=this.generateOrValidateExample({schema:t,example:c,exampleName:s}))}if(i!=null){let s=this.context.generateUniqueName({prefix:`${this.parameter.name}_example`,existingNames:Object.keys(n.userSpecifiedExamples)});n.userSpecifiedExamples[s]=this.generateOrValidateExample({schema:t,example:i,exampleName:s})}if(Object.keys(n.userSpecifiedExamples).length===0){let s=this.context.getExamplesFromSchema({schema:this.resolveSchemaChain(r),breadcrumbs:this.breadcrumbs});for(let a of s){let c=this.context.generateUniqueName({prefix:`${this.parameter.name}_example`,existingNames:Object.keys(n.userSpecifiedExamples)});n.userSpecifiedExamples[c]=this.generateOrValidateExample({schema:t,example:this.context.resolveExample(a),exampleName:c})}}if(Object.keys(n.userSpecifiedExamples).length===0){let s=`${this.parameter.name}_example`;n.autogeneratedExamples[s]=this.generateOrValidateExample({schema:t,example:void 0,ignoreErrors:!0,exampleName:s})}return n}resolveSchemaChain(t){let r=new Set,n=t;for(;this.context.isReferenceObject(n);){if(r.has(n.$ref))return;r.add(n.$ref);let i=this.context.resolveReference({reference:n,breadcrumbs:this.breadcrumbs,skipErrorCollector:!0});if(!i.resolved)return;n=i.value}return n}generateOrValidateExample({schema:t,example:r}){let n=new nS({breadcrumbs:this.breadcrumbs,context:this.context,schema:t,example:r}),{validExample:i}=n.convert();return i}getExplodeForQueryParameter(){let t=this.parameter.style??"form",r=this.parameter.explode;if(r!==void 0)return t==="form"||t==="deepObject"?r===!0?void 0:r:r===!1?void 0:r}getExplodeForPathParameter(){let t=this.parameter.explode;if(t!==void 0)return t===!1?void 0:t}}});var INo={};Z(INo,{AbstractMediaTypeObjectConverter:()=>f5r,AbstractParameterConverter:()=>d5r});var BTu=h(()=>{"use strict";OTu();PTu()});function Tit({context:e,breadcrumbs:t,headers:r}){let n=[],i={},o=t??[];if(r==null)return{headers:n,inlinedTypes:i};for(let[s,a]of Object.entries(r)){let c=e.resolveMaybeReference({schemaOrReference:a,breadcrumbs:[...o,"headers",s]});if(c==null)continue;let u=Onm({context:e,header:c}),l=u?.schema,p=c.required===!0,d=y=>p?y:Jr.container(gs.optional(y)),f=d(Ji.STRING),m,g=e.getAvailability({node:c,breadcrumbs:[...o,"headers",s]});if(l!=null)if(m=e.resolveMaybeReference({schemaOrReference:l,breadcrumbs:[...o,"headers",s,"schema"]}),m?.type==="number"||m?.type==="integer")f=d(Jr.primitive({v1:m.type==="integer"?"INTEGER":"DOUBLE",v2:m.type==="integer"?hi.integer({default:void 0,validation:void 0}):hi.double({default:void 0,validation:void 0})}));else if(m?.type==="boolean")f=d(Jr.primitive({v1:"BOOLEAN",v2:hi.boolean({default:void 0})}));else{let y=new oT({context:e,breadcrumbs:[...o,"headers",s,"schema"],schemaOrReference:l,wrapAsOptional:!p,schemaIdOverride:e.convertBreadcrumbsToName([...o,"headers",s])}).convert();if(y!=null){f=y.type;for(let[E,x]of Object.entries(y.inlinedTypes))i[E]=x}}let A=Pnm({context:e,breadcrumbs:o,header:c,headerName:s,schema:l,mediaTypeObject:u?.mediaTypeObject});n.push({name:e.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),docs:c.description,valueType:f,env:void 0,v2Examples:A,availability:g,clientDefault:void 0,defaultValue:m?.default})}return{headers:n,inlinedTypes:i}}function Onm({context:e,header:t}){if(t.schema!=null)return{schema:t.schema};if(!(!e.settings.respectParameterContent||t.content==null)){for(let[r,n]of Object.entries(t.content))if(n.schema!=null&&Qp.parse(r)?.isJSON())return{schema:n.schema,mediaTypeObject:n}}}function Pnm({context:e,breadcrumbs:t,header:r,headerName:n,schema:i,mediaTypeObject:o}){let s={userSpecifiedExamples:{},autogeneratedExamples:{}},a=r.example,c=r.examples;for(let[u,l]of Object.entries(c??{})){let p=e.resolveExampleWithValue(l);p!=null&&(s.userSpecifiedExamples[u]=bUt({context:e,breadcrumbs:t,schema:i,example:p}))}if(a!=null){let u=e.generateUniqueName({prefix:`${n}_example`,existingNames:Object.keys(s.userSpecifiedExamples)});s.userSpecifiedExamples[u]=bUt({context:e,breadcrumbs:t,schema:i,example:a})}if(Object.keys(s.userSpecifiedExamples).length===0&&o!=null)for(let[u,l]of e.getNamedExamplesFromMediaTypeObject({mediaTypeObject:o,breadcrumbs:[...t,"headers",n,"content"],defaultExampleName:`${n}_example`})){let p=e.resolveExampleWithValue(l);if(p!=null){let d=e.generateUniqueName({prefix:u,existingNames:Object.keys(s.userSpecifiedExamples)});s.userSpecifiedExamples[d]=bUt({context:e,breadcrumbs:t,schema:i,example:p})}}if(Object.keys(s.userSpecifiedExamples).length===0&&i!=null){let u=e.getExamplesFromSchema({schema:Bnm({context:e,schema:i,breadcrumbs:[...t,"headers",n,"schema"]}),breadcrumbs:[...t,"headers",n,"schema"]});for(let l of u){let p=e.generateUniqueName({prefix:`${n}_example`,existingNames:Object.keys(s.userSpecifiedExamples)});s.userSpecifiedExamples[p]=bUt({context:e,breadcrumbs:t,schema:i,example:e.resolveExample(l)})}}if(Object.keys(s.userSpecifiedExamples).length===0&&i!=null){let u=`${n}_example`;s.autogeneratedExamples[u]=bUt({context:e,breadcrumbs:t,schema:i,example:void 0,ignoreErrors:!0})}return s}function Bnm({context:e,schema:t,breadcrumbs:r}){let n=new Set,i=t;for(;e.isReferenceObject(i);){if(n.has(i.$ref))return;n.add(i.$ref);let o=e.resolveReference({reference:i,breadcrumbs:r,skipErrorCollector:!0});if(!o.resolved)return;i=o.value}return i}function bUt({context:e,breadcrumbs:t,schema:r,example:n,ignoreErrors:i}){if(r==null)return n;let o=new nS({breadcrumbs:t,context:e,schema:r,example:n}),{validExample:s,errors:a}=o.convert();return i||a.forEach(c=>{e.errorCollector.collect({message:c.message,path:c.path})}),s}var DTu=h(()=>{"use strict";wt();_n();$_r();nxe();g3e()});var m5r,RTu=h(()=>{"use strict";JD();m5r=class extends Yo{server;key="x-fern-server-name";constructor({breadcrumbs:t,server:r,context:n}){super({breadcrumbs:t,context:n}),this.server=r}convert(){let t=this.getExtensionValue(this.server,"x-name");if(!(t==null||typeof t!="string"))return t}}});var kTu,Dnm,C3,FTu=h(()=>{"use strict";wt();_n();cNo();RTu();Uo();kTu="Base",Dnm="x-fern-default-url",C3=class e extends Ji{servers;endpointLevelServers;baseUrlEnvVar;constructor({breadcrumbs:t,context:r,servers:n,endpointLevelServers:i,baseUrlEnvVar:o}){super({breadcrumbs:t,context:r}),this.servers=n,this.endpointLevelServers=i,this.baseUrlEnvVar=o}convert(){if(this.servers==null||this.servers.length===0||this.servers[0]==null)return;if(this.endpointLevelServers!=null&&this.endpointLevelServers.length>0){let n=this.getDefaultBaseUrlName(),i={id:n,name:this.context.casingsGenerator.generateName(n)},o=this.endpointLevelServers.map(c=>{let u=e.getServerName({server:c,context:this.context});return{id:u,name:this.context.casingsGenerator.generateName(u)}}).filter((c,u,l)=>l.findIndex(p=>p.id===c.id)===u),s=[i,...o],a=this.servers.map(c=>{let u=e.getServerName({server:c,context:this.context}),l=this.endpointLevelServers?.map(g=>[e.getServerName({server:g,context:this.context}),this.getServerUrl(g)]),p=e.getServerAudiences({server:c,context:this.context}),{defaultUrls:d,urlTemplates:f,urlVariables:m}=this.buildMultiUrlTemplateFields({defaultBaseUrlId:n,topLevelServer:c,endpointServers:this.endpointLevelServers??[]});return{id:u,name:this.context.casingsGenerator.generateName(u),urls:{[n]:this.getServerUrl(c),...Object.fromEntries(l??[])},docs:c.description,audiences:p,defaultUrls:d,urlTemplates:f,urlVariables:m}});return{value:{defaultEnvironment:a[0]?.id,baseUrlEnvVar:this.baseUrlEnvVar,environments:x0.multipleBaseUrls({baseUrls:s,environments:a})},defaultUrl:i.id}}let t=this.extractFernDefaultUrl(),r=this.servers.map(n=>{let i=e.getServerName({server:n,context:this.context}),o=e.getServerAudiences({server:n,context:this.context});return n.variables!=null&&Object.keys(n.variables).length>0&&n.variables!=null?{id:i,name:this.context.casingsGenerator.generateName(i),url:this.maybeRemoveTrailingSlashIfNotEmpty(this.getServerUrl(n)),audiences:o,defaultUrl:t,urlTemplate:this.maybeRemoveTrailingSlashIfNotEmpty(n.url),urlVariables:this.convertServerVariables(n.variables),docs:n.description}:{id:i,name:this.context.casingsGenerator.generateName(i),url:this.maybeRemoveTrailingSlashIfNotEmpty(this.getServerUrl(n)),audiences:o,defaultUrl:void 0,urlTemplate:void 0,urlVariables:void 0,docs:n.description}}).filter(sa);return{value:{defaultEnvironment:r[0]?.id,baseUrlEnvVar:this.baseUrlEnvVar,environments:x0.singleBaseUrl({environments:r})},defaultUrl:r[0]?.id}}convertServerVariables(t){return Object.entries(t).map(([r,n])=>({id:r,name:this.context.casingsGenerator.generateName(r),default:n.default,values:n.enum}))}static getServerExtensionName({server:t,context:r}){return new m5r({breadcrumbs:[],server:t,context:r}).convert()}static getServerAudiences({server:t,context:r}){return new yit({breadcrumbs:[],operation:t,context:r}).convert()?.audiences}static getServerName({server:t,context:r}){return t.name!=null?t.name:e.getServerExtensionName({server:t,context:r})??t.description??t.url}getServerUrl(t){if(t.variables==null)return t.url;let r=t.url;for(let[n,i]of Object.entries(t.variables))i.default!=null&&(r=r.replace(`{${n}}`,encodeURIComponent(i.default)));return r}getDefaultBaseUrlName(){return this.servers==null||this.servers.length===0||this.servers[0]==null?kTu:e.getServerExtensionName({server:this.servers[0],context:this.context})??kTu}maybeRemoveTrailingSlashIfNotEmpty(t){return t.endsWith("/")&&t!=="/"?t.slice(0,-1):t}buildMultiUrlTemplateFields({defaultBaseUrlId:t,topLevelServer:r,endpointServers:n}){let i={},o={},s={},a=!1;if(r.variables!=null&&Object.keys(r.variables).length>0){a=!0;let c=this.extractFernDefaultUrlFromServer(r);c!=null&&(i[t]=c),o[t]=this.maybeRemoveTrailingSlashIfNotEmpty(r.url),s[t]=this.convertServerVariables(r.variables)}for(let c of n){let u=e.getServerName({server:c,context:this.context});if(c.variables!=null&&Object.keys(c.variables).length>0){a=!0;let l=this.extractFernDefaultUrlFromServer(c);l!=null&&(i[u]=l),o[u]=this.maybeRemoveTrailingSlashIfNotEmpty(c.url),s[u]=this.convertServerVariables(c.variables)}}return a?{defaultUrls:Object.keys(i).length>0?i:void 0,urlTemplates:o,urlVariables:s}:{defaultUrls:void 0,urlTemplates:void 0,urlVariables:void 0}}extractFernDefaultUrlFromServer(t){let r=t[Dnm];if(typeof r=="string")return this.maybeRemoveTrailingSlashIfNotEmpty(r)}extractFernDefaultUrl(){if(this.servers!=null)for(let t of this.servers){let r=this.extractFernDefaultUrlFromServer(t);if(r!=null)return r}}}});var wm={};Z(wm,{AbstractConverters:()=>INo,ExampleConverter:()=>nS,SchemaConverters:()=>bNo,ServersConverter:()=>C3,convertResponseHeaders:()=>Tit});var vNo=h(()=>{"use strict";BTu();nxe();DTu();ENo();FTu()});var b3e,NTu=h(()=>{"use strict";nxe();AUt();b3e=class{context;constructor({context:t}){this.context=t}validateExample({example:t,schema:r,breadcrumbs:n,exampleGenerationStrategy:i}){return new nS({breadcrumbs:n,context:this.context,schema:r,example:t,depth:0,exampleGenerationStrategy:i,generateOptionalProperties:!1}).convert()}validateEndpointExample({exampleToValidate:t}){let r=[],n=[],i=!0,o=!1,s,a=[t.endpointPath,t.method];if(t.requestExample!==void 0&&t.requestSchema!==void 0){let u=this.validateExample({example:t.requestExample,schema:t.requestSchema,breadcrumbs:[...a,"request"],exampleGenerationStrategy:"request"});if(!u.isValid){i=!1;let l=t.exampleSource==="human"?G0.WARNING:G0.ERROR;r.push(...u.errors.map(p=>({...p,level:l,message:`Invalid request example: ${p.message}`})))}u.coerced&&(o=!0,n.push({level:G0.WARNING,message:"Request example was coerced to match schema",path:[...a,"request"]})),s={request:u.validExample}}let c=this.getResponseSchemaForValidation(t);if(t.responseExample!==void 0&&c!==void 0){let u=this.validateExample({example:t.responseExample,schema:c,breadcrumbs:[...a,"response"],exampleGenerationStrategy:"response"});if(!u.isValid){i=!1;let l=t.exampleSource==="human"?G0.WARNING:G0.ERROR;r.push(...u.errors.map(p=>({...p,level:l,message:`Invalid response example: ${p.message}`})))}u.coerced&&(o=!0,n.push({level:G0.WARNING,message:"Response example was coerced to match schema",path:[...a,"response"]})),s={...typeof s=="object"&&s!==null?s:{},response:u.validExample}}return{isValid:i,errors:r,warnings:n,endpointPath:t.endpointPath,method:t.method,exampleSource:t.exampleSource,exampleName:t.exampleName,validExample:s,coerced:o}}getResponseSchemaForValidation(t){let{responseStatusCode:r,responseSchemas:n,responseSchema:i}=t;return n&&Object.keys(n).length>0?r&&n[r]?n[r]:n[200]??n[201]:i}validateAiExamples({aiExamples:t,spec:r}){let n=[],i=[];for(let o of t){let{requestSchema:s,responseSchema:a,responseSchemas:c}=this.getSchemasForEndpoint({spec:r,endpointPath:o.endpointPath,method:o.method}),u={endpointPath:o.endpointPath,method:o.method,exampleSource:"ai",requestExample:o.request?.body,responseExample:o.response?.body,requestSchema:s,responseSchema:a,responseSchemas:c},l=this.validateEndpointExample({exampleToValidate:u}),p=this.hasUnexpectedProperties({requestExample:o.request?.body,responseExample:o.response?.body,requestSchema:s,responseSchema:a}),d=l.errors.length>0||l.warnings.length>0;!l.isValid||d||p?i.push({example:o,validationResult:l}):n.push(o)}return{validExamples:n,invalidExamples:i}}hasUnexpectedProperties({requestExample:t,responseExample:r,requestSchema:n,responseSchema:i}){return!!(t&&n&&this.exampleHasUnexpectedProperties(t,n)||r&&i&&this.exampleHasUnexpectedProperties(r,i))}exampleHasUnexpectedProperties(t,r){if(!t||typeof t!="object"||t===null)return!1;let n=this.context.resolveMaybeReference({schemaOrReference:r,breadcrumbs:[],skipErrorCollector:!0});if(!n||!n.properties&&!n.allOf&&!n.oneOf&&!n.anyOf||this.schemaHasPatternProperties(n))return!1;let i=t,o=this.collectAllPropertyKeys(n);return Object.keys(i).some(a=>!o.has(a))}collectAllPropertyKeys(t,r=new Set){let n=new Set;if(t.properties)for(let i of Object.keys(t.properties))n.add(i);for(let i of t.allOf??[]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:[],skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)){r.add(s);let a=this.collectAllPropertyKeys(o,r);for(let c of a)n.add(c)}}}for(let i of[...t.oneOf??[],...t.anyOf??[]]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:[],skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)){r.add(s);let a=this.collectAllPropertyKeys(o,r);for(let c of a)n.add(c)}}}return n}schemaHasPatternProperties(t,r=new Set){let n=t.patternProperties;if(n&&typeof n=="object"&&Object.keys(n).length>0)return!0;for(let i of[...t.allOf??[],...t.oneOf??[],...t.anyOf??[]]){let o=this.context.resolveMaybeReference({schemaOrReference:i,breadcrumbs:[],skipErrorCollector:!0});if(o){let s=this.context.isReferenceObject(i)?i.$ref:JSON.stringify(o);if(!r.has(s)&&(r.add(s),this.schemaHasPatternProperties(o,r)))return!0}}return!1}validateHumanExamples({spec:t}){let r=[],n=0,i=0,o=0,s=[],a=[];if(!t.paths)return{endpoints:r,totalExamples:n,validExamples:i,invalidExamples:o,hasInvalidHumanExamples:!1,hasInvalidAiExamples:!1,invalidHumanExamples:s,invalidAiExamples:a};for(let[c,u]of Object.entries(t.paths)){if(!u)continue;let l=["get","post","put","delete","patch","options","head","trace"];for(let p of l){let d=u[p];if(!d)continue;let f=[],{requestSchema:m,responseSchema:g,responseSchemas:A}=this.getSchemasForOperation({operation:d}),y=this.extractExamplesFromOperation({operation:d,path:c,method:p});for(let E of y){n++;let x={endpointPath:c,method:p,exampleName:E.name,exampleSource:E.source,requestExample:E.request,responseExample:E.response,requestSchema:m,responseSchema:g,responseStatusCode:E.statusCode,responseSchemas:A},v=this.validateEndpointExample({exampleToValidate:x});f.push(v),v.isValid?i++:(o++,E.source==="human"?s.push(v):E.source==="ai"&&a.push(v))}f.length>0&&r.push({endpointPath:c,method:p,results:f,hasInvalidExamples:f.some(E=>!E.isValid),invalidExampleCount:f.filter(E=>!E.isValid).length})}}return{endpoints:r,totalExamples:n,validExamples:i,invalidExamples:o,hasInvalidHumanExamples:s.length>0,hasInvalidAiExamples:a.length>0,invalidHumanExamples:s,invalidAiExamples:a}}getSchemasForEndpoint({spec:t,endpointPath:r,method:n}){let i=t.paths?.[r];if(!i)return{responseSchemas:{}};let o=i[n.toLowerCase()];return!o||typeof o!="object"||!("responses"in o)?{responseSchemas:{}}:this.getSchemasForOperation({operation:o})}getSchemasForOperation({operation:t}){let r,n,i={};if(t.requestBody&&!this.context.isReferenceObject(t.requestBody)){let s=t.requestBody.content?.["application/json"];s?.schema&&(r=s.schema)}if(t.responses){for(let[o,s]of Object.entries(t.responses)){if(!s||this.context.isReferenceObject(s))continue;let c=s.content?.["application/json"];c?.schema&&(i[o]=c.schema)}n=i[200]??i[201]}return{requestSchema:r,responseSchema:n,responseSchemas:i}}extractExamplesFromOperation({operation:t,path:r,method:n}){let i=[];if(t.requestBody&&!this.context.isReferenceObject(t.requestBody)){let a=t.requestBody.content?.["application/json"];if(a?.example!==void 0&&i.push({name:`${n}_${r}_request_example`,source:"openapi",request:a.example}),a?.examples)for(let[c,u]of Object.entries(a.examples)){let l=this.context.isReferenceObject(u)?this.context.resolveExample(u):u;l&&typeof l=="object"&&"value"in l&&i.push({name:c,source:"human",request:l.value})}}if(t.responses)for(let[s,a]of Object.entries(t.responses)){if(!a||this.context.isReferenceObject(a))continue;let u=a.content?.["application/json"];if(u?.example!==void 0){let l=i.find(p=>p.request!==void 0&&p.response===void 0);l?(l.response=u.example,l.statusCode=s):i.push({name:`${n}_${r}_response_${s}_example`,source:"openapi",response:u.example,statusCode:s})}if(u?.examples)for(let[l,p]of Object.entries(u.examples)){let d=this.context.isReferenceObject(p)?this.context.resolveExample(p):p;if(d&&typeof d=="object"&&"value"in d){let f=i.find(m=>m.name===l);f?(f.response=d.value,f.statusCode=s):i.push({name:l,source:"human",response:d.value,statusCode:s})}}}let o=t["x-fern-examples"];if(Array.isArray(o)){for(let s of o)if(typeof s=="object"&&s!==null){let a=s;i.push({name:a.name,source:"human",request:a.request?.body,response:a.response?.body})}}return i}}});function jTu({tags:e,errorCollector:t}){for(let r of e)if(Oit.test(r.name)){let n=[...r.name].filter(i=>Oit.test(i));t.collect({level:G0.ERROR,message:`Tag name "${r.name}" contains non-ASCII characters: ${n.join(", ")}. Non-ASCII characters in tag names will be included in URL paths and HTTP headers, which only support ASCII characters. This will cause runtime errors (ERR_INVALID_CHAR).`,path:["tags",r.name],resolution:`Remove non-ASCII characters from the tag name. For example, rename "${r.name}" to "${r.name.replace(Oit,"").trim()}".`})}}function QTu({description:e,path:t,errorCollector:r}){Rnm.test(e)&&r.collect({level:G0.ERROR,message:'Description contains "---" frontmatter delimiters which will cause YAML parsing failures in the generated docs site. The docs renderer interprets content between "---" delimiters as YAML frontmatter, which will fail if the content is not valid YAML.',path:t,resolution:'Remove the "---" delimiters from the description.'})}function xNo({spec:e,errorCollector:t}){if(Array.isArray(e.tags)){let n=e.tags.filter(i=>typeof i=="object"&&i!=null&&"name"in i&&typeof i.name=="string");jTu({tags:n,errorCollector:t})}let r=["get","post","put","delete","patch","options","head","trace"];if(e.paths!=null&&typeof e.paths=="object"){let n=new Set;for(let[i,o]of Object.entries(e.paths)){if(o==null||typeof o!="object")continue;let s=o;for(let a of r){let c=s[a];if(c==null||typeof c!="object")continue;let u=c;if(typeof u.description=="string"&&QTu({description:u.description,path:["paths",i,a,"description"],errorCollector:t}),Array.isArray(u.tags)&&!Array.isArray(e.tags)){for(let l of u.tags)if(typeof l=="string"&&!n.has(l)&&Oit.test(l)){n.add(l);let p=[...l].filter(d=>Oit.test(d));t.collect({level:G0.ERROR,message:`Tag name "${l}" contains non-ASCII characters: ${p.join(", ")}. Non-ASCII characters in tag names will be included in URL paths and HTTP headers, which only support ASCII characters. This will cause runtime errors (ERR_INVALID_CHAR).`,path:["paths",i,a,"tags"],resolution:`Remove non-ASCII characters from the tag name. For example, rename "${l}" to "${l.replace(Oit,"").trim()}".`})}}}}}}var Oit,Rnm,zTu=h(()=>{"use strict";AUt();Oit=new RegExp("[^\\x00-\\x7F]"),Rnm=/(?:^|\n)\s*---\s*(?:\n|$)/});var h5r,knm,MTu=h(()=>{"use strict";h5r={400:"BadRequestError",401:"UnauthorizedError",402:"PaymentRequiredError",403:"ForbiddenError",404:"NotFoundError",405:"MethodNotAllowedError",406:"NotAcceptableError",407:"ProxyAuthenticationRequiredError",408:"RequestTimeoutError",409:"ConflictError",410:"GoneError",411:"LengthRequiredError",412:"PreconditionFailedError",413:"ContentTooLargeError",414:"URITooLongError",415:"UnsupportedMediaTypeError",416:"RangeNotSatisfiableError",417:"ExpectationFailedError",418:"ImATeapotError",419:"AuthenticationTimeoutError",420:"MethodFailureError",421:"MisdirectedRequestError",422:"UnprocessableEntityError",423:"LockedError",424:"FailedDependencyError",425:"TooEarlyError",426:"UpgradeRequiredError",428:"PreconditionError",429:"TooManyRequestsError",430:"RequestHeaderFieldsTooLargeError",431:"RequestHeaderFieldsTooLargeError",444:"NoResponseError",449:"RetryWithError",450:"BlockedByWindowsParentalControlsError",451:"UnavailableForLegalReasonsError",498:"InvalidTokenError",499:"ClientClosedRequestError",500:"InternalServerError",501:"NotImplementedError",502:"BadGatewayError",503:"ServiceUnavailableError",504:"GatewayTimeoutError",505:"HTTPVersionNotSupportedError",506:"VariantAlsoNegotiatesError",507:"InsufficientStorageError",508:"LoopDetectedError",509:"BandwidthLimitExceededError",510:"NotExtendedError",511:"NetworkAuthenticationRequiredError"},knm=new Set(Object.values(h5r))});function CNo(e){if(e!=null)return e.map(t=>Object.fromEntries(Object.entries(t).map(([r,n])=>[r,n??[]])))}var LTu=h(()=>{"use strict"});var Uo=h(()=>{"use strict";$_r();rTu();JD();gTu();vNo();vNo();AUt();NTu();dNo();zTu();MTu();LTu()});var Fnm,Nnm,VTu,UTu=h(()=>{"use strict";jn();Fnm=Be.object({type:Be.string(),channelId:Be.string().optional(),messageId:Be.string(),value:Be.any()}),Nnm=Be.object({summary:Be.string().optional(),description:Be.string().optional(),"query-parameters":Be.record(Be.string()).optional(),headers:Be.record(Be.string()).optional(),messages:Be.array(Fnm)}),VTu=Be.array(Nnm)});var g5r,_Tu=h(()=>{"use strict";Uo();UTu();g5r=class extends Yo{channel;baseDir;key="x-fern-examples";constructor({breadcrumbs:t,channel:r,context:n,baseDir:i}){super({breadcrumbs:t??[],context:n}),this.channel=r,this.baseDir=i}convert(){let t=this.getExtensionValue(this.channel);if(t==null)return;let r=VTu.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-examples extension: ${r.error.message}`,path:this.breadcrumbs});return}return r.data.map(n=>({summary:n.summary,description:n.description,queryParameters:n["query-parameters"],headers:n.headers,messages:n.messages.map(i=>({type:i.type,channelId:i.channelId,messageId:i.messageId,value:i.value}))}))}}});var Pit,wNo=h(()=>{"use strict";Uo();_Tu();Pit=class extends Ji{channel;channelPath;inlinedTypes={};websocketGroup;constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o}){super({context:t,breadcrumbs:r}),this.websocketGroup=n,this.channel=i,this.channelPath=o}convertExamples({fullPath:t,baseUrl:r,asyncApiVersion:n}){let o=new g5r({context:this.context,breadcrumbs:this.breadcrumbs,channel:this.channel,baseDir:this.context.documentBaseDir}).convert();return o==null?{}:Object.fromEntries(o.map((s,a)=>[a.toString(),{channel:{method:"GET",path:t},baseUrl:t,environment:r,auth:void 0,pathParameters:{},queryParameters:s.queryParameters,headers:s.headers,messages:s.messages.map(c=>({type:n==="v2"?c.type:c.messageId,body:c.value}))}]))}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}}});var jnm,NH,EUt=h(()=>{"use strict";_n();Uo();jnm="x-fern-server-name",NH=class e extends Ji{servers;constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r}),this.servers=n}convert(){if(this.servers==null||Object.keys(this.servers).length===0)return;let t=[],r;for(let[n,i]of Object.entries(this.servers)){let o=e.getServerName(n,i),s=this.buildSingleBaseUrlEnvironment(this.context,o,i);t.push(s),r==null&&(r=s.id)}return{defaultEnvironment:r,baseUrlEnvVar:void 0,environments:x0.singleBaseUrl({environments:t})}}static getServerName(t,r){if(r!=null&&typeof r=="object"){let n=r[jnm];if(typeof n=="string"&&n.length>0)return n}return t}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}}});var axe,SNo=h(()=>{"use strict";Uo();axe=class extends wm.AbstractConverters.AbstractParameterConverter{parameterNamePrefix;constructor({context:t,breadcrumbs:r,parameter:n,parameterNamePrefix:i}){super({context:t,breadcrumbs:r,parameter:n}),this.parameterNamePrefix=i}convert(){let t,r={},i=new ux.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter,context:this.context}).convert()??this.parameter.required===!1,o=this.parameter.schema??{...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.example??this.parameter.name,examples:Object.values(this.parameter.examples??{}),deprecated:this.parameter.deprecated,required:void 0},a=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameterNamePrefix?`${this.parameterNamePrefix}_${this.parameter.name}`:this.parameter.name,schemaOrReference:o,wrapAsOptional:i}).convert();return a!=null&&(t=a.type,r=a.inlinedTypes??{}),this.convertToOutput({schema:o,typeReference:t,inlinedTypes:r})}}});var A5r,GTu=h(()=>{"use strict";Uo();A5r=class extends Yo{channel;key="x-fern-address";constructor({breadcrumbs:t,channel:r,context:n}){super({breadcrumbs:t,context:n}),this.channel=r}convert(){let t=this.getExtensionValue(this.channel);if(!(t==null||typeof t!="string"))return t}}});var cxe,TNo=h(()=>{"use strict";Uo();cxe=class extends Yo{node;key="x-fern-display-name";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(!(t==null||typeof t!="string"))return t}}});var uxe,ONo=h(()=>{"use strict";Uo();uxe=class extends Yo{node;key="x-fern-explorer";constructor({breadcrumbs:t,node:r,context:n}){super({breadcrumbs:t,context:n}),this.node=r}convert(){let t=this.getExtensionValue(this.node);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-explorer",path:this.breadcrumbs});return}return t}}}});var y5r,qTu=h(()=>{"use strict";Uo();y5r=class extends Yo{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(!(t==null||typeof t!="string"))return t}}});var b5r,WTu=h(()=>{"use strict";_n();tc();Uo();Vi();wNo();EUt();SNo();GTu();TNo();ONo();qTu();b5r=class extends Pit{inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o}){super({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o})}convert(){let t=[],r=[],n=[],o=new cxe({breadcrumbs:this.breadcrumbs,node:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".");this.channel.parameters&&this.convertPathParameters({context:this.context,pathParameters:t}),this.channel.bindings?.ws!=null&&(this.convertHeaders({context:this.context,headers:n}),this.convertBindingQueryParameters({context:this.context,queryParameters:r}));let s;this.channel.subscribe!=null&&(s=this.convertMessage({context:this.context,operation:this.channel.subscribe,origin:"server"}));let a;this.channel.publish!=null&&(a=this.convertMessage({context:this.context,operation:this.channel.publish,origin:"client"}));let c=[];s!=null&&c.push(s),a!=null&&c.push(a);let l=new A5r({breadcrumbs:this.breadcrumbs,channel:this.channel,context:this.context}).convert(),p=this.transformToValidPath(l??this.channelPath),d=this.resolveServerName(this.channel.servers?.[0])??this.resolveServerName(Object.keys(this.context.spec.servers??{})[0]),f=M0(p),m=ti(this.channelPath),g=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[],A=this.hasServerSecurity()||this.context.authOverrides?.auth!=null,y=new uxe({context:this.context,breadcrumbs:this.breadcrumbs,node:this.context.spec}).convert(),x=new uxe({context:this.context,breadcrumbs:this.breadcrumbs,node:this.channel}).convert()??y;return{channel:{name:this.context.casingsGenerator.generateName(m),displayName:o,connectMethodName:void 0,baseUrl:d,path:f,auth:A,headers:n,queryParameters:r,pathParameters:t,messages:c,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:p,baseUrl:d,asyncApiVersion:"v2"})},apiPlayground:x},audiences:g,inlinedTypes:this.inlinedTypes}}hasServerSecurity(){let t=this.context.spec.servers??{};if(this.channel.servers&&this.channel.servers.length>0){for(let r of this.channel.servers){let n=t[r];if(n?.security&&n.security.length>0)return!0}return!1}for(let r of Object.values(t)){let n=r;if(n.security&&n.security.length>0)return!0}return!1}convertMessage({context:t,operation:r,origin:n}){let i,o=n==="server"?"subscribe":"publish",s=[...this.breadcrumbs,o],a=t.resolveMaybeReference({schemaOrReference:r.message,breadcrumbs:s});a!=null&&(r.message=a);let c=JNe(ti(`${this.channelPath}_${o}`)).replace(/ /g,"");if("oneOf"in r.message){let l=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:s,schemaOrReference:r.message,schemaIdOverride:c}).convert();l!=null&&l.schema!=null&&(i=l.schema,this.inlinedTypes={...this.inlinedTypes,...l.inlinedTypes})}else if(t.isMessageWithPayload(r.message)){let u=t.resolveMaybeReference({schemaOrReference:r.message.payload,breadcrumbs:s});if(u!=null){let p=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:s,schemaOrReference:u,schemaIdOverride:c}).convert();p!=null&&p.schema!=null&&(i=p.schema,this.inlinedTypes={...this.inlinedTypes,...p.inlinedTypes})}}if(i!=null){let u=i,l=Jr.named({fernFilepath:t.createFernFilepath(),name:u.typeDeclaration.name.name,typeId:u.typeDeclaration.name.typeId,displayName:void 0,default:void 0,inline:!1}),p=cP.reference({bodyType:l,docs:r.description}),d=n==="server"?"subscribe":"publish",m=new cxe({breadcrumbs:[...this.breadcrumbs,d],node:r,context:this.context}).convert()??d;return{type:d,displayName:m,origin:n,body:p,availability:t.getAvailability({node:r,breadcrumbs:this.breadcrumbs}),docs:r.description,methodName:this.getOperationMethodName(r)}}}convertPathParameters({context:t,pathParameters:r}){for(let[n,i]of Object.entries(this.channel.parameters??{})){let o=t.resolveMaybeReference({schemaOrReference:i,breadcrumbs:this.breadcrumbs});if(o==null)continue;let a=new axe({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...o,name:n,in:"path",description:o.description,required:o.required??!0},parameterNamePrefix:this.channelPath}).convert();a!=null&&(this.inlinedTypes={...this.inlinedTypes,...a.inlinedTypes},a.type==="path"&&r.push(a.parameter))}}convertHeaders({context:t,headers:r}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[i,o]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let s=t.resolveMaybeReference({schemaOrReference:o,breadcrumbs:[...this.breadcrumbs,i]});if(s==null)continue;let c=new axe({context:this.context,breadcrumbs:[...this.breadcrumbs,i],parameter:{name:i,in:"header",required:n.includes(i),schema:s,description:"description"in s?s.description:void 0},parameterNamePrefix:this.channelPath}).convert();c!=null&&c.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},r.push(c.parameter))}}}resolveServerName(t){if(t==null)return;let r=this.context.spec.servers;if(r!=null&&t in r){let n=r[t];return NH.getServerName(t,n)}return t}getOperationMethodName(t){return new y5r({breadcrumbs:this.breadcrumbs,operation:t,context:this.context}).convert()}convertBindingQueryParameters({context:t,queryParameters:r}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[i,o]of Object.entries(this.channel.bindings.ws.query.properties??{})){let s=t.resolveMaybeReference({schemaOrReference:o,breadcrumbs:[...this.breadcrumbs,i]});if(s==null)continue;let c=new axe({context:this.context,breadcrumbs:[...this.breadcrumbs,i],parameter:{name:i,in:"query",required:n.includes(i),schema:s,description:"description"in s?s.description:void 0,deprecated:s.deprecated??!1},parameterNamePrefix:this.channelPath}).convert();c!=null&&c.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},r.push(c.parameter))}}}}});var E5r,HTu=h(()=>{"use strict";EUt();E5r=class extends NH{constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r,servers:n})}buildSingleBaseUrlEnvironment(t,r,n){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(n.protocol,n.url),docs:void 0,audiences:void 0,defaultUrl:void 0,urlTemplate:void 0,urlVariables:void 0}}}});var PNo,KTu,BNo,I5r,JTu=h(()=>{"use strict";_n();tc();Ft();wNo();EUt();SNo();TNo();ONo();PNo="$message.",KTu="#/channels/",BNo="#/servers/",I5r=class extends Pit{operations;inlinedTypes={};constructor({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o,operations:s}){super({context:t,breadcrumbs:r,websocketGroup:n,channel:i,channelPath:o}),this.operations=s}convert(){let t=[],r=[],n=[],o=new cxe({breadcrumbs:this.breadcrumbs,node:this.channel,context:this.context}).convert()??this.websocketGroup?.join(".")??this.channelPath;this.channel.parameters&&this.convertChannelParameters({pathParameters:t,queryParameters:r,headers:n,channelPath:this.channelPath});let s=Object.entries(this.operations).reduce((A,[y,E])=>{try{this.getChannelPathFromOperation(E)===this.channelPath&&(A[y]=E)}catch{}return A},{}),a=[];for(let[A,y]of Object.entries(s)){let x=new cxe({breadcrumbs:[...this.breadcrumbs,A],node:y,context:this.context}).convert()??A;for(let v of y.messages){let C=this.context.convertReferenceToTypeReference({reference:v});if(C.ok){let O=this.resolveMessageDocs(v)??y.description,D=cP.reference({bodyType:C.reference,docs:O});a.push({type:A,displayName:x,origin:y.action==="send"?"client":"server",body:D,availability:this.context.getAvailability({node:y,breadcrumbs:this.breadcrumbs}),docs:O,methodName:void 0})}}}let c=this.resolveChannelServersFromReference(this.channel.servers??[])??this.resolveFirstServerName(),u=this.transformToValidPath(this.channel.address??this.channelPath),l=M0(u),p=this.context.getAudiences({operation:this.channel,breadcrumbs:this.breadcrumbs})??[],d=this.hasServerSecurity()||this.context.authOverrides?.auth!=null,f=new uxe({context:this.context,breadcrumbs:this.breadcrumbs,node:this.context.spec}).convert(),g=new uxe({context:this.context,breadcrumbs:this.breadcrumbs,node:this.channel}).convert()??f;return{channel:{name:this.context.casingsGenerator.generateName(o),displayName:o,connectMethodName:void 0,baseUrl:c,path:l,auth:d,headers:n,queryParameters:r,pathParameters:t,messages:a,availability:this.context.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs}),docs:this.channel.description,examples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples({fullPath:u,baseUrl:c,asyncApiVersion:"v3"})},apiPlayground:g},audiences:p,inlinedTypes:this.inlinedTypes}}hasServerSecurity(){let r=this.context.spec.servers??{};if(this.channel.servers&&this.channel.servers.length>0){for(let n of this.channel.servers){let i=n.$ref.replace(BNo,""),o=r[i];if(o?.security&&o.security.length>0)return!0}return!1}for(let n of Object.values(r))if(n.security&&n.security.length>0)return!0;return!1}convertChannelParameters({pathParameters:t,queryParameters:r,headers:n,channelPath:i}){for(let o of Object.values(this.channel.parameters??{})){let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:[...this.breadcrumbs,"parameters"]});if(s==null)continue;let a=this.convertChannelParameterLocation(s.location);if(a==null)continue;let{type:c,parameterKey:u}=a,p=new axe({context:this.context,breadcrumbs:this.breadcrumbs,parameter:{...s,name:u,in:c},parameterNamePrefix:this.channelPath}).convert();if(p!=null)switch(this.inlinedTypes={...this.inlinedTypes,...p.inlinedTypes},p.type){case"path":t.push(p.parameter);break;case"query":r.push(p.parameter);break;case"header":n.push(p.parameter);break}}}convertChannelParameterLocation(t){try{let[r,n]=t.split("#/");if(r==null||n==null){this.context.errorCollector.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!r.startsWith(PNo)){this.context.errorCollector.collect({message:`Invalid location format: ${t}; expected ${PNo} prefix`,path:this.breadcrumbs});return}let i=r.substring(PNo.length);if(i!=="header"&&i!=="path"&&i!=="payload"){this.context.errorCollector.collect({message:`Invalid message type: ${i}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return i==="payload"?{type:"query",parameterKey:n}:{type:i,parameterKey:n}}catch{this.context.errorCollector.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveMessageDocs(t){let r=t,n=new Set;for(;this.context.isReferenceObject(r);){if(n.has(r.$ref))return;n.add(r.$ref);let i=this.context.resolveReference({reference:r,breadcrumbs:this.breadcrumbs});if(!i.resolved)return;r=i.value}return r.description??r.summary}resolveChannelServersFromReference(t){if(t==null||t.length===0||t[0]==null)return;let r=t[0];if(!r.$ref.startsWith(BNo)){this.context.errorCollector.collect({message:`Failed to resolve server name from server ref ${r.$ref}`,path:this.breadcrumbs});return}let n=r.$ref.substring(BNo.length);if(n==null){this.context.errorCollector.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}let i=this.context.spec.servers;if(i!=null&&n in i){let o=i[n];return NH.getServerName(n,o)}return n}resolveFirstServerName(){let t=this.context.spec.servers;if(t==null)return;let r=Object.keys(t)[0];if(r==null)return;let n=t[r];return NH.getServerName(r,n)}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(KTu))throw new S({message:`Failed to resolve channel path from operation ${t.channel.$ref}`,code:S.Code.ReferenceError});return t.channel.$ref.substring(KTu.length)}}});var v5r,YTu=h(()=>{"use strict";EUt();v5r=class extends NH{constructor({context:t,breadcrumbs:r,servers:n}){super({context:t,breadcrumbs:r,servers:n})}buildSingleBaseUrlEnvironment(t,r,n){return{id:r,name:t.casingsGenerator.generateName(r),url:this.constructServerUrl(n.protocol,n.host),docs:void 0,audiences:void 0,defaultUrl:void 0,urlTemplate:void 0,urlVariables:void 0}}}});var IUt,XTu=h(()=>{"use strict";_n();tc();Uo();WTu();HTu();JTu();YTu();IUt=class extends kH{constructor({context:t,breadcrumbs:r,audiences:n}){super({context:t,breadcrumbs:r,audiences:n})}async convert(){return this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.isAsyncAPIV3(this.context)?this.convertChannelMessages():this.convertComponentMessages(),this.convertSchemas(),this.convertServers(),this.convertSecuritySchemes(),this.convertChannels(),this.finalizeIr()}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}convertChannelMessages(){let t=this.context.spec;for(let[r,n]of Object.entries(t.channels??{}))for(let[i,o]of Object.entries(n.messages??{})){if(!this.context.isMessageWithPayload(o)&&!this.context.isReferenceObject(o))continue;let s=["channels",r,"messages",i],a=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:s});if(!this.context.isMessageWithPayload(a))continue;let c=this.context.resolveMaybeReference({schemaOrReference:a.payload,breadcrumbs:s});if(c==null)continue;let u=`${r}_${i}`;this.convertSchema({id:u,breadcrumbs:s,schema:c})}}convertComponentMessages(){for(let[t,r]of Object.entries(this.context.spec.components?.messages??{})){if(r.payload==null)continue;let n=["components","messages",t],i=this.context.resolveMaybeReference({schemaOrReference:r.payload,breadcrumbs:n});i!=null&&this.convertSchema({id:t,breadcrumbs:n,schema:i})}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{}))this.convertSchema({id:t,breadcrumbs:["components","schemas",t],schema:r})}convertSchema({id:t,breadcrumbs:r,schema:n}){let o=new wm.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:r,schema:n}).convert();o!=null&&this.addSchemaOutputToIr(t,o)}convertServers(){let t;if(this.isAsyncAPIV3(this.context)){let r=this.context.spec.servers;t=new v5r({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}else{let r=this.context.spec.servers;t=new E5r({context:this.context,breadcrumbs:["servers"],servers:r}).convert()}this.addEnvironmentsToIr({environmentConfig:t})}convertSecuritySchemes(){if(this.context.authOverrides){let r=R3t({rawApiFileSchema:this.context.authOverrides,casingsGenerator:this.context.casingsGenerator});this.addAuthToIR({requirement:r.requirement,schemes:r.schemes,docs:r.docs});return}let t=this.convertAsyncApiSecuritySchemes();t.length>0&&this.addAuthToIR({requirement:t.length===1?"ALL":"ANY",schemes:t,docs:void 0})}convertAsyncApiSecuritySchemes(){let t=[];for(let[r,n]of Object.entries(this.context.spec.components?.securitySchemes??{})){let i=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:["components","securitySchemes",r]});if(i==null)continue;let o=this.convertSecurityScheme({securityScheme:i,schemeId:r});o!=null&&t.push(o)}return t}convertSecurityScheme({securityScheme:t,schemeId:r}){switch(t.type){case"http":{if(t.scheme?.toLowerCase()==="bearer")return Sp.bearer({key:r,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,tokenPlaceholder:void 0,docs:t.description,playgroundDocs:void 0});if(t.scheme?.toLowerCase()==="basic")return Sp.basic({key:r,username:this.context.casingsGenerator.generateName("username"),password:this.context.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,usernameOmit:!1,passwordOmit:!1,usernamePlaceholder:void 0,passwordPlaceholder:void 0,docs:t.description,playgroundDocs:void 0});break}case"apiKey":{if(t.in==="header")return Sp.header({key:r,name:{name:this.context.casingsGenerator.generateName("apiKey"),wireValue:t.name},valueType:Ji.OPTIONAL_STRING,prefix:void 0,headerEnvVar:void 0,headerPlaceholder:void 0,docs:t.description,playgroundDocs:void 0});break}case"oauth2":return Sp.bearer({key:r,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,tokenPlaceholder:void 0,docs:t.description,playgroundDocs:void 0})}}convertChannels(){for(let[t,r]of Object.entries(this.context.spec.channels??{})){let i=new ux.SdkGroupNameExtension({breadcrumbs:["channels",t],operation:r,context:this.context}).convert()?.groups,o;if(this.isAsyncAPIV3(this.context)){let a=this.context.spec.operations??{};o=new I5r({context:this.context,breadcrumbs:["channels",t],websocketGroup:i,channel:r,channelPath:t,operations:a}).convert()}else o=new b5r({context:this.context,breadcrumbs:["channels",t],websocketGroup:i,channel:r,channelPath:t}).convert();o!=null&&(this.addWebsocketChannelToIr({websocketChannel:o.channel,channelPath:t,audiences:o.audiences,websocketGroup:i}),this.addTypesToIr(o.inlinedTypes))}}}});var vUt,ZTu=h(()=>{"use strict";_n();Uo();vUt=class extends Wb{isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let o,s=t.$ref.match(/^.*\/schemas\/(.+)$/),a=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),c=t.$ref.match(/^.*\/messages\/(.+)$/);if(s&&s[1])return o=s[1],this.convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o});if(a&&a[2]){let u=a[1],l=a[2];return o=`${u}_${l}`,this.convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o})}else return c&&c[1]?(o=c[1],this.convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o})):{ok:!1}}convertSchemaReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o}){let s=this.resolveReference({reference:t,breadcrumbs:r});if(!s.resolved)return{ok:!1};let a;if(i==="reference_identifier")a=n??s.value.title;else if(i==="discriminator_key")a=s.value.title??n;else{let c=t.$ref.split("/").pop()??o;a=s.value.title??c}return{ok:!0,reference:Jr.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(o),typeId:o,displayName:a,default:void 0,inline:!1})}}convertV3MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o}){let s=this.resolveReference({reference:t,breadcrumbs:r});if(!s.resolved)return{ok:!1};let a;if(i==="reference_identifier")a=n??s.value.name;else if(i==="discriminator_key")a=s.value.name??n;else{let c=t.$ref.split("/").pop()??o;a=s.value.name??c}return{ok:!0,reference:Jr.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(o),typeId:o,displayName:a,default:void 0,inline:!1})}}convertV2MessageReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i,typeId:o}){let s=this.resolveReference({reference:t,breadcrumbs:r});if(!s.resolved)return{ok:!1};let a;if(i==="reference_identifier")a=n??s.value.messageId??s.value.name;else if(i==="discriminator_key")a=s.value.messageId??s.value.name??n;else{let c=t.$ref.split("/").pop()??o;a=s.value.messageId??s.value.name??c}return{ok:!0,reference:Jr.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(o),typeId:o,displayName:a,default:void 0,inline:!1})}}}});var $Tu=h(()=>{"use strict";XTu();ZTu()});function znm(e){let t=new Set,r,n=new RegExp(Qnm.source,"g");for(;(r=n.exec(e))!=null;)r[1]!=null&&t.add(r[1]);return t}var Qnm,x5r,eOu=h(()=>{"use strict";Uo();Qnm=/\{([^}]+)\}/g,x5r=class extends Yo{document;key="x-fern-base-path";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t=="string")return this.parseString(t);if(typeof t=="object"&&!Array.isArray(t))return this.parseStructured(t);this.context.errorCollector.collect({message:"Expected `x-fern-base-path` to be a string or object",path:this.breadcrumbs})}}parseString(t){if(this.validatePath(t))return{path:t,parameters:[],pathsIncludeBasePath:!1}}parseStructured(t){let r=t.path;if(typeof r!="string"){this.context.errorCollector.collect({message:"`x-fern-base-path.path` must be a string",path:this.breadcrumbs});return}if(!this.validatePath(r))return;let n=znm(r),i=t.parameters;if(i!=null&&(typeof i!="object"||Array.isArray(i))){this.context.errorCollector.collect({message:"`x-fern-base-path.parameters` must be an object map",path:[...this.breadcrumbs,"parameters"]});return}let o=i??{};for(let c of Object.keys(o))if(!n.has(c)){this.context.errorCollector.collect({message:`Parameter '${c}' does not appear in the base path '${r}'`,path:[...this.breadcrumbs,"parameters",c]});return}let s=[];for(let c of n){let u=o[c];if(u==null){s.push({name:c,type:"string",default:void 0,docs:void 0});continue}if(typeof u!="object"||Array.isArray(u)){this.context.errorCollector.collect({message:`Parameter '${c}' must be an object`,path:[...this.breadcrumbs,"parameters",c]});return}let l=u,p=typeof l.type=="string"?l.type:"string",d=typeof l.docs=="string"?l.docs:void 0;s.push({name:c,type:p,default:l.default,docs:d})}let a=t["paths-include-base-path"]===!0;return{path:r,parameters:s,pathsIncludeBasePath:a}}validatePath(t){return t.startsWith("/")?!0:(this.context.errorCollector.collect({message:"`x-fern-base-path` path must start with '/'",path:this.breadcrumbs}),!1)}}});var C5r,tOu=h(()=>{"use strict";Uo();C5r=class extends Yo{document;key="x-fern-base-url-env";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t!="string"||t.length===0){this.context.errorCollector.collect({message:"Expected a non-empty string value for x-fern-base-url-env",path:this.breadcrumbs});return}return t}}}});var w5r,rOu=h(()=>{"use strict";Uo();w5r=class extends Yo{document;key="x-fern-global-headers";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-headers",path:this.breadcrumbs});return}return t}}}});function Mnm(e){let r=e["x-fern-default"]??e.default;if(typeof r=="string"||typeof r=="boolean"||typeof r=="number")return r}var S5r,nOu=h(()=>{"use strict";Uo();S5r=class extends Yo{document;key="x-fern-global-parameters";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t==null)return;if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected non-array value for x-fern-global-parameters",path:this.breadcrumbs});return}let r=[];for(let[n,i]of t.entries()){if(typeof i!="object"||i==null||Array.isArray(i)){this.context.errorCollector.collect({message:`x-fern-global-parameters[${n}] must be an object`,path:[...this.breadcrumbs,`${n}`]});continue}let o=i;if(typeof o.name!="string"){this.context.errorCollector.collect({message:`x-fern-global-parameters[${n}].name is required and must be a string`,path:[...this.breadcrumbs,`${n}`,"name"]});continue}r.push({name:o.name,"parameter-name":typeof o["parameter-name"]=="string"?o["parameter-name"]:void 0,in:typeof o.in=="string"?o.in:void 0,target:typeof o.target=="string"?o.target:void 0,env:typeof o.env=="string"?o.env:void 0,default:Mnm(o),optional:typeof o.optional=="boolean"?o.optional:void 0,apply:typeof o.apply=="string"?o.apply:void 0,type:typeof o.type=="string"?o.type:void 0,docs:typeof o.docs=="string"?o.docs:void 0})}return r.length>0?r:void 0}}});function Lnm(e){if(e!=null){if(typeof e=="string")return Ut.Literal.string(e);if(typeof e=="boolean")return Ut.Literal.boolean(e)}}function iOu({globalHeaderOverrides:e,context:t}){let r=[];for(let[n,i]of Object.entries(e.headers??{}))if(typeof i=="string")r.push({name:t.casingsGenerator.generateNameAndWireValue({name:n,wireValue:n}),valueType:Ji.STRING,env:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},availability:void 0,docs:void 0,clientDefault:void 0,defaultValue:void 0});else{let o=i.name??n;r.push({name:t.casingsGenerator.generateNameAndWireValue({name:o,wireValue:n}),valueType:Ji.STRING,env:i.env,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},availability:void 0,docs:i.docs,clientDefault:Lnm(i.default),defaultValue:i.default})}return r}var oOu=h(()=>{"use strict";_n();Uo()});function Vnm(e){if(e!=null){if(typeof e=="string")return Ut.Literal.string(e);if(typeof e=="boolean")return Ut.Literal.boolean(e)}}function sOu({globalHeaders:e,context:t}){return e.map(r=>({name:t.casingsGenerator.generateNameAndWireValue({name:r.name??"",wireValue:r.header}),valueType:r.optional?Ji.OPTIONAL_STRING:Ji.STRING,env:r.env,v2Examples:r.optional?void 0:Unm({header:r,context:t}),availability:void 0,docs:void 0,clientDefault:Vnm(r["x-fern-default"]),defaultValue:void 0}))}function Unm({header:e,context:t}){let r=new nS({breadcrumbs:[],context:t,schema:{type:"string"},example:e.header}),{validExample:n}=r.convert();return{userSpecifiedExamples:{},autogeneratedExamples:{globalHeaderExample:n}}}var aOu=h(()=>{"use strict";_n();Uo()});function _nm(e,t,r,n){if(e!=null){if(typeof e=="boolean"){if(t!=null&&t!=="boolean"){n.errorCollector.collect({message:`Default value is a boolean but type is '${t}'; expected a ${t} value`,path:[...r,"default"]});return}return Ut.Literal.boolean(e)}if(typeof e=="string"){if(t==="boolean"){n.errorCollector.collect({message:"Default value is a string but type is 'boolean'; expected a boolean value",path:[...r,"default"]});return}if(t==="integer"||t==="double"||t==="number"){n.errorCollector.collect({message:`Default value is a string but type is '${t}'; expected a numeric value`,path:[...r,"default"]});return}return Ut.Literal.string(e)}if(typeof e=="number"){if(t==="boolean"){n.errorCollector.collect({message:"Default value is a number but type is 'boolean'; expected a boolean value",path:[...r,"default"]});return}if(t==="string"){n.errorCollector.collect({message:"Default value is a number but type is 'string'; expected a string value",path:[...r,"default"]});return}if(t==="integer"&&!Number.isInteger(e)){n.errorCollector.collect({message:`Default value ${e} is not an integer`,path:[...r,"default"]});return}return Ut.Literal.string(String(e))}n.errorCollector.collect({message:`Default value has unsupported type '${typeof e}'; expected a string, number, or boolean`,path:[...r,"default"]})}}function Gnm(e,t,r){switch(e){case void 0:case"body":return Ut.GlobalParameterLocation.Body;case"query":return Ut.GlobalParameterLocation.Query;case"header":return Ut.GlobalParameterLocation.Header;case"path":return Ut.GlobalParameterLocation.Path;default:return r.errorCollector.collect({message:`Invalid global parameter location '${e}'; expected one of: body, query, header, path`,path:t}),Ut.GlobalParameterLocation.Body}}function qnm(e,t,r){switch(e){case void 0:return;case"explicit":return Ut.GlobalParameterApplyMode.Explicit;case"auto":return Ut.GlobalParameterApplyMode.Auto;default:r.errorCollector.collect({message:`Invalid global parameter apply mode '${e}'; expected one of: explicit, auto`,path:t});return}}function Wnm(e,t){let r=Hnm(e);return t===!0?Ut.TypeReference.container(Ut.ContainerType.optional(r)):r}function Hnm(e){switch(e){case"boolean":return Ut.TypeReference.primitive({v1:"BOOLEAN",v2:Ut.PrimitiveTypeV2.boolean({default:void 0})});case"integer":return Ut.TypeReference.primitive({v1:"INTEGER",v2:Ut.PrimitiveTypeV2.integer({default:void 0,validation:void 0})});case"double":case"number":return Ut.TypeReference.primitive({v1:"DOUBLE",v2:Ut.PrimitiveTypeV2.double({default:void 0,validation:void 0})});default:return Ji.STRING}}function Knm(e){return e.target!=null?e.target:e.name}function cOu({globalParameters:e,context:t}){let r=new Map;for(let[n,i]of e.entries()){let o=r.get(i.name);o!=null?t.errorCollector.collect({message:`Duplicate global parameter name '${i.name}' at index ${n} (first seen at index ${o}). Each global parameter must have a unique name.`,path:["x-fern-global-parameters",`${n}`,"name"]}):r.set(i.name,n)}return e.map((n,i)=>({param:n,index:i})).filter(({param:n,index:i})=>r.get(n.name)===i).map(({param:n,index:i})=>{let o=["x-fern-global-parameters",`${i}`],s=Gnm(n.in,[...o,"in"],t),a=n["parameter-name"]??n.name;return{id:n.name,name:t.casingsGenerator.generateNameAndWireValue({name:a,wireValue:n.name}),location:s,target:Knm(n),valueType:Wnm(n.type,n.optional),env:n.env,clientDefault:_nm(n.default,n.type,o,t),optional:n.optional,apply:qnm(n.apply,[...o,"apply"],t),docs:n.docs}})}var uOu=h(()=>{"use strict";_n();Uo()});var T5r,lOu=h(()=>{"use strict";wt();Uo();T5r=class extends wm.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r,parameter:n})}convert(){let t,r={},n=this.getSchema();if(n!=null){let i=this.context.convertBreadcrumbsToName([...this.breadcrumbs,this.parameter.name]),s=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,this.parameter.name,"schema"],schemaOrReference:n,wrapAsOptional:this.parameter.required==null||!this.parameter.required,schemaIdOverride:i}).convert();s!=null&&(t=s.type,r=s.inlinedTypes??{})}return this.convertToOutput({schema:n??{type:"string"},typeReference:t,inlinedTypes:r})}getSchema(){if(this.parameter.schema!=null)return this.parameter.schema;if(!(!this.context.settings.respectParameterContent||this.parameter.in!=="header"||this.parameter.content==null)){for(let[t,r]of Object.entries(this.parameter.content))if(r.schema!=null&&Qp.parse(t)?.isJSON())return r.schema}}}});function Ynm({encoding:e}){if(e){if(e.explode)return"exploded";if(e.style==="form")return"form";if(e.contentType)return Jnm[e.contentType]}}var O5r,Jnm,pOu=h(()=>{"use strict";wt();_n();tc();Uo();O5r=class extends wm.AbstractConverters.AbstractMediaTypeObjectConverter{contentType;mediaType;description;required;schemaId;streamingExtension;queryParameters;constructor({context:t,breadcrumbs:r,contentType:n,mediaType:i,description:o,required:s,group:a,method:c,streamingExtension:u,queryParameters:l}){super({context:t,breadcrumbs:r,group:a,method:c}),this.contentType=n,this.mediaType=i,this.description=o,this.required=s,this.schemaId=[...this.group,this.method,"Request"].join("_"),this.streamingExtension=u,this.queryParameters=l??[]}get bodyRequired(){return this.required===!1?!1:void 0}convert(){return this.streamingExtension?.type=="streamCondition"?this.convertStreamConditionRequestBody():this.convertNonStreamConditionRequestBody()}convertStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleStreamConditionJsonOrFormContent({contentType:this.contentType})}convertNonStreamConditionRequestBody(){if(this.isOrderedJsonOrFormContentType())return this.handleJsonOrFormContent({contentType:this.contentType});if(Qp.parse(this.contentType)?.isMultipart())return this.handleMultipartContent({contentType:this.contentType});if(this.isBinaryContentType())return this.handleBinaryContent({contentType:this.contentType})}isOrderedJsonOrFormContentType(){let t=Qp.parse(this.contentType);return t?t.isJSON()||t.isURLEncoded()||t.isPlainText()||t.isCSV()||t.isHTML()||t.isXML()||t.isDNS()||t.isApplicationText():!1}isBinaryContentType(){let t=Qp.parse(this.contentType);return t?t.isBinary():!1}handleJsonOrFormContent({contentType:t}){let r=this.mediaType;if(r==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});if(n==null)return this.handleSchemalessJsonContent({contentType:t,mediaTypeObject:r});let i=n.schema?.typeDeclaration.shape;return i?.type==="object"?this.hasBodyQueryParameterOverlap(i.properties)?{requestBody:ad.reference({contentType:t,docs:this.description,requestBodyType:n.type,required:this.bodyRequired,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n.inlinedTypes??{}}:{requestBody:ad.inlinedRequestBody({contentType:t,docs:this.description??n.schema?.typeDeclaration.docs,name:this.context.casingsGenerator.generateName(this.schemaId),extendedProperties:i.extendedProperties,extends:i.extends,properties:i.properties,extraProperties:i.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:n.inlinedTypes}),inlinedPropertiesByAudience:n.schema?.propertiesByAudience}:{requestBody:ad.reference({contentType:t,docs:this.description,requestBodyType:n.type,required:this.bodyRequired,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n.inlinedTypes??{}}}handleSchemalessJsonContent({contentType:t,mediaTypeObject:r}){if(!(r.example!=null||r.examples!=null&&Object.keys(r.examples).length>0))return;let i={userSpecifiedExamples:{},autogeneratedExamples:{}},o=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:r,breadcrumbs:this.breadcrumbs,defaultExampleName:`${[...this.group,this.method].join("_")}_example`}),s=new Set;for(let[a,c]of o){let u=this.context.resolveExampleWithValue(c),l=this.context.resolveExampleRecursively({example:c,breadcrumbs:this.breadcrumbs}),p=a;if(this.context.isExampleWithSummary(l)){let d=l.summary;s.has(d)||(p=d)}s.add(p),u!=null&&(i.userSpecifiedExamples[p]=u)}return{requestBody:ad.reference({contentType:t,docs:this.description,requestBodyType:Jr.unknown(),required:this.bodyRequired,v2Examples:i}),streamRequestBody:void 0,inlinedTypes:{}}}handleMultipartContent({contentType:t}){let r=this.mediaType;if(r==null||r.schema==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,resolveSchema:!0,contentType:t});if(n==null)return;let i=n.schema?.typeDeclaration.shape;if(i?.type==="object")return{requestBody:ad.fileUpload({contentType:t,docs:this.description,name:this.context.casingsGenerator.generateName(this.schemaId),properties:i.properties.map(o=>{let s=r.encoding?.[nr(o.name)];return this.convertRequestBodyProperty({property:o,contentType:t,encoding:s})}),v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:n.inlinedTypes}),examples:n.examples}}handleBinaryContent({contentType:t}){let r=this.mediaType;if(r==null)return;let n=this.parseMediaTypeObject({mediaTypeObject:r,schemaId:this.schemaId,contentType:t});return{requestBody:ad.bytes({contentType:t,isOptional:this.required===!1,docs:this.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:r,exampleGenerationStrategy:"request"})}),streamRequestBody:void 0,inlinedTypes:n?.inlinedTypes??{}}}convertRequestBodyProperty({property:t,contentType:r,encoding:n}){let{isFile:i,isOptional:o,isArray:s}=this.recursivelyCheckTypeReferenceIsFile({typeReference:t.valueType});return i?s?uC.file($j.fileArray({key:t.name,isOptional:o,contentType:r,docs:t.docs})):uC.file($j.file({key:t.name,isOptional:o,contentType:r,docs:t.docs})):uC.bodyProperty({...t,contentType:n?.contentType??r,style:Ynm({encoding:n}),name:t.name})}handleStreamConditionJsonOrFormContent({contentType:t}){if(this.streamingExtension?.type!=="streamCondition")return;let r=this.mediaType;if(r==null||r.schema==null)return;let n=this.context.resolveMaybeReference({schemaOrReference:r.schema,breadcrumbs:[...this.breadcrumbs,"content",t,"schema"]});if(n==null)return;let i=n.properties?.[this.streamingExtension.streamConditionProperty];if(i!=null&&this.context.isReferenceObject(i)&&(i=void 0),i==null){if(n.oneOf==null&&n.anyOf==null)return;i={type:"boolean"}}let o=this.buildStreamConditionRequestBody({streamConditionProperty:i,resolvedMediaTypeSchema:n,isStreaming:!0,contentType:t,mediaTypeObject:r}),s=this.buildStreamConditionRequestBody({streamConditionProperty:i,resolvedMediaTypeSchema:n,isStreaming:!1,contentType:t,mediaTypeObject:r});if(!(o==null||s==null))return{requestBody:s.requestBody,streamRequestBody:o.requestBody,inlinedTypes:this.context.removeSchemaFromInlinedTypes({id:this.schemaId,inlinedTypes:{...o.inlinedTypes,...s.inlinedTypes}})}}buildStreamConditionRequestBody({streamConditionProperty:t,resolvedMediaTypeSchema:r,isStreaming:n,contentType:i,mediaTypeObject:o}){if(this.streamingExtension==null||this.streamingExtension.type!=="streamCondition")return;let s={...r,properties:{...r.properties,[this.streamingExtension.streamConditionProperty]:{...t,type:"boolean",const:n}},required:[...r.required??[],this.streamingExtension.streamConditionProperty]},a={...o,schema:s},c=this.parseMediaTypeObject({mediaTypeObject:a,schemaId:this.schemaId,contentType:i});if(c==null)return;let u=c.schema?.typeDeclaration.shape;return u?.type==="object"?{requestBody:ad.inlinedRequestBody({contentType:i,docs:this.description??c.schema?.typeDeclaration.docs,name:this.context.casingsGenerator.generateName(n?this.streamingExtension?.streamRequestName??`${this.schemaId}_streaming`:this.schemaId),extendedProperties:u.extendedProperties,extends:u.extends,properties:u.properties,extraProperties:u.extraProperties,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:a,exampleGenerationStrategy:"request"})}),inlinedTypes:c.inlinedTypes}:{requestBody:ad.reference({contentType:i,docs:this.description,requestBodyType:c.type,required:this.bodyRequired,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:a,exampleGenerationStrategy:"request"})}),inlinedTypes:c.inlinedTypes??{}}}recursivelyCheckTypeReferenceIsFile({typeReference:t,isOptional:r,isArray:n}){return this.context.isList(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.list,isOptional:r,isArray:!0}):this.context.isOptional(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.optional,isOptional:!0,isArray:n}):this.context.isNullable(t)?this.recursivelyCheckTypeReferenceIsFile({typeReference:t.container.nullable,isOptional:r,isArray:n}):{isFile:this.context.isFile(t),isOptional:r??!1,isArray:n??!1}}hasBodyQueryParameterOverlap(t){if(this.queryParameters.length===0)return!1;let r=new Set(this.queryParameters.map(n=>nr(n.name).toLowerCase()));return t.some(n=>r.has(nr(n.name).toLowerCase()))}},Jnm={"application/json":"json"}});function $nm(e){return e?.header!=null}var Xnm,Znm,Bit,DNo=h(()=>{"use strict";wt();_n();tc();Uo();Vi();lOu();pOu();Xnm=/{([^}]+)}/g,Znm=new Set(["user-agent","content-length","content-type","x-forwarded-for","cookie","origin","content-disposition","x-ping-custom-domain"]),Bit=class extends Ji{operation;method;path;pathItemParameters;inlinedTypes={};constructor({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s}){super({context:t,breadcrumbs:r}),this.operation=n,this.method=i,this.path=o,this.pathItemParameters=s??[]}convertHttpMethod(){switch(this.method){case"get":return am.Get;case"post":return am.Post;case"put":return am.Put;case"delete":return am.Delete;case"patch":return am.Patch;case"head":return am.Head;default:return}}convertParameters({breadcrumbs:t}){let r=[],n=[],i=[],o=this.mergeParameters(this.pathItemParameters,this.operation.parameters??[]);if(o.length===0)return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:n,headers:i};for(let s of o){let a=this.context.resolveMaybeReference({schemaOrReference:s,breadcrumbs:t});if(a==null)continue;let u=new T5r({context:this.context,breadcrumbs:t,parameter:a}).convert();if(u!=null)switch(this.inlinedTypes={...this.inlinedTypes,...u.inlinedTypes},u.type){case"path":r.push(u.parameter);break;case"query":n.push(u.parameter);break;case"header":{let l=zr(u.parameter.name),p=nr(u.parameter.name),d=!1,f=this.context.authOverrides?.["auth-schemes"];if(f!=null){for(let g of Object.values(f))if($nm(g)&&g.header.toLowerCase()===p.toLowerCase()){d=!0;break}}let m=this.context.globalHeaderNames;if(m!=null){for(let g of m)if(g.toLowerCase()===p.toLowerCase()){d=!0;break}}!Znm.has(l.toLowerCase())&&!d&&i.push(u.parameter);break}}}return this.checkMissingPathParameters(r),{pathParameters:r,queryParameters:n,headers:i}}mergeParameters(t,r){if(t.length===0)return r;if(r.length===0)return t;let n=new Set;for(let o of r){let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:this.breadcrumbs});s!=null&&n.add(`${s.in}:${s.name}`)}return[...t.filter(o=>{let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:this.breadcrumbs});return s==null?!1:!n.has(`${s.in}:${s.name}`)}),...r]}checkMissingPathParameters(t){let n=[...this.path.matchAll(Xnm)].map(i=>i[1]).filter(i=>!t.some(o=>zr(o.name)===i));for(let i of n){if(i==null)continue;let o=`${i}_example`;t.push({name:this.context.casingsGenerator.generateName(i),valueType:Ji.STRING,docs:void 0,location:"ENDPOINT",variable:void 0,v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{[o]:this.generateStringParameterExample({example:i})}},explode:void 0,clientDefault:void 0})}}convertRequestBody({breadcrumbs:t,group:r,method:n,streamingExtension:i,queryParameters:o}){if(this.operation.requestBody==null)return;let s=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:t});if(s==null)return null;let a=[];for(let[c,u]of Object.entries(s.content)){let p=new O5r({context:this.context,breadcrumbs:t,contentType:c,mediaType:u,description:s.description,required:s.required,group:r??[],method:n,streamingExtension:i,queryParameters:o}).convert();p!=null&&(this.inlinedTypes={...this.inlinedTypes,...p.inlinedTypes},a.push({requestBody:p.requestBody,streamRequestBody:p.streamRequestBody,examples:p.examples,inlinedPropertiesByAudience:p.inlinedPropertiesByAudience}))}return a}computeGroupNameAndLocationFromExtensions(){let r=new ux.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.methodName,i=new ux.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()?.groups??[];if(r!=null)return{group:i,method:r}}evaluateMethodNameFromOperation(){let t=this.operation.operationId;return t??(this.operation.summary!=null?ti(this.operation.summary):ti(`${this.method}_${this.path.split("/").join("_")}`))}sanitizeMethodName(t){return t.includes(".")?ti(t):t}computeGroupNameFromTagAndOperationId(){let t=this.operation.tags?.[0],r=this.evaluateMethodNameFromOperation();if(t==null)return{method:this.sanitizeMethodName(r)};let n=this.context.settings.respectOperationIdWordBoundaries,i=M7(t,n),o=M7(r,n);return b0(i,o)?{method:t}:this.computeGroupAndMethodFromTokens({tag:t,tagTokens:i,methodName:r,methodNameTokens:o})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,methodName:n,methodNameTokens:i}){if(r.some((a,c)=>a!==i[c]))return{group:[t],method:this.sanitizeMethodName(n)};let s=i.slice(r.length);return s[0]!=null&&/^\d/.test(s[0])?{group:[t],method:this.sanitizeMethodName(n)}:{group:[t],method:ti(s.join("_"))}}generateStringParameterExample({example:t}){let r=new wm.ExampleConverter({breadcrumbs:this.breadcrumbs,context:this.context,schema:{type:"string"},example:t}),{validExample:n}=r.convert();return n}}});var Dit,RNo=h(()=>{"use strict";_n();DNo();Dit=class extends Bit{constructor({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s}){super({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s})}convert(){if(this.operation.requestBody==null){this.context.errorCollector.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let t=this.convertHttpMethod();if(t==null)return;if(t!=="POST"&&t!=="GET"){this.context.errorCollector.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:r,method:n}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),i=[...this.breadcrumbs,"Payload"],{headers:o,queryParameters:s}=this.convertParameters({breadcrumbs:i}),a=this.convertRequestBody({breadcrumbs:i,group:r,method:n,streamingExtension:void 0,queryParameters:s});if(a==null)return;let c=a[0]?.requestBody;if(c==null)return;let u=c.type==="inlinedRequestBody"?a[0]?.inlinedPropertiesByAudience:void 0,l,p;if(c.type==="inlinedRequestBody")l=a1.inlinedPayload({name:c.name,extends:c.extends,properties:c.properties});else if(c.type==="reference")l=a1.reference({payloadType:c.requestBodyType,docs:c.docs});else if(c.type==="fileUpload")p={name:c.name,properties:c.properties,docs:c.docs,v2Examples:c.v2Examples,contentType:c.contentType},l=a1.inlinedPayload({name:c.name,extends:[],properties:[]});else return;let d=this.convertWebhookResponses();return{audiences:this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],group:r,inlinedPayloadPropertiesByAudience:u,webhook:{id:`${r?.join(".")??""}.${n}`,name:this.context.casingsGenerator.generateName(n),displayName:this.operation.summary,method:t,headers:o,payload:l,signatureVerification:void 0,fileUploadPayload:p,responses:d.length>0?d:void 0,examples:[],availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),docs:this.operation.description,v2Examples:{autogeneratedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(c.v2Examples?.autogeneratedExamples??{}),userSpecifiedExamples:this.getWebhookV2ExamplesFromRequestBodyV2Examples(c.v2Examples?.userSpecifiedExamples??{})}},inlinedTypes:this.inlinedTypes}}convertWebhookResponses(){let t=[];if(this.operation.responses==null)return t;for(let[r,n]of Object.entries(this.operation.responses)){let i=/^\d[Xx]{2}$/.test(r),o;if(i)o=parseInt(r.charAt(0))*100;else if(o=parseInt(r),isNaN(o))continue;let a=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:[...this.breadcrumbs,"responses",r]})?.description;t.push({statusCode:o,isWildcardStatusCode:i?!0:void 0,body:void 0,docs:a})}return t}getWebhookV2ExamplesFromRequestBodyV2Examples(t){return Object.fromEntries(Object.entries(t).map(([r,n])=>[r,{name:r,payload:n}]))}}});var fOu,dOu=h(()=>{"use strict";fOu=["get","post","put","delete","patch","head"]});var P5r,mOu=h(()=>{"use strict";Uo();P5r=class extends Yo{operation;key="x-fern-global-parameter";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;if(typeof t=="string")return[t];if(!Array.isArray(t)){this.context.errorCollector.collect({message:"Received unexpected value for x-fern-global-parameter; expected a string or array of strings",path:this.breadcrumbs});return}let r=[];for(let[n,i]of t.entries()){if(typeof i!="string"){this.context.errorCollector.collect({message:`x-fern-global-parameter[${n}] must be a string`,path:[...this.breadcrumbs,`${n}`]});continue}r.push(i)}return r.length>0?r:void 0}}});var B5r,hOu=h(()=>{"use strict";Uo();B5r=class extends Yo{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return t}}}});var eim,tim,rim,nim,kNo,gOu=h(()=>{"use strict";jn();eim=Be.object({cursor:Be.string(),next_cursor:Be.string(),results:Be.string()}),tim=Be.object({offset:Be.string(),results:Be.string(),step:Be.string().optional(),"has-next-page":Be.string().optional()}),rim=Be.object({next_uri:Be.string(),results:Be.string()}),nim=Be.object({next_path:Be.string(),results:Be.string()}),kNo=Be.union([Be.boolean(),eim,tim,rim,nim])});var FNo,lxe,D5r,AOu=h(()=>{"use strict";Uo();gOu();FNo="$request.",lxe="$response.",D5r=class extends Yo{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:n,context:i}){super({breadcrumbs:t,context:i}),this.operation=r,this.document=n}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=kNo.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean"){let n=this.getExtensionValue(this.document);if(n==null)return;if(typeof n=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let i=kNo.safeParse(n);if(!i.success){this.context.errorCollector.collect({message:`Invalid x-fern-pagination extension: ${i.error.message}`,path:this.breadcrumbs});return}if(typeof i.data=="boolean"){this.context.errorCollector.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:i.data})}if(typeof r.data=="boolean"){this.context.errorCollector.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig({config:r.data})}convertPaginationConfig({config:t}){let r=t;if("cursor"in r)return{type:"cursor",cursor:Wb.maybeTrimPrefix(r.cursor,FNo),nextCursor:Wb.maybeTrimPrefix(r.next_cursor,lxe),results:Wb.maybeTrimPrefix(r.results,lxe)};let n=t;if("next_uri"in n)return{type:"uri",nextUri:Wb.maybeTrimPrefix(n.next_uri,lxe),results:Wb.maybeTrimPrefix(n.results,lxe)};let i=t;if("next_path"in i)return{type:"path",nextPath:Wb.maybeTrimPrefix(i.next_path,lxe),results:Wb.maybeTrimPrefix(i.results,lxe)};let o=t;return{type:"offset",offset:Wb.maybeTrimPrefix(o.offset,FNo),results:Wb.maybeTrimPrefix(o.results,lxe),step:o.step!=null?Wb.maybeTrimPrefix(o.step,FNo):void 0,hasNextPage:o["has-next-page"]!=null?Wb.maybeTrimPrefix(o["has-next-page"],lxe):void 0}}}});function NNo(e){let t=e["x-fern-streaming"];if(t==null||typeof t=="boolean")return;let r=t.resumable;return typeof r=="boolean"?r:void 0}var iim,oim,sim,R5r,yOu=h(()=>{"use strict";Uo();jn();iim="$request.",oim=Be.object({"stream-condition":Be.string().optional(),format:Be.enum(["sse","json"]).optional(),"stream-description":Be.string().optional(),"stream-request-name":Be.string().optional(),"response-stream":Be.any(),response:Be.any(),terminator:Be.string().optional(),resumable:Be.boolean().optional()}),sim=Be.union([Be.boolean(),oim]),R5r=class extends Yo{document;operation;key="x-fern-streaming";constructor({breadcrumbs:t,document:r,operation:n,context:i}){super({breadcrumbs:t,context:i}),this.document=r,this.operation=n}convert(){let t=this.getExtensionValue(this.operation);if(t==null)return;let r=sim.safeParse(t);if(!r.success){this.context.errorCollector.collect({message:`Invalid x-fern-streaming extension: ${r.error.message}`,path:this.breadcrumbs});return}if(typeof r.data=="boolean")return r.data?{type:"stream",format:"json",terminator:void 0,resumable:!1}:void 0;let n=r.data.resumable??NNo(this.document)??!1;if(r.data["stream-condition"]==null&&r.data.format!=null)return{type:"stream",format:r.data.format,terminator:r.data.terminator,resumable:n};if(r.data["stream-condition"]==null){this.context.errorCollector.collect({message:"Missing stream-condition property without specified format.",path:this.breadcrumbs});return}return{type:"streamCondition",format:r.data.format??"json",terminator:r.data.terminator,streamDescription:r.data["stream-description"],streamConditionProperty:Wb.maybeTrimPrefix(r.data["stream-condition"],iim),streamRequestName:r.data["stream-request-name"],responseStream:r.data["response-stream"],response:r.data.response,resumable:n}}}});var k5r,bOu=h(()=>{"use strict";Uo();k5r=class extends Yo{operation;key="x-fern-subtitle";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"Received unexpected non-string value for x-fern-subtitle",path:this.breadcrumbs});return}return t}}}});var F5r,EOu=h(()=>{"use strict";Uo();F5r=class extends Yo{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return t}}}});function aim(e){return io(e)&&typeof e.$ref=="string"}function cim(e,t){if(e!=null){if(typeof e=="string")return e;if(aim(e)){let r=(0,IOu.resolve)(t??process.cwd(),e.$ref);if((0,j5r.existsSync)(r))try{return(0,j5r.readFileSync)(r,"utf-8")}catch{return}}}}var j5r,IOu,N5r,vOu=h(()=>{"use strict";wt();Uo();j5r=require("fs"),IOu=require("path");N5r=class extends Yo{operation;baseDir;key="x-codeSamples";constructor({context:t,breadcrumbs:r,operation:n,baseDir:i}){super({breadcrumbs:r,context:t}),this.operation=n,this.baseDir=i}convert(){let t=io(this.operation)?this.operation:{},r=t["x-codeSamples"],n=t["x-code-samples"],i=Array.isArray(r)?r:[],o=Array.isArray(n)?n:[],s=[...i,...o];if(s.length===0)return;let a=[];for(let c of s){if(!io(c))continue;let u=c,l=u.lang,p=u.label,d=u.source;if(typeof l!="string")continue;let f=cim(d,this.baseDir);f!=null&&a.push({name:typeof p=="string"?p:l,language:l,code:f,install:void 0,docs:void 0})}if(a.length!==0)return[{"code-samples":a}]}}});function uim(e){return io(e)&&typeof e.$ref=="string"}function lim(e,t){if(e!=null){if(typeof e=="string")return e;if(uim(e)){let r=(0,xOu.resolve)(t??process.cwd(),e.$ref);if((0,z5r.existsSync)(r))try{return(0,z5r.readFileSync)(r,"utf-8")}catch{return}}}}function pim(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){if(!io(n))continue;let o=lim(n.code,t);o!=null&&r.push({...n,code:o})}return r}var z5r,xOu,Q5r,COu=h(()=>{"use strict";wt();lo();Uo();z5r=require("fs"),xOu=require("path");Q5r=class extends Yo{operation;baseDir;key="x-fern-examples";constructor({context:t,breadcrumbs:r,operation:n,baseDir:i}){super({breadcrumbs:r,context:t}),this.operation=n,this.baseDir=i}convert(){let t=this.getExtensionValue(this.operation);return t==null?void 0:(Array.isArray(t)?t:[]).map(o=>{if(!io(o))return o;let a=o["code-samples"];if(a!=null){let c=pim(a,this.baseDir);return{...o,"code-samples":c}}return o}).filter(o=>{let s=Fd.serialization.ExampleEndpointCallSchema.parse(o);return s.ok||this.context.errorCollector.collect({message:`Failed to parse x-fern-example in ${this.breadcrumbs.join(".")}`,path:this.breadcrumbs}),s.ok})}}});var xUt,wOu=h(()=>{"use strict";Uo();xUt=class extends Yo{document;key="x-fern-explorer";constructor({breadcrumbs:t,document:r,context:n}){super({breadcrumbs:t,context:n}),this.document=r}convert(){let t=this.getExtensionValue(this.document);if(t!=null){if(typeof t!="boolean"){this.context.errorCollector.collect({message:"Received unexpected non-boolean value for x-fern-explorer",path:this.breadcrumbs});return}return t}}}});var CUt,SOu=h(()=>{"use strict";wt();_n();Uo();CUt=class extends wm.AbstractConverters.AbstractMediaTypeObjectConverter{responseBody;statusCode;streamingExtension;convertedResponseHeaders;constructor({context:t,breadcrumbs:r,responseBody:n,group:i,method:o,statusCode:s,streamingExtension:a}){super({context:t,breadcrumbs:r,group:i,method:o}),this.responseBody=n,this.statusCode=s,this.streamingExtension=a}convert(){if(parseInt(this.statusCode)===204){this.responseBody.content!=null&&Object.keys(this.responseBody.content).length>0&&this.context.errorCollector.collect({message:"A 204 (No Content) response declares a body, but a 204 response cannot include one. Ignoring the declared body and treating the success response as optional.",path:this.breadcrumbs});return}return this.shouldConvertAsStreaming()?this.convertStreamingResponseBody():this.convertNonStreamingResponseBody()}convertStreamingResponseBody(){if(this.streamingExtension!=null){if(this.streamingExtension.type=="streamCondition"){let t=this.streamingExtension.responseStream,r=this.streamingExtension.response,n=[...this.group,this.method,"Response",this.statusCode].join("_"),i=`${n}_streaming`,o=this.parseMediaTypeSchemaOrReference({schemaOrReference:t,schemaId:i}),s=this.parseMediaTypeSchemaOrReference({schemaOrReference:r,schemaId:n});return this.convertStreamConditionResponse({convertedStreamingSchema:o,convertedNonStreamingSchema:s})}if(this.streamingExtension.type==="stream"){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}),n=this.streamingExtension.format==="sse"?[...r.filter(i=>i.includes("text/event-stream")),...r.filter(i=>!i.includes("text/event-stream"))]:r;for(let i of n){let o=this.responseBody.content?.[i];if(o==null)continue;let s=this.parseMediaTypeObject({mediaTypeObject:o,schemaId:t,contentType:this.streamingExtension.format});if(s!=null)return this.convertStreamingResponse({mediaTypeObject:o,convertedSchema:s})}}}}convertNonStreamingResponseBody(){let t=[...this.group,this.method,"Response",this.statusCode].join("_"),r=Object.keys(this.responseBody.content??{}).filter(o=>o.includes("json"));for(let o of r){let s=this.responseBody.content?.[o];if(s==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:s,schemaId:t,contentType:o});if(a!=null&&this.shouldReturnJsonResponse(o))return this.returnJsonResponse({mediaTypeObject:s,convertedSchema:a})}let n=Object.keys(this.responseBody.content??{}).filter(o=>!o.includes("json"));for(let o of n){let s=this.responseBody.content?.[o];if(s==null)continue;let a=this.parseMediaTypeObject({mediaTypeObject:s,schemaId:t,contentType:o});if(a!=null){if(this.isBinarySchema(a))return this.shouldReturnBytesResponse()?this.returnBytesResponse({mediaTypeObject:s}):this.returnFileDownloadResponse({mediaTypeObject:s});if(this.shouldReturnTextResponse(o))return this.returnTextResponse({mediaTypeObject:s,contentType:o})}}let i=parseInt(this.statusCode);if(!isNaN(i)&&i>=200&&i<300&&i!==204){let o=r.map(c=>this.responseBody.content?.[c]).find(c=>c!=null),s={schema:{type:"object",description:"Empty response body"},...o?.examples!=null&&{examples:o.examples},...o?.example!=null&&{example:o.example}},a=this.parseMediaTypeObject({mediaTypeObject:s,schemaId:t,contentType:"application/json",resolveSchema:!0});if(a!=null)return this.returnJsonResponse({mediaTypeObject:s,convertedSchema:a})}}convertStreamConditionResponse({convertedStreamingSchema:t,convertedNonStreamingSchema:r}){if(t==null||r==null)return;let n=this.responseBody.description;return this.streamingExtension?.type==="streamCondition"&&this.streamingExtension.streamDescription!=null&&(n=this.streamingExtension.streamDescription),{responseBody:Cu.json(NE.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:r.schema?.typeDeclaration.v2Examples})),streamResponseBody:Cu.streaming(jI.json({docs:n,payload:t.type,terminator:this.streamingExtension?.terminator,v2Examples:t.schema?.typeDeclaration.v2Examples})),inlinedTypes:{...t.inlinedTypes,...r.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},headers:this.convertResponseHeaders().headers}}convertStreamingResponse({mediaTypeObject:t,convertedSchema:r}){if(this.streamingExtension==null)return;switch(this.streamingExtension.format){case"json":return{responseBody:Cu.streaming(jI.json({docs:this.responseBody.description,payload:r.type,terminator:this.streamingExtension?.terminator,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:{...r.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},examples:r.examples,headers:this.convertResponseHeaders().headers};case"sse":return{responseBody:Cu.streaming(jI.sse({docs:this.responseBody.description,payload:r.type,terminator:this.streamingExtension?.terminator,resumable:this.streamingExtension?.resumable,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:{...r.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},examples:r.examples,headers:this.convertResponseHeaders().headers};default:return}}returnJsonResponse({mediaTypeObject:t,convertedSchema:r}){return{responseBody:Cu.json(NE.response({responseBodyType:r.type,docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})})),streamResponseBody:void 0,inlinedTypes:{...r.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},examples:r.examples,headers:this.convertResponseHeaders().headers}}returnBytesResponse({mediaTypeObject:t}){return{responseBody:Cu.bytes({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:this.convertResponseHeaders().inlinedTypes,headers:this.convertResponseHeaders().headers}}returnFileDownloadResponse({mediaTypeObject:t}){return{responseBody:Cu.fileDownload({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"})}),streamResponseBody:void 0,inlinedTypes:this.convertResponseHeaders().inlinedTypes,headers:this.convertResponseHeaders().headers}}returnTextResponse({mediaTypeObject:t,contentType:r}){return{responseBody:Cu.text({docs:this.responseBody.description,v2Examples:this.convertMediaTypeObjectExamples({mediaTypeObject:t,generateOptionalProperties:!0,exampleGenerationStrategy:"response"}),contentType:Qp.parse(r)?.isPlainText()?void 0:r}),streamResponseBody:void 0,inlinedTypes:this.convertResponseHeaders().inlinedTypes,headers:this.convertResponseHeaders().headers}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}shouldConvertAsStreaming(){return this.streamingExtension!=null}shouldReturnJsonResponse(t){return t.includes("json")}shouldReturnBytesResponse(){return this.context.settings.useBytesForBinaryResponse&&this.streamingExtension==null}shouldReturnTextResponse(t){return Qp.parse(t)?.isText()??!1}convertResponseHeaders(){return this.convertedResponseHeaders??=Tit({context:this.context,breadcrumbs:this.breadcrumbs,headers:this.responseBody.headers}),this.convertedResponseHeaders}}});function TOu(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}var M5r,OOu=h(()=>{"use strict";_n();Uo();M5r=class extends wm.AbstractConverters.AbstractMediaTypeObjectConverter{responseError;statusCode;methodName;isWildcardStatusCode;convertedResponseHeaders;constructor({context:t,breadcrumbs:r,responseError:n,group:i,method:o,methodName:s,statusCode:a,isWildcardStatusCode:c}){super({context:t,breadcrumbs:r,group:i,method:o}),this.responseError=n,this.statusCode=a,this.methodName=s,this.isWildcardStatusCode=c}convert(){if(!this.responseError.content){let n=this.getErrorNameForStatusCode(this.statusCode,this.isWildcardStatusCode);if(n==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}let i=this.getErrorIdFromErrorName(n);return{error:{error:{name:this.context.casingsGenerator.generateName(i),fernFilepath:{allParts:[],packagePath:[],file:void 0},errorId:i},docs:this.responseError.description},errorType:Jr.unknown(),displayName:n,statusCode:this.statusCode,isWildcardStatusCode:this.isWildcardStatusCode,inlinedTypes:this.convertResponseHeaders().inlinedTypes,examples:{},headers:this.convertResponseHeaders().headers}}let t=Object.keys(this.responseError.content).filter(n=>n.includes("json")),r=this.getErrorNameForStatusCode(this.statusCode,this.isWildcardStatusCode);if(r==null){this.context.logger.warn(`No error name found for status code ${this.statusCode}`);return}for(let n of[...t]){let i=this.responseError.content?.[n];if(i==null)continue;let o=this.parseMediaTypeObject({mediaTypeObject:i,schemaId:TOu(`${this.methodName}Request${r}`),contentType:n});if(o==null)continue;let s=this.getErrorIdFromErrorName(r);if(o.schema!=null)return this.constructErrorConverterOutput({errorName:r,errorId:s,fernFilepath:o.schema.typeDeclaration.name.fernFilepath,convertedSchema:o,mediaTypeObject:i});if(o.type.type==="named")return this.constructErrorConverterOutput({errorName:r,errorId:s,fernFilepath:o.type.fernFilepath,convertedSchema:o,mediaTypeObject:i})}}constructErrorConverterOutput({errorName:t,errorId:r,fernFilepath:n,convertedSchema:i,mediaTypeObject:o}){return{error:{error:{name:this.context.casingsGenerator.generateName(r),fernFilepath:n,errorId:r},docs:this.responseError.description},errorType:i.type,displayName:t,statusCode:this.statusCode,isWildcardStatusCode:this.isWildcardStatusCode,inlinedTypes:{...i.inlinedTypes,...this.convertResponseHeaders().inlinedTypes},examples:this.convertErrorExamples({mediaTypeObject:o}),headers:this.convertResponseHeaders().headers}}convertErrorExamples({mediaTypeObject:t}){let r=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:t,breadcrumbs:this.breadcrumbs,defaultExampleName:`${[...this.group,this.method].join("_")}_error_example`});if(r.length===0)return;let n=new Set,i={};for(let[o,s]of r){let a=this.context.resolveExampleWithValue(s),c=this.context.resolveExampleRecursively({example:s,breadcrumbs:this.breadcrumbs}),u=this.getIdForErrorExample({key:o,example:c,usedExampleNames:n});n.add(u),a!=null&&(i[u]=a)}return Object.keys(i).length>0?i:void 0}getIdForErrorExample({key:t,example:r,usedExampleNames:n}){if(this.context.isExampleWithSummary(r)){let i=r.summary;if(!n.has(i))return i;let o=`${i} (${t})`;return n.has(o)?t:o}return t}getErrorNameForStatusCode(t,r){if(r){if(t===400)return"ClientRequestError";if(t===500)return"ServerError"}return h5r[t]}getErrorIdFromErrorName(t){return this.context.enableUniqueErrorsPerEndpoint?TOu(`${this.methodName}Request${t}`):t}convertResponseHeaders(){return this.convertedResponseHeaders??=Tit({context:this.context,breadcrumbs:this.breadcrumbs,headers:this.responseError.headers}),this.convertedResponseHeaders}}});var L5r,POu=h(()=>{"use strict";lo();_n();tc();TW();Uo();Vi();vOu();COu();wOu();SOu();OOu();DNo();L5r=class e extends Bit{idempotent;subtitle;globalParameterIds;idToAuthScheme;topLevelServers;pathLevelServers;streamingExtension;static AUTHORIZATION_HEADER="Authorization";constructor({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s,idempotent:a,subtitle:c,globalParameterIds:u,idToAuthScheme:l,topLevelServers:p,pathLevelServers:d,streamingExtension:f}){super({context:t,breadcrumbs:r,operation:n,method:i,path:o,pathItemParameters:s}),this.idempotent=a,this.subtitle=c,this.globalParameterIds=u,this.idToAuthScheme=l,this.topLevelServers=p,this.pathLevelServers=d,this.streamingExtension=f}convert(){let t=this.convertHttpMethod();if(t==null)return;let{group:r,method:n}=this.computeGroupNameAndLocationFromExtensions()??this.computeGroupNameFromTagAndOperationId(),i=this.getGroupDisplayName(r),o=this.getGroupDescription(r),{headers:s,pathParameters:a,queryParameters:c}=this.convertParameters({breadcrumbs:[...this.breadcrumbs,"parameters"]}),u=this.collectQueryParameterAudiences({breadcrumbs:[...this.breadcrumbs,"parameters"]}),l=this.convertRequestBody({breadcrumbs:[...this.breadcrumbs,"requestBody"],group:r,method:n,streamingExtension:this.streamingExtension,queryParameters:c}),p=l?.[0]?.requestBody,d=l?.[0]?.streamRequestBody,f=l?.[0]?.inlinedPropertiesByAudience,m={requestBodies:l?.map(se=>se.requestBody)},g=this.convertResponseBody({breadcrumbs:[...this.breadcrumbs,"responses"],group:r,method:n,streamingExtension:this.streamingExtension}),A=g?.response,y=g?.streamResponse,E=g!=null?g.errors:[],x={},v=E.map(se=>se.error),C=M0(this.path),O=this.getEndpointBaseUrl(),D=this.getEndpointBaseUrls(),R=this.convertExamples({httpPath:C,httpMethod:t,baseUrl:O});if(Object.keys(R.examples).length===0&&Object.keys(R.streamExamples).length===0){let se=this.synthesizeEndpointExamplesFromNativeRequestBody({httpPath:C,httpMethod:t,baseUrl:O});if(se!=null)for(let[ae,Oe]of Object.entries(se))R.examples[ae]=Oe}if(Object.keys(R.examples).length===0&&Object.keys(R.streamExamples).length===0&&l!=null&&l.length>1){let se=this.synthesizeEndpointExamplesFromPerContentTypeRequestBodies({convertedRequestBodies:l,httpPath:C,httpMethod:t,baseUrl:O});if(se!=null)for(let[ae,Oe]of Object.entries(se))R.examples[ae]=Oe}let P=new Set(this.operation.security?.flatMap(se=>Object.keys(se))??[]),M=this.authSchemeToHeaders(Array.from(P));M.length>0&&s.push(...M);for(let se of E){let ae=se.error,Oe=se.errorType,Ie=ae.error.errorId,Fe=se.examples;x[Ie]={name:ae.error,displayName:se.displayName,discriminantValue:{name:ae.error.name,wireValue:Ie},type:Oe,statusCode:se.statusCode,isWildcardStatusCode:se.isWildcardStatusCode,docs:ae.docs,examples:[],v2Examples:{userSpecifiedExamples:Fe??{},autogeneratedExamples:{}},headers:se.headers}}let J=this.context.getAudiences({operation:this.operation,breadcrumbs:this.breadcrumbs})??[],$=new xUt({context:this.context,breadcrumbs:this.breadcrumbs,document:this.context.spec}).convert(),oe=new xUt({context:this.context,breadcrumbs:this.breadcrumbs,document:this.operation}).convert()??$,de={displayName:this.operation.summary,subtitle:this.subtitle,method:t,baseUrl:O,v2BaseUrls:D,path:C,pathParameters:a,queryParameters:c,headers:s.filter((se,ae,Oe)=>ae===Oe.findIndex(Ie=>nr(Ie.name)===nr(se.name))),responseHeaders:g?.responseHeaders,sdkRequest:void 0,errors:v,auth:this.computeEndpointAuth(),security:this.computeEndpointSecurity(),availability:this.context.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs}),userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:C,allPathParameters:a,pagination:void 0,transport:void 0,source:uD.openapi(),audiences:J,retries:void 0,globalParameters:this.globalParameterIds,apiPlayground:oe},we=this.context.namespace!=null?[this.context.namespace]:[],De=r?.map(se=>ti(se));return we.push(...De??[]),{audiences:J,group:r,groupDisplayName:i,groupDescription:o,errors:x,endpoint:{...de,id:`endpoint_${we.join("/")}.${n}`,name:this.context.casingsGenerator.generateName(n),requestBody:p,v2RequestBodies:m,response:A,docs:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:R.examples},v2Responses:{responses:g?.v2Responses}},streamEndpoint:y!=null&&y.body!=null?{...de,id:`endpoint_${we.join("/")}.${n}_stream`,name:this.context.casingsGenerator.generateName(`${n}_stream`),requestBody:d,v2RequestBodies:void 0,response:y,docs:this.streamingExtension?.type==="streamCondition"?this.streamingExtension.streamDescription??this.operation.description:this.operation.description,v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:R.streamExamples},v2Responses:{responses:[{statusCode:200,isWildcardStatusCode:void 0,body:y.body,docs:y.docs}]}}:void 0,inlinedTypes:this.inlinedTypes,servers:this.filterOutTopLevelServers(this.operation.servers??this.pathLevelServers??[]),inlinedRequestPropertiesByAudience:f,queryParametersByAudience:u}}collectQueryParameterAudiences({breadcrumbs:t}){let r=this.mergeParameters(this.pathItemParameters,this.operation.parameters??[]);if(r.length===0)return;let n={},i=!1;for(let o of r){let s=this.context.resolveMaybeReference({schemaOrReference:o,breadcrumbs:t,skipErrorCollector:!0});if(s==null||s.in!=="query")continue;let a=this.context.getAudiences({operation:s,breadcrumbs:t})??[];if(a.length!==0){i=!0;for(let c of a)n[c]==null&&(n[c]=new Set),n[c].add(s.name)}}return i?n:void 0}convertResponseBody({breadcrumbs:t,group:r,method:n,streamingExtension:i}){if(this.operation.responses==null)return;let o,s=!1,a=!1;for(let[c,u]of Object.entries(this.operation.responses)){let l=/^[45]XX$/i.test(c),p,d=!1;if(l)p=parseInt(c.charAt(0))*100,d=!0;else{if(p=parseInt(c),isNaN(p)||p<200||p>=300&&p<400)continue;d=p>=400&&p<600}if(o==null&&(o={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{},responseHeaders:[]}),p>=200&&p<300){let f=this.context.resolveMaybeReference({schemaOrReference:u,breadcrumbs:[...t,c]});if(f==null)continue;let g=new CUt({context:this.context,breadcrumbs:[...t,c],responseBody:f,group:r??[],method:n,statusCode:c,streamingExtension:i}).convert();if(g==null){a=!0,o.response==null&&(o.response={statusCode:p,isWildcardStatusCode:l?!0:void 0,body:void 0,docs:f.description});continue}g!=null&&(this.inlinedTypes={...this.inlinedTypes,...g.inlinedTypes},s||(s=!0,o.response={statusCode:p,isWildcardStatusCode:l?!0:void 0,body:g.responseBody,docs:f.description},o.streamResponse={statusCode:p,isWildcardStatusCode:l?!0:void 0,body:g.streamResponseBody,docs:f.description},g.headers!=null&&(o.responseHeaders=g.headers)),o.v2Responses=[...o.v2Responses??[],{statusCode:p,isWildcardStatusCode:l?!0:void 0,body:g.responseBody,docs:f.description}])}if(d){let f=this.context.resolveMaybeReference({schemaOrReference:u,breadcrumbs:[...t,c]});if(f==null)continue;let g=new M5r({context:this.context,breadcrumbs:[...t,c],responseError:f,group:r??[],method:n,methodName:this.evaluateMethodNameFromOperation(),statusCode:p,isWildcardStatusCode:l?!0:void 0}).convert();g!=null&&(this.inlinedTypes={...this.inlinedTypes,...g.inlinedTypes},o.errors.push(g))}}if(this.streamingExtension!=null){o==null&&(o={response:void 0,v2Responses:void 0,streamResponse:void 0,errors:[],examples:{},responseHeaders:[]});let u=new CUt({context:this.context,breadcrumbs:[...t,"stream"],responseBody:{description:""},group:r??[],method:n,statusCode:"stream",streamingExtension:i}).convert();u!=null&&(this.inlinedTypes={...this.inlinedTypes,...u.inlinedTypes},o.response={statusCode:200,isWildcardStatusCode:void 0,body:u.responseBody,docs:void 0},o.streamResponse={statusCode:200,isWildcardStatusCode:void 0,body:u.streamResponseBody,docs:void 0},o.v2Responses=[{statusCode:200,isWildcardStatusCode:void 0,body:u.responseBody,docs:void 0}])}if(a&&s&&o?.response?.body!=null){let c=o.response.body;if(c.type==="json"&&c.value.type==="response"){let u=c.value.responseBodyType;(u.type!=="container"||u.container.type!=="optional")&&(o.response={...o.response,body:Cu.json(NE.response({...c.value,responseBodyType:Jr.container(gs.optional(u))}))})}}return o}computeEndpointAuth(){return this.operation.security!=null&&this.operation.security.length===0?!1:this.operation.security!=null&&this.operation.security.length>0?!0:this.context.spec.security!=null&&this.context.spec.security.length>0||this.shouldApplyDefaultAuthOverrides()}computeEndpointSecurity(){return this.operation.security!=null&&this.operation.security.length===0?[]:this.context.authOverrides?.auth!=null&&!this.usesEndpointSecurity()?this.getDefaultSecurityFromAuthOverrides():CNo(this.operation.security??this.context.spec.security)}usesEndpointSecurity(){let t=this.context.authOverrides?.auth;return t!=null&&HJe(t)}shouldApplyDefaultAuthOverrides(){if(!this.context.authOverrides?.auth||this.usesEndpointSecurity())return!1;let t=this.context.spec.security!=null&&this.context.spec.security.length>0,r=this.operation.security!=null&&this.operation.security.length>0;return!(t||r)}getDefaultSecurityFromAuthOverrides(){if(!this.context.authOverrides?.auth)return;let t=this.context.authOverrides.auth;if(typeof t=="string"){let r={};return r[t]=[],[r]}if(typeof t=="object"&&"any"in t){let r=t.any;if(Array.isArray(r))return r.map(n=>{let i=typeof n=="string"?n:n.scheme,o={};return o[i]=[],o})}}authSchemeToHeaders(t){let r=[];for(let n of t){let i=this.idToAuthScheme?.[n];if(i==null)continue;let o={valueType:Ji.STRING,availability:void 0,docs:void 0,env:void 0,v2Examples:void 0,clientDefault:void 0,defaultValue:void 0};switch(i.type){case"bearer":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...o});break;case"basic":r.push({name:{name:this.context.casingsGenerator.generateName(e.AUTHORIZATION_HEADER),wireValue:e.AUTHORIZATION_HEADER},...o});break;case"header":r.push({name:i.name,...o});break}}return r}convertExamples({httpPath:t,httpMethod:r,baseUrl:n}){let o=new Q5r({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert()??[],a=new N5r({context:this.context,breadcrumbs:this.breadcrumbs,operation:this.operation,baseDir:this.context.documentBaseDir}).convert()??[],u=o.some(l=>Array.isArray(l["code-samples"])&&l["code-samples"].length>0)?o:[...o,...a];return u.length===0?{examples:{},streamExamples:{}}:this.streamingExtension?.type==="streamCondition"?this.convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:u}):{examples:this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:u}),streamExamples:{}}}synthesizeEndpointExamplesFromNativeRequestBody({httpPath:t,httpMethod:r,baseUrl:n}){if(this.operation.requestBody==null)return;let i=this.context.resolveMaybeReference({schemaOrReference:this.operation.requestBody,breadcrumbs:[...this.breadcrumbs,"requestBody"]});if(i==null)return;let o=this.extractNativeResponseExample(),s={};for(let[,a]of Object.entries(i.content)){if(a.schema!=null)continue;let c=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:a,breadcrumbs:[...this.breadcrumbs,"requestBody"],defaultExampleName:"Example"});for(let[u,l]of c){let p=this.context.resolveExampleWithValue(l);p!=null&&(s[u]={displayName:void 0,contentType:void 0,request:{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,{})},baseUrl:void 0,environment:n,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:p},response:o,codeSamples:void 0})}}return Object.keys(s).length>0?s:void 0}extractNativeResponseExample(){if(this.operation.responses!=null)for(let[t,r]of Object.entries(this.operation.responses)){let n=parseInt(t);if(isNaN(n)||n<200||n>=300)continue;let i=this.context.resolveMaybeReference({schemaOrReference:r,breadcrumbs:[...this.breadcrumbs,"responses",t]});if(i?.content!=null)for(let[,o]of Object.entries(i.content)){let s=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:o,breadcrumbs:[...this.breadcrumbs,"responses",t],defaultExampleName:"Example"});for(let[,a]of s){let c=this.context.resolveExampleWithValue(a);if(c!=null)return{docs:void 0,statusCode:n,body:Ut.V2HttpEndpointResponseBody.json(c)}}}}}synthesizeEndpointExamplesFromPerContentTypeRequestBodies({convertedRequestBodies:t,httpPath:r,httpMethod:n,baseUrl:i}){let o={},s=this.extractNativeResponseExamplesByContentType();for(let a of t){let c=a.requestBody,u=c.contentType,l=c.v2Examples;if(l==null)continue;let p=l.userSpecifiedExamples;if(Object.keys(p).length===0)continue;let d=u!=null?s.get(u):void 0;for(let[f,m]of Object.entries(p)){let g=t.length>1&&u!=null?`${f} (${u})`:f;o[g]={displayName:t.length>1?g:void 0,contentType:u??void 0,request:{docs:void 0,endpoint:{method:n,path:this.buildExamplePath(r,{})},baseUrl:void 0,environment:i,auth:void 0,pathParameters:{},queryParameters:{},headers:{},requestBody:m},response:d??this.extractNativeResponseExample()??void 0,codeSamples:void 0}}}return Object.keys(o).length>0?o:void 0}extractNativeResponseExamplesByContentType(){let t=new Map;if(this.operation.responses==null)return t;for(let[r,n]of Object.entries(this.operation.responses)){let i=parseInt(r);if(isNaN(i)||i<200||i>=300)continue;let o=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:[...this.breadcrumbs,"responses",r]});if(o?.content!=null)for(let[s,a]of Object.entries(o.content)){if(t.has(s))continue;let c=this.context.getNamedExamplesFromMediaTypeObject({mediaTypeObject:a,breadcrumbs:[...this.breadcrumbs,"responses",r],defaultExampleName:"Example"});for(let[,u]of c){let l=this.context.resolveExampleWithValue(u);if(l!=null){t.set(s,{docs:void 0,statusCode:i,body:Ut.V2HttpEndpointResponseBody.json(l)});break}}}}return t}convertStreamConditionExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:i}){let o=i.filter(u=>!(u.response!=null&&"stream"in u.response)),s=i.filter(u=>u.response!=null&&"stream"in u.response),a=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:o}),c=this.convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:s});return{examples:a,streamExamples:c}}convertEndpointExamples({httpPath:t,httpMethod:r,baseUrl:n,fernExamples:i}){return Object.fromEntries(i.map((o,s)=>[this.getExampleName({example:o,exampleIndex:s}),{displayName:void 0,contentType:void 0,request:o.request!=null||o["path-parameters"]!=null||o["query-parameters"]!=null||o.headers!=null?{docs:void 0,endpoint:{method:r,path:this.buildExamplePath(t,o["path-parameters"]??{})},baseUrl:void 0,environment:n,auth:void 0,pathParameters:o["path-parameters"]??{},queryParameters:o["query-parameters"]??{},headers:o.headers??{},requestBody:o.request??void 0}:void 0,response:o.response!=null?{docs:void 0,statusCode:void 0,body:this.getExampleResponseBody({example:o})}:void 0,codeSamples:o["code-samples"]?.map(a=>{let c=("language"in a?a.language:a.sdk)??void 0;return{name:a.name,docs:void 0,language:c,code:a.code}})}]))}getExampleName({example:t,exampleIndex:r}){return t.name??t["code-samples"]?.[0]?.name??`Example_${r}`}getExampleResponseBody({example:t}){if(t.response!=null){if("stream"in t.response)return Ut.V2HttpEndpointResponseBody.stream(t.response.stream);if("body"in t.response)return Ut.V2HttpEndpointResponseBody.json(t.response.body)}}getEndpointBaseUrl(){let r=new ux.ServerFromOperationNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert();if(r!=null)return this.context.logger.debug(`[getEndpointBaseUrl] Endpoint ${this.method.toUpperCase()} ${this.path} specifies a server with "${mn.SERVER_NAME_V2}" extension. Returning server type: ${r}`),r;let n=this.operation.servers?.[0]??this.pathLevelServers?.[0];if(n==null)return;let o=this.topLevelServers?.find(s=>s.url===n.url)??n;return C3.getServerName({server:o,context:this.context})}getEndpointBaseUrls(){if(new ux.ServerFromOperationNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation,context:this.context}).convert()!=null)return;let n=this.operation.servers??this.pathLevelServers;return n?.map(o=>{let a=this.topLevelServers?.find(c=>c.url===o.url)??o;return C3.getServerName({server:a,context:this.context})})}buildExamplePath(t,r){return t.head+t.parts.map(n=>`${r[n.pathParameter]?.toString()??n.pathParameter}${n.tail}`).join("")}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers?.some(n=>n.url===r.url))}getGroupDisplayName(t){let r=this.operation.tags?.[0];r!=null&&(r=this.context.getDisplayNameForTag(r));let n=t?.[t.length-1];if(n!=null&&r!=null)return r.toLowerCase().replaceAll(" ","")===n?r:void 0}getGroupDescription(t){let r=this.operation.tags?.[0],n=t?.[t.length-1];if(!(r==null||n==null)&&ti(r)===ti(n))return this.context.getDescriptionForTag(r)}}});var jNo,V5r,BOu=h(()=>{"use strict";Uo();jNo=be(Qjt(),1);dOu();mOu();hOu();AOu();yOu();bOu();EOu();POu();RNo();V5r=class extends Ji{pathItem;path;idToAuthScheme;topLevelServers;declaredGlobalParameterIds;constructor({context:t,breadcrumbs:r,pathItem:n,path:i,idToAuthScheme:o,topLevelServers:s,declaredGlobalParameterIds:a}){super({context:t,breadcrumbs:r}),this.pathItem=n,this.path=i,this.idToAuthScheme=o,this.topLevelServers=s,this.declaredGlobalParameterIds=a}convert(){let t=[],r=[],n={};for(let i of fOu){let o=this.pathItem[i];if(o==null)continue;let s=[...this.breadcrumbs,i],a=this.tryParseAsWebhook({operationBreadcrumbs:s,operation:o,method:i,context:this.context});if(a!=null){r.push(a),Object.assign(n,a.inlinedTypes);continue}let u=new R5r({breadcrumbs:s,document:this.context.spec,operation:o,context:this.context}).convert();u==null&&this.operationHasTextEventStreamResponse(o)&&(u={type:"stream",format:"sse",terminator:void 0,resumable:NNo(this.context.spec)??!1});let l=this.tryParseAsHttpEndpoint({operationBreadcrumbs:s,operation:o,method:i,streamingExtension:u});l!=null&&(t.push(l),Object.assign(n,l.inlinedTypes))}return{endpoints:t,webhooks:r,inlinedTypes:n}}tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:n,context:i}){return new F5r({breadcrumbs:n,operation:t,context:i}).convert()?new Dit({context:this.context,breadcrumbs:n,operation:t,method:jNo.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,pathItemParameters:this.pathItem.parameters}).convert():void 0}operationHasTextEventStreamResponse(t){if(t.responses==null)return!1;for(let[r,n]of Object.entries(t.responses)){let i=parseInt(r);if(isNaN(i)||i<200||i>=300)continue;let o=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:this.breadcrumbs});if(o?.content==null)continue;let s=Object.keys(o.content);if(s.length===1&&s[0]?.includes("text/event-stream"))return!0}return!1}tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:n,streamingExtension:i}){new D5r({breadcrumbs:n,operation:t,document:this.context.spec,context:this.context}).convert()!=null;let c=new B5r({breadcrumbs:n,operation:t,context:this.context}).convert(),l=new k5r({breadcrumbs:n,operation:t,context:this.context}).convert(),d=new P5r({breadcrumbs:n,operation:t,context:this.context}).convert();if(d!=null&&this.declaredGlobalParameterIds!=null){let m=[];for(let g of d)this.declaredGlobalParameterIds.has(g)?m.push(g):this.context.errorCollector.collect({message:`x-fern-global-parameter references undeclared global parameter '${g}'. Declared parameters: ${[...this.declaredGlobalParameterIds].join(", ")}`,path:[...n,"x-fern-global-parameter"]});d=m.length>0?m:void 0}return new L5r({context:this.context,breadcrumbs:n,operation:t,method:jNo.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,pathItemParameters:this.pathItem.parameters,idempotent:c,subtitle:l,globalParameterIds:d,idToAuthScheme:this.idToAuthScheme,topLevelServers:this.topLevelServers,pathLevelServers:this.pathItem.servers,streamingExtension:i}).convert()}}});var U5r,DOu=h(()=>{"use strict";_n();Uo();U5r=class extends Ji{securityScheme;schemeId;constructor({context:t,breadcrumbs:r,securityScheme:n,schemeId:i}){super({context:t,breadcrumbs:r}),this.securityScheme=n,this.schemeId=i}getExtension(t){return this.securityScheme[t]}convert(){let t=this.getExtension("x-fern-playground-description");switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme?.toLowerCase()==="bearer"){let r=this.getExtension("x-fern-bearer"),n=r?.name??"token",i=r?.env,o=r?.placeholder;return Sp.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName(n),tokenEnvVar:i,tokenPlaceholder:o,docs:this.securityScheme.description,playgroundDocs:t})}if(this.securityScheme.scheme?.toLowerCase()==="basic"){let r=this.getExtension("x-fern-basic"),n=r?.username?.name??"username",i=r?.password?.name??"password",o=r?.username?.env,s=r?.password?.env,a=r?.username?.placeholder,c=r?.password?.placeholder;return Sp.basic({key:this.schemeId,username:this.context.casingsGenerator.generateName(n),password:this.context.casingsGenerator.generateName(i),usernameEnvVar:o,passwordEnvVar:s,usernameOmit:!1,passwordOmit:!1,usernamePlaceholder:a,passwordPlaceholder:c,docs:this.securityScheme.description,playgroundDocs:t})}break}case"apiKey":{if(this.securityScheme.in==="header"){let r=this.getExtension("x-fern-header"),n=r?.name??"apiKey",i=r?.env,o=r?.prefix,s=r?.placeholder;return Sp.header({key:this.schemeId,name:{name:this.context.casingsGenerator.generateName(n),wireValue:this.securityScheme.name},valueType:Ji.OPTIONAL_STRING,prefix:o,headerEnvVar:i,headerPlaceholder:s,docs:this.securityScheme.description,playgroundDocs:t})}break}case"oauth2":return Sp.bearer({key:this.schemeId,token:this.context.casingsGenerator.generateName("token"),tokenEnvVar:void 0,tokenPlaceholder:void 0,docs:this.securityScheme.description,playgroundDocs:t})}}}});function fim(e){if(e!=null){if(typeof e=="string")return w0.string(e);if(typeof e=="boolean")return w0.boolean(e)}}var ROu,wUt,kOu=h(()=>{"use strict";lo();_n();tc();TW();Uo();ROu=be(Qjt(),1);eOu();tOu();rOu();nOu();oOu();aOu();uOu();RNo();BOu();DOu();wUt=class extends kH{constructor({breadcrumbs:t,context:r,audiences:n}){super({breadcrumbs:t,context:r,audiences:n})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.context.spec=await this.resolveAllExternalRefs({spec:this.context.spec}),this.context.spec=zjt({document:this.context.spec,options:this.context.settings,logger:this.context.logger}),xNo({spec:this.context.spec,errorCollector:this.context.errorCollector}),this.overrideOpenApiAuthWithGeneratorsAuth(),this.convertSecuritySchemes(),this.convertGlobalHeaders(),this.convertGlobalParameters(),this.convertBasePath(),this.convertSchemas(),this.convertWebhooks();let{endpointLevelServers:t,errors:r}=this.convertPaths();this.addErrorsToIr(r);let{defaultUrl:n}=this.convertServers({endpointLevelServers:t});this.updateEndpointsWithDefaultUrl(n);let i=this.context.spec.info?.title?.trim();return i&&i!=='""'&&(this.ir.apiDisplayName=i),this.finalizeIr()}convertGlobalHeaders(){if(this.context.globalHeaderOverrides){let n=iOu({globalHeaderOverrides:this.context.globalHeaderOverrides,context:this.context});this.addGlobalHeadersToIr(n),this.context.setGlobalHeaders(n);return}let r=new w5r({breadcrumbs:["x-fern-global-headers"],document:this.context.spec,context:this.context}).convert();if(r!=null){let n=sOu({globalHeaders:r,context:this.context});this.addGlobalHeadersToIr(n),this.context.setGlobalHeaders(n)}}convertGlobalParameters(){let r=new S5r({breadcrumbs:["x-fern-global-parameters"],document:this.context.spec,context:this.context}).convert();if(r!=null){let n=cOu({globalParameters:r,context:this.context});if(this.ir.globalParameters=n,this.ir.headers.length>0){let i=new Set(this.ir.headers.map(o=>{let s=o.name;return(typeof s=="string"?s:s.wireValue).toLowerCase()}));for(let o of r){let s=(o.target??o.name).toLowerCase();o.in==="header"&&i.has(s)&&this.context.logger.warn(`Global parameter "${o.name}" (in: header, target: "${o.target??o.name}") overlaps with an x-fern-global-headers entry. The x-fern-global-parameters definition takes precedence.`)}}}}convertBasePath(){let r=new x5r({breadcrumbs:["x-fern-base-path"],document:this.context.spec,context:this.context}).convert();if(r!=null){this.ir.basePath=M0(r.path);for(let n of r.parameters)n.type!=="string"&&this.context.errorCollector.collect({message:`x-fern-base-path parameter '${n.name}' uses type '${n.type}' which is not yet supported; treating as string`,path:["x-fern-base-path","parameters",n.name]}),this.ir.pathParameters.push({name:this.context.casingsGenerator.generateName(n.name),valueType:Ji.STRING,docs:n.docs,location:Ut.PathParameterLocation.Root,variable:void 0,clientDefault:fim(n.default),v2Examples:{userSpecifiedExamples:{},autogeneratedExamples:{}},explode:void 0});if(r.pathsIncludeBasePath){let n=jjt({openApi:this.context.spec,basePath:r.path,rootPathParameterNames:new Set(r.parameters.map(i=>i.name))});for(let i of n)this.context.errorCollector.collect({message:i,path:["x-fern-base-path","paths-include-base-path"]})}}}convertSecuritySchemes(){let t=this.convertOpenApiSecuritySchemes();if(this.context.authOverrides){let r=new Map(t.map(n=>[n.key,n.docs]));this.convertAuthOverrides(r,this.context.authOverrides);return}t.length>0&&this.addAuthToIR({requirement:t.length===1?"ALL":"ANY",schemes:t,docs:void 0})}convertAuthOverrides(t,r){let n={...r,"auth-schemes":Object.fromEntries(Object.entries(r["auth-schemes"]??{}).map(([o,s])=>[o,{...s}]))};for(let[o,s]of Object.entries(n["auth-schemes"]))!s.docs&&t.has(o)&&(s.docs=t.get(o));let i=R3t({rawApiFileSchema:n,casingsGenerator:this.context.casingsGenerator});this.addAuthToIR({requirement:i.requirement,schemes:i.schemes,docs:i.docs})}convertOpenApiSecuritySchemes(){let t=[];for(let[r,n]of Object.entries(this.context.spec.components?.securitySchemes??{})){let i=this.context.resolveMaybeReference({schemaOrReference:n,breadcrumbs:["components","securitySchemes",r]});if(i==null)continue;let s=new U5r({context:this.context,breadcrumbs:["components","securitySchemes",r],securityScheme:i,schemeId:r}).convert();s!=null&&t.push(s)}return t}convertServers({endpointLevelServers:t}){let n=new C5r({breadcrumbs:["x-fern-base-url-env"],document:this.context.spec,context:this.context}).convert();if(this.context.environmentOverrides){let s=k3t({rawApiFileSchema:this.context.environmentOverrides,casingsGenerator:this.context.casingsGenerator});return s!=null&&this.addEnvironmentsToIr({environmentConfig:{...s.environmentsConfig,baseUrlEnvVar:s.environmentsConfig.baseUrlEnvVar??n},audiences:s.audiences}),{defaultUrl:this.context.environmentOverrides["default-url"]}}let o=new C3({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t,baseUrlEnvVar:n}).convert();return this.addEnvironmentsToIr({environmentConfig:o?.value}),{defaultUrl:o?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let i=new wm.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();i!=null&&this.addSchemaOutputToIr(t,i)}}convertWebhooks(){for(let[t,r]of Object.entries(this.context.spec.webhooks??{})){if(r==null){this.context.errorCollector.collect({message:"Skipping empty webhook",path:this.breadcrumbs});continue}if(!("post"in r)||r.post==null){this.context.errorCollector.collect({message:"Skipping webhook as it is not a POST method",path:this.breadcrumbs});continue}let n=r.post.operationId??t,i=r.post.operationId!=null?r.post:{...r.post,operationId:n},s=new Dit({context:this.context,breadcrumbs:["webhooks",n],operation:i,method:ROu.OpenAPIV3.HttpMethods.POST,path:n}).convert();s!=null&&(this.addWebhookToIr({webhook:s.webhook,operationId:n,audiences:s.audiences,group:s.group,inlinedPayloadPropertiesByAudience:s.inlinedPayloadPropertiesByAudience}),this.addTypesToIr(s.inlinedTypes))}}convertPaths(){let t=[],r={},n=this.ir.globalParameters!=null?new Set(this.ir.globalParameters.map(i=>i.id)):void 0;for(let[i,o]of Object.entries(this.context.spec.paths??{})){if(o==null)continue;let a=new V5r({context:this.context,breadcrumbs:["paths",i],topLevelServers:this.context.spec.servers,pathItem:o,path:i,declaredGlobalParameterIds:n}).convert();if(a!=null){for(let c of a.endpoints){if(c.streamEndpoint!=null&&this.addEndpointToIr({endpoint:c.streamEndpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName,endpointGroupDescription:c.groupDescription,inlinedRequestPropertiesByAudience:c.inlinedRequestPropertiesByAudience,queryParametersByAudience:c.queryParametersByAudience}),this.addEndpointToIr({endpoint:c.endpoint,audiences:c.audiences,endpointGroup:c.group,endpointGroupDisplayName:c.groupDisplayName,endpointGroupDescription:c.groupDescription,inlinedRequestPropertiesByAudience:c.inlinedRequestPropertiesByAudience,queryParametersByAudience:c.queryParametersByAudience}),c.servers)for(let u of c.servers)this.shouldAddServerToCollectedServers({server:u,currentServers:t})&&t.push(u);if(c.errors)for(let[u,l]of Object.entries(c.errors))r[u]=l}for(let c of a.webhooks){let u=this.context.getGroup({groupParts:c.group,namespace:this.context.namespace});this.addWebhookToIr({webhook:c.webhook,operationId:u.join("."),group:u,audiences:c.audiences,inlinedPayloadPropertiesByAudience:c.inlinedPayloadPropertiesByAudience})}this.addTypesToIr(a.inlinedTypes)}}return{endpointLevelServers:t,errors:r}}overrideOpenApiAuthWithGeneratorsAuth(){if(!this.context.authOverrides?.["auth-schemes"])return;let t=this.context.authOverrides.auth;if(t!=null&&HJe(t))return;let r={};for(let n of Object.keys(this.context.authOverrides["auth-schemes"]))r[n]=[];this.context.spec.security=[r],this.removeEndpointSpecificAuth()}removeEndpointSpecificAuth(){if(this.context.spec.paths)for(let t of Object.values(this.context.spec.paths)){if(!t)continue;let r=["get","post","put","patch","delete","options","head","trace"];for(let n of r){let i=t[n];i?.security!=null&&i.security.length>0&&delete i.security}}}}});var _5r,FOu=h(()=>{"use strict";Uo();_5r=class extends Yo{tag;key="x-displayName";constructor({breadcrumbs:t,tag:r,context:n}){super({breadcrumbs:t,context:n}),this.tag=r}convert(){if(typeof this.tag!="object"||this.tag==null)return;let t=this.tag[this.key];if(t!=null){if(typeof t!="string"){this.context.errorCollector.collect({message:"x-displayName extension must be a string",path:this.breadcrumbs});return}if(t.trim().length!==0)return{displayName:t}}}}});var ode,NOu=h(()=>{"use strict";_n();tc();Uo();FOu();ode=class extends Wb{globalHeaderNames;tagToDisplayName={};tagToDescription=new Map;tagDescriptionsIndexed=!1;isReferenceObject(t){return t!=null&&typeof t=="object"&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let o=this.getTypeIdFromSchemaReference(t);if(o==null)return{ok:!1};let s=t.$ref.split("/").pop()??o,a=this.resolveReference({reference:t,breadcrumbs:r});if(!a.resolved)return{ok:!1};let c;i==="reference_identifier"?c=n??a.value.title:i==="discriminator_key"?c=a.value.title??n:c=a.value.title??s;let u;if(o.includes("/")){let p=new wm.SchemaConverters.SchemaConverter({context:this,breadcrumbs:r??[],schema:a.value,id:o}).convert();p!=null&&(u={[o]:p.convertedSchema})}return{ok:!0,reference:Jr.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(s),typeId:o,default:void 0,inline:!1,displayName:c}),inlinedTypes:u}}setGlobalHeaders(t){this.globalHeaderNames=t.map(r=>nr(r.name))}getDisplayNameForTag(t){if(Object.keys(this.tagToDisplayName).length===0)for(let r of this.spec.tags??[]){let i=new _5r({breadcrumbs:["tags",r.name],tag:r,context:this}).convert()?.displayName??r.name;this.tagToDisplayName[r.name]=i}return this.tagToDisplayName[t]??t}getDescriptionForTag(t){if(!this.tagDescriptionsIndexed){this.tagDescriptionsIndexed=!0;for(let r of this.spec.tags??[])r.description!=null&&r.description.trim().length>0&&this.tagToDescription.set(r.name,r.description)}return this.tagToDescription.get(t)}}});function zNo({ir:e,authOverrides:t}){if(!t["auth-schemes"]||!e.auth)return e;let r=t["auth-schemes"],n=[];for(let i of e.auth.schemes){if(i.type!=="bearer"){n.push(i);continue}let o=r[i.key];if(o==null){n.push(i);continue}let s=vle(o,{header:()=>{},basic:()=>{},tokenBearer:()=>{},inferredBearer:()=>{},oauth:a=>mim({ir:e,key:i.key,oauthScheme:a})});n.push(s??i)}return{...e,auth:{...e.auth,schemes:n}}}function mim({ir:e,key:t,oauthScheme:r}){if(r.type!=="client-credentials")return;let n=r["get-token"];if(n==null)return;let i=jOu({ir:e,endpointRef:n.endpoint});if(i==null)return;let{endpoint:o,serviceId:s,subpackageId:a}=i,c=n["request-properties"],u=n["response-properties"],l=QNo({ir:e,endpoint:o,wireValue:jH(c?.["client-id"],"client_id")}),p=QNo({ir:e,endpoint:o,wireValue:jH(c?.["client-secret"],"client_secret")}),d=Rit({ir:e,endpoint:o,wireValue:jH(u?.["access-token"],"access_token")});if(!(l==null||p==null||d==null))return Sp.oauth({key:t,docs:r.docs,playgroundDocs:r["playground-docs"],configuration:aD.clientCredentials({clientIdEnvVar:r["client-id-env"],clientSecretEnvVar:r["client-secret-env"],tokenPrefix:r["token-prefix"],tokenHeader:r["token-header"],scopes:r.scopes,tokenEndpoint:{endpointReference:{endpointId:o.id,serviceId:s,subpackageId:a},requestProperties:{clientId:l,clientSecret:p,scopes:void 0,customProperties:Aim({ir:e,endpoint:o,excludeWireValues:[jH(c?.["client-id"],"client_id"),jH(c?.["client-secret"],"client_secret")]})},responseProperties:{accessToken:d,expiresIn:Rit({ir:e,endpoint:o,wireValue:jH(u?.["expires-in"],"expires_in")}),refreshToken:Rit({ir:e,endpoint:o,wireValue:jH(u?.["refresh-token"],"refresh_token")})}},refreshEndpoint:r["refresh-token"]!=null?him({ir:e,refreshTokenConfig:r["refresh-token"]}):void 0})})}function him({ir:e,refreshTokenConfig:t}){let r=jOu({ir:e,endpointRef:t.endpoint});if(r==null)return;let{endpoint:n,serviceId:i,subpackageId:o}=r,s=t["request-properties"],a=t["response-properties"],c=QNo({ir:e,endpoint:n,wireValue:jH(s?.["refresh-token"],"refresh_token")}),u=Rit({ir:e,endpoint:n,wireValue:jH(a?.["access-token"],"access_token")});if(!(c==null||u==null))return{endpointReference:{endpointId:n.id,serviceId:i,subpackageId:o},requestProperties:{refreshToken:c},responseProperties:{accessToken:u,expiresIn:Rit({ir:e,endpoint:n,wireValue:jH(a?.["expires-in"],"expires_in")}),refreshToken:Rit({ir:e,endpoint:n,wireValue:jH(a?.["refresh-token"],"refresh_token")})}}}function jOu({ir:e,endpointRef:t}){let r=t.trim().split(/\s+/);if(r.length!==2)return;let n=dim[r[0]?.toUpperCase()??""],i=r[1]?.replace(/\/+$/,"");if(!(n==null||i==null))for(let[o,s]of Object.entries(e.services))for(let a of s.endpoints){if(a.method!==n)continue;if(gim(a.fullPath)===i){let u=Object.entries(e.subpackages).find(([,l])=>l.service===o)?.[0];return{endpoint:a,serviceId:o,subpackageId:u}}}}function gim(e){let t=e.head;for(let r of e.parts)t+=`{${r.pathParameter}}${r.tail}`;return t.replace(/\/+$/,"")}function jH(e,t){return e==null?t:e.match(/^\$(?:request|response)\.(.+)$/)?.[1]??e}function QOu(e,t){return e.find(r=>nr(r.name)===t)}function MNo(e,t){let r=e.types[t];if(r?.shape.type==="object")return r.shape.properties}function QNo({ir:e,endpoint:t,wireValue:r}){if(t.requestBody==null)return;let n;t.requestBody.type==="inlinedRequestBody"?n=t.requestBody.properties.map(o=>({...o,xml:void 0})):t.requestBody.type==="reference"&&t.requestBody.requestBodyType.type==="named"&&(n=MNo(e,t.requestBody.requestBodyType.typeId));let i=n!=null?QOu(n,r):void 0;if(i!=null)return{propertyPath:void 0,property:oP.body({...i})}}function Aim({ir:e,endpoint:t,excludeWireValues:r}){if(t.requestBody==null)return;let n;if(t.requestBody.type==="inlinedRequestBody"?n=t.requestBody.properties.map(s=>({...s,xml:void 0})):t.requestBody.type==="reference"&&t.requestBody.requestBodyType.type==="named"&&(n=MNo(e,t.requestBody.requestBodyType.typeId)),n==null)return;let i=new Set(r),o=n.filter(s=>!i.has(nr(s.name))).map(s=>({propertyPath:void 0,property:oP.body({...s})}));return o.length>0?o:void 0}function Rit({ir:e,endpoint:t,wireValue:r}){if(t.response?.body?.type!=="json")return;let n=t.response.body.value.responseBodyType;if(n.type!=="named")return;let i=MNo(e,n.typeId),o=i!=null?QOu(i,r):void 0;if(o!=null)return{propertyPath:void 0,property:o}}var dim,zOu=h(()=>{"use strict";lo();_n();tc();dim={GET:am.Get,POST:am.Post,PUT:am.Put,PATCH:am.Patch,DELETE:am.Delete}});var G5r=h(()=>{"use strict";kOu();NOu();zOu()});var yim,bim,Eim,q5r,MOu=h(()=>{"use strict";wt();Uo();jn();yim=Be.object({description:Be.string().optional(),required:Be.boolean().optional(),deprecated:Be.boolean().optional(),allowEmptyValue:Be.boolean().optional(),style:Be.string().optional(),explode:Be.boolean().optional(),allowReserved:Be.boolean().optional(),schema:Be.any().optional(),example:Be.any().optional(),examples:Be.record(Be.string(),Be.any()).optional(),content:Be.record(Be.string(),Be.any()).optional()}),bim=yim.extend({name:Be.string(),in:Be.string()}),Eim=Be.array(bim),q5r=class extends Yo{operation;key="x-fern-parameters";constructor({breadcrumbs:t,operation:r,context:n}){super({breadcrumbs:t,context:n}),this.operation=r}convert(){let t=this.getExtensionValue(this.operation);if(t!=null)try{return Eim.parse(t)}catch(r){this.context.errorCollector.collect({message:`Failed to parse x-fern-parameters extension: ${Fn(r)}`,path:this.breadcrumbs});return}}}});var W5r,LOu=h(()=>{"use strict";_n();tc();Uo();W5r=class extends Ji{method;pathParameters;queryParameters;headers;topLevelServers;constructor({context:t,breadcrumbs:r,method:n,pathParameters:i=[],queryParameters:o=[],headers:s=[],topLevelServers:a=[]}){super({context:t,breadcrumbs:r}),this.method=n,this.pathParameters=i,this.queryParameters=o,this.headers=s,this.topLevelServers=a}convert(){let t={},r="";for(let u of this.pathParameters)r+=`/{${zr(u.name)}}`;let n=M0(r),i=[];for(let[u,l]of this.method.params.entries()){let p;if(this.context.isReferenceObject(l)){let g=this.context.resolveReference({reference:l});if(g.resolved)p=g.value;else continue}else p=l;let d=[this.method.name,"Param",p.name].join("_"),m=new wm.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"Param",p.name],schemaIdOverride:d,context:this.context,schemaOrReference:p.schema,wrapAsOptional:!p.required}).convert();m!=null&&(i.push({docs:p.description,availability:this.context.getAvailability({node:l,breadcrumbs:[...this.breadcrumbs,"parameters"]}),name:this.context.casingsGenerator.generateNameAndWireValue({name:p.name,wireValue:p.name}),valueType:m.type,defaultValue:p.schema!=null&&typeof p.schema=="object"?p.schema.default:void 0,v2Examples:m.schema?.typeDeclaration.v2Examples,propertyAccess:void 0}),t={...m.inlinedTypes,...t,...m.schema!=null?{[d]:m.schema}:{}})}let o;if(this.method.result!=null){let u=this.context.resolveMaybeReference({schemaOrReference:this.method.result,breadcrumbs:[...this.breadcrumbs,"result"]});if(u!=null){let l=new wm.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[this.method.name,"result"],context:this.context,schemaOrReference:u.schema}),p=[this.method.name,"Result"].join("_"),d=l.convert();d!=null&&(o={docs:u.description,v2Examples:d.schema?.typeDeclaration.v2Examples,responseBodyType:d.type},t={...d.inlinedTypes,...t,...d.schema!=null?{[p]:d.schema}:{}})}}let s=this.getEndpointBaseUrls(),a=this.context.getAudiences({operation:this.method,breadcrumbs:this.breadcrumbs})??[];return{endpoint:{baseUrl:void 0,v2BaseUrls:s,basePath:void 0,auth:!1,security:void 0,method:"POST",id:this.method.name,docs:this.method.description,name:this.context.casingsGenerator.generateName(this.method.name),headers:this.headers,displayName:this.method.name,subtitle:void 0,pathParameters:this.pathParameters,queryParameters:this.queryParameters,allPathParameters:this.pathParameters,path:n,fullPath:n,requestBody:i.length>0?ad.inlinedRequestBody({name:this.context.casingsGenerator.generateName([this.method.name,"Request"].join("_")),docs:void 0,properties:i,extends:[],extendedProperties:[],contentType:"application/json",extraProperties:!1,v2Examples:void 0}):void 0,v2RequestBodies:void 0,sdkRequest:void 0,response:o!=null?{body:Cu.json(NE.response(o)),statusCode:void 0,isWildcardStatusCode:void 0,docs:o.docs}:void 0,v2Responses:void 0,errors:[],idempotent:!1,pagination:void 0,userSpecifiedExamples:[],autogeneratedExamples:[],v2Examples:{autogeneratedExamples:{},userSpecifiedExamples:this.convertExamples(r)},transport:void 0,availability:void 0,source:uD.openrpc(),audiences:a,retries:void 0,globalParameters:void 0,apiPlayground:void 0,responseHeaders:[]},audiences:a,inlinedTypes:t,servers:this.filterOutTopLevelServers(this.method.servers??[])}}filterOutTopLevelServers(t){return t.filter(r=>!this.topLevelServers.some(n=>n.url===r.url))}getEndpointBaseUrls(){let t=this.method.servers;return t?.map(n=>{if(this.topLevelServers.find(a=>a.name===n.name&&a.url!==n.url)!=null)return n.url;let s=this.topLevelServers.find(a=>a.url===n.url)??n;return C3.getServerName({server:s,context:this.context})})}convertExamples(t){let r={},n={};for(let o of this.pathParameters){let s=Object.values(o.v2Examples?.userSpecifiedExamples??{})[0],a=Object.values(o.v2Examples?.autogeneratedExamples??{})[0],c=s!==void 0?s:a;c!==void 0&&(n[zr(o.name)]=c)}let i=0;if(this.method.examples&&this.method.examples.length>0){for(let o of this.method.examples??[]){let s;if(this.context.isReferenceObject(o)){let l=this.context.resolveReference({reference:o});if(l.resolved)s=l.value;else continue}else s=o;let a;if(s.result)if(this.context.isReferenceObject(s.result)){let l=this.context.resolveReference({reference:s.result});l.resolved&&(a=l.value)}else a=s.result;let c=s.name??`Example ${i+1}`,u=[];if(s.params&&Array.isArray(s.params)){u=[];for(let l of s.params)if(this.context.isReferenceObject(l)){let p=this.context.resolveReference({reference:l});if(p.resolved)u.push(p.value);else continue}else u.push(l)}r[c]={displayName:void 0,contentType:void 0,request:{docs:void 0,endpoint:{method:"POST",path:t},baseUrl:void 0,environment:void 0,auth:void 0,pathParameters:n,queryParameters:{},headers:{},requestBody:u.map(l=>l.value)??void 0},response:{docs:void 0,statusCode:void 0,body:a?.value?Ut.V2HttpEndpointResponseBody.json({jsonrpc:"2.0",id:s.examplePairedRequest?.id||"1",result:a.value}):void 0},codeSamples:[]}}++i}return r}}});var H5r,VOu=h(()=>{"use strict";Uo();H5r=class extends wm.AbstractConverters.AbstractParameterConverter{constructor({context:t,breadcrumbs:r,parameter:n}){super({context:t,breadcrumbs:r,parameter:n})}convert(){let t,r={};if(this.parameter.schema!=null){let i=new wm.SchemaConverters.SchemaOrReferenceConverter({context:this.context,breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert();i!=null&&(t=i.type,r=i.inlinedTypes??{})}return this.convertToOutput({schema:this.parameter.schema??{type:"string"},typeReference:t,inlinedTypes:r})}}});var SUt,UOu=h(()=>{"use strict";Uo();MOu();LOu();VOu();SUt=class extends kH{constructor({context:t,breadcrumbs:r,audiences:n}){super({context:t,breadcrumbs:r,audiences:n})}async convert(){this.context.spec=this.removeXFernIgnores({document:this.context.spec}),this.convertSchemas();let{endpointLevelServers:t}=this.convertMethods(),{defaultUrl:r}=this.convertServers({endpointLevelServers:t});return this.updateEndpointsWithDefaultUrl(r),this.finalizeIr()}convertServers({endpointLevelServers:t}){let n=new C3({context:this.context,breadcrumbs:["servers"],servers:this.context.spec.servers,endpointLevelServers:t}).convert();return this.addEnvironmentsToIr({environmentConfig:n?.value}),{defaultUrl:n?.defaultUrl}}convertSchemas(){for(let[t,r]of Object.entries(this.context.spec.components?.schemas??{})){let i=new wm.SchemaConverters.SchemaConverter({context:this.context,id:t,breadcrumbs:["components","schemas",t],schema:r}).convert();i!=null&&this.addSchemaOutputToIr(t,i)}}convertMethods(){let t=[],n=new q5r({context:this.context,breadcrumbs:["methods"],operation:this.context.spec}).convert(),i=[],o=[],s=[];if(n&&n.length>0)for(let[c,u]of n.entries()){let p=new H5r({context:this.context,breadcrumbs:[...this.breadcrumbs,`x-fern-parameters[${c}]`],parameter:u}).convert();if(p!=null)switch(p.type){case"path":{i.push(p.parameter);break}case"query":{o.push(p.parameter);break}case"header":{s.push(p.parameter);break}}}let a=this.context.getGroup({groupParts:[],namespace:this.context.namespace});for(let c of this.context.spec.methods??[]){let u=this.context.resolveMaybeReference({schemaOrReference:c,breadcrumbs:["methods"]});if(u==null)continue;let p=new W5r({context:this.context,breadcrumbs:["methods"],method:u,pathParameters:i,queryParameters:o,headers:s,topLevelServers:this.context.spec.servers}).convert();if(p!=null&&(this.addEndpointToIr({endpoint:p.endpoint,audiences:p.audiences,endpointGroup:a,serviceName:"service_root"}),this.addTypesToIr(p.inlinedTypes),p.servers))for(let d of p.servers)this.shouldAddServerToCollectedServers({server:d,currentServers:t,specType:"openrpc"})&&t.push(this.maybeDeduplicateServerName(d))}return{endpointLevelServers:t}}maybeDeduplicateServerName(t){return this.context.spec.servers?.find(n=>n.name===t.name&&n.url!==t.url)?{...t,name:t.url}:t}}});var TUt,_Ou=h(()=>{"use strict";_n();Uo();TUt=class extends Wb{isReferenceObject(t){return t!=null&&"$ref"in t}convertReferenceToTypeReference({reference:t,breadcrumbs:r,displayNameOverride:n,displayNameOverrideSource:i}){let o=this.getTypeIdFromSchemaReference(t);if(o==null)return{ok:!1};let s=this.resolveReference({reference:t,breadcrumbs:r});if(!s.resolved)return{ok:!1};let a;if(i==="reference_identifier")a=n??s.value.title;else if(i==="discriminator_key")a=s.value.title??n;else{let c=t.$ref.split("/").pop()??o;a=s.value.title??c}return{ok:!0,reference:Jr.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(o),typeId:o,displayName:a,default:void 0,inline:!1})}}}});var GOu=h(()=>{"use strict";UOu();_Ou()});var qOu,WOu=h(()=>{"use strict";qOu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i});function Iim(e){return typeof e=="string"&&qOu.test(e)}var LNo,HOu=h(()=>{"use strict";WOu();LNo=Iim});function KOu(e,t=0){return(qP[e[t+0]]+qP[e[t+1]]+qP[e[t+2]]+qP[e[t+3]]+"-"+qP[e[t+4]]+qP[e[t+5]]+"-"+qP[e[t+6]]+qP[e[t+7]]+"-"+qP[e[t+8]]+qP[e[t+9]]+"-"+qP[e[t+10]]+qP[e[t+11]]+qP[e[t+12]]+qP[e[t+13]]+qP[e[t+14]]+qP[e[t+15]]).toLowerCase()}var qP,JOu=h(()=>{"use strict";qP=[];for(let e=0;e<256;++e)qP.push((e+256).toString(16).slice(1))});function VNo(){return crypto.getRandomValues(vim)}var vim,YOu=h(()=>{"use strict";vim=new Uint8Array(16)});function xim(e,t,r){return!t&&!e&&crypto.randomUUID?crypto.randomUUID():Cim(e,t,r)}function Cim(e,t,r){e=e||{};let n=e.random??e.rng?.()??VNo();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let i=0;i<16;++i)t[r+i]=n[i];return t}return KOu(n)}var YD,XOu=h(()=>{"use strict";YOu();JOu();YD=xim});var kit=h(()=>{"use strict";XOu();HOu()});async function UNo({context:e,absoluteFilePath:t,absoluteFilePathToOverrides:r}){let n=(await(0,ZOu.readFile)(t)).toString(),i;try{i=JSON.parse(n)}catch{i=Ir.load(n)}let o=[];r!=null&&(Array.isArray(r)?o=r:o=[r]);let s=i;for(let a of o)s=await hit({absoluteFilePathToOverrides:a,context:e,data:s});return s}var ZOu,$Ou=h(()=>{"use strict";ZOu=require("fs/promises");Wo();K_r()});var ePu=h(()=>{"use strict";$Ou()});function WNo(){let e=K5r.default.platform(),t=K5r.default.arch(),r;switch(e){case"linux":r="Linux";break;case"darwin":r="Darwin";break;case"win32":r="Windows";break;default:throw new S({message:`Unsupported platform: ${e}`,code:S.Code.EnvironmentError})}let n;switch(t){case"x64":n="x86_64";break;case"arm64":n=e==="linux"?"aarch64":"arm64";break;default:throw new S({message:`Unsupported architecture: ${t}`,code:S.Code.EnvironmentError})}return{os:r,arch:n,extension:r==="Windows"?".exe":""}}function PUt(){let e=K5r.default.homedir();return Mt.of(qNo.default.join(e,Sim,Tim))}function Oim(){let{extension:e}=WNo(),t=PUt();return ze(t,ve.of(`${OUt}-${sde}${e}`))}function Pim(){let{extension:e}=WNo(),t=PUt();return ze(t,ve.of(`${OUt}${e}`))}function Bim(){let e=PUt();return ze(e,ve.of(`${OUt}.version`))}function Dim(){let e=PUt();return qNo.default.join(e,`${OUt}.lock`)}function Rim(){let{os:e,arch:t,extension:r}=WNo();return`${wim}/${sde}/${OUt}-${e}-${t}${r}`}async function rPu(e){try{return await(0,Hb.access)(e),!0}catch{return!1}}async function kim(e){let t=Dim(),r=Date.now()+tPu;for(;Date.now()<r;)try{return await(0,Hb.mkdir)(t,{recursive:!1}),GNo(t,e)}catch{e.debug(`Waiting for buf lock on ${t}...`),await new Promise(n=>setTimeout(n,_No))}e.debug(`Buf lock timed out after ${tPu}ms, breaking stale lock`);try{await(0,Hb.rm)(t,{recursive:!0})}catch(n){e.debug(`Failed to remove stale buf lock: ${n instanceof Error?n.message:String(n)}`)}try{await(0,Hb.mkdir)(t,{recursive:!1})}catch{let n=Math.max(_No*5,r-Date.now()),i=Date.now()+n;for(;Date.now()<i;)try{return await(0,Hb.mkdir)(t,{recursive:!1}),GNo(t,e)}catch{e.debug(`Waiting for buf lock on ${t} (post-break retry)...`),await new Promise(o=>setTimeout(o,_No))}throw new S({message:"Failed to acquire buf lock after timeout and retry",code:S.Code.InternalError})}return GNo(t,e)}function GNo(e,t){return async()=>{try{await(0,Hb.rm)(e,{recursive:!0})}catch(r){t.debug(`Failed to release buf lock: ${r instanceof Error?r.message:String(r)}`)}}}async function BUt(e){try{let t=PUt();await(0,Hb.mkdir)(t,{recursive:!0});let r=await kim(e);try{return await Fim(e)}finally{await r()}}catch(t){e.debug(`Failed to resolve buf: ${t instanceof Error?t.message:String(t)}`);return}}async function Fim(e){let t=Oim(),r=Pim(),n=Bim();if(await rPu(t))return await Nim(n,e)===sde&&await rPu(r)?(e.info(`Using cached buf ${sde}`),r):(await nPu(t,r),await(0,Hb.writeFile)(n,sde),e.info(`Updated buf to ${sde}`),r);let i=Rim();e.info(`Downloading buf ${sde}...`);let o=Mt.of(`${t}.download`);try{let s=await fetch(i,{redirect:"follow"});if(!s.ok){e.debug(`Failed to download buf: ${s.status} ${s.statusText}`);return}let a=await s.arrayBuffer();return await(0,Hb.writeFile)(o,new Uint8Array(a)),await(0,Hb.chmod)(o,493),await(0,Hb.rename)(o,t),await nPu(t,r),await(0,Hb.writeFile)(n,sde),e.info(`Downloaded buf ${sde}`),r}catch(s){e.debug(`Failed to download buf: ${s instanceof Error?s.message:String(s)}`);try{await(0,Hb.rm)(o,{force:!0})}catch(a){e.debug(`Failed to clean up partial buf download: ${a instanceof Error?a.message:String(a)}`)}return}}async function Nim(e,t){try{return(await(0,Hb.readFile)(e,"utf-8")).trim()}catch(r){t.debug(`Failed to read buf version marker: ${r instanceof Error?r.message:String(r)}`);return}}async function nPu(e,t){let r=Mt.of(`${t}.tmp`);await(0,Hb.copyFile)(e,r),await(0,Hb.chmod)(r,493),await(0,Hb.rename)(r,t)}var Hb,K5r,qNo,sde,wim,OUt,Sim,Tim,tPu,_No,HNo=h(()=>{"use strict";Yt();Ft();Hb=require("fs/promises"),K5r=be(require("os"),1),qNo=be(require("path"),1),sde="v1.50.0",wim="https://github.com/bufbuild/buf/releases/download",OUt="buf",Sim=".fern",Tim="bin",tPu=12e4,_No=200});function RUt(e){return e.includes("server hosted at that remote is unavailable")||e.includes("fetch failed")||e.includes("failed to connect")||e.includes("network")||e.includes("ENOTFOUND")||e.includes("ETIMEDOUT")||e.includes("TIMEDOUT")||e.includes("timed out")||e.includes("ECONNREFUSED")||e.includes("ECONNRESET")||e.includes("socket hang up")}async function kUt(e,t,r=5e3){return DUt!==void 0?DUt:(KNo==null&&(KNo=jim(e,t,r)),KNo)}async function jim(e,t,r){t.debug(`Detecting air-gapped mode by checking connectivity to ${e}`);let n=3,i;for(let o=1;o<=n;o++)try{return await(await fetch(e,{method:"GET",signal:AbortSignal.timeout(r)})).body?.cancel().catch(()=>{}),DUt=!1,t.debug("Network check succeeded - not in air-gapped mode"),!1}catch(s){let a=Fn(s),c=s instanceof Error&&s.cause?` (cause: ${Fn(s.cause)})`:"";if(i=`${a}${c}`,!RUt(a))return DUt=!1,!1;if(o<n){let u=o*500;t.debug(`Network check attempt ${o}/${n} failed: ${i} \u2014 retrying in ${u}ms`),await new Promise(l=>setTimeout(l,u))}}return DUt=!0,t.debug(`Network check failed after ${n} attempts - entering air-gapped mode: ${i}`),!0}async function FUt(e,t,r="buf"){let n=ze(e,ve.of("buf.lock")),i=!1;try{await(0,E3e.access)(n),i=!0,t.debug(`Found buf.lock at: ${n}`)}catch{t.debug(`No buf.lock found at: ${n}`)}if(!i)return!1;let o=Mt.of((await iPu.default.dir()).path);try{let s=ze(e,ve.of("buf.yaml"));try{await(0,E3e.cp)(s,ze(o,ve.of("buf.yaml"))),await(0,E3e.cp)(n,ze(o,ve.of("buf.lock")))}catch{return!1}try{return await MQ(t,r,["dep","update"],{cwd:o,stdio:"pipe",timeout:3e4}),t.debug("Network check succeeded - not in air-gapped mode"),!1}catch(a){let c=Fn(a);return RUt(c)?(t.debug(`Network check failed - entering air-gapped mode: ${c.substring(0,100)}`),!0):!1}}finally{try{await(0,E3e.rm)(o,{recursive:!0,force:!0})}catch{}}}async function NUt(e){let t=h_("which",{cwd:Mt.of(process.cwd()),logger:void 0,doNotPipeOutput:!0});try{let n=(await t(["buf"])).stdout?.trim();return n?e.debug(`Found buf on PATH: ${n}`):e.debug("Found buf on PATH"),"buf"}catch{e.debug("buf not found on PATH, attempting auto-download");let r=await BUt(e);if(r!=null)return e.debug(`Using auto-downloaded buf: ${r}`),r;throw new S({message:"Missing required dependency; please install 'buf' to continue (e.g. 'brew install buf').",code:S.Code.EnvironmentError})}}var E3e,iPu,DUt,KNo,oPu,Qim,sPu,aPu,cPu,uPu,jUt,lPu,pPu,fPu,J5r=h(()=>{"use strict";wt();Yt();Q0();Ft();E3e=require("fs/promises"),iPu=be(kE(),1);HNo();oPu="buf.gen.yaml",Qim="output",sPu=`${Qim}/ir.json`,aPu="protoc-gen-fern",cPu=`version: v1
742
742
  `,uPu=`version: v2
743
743
  `,jUt=e=>{let t=`version: v1
744
744
  `;if(e.length>0){t+=`deps:
@@ -3388,7 +3388,7 @@ ${u4u.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&D3o(th
3388
3388
  `+l4e.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?l4e.default.cyan(y4u(t,this.opt.mask)):l4e.default.italic(l4e.default.dim("[hidden]")):this.opt.mask?y4u(t,this.opt.mask):l4e.default.italic(l4e.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var EKr=be(sS(),1);var AVu=be(f4o(),1),yKr=require("child_process"),Mst=require("fs"),AKr=be(require("path"),1),yVu=be(require("os"),1),bVu=require("crypto"),Y4o=be(hVu(),1);var mKr=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var X5t=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var hKr=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var gKr=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function bKr(e="",t,r){let n=new X4o(e,r);n.runAsync((i,o)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,o)}catch(s){setImmediate(t,s,void 0)}})}function gVu(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function Rjm(e){let t=[],r="";for(let n=0;n<e.length;n++){let i=e.charAt(n);n>0&&i===" "&&e[n-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${i}`}return r.length>0&&t.push(r),t}var X4o=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=Rjm(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??yVu.default.tmpdir(),r=(0,bVu.randomUUID)(),n=gVu(this.fileOptions.prefix),i=gVu(this.fileOptions.postfix),o=`${n}${r}${i}`,s=AKr.default.resolve(t,o),a=AKr.default.resolve(t)+AKr.default.sep;if(!s.startsWith(a))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=s;let c={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(c.mode=this.fileOptions.mode),(0,Mst.writeFileSync)(this.tempFile,this.text,c)}catch(t){throw new mKr(t)}}readTemporaryFile(){try{let t=(0,Mst.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,AVu.detect)(t)??"utf8";Y4o.default.encodingExists(r)||(r="utf8"),this.text=Y4o.default.decode(t,r)}}catch(t){throw new hKr(t)}}removeTemporaryFile(){try{(0,Mst.unlinkSync)(this.tempFile)}catch(t){throw new gKr(t)}}launchEditor(){try{let t=(0,yKr.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new X5t(t)}}launchEditorAsync(t){try{(0,yKr.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new X5t(r)}}};var EVu=be(F3(),1);var Z5t=class extends aS{_run(t){this.done=t,this.editorResult=new EVu.Subject;let r=$P(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?EKr.default.dim("Received"):EKr.default.dim("Press <enter> to launch your preferred editor."),t&&(r=EKr.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),bKr(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(t,r){this.rl.resume(),t?this.editorResult.error(t):this.editorResult.next(r)}onEnd(t){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=t.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(t){this.render(t.isValid)}};var wVu=require("stream");var xVu=be(require("readline"),1),CVu=be(vVu(),1),m4e=class{constructor(t){this.rl||=xVu.default.createInterface(Fjm(t)),this.rl.resume(),this.onForceClose=this.onForceClose.bind(this),process.on("exit",this.onForceClose),this.rl.on("SIGINT",this.onForceClose)}onForceClose(){this.close(),process.kill(process.pid,"SIGINT"),console.log("")}close(){this.rl.removeListener("SIGINT",this.onForceClose),process.removeListener("exit",this.onForceClose),this.rl.output.unmute(),this.activePrompt&&typeof this.activePrompt.close=="function"&&this.activePrompt.close(),this.rl.output.end(),this.rl.pause(),this.rl.close()}};function Fjm(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new CVu.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var $5t=class extends m4e{constructor(t={}){super(t),this.log=new wVu.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return j5t(this.rl,this.bottomBar.split(`
3389
3389
  `).length),this}updateBottomBar(t){return j5t(this.rl,1),this.rl.output.unmute(),this.clean(),this.bottomBar=t,this.render(),this.rl.output.mute(),this}writeLog(t){return this.rl.output.unmute(),this.clean(),this.rl.output.write(this.enforceLF(t.toString())),this.render(),this.rl.output.mute(),this}enforceLF(t){return/[\n\r]$/.test(t)?t:t+`
3390
3390
  `}write(t){let r=t.split(/\n/);this.height=r.length,this.rl.setPrompt(r.at(-1)),this.rl.output.rows===0&&this.rl.output.columns===0&&UHr(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var Hd=be(F3(),1),OVu=be(d5t(),1);var IKr=be(F3(),1),SVu=be(d5t(),1),vKr=function(e,t,r){return typeof e[t]!="function"?(0,IKr.of)(e):(0,IKr.from)((0,SVu.default)(e[t])(r).then(n=>(e[t]=n,e)))};var TVu={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,o,s)=>{i==="__proto__"||i==="constructor"||(o===s.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=o=>String.prototype.split.call(t,o).filter(Boolean).reduce((s,a)=>s!=null?s[a]:s,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},Lst=class extends m4e{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let n;return Array.isArray(t)?n=(0,Hd.from)(t):(0,Hd.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,Hd.from)(Object.entries(t).map(([i,o])=>({name:i,...o}))):n=(0,Hd.from)([t]),this.process=n.pipe((0,Hd.concatMap)(this.processQuestion.bind(this)),(0,Hd.publish)()),this.process.connect(),this.process.pipe((0,Hd.reduce)((i,o)=>(TVu.set(i,o.name,o.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,Hd.defer)(()=>(0,Hd.of)(t).pipe((0,Hd.concatMap)(this.setDefaultType.bind(this)),(0,Hd.concatMap)(this.filterIfRunnable.bind(this)),(0,Hd.concatMap)(()=>vKr(t,"message",this.answers)),(0,Hd.concatMap)(()=>vKr(t,"default",this.answers)),(0,Hd.concatMap)(()=>vKr(t,"choices",this.answers)),(0,Hd.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,Hd.defer)(()=>(0,Hd.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,Hd.defer)(()=>(0,Hd.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&TVu.get(this.answers,t.name)!==void 0)return Hd.EMPTY;if(t.when===!1)return Hd.EMPTY;if(typeof t.when!="function")return(0,Hd.of)(t);let{answers:r}=this;return(0,Hd.defer)(()=>(0,Hd.from)((0,OVu.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,Hd.filter)(n=>n!=null)))}};function PVu(e){let t=function(r,n){let i;try{i=new Lst(t.prompts,e)}catch(s){return Promise.reject(s)}let o=i.run(r,n);return o.ui=i,o};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",z5t),this.registerPrompt("input",u4e),this.registerPrompt("number",M5t),this.registerPrompt("confirm",L5t),this.registerPrompt("rawlist",V5t),this.registerPrompt("expand",U5t),this.registerPrompt("checkbox",_5t),this.registerPrompt("password",G5t),this.registerPrompt("editor",Z5t)},t.restoreDefaultPrompts(),t}var $4o=PVu();function jjm(e,t){$4o.registerPrompt(e,t)}function Qjm(){$4o.restoreDefaultPrompts()}var zjm={prompt:$4o,ui:{BottomBar:$5t,Prompt:Lst},createPromptModule:PVu,registerPrompt:jjm,restoreDefaultPrompts:Qjm,Separator:wz},yu=zjm;var Vst=require("path");function DVu(){let e=Mjm();return async t=>{for(let r of t)r.module=e(r.filename);return t}}function Mjm(e=process.argv[1]?(0,Vst.dirname)(process.argv[1]):process.cwd(),t=Vst.sep==="\\"){let r=t?BVu(e):e;return n=>{if(!n)return;let i=t?BVu(n):n,{dir:o,base:s,ext:a}=Vst.posix.parse(i);(a===".js"||a===".mjs"||a===".cjs")&&(s=s.slice(0,-1*a.length));let c=decodeURIComponent(s);o||(o=".");let u=o.lastIndexOf("/node_modules");if(u>-1)return`${o.slice(u+14).replace(/\//g,".")}:${c}`;if(o.startsWith(r)){let l=o.slice(r.length+1).replace(/\//g,".");return l?`${l}:${c}`:c}return c}}function BVu(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var eVo=e=>{if("flags"in e){let t=RVu(e.flags),r=kVu(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,o])=>[i,tVo(o)])),n=Object.fromEntries(Object.entries(t).map(([i,o])=>[i,Ljm(i,o,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function Ljm(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var RVu=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,e8t(r)]).filter(([,t])=>t!==void 0)),kVu=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let n=t[r];return n.enabled&&n.metadata&&n.metadata.payload!==void 0}).map(r=>{let n=t[r].metadata?.payload;return[r,n?tVo(n):void 0]}))};var e8t=e=>e===void 0?void 0:e.variant??e.enabled,tVo=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};var B2=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({});function rVo(){return"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&typeof Response.prototype.blob=="function"}var Ujm="NativeGzipValidationError",_jm=31,Gjm=139,qjm=8,Wjm=e=>e.length>=2&&e[0]===_jm&&e[1]===Gjm;var t8t,Hjm=()=>{if(t8t)return t8t;t8t=[];for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;t8t[e]=t>>>0}return t8t},Kjm=e=>{let t=Hjm(),r=4294967295;for(let n=0;n<e.length;n++)r=t[(r^e[n])&255]^r>>>8;return(4294967295^r)>>>0},xKr=e=>{let t=new Error(`Native gzip produced invalid output: ${e}`);throw t.name=Ujm,t},Jjm=async(e,t)=>{e.size<18&&xKr("too-short");let r=new Uint8Array(await e.slice(0,10).arrayBuffer());(!Wjm(r)||r[2]!==qjm)&&xKr("invalid-header");let n=new DataView(await e.slice(e.size-8).arrayBuffer());n.getUint32(0,!0)!==Kjm(t)&&xKr("invalid-crc");let i=t.length>>>0;n.getUint32(4,!0)!==i&&xKr("invalid-size")};async function r8t(e,t=!0,r){try{let n=new TextEncoder().encode(e),i=new CompressionStream("gzip"),o=i.writable.getWriter(),s=o.write(n).then(()=>o.close()).catch(async u=>{try{await o.abort(u)}catch{}throw u}),a=new Response(i.readable).blob(),[c]=await Promise.all([a,s]);return await Jjm(c,n),c}catch(n){if(r?.rethrow)throw n;return t&&console.error("Failed to gzip compress data",n),null}}var Yjm=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],FVu=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return Yjm.concat(t).some(n=>{let i=n.toLowerCase();return r.indexOf(i)!==-1})};var Zjm=Array.isArray,NVu=Object.prototype,bev=NVu.hasOwnProperty,nVo=NVu.toString,Ust=Zjm||function(e){return nVo.call(e)==="[object Array]"};var n8t=e=>e===Object(e)&&!Ust(e);var _st=e=>e===void 0,cCe=e=>nVo.call(e)=="[object String]",jVu=e=>cCe(e)&&e.trim().length===0;var i8t=e=>nVo.call(e)=="[object Number]"&&e===e;var iVo=e=>e instanceof Error;function CKr(e){return e===null||typeof e!="object"}function h4e(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function QVu(e){return h4e(e,"ErrorEvent")}function Gst(e){return typeof Event<"u"&&$jm(e,Event)}function zVu(e){return h4e(e,"Object")}function $jm(e,t){try{return e instanceof t}catch{return!1}}function o8t(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),i8t(e)?e>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e<t?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),o8t(i||r,t,r,n))}var eQm=864e5,wKr=class{constructor(t){this._buckets={},this._onBucketRateLimited=t._onBucketRateLimited,this._bucketSize=o8t(t.bucketSize,0,100,t._logger),this._refillRate=o8t(t.refillRate,0,this._bucketSize,t._logger),this._refillInterval=o8t(t.refillInterval,0,eQm,t._logger)}_applyRefill(t,r){let n=r-t.lastAccess,i=Math.floor(n/this._refillInterval);if(i>0){let o=i*this._refillRate;t.tokens=Math.min(t.tokens+o,this._bucketSize),t.lastAccess=t.lastAccess+i*this._refillInterval}}consumeRateLimit(t){let r=Date.now(),n=String(t),i=this._buckets[n];return i?this._applyRefill(i,r):(i={tokens:this._bucketSize,lastAccess:r},this._buckets[n]=i),i.tokens===0?!0:(i.tokens--,i.tokens===0&&this._onBucketRateLimited?.(t),i.tokens===0)}stop(){this._buckets={}}};var SKr="0123456789abcdef",TKr=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length===16)return new e(t);throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||t<0||r<0||n<0||i<0||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let o=new Uint8Array(16);return o[0]=t/2**40,o[1]=t/2**32,o[2]=t/2**24,o[3]=t/2**16,o[4]=t/256,o[5]=t,o[6]=112|r>>>8,o[7]=r,o[8]=128|n>>>24,o[9]=n>>>16,o[10]=n>>>8,o[11]=n,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new e(o)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;default:break}if(r){let n=new Uint8Array(16);for(let i=0;i<16;i+=4){let o=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=o>>>24,n[i+1]=o>>>16,n[i+2]=o>>>8,n[i+3]=o}return new e(n)}throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=SKr.charAt(this.bytes[r]>>>4),t+=SKr.charAt(15&this.bytes[r]),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=SKr.charAt(this.bytes[r]>>>4),t+=SKr.charAt(15&this.bytes[r]);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},oVo=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??tQm()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let n=this.generateOrAbortCore(t,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(t,r)),n}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+r>=this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return TKr.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}generateV4(){let t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,TKr.ofInner(t)}},tQm=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),MVu,Ete=()=>rQm().toString(),rQm=()=>(MVu||(MVu=new oVo)).generate();var OKr=class{add(t){let r=Ete();return this.promiseByIds[r]=t,t.catch(()=>{}).finally(()=>{delete this.promiseByIds[r]}),t}async join(){let t=Object.values(this.promiseByIds),r=t.length;for(;r>0;)await Promise.all(t),t=Object.values(this.promiseByIds),r=t.length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}};function nQm(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}var LVu=(e,t,r)=>{function n(o,...s){t(()=>{let a=r[o];a(e,...s)})}return{debug:(...o)=>{n("debug",...o)},info:(...o)=>{n("log",...o)},warn:(...o)=>{n("warn",...o)},error:(...o)=>{n("error",...o)},critical:(...o)=>{r.error(e,...o)},createLogger:o=>LVu(`${e} ${o}`,t,r)}},iQm=e=>e();function VVu(e,t=iQm){return LVu(e,t,nQm())}var Wst="Mobile",BKr="iOS",qst="Android",UVu="Tablet",Dev=qst+" "+UVu;var sQm="Apple",Rev=sQm+" Watch",_Vu="Safari",DKr="BlackBerry",GVu="Samsung",aQm=GVu+"Browser",cQm=GVu+" Internet",RKr="Chrome",uQm=RKr+" OS",lQm=RKr+" "+BKr,qVu="Internet Explorer",pQm=qVu+" "+Wst,aVo="Opera",kev=aVo+" Mini",WVu="Edge",fQm="Microsoft "+WVu,cVo="Firefox",dQm=cVo+" "+BKr,uVo="Nintendo",lVo="PlayStation",PKr="Xbox",mQm=qst+" "+Wst,hQm=Wst+" "+_Vu,s8t="Windows",gQm=s8t+" Phone";var HVu="Generic",Fev=HVu+" "+Wst.toLowerCase(),Nev=HVu+" "+UVu.toLowerCase(),AQm="Konqueror",yQm="Oculus Browser",tR="(\\d+(\\.\\d+)?)",sVo=new RegExp("Version/"+tR),jev=new RegExp(PKr,"i"),Qev=new RegExp(lVo+" \\w+","i"),zev=new RegExp(uVo+" \\w+","i"),bQm=new RegExp(DKr+"|PlayBook|BB10","i"),EQm={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000","5.1":"XP","5.2":"XP","6.0":"Vista","6.1":"7","6.2":"8","6.3":"8.1","6.4":"10","10.0":"10"};var Mev={[pQm]:[new RegExp("rv:"+tR)],[fQm]:[new RegExp(WVu+"?\\/"+tR)],[RKr]:[new RegExp("("+RKr+"|CrMo)\\/"+tR)],[lQm]:[new RegExp("CriOS\\/"+tR)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+tR)],[_Vu]:[sVo],[hQm]:[sVo],[aVo]:[new RegExp("("+aVo+"|OPR)\\/"+tR)],[cVo]:[new RegExp(cVo+"\\/"+tR)],[dQm]:[new RegExp("FxiOS\\/"+tR)],[AQm]:[new RegExp("Konqueror[:/]?"+tR,"i")],[DKr]:[new RegExp(DKr+" "+tR),sVo],[mQm]:[new RegExp("android\\s"+tR,"i")],[cQm]:[new RegExp(aQm+"\\/"+tR)],[yQm]:[new RegExp("OculusBrowser\\/"+tR)],[qVu]:[new RegExp("(rv:|MSIE )"+tR)],Mozilla:[new RegExp("rv:"+tR)]};var Lev=[[new RegExp(PKr+"; "+PKr+" (.*?)[);]","i"),e=>[PKr,e&&e[1]||""]],[new RegExp(uVo,"i"),[uVo,""]],[new RegExp(lVo,"i"),[lVo,""]],[bQm,[DKr,""]],[new RegExp(s8t,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[gQm,""];if(new RegExp(Wst).test(t)&&!/IEMobile\b/.test(t))return[s8t+" "+Wst,""];let r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let n=r[1],i=EQm[n]||"";return/arm/i.test(t)&&(i="RT"),[s8t,i]}return[s8t,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){let t=[e[3],e[4],e[5]||"0"];return[BKr,t.join(".")]}return[BKr,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=_st(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+qst+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+qst+")","i"),e=>{if(e&&e[2]){let t=[e[2],e[3],e[4]||"0"];return[qst,t.join(".")]}return[qst,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];if(e&&e[1]){let r=[e[1],e[2],e[3]||"0"];t[1]=r.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[uQm,""]],[/Linux|debian/i,["Linux",""]]];var KVu="utf8";function JVu(e){return e?.replace(/\/+$/,"")}async function YVu(e,t){let r=null;for(let n=0;n<t.retryCount+1;n++){n>0&&await new Promise(i=>setTimeout(i,t.retryDelay));try{return await e()}catch(i){if(r=i,!t.retryCheck(i))throw i}}throw r}function kKr(){return new Date().toISOString()}function Ite(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var XVu=e=>e instanceof Error;function pVo(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var IQm={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},etv=IQm.info;var FKr=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(n=>n!==r)}}emit(t,r){for(let n of this.events[t]||[])n(r);for(let n of this.events["*"]||[])n(t,r)}};var A4e=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},g4e=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function ZVu(e){if(e instanceof A4e){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function NKr(e){return typeof e=="object"&&(e instanceof A4e||e instanceof g4e)}function jKr(e){return typeof e=="object"&&e instanceof A4e&&e.status===413}var a8t=class{constructor(t,r={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new OKr,this._events=new FKr,this._isInitialized=!1;let n=typeof t=="string"?t.trim():"",i=typeof r.host=="string"?r.host.trim():"",o=!n;this._logger=VVu("[PostHog]",this.logMsgIfDebug.bind(this)),o&&this._logger.error("You must pass your PostHog project's api key. The client will be disabled."),this.apiKey=n,this.host=JVu(i||"https://us.i.posthog.com"),this.flushAt=r.flushAt?Math.max(r.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,r.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,r.maxQueueSize??1e3),this.flushInterval=r.flushInterval??1e4,this.preloadFeatureFlags=r.preloadFeatureFlags??!0,this.defaultOptIn=r.defaultOptIn??!0,this.disableSurveys=r.disableSurveys??!1,this._retryOptions={retryCount:r.fetchRetryCount??3,retryDelay:r.fetchRetryDelay??3e3,retryCheck:NKr},this.requestTimeout=r.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r.disableGeoip??!0,this.disabled=(r.disabled??!1)||o,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this.evaluationContexts=r?.evaluationContexts??r?.evaluationEnvironments,r?.evaluationEnvironments&&!r?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!rVo()||(r?.disableCompression??!1)}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(B2.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(B2.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(B2.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>this._logger.info(n,i));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){return this.promiseQueue.add(t)}identifyStateless(t,r,n){this.wrap(()=>{let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",i,n)})}async identifyStatelessImmediate(t,r,n){let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",i,n)}captureStateless(t,r,n,i){this.wrap(()=>{let o=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",o,i)})}async captureStatelessImmediate(t,r,n,i){let o=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",o,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",o,i)})}async aliasStatelessImmediate(t,r,n,i){let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",o,i)}groupIdentifyStateless(t,r,n,i,o,s){this.wrap(()=>{let a=this.buildPayload({distinct_id:o||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...s||{}}});this.enqueue("capture",a,i)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,n,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(i=>i.json()).catch(i=>{this._logger.error("Remote config could not be loaded",i),this._events.emit("error",i)})}async getFlags(t,r={},n={},i={},o={},s=!1){await this._initPromise;let a=s?"&config=true":"",c=`${this.host}/flags/?v=2${a}`,u={token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...o};n.$device_id&&(u.$device_id=n.$device_id),this.evaluationContexts&&this.evaluationContexts.length>0&&(u.evaluation_contexts=this.evaluationContexts);let l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(u)};return this._logger.info("Flags URL",c),this.fetchWithRetry(c,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(p=>p.json()).then(p=>({success:!0,response:eVo(p)})).catch(p=>(this._events.emit("error",p),{success:!1,error:this.categorizeRequestError(p)}))}categorizeRequestError(t){if(t instanceof A4e)return{type:"api_error",statusCode:t.status};if(t instanceof g4e){let r=t.error;return r instanceof Error&&(r.name==="AbortError"||r.name==="TimeoutError")?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailStateless(t,r,n,i,o,s);if(a===void 0)return{response:void 0,requestId:void 0};let c=e8t(a.response);return c===void 0&&(c=!1),{response:c,requestId:a.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(r,n,i,o,s,[t]);return a===void 0?void 0:{response:a.flags[t],requestId:a.requestId,evaluatedAt:a.evaluatedAt}}async getFeatureFlagPayloadStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagPayloadsStateless(r,n,i,o,s,[t]);if(!a)return;let c=a[t];return c===void 0?null:c}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},o,s){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},o,s){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(t,r,n,i,o,s);return a?{flags:a.featureFlags,payloads:a.featureFlagPayloads,requestId:a.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a={};(o??this.disableGeoip)&&(a.geoip_disable=!0),s&&(a.flag_keys_to_evaluate=s);let c=await this.getFlags(t,r,n,i,a);if(!c.success)return;let u=c.response;return u.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),u.quotaLimited?.includes("feature_flags")?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:u?.requestId,quotaLimited:u.quotaLimited}):u}async getSurveysStateless(){if(await this._initPromise,this.disabled)return[];if(this.disableSurveys===!0)return this._logger.info("Loading surveys is disabled."),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(o=>{if(o.status!==200||!o.json){let s=`Surveys API could not be loaded: ${o.status}`,a=new Error(s);this._logger.error(a),this._events.emit("error",new Error(s));return}return o.json()}).catch(o=>{this._logger.error("Surveys API could not be loaded",o),this._events.emit("error",o)}))?.surveys;return i&&this._logger.info("Surveys fetched from API: ",JSON.stringify(i)),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(B2.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(B2.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(B2.Props,this.props)})}processBeforeEnqueue(t){return t}async flushStorage(){}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o=this.getPersistedProperty(B2.Queue)||[];o.length>=this.maxQueueSize&&(o.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),o.push({message:i}),this.setPersistedProperty(B2.Queue,o),this._events.emit(t,i),o.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Ite(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o={api_key:this.apiKey,batch:[i],sent_at:kKr()};this.historicalMigration&&(o.historical_migration=!0);let s=JSON.stringify(o),a=`${this.host}/batch/`,c=this.disableCompression?null:await r8t(s,this.isDebug),u={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...c!==null&&{"Content-Encoding":"gzip"}},body:c||s};try{await(await this.fetchWithRetry(a,u)).body?.cancel()?.catch(()=>{})}catch(l){this._events.emit("error",l)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:kKr(),uuid:n?.uuid?n.uuid:Ete()};return(n?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await ZVu(t)})}async flush(){if(this.disabled)return;let t=pVo([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),pVo([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(B2.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),o=i.map(f=>f.message),s=async()=>{let m=(this.getPersistedProperty(B2.Queue)||[]).slice(i.length);this.setPersistedProperty(B2.Queue,m),t=m,await this.flushStorage()},a={api_key:this.apiKey,batch:o,sent_at:kKr()};this.historicalMigration&&(a.historical_migration=!0);let c=JSON.stringify(a),u=`${this.host}/batch/`,l=this.disableCompression?null:await r8t(c,this.isDebug),p={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...l!==null&&{"Content-Encoding":"gzip"}},body:l||c},d={retryCheck:f=>jKr(f)?!1:NKr(f)};try{await(await this.fetchWithRetry(u,p,d)).body?.cancel()?.catch(()=>{})}catch(f){if(jKr(f)&&o.length>1){this.maxBatchSize=Math.max(1,Math.floor(o.length/2)),this._logger.warn(`Received 413 when sending batch of size ${o.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw f instanceof g4e||await s(),this._events.emit("error",f),f}await s(),r.push(...o)}this._events.emit("flush",r)}async _sendLogsBatch(t){if(this.disabled)return{kind:"fatal",error:new Error("The client is disabled")};let r=JSON.stringify(t),n=`${this.host}/i/v1/logs?token=${encodeURIComponent(this.apiKey)}`,i=this.disableCompression?null:await r8t(r,this.isDebug),o={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...i!==null&&{"Content-Encoding":"gzip"}},body:i||r};try{return await this.fetchWithRetry(n,o,{retryCheck:s=>jKr(s)?!1:NKr(s)}),{kind:"ok"}}catch(s){return jKr(s)?{kind:"too-large"}:s instanceof g4e?{kind:"retry-later",error:s}:{kind:"fatal",error:s}}}async fetchWithRetry(t,r,n,i){let o=r.body?r.body:"",s=-1;try{s=o instanceof Blob?o.size:Buffer.byteLength(o,KVu)}catch{o instanceof Blob?s=o.size:s=new TextEncoder().encode(o).length}return await YVu(async()=>{let a=new AbortController,c=i??this.requestTimeout,u=Ite(()=>a.abort(),c),l=null;try{l=await this.fetch(t,{signal:a.signal,...r})}catch(d){throw new g4e(d)}finally{clearTimeout(u)}if(!(r.mode==="no-cors")&&(l.status<200||l.status>=400))throw new A4e(l,s);return l},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;if(this.clearFlushTimer(),this.disabled)return;let n=async()=>{try{for(await this.promiseQueue.join();!((this.getPersistedProperty(B2.Queue)||[]).length===0||(await this.flush(),r)););}catch(o){if(!NKr(o))throw o;await ZVu(o)}},i;try{return await Promise.race([new Promise((o,s)=>{i=Ite(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,s("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}finally{clearTimeout(i)}}async shutdown(t=3e4){return this.shutdownPromise?this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup"):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}};var Tz={};Z(Tz,{DEFAULT_EXCEPTION_STEPS_CONFIG:()=>VKr,DOMExceptionCoercer:()=>hVo,EXCEPTION_STEP_INTERNAL_FIELDS:()=>c8t,ErrorCoercer:()=>gVo,ErrorEventCoercer:()=>AVo,ErrorPropertiesBuilder:()=>fVo,EventCoercer:()=>EVo,ExceptionStepsBuffer:()=>wVo,ObjectCoercer:()=>bVo,PrimitiveCoercer:()=>IVo,PromiseRejectionEventCoercer:()=>vVo,ReduceableCache:()=>xVo,StringCoercer:()=>yVo,chromeStackLineParser:()=>dVo,createDefaultStackParser:()=>zQm,createStackParser:()=>uUu,geckoStackLineParser:()=>mVo,getUtf8ByteLength:()=>pUu,nodeStackLineParser:()=>oUu,opera10StackLineParser:()=>rUu,opera11StackLineParser:()=>nUu,resolveExceptionStepsConfig:()=>CVo,reverseAndStripFrames:()=>cUu,stripReservedExceptionStepFields:()=>VQm,winjsStackLineParser:()=>tUu});var QKr,$Vu,zKr;function eUu(e){let t=globalThis._posthogChunkIds;if(!t)return;let r=Object.keys(t);return zKr&&r.length===$Vu||($Vu=r.length,zKr=r.reduce((n,i)=>{QKr||(QKr={});let o=QKr[i];if(o)n[o[0]]=o[1];else{let s=e(i);for(let a=s.length-1;a>=0;a--){let u=s[a]?.filename,l=t[i];if(u&&l){n[u]=l,QKr[i]=[u,l];break}}}return n},{})),zKr}var wQm=4,fVo=class{constructor(t,r,n=[]){this.coercers=t,this.stackParser=r,this.modifiers=n}buildFromUnknown(t,r={}){let i=r&&r.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,r,0).apply(t),a=this.buildParsingContext(r),c=this.parseStacktrace(s,a);return{$exception_list:this.convertToExceptionList(c,i),$exception_level:"error"}}async modifyFrames(t){for(let r of t)r.stacktrace&&r.stacktrace.frames&&Ust(r.stacktrace.frames)&&(r.stacktrace.frames=await this.applyModifiers(r.stacktrace.frames));return t}coerceFallback(t){return{type:"Error",value:"Unknown error",stack:t.syntheticException?.stack,synthetic:!0}}parseStacktrace(t,r){let n;t.cause!=null&&(n=this.parseStacktrace(t.cause,r));let i;return t.stack!=""&&t.stack!=null&&(i=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?r.skipFirstLines:0),r.chunkIdMap)),{...t,cause:n,stack:i}}applyChunkIds(t,r){return t.map(n=>(n.filename&&r&&(n.chunk_id=r[n.filename]),n))}applyCoercers(t,r){for(let n of this.coercers)if(n.match(t))return n.coerce(t,r);return this.coerceFallback(r)}async applyModifiers(t){let r=t;for(let n of this.modifiers)r=await n(r);return r}convertToExceptionList(t,r){let n={type:t.type,value:t.value,mechanism:{type:r.type??"generic",handled:r.handled??!0,synthetic:t.synthetic??!1}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});let i=[n];return t.cause!=null&&i.push(...this.convertToExceptionList(t.cause,{...r,handled:!0})),i}buildParsingContext(t){return{chunkIdMap:eUu(this.stackParser),skipFirstLines:t.skipFirstLines??1}}buildCoercingContext(t,r,n=0){let i=(s,a)=>{if(a<=wQm){let c=this.buildCoercingContext(t,r,a);return this.applyCoercers(s,c)}};return{...r,syntheticException:n==0?r.syntheticException:void 0,mechanism:t,apply:s=>i(s,n),next:s=>i(s,n+1)}}};var tB="?";function vte(e,t,r,n,i){let o={platform:e,filename:t,function:r==="<anonymous>"?tB:r,in_app:!0};return _st(n)||(o.lineno=n),_st(i)||(o.colno=i),o}var MKr=(e,t)=>{let r=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return r||n?[e.indexOf("@")!==-1?e.split("@")[0]:tB,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};var SQm=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,TQm=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,OQm=/\((\S*)(?::(\d+))(?::(\d+))\)/,dVo=(e,t)=>{let r=SQm.exec(e);if(r){let[,i,o,s]=r;return vte(t,i,tB,+o,+s)}let n=TQm.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){let a=OQm.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}let[o,s]=MKr(n[1]||tB,n[2]);return vte(t,s,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}};var PQm=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,BQm=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,mVo=(e,t)=>{let r=PQm.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let s=BQm.exec(r[3]);s&&(r[1]=r[1]||"eval",r[3]=s[1],r[4]=s[2],r[5]="")}let i=r[3],o=r[1]||tB;return[o,i]=MKr(o,i),vte(t,i,o,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}};var DQm=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,tUu=(e,t)=>{let r=DQm.exec(e);return r?vte(t,r[2],r[1]||tB,+r[3],r[4]?+r[4]:void 0):void 0};var RQm=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,rUu=(e,t)=>{let r=RQm.exec(e);return r?vte(t,r[2],r[3]||tB,+r[1]):void 0},kQm=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,nUu=(e,t)=>{let r=kQm.exec(e);return r?vte(t,r[5],r[3]||r[4]||tB,+r[1],+r[2]):void 0};var FQm=/^\s*[-]{4,}$/,NQm=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,oUu=(e,t)=>{let r=e.match(NQm);if(r){let n,i,o,s,a;if(r[1]){o=r[1];let l=o.lastIndexOf(".");if(o[l-1]==="."&&l--,l>0){n=o.slice(0,l),i=o.slice(l+1);let p=n.indexOf(".Module");p>0&&(o=o.slice(p+1),n=n.slice(0,p))}s=void 0}i&&(s=n,a=i),i==="<anonymous>"&&(a=void 0,o=void 0),o===void 0&&(a=a||tB,o=s?`${s}.${a}`:a);let c=r[2]?.startsWith("file://")?r[2].slice(7):r[2],u=r[5]==="native";return c?.match(/\/[A-Z]:/)&&(c=c.slice(1)),!c&&r[5]&&!u&&(c=r[5]),{filename:c?decodeURI(c):void 0,module:void 0,function:o,lineno:iUu(r[3]),colno:iUu(r[4]),in_app:jQm(c||"",u),platform:t}}if(e.match(FQm))return{filename:e,platform:t}};function jQm(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function iUu(e){return parseInt(e||"",10)||void 0}var sUu=/\(error: (.*)\)/,aUu=50;function cUu(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,aUu).map(r=>({...r,filename:r.filename||QQm(t).filename,function:r.function||tB}))}function QQm(e){return e[e.length-1]||{}}function zQm(){return uUu("web:javascript",dVo,mVo)}function uUu(e,...t){return(r,n=0)=>{let i=[],o=r.split(`
3391
- `);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let c=sUu.test(a)?a.replace(sUu,"$1"):a;if(!c.match(/\S*Error: /)){for(let u of t){let l=u(c,e);if(l){i.push(l);break}}if(i.length>=aUu)break}}return cUu(i)}}var hVo=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=cCe(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return h4e(t,"DOMException")}isDOMError(t){return h4e(t,"DOMError")}};var gVo=class{match(t){return iVo(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var AVo=class{constructor(){}match(t){return QVu(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var MQm=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,yVo=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(MQm);return i&&(r=i[1],n=i[2]),[r,n]}};var lUu=["fatal","error","warning","log","info","debug"];function LKr(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var bVo=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Gst(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=LKr(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return cCe(t)&&!jVu(t)&&lUu.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(XVu(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var EVo=class{match(t){return Gst(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${LKr(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var IVo=class{match(t){return CKr(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var vVo=class{match(t){return h4e(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Gst(t))return!1;try{let r=t.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return CKr(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var xVo=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var c8t={MESSAGE:"$message",TIMESTAMP:"$timestamp"},LQm=new Set([c8t.MESSAGE,c8t.TIMESTAMP]),VKr={enabled:!0,max_bytes:32768};function CVo(e){return e?{enabled:e.enabled??VKr.enabled,max_bytes:UQm(e.max_bytes,VKr.max_bytes)}:{...VKr}}function VQm(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};let t=[];return{sanitizedProperties:Object.keys(e).reduce((n,i)=>LQm.has(i)?(t.push(i),n):(n[i]=e[i],n),{}),droppedKeys:t}}var wVo=class{constructor(t){this._entries=[],this._totalBytes=0,this._config=CVo(t)}setConfig(t){this._config=CVo(t),this._trimToMaxBytes()}add(t){let r=_Qm(t);if(!r)return;let n=pUu(r.json);n>this._config.max_bytes||(this._entries.push({step:r.step,bytes:n}),this._totalBytes+=n,this._trimToMaxBytes())}getAttachable(){return this._entries.map(t=>t.step)}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){let t=this._entries.shift();t&&(this._totalBytes-=t.bytes)}}};function UQm(e,t){if(!i8t(e)||e===1/0||e===-1/0)return t;let r=Math.floor(e);return r<0?t:r}function _Qm(e){let t=GQm(e);if(t)try{let r=JSON.parse(t);if(!n8t(r))return;let n=r,i=n[c8t.MESSAGE],o=n[c8t.TIMESTAMP];return!cCe(i)||i.trim().length===0||!cCe(o)&&!i8t(o)?void 0:{step:n,json:t}}catch{return}}function GQm(e){let t=new WeakSet;try{return JSON.stringify(e,(r,n)=>{if(typeof n=="bigint")return n.toString();if(!(typeof n=="function"||typeof n=="symbol")){if(n instanceof Date)return n.toISOString();if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n=="object"){if(t.has(n))return"[Circular]";t.add(n)}return n}})}catch{return}}function pUu(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length;let t=encodeURIComponent(e),r=0;for(let n=0;n<t.length;n++)t[n]==="%"?(r+=1,n+=2):r+=1;return r}var mUu=require("fs"),hUu=require("readline"),UKr=new Tz.ReduceableCache(25),gUu=new Tz.ReduceableCache(20),SVo=7,qQm=1e3,WQm=1e4;async function AUu(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||YQm(s)||XQm(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(gUu.get(i))continue;let o=t[i];if(!o)continue;o.sort((c,u)=>c-u);let s=$Qm(o);if(s.every(c=>ZQm(i,c)))continue;let a=ezm(UKr,i,{});n.push(HQm(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&KQm(e,UKr),UKr.reduce(),e}function HQm(e,t,r){return new Promise(n=>{let i=(0,mUu.createReadStream)(e),o=(0,hUu.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,c=0,u=t[c];if(u===void 0)return void s();let l=u[0],p=u[1];function d(){gUu.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=tzm(f,0),a>=p)){if(c===t.length-1){o.close(),o.removeAllListeners();return}c++;let m=t[c];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function KQm(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;JQm(r.lineno,r,n)}}function JQm(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=yUu(e);i<e;i++){let o=r[i];if(o===void 0)return void fUu(t);t.pre_context.push(o)}if(r[e]===void 0)return void fUu(t);t.context_line=r[e];let n=bUu(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function fUu(e){delete e.pre_context,delete e.context_line,delete e.post_context}function YQm(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function XQm(e){return e.lineno!==void 0&&e.lineno>WQm||e.colno!==void 0&&e.colno>qQm}function ZQm(e,t){let r=UKr.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function $Qm(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=dUu(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+SVo:(i.push(n),n=dUu(o)),t++}return i}function dUu(e){return[yUu(e),bUu(e)]}function yUu(e){return Math.max(1,e-SVo)}function bUu(e){return e+SVo}function ezm(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function tzm(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}var Hst=require("path");function EUu(e=process.cwd()){let t=Hst.sep==="\\",r=i=>t?i.replace(/\\/g,"/"):i,n=r(e);return async i=>{for(let o of i)!o.filename||o.filename.startsWith("node:")||o.filename.startsWith("data:")||(0,Hst.isAbsolute)(o.filename)&&(o.filename=r((0,Hst.relative)(n,r(o.filename))));return i}}function rzm(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function IUu(e,t){globalThis.process?.on("uncaughtException",rzm(e,t))}function vUu(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var nzm=2e3,$H=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new wKr({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return n8t(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i},s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n,properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(IUu(this.onException.bind(this),this.onFatalError.bind(this)),vUu(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(nzm),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var xUu="5.35.1";var Rde={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};var Kst=class e{constructor(t){this._host=t.host,this._distinctId=t.distinctId,this._groups=t.groups,this._disableGeoip=t.disableGeoip,this._flags=t.flags,this._requestId=t.requestId,this._evaluatedAt=t.evaluatedAt,this._flagDefinitionsLoadedAt=t.flagDefinitionsLoadedAt,this._errorsWhileComputing=t.errorsWhileComputing??!1,this._quotaLimited=t.quotaLimited??!1,this._accessed=t.accessed??new Set,this._isSlice=t.isSlice??!1}isEnabled(t){let r=this._flags[t];return this._recordAccess(t),r?.enabled??!1}getFlag(t){let r=this._flags[t];if(this._recordAccess(t),!!r)return r.enabled?r.variant??!0:!1}getFlagPayload(t){return this._flags[t]?.payload}onlyAccessed(){let t={};for(let r of this._accessed){let n=this._flags[r];n&&(t[r]=n)}return this._cloneWith(t)}only(t){let r={},n=[];for(let i of t){let o=this._flags[i];o?r[i]=o:n.push(i)}return n.length>0&&this._host.logWarning(`FeatureFlagEvaluations.only() was called with flag keys that are not in the evaluation set and will be dropped: ${n.join(", ")}`),this._cloneWith(r)}get keys(){return Object.keys(this._flags)}_getEventProperties(){let t={},r=[];for(let[n,i]of Object.entries(this._flags)){let o=i.enabled===!1?!1:i.variant??!0;t[`$feature/${n}`]=o,i.enabled&&r.push(n)}return r.length>0&&(r.sort(),t.$active_feature_flags=r),t}_cloneWith(t){return new e({host:this._host,distinctId:this._distinctId,groups:this._groups,disableGeoip:this._disableGeoip,flags:t,requestId:this._requestId,evaluatedAt:this._evaluatedAt,flagDefinitionsLoadedAt:this._flagDefinitionsLoadedAt,errorsWhileComputing:this._errorsWhileComputing,quotaLimited:this._quotaLimited,accessed:new Set(this._accessed),isSlice:!0})}_recordAccess(t){if(this._accessed.add(t),this._distinctId===""||this._isSlice&&!(t in this._flags))return;let r=this._flags[t],n=r===void 0?void 0:r.enabled===!1?!1:r.variant??!0,i={$feature_flag:t,$feature_flag_response:n,$feature_flag_id:r?.id,$feature_flag_version:r?.version,$feature_flag_reason:r?.reason,locally_evaluated:r?.locallyEvaluated??!1,[`$feature/${t}`]:n,$feature_flag_request_id:this._requestId,$feature_flag_evaluated_at:r?.locallyEvaluated?Date.now():this._evaluatedAt};r?.locallyEvaluated&&this._flagDefinitionsLoadedAt!==void 0&&(i.$feature_flag_definitions_loaded_at=this._flagDefinitionsLoadedAt);let o=[];this._errorsWhileComputing&&o.push(Rde.ERRORS_WHILE_COMPUTING),this._quotaLimited&&o.push(Rde.QUOTA_LIMITED),r===void 0&&o.push(Rde.FLAG_MISSING),o.length>0&&(i.$feature_flag_error=o.join(",")),this._host.captureFlagCalledEventIfNeeded({distinctId:this._distinctId,key:t,response:n,groups:this._groups,disableGeoip:this._disableGeoip,properties:i})}};async function CUu(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var izm=6e4,ozm=1152921504606847e3,szm=["is_not","is_set"],Jst=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},Kd=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},xte=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},_Kr=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let c=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,c)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(u){u instanceof xte||u instanceof Kd?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${t}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${u}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(c=>this.featureFlagsByKey[c]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async c=>{try{let{value:u,payload:l}=await this.computeFlagAndPayloadLocally(c,a);n[c.key]=u,l&&(i[c.key]=l)}catch(u){u instanceof xte||u instanceof Kd?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${c.key}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${c.key}: ${u}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(!t.active)return!1;if(t.ensure_experience_continuity)throw new Kd("Flag has experience continuity enabled");let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let u=this.groupTypeMapping[String(c)];if(!u)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new Kd("Flag has unknown group type index");if(!(u in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[u];return await this.matchFeatureFlagProperties(t,i[u],l,r)}{let u=this.getBucketingValueForFlag(t,n,o);if(u===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new Kd(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,u,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new Kd("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new Kd(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new Kd(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new Kd(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let c of s){if(!(c in i)){let l=this.featureFlagsByKey[c];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[c]=p}catch(p){throw new Kd(`Error evaluating flag dependency '${c}' for flag '${o}': ${p}`)}else i[c]=!1;else throw new Kd(`Missing flag dependency '${c}' for flag '${o}'`)}if(i[c]==null)throw new Kd(`Dependency '${c}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=o.aggregation_group_type_index,{groups:c,groupProperties:u}=i,l=!1,p;for(let d of s)try{let f=d.aggregation_group_type_index!==void 0?d.aggregation_group_type_index:a,m=n,g=r;if(f!==a&&f!=null){let A=this.groupTypeMapping[String(f)];if(!A||!(A in c)){this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Skipping group condition for flag '${t.key}': group type index ${f} not available`));continue}if(!(A in u)){l=!0;continue}m=u[A],g=c[A]}if(await this.isConditionMatch(t,g,d,m,i)){let A=d.variant,y=o.multivariate?.variants||[];p=A&&y.some(E=>E.key===A)?A:await this.getMatchingVariant(t,g)||!0;break}}catch(f){if(f instanceof xte)throw f;if(f instanceof Kd)l=!0;else throw f}if(p!==void 0)return p;if(l)throw new Kd("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let u=c.type,l=!1;if(l=u==="cohort"?await PUu(c,i,this.cohorts,this.debugMode,p=>this.evaluateFlagDependency(p,i,o)):u==="flag"?await this.evaluateFlagDependency(c,i,o):OUu(c,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await wUu(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await wUu(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(izm,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new Jst(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new Jst(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new Jst(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof Jst&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/flags/definitions?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=Ite(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function wUu(e,t,r=""){let n=await CUu(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/ozm}function OUu(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")return!1}else{if(o==="is_not_set")return!0;throw new Kd(`Property ${n} not found in propertyValues`)}let s=t[n];if(s==null&&!szm.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(u,l){return Array.isArray(u)?u.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(u).toLowerCase()===String(l).toLowerCase()}function c(u,l,p){if(p==="gt")return u>l;if(p==="gte")return u>=l;if(p==="lt")return u<l;if(p==="lte")return u<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return SUu(String(i))&&String(s).match(String(i))!==null;case"not_regex":return SUu(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:parseFloat(String(i)),l;return l=typeof s=="number"?s:s!=null?parseFloat(String(s)):NaN,Number.isFinite(u)&&Number.isFinite(l)?c(l,u,o):c(String(s),String(i),o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new Kd("Date operations cannot be performed on boolean values");let u=pzm(String(i));if(u==null&&(u=TUu(i)),u==null)throw new Kd(`Invalid date: ${i}`);let l=TUu(s);return["is_date_before"].includes(o)?l<u:l>u}case"semver_eq":return E5(rB(String(s)),rB(String(i)))===0;case"semver_neq":return E5(rB(String(s)),rB(String(i)))!==0;case"semver_gt":return E5(rB(String(s)),rB(String(i)))>0;case"semver_gte":return E5(rB(String(s)),rB(String(i)))>=0;case"semver_lt":return E5(rB(String(s)),rB(String(i)))<0;case"semver_lte":return E5(rB(String(s)),rB(String(i)))<=0;case"semver_tilde":{let u=rB(String(s)),{lower:l,upper:p}=czm(String(i));return E5(u,l)>=0&&E5(u,p)<0}case"semver_caret":{let u=rB(String(s)),{lower:l,upper:p}=uzm(String(i));return E5(u,l)>=0&&E5(u,p)<0}case"semver_wildcard":{let u=rB(String(s)),{lower:l,upper:p}=lzm(String(i));return E5(u,l)>=0&&E5(u,p)<0}default:throw new Kd(`Unknown operator: ${o}`)}}function azm(e,t){if(!(e in t))throw new xte(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}async function PUu(e,t,r,n=!1,i){let o=String(e.value);azm(o,r);let s=r[o];return BUu(s,t,r,n,i)}async function BUu(e,t,r,n=!1,i){if(!e)return!0;let o=e.type,s=e.values;if(!s||s.length===0)return!0;let a=!1;if("values"in s[0]){for(let c of s)try{let u=await BUu(c,t,r,n,i);if(o==="AND"){if(!u)return!1}else if(u)return!0}catch(u){if(u instanceof xte)throw u;if(u instanceof Kd)n&&console.debug(`Failed to compute property ${c} locally: ${u}`),a=!0;else throw u}if(a)throw new Kd("Can't match cohort without a given cohort property value");return o==="AND"}for(let c of s)try{let u;if(c.type==="cohort")u=await PUu(c,t,r,n,i);else if(c.type==="flag"){if(!i)throw new Kd(`Flag dependency '${c.key||"unknown"}' cannot be evaluated without a flag dependency evaluator`);u=await i(c)}else u=OUu(c,t);let l=c.negation||!1;if(o==="AND"){if(!u&&!l||u&&l)return!1}else if(u&&!l||!u&&l)return!0}catch(u){if(u instanceof xte)throw u;if(u instanceof Kd)n&&console.debug(`Failed to compute property ${c} locally: ${u}`),a=!0;else throw u}if(a)throw new Kd("can't match cohort without a given cohort property value");return o==="AND"}function SUu(e){try{return new RegExp(e),!0}catch{return!1}}function DUu(e,t){if(!/^\d+$/.test(e))throw new Kd(`Invalid semver: ${t}`);if(e.length>1&&e[0]==="0")throw new Kd(`Invalid semver: ${t}`);return parseInt(e,10)}function rB(e){let r=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!r||r.startsWith("."))throw new Kd(`Invalid semver: ${e}`);let n=r.split("."),i=c=>c===void 0||c===""?0:DUu(c,e),o=i(n[0]),s=i(n[1]),a=i(n[2]);return[o,s,a]}function E5(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0}function czm(e){let t=rB(e),r=[t[0],t[1],t[2]],n=[t[0],t[1]+1,0];return{lower:r,upper:n}}function uzm(e){let t=rB(e),[r,n,i]=t,o=[r,n,i],s;return s=r>0?[r+1,0,0]:n>0?[0,n+1,0]:[0,0,i+1],{lower:o,upper:s}}function lzm(e){let r=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!r)throw new Kd(`Invalid wildcard semver: ${e}`);let n=r.split("."),i=c=>{try{return DUu(c,e)}catch{throw new Kd(`Invalid wildcard semver: ${e}`)}},o=i(n[0]),s,a;if(n.length===1)s=[o,0,0],a=[o+1,0,0];else{let c=i(n[1]);s=[o,c,0],a=[o,c+1,0]}return{lower:s,upper:a}}function TUu(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new Kd(`${e} is in an invalid date format`)}throw new Kd(`The date provided ${e} must be a string, number, or date object`)}function pzm(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var GKr=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var fzm=100,RUu=3e4,dzm=5e4,mzm=50,hzm=500,gzm="https://us.i.posthog.com",kUu=new Set;function qKr(e,t){kUu.has(e)||(kUu.add(e),console.warn(`[PostHog] ${t}`))}function Azm(e){return typeof e=="string"?e.trim():""}function yzm(e){return(typeof e=="string"?e.trim():"")||void 0}function bzm(e){return(typeof e=="string"?e.trim():"")||gzm}function Ezm(e){if(!e)return{};let t={};for(let[n,i]of Object.entries(e))t[`$feature/${n}`]=i;let r=Object.keys(e).filter(n=>e[n]!==!1).sort();return r.length>0&&(t.$active_feature_flags=r),t}var WKr=class extends a8t{constructor(t,r={}){let n=Azm(t),i={...r,host:bzm(r.host),personalApiKey:yzm(r.personalApiKey)};if(super(n,i),this._memoryStorage=new GKr,this.options=i,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof i.featureFlagsPollingInterval=="number"?Math.max(i.featureFlagsPollingInterval,fzm):RUu,typeof i.waitUntilDebounceMs=="number"&&(this.options.waitUntilDebounceMs=Math.max(i.waitUntilDebounceMs,0)),typeof i.waitUntilMaxWaitMs=="number"&&(this.options.waitUntilMaxWaitMs=Math.max(i.waitUntilMaxWaitMs,0)),i.personalApiKey){if(i.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');i.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new _Kr({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:i.personalApiKey,projectApiKey:n,timeout:i.requestTimeout??1e4,host:this.host,fetch:i.fetch,onError:s=>{this._events.emit("error",s)},onLoad:s=>{this._events.emit("localEvaluationFlagsLoaded",s)},customHeaders:this.getCustomHeaders(),cacheProvider:i.flagDefinitionCacheProvider,strictLocalEvaluation:i.strictLocalEvaluation}))}this.errorTracking=new $H(this,i,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=i.maxCacheSize||dzm}enqueue(t,r,n){super.enqueue(t,r,n),this.scheduleDebouncedFlush()}async flush(){let t=super.flush(),r=this.options.waitUntil;if(r&&!this._waitUntilCycle)try{r(t.catch(()=>{}))}catch{}return t}scheduleDebouncedFlush(){let t=this.options.waitUntil;if(!t||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let s,a=new Promise(c=>{s=c});try{t(a)}catch{return}this._waitUntilCycle={resolve:s,startedAt:Date.now(),timer:void 0}}let r=Date.now()-this._waitUntilCycle.startedAt,n=this.options.waitUntilMaxWaitMs??hzm,i=r>=n;if(this._waitUntilCycle.timer!==void 0&&clearTimeout(this._waitUntilCycle.timer),i)return void this.resolveWaitUntilFlush();let o=this.options.waitUntilDebounceMs??mzm;this._waitUntilCycle.timer=Ite(()=>{this.resolveWaitUntilFlush()},o)}_consumeWaitUntilCycle(){let t=this._waitUntilCycle;return t&&(clearTimeout(t.timer),this._waitUntilCycle=void 0),t?.resolve}async resolveWaitUntilFlush(){let t=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{t?.()}}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):fetch(t,r)}getLibraryVersion(){return xUu}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};await super.identifyStatelessImmediate(t,l,{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=RUu){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let O=this._flagOverrides[t];if(O===void 0)return;let D=this._payloadOverrides?.[t];return{key:t,enabled:O!==!1,variant:typeof O=="string"?O:void 0,payload:D}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f,m=!1,g,A,y,E,x,v;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let O=this.featureFlagsPoller?.featureFlagsByKey[t];if(O)try{let D=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(O,d,{matchValue:i});if(D){m=!0;let R=D.value;E=O.id,v="Evaluated locally",f={key:t,enabled:R!==!1,variant:typeof R=="string"?R:void 0,payload:D.payload??void 0}}}catch(D){if(D instanceof xte||D instanceof Kd)this._logger?.info(`${D.name} when computing flag locally: ${t}: ${D.message}`);else throw D}}if(!m&&!c){let O=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(O===void 0)y=Rde.UNKNOWN_ERROR;else{g=O.requestId,A=O.evaluatedAt;let D=[];O.errorsWhileComputingFlags&&D.push(Rde.ERRORS_WHILE_COMPUTING),O.quotaLimited?.includes("feature_flags")&&D.push(Rde.QUOTA_LIMITED);let R=O.flags[t];if(R===void 0)D.push(Rde.FLAG_MISSING);else{E=R.metadata?.id,x=R.metadata?.version,v=R.reason?.description??R.reason?.code;let P;if(R.metadata?.payload!==void 0)try{P=JSON.parse(R.metadata.payload)}catch{P=R.metadata.payload}f={key:t,enabled:R.enabled,variant:R.variant,payload:P}}D.length>0&&(y=D.join(","))}}if(o){let O=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,D={$feature_flag:t,$feature_flag_response:O,$feature_flag_id:E,$feature_flag_version:x,$feature_flag_reason:v,locally_evaluated:m,[`$feature/${t}`]:O,$feature_flag_request_id:g,$feature_flag_evaluated_at:m?Date.now():A};if(m&&this.featureFlagsPoller){let R=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();R!==void 0&&(D.$feature_flag_definitions_loaded_at=R)}y&&(D.$feature_flag_error=y),this._captureFlagCalledEventIfNeeded({distinctId:r,key:t,response:O,groups:s,disableGeoip:a,properties:D})}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){qKr("getFeatureFlag","`getFeatureFlag` is deprecated and will be removed in a future major version. Use `posthog.evaluateFlags(distinctId, ...)` and call `flags.getFlag(key)` instead \u2014 this consolidates flag evaluation into a single `/flags` request per incoming request.");let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(qKr("getFeatureFlagPayload","`getFeatureFlagPayload` is deprecated and will be removed in a future major version. Use `posthog.evaluateFlags(distinctId, ...)` and call `flags.getFlagPayload(key)` instead \u2014 this consolidates flag evaluation into a single `/flags` request per incoming request."),this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){qKr("isFeatureEnabled","`isFeatureEnabled` is deprecated and will be removed in a future major version. Use `posthog.evaluateFlags(distinctId, ...)` and call `flags.isEnabled(key)` instead \u2014 this consolidates flag evaluation into a single `/flags` request per incoming request.");let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});return i===void 0?void 0:i.enabled===!1?!1:!!(i.variant??!0)||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},g={},A=!0;if(f&&(m=f.response,g=f.payloads,A=f.fallbackToFlags),A&&!c){let y=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...y.flags||{}},g={...g,...y.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(g={...g,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:g}}async evaluateFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to evaluate feature flags \u2014 pass it explicitly or use withContext()"),new Kst({host:this._getFeatureFlagEvaluationsHost(),distinctId:"",flags:{}});let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f={},m,g,A=!1,y=!1,E=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),x=new Set;if(E)for(let[C,O]of Object.entries(E.response)){let D=this.featureFlagsPoller?.featureFlagsByKey[C];f[C]={key:C,enabled:O!==!1,variant:typeof O=="string"?O:void 0,payload:E.payloads[C],id:D?.id,version:void 0,reason:"Evaluated locally",locallyEvaluated:!0},x.add(C)}if((E?E.fallbackToFlags:!0)&&!c){let C=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);if(C){m=C.requestId,g=C.evaluatedAt,A=!!C.errorsWhileComputingFlags,y=Array.isArray(C.quotaLimited)&&C.quotaLimited.includes("feature_flags");for(let[O,D]of Object.entries(C.flags)){if(x.has(O))continue;let R;if(D.metadata?.payload!==void 0)try{R=JSON.parse(D.metadata.payload)}catch{R=D.metadata.payload}f[O]={key:O,enabled:D.enabled,variant:D.variant,payload:R,id:D.metadata?.id,version:D.metadata?.version,reason:D.reason?.description??D.reason?.code,locallyEvaluated:!1}}}}if(this._flagOverrides!==void 0)for(let[C,O]of Object.entries(this._flagOverrides)){if(O===void 0){delete f[C];continue}let D=f[C];f[C]={key:C,enabled:O!==!1,variant:typeof O=="string"?O:void 0,payload:D?.payload,id:D?.id,version:D?.version,reason:D?.reason,locallyEvaluated:D?.locallyEvaluated??!1}}if(this._payloadOverrides!==void 0)for(let[C,O]of Object.entries(this._payloadOverrides)){let D=f[C];D&&(f[C]={...D,payload:O})}return new Kst({host:this._getFeatureFlagEvaluationsHost(),distinctId:n,groups:o,disableGeoip:s,flags:f,requestId:m,evaluatedAt:g,flagDefinitionsLoadedAt:this.featureFlagsPoller?.getFlagDefinitionsLoadedAt(),errorsWhileComputing:A,quotaLimited:y})}_captureFlagCalledEventIfNeeded(t){let{distinctId:r,key:n,response:i,groups:o,disableGeoip:s,properties:a}=t,c=`${n}_${i}`;r in this.distinctIdHasSentFlagCalls&&this.distinctIdHasSentFlagCalls[r].includes(c)||(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(c):this.distinctIdHasSentFlagCalls[r]=[c],this.capture({distinctId:r,event:"$feature_flag_called",properties:a,groups:o,disableGeoip:s}))}_getFeatureFlagEvaluationsHost(){return this._featureFlagEvaluationsHost||(this._featureFlagEvaluationsHost={captureFlagCalledEventIfNeeded:t=>this._captureFlagCalledEventIfNeeded(t),logWarning:t=>{this.options.featureFlagsLogWarnings!==!1&&console.warn(`[PostHog] ${t}`)}}),this._featureFlagEvaluationsHost}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){let r=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown();try{return await super._shutdown(t)}finally{r?.()}}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=Ite(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(zVu(s)&&r&&o in r){let a={};for(let[c,u]of Object.entries(s))a[String(c)]=String(u);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i,o){if(!$H.isPreviouslyCapturedError(t)){let s=new Error("PostHog syntheticException");this.addPendingPromise($H.buildEventMessage(t,{syntheticException:s},r,n).then(a=>this.capture({...a,uuid:i,flags:o})))}}async captureExceptionImmediate(t,r,n,i){if(!$H.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");return this.addPendingPromise($H.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.captureImmediate({...s,flags:i})))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,flags:s,sendFeatureFlags:a,timestamp:c,disableGeoip:u,uuid:l}=t,p=this.context?.get(),d=r||p?.distinctId,f={...this.props,...p?.properties||{},...i||{}};d||(d=Ete(),f.$process_person_profile=!1),p?.sessionId&&!f.$session_id&&(f.$session_id=p.sessionId);let m=this._runBeforeSend({distinctId:d,event:n,properties:f,groups:o,flags:s,sendFeatureFlags:a,timestamp:c,disableGeoip:u,uuid:l});if(!m)return Promise.reject(null);let g=await Promise.resolve().then(async()=>{if(s)return a&&console.warn("[PostHog] Both `flags` and `sendFeatureFlags` were passed to capture(); using `flags` and ignoring `sendFeatureFlags`."),s._getEventProperties();if(a){qKr("sendFeatureFlags","`sendFeatureFlags` is deprecated and will be removed in a future major version. Pass a `flags` snapshot from `posthog.evaluateFlags(...)` instead \u2014 it avoids a second `/flags` request per capture and guarantees the event carries the exact flag values your code branched on.");let A=typeof a=="object"?a:void 0,y=await this.getFeatureFlagsForEvent(m.distinctId,o,u,A);return Ezm(y)}return{}}).catch(()=>({})).then(A=>({...A,...m.properties||{},$groups:m.groups||o}));return m.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof g.$raw_user_agent=="string"&&FVu(g.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(m.event="$bot_pageview",g.$browser_type="bot"),{distinctId:m.distinctId,event:m.event,properties:g,options:{timestamp:m.timestamp,disableGeoip:m.disableGeoip,uuid:m.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var FUu=require("async_hooks"),HKr=class{constructor(){this.storage=new FUu.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var NUu="posthog-node";function Izm(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let c=s.tags[TVo.POSTHOG_ID_TAG];if(c===void 0)return s;let u=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${c}`,u).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(g=>({...g,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:c,properties:f}),s}}var TVo=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=NUu,this.name=NUu,this.setupOnce=function(s,a){let c=a()?.getClient()?.getDsn()?.projectId;s(Izm(t,{organization:r,projectId:c,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};$H.errorPropertiesBuilder=new Tz.ErrorPropertiesBuilder([new Tz.EventCoercer,new Tz.ErrorCoercer,new Tz.ObjectCoercer,new Tz.StringCoercer,new Tz.PrimitiveCoercer],Tz.createStackParser("node:javascript",Tz.nodeStackLineParser),[DVu(),AUu,EUu()]);var uCe=class extends WKr{getLibraryId(){return"posthog-node"}initializeContext(){return new HKr}};var KKr=class{posthog;constructor({posthogApiKey:t}){this.posthog=new uCe(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"5.139.0",usingAccessToken:!0,...fue()}})}sendAutomationEvent(t){this.posthog.capture({distinctId:t.distinctId,event:t.event,properties:t.properties})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}};var u8t=class{async sendEvent(){}async sendAutomationEvent(){}async identify(){}async flush(){}};bd();Yt();var Yst=require("fs/promises"),jUu=require("os"),QUu=require("path");kit();var vzm="id",xzm=".fern",l8t=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new uCe(r),this.userId=t==null?void 0:YQo(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"5.139.0",...t,...t.properties,usingAccessToken:!1,agent:IVr(),...r!=null?{userEmail:r}:{},...fue()}})}sendAutomationEvent(t){this.posthog.capture({distinctId:t.distinctId,event:t.event,properties:t.properties})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await jf({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=YD(),r=ze(Mt.of((0,jUu.homedir)()),ve.of(xzm),ve.of(vzm));try{await Jt(r)?this.persistedDistinctId=(await(0,Yst.readFile)(r)).toString():(await(0,Yst.mkdir)((0,QUu.dirname)(r),{recursive:!0}),await(0,Yst.writeFile)(r,t),this.persistedDistinctId=t)}catch{this.persistedDistinctId=t}}return this.persistedDistinctId}};var OVo;async function p8t(){return OVo==null&&(OVo=await Czm()),OVo}async function Czm(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new u8t;let r=await pot();return r!=null?new l8t({token:r,posthogApiKey:e}):await bz()!=null?new KKr({posthogApiKey:e}):new l8t({token:void 0,posthogApiKey:e})}catch{return new u8t}}In();wt();Ft();J_();var f8t=be(require("process"),1);kWe();var LUu=be(BPo(),1),VUu=be(MUu(),1);function fT(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=F7(e),e.length===0))return 0;e=e.replace((0,VUu.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(LUu.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}In();function JKr(e){let t=0;for(let r of e.split(`
3391
+ `);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let c=sUu.test(a)?a.replace(sUu,"$1"):a;if(!c.match(/\S*Error: /)){for(let u of t){let l=u(c,e);if(l){i.push(l);break}}if(i.length>=aUu)break}}return cUu(i)}}var hVo=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=cCe(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return h4e(t,"DOMException")}isDOMError(t){return h4e(t,"DOMError")}};var gVo=class{match(t){return iVo(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var AVo=class{constructor(){}match(t){return QVu(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var MQm=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,yVo=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(MQm);return i&&(r=i[1],n=i[2]),[r,n]}};var lUu=["fatal","error","warning","log","info","debug"];function LKr(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var bVo=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Gst(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=LKr(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return cCe(t)&&!jVu(t)&&lUu.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(XVu(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var EVo=class{match(t){return Gst(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${LKr(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var IVo=class{match(t){return CKr(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var vVo=class{match(t){return h4e(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Gst(t))return!1;try{let r=t.detail;return r!=null&&typeof r=="object"&&"reason"in r}catch{return!1}}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return CKr(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&t.detail!=null&&typeof t.detail=="object"&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var xVo=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var c8t={MESSAGE:"$message",TIMESTAMP:"$timestamp"},LQm=new Set([c8t.MESSAGE,c8t.TIMESTAMP]),VKr={enabled:!0,max_bytes:32768};function CVo(e){return e?{enabled:e.enabled??VKr.enabled,max_bytes:UQm(e.max_bytes,VKr.max_bytes)}:{...VKr}}function VQm(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};let t=[];return{sanitizedProperties:Object.keys(e).reduce((n,i)=>LQm.has(i)?(t.push(i),n):(n[i]=e[i],n),{}),droppedKeys:t}}var wVo=class{constructor(t){this._entries=[],this._totalBytes=0,this._config=CVo(t)}setConfig(t){this._config=CVo(t),this._trimToMaxBytes()}add(t){let r=_Qm(t);if(!r)return;let n=pUu(r.json);n>this._config.max_bytes||(this._entries.push({step:r.step,bytes:n}),this._totalBytes+=n,this._trimToMaxBytes())}getAttachable(){return this._entries.map(t=>t.step)}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){let t=this._entries.shift();t&&(this._totalBytes-=t.bytes)}}};function UQm(e,t){if(!i8t(e)||e===1/0||e===-1/0)return t;let r=Math.floor(e);return r<0?t:r}function _Qm(e){let t=GQm(e);if(t)try{let r=JSON.parse(t);if(!n8t(r))return;let n=r,i=n[c8t.MESSAGE],o=n[c8t.TIMESTAMP];return!cCe(i)||i.trim().length===0||!cCe(o)&&!i8t(o)?void 0:{step:n,json:t}}catch{return}}function GQm(e){let t=new WeakSet;try{return JSON.stringify(e,(r,n)=>{if(typeof n=="bigint")return n.toString();if(!(typeof n=="function"||typeof n=="symbol")){if(n instanceof Date)return n.toISOString();if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n=="object"){if(t.has(n))return"[Circular]";t.add(n)}return n}})}catch{return}}function pUu(e){if(typeof TextEncoder<"u")return new TextEncoder().encode(e).length;let t=encodeURIComponent(e),r=0;for(let n=0;n<t.length;n++)t[n]==="%"?(r+=1,n+=2):r+=1;return r}var mUu=require("fs"),hUu=require("readline"),UKr=new Tz.ReduceableCache(25),gUu=new Tz.ReduceableCache(20),SVo=7,qQm=1e3,WQm=1e4;async function AUu(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||YQm(s)||XQm(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(gUu.get(i))continue;let o=t[i];if(!o)continue;o.sort((c,u)=>c-u);let s=$Qm(o);if(s.every(c=>ZQm(i,c)))continue;let a=ezm(UKr,i,{});n.push(HQm(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&KQm(e,UKr),UKr.reduce(),e}function HQm(e,t,r){return new Promise(n=>{let i=(0,mUu.createReadStream)(e),o=(0,hUu.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,c=0,u=t[c];if(u===void 0)return void s();let l=u[0],p=u[1];function d(){gUu.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=tzm(f,0),a>=p)){if(c===t.length-1){o.close(),o.removeAllListeners();return}c++;let m=t[c];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function KQm(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;JQm(r.lineno,r,n)}}function JQm(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=yUu(e);i<e;i++){let o=r[i];if(o===void 0)return void fUu(t);t.pre_context.push(o)}if(r[e]===void 0)return void fUu(t);t.context_line=r[e];let n=bUu(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function fUu(e){delete e.pre_context,delete e.context_line,delete e.post_context}function YQm(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function XQm(e){return e.lineno!==void 0&&e.lineno>WQm||e.colno!==void 0&&e.colno>qQm}function ZQm(e,t){let r=UKr.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function $Qm(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=dUu(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+SVo:(i.push(n),n=dUu(o)),t++}return i}function dUu(e){return[yUu(e),bUu(e)]}function yUu(e){return Math.max(1,e-SVo)}function bUu(e){return e+SVo}function ezm(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function tzm(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}var Hst=require("path");function EUu(e=process.cwd()){let t=Hst.sep==="\\",r=i=>t?i.replace(/\\/g,"/"):i,n=r(e);return async i=>{for(let o of i)!o.filename||o.filename.startsWith("node:")||o.filename.startsWith("data:")||(0,Hst.isAbsolute)(o.filename)&&(o.filename=r((0,Hst.relative)(n,r(o.filename))));return i}}function rzm(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function IUu(e,t){globalThis.process?.on("uncaughtException",rzm(e,t))}function vUu(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var nzm=2e3,$H=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new wKr({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return n8t(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i},s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n,properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(IUu(this.onException.bind(this),this.onFatalError.bind(this)),vUu(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(nzm),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var xUu="5.35.1";var Rde={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};var Kst=class e{constructor(t){this._host=t.host,this._distinctId=t.distinctId,this._groups=t.groups,this._disableGeoip=t.disableGeoip,this._flags=t.flags,this._requestId=t.requestId,this._evaluatedAt=t.evaluatedAt,this._flagDefinitionsLoadedAt=t.flagDefinitionsLoadedAt,this._errorsWhileComputing=t.errorsWhileComputing??!1,this._quotaLimited=t.quotaLimited??!1,this._accessed=t.accessed??new Set,this._isSlice=t.isSlice??!1}isEnabled(t){let r=this._flags[t];return this._recordAccess(t),r?.enabled??!1}getFlag(t){let r=this._flags[t];if(this._recordAccess(t),!!r)return r.enabled?r.variant??!0:!1}getFlagPayload(t){return this._flags[t]?.payload}onlyAccessed(){let t={};for(let r of this._accessed){let n=this._flags[r];n&&(t[r]=n)}return this._cloneWith(t)}only(t){let r={},n=[];for(let i of t){let o=this._flags[i];o?r[i]=o:n.push(i)}return n.length>0&&this._host.logWarning(`FeatureFlagEvaluations.only() was called with flag keys that are not in the evaluation set and will be dropped: ${n.join(", ")}`),this._cloneWith(r)}get keys(){return Object.keys(this._flags)}_getEventProperties(){let t={},r=[];for(let[n,i]of Object.entries(this._flags)){let o=i.enabled===!1?!1:i.variant??!0;t[`$feature/${n}`]=o,i.enabled&&r.push(n)}return r.length>0&&(r.sort(),t.$active_feature_flags=r),t}_cloneWith(t){return new e({host:this._host,distinctId:this._distinctId,groups:this._groups,disableGeoip:this._disableGeoip,flags:t,requestId:this._requestId,evaluatedAt:this._evaluatedAt,flagDefinitionsLoadedAt:this._flagDefinitionsLoadedAt,errorsWhileComputing:this._errorsWhileComputing,quotaLimited:this._quotaLimited,accessed:new Set(this._accessed),isSlice:!0})}_recordAccess(t){if(this._accessed.add(t),this._distinctId===""||this._isSlice&&!(t in this._flags))return;let r=this._flags[t],n=r===void 0?void 0:r.enabled===!1?!1:r.variant??!0,i={$feature_flag:t,$feature_flag_response:n,$feature_flag_id:r?.id,$feature_flag_version:r?.version,$feature_flag_reason:r?.reason,locally_evaluated:r?.locallyEvaluated??!1,[`$feature/${t}`]:n,$feature_flag_request_id:this._requestId,$feature_flag_evaluated_at:r?.locallyEvaluated?Date.now():this._evaluatedAt};r?.locallyEvaluated&&this._flagDefinitionsLoadedAt!==void 0&&(i.$feature_flag_definitions_loaded_at=this._flagDefinitionsLoadedAt);let o=[];this._errorsWhileComputing&&o.push(Rde.ERRORS_WHILE_COMPUTING),this._quotaLimited&&o.push(Rde.QUOTA_LIMITED),r===void 0&&o.push(Rde.FLAG_MISSING),o.length>0&&(i.$feature_flag_error=o.join(",")),this._host.captureFlagCalledEventIfNeeded({distinctId:this._distinctId,key:t,response:n,groups:this._groups,disableGeoip:this._disableGeoip,properties:i})}};async function CUu(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var izm=6e4,ozm=1152921504606847e3,szm=["is_not","is_set"],Jst=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},Kd=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},xte=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},_Kr=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let c=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,c)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(u){u instanceof xte||u instanceof Kd?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${t}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${u}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(c=>this.featureFlagsByKey[c]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async c=>{try{let{value:u,payload:l}=await this.computeFlagAndPayloadLocally(c,a);n[c.key]=u,l&&(i[c.key]=l)}catch(u){u instanceof xte||u instanceof Kd?this.logMsgIfDebug(()=>console.debug(`${u.name} when computing flag locally: ${c.key}: ${u.message}`)):u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${c.key}: ${u}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(!t.active)return!1;if(t.ensure_experience_continuity)throw new Kd("Flag has experience continuity enabled");let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let u=this.groupTypeMapping[String(c)];if(!u)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new Kd("Flag has unknown group type index");if(!(u in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[u];return await this.matchFeatureFlagProperties(t,i[u],l,r)}{let u=this.getBucketingValueForFlag(t,n,o);if(u===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new Kd(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,u,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new Kd("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new Kd(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new Kd(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new Kd(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let c of s){if(!(c in i)){let l=this.featureFlagsByKey[c];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[c]=p}catch(p){throw new Kd(`Error evaluating flag dependency '${c}' for flag '${o}': ${p}`)}else i[c]=!1;else throw new Kd(`Missing flag dependency '${c}' for flag '${o}'`)}if(i[c]==null)throw new Kd(`Dependency '${c}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=o.aggregation_group_type_index,{groups:c,groupProperties:u}=i,l=!1,p;for(let d of s)try{let f=d.aggregation_group_type_index!==void 0?d.aggregation_group_type_index:a,m=n,g=r;if(f!==a&&f!=null){let A=this.groupTypeMapping[String(f)];if(!A||!(A in c)){this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Skipping group condition for flag '${t.key}': group type index ${f} not available`));continue}if(!(A in u)){l=!0;continue}m=u[A],g=c[A]}if(await this.isConditionMatch(t,g,d,m,i)){let A=d.variant,y=o.multivariate?.variants||[];p=A&&y.some(E=>E.key===A)?A:await this.getMatchingVariant(t,g)||!0;break}}catch(f){if(f instanceof xte)throw f;if(f instanceof Kd)l=!0;else throw f}if(p!==void 0)return p;if(l)throw new Kd("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let u=c.type,l=!1;if(l=u==="cohort"?await PUu(c,i,this.cohorts,this.debugMode,p=>this.evaluateFlagDependency(p,i,o)):u==="flag"?await this.evaluateFlagDependency(c,i,o):OUu(c,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await wUu(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await wUu(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(izm,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new Jst(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new Jst(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new Jst(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof Jst&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/flags/definitions?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=Ite(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function wUu(e,t,r=""){let n=await CUu(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/ozm}function OUu(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")return!1}else{if(o==="is_not_set")return!0;throw new Kd(`Property ${n} not found in propertyValues`)}let s=t[n];if(s==null&&!szm.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(u,l){return Array.isArray(u)?u.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(u).toLowerCase()===String(l).toLowerCase()}function c(u,l,p){if(p==="gt")return u>l;if(p==="gte")return u>=l;if(p==="lt")return u<l;if(p==="lte")return u<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return SUu(String(i))&&String(s).match(String(i))!==null;case"not_regex":return SUu(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:parseFloat(String(i)),l;return l=typeof s=="number"?s:s!=null?parseFloat(String(s)):NaN,Number.isFinite(u)&&Number.isFinite(l)?c(l,u,o):c(String(s),String(i),o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new Kd("Date operations cannot be performed on boolean values");let u=pzm(String(i));if(u==null&&(u=TUu(i)),u==null)throw new Kd(`Invalid date: ${i}`);let l=TUu(s);return["is_date_before"].includes(o)?l<u:l>u}case"semver_eq":return E5(rB(String(s)),rB(String(i)))===0;case"semver_neq":return E5(rB(String(s)),rB(String(i)))!==0;case"semver_gt":return E5(rB(String(s)),rB(String(i)))>0;case"semver_gte":return E5(rB(String(s)),rB(String(i)))>=0;case"semver_lt":return E5(rB(String(s)),rB(String(i)))<0;case"semver_lte":return E5(rB(String(s)),rB(String(i)))<=0;case"semver_tilde":{let u=rB(String(s)),{lower:l,upper:p}=czm(String(i));return E5(u,l)>=0&&E5(u,p)<0}case"semver_caret":{let u=rB(String(s)),{lower:l,upper:p}=uzm(String(i));return E5(u,l)>=0&&E5(u,p)<0}case"semver_wildcard":{let u=rB(String(s)),{lower:l,upper:p}=lzm(String(i));return E5(u,l)>=0&&E5(u,p)<0}default:throw new Kd(`Unknown operator: ${o}`)}}function azm(e,t){if(!(e in t))throw new xte(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}async function PUu(e,t,r,n=!1,i){let o=String(e.value);azm(o,r);let s=r[o];return BUu(s,t,r,n,i)}async function BUu(e,t,r,n=!1,i){if(!e)return!0;let o=e.type,s=e.values;if(!s||s.length===0)return!0;let a=!1;if("values"in s[0]){for(let c of s)try{let u=await BUu(c,t,r,n,i);if(o==="AND"){if(!u)return!1}else if(u)return!0}catch(u){if(u instanceof xte)throw u;if(u instanceof Kd)n&&console.debug(`Failed to compute property ${c} locally: ${u}`),a=!0;else throw u}if(a)throw new Kd("Can't match cohort without a given cohort property value");return o==="AND"}for(let c of s)try{let u;if(c.type==="cohort")u=await PUu(c,t,r,n,i);else if(c.type==="flag"){if(!i)throw new Kd(`Flag dependency '${c.key||"unknown"}' cannot be evaluated without a flag dependency evaluator`);u=await i(c)}else u=OUu(c,t);let l=c.negation||!1;if(o==="AND"){if(!u&&!l||u&&l)return!1}else if(u&&!l||!u&&l)return!0}catch(u){if(u instanceof xte)throw u;if(u instanceof Kd)n&&console.debug(`Failed to compute property ${c} locally: ${u}`),a=!0;else throw u}if(a)throw new Kd("can't match cohort without a given cohort property value");return o==="AND"}function SUu(e){try{return new RegExp(e),!0}catch{return!1}}function DUu(e,t){if(!/^\d+$/.test(e))throw new Kd(`Invalid semver: ${t}`);if(e.length>1&&e[0]==="0")throw new Kd(`Invalid semver: ${t}`);return parseInt(e,10)}function rB(e){let r=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!r||r.startsWith("."))throw new Kd(`Invalid semver: ${e}`);let n=r.split("."),i=c=>c===void 0||c===""?0:DUu(c,e),o=i(n[0]),s=i(n[1]),a=i(n[2]);return[o,s,a]}function E5(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0}function czm(e){let t=rB(e),r=[t[0],t[1],t[2]],n=[t[0],t[1]+1,0];return{lower:r,upper:n}}function uzm(e){let t=rB(e),[r,n,i]=t,o=[r,n,i],s;return s=r>0?[r+1,0,0]:n>0?[0,n+1,0]:[0,0,i+1],{lower:o,upper:s}}function lzm(e){let r=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!r)throw new Kd(`Invalid wildcard semver: ${e}`);let n=r.split("."),i=c=>{try{return DUu(c,e)}catch{throw new Kd(`Invalid wildcard semver: ${e}`)}},o=i(n[0]),s,a;if(n.length===1)s=[o,0,0],a=[o+1,0,0];else{let c=i(n[1]);s=[o,c,0],a=[o,c+1,0]}return{lower:s,upper:a}}function TUu(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new Kd(`${e} is in an invalid date format`)}throw new Kd(`The date provided ${e} must be a string, number, or date object`)}function pzm(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var GKr=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var fzm=100,RUu=3e4,dzm=5e4,mzm=50,hzm=500,gzm="https://us.i.posthog.com",kUu=new Set;function qKr(e,t){kUu.has(e)||(kUu.add(e),console.warn(`[PostHog] ${t}`))}function Azm(e){return typeof e=="string"?e.trim():""}function yzm(e){return(typeof e=="string"?e.trim():"")||void 0}function bzm(e){return(typeof e=="string"?e.trim():"")||gzm}function Ezm(e){if(!e)return{};let t={};for(let[n,i]of Object.entries(e))t[`$feature/${n}`]=i;let r=Object.keys(e).filter(n=>e[n]!==!1).sort();return r.length>0&&(t.$active_feature_flags=r),t}var WKr=class extends a8t{constructor(t,r={}){let n=Azm(t),i={...r,host:bzm(r.host),personalApiKey:yzm(r.personalApiKey)};if(super(n,i),this._memoryStorage=new GKr,this.options=i,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof i.featureFlagsPollingInterval=="number"?Math.max(i.featureFlagsPollingInterval,fzm):RUu,typeof i.waitUntilDebounceMs=="number"&&(this.options.waitUntilDebounceMs=Math.max(i.waitUntilDebounceMs,0)),typeof i.waitUntilMaxWaitMs=="number"&&(this.options.waitUntilMaxWaitMs=Math.max(i.waitUntilMaxWaitMs,0)),i.personalApiKey){if(i.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');i.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new _Kr({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:i.personalApiKey,projectApiKey:n,timeout:i.requestTimeout??1e4,host:this.host,fetch:i.fetch,onError:s=>{this._events.emit("error",s)},onLoad:s=>{this._events.emit("localEvaluationFlagsLoaded",s)},customHeaders:this.getCustomHeaders(),cacheProvider:i.flagDefinitionCacheProvider,strictLocalEvaluation:i.strictLocalEvaluation}))}this.errorTracking=new $H(this,i,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=i.maxCacheSize||dzm}enqueue(t,r,n){super.enqueue(t,r,n),this.scheduleDebouncedFlush()}async flush(){let t=super.flush(),r=this.options.waitUntil;if(r&&!this._waitUntilCycle)try{r(t.catch(()=>{}))}catch{}return t}scheduleDebouncedFlush(){let t=this.options.waitUntil;if(!t||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let s,a=new Promise(c=>{s=c});try{t(a)}catch{return}this._waitUntilCycle={resolve:s,startedAt:Date.now(),timer:void 0}}let r=Date.now()-this._waitUntilCycle.startedAt,n=this.options.waitUntilMaxWaitMs??hzm,i=r>=n;if(this._waitUntilCycle.timer!==void 0&&clearTimeout(this._waitUntilCycle.timer),i)return void this.resolveWaitUntilFlush();let o=this.options.waitUntilDebounceMs??mzm;this._waitUntilCycle.timer=Ite(()=>{this.resolveWaitUntilFlush()},o)}_consumeWaitUntilCycle(){let t=this._waitUntilCycle;return t&&(clearTimeout(t.timer),this._waitUntilCycle=void 0),t?.resolve}async resolveWaitUntilFlush(){let t=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{t?.()}}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):fetch(t,r)}getLibraryVersion(){return xUu}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};await super.identifyStatelessImmediate(t,l,{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=RUu){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let O=this._flagOverrides[t];if(O===void 0)return;let D=this._payloadOverrides?.[t];return{key:t,enabled:O!==!1,variant:typeof O=="string"?O:void 0,payload:D}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f,m=!1,g,A,y,E,x,v;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let O=this.featureFlagsPoller?.featureFlagsByKey[t];if(O)try{let D=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(O,d,{matchValue:i});if(D){m=!0;let R=D.value;E=O.id,v="Evaluated locally",f={key:t,enabled:R!==!1,variant:typeof R=="string"?R:void 0,payload:D.payload??void 0}}}catch(D){if(D instanceof xte||D instanceof Kd)this._logger?.info(`${D.name} when computing flag locally: ${t}: ${D.message}`);else throw D}}if(!m&&!c){let O=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(O===void 0)y=Rde.UNKNOWN_ERROR;else{g=O.requestId,A=O.evaluatedAt;let D=[];O.errorsWhileComputingFlags&&D.push(Rde.ERRORS_WHILE_COMPUTING),O.quotaLimited?.includes("feature_flags")&&D.push(Rde.QUOTA_LIMITED);let R=O.flags[t];if(R===void 0)D.push(Rde.FLAG_MISSING);else{E=R.metadata?.id,x=R.metadata?.version,v=R.reason?.description??R.reason?.code;let P;if(R.metadata?.payload!==void 0)try{P=JSON.parse(R.metadata.payload)}catch{P=R.metadata.payload}f={key:t,enabled:R.enabled,variant:R.variant,payload:P}}D.length>0&&(y=D.join(","))}}if(o){let O=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,D={$feature_flag:t,$feature_flag_response:O,$feature_flag_id:E,$feature_flag_version:x,$feature_flag_reason:v,locally_evaluated:m,[`$feature/${t}`]:O,$feature_flag_request_id:g,$feature_flag_evaluated_at:m?Date.now():A};if(m&&this.featureFlagsPoller){let R=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();R!==void 0&&(D.$feature_flag_definitions_loaded_at=R)}y&&(D.$feature_flag_error=y),this._captureFlagCalledEventIfNeeded({distinctId:r,key:t,response:O,groups:s,disableGeoip:a,properties:D})}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){qKr("getFeatureFlag","`getFeatureFlag` is deprecated and will be removed in a future major version. Use `posthog.evaluateFlags(distinctId, ...)` and call `flags.getFlag(key)` instead \u2014 this consolidates flag evaluation into a single `/flags` request per incoming request.");let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(qKr("getFeatureFlagPayload","`getFeatureFlagPayload` is deprecated and will be removed in a future major version. Use `posthog.evaluateFlags(distinctId, ...)` and call `flags.getFlagPayload(key)` instead \u2014 this consolidates flag evaluation into a single `/flags` request per incoming request."),this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){qKr("isFeatureEnabled","`isFeatureEnabled` is deprecated and will be removed in a future major version. Use `posthog.evaluateFlags(distinctId, ...)` and call `flags.isEnabled(key)` instead \u2014 this consolidates flag evaluation into a single `/flags` request per incoming request.");let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});return i===void 0?void 0:i.enabled===!1?!1:!!(i.variant??!0)||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},g={},A=!0;if(f&&(m=f.response,g=f.payloads,A=f.fallbackToFlags),A&&!c){let y=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...y.flags||{}},g={...g,...y.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(g={...g,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:g}}async evaluateFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to evaluate feature flags \u2014 pass it explicitly or use withContext()"),new Kst({host:this._getFeatureFlagEvaluationsHost(),distinctId:"",flags:{}});let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:c,personProperties:u,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,u,l);u=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,u,l);c==null&&(c=this.options.strictLocalEvaluation??!1);let f={},m,g,A=!1,y=!1,E=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),x=new Set;if(E)for(let[C,O]of Object.entries(E.response)){let D=this.featureFlagsPoller?.featureFlagsByKey[C];f[C]={key:C,enabled:O!==!1,variant:typeof O=="string"?O:void 0,payload:E.payloads[C],id:D?.id,version:void 0,reason:"Evaluated locally",locallyEvaluated:!0},x.add(C)}if((E?E.fallbackToFlags:!0)&&!c){let C=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);if(C){m=C.requestId,g=C.evaluatedAt,A=!!C.errorsWhileComputingFlags,y=Array.isArray(C.quotaLimited)&&C.quotaLimited.includes("feature_flags");for(let[O,D]of Object.entries(C.flags)){if(x.has(O))continue;let R;if(D.metadata?.payload!==void 0)try{R=JSON.parse(D.metadata.payload)}catch{R=D.metadata.payload}f[O]={key:O,enabled:D.enabled,variant:D.variant,payload:R,id:D.metadata?.id,version:D.metadata?.version,reason:D.reason?.description??D.reason?.code,locallyEvaluated:!1}}}}if(this._flagOverrides!==void 0)for(let[C,O]of Object.entries(this._flagOverrides)){if(O===void 0){delete f[C];continue}let D=f[C];f[C]={key:C,enabled:O!==!1,variant:typeof O=="string"?O:void 0,payload:D?.payload,id:D?.id,version:D?.version,reason:D?.reason,locallyEvaluated:D?.locallyEvaluated??!1}}if(this._payloadOverrides!==void 0)for(let[C,O]of Object.entries(this._payloadOverrides)){let D=f[C];D&&(f[C]={...D,payload:O})}return new Kst({host:this._getFeatureFlagEvaluationsHost(),distinctId:n,groups:o,disableGeoip:s,flags:f,requestId:m,evaluatedAt:g,flagDefinitionsLoadedAt:this.featureFlagsPoller?.getFlagDefinitionsLoadedAt(),errorsWhileComputing:A,quotaLimited:y})}_captureFlagCalledEventIfNeeded(t){let{distinctId:r,key:n,response:i,groups:o,disableGeoip:s,properties:a}=t,c=`${n}_${i}`;r in this.distinctIdHasSentFlagCalls&&this.distinctIdHasSentFlagCalls[r].includes(c)||(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(c):this.distinctIdHasSentFlagCalls[r]=[c],this.capture({distinctId:r,event:"$feature_flag_called",properties:a,groups:o,disableGeoip:s}))}_getFeatureFlagEvaluationsHost(){return this._featureFlagEvaluationsHost||(this._featureFlagEvaluationsHost={captureFlagCalledEventIfNeeded:t=>this._captureFlagCalledEventIfNeeded(t),logWarning:t=>{this.options.featureFlagsLogWarnings!==!1&&console.warn(`[PostHog] ${t}`)}}),this._featureFlagEvaluationsHost}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){let r=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown();try{return await super._shutdown(t)}finally{r?.()}}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=Ite(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(zVu(s)&&r&&o in r){let a={};for(let[c,u]of Object.entries(s))a[String(c)]=String(u);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let u={};for(let[l,p]of Object.entries(r||{}))u[l]=String(p);return await this.getAllFlags(t,{groups:u,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i,o){if(!$H.isPreviouslyCapturedError(t)){let s=new Error("PostHog syntheticException");this.addPendingPromise($H.buildEventMessage(t,{syntheticException:s},r,n).then(a=>this.capture({...a,uuid:i,flags:o})))}}async captureExceptionImmediate(t,r,n,i){if(!$H.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");return this.addPendingPromise($H.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.captureImmediate({...s,flags:i})))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,flags:s,sendFeatureFlags:a,timestamp:c,disableGeoip:u,uuid:l}=t,p=this.context?.get(),d=r||p?.distinctId,f={...this.props,...p?.properties||{},...i||{}};d||(d=Ete(),f.$process_person_profile=!1),p?.sessionId&&!f.$session_id&&(f.$session_id=p.sessionId);let m=this._runBeforeSend({distinctId:d,event:n,properties:f,groups:o,flags:s,sendFeatureFlags:a,timestamp:c,disableGeoip:u,uuid:l});if(!m)return Promise.reject(null);let g=await Promise.resolve().then(async()=>{if(s)return a&&console.warn("[PostHog] Both `flags` and `sendFeatureFlags` were passed to capture(); using `flags` and ignoring `sendFeatureFlags`."),s._getEventProperties();if(a){qKr("sendFeatureFlags","`sendFeatureFlags` is deprecated and will be removed in a future major version. Pass a `flags` snapshot from `posthog.evaluateFlags(...)` instead \u2014 it avoids a second `/flags` request per capture and guarantees the event carries the exact flag values your code branched on.");let A=typeof a=="object"?a:void 0,y=await this.getFeatureFlagsForEvent(m.distinctId,o,u,A);return Ezm(y)}return{}}).catch(()=>({})).then(A=>({...A,...m.properties||{},$groups:m.groups||o}));return m.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof g.$raw_user_agent=="string"&&FVu(g.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(m.event="$bot_pageview",g.$browser_type="bot"),{distinctId:m.distinctId,event:m.event,properties:g,options:{timestamp:m.timestamp,disableGeoip:m.disableGeoip,uuid:m.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var FUu=require("async_hooks"),HKr=class{constructor(){this.storage=new FUu.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var NUu="posthog-node";function Izm(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let c=s.tags[TVo.POSTHOG_ID_TAG];if(c===void 0)return s;let u=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${c}`,u).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(g=>({...g,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:c,properties:f}),s}}var TVo=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=NUu,this.name=NUu,this.setupOnce=function(s,a){let c=a()?.getClient()?.getDsn()?.projectId;s(Izm(t,{organization:r,projectId:c,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};$H.errorPropertiesBuilder=new Tz.ErrorPropertiesBuilder([new Tz.EventCoercer,new Tz.ErrorCoercer,new Tz.ObjectCoercer,new Tz.StringCoercer,new Tz.PrimitiveCoercer],Tz.createStackParser("node:javascript",Tz.nodeStackLineParser),[DVu(),AUu,EUu()]);var uCe=class extends WKr{getLibraryId(){return"posthog-node"}initializeContext(){return new HKr}};var KKr=class{posthog;constructor({posthogApiKey:t}){this.posthog=new uCe(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"5.139.1",usingAccessToken:!0,...fue()}})}sendAutomationEvent(t){this.posthog.capture({distinctId:t.distinctId,event:t.event,properties:t.properties})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}};var u8t=class{async sendEvent(){}async sendAutomationEvent(){}async identify(){}async flush(){}};bd();Yt();var Yst=require("fs/promises"),jUu=require("os"),QUu=require("path");kit();var vzm="id",xzm=".fern",l8t=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new uCe(r),this.userId=t==null?void 0:YQo(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"5.139.1",...t,...t.properties,usingAccessToken:!1,agent:IVr(),...r!=null?{userEmail:r}:{},...fue()}})}sendAutomationEvent(t){this.posthog.capture({distinctId:t.distinctId,event:t.event,properties:t.properties})}async flush(){try{await Promise.race([this.posthog.flush(),new Promise(t=>setTimeout(t,3e3))])}catch{}}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await jf({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=YD(),r=ze(Mt.of((0,jUu.homedir)()),ve.of(xzm),ve.of(vzm));try{await Jt(r)?this.persistedDistinctId=(await(0,Yst.readFile)(r)).toString():(await(0,Yst.mkdir)((0,QUu.dirname)(r),{recursive:!0}),await(0,Yst.writeFile)(r,t),this.persistedDistinctId=t)}catch{this.persistedDistinctId=t}}return this.persistedDistinctId}};var OVo;async function p8t(){return OVo==null&&(OVo=await Czm()),OVo}async function Czm(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new u8t;let r=await pot();return r!=null?new l8t({token:r,posthogApiKey:e}):await bz()!=null?new KKr({posthogApiKey:e}):new l8t({token:void 0,posthogApiKey:e})}catch{return new u8t}}In();wt();Ft();J_();var f8t=be(require("process"),1);kWe();var LUu=be(BPo(),1),VUu=be(MUu(),1);function fT(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=F7(e),e.length===0))return 0;e=e.replace((0,VUu.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(LUu.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}In();function JKr(e){let t=0;for(let r of e.split(`
3392
3392
  `))t=Math.max(t,fT(r));return t}var a_u=be(BVo(),1);var Szm=/[\p{Lu}]/u,Tzm=/[\p{Ll}]/u,GUu=/^[\p{Lu}](?![\p{Lu}])/gu,HUu=/([\p{Alpha}\p{N}_]|$)/u,DVo=/[_.\- ]+/,Ozm=new RegExp("^"+DVo.source),qUu=new RegExp(DVo.source+HUu.source,"gu"),WUu=new RegExp("\\d+"+HUu.source,"gu"),Pzm=(e,t,r,n)=>{let i=!1,o=!1,s=!1,a=!1;for(let c=0;c<e.length;c++){let u=e[c];a=c>2?e[c-3]==="-":!0,i&&Szm.test(u)?(e=e.slice(0,c)+"-"+e.slice(c),i=!1,s=o,o=!0,c++):o&&s&&Tzm.test(u)&&(!a||n)?(e=e.slice(0,c-1)+"-"+e.slice(c-1),s=o,o=!1,i=!0):(i=t(u)===u&&r(u)!==u,s=o,o=r(u)===u&&t(u)!==u)}return e},Bzm=(e,t)=>(GUu.lastIndex=0,e.replace(GUu,r=>t(r))),Dzm=(e,t)=>(qUu.lastIndex=0,WUu.lastIndex=0,e.replace(qUu,(r,n)=>t(n)).replace(WUu,r=>t(r)));function RVo(e,t){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";let r=t.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(t.locale),n=t.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(t.locale);return e.length===1?DVo.test(e)?"":t.pascalCase?n(e):r(e):(e!==r(e)&&(e=Pzm(e,r,n,t.preserveConsecutiveUppercase)),e=e.replace(Ozm,""),e=t.preserveConsecutiveUppercase?Bzm(e,r):r(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),Dzm(e,n))}var jVo=be(JUu(),1);kWe();var YUu=(e=0)=>t=>`\x1B[${t+e}m`,XUu=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ZUu=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,Y0={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Wiv=Object.keys(Y0.modifier),Nzm=Object.keys(Y0.color),jzm=Object.keys(Y0.bgColor),Hiv=[...Nzm,...jzm];function Qzm(){let e=new Map;for(let[t,r]of Object.entries(Y0)){for(let[n,i]of Object.entries(r))Y0[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=Y0[n],e.set(i[0],i[1]);Object.defineProperty(Y0,t,{value:r,enumerable:!1})}return Object.defineProperty(Y0,"codes",{value:e,enumerable:!1}),Y0.color.close="\x1B[39m",Y0.bgColor.close="\x1B[49m",Y0.color.ansi=YUu(),Y0.color.ansi256=XUu(),Y0.color.ansi16m=ZUu(),Y0.bgColor.ansi=YUu(10),Y0.bgColor.ansi256=XUu(10),Y0.bgColor.ansi16m=ZUu(10),Object.defineProperties(Y0,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>Y0.rgbToAnsi256(...Y0.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>Y0.ansi256ToAnsi(Y0.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>Y0.ansi256ToAnsi(Y0.hexToAnsi256(t)),enumerable:!1}}),Y0}var zzm=Qzm(),$Uu=zzm;var YKr=new Set(["\x1B","\x9B"]),Mzm=39,FVo="\x07",r_u="[",Lzm="]",n_u="m",NVo=`${Lzm}8;;`,e_u=e=>`${YKr.values().next().value}${r_u}${e}${n_u}`,t_u=e=>`${YKr.values().next().value}${NVo}${e}${FVo}`,Vzm=e=>e.split(" ").map(t=>fT(t)),kVo=(e,t,r)=>{let n=[...t],i=!1,o=!1,s=fT(F7(e[e.length-1]));for(let[a,c]of n.entries()){let u=fT(c);if(s+u<=r?e[e.length-1]+=c:(e.push(c),s=0),YKr.has(c)&&(i=!0,o=n.slice(a+1).join("").startsWith(NVo)),i){o?c===FVo&&(i=!1,o=!1):c===n_u&&(i=!1);continue}s+=u,s===r&&a<n.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Uzm=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(fT(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},_zm=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,o,s=Vzm(e),a=[""];for(let[u,l]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let p=fT(a[a.length-1]);if(u!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),p=0),(p>0||r.trim===!1)&&(a[a.length-1]+=" ",p++)),r.hard&&s[u]>t){let d=t-p,f=1+Math.floor((s[u]-d-1)/t);Math.floor((s[u]-1)/t)<f&&a.push(""),kVo(a,l,t);continue}if(p+s[u]>t&&p>0&&s[u]>0){if(r.wordWrap===!1&&p<t){kVo(a,l,t);continue}a.push("")}if(p+s[u]>t&&r.wordWrap===!1){kVo(a,l,t);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(u=>Uzm(u)));let c=[...a.join(`
3393
3393
  `)];for(let[u,l]of c.entries()){if(n+=l,YKr.has(l)){let{groups:d}=new RegExp(`(?:\\${r_u}(?<code>\\d+)m|\\${NVo}(?<uri>.*)${FVo})`).exec(c.slice(u).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===Mzm?void 0:f}else d.uri!==void 0&&(o=d.uri.length===0?void 0:d.uri)}let p=$Uu.codes.get(Number(i));c[u+1]===`
3394
3394
  `?(o&&(n+=t_u("")),i&&p&&(n+=e_u(p))):l===`
@@ -3963,7 +3963,7 @@ Hint: Values starting with "@" (such as scoped npm packages) must be wrapped in
3963
3963
  Add a 'docs:' section to your fern.yml to get started.`,code:S.Code.ConfigError});let o=await new NDe({context:t}).check({workspace:n,strict:r.strict}),s=new Set(o.mdxParseErrors.map(p=>p.displayRelativeFilepath)),a=new Set(o.mdxParseErrors.map(p=>p.rawMessage)),c=o.violations.filter(p=>!(s.size>0&&mSh(p,s,a))),u=o.hasErrors||r.strict&&o.hasWarnings;if(r.json){let p=this.buildJsonResponse({result:o,filteredViolations:c,hasErrors:u});if(t.stdout.info(JSON.stringify(p,null,2)),u)throw new S({code:S.Code.ValidationError});return}if(c.length>0)for(let p of c){let d=p.severity==="warning"?fe.yellow:fe.red;process.stderr.write(`${d(`${p.displayRelativeFilepath}:${p.line}:${p.column}: ${p.message}`)}
3964
3964
  `)}let l=0;if(o.mdxParseErrors.length>0){for(let p of o.mdxParseErrors)t.stderr.info(`
3965
3965
  ${p.toString()}
3966
- `);r.fix?l+=await xsi(t,o.mdxParseErrors):process.stdout.isTTY===!0&&!Lri()&&await Csi(t,o.mdxParseErrors)}if(r.fix&&c.length>0){let d=await new sIt({context:t}).fix({workspace:n,violations:c});l+=d.fixedCount}if(u&&(!r.fix||l===0))throw new S({code:S.Code.ValidationError});if(o.warningCount>0){t.stderr.info(`${Mr.warning} ${fe.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(fe.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${Mr.success} ${fe.green("All checks passed")}`)}buildJsonResponse({result:t,filteredViolations:r,hasErrors:n}){let i={};return(r.length>0||t.mdxParseErrors.length>0)&&(i.docs=[...r.map(o=>Pte(o)),...t.mdxParseErrors.map(o=>({severity:"error",rule:o.code.code,filepath:o.displayRelativeFilepath,...o.line!=null?{line:o.line}:{},...o.column!=null?{column:o.column}:{},message:`[${o.code.code}] ${o.code.title}: ${o.rawMessage}`}))]),{success:!n,results:i}}};function mSh(e,t,r){if(!/failed to parse|failed to initialize/i.test(e.message))return!1;for(let n of r)if(n.length>0&&e.message.includes(n))return!0;for(let n of t){if(e.message.includes(n))return!0;let i=n.split("/").filter(Boolean);for(let o=i.length;o>=2;o--){let s=i.slice(i.length-o).join("/");if(e.message.includes(s))return!0}if(i.length===1){let o=i[0];if(o!=null&&e.message.includes(o))return!0}}return!1}function oos(e){let t=new ios;si(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}).option("fix",{type:"boolean",description:"Automatically fix issues that have a known resolution",default:!1}))}jb();Ft();var Rbl=be(require("net"),1),kbl=be(require("os"),1),Tsi=class extends Error{constructor(t){super(`${t} is locked`)}},lIt={old:new Set,young:new Set},hSh=1e3*15,Fbl=new Set;var nWt,gSh=()=>{let e=kbl.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},Bbl=e=>new Promise((t,r)=>{let n=Rbl.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),Dbl=async(e,t)=>{if(e.host||e.port===0)return Bbl(e);for(let r of t)try{await Bbl({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},ASh=e=>lIt.old.has(e)||lIt.young.has(e)||Fbl.has(e),ySh=function*(e){e&&(yield*e),yield 0};async function QDe(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let s=e.exclude;if(typeof s[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of s){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}r=new Set(s)}let{reserve:n,...i}=e??{};nWt===void 0&&(nWt=setTimeout(()=>{nWt=void 0,lIt.old=lIt.young,lIt.young=new Set},hSh),nWt.unref&&nWt.unref());let o=gSh();for(let s of ySh(t))try{if(r.has(s))continue;let a=await Dbl({...i,port:s},o);for(;ASh(a);){if(s!==0)throw new Tsi(s);a=await Dbl({...i,port:s},o)}return n?Fbl.add(a):lIt.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof Tsi))throw a}throw new Error("No available ports found")}Ft();var Qbl=/^[a-z0-9-]+-preview-[a-z0-9-]+\.docs\.buildwithfern\.com$/i,Nbl="docs.buildwithfern.com",jbl=62;function OUe(e){let t=e.toLowerCase().trim();t.startsWith("https://")?t=t.slice(8):t.startsWith("http://")&&(t=t.slice(7));let r=t.indexOf("/");return r!==-1&&(t=t.slice(0,r)),Qbl.test(t)}function zbl(e){let t=e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");return t.length===0?"default":t}function iWt({orgId:e,previewId:t}){let r=zbl(t),n=`${e}-preview-${r}.${Nbl}`;if(n.length<=jbl)return n;let i=`${e}-preview-`,o=jbl-i.length;if(o<8)throw new S({message:`Organization name "${e}" is too long to generate a valid preview URL`,code:S.Code.ValidationError});let a=r.slice(0,o).replace(/-+$/,"");return`${i}${a}.${Nbl}`}wt();lv();nh();Yt();Q0();Ft();In();var qcs=require("child_process"),cBl=be(cos(),1),Wcs=be(dai(),1),Hcs=be(require("fs"),1),nRe=require("fs/promises"),uBl=be(require("http"),1),lBl=be(require("os"),1),rui=be(require("path"),1);Oai();Yt();var CG=require("fs/promises"),vCl=require("os"),Jss=be(require("path"),1),oFh=".fern",sFh="logs",Kss=100*1024*1024;function aFh(){return"cli@5.139.0"}var UUe=class{logFilePath=null;initialized=!1;sessionStartTime;consoleLogger;constructor(){this.sessionStartTime=Date.now()}async initialize(t,r){if(this.initialized)return;this.consoleLogger=t;let n=r??ze(ze(Mt.of((0,vCl.homedir)()),ve.of(oFh)),ve.of(sFh));await Jt(n)||await(0,CG.mkdir)(n,{recursive:!0});let o=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=ze(n,ve.of(o));let s=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${Jss.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
3966
+ `);r.fix?l+=await xsi(t,o.mdxParseErrors):process.stdout.isTTY===!0&&!Lri()&&await Csi(t,o.mdxParseErrors)}if(r.fix&&c.length>0){let d=await new sIt({context:t}).fix({workspace:n,violations:c});l+=d.fixedCount}if(u&&(!r.fix||l===0))throw new S({code:S.Code.ValidationError});if(o.warningCount>0){t.stderr.info(`${Mr.warning} ${fe.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(fe.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${Mr.success} ${fe.green("All checks passed")}`)}buildJsonResponse({result:t,filteredViolations:r,hasErrors:n}){let i={};return(r.length>0||t.mdxParseErrors.length>0)&&(i.docs=[...r.map(o=>Pte(o)),...t.mdxParseErrors.map(o=>({severity:"error",rule:o.code.code,filepath:o.displayRelativeFilepath,...o.line!=null?{line:o.line}:{},...o.column!=null?{column:o.column}:{},message:`[${o.code.code}] ${o.code.title}: ${o.rawMessage}`}))]),{success:!n,results:i}}};function mSh(e,t,r){if(!/failed to parse|failed to initialize/i.test(e.message))return!1;for(let n of r)if(n.length>0&&e.message.includes(n))return!0;for(let n of t){if(e.message.includes(n))return!0;let i=n.split("/").filter(Boolean);for(let o=i.length;o>=2;o--){let s=i.slice(i.length-o).join("/");if(e.message.includes(s))return!0}if(i.length===1){let o=i[0];if(o!=null&&e.message.includes(o))return!0}}return!1}function oos(e){let t=new ios;si(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}).option("fix",{type:"boolean",description:"Automatically fix issues that have a known resolution",default:!1}))}jb();Ft();var Rbl=be(require("net"),1),kbl=be(require("os"),1),Tsi=class extends Error{constructor(t){super(`${t} is locked`)}},lIt={old:new Set,young:new Set},hSh=1e3*15,Fbl=new Set;var nWt,gSh=()=>{let e=kbl.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},Bbl=e=>new Promise((t,r)=>{let n=Rbl.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),Dbl=async(e,t)=>{if(e.host||e.port===0)return Bbl(e);for(let r of t)try{await Bbl({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},ASh=e=>lIt.old.has(e)||lIt.young.has(e)||Fbl.has(e),ySh=function*(e){e&&(yield*e),yield 0};async function QDe(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let s=e.exclude;if(typeof s[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of s){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}r=new Set(s)}let{reserve:n,...i}=e??{};nWt===void 0&&(nWt=setTimeout(()=>{nWt=void 0,lIt.old=lIt.young,lIt.young=new Set},hSh),nWt.unref&&nWt.unref());let o=gSh();for(let s of ySh(t))try{if(r.has(s))continue;let a=await Dbl({...i,port:s},o);for(;ASh(a);){if(s!==0)throw new Tsi(s);a=await Dbl({...i,port:s},o)}return n?Fbl.add(a):lIt.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof Tsi))throw a}throw new Error("No available ports found")}Ft();var Qbl=/^[a-z0-9-]+-preview-[a-z0-9-]+\.docs\.buildwithfern\.com$/i,Nbl="docs.buildwithfern.com",jbl=62;function OUe(e){let t=e.toLowerCase().trim();t.startsWith("https://")?t=t.slice(8):t.startsWith("http://")&&(t=t.slice(7));let r=t.indexOf("/");return r!==-1&&(t=t.slice(0,r)),Qbl.test(t)}function zbl(e){let t=e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"");return t.length===0?"default":t}function iWt({orgId:e,previewId:t}){let r=zbl(t),n=`${e}-preview-${r}.${Nbl}`;if(n.length<=jbl)return n;let i=`${e}-preview-`,o=jbl-i.length;if(o<8)throw new S({message:`Organization name "${e}" is too long to generate a valid preview URL`,code:S.Code.ValidationError});let a=r.slice(0,o).replace(/-+$/,"");return`${i}${a}.${Nbl}`}wt();lv();nh();Yt();Q0();Ft();In();var qcs=require("child_process"),cBl=be(cos(),1),Wcs=be(dai(),1),Hcs=be(require("fs"),1),nRe=require("fs/promises"),uBl=be(require("http"),1),lBl=be(require("os"),1),rui=be(require("path"),1);Oai();Yt();var CG=require("fs/promises"),vCl=require("os"),Jss=be(require("path"),1),oFh=".fern",sFh="logs",Kss=100*1024*1024;function aFh(){return"cli@5.139.1"}var UUe=class{logFilePath=null;initialized=!1;sessionStartTime;consoleLogger;constructor(){this.sessionStartTime=Date.now()}async initialize(t,r){if(this.initialized)return;this.consoleLogger=t;let n=r??ze(ze(Mt.of((0,vCl.homedir)()),ve.of(oFh)),ve.of(sFh));await Jt(n)||await(0,CG.mkdir)(n,{recursive:!0});let o=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=ze(n,ve.of(o));let s=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${Jss.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
3967
3967
  `);await(0,CG.writeFile)(this.logFilePath,s,"utf-8"),this.initialized=!0,this.enforceLogSizeLimit(n)}getLogFilePath(){return this.logFilePath}async writeEntry(t){if(!this.initialized||!this.logFilePath)return;let r=JSON.stringify(t)+`
3968
3968
  `;try{await(0,CG.appendFile)(this.logFilePath,r,"utf-8")}catch{}}async logFrontendMetrics(t){let r={timestamp:t.timestamp,source:t.source,level:t.level,eventType:this.getEventType(t.payload,t.isAggregate),isAggregate:t.isAggregate,data:t.payload};await this.writeEntry(r)}async logCliMetric(t,r="info"){let n={timestamp:t.timestamp,source:aFh(),level:r,eventType:t.type,data:{durationMs:t.durationMs,metadata:t.metadata}};await this.writeEntry(n)}async logCliMemory(){let t=process.memoryUsage(),r={type:"cli_memory",timestamp:new Date().toISOString(),metadata:{heapUsed:t.heapUsed,heapTotal:t.heapTotal,external:t.external,rss:t.rss,heapUsedMB:Math.round(t.heapUsed/1024/1024*100)/100,heapTotalMB:Math.round(t.heapTotal/1024/1024*100)/100,rssMB:Math.round(t.rss/1024/1024*100)/100}};await this.logCliMetric(r)}async logCliReloadStart(){let t={type:"cli_reload_start",timestamp:new Date().toISOString()};await this.logCliMetric(t)}async logCliReloadFinish(t,r){let n={type:"cli_reload_finish",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliDocsGeneration(t,r){let n={type:"cli_docs_generation",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliValidation(t,r){let n={type:"cli_validation",timestamp:new Date().toISOString(),durationMs:t,metadata:{success:r}};await this.logCliMetric(n)}async enforceLogSizeLimit(t){try{let n=(await(0,CG.readdir)(t)).filter(c=>c.endsWith(".log")),i=[];for(let c of n){let u=Jss.default.join(t,c);try{let l=await(0,CG.stat)(u);i.push({name:c,fullPath:u,size:l.size,mtimeMs:l.mtimeMs})}catch{}}let o=i.reduce((c,u)=>c+u.size,0),s=Math.round(o/1024/1024*100)/100,a=Kss/1024/1024;if(o<=Kss){this.consoleLogger?.debug(`Log directory size ${s} MB does not exceed ${a} MB cap`);return}this.consoleLogger?.info(`Rotating logs: total size ${s} MB exceeds ${a} MB cap`),i.sort((c,u)=>c.mtimeMs-u.mtimeMs);for(let c of i){if(o<=Kss)break;if(!(this.logFilePath!=null&&c.fullPath===this.logFilePath))try{await(0,CG.unlink)(c.fullPath),o-=c.size}catch{}}}catch{}}getEventType(t,r){return r?"aggregate_summary":"type"in t&&typeof t.type=="string"?t.type:"unknown"}static isMetricsMessage(t){if(typeof t!="object"||t===null)return!1;let r=t;return r.type==="metrics"&&typeof r.timestamp=="string"&&typeof r.source=="string"}};var Pai={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"};function xCl(e){let t=cFh();if(t==null)return;let{port:r,debugLogger:n,getDocsLoadResponse:i,extractLocaleFromPath:o}=e,s=new Map;function a(u){let l=JSON.stringify(u),p=[];for(let[d]of s)try{d.send(l)}catch{p.push(d)}for(let d of p){let f=s.get(d);f&&(clearInterval(f.pingInterval),s.delete(d))}}let c=t.serve({port:r,async fetch(u,l){if(u.method==="OPTIONS")return new Response(null,{status:204,headers:Pai});let p=new URL(u.url);if(u.headers.get("upgrade")?.toLowerCase()==="websocket"){l.upgrade(u,{data:{connectionId:`${Date.now()}`}});return}if(u.method==="POST"&&p.pathname==="/v2/registry/docs/load-with-url")try{let f=await u.json(),m=o?.(f?.url);return new Response(JSON.stringify(i(m)),{headers:{"Content-Type":"application/json",...Pai}})}catch{return new Response(JSON.stringify(i()),{headers:{"Content-Type":"application/json",...Pai}})}let d=/^\/_local\/(.*)/.exec(p.pathname);return u.method==="GET"&&d!=null?new Response(t.file(`/${d[1]}`),{headers:Pai}):new Response("Not Found",{status:404})},websocket:{open(u){let{connectionId:l}=u.data,p=setInterval(()=>{let d=s.get(u);if(!d)return;let f=Date.now();if(f-d.lastPong>9e4){u.close();return}try{u.send(JSON.stringify({type:"ping",timestamp:f}))}catch{u.close()}},3e4);s.set(u,{pingInterval:p,lastPong:Date.now()});try{u.send(JSON.stringify({type:"connected",connectionId:l}))}catch{}},message(u,l){try{let p=JSON.parse(l.toString());if(p.type==="pong"){let d=s.get(u);d&&(d.lastPong=Date.now())}else UUe.isMetricsMessage(p)&&n.logFrontendMetrics(p)}catch{}},close(u){let l=s.get(u);l&&(clearInterval(l.pingInterval),s.delete(u))}}});return{sendData:a,stop:u=>c.stop(u)}}function cFh(){return globalThis.Bun}Ft();var UCl=require("events"),Fai=be(require("fs"),1),GUe=be(require("path"),1);var CCl=be(require("os"),1),wCl=300,WDe=20,QWt=1e7,SCl=CCl.default.platform();var uFh=SCl==="darwin",Yss=SCl==="win32",HDe=uFh||Yss,TCl=3e3,OCl=2e4,Xss=1250;var koe;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(koe||(koe={}));var _Ue;(function(e){e.CHANGE="change",e.RENAME="rename"})(_Ue||(_Ue={}));var zWt;(function(e){e.CHANGE="change",e.ERROR="error"})(zWt||(zWt={}));var kc;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(kc||(kc={}));var zN;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(zN||(zN={}));var lFh=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),s,a,c=0,u=0,l=()=>{let v=Date.now(),C=v-c,O=v-u,D=C>=t||O>=o;return[v,D]},p=v=>{if(u=v,!s)return;let C=s;s=void 0,e.apply(void 0,C)},d=()=>{E(0)},f=()=>{a&&(d(),p(Date.now()))},m=v=>{if(u=v,n)return p(v)},g=v=>{if(i&&s)return p(v);s=void 0},A=()=>{a=void 0;let[v,C]=l();return C?g(v):y(v)},y=v=>{let C=v-c,O=v-u,D=t-C,R=o-O,P=Math.min(D,R);return E(P)},E=v=>{a&&clearTimeout(a),!(v<=0)&&(a=setTimeout(A,v))},x=(...v)=>{let[C,O]=l(),D=!!a;if(s=v,c=C,(O||!a)&&E(t),O)return D?p(C):m(C)};return x.cancel=d,x.flush=f,x},Bai=lFh;var tas=be(require("fs"),1),Rai=be(require("path"),1);var Xd=be(require("fs"),1),yB=require("util");var lhe=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},Foe=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var Zss=be(require("process"),1),PCl=Zss.default.getuid?!Zss.default.getuid():!1,BCl=1e4,WM=()=>{};var MWt={isChangeErrorOk:e=>{if(!MWt.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!PCl&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!MWt.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!MWt.isNodeError(e))throw e;if(!MWt.isChangeErrorOk(e))throw e}},Sx=MWt;var $ss=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=BCl,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(n),n=()=>t(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},DCl=new $ss;var phe=(e,t)=>function(n){return function i(...o){return DCl.schedule().then(s=>{let a=u=>(s(),u),c=u=>{if(s(),Date.now()>=n)throw u;if(t(u)){let l=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,l)).then(()=>i.apply(void 0,o))}throw u};return e.apply(void 0,o).then(a,c)})}},fhe=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(t(s))return i.apply(void 0,o);throw s}}};var pFh={attempt:{chmod:lhe((0,yB.promisify)(Xd.default.chmod),Sx.onChangeError),chown:lhe((0,yB.promisify)(Xd.default.chown),Sx.onChangeError),close:lhe((0,yB.promisify)(Xd.default.close),WM),fsync:lhe((0,yB.promisify)(Xd.default.fsync),WM),mkdir:lhe((0,yB.promisify)(Xd.default.mkdir),WM),realpath:lhe((0,yB.promisify)(Xd.default.realpath),WM),stat:lhe((0,yB.promisify)(Xd.default.stat),WM),unlink:lhe((0,yB.promisify)(Xd.default.unlink),WM),chmodSync:Foe(Xd.default.chmodSync,Sx.onChangeError),chownSync:Foe(Xd.default.chownSync,Sx.onChangeError),closeSync:Foe(Xd.default.closeSync,WM),existsSync:Foe(Xd.default.existsSync,WM),fsyncSync:Foe(Xd.default.fsync,WM),mkdirSync:Foe(Xd.default.mkdirSync,WM),realpathSync:Foe(Xd.default.realpathSync,WM),statSync:Foe(Xd.default.statSync,WM),unlinkSync:Foe(Xd.default.unlinkSync,WM)},retry:{close:phe((0,yB.promisify)(Xd.default.close),Sx.isRetriableError),fsync:phe((0,yB.promisify)(Xd.default.fsync),Sx.isRetriableError),open:phe((0,yB.promisify)(Xd.default.open),Sx.isRetriableError),readFile:phe((0,yB.promisify)(Xd.default.readFile),Sx.isRetriableError),rename:phe((0,yB.promisify)(Xd.default.rename),Sx.isRetriableError),stat:phe((0,yB.promisify)(Xd.default.stat),Sx.isRetriableError),write:phe((0,yB.promisify)(Xd.default.write),Sx.isRetriableError),writeFile:phe((0,yB.promisify)(Xd.default.writeFile),Sx.isRetriableError),closeSync:fhe(Xd.default.closeSync,Sx.isRetriableError),fsyncSync:fhe(Xd.default.fsyncSync,Sx.isRetriableError),openSync:fhe(Xd.default.openSync,Sx.isRetriableError),readFileSync:fhe(Xd.default.readFileSync,Sx.isRetriableError),renameSync:fhe(Xd.default.renameSync,Sx.isRetriableError),statSync:fhe(Xd.default.statSync,Sx.isRetriableError),writeSync:fhe(Xd.default.writeSync,Sx.isRetriableError),writeFileSync:fhe(Xd.default.writeFileSync,Sx.isRetriableError)}},RCl=pFh;var Dai=be(require("fs"),1),LWt=be(require("path"),1);var eas=()=>{};var fFh=()=>{let e=eas,t=eas,r=!1,n=!1;return{promise:new Promise((c,u)=>{e=l=>(r=!0,c(l)),t=l=>(n=!0,u(l))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},kCl=fFh;var dFh=()=>{let{promise:e,resolve:t,isPending:r}=kCl(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},FCl=dFh;var NCl={then:e=>{e()}};var jCl=e=>Array.isArray(e)?e:[e],QCl=e=>typeof e=="function";var mFh=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],s=jCl(o).map(se=>QCl(se)?se:ae=>se.test(ae)),a=se=>s.some(ae=>ae(se)),c=t?.signal??{aborted:!1},u=t?.onDirents||(()=>{}),l=[],p=new Set,d={},f=[],m=new Set,g={},A=[],y=new Set,E={},x={},v=new Set,C={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},O={directories:l,directoriesNames:p,directoriesNamesToPaths:d,files:f,filesNames:m,filesNamesToPaths:g,symlinks:A,symlinksNames:y,symlinksNamesToPaths:E,map:x},{promise:D,increment:R,decrement:P}=FCl(),M=0,J=(se,ae,Oe,Ie)=>{v.has(ae)||M>=i||(M+=1,se.directories.push(ae),se.directoriesNames.add(Oe),l.push(ae),p.add(Oe),d.propertyIsEnumerable(Oe)||(d[Oe]=[]),d[Oe].push(ae),v.add(ae),!(Ie>=n)&&(M>=i||de(ae,Ie+1)))},X=(se,ae,Oe)=>{v.has(ae)||M>=i||(M+=1,se.files.push(ae),se.filesNames.add(Oe),f.push(ae),m.add(Oe),g.propertyIsEnumerable(Oe)||(g[Oe]=[]),g[Oe].push(ae),v.add(ae))},$=(se,ae,Oe,Ie)=>{v.has(ae)||M>=i||(M+=1,se.symlinks.push(ae),se.symlinksNames.add(Oe),A.push(ae),y.add(Oe),E.propertyIsEnumerable(Oe)||(E[Oe]=[]),E[Oe].push(ae),v.add(ae),r&&(Ie>=n||M>=i||we(ae,Ie+1)))},ie=(se,ae,Oe,Ie,Fe)=>{c.aborted||a(ae)||(Ie.isDirectory()?J(se,ae,Oe,Fe):Ie.isFile()?X(se,ae,Oe):Ie.isSymbolicLink()&&$(se,ae,Oe,Fe))},ue=(se,ae,Oe,Ie)=>{if(c.aborted)return;let Fe=ae===LWt.default.sep?"":LWt.default.sep,Ke=Oe.name,ot=`${ae}${Fe}${Ke}`;a(ot)||(Oe.isDirectory()?J(se,ot,Ke,Ie):Oe.isFile()?X(se,ot,Ke):Oe.isSymbolicLink()&&$(se,ot,Ke,Ie))},oe=(se,ae,Oe,Ie)=>{for(let Fe=0,Ke=Oe.length;Fe<Ke;Fe++)ue(se,ae,Oe[Fe],Ie)},de=(se,ae)=>{c.aborted||ae>n||M>=i||(R(),Dai.default.readdir(se,{withFileTypes:!0},(Oe,Ie)=>{if(Oe||c.aborted||!Ie.length)return P();(u(Ie)||NCl).then(()=>{let Ke=x[se]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};oe(Ke,se,Ie,ae),P()})}))},we=(se,ae)=>{R(),Dai.default.realpath(se,(Oe,Ie)=>{if(Oe||c.aborted)return P();Dai.default.stat(Ie,(Fe,Ke)=>{if(Fe||c.aborted)return P();let ot=LWt.default.basename(Ie),bt=x[se]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};ie(bt,Ie,ot,Ke,ae),P()})})};return(async(se,ae=1)=>(se=LWt.default.normalize(se),v.add(se),de(se,ae),await D,c.aborted?C:O))(e)},zCl=mFh;var Noe={lang:{debounce:Bai,attempt:e=>{try{return e()}catch(t){return Noe.lang.castError(t)}},castArray:e=>Noe.lang.isArray(e)?e:[e],castError:e=>Noe.lang.isError(e)?e:Noe.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(Noe.lang.isNaN(e))return Noe.lang.isNaN(t);if(Noe.lang.isPrimitive(e)||Noe.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split(Rai.default.sep).length-1),getRealPath:(e,t)=>{try{return t?tas.default.realpathSync.native(e):tas.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===Rai.default.sep&&t.length-e.length>Rai.default.sep.length,poll:(e,t=OCl)=>RCl.retry.stat(t)(e,{bigint:!0}).catch(Noe.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let s=o[e];return[s.directories,s.files]}else{let s=await zCl(e,{depth:r,limit:n,ignore:t,signal:i});return[s.directories,s.files]}}}},sp=Noe;var kai=be(require("path"),1);var ras=class{constructor(t,r,n){this.base=n,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||sp.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=wCl){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(a,c)=>{let u=this.options.ignoreInitial?[]:a,l=await this.eventsPopulate([...c]),p=this.eventsDeduplicate([...u,...l]);this.onTargetEvents(p)},s=sp.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(a,c="",u=!1)=>{u?await this.eventsPopulate([c],n,!0):i.add(c),r.then(s)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,s]=i,a=r[s];return o===a||o===kc.CHANGE&&a===kc.ADD||(r[s]=o,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let o=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(o.map(async s=>{r.push([s,i]),s===kc.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):s===kc.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let o=this.options.recursive?this.options.depth??WDe:Math.min(1,this.options.depth??WDe),s=this.options.limit??QWt,[a,c]=await sp.fs.readdir(r,this.options.ignore,o,s,this.watcher._closeSignal),u=[...a,...c];return await Promise.all(u.map(l=>{if(!this.watcher.isIgnored(l,this.options.ignore)&&!t.includes(l))return this.eventsPopulate([l],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())sp.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(kc.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!HDe&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(kc.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(kc.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(kai.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(kc.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(kai.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(kc.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===kc.ADD?this.onTargetAdd(n):r===kc.ADD_DIR?this.onTargetAddDir(n):r===kc.CHANGE?this.onTargetChange(n):r===kc.UNLINK?this.onTargetUnlink(n):r===kc.UNLINK_DIR&&this.onTargetUnlinkDir(n)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,n=!1){return this.handlerBatched(t,r,n)}onWatcherChange(t=_Ue.CHANGE,r){if(this.watcher.isClosed())return;let n=kai.default.resolve(this.folderPath,r||"");this.filePath&&n!==this.folderPath&&n!==this.filePath||this.watcher.isIgnored(n,this.options.ignore)||this.onWatcherEvent(t,n)}onWatcherError(t){Yss&&t.code==="EPERM"?this.onWatcherChange(_Ue.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(zWt.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(zWt.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(_Ue.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&HDe&&this.options.native!==!1?this.options.depth??WDe:Math.min(1,this.options.depth??WDe),n=this.options.limit??QWt,[i,o]=await sp.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),s=[this.folderPath,...i,...o];await Promise.all(s.map(a=>{if(!this.watcher._poller.stats.has(a)&&!this.watcher.isIgnored(a,this.options.ignore))return this.onWatcherEvent(_Ue.CHANGE,a,t)}))}}},MCl=ras;var MN={interval:100,intervalId:void 0,fns:new Map,init:()=>{MN.intervalId||(MN.intervalId=setInterval(MN.resolve,MN.interval))},reset:()=>{MN.intervalId&&(clearInterval(MN.intervalId),delete MN.intervalId)},add:(e,t)=>{MN.fns.set(e,Date.now()+t),MN.init()},remove:e=>{MN.fns.delete(e)},resolve:()=>{if(!MN.fns.size)return MN.reset();let e=Date.now();for(let[t,r]of MN.fns)r>=e||(MN.remove(t),t())}},VWt=MN;var UWt=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=Xss){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(sp.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return a();let c=()=>{s.add.delete(n),VWt.remove(u)},u=()=>{c(),a()};VWt.add(u,r);let l=()=>{let p=s.unlink.get(n);if(!p)return;c();let d=p();i===d?o.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(o.change,i):this._watcher.event(o.rename,d,i)};s.add.set(n,l),l()}getLockUnlink(t,r=Xss){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{this._watcher.event(o.unlink,i)};if(!n)return a();let c=()=>{s.unlink.delete(n),VWt.remove(u)},u=()=>{c(),a()};VWt.add(u,r);let l=()=>(c(),i);s.unlink.set(n,l),s.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,kc.ADD,koe.FILE);return this.getLockAdd({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let n=this._watcher._poller.getIno(t,kc.ADD_DIR,koe.DIR);return this.getLockAdd({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let n=this._watcher._poller.getIno(t,kc.UNLINK,koe.FILE);return this.getLockUnlink({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let n=this._watcher._poller.getIno(t,kc.UNLINK_DIR,koe.DIR);return this.getLockUnlink({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};UWt.DIR_EVENTS={add:kc.ADD_DIR,rename:kc.RENAME_DIR,unlink:kc.UNLINK_DIR};UWt.FILE_EVENTS={add:kc.ADD,change:kc.CHANGE,rename:kc.RENAME,unlink:kc.UNLINK};var LCl=UWt;var nas=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(sp.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(sp.lang.isSet(n)){let i=n.delete(r);return n.size||this.map.delete(t),i}else if(n===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let n=this.map.get(t);if(sp.lang.isSet(n))return Array.from(n).find(r);if(r(n))return n}}get(t){return this.map.get(t)}has(t,r){if(sp.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return sp.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);sp.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},ias=nas;var oas=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},VCl=oas;var sas=class{constructor(){this.inos={},this.paths=new ias,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let o=i[t];if(o&&!(n&&o[1]!==n))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await sp.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new VCl(n)}reset(){this.inos={},this.paths=new ias,this.stats=new Map}async update(t,r){let n=this.getStats(t),i=await this.poll(t,r);if(this.updateStats(t,i),!n&&i){if(i.isFile())return this.updateIno(t,kc.ADD,i),[kc.ADD];if(i.isDirectory())return this.updateIno(t,kc.ADD_DIR,i),[kc.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,kc.UNLINK,n),[kc.UNLINK];if(n.isDirectory())return this.updateIno(t,kc.UNLINK_DIR,n),[kc.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,kc.CHANGE,i),[kc.CHANGE]);if(i.isDirectory())return this.updateIno(t,kc.UNLINK,n),this.updateIno(t,kc.ADD_DIR,i),[kc.UNLINK,kc.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,kc.UNLINK_DIR,n),this.updateIno(t,kc.ADD,i),[kc.UNLINK_DIR,kc.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,kc.UNLINK_DIR,n),this.updateIno(t,kc.ADD_DIR,i),[kc.UNLINK_DIR,kc.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?koe.FILE:koe.DIR;i[t]=[n.ino,o]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let n=this.stats.get(t)?.ino||-1;this.paths.delete(n,t),this.stats.delete(t)}}},aas=sas;var cas=class e extends UCl.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(zN.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(zN.CLOSE,i)),this._readyWait=new Promise(i=>this.on(zN.READY,i)),this._locker=new LCl(this),this._roots=new Set,this._poller=new aas,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,n)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(sp.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(zN.CLOSE))}error(t){if(this.isClosed())return!1;let r=sp.lang.castError(t);return this.emit(zN.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(zN.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(zN.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&sp.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&sp.lang.isShallowEqual(n.options,r))return!0;return!1}watchersClose(t,r,n=!0){if(t){let i=this._watchers[t];if(i)for(let o of[...i])r&&o.filePath!==r||this.watcherClose(o);if(n)for(let o in this._watchers)sp.fs.isSubPath(t,o)&&this.watchersClose(o,r,!1)}else for(let i in this._watchers)this.watchersClose(i,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,n]of t)this.watchPath(r,n.options,n.handler)}async watcherAdd(t,r){let{folderPath:n}=t;(this._watchers[n]=this._watchers[n]||[]).push(t);let o=new MCl(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,1),r.length||delete this._watchers[t.folderPath]}let n=t.filePath||t.folderPath;this._roots.has(n)&&(this._watchersRestorable[n]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=sp.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(a=>a.handler===n&&(!a.filePath||a.filePath===i)&&a.options.ignore===r.ignore&&!!a.options.native==!!r.native&&(!r.recursive||a.options.recursive)))return!0;let s=GUe.default.dirname(t);for(let a=1;a<1/0;a++){if(this._watchers[s]?.find(l=>(a===1||l.options.recursive&&a<=(l.options.depth??WDe))&&l.handler===n&&(!l.filePath||l.filePath===i)&&l.options.ignore===r.ignore&&!!l.options.native==!!r.native&&(!r.recursive||l.options.recursive&&HDe&&l.options.native!==!1)))return!0;if(!HDe)break;let u=GUe.default.dirname(t);if(s===u)break;s=u}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=sp.lang.uniq(t).sort();let s;for(let a of t)if(!this.isIgnored(a,r.ignore)&&!this.watcherExists(a,r,n,i))try{let c=!r.recursive||HDe&&r.native!==!1?r:{...r,recursive:!1},l={watcher:Fai.default.watch(a,c),handler:n,options:r,folderPath:a,filePath:i},p=s=await this.watcherAdd(l,o);if(this._roots.has(i||a)){let f={...r,ignoreInitial:!0,recursive:!1},m=GUe.default.dirname(a),g=a;await this.watchDirectories([m],f,n,g,p)}}catch(c){this.error(c)}return s}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||HDe&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let s=r.depth??WDe,a=r.limit??QWt,[c]=await sp.fs.readdir(t,r.ignore,s,a,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let u=await this.watchDirectories([t],r,n,i,o);if(c.length){let l=sp.fs.getDepth(t);for(let p of c){let d=sp.fs.getDepth(p),f=Math.max(0,s-(d-l)),m={...r,depth:f};await this.watchDirectories([p],m,n,i,o||u)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(u,l)=>{l===t&&(c(),n())},s=new e(o),a=()=>{this._subwatchers.add(i),this.on(zN.CLOSE,c),s.watchFile(t,r,o)},c=()=>{this._subwatchers.delete(i),this.removeListener(zN.CLOSE,c),s.close()};return a()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=GUe.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new aas,s=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,s(),n())})}async watchPolling(t,r,n){if(this.isClosed())return sp.lang.noop;if(this.pollerExists(t,r))return sp.lang.noop;let i={...r,interval:r.pollingInterval??TCl},o={targetPath:t,options:r},s=()=>{this._pollers.add(o),this.on(zN.CLOSE,a),Fai.default.watchFile(t,i,n)},a=()=>{this._pollers.delete(o),this.removeListener(zN.CLOSE,a),Fai.default.unwatchFile(t,n)};return sp.lang.attempt(s),()=>sp.lang.attempt(a)}async watchUnknownChild(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchFileOnce(t,r,i)}async watchUnknownTarget(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchPollingOnce(t,r,i)}async watchPaths(t,r,n){if(this.isClosed())return;if(t=sp.lang.uniq(t).sort(),t.every((o,s)=>t.every((a,c)=>c===s||!sp.fs.isSubPath(o,a))))await Promise.all(t.map(o=>this.watchPath(o,r,n)));else for(let o of t)await this.watchPath(o,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=GUe.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await sp.fs.poll(t,r.pollingTimeout);if(i){if(i.isFile())return this.watchFile(t,r,n);if(i.isDirectory())return this.watchDirectory(t,r,n);this.error(`"${t}" is not supported`)}else{let o=GUe.default.dirname(t);return(await sp.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=sp.lang.noop){if(sp.lang.isFunction(t))return this.watch([],{},t);if(sp.lang.isUndefined(t))return this.watch([],r,n);if(sp.lang.isFunction(r))return this.watch(t,{},r);if(sp.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=sp.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==sp.lang.noop&&this.on(zN.ALL,n),r.readdirMap=void 0,this.ready())}},_Cl=cas;function hFh(e){return"code"in e&&typeof e.code=="string"}function GCl(e){return e instanceof Error?e:new Error(String(e))}function qCl(e){return hFh(e)&&e.code==="ENOSPC"?"Unable to watch Fern docs files for changes because the system limit for file watchers was reached. Close other file-watching processes or increase the file watcher limit, then restart `fern docs dev`.":`Unable to watch Fern docs files for changes: ${e.message}`}async function Nai({absoluteFilePathToFern:e,additionalFilepaths:t,context:r}){let n=new _Cl([e,...t],{recursive:!0,ignoreInitial:!0,debounce:100,renameDetection:!0}),i=await new Promise(o=>{let s=()=>{n.off("error",a),o(void 0)},a=c=>{n.off("ready",s),o(GCl(c))};n.once("ready",s),n.once("error",a)});return i!=null&&(n.close(),r.failAndThrow(qCl(i),i,{code:S.Code.EnvironmentError})),n.on("error",o=>{let s=GCl(o);r.failWithoutThrowing(qCl(s),s,{code:S.Code.EnvironmentError}),n.close()}),n}Yt();Q0();Ft();In();var HPl=require("child_process"),Kci=be(Aas(),1),KPl=be(Bcs(),1),hI=require("fs"),xB=require("fs/promises"),JPl=require("os"),VN=be(require("path"),1),YPl=be(kE(),1),XPl=be(WPl(),1),$Ue=process.platform==="win32",Hci=fe.cyan("[docs]:"),qQh="etag",WQh=23,Vcs=e=>e.padEnd(WQh," "),HQh="preview",KQh="app-preview",JQh="bundle",YQh=".next",XQh="standalone",ZQh=".fern",$Qh="packages/fern-docs/bundle/.next/server/instrumentation.js",ezh='Cannot find matching keyid: {"signatures":',tzh="ERR_PNPM_IGNORED_BUILDS";function rzh(e){try{let r=(0,HPl.execSync)('reg query "HKLM\\SYSTEM\\CurrentControlSet\\Control\\FileSystem" /v LongPathsEnabled',{encoding:"utf-8",timeout:5e3}).match(/LongPathsEnabled\s+REG_DWORD\s+0x(\d+)/i);if(r!=null&&r[1]==="1")return}catch(t){e.debug(`Registry query for LongPathsEnabled failed: ${t}`)}throw new S({message:`Windows long path support is not enabled. The docs bundle contains deeply nested .pnpm paths that exceed the 260-character MAX_PATH limit.
3969
3969
 
@@ -4316,7 +4316,7 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
4316
4316
  `);i.failAndThrow(s!=null?`No docs instance found matching '${s}'.
4317
4317
 
4318
4318
  Available instances:
4319
- ${C}`:"No docs instance found. Failed to register.",void 0,{code:S.Code.ConfigError});return}let x=(typeof E.customDomain=="string"?[E.customDomain]:E.customDomain??[]).map(fZl);dZl(E.url,x,i),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${E.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let v;return await i.runInteractiveTask({name:E.url},async()=>{let C=performance.now(),O=()=>Icp({docsWorkspace:n,customDomains:x,domain:E.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,previewId:c,editThisPage:E.editThisPage,disableTemplates:u,skipUpload:l,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:E.audiences?Array.isArray(E.audiences)?E.audiences:[E.audiences]:void 0,docsUrl:E.url,cliVersion:p,ciSource:d,deployerAuthor:f,loginCommand:m,multiSource:E.multiSource??!1,docsVisibility:g});for(let R=0;;R++)try{v=await O();break}catch(P){if(!(P instanceof sSt)||R>=XYt.length){if(P instanceof sSt)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.",void 0,{code:S.Code.NetworkError});throw P}let M=XYt[R]??XYt[XYt.length-1]??6e4,J=M/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${J} minute${J===1?"":"s"} (attempt ${R+1}/${XYt.length})...`),await new Promise(X=>setTimeout(X,M))}let D=performance.now()-C;i.logger.debug(`Docs publishing completed in ${D.toFixed(0)}ms`)}),v}Ft();var Ybi=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,previewId:n,skipUpload:i}){let o=new vd({context:this.context,task:this.task});try{let s=await ZYt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:o,token:this.token,instanceUrl:t,preview:r,previewId:n,disableTemplates:void 0,skipUpload:i,cliVersion:"5.139.0",loginCommand:"fern auth login"});return o.getResult()===df.Failure?{success:!1}:{success:!0,url:s}}catch(s){return{success:!1,error:Fn(s)}}}};wt();In();var aSt=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
4319
+ ${C}`:"No docs instance found. Failed to register.",void 0,{code:S.Code.ConfigError});return}let x=(typeof E.customDomain=="string"?[E.customDomain]:E.customDomain??[]).map(fZl);dZl(E.url,x,i),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${E.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let v;return await i.runInteractiveTask({name:E.url},async()=>{let C=performance.now(),O=()=>Icp({docsWorkspace:n,customDomains:x,domain:E.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,previewId:c,editThisPage:E.editThisPage,disableTemplates:u,skipUpload:l,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:E.audiences?Array.isArray(E.audiences)?E.audiences:[E.audiences]:void 0,docsUrl:E.url,cliVersion:p,ciSource:d,deployerAuthor:f,loginCommand:m,multiSource:E.multiSource??!1,docsVisibility:g});for(let R=0;;R++)try{v=await O();break}catch(P){if(!(P instanceof sSt)||R>=XYt.length){if(P instanceof sSt)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.",void 0,{code:S.Code.NetworkError});throw P}let M=XYt[R]??XYt[XYt.length-1]??6e4,J=M/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${J} minute${J===1?"":"s"} (attempt ${R+1}/${XYt.length})...`),await new Promise(X=>setTimeout(X,M))}let D=performance.now()-C;i.logger.debug(`Docs publishing completed in ${D.toFixed(0)}ms`)}),v}Ft();var Ybi=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,previewId:n,skipUpload:i}){let o=new vd({context:this.context,task:this.task});try{let s=await ZYt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:o,token:this.token,instanceUrl:t,preview:r,previewId:n,disableTemplates:void 0,skipUpload:i,cliVersion:"5.139.1",loginCommand:"fern auth login"});return o.getResult()===df.Failure?{success:!1}:{success:!0,url:s}}catch(s){return{success:!1,error:Fn(s)}}}};wt();In();var aSt=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
4320
4320
  `),this.stream.write(`${fe.cyan("\u25C6")} ${fe.bold(t.title)}
4321
4321
  `),t.subtitle!=null&&this.stream.write(` ${fe.dim(t.subtitle)}
4322
4322
  `),this.stream.write(`
@@ -5008,7 +5008,7 @@ ${r}`}function ECi(e){let t=this,{emitParseErrors:r,...n}={...t.data("settings")
5008
5008
  `),g="";return c&&(g=l.style.error(c)),[`${p} ${f} ${s}`,[m,g].filter(Boolean).join(`
5009
5009
  `)]});var nAA=Hx((e,t)=>{let{validate:r=()=>!0}=e,n=PI(e.theme),[i,o]=au("idle"),[s,a]=au(),[c,u]=au(""),l=qx({status:i,theme:n});Wx(async(g,A)=>{if(i==="idle")if(Gx(g)){let y=c;o("loading");let E=await r(y);E===!0?(u(y),o("done"),t(y)):(A.write(c),a(E||"You must provide a valid value"),o("idle"))}else u(A.line),a(void 0)});let p=n.style.message(e.message,i),d="",f;e.mask?d=(typeof e.mask=="string"?e.mask:"*").repeat(c.length):i!=="done"&&(f=`${n.style.help("[input is masked]")}${ZTt}`),i==="done"&&(d=n.style.answer(d));let m="";return s&&(m=n.style.error(s)),[[l,p,e.mask?d:f].join(" "),m]});var yGe=be(sS(),1);var iAA={icon:{cursor:jC.pointer},style:{disabled:e=>yGe.default.dim(`- ${e}`),searchTerm:e=>yGe.default.cyan(e),description:e=>yGe.default.cyan(e),keysHelpTip:e=>e.map(([t,r])=>`${yGe.default.bold(t)} ${yGe.default.dim(r)}`).join(yGe.default.dim(" \u2022 "))},helpMode:"always"};function I4s(e){return!Pd.isSeparator(e)&&!e.disabled}function oAA(e){return e.map(t=>{if(Pd.isSeparator(t))return t;if(typeof t=="string")return{value:t,name:t,short:t,disabled:!1};let r=t.name??String(t.value),n={value:t.value,name:r,short:t.short??r,disabled:t.disabled??!1};return t.description&&(n.description=t.description),n})}var sAA=Hx((e,t)=>{let{pageSize:r=7,validate:n=()=>!0}=e,i=PI(iAA,e.theme),[o,s]=au("loading"),[a,c]=au(""),[u,l]=au([]),[p,d]=au(),f=qx({status:o,theme:i}),m=UL(()=>{let M=u.findIndex(I4s),J=u.findLastIndex(I4s);return{first:M,last:J}},[u]),[g=m.first,A]=au();K4(()=>{let M=new AbortController;return s("loading"),d(void 0),(async()=>{try{let X=await e.source(a||void 0,{signal:M.signal});M.signal.aborted||(A(void 0),d(void 0),l(oAA(X)),s("idle"))}catch(X){!M.signal.aborted&&X instanceof Error&&d(X.message)}})(),()=>{M.abort()}},[a]);let y=u[g];Wx(async(M,J)=>{if(Gx(M))if(y){s("loading");let X=await n(y.value);s("idle"),X===!0?(s("done"),t(y.value)):y.name===a?d(X||"You must provide a valid value"):(J.write(y.name),c(y.name))}else J.write(a);else if(eAe(M)&&y)J.clearLine(0),J.write(y.name),c(y.name);else if(o!=="loading"&&(QB(M)||VL(M))){if(J.clearLine(0),QB(M)&&g!==m.first||VL(M)&&g!==m.last){let X=QB(M)?-1:1,$=g;do $=($+X+u.length)%u.length;while(!I4s(u[$]));A($)}}else c(J.line)});let E=i.style.message(e.message,o),x;if(i.helpMode!=="never")if(e.instructions){let{pager:M,navigation:J}=e.instructions;x=i.style.help(u.length>r?M:J)}else x=i.style.keysHelpTip([["\u2191\u2193","navigate"],["\u23CE","select"]]);let v=mGe({items:u,active:g,renderItem({item:M,isActive:J}){if(Pd.isSeparator(M))return` ${M.separator}`;if(M.disabled){let ie=typeof M.disabled=="string"?M.disabled:"(disabled)";return i.style.disabled(`${M.name} ${ie}`)}let X=J?i.style.highlight:ie=>ie,$=J?i.icon.cursor:" ";return X(`${$} ${M.name}`)},pageSize:r,loop:!1}),C;p?C=i.style.error(p):u.length===0&&a!==""&&o==="idle"&&(C=i.style.error("No results found"));let O;if(o==="done"&&y)return[f,E,i.style.answer(y.short)].filter(Boolean).join(" ").trimEnd();O=i.style.searchTerm(a);let D=y?.description,R=[f,E,O].filter(Boolean).join(" ").trimEnd(),P=[C??v," ",D?i.style.description(D):"",x].filter(Boolean).join(`
5010
5010
  `).trimEnd();return[R,P]});var eOt=be(sS(),1);var aAA={icon:{cursor:jC.pointer},style:{disabled:e=>eOt.default.dim(`- ${e}`),description:e=>eOt.default.cyan(e),keysHelpTip:e=>e.map(([t,r])=>`${eOt.default.bold(t)} ${eOt.default.dim(r)}`).join(eOt.default.dim(" \u2022 "))},helpMode:"always",indexMode:"hidden",keybindings:[]};function $Tt(e){return!Pd.isSeparator(e)&&!e.disabled}function cAA(e){return e.map(t=>{if(Pd.isSeparator(t))return t;if(typeof t=="string")return{value:t,name:t,short:t,disabled:!1};let r=t.name??String(t.value),n={value:t.value,name:r,short:t.short??r,disabled:t.disabled??!1};return t.description&&(n.description=t.description),n})}var v4s=Hx((e,t)=>{let{loop:r=!0,pageSize:n=7}=e,i=PI(aAA,e.theme),{keybindings:o}=i,[s,a]=au("idle"),c=qx({status:s,theme:i}),u=dGe(),l=!o.includes("vim"),p=UL(()=>cAA(e.choices),[e.choices]),d=UL(()=>{let D=p.findIndex($Tt),R=p.findLastIndex($Tt);if(D===-1)throw new Fce("[select prompt] No selectable choices. All choices are disabled.");return{first:D,last:R}},[p]),f=UL(()=>"default"in e?p.findIndex(D=>$Tt(D)&&D.value===e.default):-1,[e.default,p]),[m,g]=au(f===-1?d.first:f),A=p[m];Wx((D,R)=>{if(clearTimeout(u.current),Gx(D))a("done"),t(A.value);else if(QB(D,o)||VL(D,o)){if(R.clearLine(0),r||QB(D,o)&&m!==d.first||VL(D,o)&&m!==d.last){let P=QB(D,o)?-1:1,M=m;do M=(M+P+p.length)%p.length;while(!$Tt(p[M]));g(M)}}else if(ner(D)&&!Number.isNaN(Number(R.line))){let P=Number(R.line)-1,M=-1,J=p.findIndex($=>Pd.isSeparator($)?!1:(M++,M===P)),X=p[J];X!=null&&$Tt(X)&&g(J),u.current=setTimeout(()=>{R.clearLine(0)},700)}else if(lGe(D))R.clearLine(0);else if(l){let P=R.line.toLowerCase(),M=p.findIndex(J=>Pd.isSeparator(J)||!$Tt(J)?!1:J.name.toLowerCase().startsWith(P));M!==-1&&g(M),u.current=setTimeout(()=>{R.clearLine(0)},700)}}),K4(()=>()=>{clearTimeout(u.current)},[]);let y=i.style.message(e.message,s),E;if(i.helpMode!=="never")if(e.instructions){let{pager:D,navigation:R}=e.instructions;E=i.style.help(p.length>n?D:R)}else E=i.style.keysHelpTip([["\u2191\u2193","navigate"],["\u23CE","select"]]);let x=0,v=mGe({items:p,active:m,renderItem({item:D,isActive:R,index:P}){if(Pd.isSeparator(D))return x++,` ${D.separator}`;let M=i.indexMode==="number"?`${P+1-x}. `:"";if(D.disabled){let $=typeof D.disabled=="string"?D.disabled:"(disabled)";return i.style.disabled(`${M}${D.name} ${$}`)}let J=R?i.style.highlight:$=>$,X=R?i.icon.cursor:" ";return J(`${X} ${M}${D.name}`)},pageSize:n,loop:r});if(s==="done")return[c,y,i.style.answer(A.short)].filter(Boolean).join(" ");let{description:C}=A;return`${[[c,y].filter(Boolean).join(" "),v," ",C?i.style.description(C):"",E].filter(Boolean).join(`
5011
- `).trimEnd()}${ZTt}`});In();Vi();var Nce={GENERATION_STARTED:"generation_started",GENERATION_COMPLETED:"generation_completed",GENERATION_FAILED:"generation_failed",VERIFICATION_FAILED:"verification_failed",SDK_PR_CREATED:"sdk_pr_created",UPGRADE_APPLIED:"upgrade_applied",MAJOR_VERSION_BUMP:"major_version_bump"},uAA={[Nce.GENERATION_STARTED]:!1,[Nce.GENERATION_COMPLETED]:!1,[Nce.GENERATION_FAILED]:!0,[Nce.VERIFICATION_FAILED]:!0,[Nce.SDK_PR_CREATED]:!1,[Nce.UPGRADE_APPLIED]:!1,[Nce.MAJOR_VERSION_BUMP]:!1};function bwp(e){return uAA[e]}function Ewp(e,t){return{automation_mode:!0,surface:"cli",action:t.action,run_id:t.run_id,github_run_id:t.github_run_id,github_run_url:t.github_run_url,org:t.org,config_repo:t.config_repo,config_commit_sha:t.config_commit_sha,config_branch:t.config_branch,config_pr_number:t.config_pr_number,trigger:t.trigger,cli_version:t.cli_version,...e.errorCode!==void 0?{error_code:e.errorCode}:{},...e.attributes??{}}}function Iwp(e,t){function r(i,o,s){s!=null&&(i[o]=s)}let n={surface:"cli",automation_mode:"true"};return r(n,"event",e.event),r(n,"action",t.action),r(n,"run_id",t.run_id),r(n,"org",t.org),r(n,"config_repo",t.config_repo),r(n,"trigger",t.trigger),r(n,"error_code",e.errorCode??"none"),n}function vwp(e,t){return{github_run_id:t.github_run_id,github_run_url:t.github_run_url,config_commit_sha:t.config_commit_sha,config_branch:t.config_branch,config_pr_number:t.config_pr_number,cli_version:t.cli_version,...e.attributes??{}}}function xwp(e,t){return{event:e.event,timestamp:new Date().toISOString(),surface:"cli",action:t.action,run_id:t.run_id,github_run_id:t.github_run_id,github_run_url:t.github_run_url,org:t.org,config_repo:t.config_repo,config_commit_sha:t.config_commit_sha,config_branch:t.config_branch,config_pr_number:t.config_pr_number,trigger:t.trigger,cli_version:t.cli_version,...e.errorCode!==void 0?{error_code:e.errorCode}:{},...e.attributes??{}}}function Cwp(e){let t=e.join(" ");return/\bautomations\s+generate\b/.test(t)?Nce.GENERATION_FAILED:/\bautomations\s+preview\b/.test(t)?Nce.VERIFICATION_FAILED:Nce.GENERATION_FAILED}var lAA="",pAA="FERN_AUTOMATION_EVENTS_ORIGIN",fAA=3e3,rwi=class e{static instance;origin;inflight=[];static getInstance(){return e.instance==null&&(e.instance=new e(process.env[pAA]??lAA)),e.instance}constructor(t){this.origin=t}resolveEndpoint(){if(this.origin.length!==0)return`${this.origin.replace(/\/$/,"")}/v1/automation/events`}post(t,r){this.inflight.push(this.send(t,r))}async shutdown(){let t=this.inflight;this.inflight=[],t.length>0&&await Promise.allSettled(t)}async send(t,r){let n=this.resolveEndpoint();if(n==null)return;let i=new AbortController,o=setTimeout(()=>i.abort(),fAA);try{let s={"content-type":"application/json"},a=await bz();a!=null&&a.value.length>0&&(s.Authorization=`Bearer ${a.value}`);let c=await fetch(n,{method:"POST",headers:s,body:JSON.stringify(xwp(t,r)),signal:i.signal})}catch{return}finally{clearTimeout(o)}}};function wwp(){let{fern_run_id:e,github_run_id:t}=fue();return{action:process.env.FERN_ACTION,run_id:e,github_run_id:t,github_run_url:process.env.FERN_GITHUB_RUN_URL,org:void 0,config_repo:process.env.FERN_CONFIG_REPO,config_commit_sha:process.env.FERN_CONFIG_COMMIT_SHA,config_branch:process.env.FERN_CONFIG_BRANCH,config_pr_number:process.env.FERN_CONFIG_PR_NUMBER,trigger:process.env.GITHUB_EVENT_NAME,cli_version:"5.139.0"}}function Swp(){return process.env.FERN_AUTOMATION==="true"}var nwi=class{constructor(t,r=rwi.getInstance()){this.reporter=t;this.automationEventApiClient=r;this.context=wwp()}reporter;automationEventApiClient;context;setOrganization(t){this.context={...this.context,org:t}}emit(t,r){let n=this.captureSentryForFailure({event:t,context:this.context,error:r?.error}),i=n==null?t:{...t,attributes:{...t.attributes??{},sentry_event_id:n}};this.capturePostHogEvent({event:i,context:this.context}),this.captureAutomationEventApiEvent(i,this.context)}async flush(){await this.automationEventApiClient.shutdown()}capturePostHogEvent({event:t,context:r}){this.reporter.instrumentPostHogAutomationEvent({distinctId:r.run_id??void 0,event:t.event,properties:Ewp(t,r)})}captureSentryForFailure({event:t,context:r,error:n}){if(!(!bwp(t.event)||t.errorCode==null))return this.reporter.captureException(n,{tags:Iwp(t,r),context:{automation:vwp(t,r)}})}captureAutomationEventApiEvent(t,r){this.automationEventApiClient.post(t,r)}};Ft();function iwi(e,t,r){if(t instanceof Xc)return;let n=QNe(t,r?.code),i=r?.argv??process.argv,o=i.join(" "),s=r?.message??(t instanceof Error?t.message:void 0)??"",a=t??new S({message:s,code:n});Swp()?mAA(i,e,n,s,a):dAA(e,o,n,a)}function dAA(e,t,r,n){e.instrumentPostHogEvent({command:t,properties:{failed:!0,errorCode:r}}),ORt(r)&&e.captureException(n,{tags:{"error.code":r}})}function mAA(e,t,r,n,i){let o=Cwp(e);t.emitAutomationTelemetryEvent({event:o,errorCode:r,attributes:{error_message:n}},{error:i})}Ft();function bGe(){return process.env.FERN_DISABLE_TELEMETRY==="true"}function owi({cliName:e,packageVersion:t,isLocal:r}){return bGe()||r?!1:!(t==="0.0.0")&&(e==="fern"&&!0)}var swi=class{sentry;constructor({release:t,telemetry:r}){let n="https://84f58b5e457f06999d92f11ce4b79158@o4509504076185600.ingest.us.sentry.io/4511021546602496";if(owi(r)&&n!=null&&n.length>0){let i="production";if(i==null||i.length===0)throw new S({message:"SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured",code:S.Code.ConfigError});this.sentry=ERt({dsn:n,release:t,environment:i,defaultIntegrations:!1,integrations:[m7e(),oye(),sye(),_Ae(),iye()],tracesSampleRate:0,attachStacktrace:!0,sendClientReports:!1}),IRt()}}captureException(t,r){if(this.sentry!=null)try{let n=r?.tags,i=r?.context,o=n!=null&&Object.keys(n).length>0,s=i!=null&&Object.values(i).some(a=>a!=null);return!o&&!s?this.sentry.captureException(t):UO(a=>{if(o&&a.setTags(n),i!=null)for(let[c,u]of Object.entries(i))u!=null&&a.setContext(c,u);return this.sentry?.captureException(t,void 0,a)})}catch{return}}async flush(){this.sentry!=null&&await Promise.resolve(this.sentry.flush(2e3)).catch(()=>{})}};Ft();var awi=class{originalWrite;redirected=!1;redirect(){if(this.redirected)throw new S({message:"StdoutRedirector: already redirected \u2014 did you forget to restore()?",code:S.Code.InternalError});this.originalWrite=process.stdout.write,process.stdout.write=process.stderr.write.bind(process.stderr),this.redirected=!0}restore(){!this.redirected||this.originalWrite==null||(process.stdout.write=this.originalWrite,this.originalWrite=void 0,this.redirected=!1)}async withRedirect(t){this.redirect();try{return await t()}finally{this.restore()}}};kfe();wt();jb();Ft();In();var aer=class{result=df.Success;lastFailureMessage=void 0;logImmediately;logPrefix;title;subtasks=[];shouldBufferLogs;bufferedLogs=[];status="notStarted";onResult;instrumentPostHogEventImpl;captureExceptionImpl;emitAutomationTelemetryEventImpl;constructor({logImmediately:t,logPrefix:r,title:n,takeOverTerminal:i,onResult:o,shouldBufferLogs:s,instrumentPostHogEvent:a,captureException:c,emitAutomationTelemetryEvent:u}){this.logImmediately=t,this.logPrefix=r??"",this.title=n,this.takeOverTerminal=i,this.onResult=o,this.shouldBufferLogs=s,this.instrumentPostHogEventImpl=a,this.captureExceptionImpl=c,this.emitAutomationTelemetryEventImpl=u}start(){return this.status="running",this}isStarted(){return this.status!=="notStarted"}finish(){this.status!=="finished"&&(this.status="finished",this.flushLogs(),this.onResult?.(this.getResult()))}isFinished(){return this.status==="finished"}takeOverTerminal;failAndThrow(t,r,n){throw this.failWithoutThrowing(t,r,n),this.finish(),new Xc}failWithoutThrowing(t,r,n){this.result=df.Failure,!(r instanceof Xc)&&(t!=null&&(this.lastFailureMessage=t),y4t({message:t,error:r,logger:this.logger}),iwi(this,r,{...n,message:t}))}getLastFailureMessage(){return this.lastFailureMessage}captureException(t,r){return this.captureExceptionImpl?.(t,r)}emitAutomationTelemetryEvent(t,r){this.emitAutomationTelemetryEventImpl(t,r)}getResult(){return this.result}instrumentPostHogEvent(t){this.instrumentPostHogEventImpl(t)}logAtLevel(t,...r){this.logAtLevelWithOverrides(t,r)}logAtLevelWithOverrides(t,r,n={}){this.log({parts:r,level:t,time:new Date,...n})}log(t){this.bufferedLogs.push({...t,prefix:this.logPrefix}),this.shouldBufferLogs||this.flushLogs()}flushLogs(){this.logImmediately(this.bufferedLogs),this.bufferedLogs=[]}logger=jv(this.logAtLevel.bind(this));addInteractiveTask({name:t,subtitle:r}){let n=new x4s({name:t,subtitle:r,logImmediately:i=>this.logImmediately(i),logPrefix:`${this.logPrefix}${fe.blackBright(t)} `,takeOverTerminal:this.takeOverTerminal,onResult:this.onResult,shouldBufferLogs:this.shouldBufferLogs,instrumentPostHogEvent:i=>this.instrumentPostHogEventImpl(i),captureException:this.captureExceptionImpl,emitAutomationTelemetryEvent:this.emitAutomationTelemetryEventImpl});return this.subtasks.push(n),n}async runInteractiveTask(t,r){let n=this.addInteractiveTask(t).start();try{await r(n)}catch(i){n.failWithoutThrowing(void 0,i)}finally{n.finish()}return n.getResult()===df.Success}printInteractiveTasks({spinner:t}){return this.subtasks.map(r=>r.print({spinner:t})).join(`
5011
+ `).trimEnd()}${ZTt}`});In();Vi();var Nce={GENERATION_STARTED:"generation_started",GENERATION_COMPLETED:"generation_completed",GENERATION_FAILED:"generation_failed",VERIFICATION_FAILED:"verification_failed",SDK_PR_CREATED:"sdk_pr_created",UPGRADE_APPLIED:"upgrade_applied",MAJOR_VERSION_BUMP:"major_version_bump"},uAA={[Nce.GENERATION_STARTED]:!1,[Nce.GENERATION_COMPLETED]:!1,[Nce.GENERATION_FAILED]:!0,[Nce.VERIFICATION_FAILED]:!0,[Nce.SDK_PR_CREATED]:!1,[Nce.UPGRADE_APPLIED]:!1,[Nce.MAJOR_VERSION_BUMP]:!1};function bwp(e){return uAA[e]}function Ewp(e,t){return{automation_mode:!0,surface:"cli",action:t.action,run_id:t.run_id,github_run_id:t.github_run_id,github_run_url:t.github_run_url,org:t.org,config_repo:t.config_repo,config_commit_sha:t.config_commit_sha,config_branch:t.config_branch,config_pr_number:t.config_pr_number,trigger:t.trigger,cli_version:t.cli_version,...e.errorCode!==void 0?{error_code:e.errorCode}:{},...e.attributes??{}}}function Iwp(e,t){function r(i,o,s){s!=null&&(i[o]=s)}let n={surface:"cli",automation_mode:"true"};return r(n,"event",e.event),r(n,"action",t.action),r(n,"run_id",t.run_id),r(n,"org",t.org),r(n,"config_repo",t.config_repo),r(n,"trigger",t.trigger),r(n,"error_code",e.errorCode??"none"),n}function vwp(e,t){return{github_run_id:t.github_run_id,github_run_url:t.github_run_url,config_commit_sha:t.config_commit_sha,config_branch:t.config_branch,config_pr_number:t.config_pr_number,cli_version:t.cli_version,...e.attributes??{}}}function xwp(e,t){return{event:e.event,timestamp:new Date().toISOString(),surface:"cli",action:t.action,run_id:t.run_id,github_run_id:t.github_run_id,github_run_url:t.github_run_url,org:t.org,config_repo:t.config_repo,config_commit_sha:t.config_commit_sha,config_branch:t.config_branch,config_pr_number:t.config_pr_number,trigger:t.trigger,cli_version:t.cli_version,...e.errorCode!==void 0?{error_code:e.errorCode}:{},...e.attributes??{}}}function Cwp(e){let t=e.join(" ");return/\bautomations\s+generate\b/.test(t)?Nce.GENERATION_FAILED:/\bautomations\s+preview\b/.test(t)?Nce.VERIFICATION_FAILED:Nce.GENERATION_FAILED}var lAA="",pAA="FERN_AUTOMATION_EVENTS_ORIGIN",fAA=3e3,rwi=class e{static instance;origin;inflight=[];static getInstance(){return e.instance==null&&(e.instance=new e(process.env[pAA]??lAA)),e.instance}constructor(t){this.origin=t}resolveEndpoint(){if(this.origin.length!==0)return`${this.origin.replace(/\/$/,"")}/v1/automation/events`}post(t,r){this.inflight.push(this.send(t,r))}async shutdown(){let t=this.inflight;this.inflight=[],t.length>0&&await Promise.allSettled(t)}async send(t,r){let n=this.resolveEndpoint();if(n==null)return;let i=new AbortController,o=setTimeout(()=>i.abort(),fAA);try{let s={"content-type":"application/json"},a=await bz();a!=null&&a.value.length>0&&(s.Authorization=`Bearer ${a.value}`);let c=await fetch(n,{method:"POST",headers:s,body:JSON.stringify(xwp(t,r)),signal:i.signal})}catch{return}finally{clearTimeout(o)}}};function wwp(){let{fern_run_id:e,github_run_id:t}=fue();return{action:process.env.FERN_ACTION,run_id:e,github_run_id:t,github_run_url:process.env.FERN_GITHUB_RUN_URL,org:void 0,config_repo:process.env.FERN_CONFIG_REPO,config_commit_sha:process.env.FERN_CONFIG_COMMIT_SHA,config_branch:process.env.FERN_CONFIG_BRANCH,config_pr_number:process.env.FERN_CONFIG_PR_NUMBER,trigger:process.env.GITHUB_EVENT_NAME,cli_version:"5.139.1"}}function Swp(){return process.env.FERN_AUTOMATION==="true"}var nwi=class{constructor(t,r=rwi.getInstance()){this.reporter=t;this.automationEventApiClient=r;this.context=wwp()}reporter;automationEventApiClient;context;setOrganization(t){this.context={...this.context,org:t}}emit(t,r){let n=this.captureSentryForFailure({event:t,context:this.context,error:r?.error}),i=n==null?t:{...t,attributes:{...t.attributes??{},sentry_event_id:n}};this.capturePostHogEvent({event:i,context:this.context}),this.captureAutomationEventApiEvent(i,this.context)}async flush(){await this.automationEventApiClient.shutdown()}capturePostHogEvent({event:t,context:r}){this.reporter.instrumentPostHogAutomationEvent({distinctId:r.run_id??void 0,event:t.event,properties:Ewp(t,r)})}captureSentryForFailure({event:t,context:r,error:n}){if(!(!bwp(t.event)||t.errorCode==null))return this.reporter.captureException(n,{tags:Iwp(t,r),context:{automation:vwp(t,r)}})}captureAutomationEventApiEvent(t,r){this.automationEventApiClient.post(t,r)}};Ft();function iwi(e,t,r){if(t instanceof Xc)return;let n=QNe(t,r?.code),i=r?.argv??process.argv,o=i.join(" "),s=r?.message??(t instanceof Error?t.message:void 0)??"",a=t??new S({message:s,code:n});Swp()?mAA(i,e,n,s,a):dAA(e,o,n,a)}function dAA(e,t,r,n){e.instrumentPostHogEvent({command:t,properties:{failed:!0,errorCode:r}}),ORt(r)&&e.captureException(n,{tags:{"error.code":r}})}function mAA(e,t,r,n,i){let o=Cwp(e);t.emitAutomationTelemetryEvent({event:o,errorCode:r,attributes:{error_message:n}},{error:i})}Ft();function bGe(){return process.env.FERN_DISABLE_TELEMETRY==="true"}function owi({cliName:e,packageVersion:t,isLocal:r}){return bGe()||r?!1:!(t==="0.0.0")&&(e==="fern"&&!0)}var swi=class{sentry;constructor({release:t,telemetry:r}){let n="https://84f58b5e457f06999d92f11ce4b79158@o4509504076185600.ingest.us.sentry.io/4511021546602496";if(owi(r)&&n!=null&&n.length>0){let i="production";if(i==null||i.length===0)throw new S({message:"SENTRY_ENVIRONMENT must be set when SENTRY_DSN is configured",code:S.Code.ConfigError});this.sentry=ERt({dsn:n,release:t,environment:i,defaultIntegrations:!1,integrations:[m7e(),oye(),sye(),_Ae(),iye()],tracesSampleRate:0,attachStacktrace:!0,sendClientReports:!1}),IRt()}}captureException(t,r){if(this.sentry!=null)try{let n=r?.tags,i=r?.context,o=n!=null&&Object.keys(n).length>0,s=i!=null&&Object.values(i).some(a=>a!=null);return!o&&!s?this.sentry.captureException(t):UO(a=>{if(o&&a.setTags(n),i!=null)for(let[c,u]of Object.entries(i))u!=null&&a.setContext(c,u);return this.sentry?.captureException(t,void 0,a)})}catch{return}}async flush(){this.sentry!=null&&await Promise.resolve(this.sentry.flush(2e3)).catch(()=>{})}};Ft();var awi=class{originalWrite;redirected=!1;redirect(){if(this.redirected)throw new S({message:"StdoutRedirector: already redirected \u2014 did you forget to restore()?",code:S.Code.InternalError});this.originalWrite=process.stdout.write,process.stdout.write=process.stderr.write.bind(process.stderr),this.redirected=!0}restore(){!this.redirected||this.originalWrite==null||(process.stdout.write=this.originalWrite,this.originalWrite=void 0,this.redirected=!1)}async withRedirect(t){this.redirect();try{return await t()}finally{this.restore()}}};kfe();wt();jb();Ft();In();var aer=class{result=df.Success;lastFailureMessage=void 0;logImmediately;logPrefix;title;subtasks=[];shouldBufferLogs;bufferedLogs=[];status="notStarted";onResult;instrumentPostHogEventImpl;captureExceptionImpl;emitAutomationTelemetryEventImpl;constructor({logImmediately:t,logPrefix:r,title:n,takeOverTerminal:i,onResult:o,shouldBufferLogs:s,instrumentPostHogEvent:a,captureException:c,emitAutomationTelemetryEvent:u}){this.logImmediately=t,this.logPrefix=r??"",this.title=n,this.takeOverTerminal=i,this.onResult=o,this.shouldBufferLogs=s,this.instrumentPostHogEventImpl=a,this.captureExceptionImpl=c,this.emitAutomationTelemetryEventImpl=u}start(){return this.status="running",this}isStarted(){return this.status!=="notStarted"}finish(){this.status!=="finished"&&(this.status="finished",this.flushLogs(),this.onResult?.(this.getResult()))}isFinished(){return this.status==="finished"}takeOverTerminal;failAndThrow(t,r,n){throw this.failWithoutThrowing(t,r,n),this.finish(),new Xc}failWithoutThrowing(t,r,n){this.result=df.Failure,!(r instanceof Xc)&&(t!=null&&(this.lastFailureMessage=t),y4t({message:t,error:r,logger:this.logger}),iwi(this,r,{...n,message:t}))}getLastFailureMessage(){return this.lastFailureMessage}captureException(t,r){return this.captureExceptionImpl?.(t,r)}emitAutomationTelemetryEvent(t,r){this.emitAutomationTelemetryEventImpl(t,r)}getResult(){return this.result}instrumentPostHogEvent(t){this.instrumentPostHogEventImpl(t)}logAtLevel(t,...r){this.logAtLevelWithOverrides(t,r)}logAtLevelWithOverrides(t,r,n={}){this.log({parts:r,level:t,time:new Date,...n})}log(t){this.bufferedLogs.push({...t,prefix:this.logPrefix}),this.shouldBufferLogs||this.flushLogs()}flushLogs(){this.logImmediately(this.bufferedLogs),this.bufferedLogs=[]}logger=jv(this.logAtLevel.bind(this));addInteractiveTask({name:t,subtitle:r}){let n=new x4s({name:t,subtitle:r,logImmediately:i=>this.logImmediately(i),logPrefix:`${this.logPrefix}${fe.blackBright(t)} `,takeOverTerminal:this.takeOverTerminal,onResult:this.onResult,shouldBufferLogs:this.shouldBufferLogs,instrumentPostHogEvent:i=>this.instrumentPostHogEventImpl(i),captureException:this.captureExceptionImpl,emitAutomationTelemetryEvent:this.emitAutomationTelemetryEventImpl});return this.subtasks.push(n),n}async runInteractiveTask(t,r){let n=this.addInteractiveTask(t).start();try{await r(n)}catch(i){n.failWithoutThrowing(void 0,i)}finally{n.finish()}return n.getResult()===df.Success}printInteractiveTasks({spinner:t}){return this.subtasks.map(r=>r.print({spinner:t})).join(`
5012
5012
  `)}},x4s=class extends aer{name;subtitle;constructor({name:t,subtitle:r,...n}){super(n),this.name=t,this.subtitle=r}start(){return super.start(),this.logAtLevelWithOverrides(Hn.Info,["Started."],{omitOnTTY:!0}),this.flushLogs(),this}isStarted(){return this.status!=="notStarted"}finish(){this.status!=="finished"&&(this.result===df.Success?this.logAtLevelWithOverrides(Hn.Info,["Finished."],{omitOnTTY:!0}):this.logAtLevelWithOverrides(Hn.Error,["Failed."],{omitOnTTY:!0}),super.finish())}setSubtitle(t){this.subtitle=t}print({spinner:t}){let r=[this.name];return this.subtitle!=null&&r.push(fe.dim(this.subtitle)),r.push(...this.subtasks.map(n=>n.print({spinner:t}))),Lj({prefix:this.getIcon({spinner:t}),content:r.join(`
5013
5013
  `)})}printInteractiveTasks({spinner:t}){return this.print({spinner:t})}getIcon({spinner:t}){let r=this.subtasks.length>0;switch(this.status){case"notStarted":return r?fe.dim("\u25B8 "):fe.dim("\u25E6 ");case"running":return r?fe.cyan("\u25BE "):t;case"finished":switch(this.getResult()){case df.Success:return r?fe.green("\u25BE "):fe.green("\u2713 ");case df.Failure:return r?fe.red("\u25BE "):fe.red("x ")}}}getResult(){if(this.result===df.Failure)return df.Failure;for(let t of this.subtasks)if(t.getResult()===df.Failure)return df.Failure;return df.Success}};Ft();var Twp=be(NLe(),1);In();function Owp(e){return e.filter(t=>t.isUpgradeAvailable).length>0}function hAA(e){return(e.cliUpgradeInfo?.isUpgradeAvailable??!1)||Owp(e.generatorUpgradeInfo)}async function Pwp({cliEnvironment:e,upgradeInfo:t}){if(!hAA(t)||e.packageVersion==t.cliUpgradeInfo?.latestVersion)return;let r=`${fe.underline("Upgrades available")}
5014
5014
 
@@ -5017,7 +5017,7 @@ ${r}`}function ECi(e){let t=this,{emitParseErrors:r,...n}={...t.data("settings")
5017
5017
  Run ${fe.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
5018
5018
  Run ${fe.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),Xst(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function C4s({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!Owp(e))return;let i=t??"",o=e.filter(a=>a.isUpgradeAvailable);r!=null&&(o=o.slice(0,r+1));let s=o.sort((a,c)=>a.generatorName.localeCompare(c.generatorName)||a.currentVersion.localeCompare(c.currentVersion));for(let a of s)i+=`
5019
5019
  ${await gAA(a.generatorName)} (${a.apiName!=null?"API: "+a.apiName+", ":""}Group: ${a.generatorGroup}) `+fe.dim(a.currentVersion)+fe.reset(" \u2192 ")+fe.green(a.latestVersion);return i+=`
5020
- `,n?Xst(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function gAA(e){let r=await new Twp.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new S({message:`Generator ${e} not found`,code:S.Code.ConfigError});return r.body.displayName}ro();Ufe();Ft();var tOt=be(DE(),1);function rOt(e){let t;return()=>(t??=e.runTask(r=>ed(r)),t)}function cwi({generatorId:e,candidateVersion:t,currentVersion:r}){if(!Bwp(t)||!Bwp(r))throw new S({message:`Cannot compare versions for generator "${e}": configured version "${r}", candidate version "${t}". Use valid semantic versions such as 1.2.3.`,code:S.Code.VersionError});try{return t===r?0:rS(t,r)?1:rS(r,t)?-1:0}catch{let n=tOt.default.valid(t),i=tOt.default.valid(r);if(n!=null&&i!=null)return Math.sign(tOt.default.compare(n,i));throw new S({message:`Cannot compare versions for generator "${e}": configured version "${r}", candidate version "${t}". Use valid semantic versions such as 1.2.3.`,code:S.Code.VersionError})}}function Bwp(e){if(e==="latest"||tOt.default.valid(e)!=null)return!0;try{return EH(e),!0}catch{return!1}}async function uwi({generatorId:e,currentVersion:t,includeMajor:r,channel:n,organization:i,getToken:o,context:s}){if(n!=null)throw new Error(`SDK Gen API generator version discovery does not support the requested upgrade channel "${n}". Remove --channel to use executable index versions, or disable FERN_USE_SDK_GEN_API to use FDR channel metadata.`);let a=Hgi();if(a==null)throw new Error("FERN_SDK_GEN_API_ORIGIN is required when FERN_USE_SDK_GEN_API=true");let c=Vk(e);if(c==null)return s.logger.error(`SDK Gen API cannot discover versions for unsupported generator ${e}. Use a canonical first-party SDK generator name or disable FERN_USE_SDK_GEN_API.`),{};let u=await o(),l=new URL("v1/fern/generator-versions/discover",`${a.replace(/\/+$/,"")}/`),p;try{p=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${u.value}`,"X-Fern-Organization-Id":i,"content-type":"application/json"},body:JSON.stringify({targets:[{targetId:"generator",generatorId:e,language:c,currentVersion:t,includeMajor:r}]})})}catch(m){throw new Error(`SDK Gen API version discovery failed for ${e}@${t} because the API could not be reached. Verify FERN_SDK_GEN_API_ORIGIN and the selected environment.`,{cause:m})}if(!p.ok)throw new Error(`SDK Gen API version discovery failed for ${e}@${t} with HTTP ${p.status}. Verify FERN_SDK_GEN_API_ORIGIN and the selected environment.`);let d=await p.json(),f=AAA(d);return f.state==="UNAVAILABLE"?(s.logger.error(`SDK Gen API cannot resolve an executable version for ${e}@${t} (${f.reason}). Publish the coordinate to this environment or choose a supported generator version.`),{}):{compatibleVersion:f.compatibleVersion,withheldMajorVersion:f.withheldMajorVersion}}function AAA(e){if(!Rwp(e,["targets"])||!Array.isArray(e.targets)||e.targets.length!==1)throw new Error("SDK Gen API returned an invalid generator version discovery response");let t=e.targets[0];if(!kwp(t)||t.targetId!=="generator")throw new Error("SDK Gen API returned an invalid generator version discovery target");if(t.state==="UNAVAILABLE"){if(!Rwp(t,["targetId","state","reason"])||t.reason!=="IDENTITY_UNAVAILABLE"&&t.reason!=="LANGUAGE_MISMATCH"&&t.reason!=="VERSION_UNAVAILABLE")throw new Error("SDK Gen API returned an invalid unavailable generator version result");return{targetId:"generator",state:"UNAVAILABLE",reason:t.reason}}if(t.state!=="RESOLVED")throw new Error("SDK Gen API returned an unknown generator version discovery state");if(!Fwp(t,["targetId","state","compatibleVersion","withheldMajorVersion"]))throw new Error("SDK Gen API returned an invalid resolved generator version result");let r=Dwp(t,"compatibleVersion"),n=Dwp(t,"withheldMajorVersion");if(r==null&&n==null)throw new Error("SDK Gen API returned an empty generator version discovery result");return{targetId:"generator",state:"RESOLVED",...r==null?{}:{compatibleVersion:r},...n==null?{}:{withheldMajorVersion:n}}}function Dwp(e,t){if(!Object.hasOwn(e,t))return;let r=e[t];if(typeof r!="string"||tOt.default.valid(r)!==r)throw new S({message:`SDK Gen API returned invalid ${t} ${JSON.stringify(r)}. Expected an exact semantic version such as 1.2.3.`,code:S.Code.VersionError});return r}function kwp(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function Rwp(e,t){return kwp(e)&&Object.keys(e).length===t.length&&Fwp(e,t)}function Fwp(e,t){let r=new Set(t);return Object.keys(e).every(n=>r.has(n))}async function yAA({cliContext:e,project:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let{apiWorkspaces:s}=t,a=EJ()?rOt(e):void 0;if(s.length===1){let u={type:"singleApi",versions:{}};return await Nwp({cliContext:e,apiWorkspaces:s,perGeneratorAction:async(l,p,d,f)=>{u.versions[p]==null&&(u.versions[p]={});let m=wLe(d.name);if(m==null){f.logger.debug(`Skipping unknown generator: ${d.name}`);return}let g=await Qwp({generatorName:d.name,normalizedGeneratorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:d.version,channel:i,includeMajor:o,organization:t.config.organization,getSdkGenApiToken:a,context:f});g!=null&&(u.versions[p][d.name]={previousVersion:d.version,latestVersion:g})},generatorFilter:r,groupFilter:n}),u}let c={type:"multiApi",versions:{}};return await Nwp({cliContext:e,apiWorkspaces:s,perGeneratorAction:async(u,l,p,d)=>{if(u==null)return;c.versions[u]==null&&(c.versions[u]={}),c.versions[u][l]==null&&(c.versions[u][l]={});let f=wLe(p.name);if(f==null){d.logger.debug(`Skipping unknown generator: ${p.name}`);return}let m=await Qwp({generatorName:p.name,normalizedGeneratorName:f,cliVersion:e.environment.packageVersion,currentGeneratorVersion:p.version,channel:i,includeMajor:o,organization:t.config.organization,getSdkGenApiToken:a,context:d});m!=null&&(c.versions[u][l][p.name]={previousVersion:p.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),c}async function Nwp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await c3({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let c=n!=null?qg(n):void 0;for(let u of a.groups)if(!(i!=null&&u.groupName!==i))for(let l of u.generators)c!=null&&l.name!==c||await r(o.workspaceName,u.groupName,l,s)})}))}function jwp(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let c=cwi({generatorId:s,candidateVersion:a.latestVersion,currentVersion:a.previousVersion})===1;r.debug(`Latest version: ${a.latestVersion}. `+(c?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:c,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function Qwp({generatorName:e,normalizedGeneratorName:t,cliVersion:r,currentGeneratorVersion:n,channel:i,includeMajor:o,organization:s,getSdkGenApiToken:a,context:c}){if(EJ()){if(a==null)throw new Error("SDK Gen API generator version discovery requires authentication");return(await uwi({generatorId:qg(e),currentVersion:n,includeMajor:o??!1,channel:i,organization:s,getToken:a,context:c})).compatibleVersion}return LP({generatorName:t,cliVersion:r,currentGeneratorVersion:n,channel:i,includeMajor:o,context:c})}async function lwi({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await yAA({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[c,u]of Object.entries(a.versions))s.push(...jwp(u,c,t.logger));else s.push(...jwp(a.versions,void 0,t.logger))}return s}Ft();$Tr();async function tAe({cliEnvironment:e,includePreReleases:t=!1}){if(e.packageName!=="fern-api"||e.packageVersion==="0.0.0")return e.packageVersion;try{return await PQe(e.packageName,{version:t?"prerelease":"latest"})}catch(r){throw new S({message:`Failed to resolve latest CLI version: ${r instanceof Error?r.message:String(r)}`,code:S.Code.NetworkError})}}var zwp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],pwi=class e{environment;sentryClient;posthogManager;automationTelemetryManager;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Hn.Info;isLocal;stdoutRedirector=new awi;jsonMode=!1;static async create(t,r,{isLocal:n}){let i=await p8t();return new e(t,r,{isLocal:n,posthogManager:i})}constructor(t,r,{isLocal:n,posthogManager:i}){this.ttyAwareLogger=new F4t(t,r),this.isLocal=n??!1,this.posthogManager=i;let o=this.getPackageName(),s=this.getPackageVersion(),a=this.getCliName();(o==null||s==null||a==null)&&this.exitProgram(),this.environment={packageName:o,packageVersion:s,cliName:a},this.sentryClient=new swi({release:`cli@${this.environment.packageVersion}`,telemetry:{cliName:this.environment.cliName,packageVersion:this.environment.packageVersion,isLocal:this.isLocal}}),this.automationTelemetryManager=new nwi(this)}getPackageName(){return"fern-api"}getPackageVersion(){return"5.139.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${fe.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r,n){throw this.failWithoutThrowing(t,r,n),new Xc}failWithoutThrowing(t,r,n){this.didSucceed=!1,!(r instanceof Xc)&&(y4t({message:t,error:r,logger:this.logger}),iwi(this,r,{...n,message:t}))}enableJsonMode(){this.jsonMode||(this.jsonMode=!0,this.stdoutRedirector.redirect())}get isJsonMode(){return this.jsonMode}get isTTY(){return this.ttyAwareLogger.isTTY}writeJsonToStdout(t){this.writeTextToStdout(JSON.stringify(t,null,2)+`
5020
+ `,n?Xst(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function gAA(e){let r=await new Twp.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new S({message:`Generator ${e} not found`,code:S.Code.ConfigError});return r.body.displayName}ro();Ufe();Ft();var tOt=be(DE(),1);function rOt(e){let t;return()=>(t??=e.runTask(r=>ed(r)),t)}function cwi({generatorId:e,candidateVersion:t,currentVersion:r}){if(!Bwp(t)||!Bwp(r))throw new S({message:`Cannot compare versions for generator "${e}": configured version "${r}", candidate version "${t}". Use valid semantic versions such as 1.2.3.`,code:S.Code.VersionError});try{return t===r?0:rS(t,r)?1:rS(r,t)?-1:0}catch{let n=tOt.default.valid(t),i=tOt.default.valid(r);if(n!=null&&i!=null)return Math.sign(tOt.default.compare(n,i));throw new S({message:`Cannot compare versions for generator "${e}": configured version "${r}", candidate version "${t}". Use valid semantic versions such as 1.2.3.`,code:S.Code.VersionError})}}function Bwp(e){if(e==="latest"||tOt.default.valid(e)!=null)return!0;try{return EH(e),!0}catch{return!1}}async function uwi({generatorId:e,currentVersion:t,includeMajor:r,channel:n,organization:i,getToken:o,context:s}){if(n!=null)throw new Error(`SDK Gen API generator version discovery does not support the requested upgrade channel "${n}". Remove --channel to use executable index versions, or disable FERN_USE_SDK_GEN_API to use FDR channel metadata.`);let a=Hgi();if(a==null)throw new Error("FERN_SDK_GEN_API_ORIGIN is required when FERN_USE_SDK_GEN_API=true");let c=Vk(e);if(c==null)return s.logger.error(`SDK Gen API cannot discover versions for unsupported generator ${e}. Use a canonical first-party SDK generator name or disable FERN_USE_SDK_GEN_API.`),{};let u=await o(),l=new URL("v1/fern/generator-versions/discover",`${a.replace(/\/+$/,"")}/`),p;try{p=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${u.value}`,"X-Fern-Organization-Id":i,"content-type":"application/json"},body:JSON.stringify({targets:[{targetId:"generator",generatorId:e,language:c,currentVersion:t,includeMajor:r}]})})}catch(m){throw new Error(`SDK Gen API version discovery failed for ${e}@${t} because the API could not be reached. Verify FERN_SDK_GEN_API_ORIGIN and the selected environment.`,{cause:m})}if(!p.ok)throw new Error(`SDK Gen API version discovery failed for ${e}@${t} with HTTP ${p.status}. Verify FERN_SDK_GEN_API_ORIGIN and the selected environment.`);let d=await p.json(),f=AAA(d);return f.state==="UNAVAILABLE"?(s.logger.error(`SDK Gen API cannot resolve an executable version for ${e}@${t} (${f.reason}). Publish the coordinate to this environment or choose a supported generator version.`),{}):{compatibleVersion:f.compatibleVersion,withheldMajorVersion:f.withheldMajorVersion}}function AAA(e){if(!Rwp(e,["targets"])||!Array.isArray(e.targets)||e.targets.length!==1)throw new Error("SDK Gen API returned an invalid generator version discovery response");let t=e.targets[0];if(!kwp(t)||t.targetId!=="generator")throw new Error("SDK Gen API returned an invalid generator version discovery target");if(t.state==="UNAVAILABLE"){if(!Rwp(t,["targetId","state","reason"])||t.reason!=="IDENTITY_UNAVAILABLE"&&t.reason!=="LANGUAGE_MISMATCH"&&t.reason!=="VERSION_UNAVAILABLE")throw new Error("SDK Gen API returned an invalid unavailable generator version result");return{targetId:"generator",state:"UNAVAILABLE",reason:t.reason}}if(t.state!=="RESOLVED")throw new Error("SDK Gen API returned an unknown generator version discovery state");if(!Fwp(t,["targetId","state","compatibleVersion","withheldMajorVersion"]))throw new Error("SDK Gen API returned an invalid resolved generator version result");let r=Dwp(t,"compatibleVersion"),n=Dwp(t,"withheldMajorVersion");if(r==null&&n==null)throw new Error("SDK Gen API returned an empty generator version discovery result");return{targetId:"generator",state:"RESOLVED",...r==null?{}:{compatibleVersion:r},...n==null?{}:{withheldMajorVersion:n}}}function Dwp(e,t){if(!Object.hasOwn(e,t))return;let r=e[t];if(typeof r!="string"||tOt.default.valid(r)!==r)throw new S({message:`SDK Gen API returned invalid ${t} ${JSON.stringify(r)}. Expected an exact semantic version such as 1.2.3.`,code:S.Code.VersionError});return r}function kwp(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function Rwp(e,t){return kwp(e)&&Object.keys(e).length===t.length&&Fwp(e,t)}function Fwp(e,t){let r=new Set(t);return Object.keys(e).every(n=>r.has(n))}async function yAA({cliContext:e,project:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let{apiWorkspaces:s}=t,a=EJ()?rOt(e):void 0;if(s.length===1){let u={type:"singleApi",versions:{}};return await Nwp({cliContext:e,apiWorkspaces:s,perGeneratorAction:async(l,p,d,f)=>{u.versions[p]==null&&(u.versions[p]={});let m=wLe(d.name);if(m==null){f.logger.debug(`Skipping unknown generator: ${d.name}`);return}let g=await Qwp({generatorName:d.name,normalizedGeneratorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:d.version,channel:i,includeMajor:o,organization:t.config.organization,getSdkGenApiToken:a,context:f});g!=null&&(u.versions[p][d.name]={previousVersion:d.version,latestVersion:g})},generatorFilter:r,groupFilter:n}),u}let c={type:"multiApi",versions:{}};return await Nwp({cliContext:e,apiWorkspaces:s,perGeneratorAction:async(u,l,p,d)=>{if(u==null)return;c.versions[u]==null&&(c.versions[u]={}),c.versions[u][l]==null&&(c.versions[u][l]={});let f=wLe(p.name);if(f==null){d.logger.debug(`Skipping unknown generator: ${p.name}`);return}let m=await Qwp({generatorName:p.name,normalizedGeneratorName:f,cliVersion:e.environment.packageVersion,currentGeneratorVersion:p.version,channel:i,includeMajor:o,organization:t.config.organization,getSdkGenApiToken:a,context:d});m!=null&&(c.versions[u][l][p.name]={previousVersion:p.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),c}async function Nwp({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await c3({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let c=n!=null?qg(n):void 0;for(let u of a.groups)if(!(i!=null&&u.groupName!==i))for(let l of u.generators)c!=null&&l.name!==c||await r(o.workspaceName,u.groupName,l,s)})}))}function jwp(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let c=cwi({generatorId:s,candidateVersion:a.latestVersion,currentVersion:a.previousVersion})===1;r.debug(`Latest version: ${a.latestVersion}. `+(c?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:c,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function Qwp({generatorName:e,normalizedGeneratorName:t,cliVersion:r,currentGeneratorVersion:n,channel:i,includeMajor:o,organization:s,getSdkGenApiToken:a,context:c}){if(EJ()){if(a==null)throw new Error("SDK Gen API generator version discovery requires authentication");return(await uwi({generatorId:qg(e),currentVersion:n,includeMajor:o??!1,channel:i,organization:s,getToken:a,context:c})).compatibleVersion}return LP({generatorName:t,cliVersion:r,currentGeneratorVersion:n,channel:i,includeMajor:o,context:c})}async function lwi({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await yAA({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[c,u]of Object.entries(a.versions))s.push(...jwp(u,c,t.logger));else s.push(...jwp(a.versions,void 0,t.logger))}return s}Ft();$Tr();async function tAe({cliEnvironment:e,includePreReleases:t=!1}){if(e.packageName!=="fern-api"||e.packageVersion==="0.0.0")return e.packageVersion;try{return await PQe(e.packageName,{version:t?"prerelease":"latest"})}catch(r){throw new S({message:`Failed to resolve latest CLI version: ${r instanceof Error?r.message:String(r)}`,code:S.Code.NetworkError})}}var zwp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],pwi=class e{environment;sentryClient;posthogManager;automationTelemetryManager;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Hn.Info;isLocal;stdoutRedirector=new awi;jsonMode=!1;static async create(t,r,{isLocal:n}){let i=await p8t();return new e(t,r,{isLocal:n,posthogManager:i})}constructor(t,r,{isLocal:n,posthogManager:i}){this.ttyAwareLogger=new F4t(t,r),this.isLocal=n??!1,this.posthogManager=i;let o=this.getPackageName(),s=this.getPackageVersion(),a=this.getCliName();(o==null||s==null||a==null)&&this.exitProgram(),this.environment={packageName:o,packageVersion:s,cliName:a},this.sentryClient=new swi({release:`cli@${this.environment.packageVersion}`,telemetry:{cliName:this.environment.cliName,packageVersion:this.environment.packageVersion,isLocal:this.isLocal}}),this.automationTelemetryManager=new nwi(this)}getPackageName(){return"fern-api"}getPackageVersion(){return"5.139.1"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${fe.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r,n){throw this.failWithoutThrowing(t,r,n),new Xc}failWithoutThrowing(t,r,n){this.didSucceed=!1,!(r instanceof Xc)&&(y4t({message:t,error:r,logger:this.logger}),iwi(this,r,{...n,message:t}))}enableJsonMode(){this.jsonMode||(this.jsonMode=!0,this.stdoutRedirector.redirect())}get isJsonMode(){return this.jsonMode}get isTTY(){return this.ttyAwareLogger.isTTY}writeJsonToStdout(t){this.writeTextToStdout(JSON.stringify(t,null,2)+`
5021
5021
  `)}writeTextToStdout(t){this.stdoutRedirector.restore(),process.stdout.write(t),this.jsonMode&&this.stdoutRedirector.redirect()}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish();try{await this.posthogManager.flush()}catch{}await this.sentryClient.flush(),await this.automationTelemetryManager.flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await Pwp({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
5022
5022
  `)||(r+=`
5023
5023
  `),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=oQi(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t,this.automationTelemetryManager.setOrganization(t.config.organization)}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new aer(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(o){throw n.failWithoutThrowing(void 0,o),new Xc}finally{n.finish()}return i}instrumentPostHogEvent(t){this.isLocal||this.posthogManager.sendEvent(t)}instrumentPostHogAutomationEvent(t){this.isLocal||this.posthogManager.sendAutomationEvent(t)}captureException(t,r){return this.sentryClient.captureException(t,r)}emitAutomationTelemetryEvent(t,r){this.automationTelemetryManager.emit(t,r)}logger=jv((t,...r)=>this.log(t,...r));stderr=jv((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=t.type==="docs"?"docs":t.workspaceName??"api",n=Mwp(r),i=1+(this.longestWorkspaceName!=null?Mwp(this.longestWorkspaceName):n).length,o=n.padEnd(i),s=zwp[this.numTasks++%zwp.length],a=fe.hex(s)(o);return{...this.constructTaskInit(),logPrefix:a,title:fe.hex(s).bold(r)}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===df.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:t=>{this.instrumentPostHogEvent(t)},shouldBufferLogs:!1,captureException:(t,r)=>this.sentryClient.captureException(t,r),emitAutomationTelemetryEvent:(t,r)=>this.emitAutomationTelemetryEvent(t,r)}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let n=t.filter(i=>Ow.indexOf(i.level)>=Ow.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===Hn.Debug,stderr:r||this.jsonMode})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await tAe({cliEnvironment:this.environment,includePreReleases:t}),n=rS(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},o=await lwi({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:o}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return this.selectPrompt({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r})}async selectPrompt({message:t,choices:r,default:n}){try{return await v4s({message:t,choices:r,default:n,theme:{prefix:fe.yellow("?"),style:{answer:i=>fe.cyan(i),message:i=>fe.bold(i),highlight:i=>fe.cyan(i)}}})}catch(i){throw i?.name==="ExitPromptError"?(this.logger.info(`