fern-api 3.70.2 → 3.70.3

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 +5 -5
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1299,7 +1299,7 @@ ${asl.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&sGa(th
1299
1299
  `+y4t.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?y4t.default.cyan(hsl(t,this.opt.mask)):y4t.default.italic(y4t.default.dim("[hidden]")):this.opt.mask?hsl(t,this.opt.mask):y4t.default.italic(y4t.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 fzn=We(jT(),1);var mul=We(kGa(),1),lzn=require("child_process"),Ysr=require("fs"),czn=We(require("path"),1),hul=We(require("os"),1),yul=require("crypto"),I7a=We(ful(),1);var azn=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var _$r=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var szn=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var uzn=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function pzn(e="",t,r){let n=new x7a(e,r);n.runAsync((i,o)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,o)}catch(a){setImmediate(t,a,void 0)}})}function dul(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function I4b(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 x7a=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=I4b(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??hul.default.tmpdir(),r=(0,yul.randomUUID)(),n=dul(this.fileOptions.prefix),i=dul(this.fileOptions.postfix),o=`${n}${r}${i}`,a=czn.default.resolve(t,o),s=czn.default.resolve(t)+czn.default.sep;if(!a.startsWith(s))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=a;let c={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(c.mode=this.fileOptions.mode),(0,Ysr.writeFileSync)(this.tempFile,this.text,c)}catch(t){throw new azn(t)}}readTemporaryFile(){try{let t=(0,Ysr.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,mul.detect)(t)??"utf8";I7a.default.encodingExists(r)||(r="utf8"),this.text=I7a.default.decode(t,r)}}catch(t){throw new szn(t)}}removeTemporaryFile(){try{(0,Ysr.unlinkSync)(this.tempFile)}catch(t){throw new uzn(t)}}launchEditor(){try{let t=(0,lzn.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new _$r(t)}}launchEditorAsync(t){try{(0,lzn.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new _$r(r)}}};var gul=We(zJ(),1);var v$r=class extends CT{_run(t){this.done=t,this.editorResult=new gul.Subject;let r=VM(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"?fzn.default.dim("Received"):fzn.default.dim("Press <enter> to launch your preferred editor."),t&&(r=fzn.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),pzn(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 Oul=require("stream");var _ul=We(require("readline"),1),vul=We(Aul(),1),_4t=class{constructor(t){this.rl||=_ul.default.createInterface(j4b(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 j4b(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 vul.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var O$r=class extends _4t{constructor(t={}){super(t),this.log=new Oul.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return o$r(this.rl,this.bottomBar.split(`
1300
1300
  `).length),this}updateBottomBar(t){return o$r(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+`
1301
1301
  `}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&&RMn(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var TA=We(zJ(),1),Eul=We(IHr(),1);var dzn=We(zJ(),1),wul=We(IHr(),1),mzn=function(e,t,r){return typeof e[t]!="function"?(0,dzn.of)(e):(0,dzn.from)((0,wul.default)(e[t])(r).then(n=>(e[t]=n,e)))};var Pul={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,o,a)=>{i==="__proto__"||i==="constructor"||(o===a.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((a,s)=>a!=null?a[s]:a,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},Xsr=class extends _4t{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,TA.from)(t):(0,TA.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,TA.from)(Object.entries(t).map(([i,o])=>({name:i,...o}))):n=(0,TA.from)([t]),this.process=n.pipe((0,TA.concatMap)(this.processQuestion.bind(this)),(0,TA.publish)()),this.process.connect(),this.process.pipe((0,TA.reduce)((i,o)=>(Pul.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,TA.defer)(()=>(0,TA.of)(t).pipe((0,TA.concatMap)(this.setDefaultType.bind(this)),(0,TA.concatMap)(this.filterIfRunnable.bind(this)),(0,TA.concatMap)(()=>mzn(t,"message",this.answers)),(0,TA.concatMap)(()=>mzn(t,"default",this.answers)),(0,TA.concatMap)(()=>mzn(t,"choices",this.answers)),(0,TA.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,TA.defer)(()=>(0,TA.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,TA.defer)(()=>(0,TA.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&Pul.get(this.answers,t.name)!==void 0)return TA.EMPTY;if(t.when===!1)return TA.EMPTY;if(typeof t.when!="function")return(0,TA.of)(t);let{answers:r}=this;return(0,TA.defer)(()=>(0,TA.from)((0,Eul.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,TA.filter)(n=>n!=null)))}};function Iul(e){let t=function(r,n){let i;try{i=new Xsr(t.prompts,e)}catch(a){return Promise.reject(a)}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",s$r),this.registerPrompt("input",h4t),this.registerPrompt("number",u$r),this.registerPrompt("confirm",c$r),this.registerPrompt("rawlist",l$r),this.registerPrompt("expand",p$r),this.registerPrompt("checkbox",f$r),this.registerPrompt("password",d$r),this.registerPrompt("editor",v$r)},t.restoreDefaultPrompts(),t}var C7a=Iul();function S4b(e,t){C7a.registerPrompt(e,t)}function B4b(){C7a.restoreDefaultPrompts()}var D4b={prompt:C7a,ui:{BottomBar:O$r,Prompt:Xsr},createPromptModule:Iul,registerPrompt:S4b,restoreDefaultPrompts:B4b,Separator:u5},p0=D4b;var Zsr=require("path");function jul(){let e=T4b();return async t=>{for(let r of t)r.module=e(r.filename);return t}}function T4b(e=process.argv[1]?(0,Zsr.dirname)(process.argv[1]):process.cwd(),t=Zsr.sep==="\\"){let r=t?xul(e):e;return n=>{if(!n)return;let i=t?xul(n):n,{dir:o,base:a,ext:s}=Zsr.posix.parse(i);(s===".js"||s===".mjs"||s===".cjs")&&(a=a.slice(0,-1*s.length));let c=decodeURIComponent(a);o||(o=".");let l=o.lastIndexOf("/node_modules");if(l>-1)return`${o.slice(l+14).replace(/\//g,".")}:${c}`;if(o.startsWith(r)){let u=o.slice(r.length+1).replace(/\//g,".");return u?`${u}:${c}`:c}return c}}function xul(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var S7a=e=>{if("flags"in e){let t=Cul(e.flags),r=Sul(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,o])=>[i,Bul(o)])),n=Object.fromEntries(Object.entries(t).map(([i,o])=>[i,R4b(i,o,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function R4b(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 Cul=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,w$r(r)]).filter(([,t])=>t!==void 0)),Sul=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?Bul(n):void 0]}))};var w$r=e=>e===void 0?void 0:e.variant??e.enabled,Bul=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};var hzn="0123456789abcdef",yzn=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+=hzn.charAt(this.bytes[r]>>>4),t+=hzn.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+=hzn.charAt(this.bytes[r]>>>4),t+=hzn.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}},B7a=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??F4b()}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 yzn.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,yzn.ofInner(t)}},F4b=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),Dul,RNe=()=>N4b().toString(),N4b=()=>(Dul||(Dul=new B7a)).generate();var M4b=["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"],Tul=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return M4b.concat(t).some(n=>{let i=n.toLowerCase();return r.indexOf(i)!==-1})};var l5=(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.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})({});var Q4b=Array.isArray,Rul=Object.prototype,IgC=Rul.hasOwnProperty,D7a=Rul.toString,T7a=Q4b||function(e){return D7a.call(e)==="[object Array]"};var Ful=e=>e===Object(e)&&!T7a(e);var eur=e=>e===void 0,P$r=e=>D7a.call(e)=="[object String]",Nul=e=>P$r(e)&&e.trim().length===0;var Mul=e=>D7a.call(e)=="[object Number]"&&e===e;var R7a=e=>e instanceof Error;function E$r(e){return e===null||typeof e!="object"}function v4t(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function zul(e){return v4t(e,"ErrorEvent")}function gzn(e){return!eur(Event)&&q4b(e,Event)}function Qul(e){return v4t(e,"Object")}function q4b(e,t){try{return e instanceof t}catch{return!1}}function I$r(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),Mul(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),I$r(i||r,t,r,n))}var V4b=864e5,bzn=class{constructor(t){this._buckets={},this._onBucketRateLimited=t._onBucketRateLimited,this._bucketSize=I$r(t.bucketSize,0,100,t._logger),this._refillRate=I$r(t.refillRate,0,this._bucketSize,t._logger),this._refillInterval=I$r(t.refillInterval,0,V4b,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 Azn=class{add(t){let r=RNe();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 k4b(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}var qul=(e,t,r)=>{function n(o,...a){t(()=>{let s=r[o];s(e,...a)})}return{info:(...o)=>{n("log",...o)},warn:(...o)=>{n("warn",...o)},error:(...o)=>{n("error",...o)},critical:(...o)=>{r.error(e,...o)},createLogger:o=>qul(`${e} ${o}`,t,r)}},U4b=e=>e();function Vul(e,t=U4b){return qul(e,t,k4b())}var rur="Mobile",vzn="iOS",tur="Android",kul="Tablet",zgC=tur+" "+kul;var L4b="Apple",QgC=L4b+" Watch",Uul="Safari",Ozn="BlackBerry",Lul="Samsung",W4b=Lul+"Browser",G4b=Lul+" Internet",wzn="Chrome",H4b=wzn+" OS",$4b=wzn+" "+vzn,Wul="Internet Explorer",J4b=Wul+" "+rur,N7a="Opera",qgC=N7a+" Mini",Gul="Edge",K4b="Microsoft "+Gul,M7a="Firefox",Y4b=M7a+" "+vzn,z7a="Nintendo",Q7a="PlayStation",_zn="Xbox",X4b=tur+" "+rur,Z4b=rur+" "+Uul,x$r="Windows",e2b=x$r+" Phone";var Hul="Generic",VgC=Hul+" "+rur.toLowerCase(),kgC=Hul+" "+kul.toLowerCase(),t2b="Konqueror",_U="(\\d+(\\.\\d+)?)",F7a=new RegExp("Version/"+_U),UgC=new RegExp(_zn,"i"),LgC=new RegExp(Q7a+" \\w+","i"),WgC=new RegExp(z7a+" \\w+","i"),r2b=new RegExp(Ozn+"|PlayBook|BB10","i"),n2b={"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 GgC={[J4b]:[new RegExp("rv:"+_U)],[K4b]:[new RegExp(Gul+"?\\/"+_U)],[wzn]:[new RegExp("("+wzn+"|CrMo)\\/"+_U)],[$4b]:[new RegExp("CriOS\\/"+_U)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+_U)],[Uul]:[F7a],[Z4b]:[F7a],[N7a]:[new RegExp("("+N7a+"|OPR)\\/"+_U)],[M7a]:[new RegExp(M7a+"\\/"+_U)],[Y4b]:[new RegExp("FxiOS\\/"+_U)],[t2b]:[new RegExp("Konqueror[:/]?"+_U,"i")],[Ozn]:[new RegExp(Ozn+" "+_U),F7a],[X4b]:[new RegExp("android\\s"+_U,"i")],[G4b]:[new RegExp(W4b+"\\/"+_U)],[Wul]:[new RegExp("(rv:|MSIE )"+_U)],Mozilla:[new RegExp("rv:"+_U)]};var HgC=[[new RegExp(_zn+"; "+_zn+" (.*?)[);]","i"),e=>[_zn,e&&e[1]||""]],[new RegExp(z7a,"i"),[z7a,""]],[new RegExp(Q7a,"i"),[Q7a,""]],[r2b,[Ozn,""]],[new RegExp(x$r,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[e2b,""];if(new RegExp(rur).test(t)&&!/IEMobile\b/.test(t))return[x$r+" "+rur,""];let r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let n=r[1],i=n2b[n]||"";return/arm/i.test(t)&&(i="RT"),[x$r,i]}return[x$r,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){let t=[e[3],e[4],e[5]||"0"];return[vzn,t.join(".")]}return[vzn,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=eur(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+tur+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+tur+")","i"),e=>{if(e&&e[2]){let t=[e[2],e[3],e[4]||"0"];return[tur,t.join(".")]}return[tur,""]}],[/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/,[H4b,""]],[/Linux|debian/i,["Linux",""]]];var $ul="utf8";function Jul(e,t){if(!e||typeof e!="string"||i2b(e))throw new Error(t)}function i2b(e){return e.trim().length===0}function Kul(e){return e?.replace(/\/+$/,"")}async function Yul(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 Pzn(){return new Date().toISOString()}function O4t(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var Xul=e=>e instanceof Error;function q7a(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var Ezn=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)}};function Zul(){return"CompressionStream"in globalThis}async function V7a(e,t=!0){try{let n=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(n).blob()}catch(r){return t&&console.error("Failed to gzip compress data",r),null}}var w4t=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()}},nur=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function ecl(e){if(e instanceof w4t){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 k7a(e){return typeof e=="object"&&(e instanceof w4t||e instanceof nur)}function tcl(e){return typeof e=="object"&&e instanceof w4t&&e.status===413}var j$r=class{constructor(t,r={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new Azn,this._events=new Ezn,this._isInitialized=!1,Jul(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=Kul(r.host||"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:k7a},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,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=Vul("[PostHog]",this.logMsgIfDebug.bind(this)),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=!Zul()||(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(l5.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(l5.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(l5.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,a){this.wrap(()=>{let s=this.buildPayload({distinct_id:o||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...a||{}}});this.enqueue("capture",s,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={},a=!0){await this._initPromise;let s=a?"&config=true":"",c=`${this.host}/flags/?v=2${s}`,l={token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...o};this.evaluationContexts&&this.evaluationContexts.length>0&&(l.evaluation_contexts=this.evaluationContexts);let u={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(l)};return this._logger.info("Flags URL",c),this.fetchWithRetry(c,u,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(p=>p.json()).then(p=>({success:!0,response:S7a(p)})).catch(p=>(this._events.emit("error",p),{success:!1,error:this.categorizeRequestError(p)}))}categorizeRequestError(t){if(t instanceof w4t)return{type:"api_error",statusCode:t.status};if(t instanceof nur){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={},a){await this._initPromise;let s=await this.getFeatureFlagDetailStateless(t,r,n,i,o,a);if(s===void 0)return{response:void 0,requestId:void 0};let c=w$r(s.response);return c===void 0&&(c=!1),{response:c,requestId:s.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},o={},a){await this._initPromise;let s=await this.getFeatureFlagDetailsStateless(r,n,i,o,a,[t]);return s===void 0?void 0:{response:s.flags[t],requestId:s.requestId,evaluatedAt:s.evaluatedAt}}async getFeatureFlagPayloadStateless(t,r,n={},i={},o={},a){await this._initPromise;let s=await this.getFeatureFlagPayloadsStateless(r,n,i,o,a,[t]);if(!s)return;let c=s[t];return c===void 0?null:c}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},o,a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,a)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},o,a){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,a)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},o,a){await this._initPromise;let s=await this.getFeatureFlagDetailsStateless(t,r,n,i,o,a);return s?{flags:s.featureFlags,payloads:s.featureFlagPayloads,requestId:s.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},o,a){await this._initPromise;let s={};(o??this.disableGeoip)&&(s.geoip_disable=!0),a&&(s.flag_keys_to_evaluate=a);let c=await this.getFlags(t,r,n,i,s);if(!c.success)return;let l=c.response;return l.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"),l.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:l?.requestId,quotaLimited:l.quotaLimited}):l}async getSurveysStateless(){if(await this._initPromise,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 a=`Surveys API could not be loaded: ${o.status}`,s=new Error(a);this._logger.error(s),this._events.emit("error",new Error(a));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(l5.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(l5.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(l5.Props,this.props)})}processBeforeEnqueue(t){return t}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(l5.Queue)||[];o.length>=this.maxQueueSize&&(o.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),o.push({message:i}),this.setPersistedProperty(l5.Queue,o),this._events.emit(t,i),o.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=O4t(()=>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:Pzn()};this.historicalMigration&&(o.historical_migration=!0);let a=JSON.stringify(o),s=`${this.host}/batch/`,c=this.disableCompression?null:await V7a(a,this.isDebug),l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...c!==null&&{"Content-Encoding":"gzip"}},body:c||a};try{await this.fetchWithRetry(s,l)}catch(u){this._events.emit("error",u)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:Pzn(),uuid:n?.uuid?n.uuid:RNe()};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 ecl(t)})}async flush(){let t=q7a([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),q7a([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(l5.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(m=>m.message),a=()=>{let h=(this.getPersistedProperty(l5.Queue)||[]).slice(i.length);this.setPersistedProperty(l5.Queue,h),t=h},s={api_key:this.apiKey,batch:o,sent_at:Pzn()};this.historicalMigration&&(s.historical_migration=!0);let c=JSON.stringify(s),l=`${this.host}/batch/`,u=this.disableCompression?null:await V7a(c,this.isDebug),p={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...u!==null&&{"Content-Encoding":"gzip"}},body:u||c},d={retryCheck:m=>tcl(m)?!1:k7a(m)};try{await this.fetchWithRetry(l,p,d)}catch(m){if(tcl(m)&&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 m instanceof nur||a(),this._events.emit("error",m),m}a(),r.push(...o)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){AbortSignal.timeout??=function(s){let c=new AbortController;return setTimeout(()=>c.abort(),s),c.signal};let o=r.body?r.body:"",a=-1;try{a=o instanceof Blob?o.size:Buffer.byteLength(o,$ul)}catch{o instanceof Blob?a=o.size:a=new TextEncoder().encode(o).length}return await Yul(async()=>{let s=null;try{s=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(l){throw new nur(l)}if(!(r.mode==="no-cors")&&(s.status<200||s.status>=400))throw new w4t(s,a);return s},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await this.promiseQueue.join();!((this.getPersistedProperty(l5.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!k7a(i))throw i;await ecl(i)}};return Promise.race([new Promise((i,o)=>{O4t(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,o("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}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 p5={};Q(p5,{DOMExceptionCoercer:()=>G7a,ErrorCoercer:()=>H7a,ErrorEventCoercer:()=>$7a,ErrorPropertiesBuilder:()=>U7a,EventCoercer:()=>Y7a,ObjectCoercer:()=>K7a,PrimitiveCoercer:()=>X7a,PromiseRejectionEventCoercer:()=>Z7a,ReduceableCache:()=>eHa,StringCoercer:()=>J7a,chromeStackLineParser:()=>L7a,createDefaultStackParser:()=>A2b,createStackParser:()=>fcl,geckoStackLineParser:()=>W7a,nodeStackLineParser:()=>ucl,opera10StackLineParser:()=>ocl,opera11StackLineParser:()=>acl,reverseAndStripFrames:()=>pcl,winjsStackLineParser:()=>icl});var Izn,rcl,xzn;function ncl(e){let t=globalThis._posthogChunkIds;if(!t)return;let r=Object.keys(t);return xzn&&r.length===rcl||(rcl=r.length,xzn=r.reduce((n,i)=>{Izn||(Izn={});let o=Izn[i];if(o)n[o[0]]=o[1];else{let a=e(i);for(let s=a.length-1;s>=0;s--){let l=a[s]?.filename,u=t[i];if(l&&u){n[l]=u,Izn[i]=[l,u];break}}}return n},{})),xzn}var a2b=4,U7a=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"},a=this.buildCoercingContext(i,r,0).apply(t),s=this.buildParsingContext(),c=this.parseStacktrace(a,s);return{$exception_list:this.convertToExceptionList(c,i),$exception_level:"error"}}async modifyFrames(t){for(let r of t)r.stacktrace&&r.stacktrace.frames&&T7a(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?1: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(){return{chunkIdMap:ncl(this.stackParser)}}buildCoercingContext(t,r,n=0){let i=(a,s)=>{if(s<=a2b){let c=this.buildCoercingContext(t,r,s);return this.applyCoercers(a,c)}};return{...r,syntheticException:n==0?r.syntheticException:void 0,mechanism:t,apply:a=>i(a,n),next:a=>i(a,n+1)}}};var UM="?";function FNe(e,t,r,n,i){let o={platform:e,filename:t,function:r==="<anonymous>"?UM:r,in_app:!0};return eur(n)||(o.lineno=n),eur(i)||(o.colno=i),o}var jzn=(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]:UM,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};var s2b=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,u2b=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,c2b=/\((\S*)(?::(\d+))(?::(\d+))\)/,L7a=(e,t)=>{let r=s2b.exec(e);if(r){let[,i,o,a]=r;return FNe(t,i,UM,+o,+a)}let n=u2b.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){let s=c2b.exec(n[2]);s&&(n[2]=s[1],n[3]=s[2],n[4]=s[3])}let[o,a]=jzn(n[1]||UM,n[2]);return FNe(t,a,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}};var l2b=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,p2b=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,W7a=(e,t)=>{let r=l2b.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let a=p2b.exec(r[3]);a&&(r[1]=r[1]||"eval",r[3]=a[1],r[4]=a[2],r[5]="")}let i=r[3],o=r[1]||UM;return[o,i]=jzn(o,i),FNe(t,i,o,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}};var f2b=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,icl=(e,t)=>{let r=f2b.exec(e);return r?FNe(t,r[2],r[1]||UM,+r[3],r[4]?+r[4]:void 0):void 0};var d2b=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,ocl=(e,t)=>{let r=d2b.exec(e);return r?FNe(t,r[2],r[3]||UM,+r[1]):void 0},m2b=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,acl=(e,t)=>{let r=m2b.exec(e);return r?FNe(t,r[5],r[3]||r[4]||UM,+r[1],+r[2]):void 0};var h2b=/^\s*[-]{4,}$/,y2b=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,ucl=(e,t)=>{let r=e.match(y2b);if(r){let n,i,o,a,s;if(r[1]){o=r[1];let u=o.lastIndexOf(".");if(o[u-1]==="."&&u--,u>0){n=o.slice(0,u),i=o.slice(u+1);let p=n.indexOf(".Module");p>0&&(o=o.slice(p+1),n=n.slice(0,p))}a=void 0}i&&(a=n,s=i),i==="<anonymous>"&&(s=void 0,o=void 0),o===void 0&&(s=s||UM,o=a?`${a}.${s}`:s);let c=r[2]?.startsWith("file://")?r[2].slice(7):r[2],l=r[5]==="native";return c?.match(/\/[A-Z]:/)&&(c=c.slice(1)),!c&&r[5]&&!l&&(c=r[5]),{filename:c?decodeURI(c):void 0,module:void 0,function:o,lineno:scl(r[3]),colno:scl(r[4]),in_app:g2b(c||"",l),platform:t}}if(e.match(h2b))return{filename:e,platform:t}};function g2b(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 scl(e){return parseInt(e||"",10)||void 0}var ccl=/\(error: (.*)\)/,lcl=50;function pcl(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,lcl).map(r=>({...r,filename:r.filename||b2b(t).filename,function:r.function||UM}))}function b2b(e){return e[e.length-1]||{}}function A2b(){return fcl("web:javascript",L7a,W7a)}function fcl(e,...t){return(r,n=0)=>{let i=[],o=r.split(`
1302
- `);for(let a=n;a<o.length;a++){let s=o[a];if(s.length>1024)continue;let c=ccl.test(s)?s.replace(ccl,"$1"):s;if(!c.match(/\S*Error: /)){for(let l of t){let u=l(c,e);if(u){i.push(u);break}}if(i.length>=lcl)break}}return pcl(i)}}var G7a=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=P$r(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 v4t(t,"DOMException")}isDOMError(t){return v4t(t,"DOMError")}};var H7a=class{match(t){return R7a(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 $7a=class{constructor(){}match(t){return zul(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 _2b=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,J7a=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(_2b);return i&&(r=i[1],n=i[2]),[r,n]}};var dcl=["fatal","error","warning","log","info","debug"];function Czn(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 K7a=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 gzn(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=Czn(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return P$r(t)&&!Nul(t)&&dcl.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(Xul(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var Y7a=class{match(t){return gzn(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Czn(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var X7a=class{match(t){return E$r(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var Z7a=class{match(t){return v4t(t,"PromiseRejectionEvent")}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return E$r(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){if(E$r(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var eHa=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 ycl=require("fs"),gcl=require("readline"),Szn=new p5.ReduceableCache(25),bcl=new p5.ReduceableCache(20),tHa=7,v2b=1e3,O2b=1e4;async function Acl(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],a=o?.filename;if(!o||typeof a!="string"||typeof o.lineno!="number"||I2b(a)||x2b(o))continue;t[a]||(t[a]=[]),t[a].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(bcl.get(i))continue;let o=t[i];if(!o)continue;o.sort((c,l)=>c-l);let a=C2b(o);if(a.every(c=>j2b(i,c)))continue;let s=S2b(Szn,i,{});n.push(w2b(i,a,s))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&P2b(e,Szn),Szn.reduce(),e}function w2b(e,t,r){return new Promise(n=>{let i=(0,ycl.createReadStream)(e),o=(0,gcl.createInterface)({input:i});function a(){i.destroy(),n()}let s=0,c=0,l=t[c];if(l===void 0)return void a();let u=l[0],p=l[1];function d(){bcl.set(e,1),o.close(),o.removeAllListeners(),a()}i.on("error",d),o.on("error",d),o.on("close",a),o.on("line",m=>{if(s++,!(s<u)&&(r[s]=B2b(m,0),s>=p)){if(c===t.length-1){o.close(),o.removeAllListeners();return}c++;let h=t[c];if(h===void 0){o.close(),o.removeAllListeners();return}u=h[0],p=h[1]}})})}function P2b(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;E2b(r.lineno,r,n)}}function E2b(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=_cl(e);i<e;i++){let o=r[i];if(o===void 0)return void mcl(t);t.pre_context.push(o)}if(r[e]===void 0)return void mcl(t);t.context_line=r[e];let n=vcl(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 mcl(e){delete e.pre_context,delete e.context_line,delete e.post_context}function I2b(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function x2b(e){return e.lineno!==void 0&&e.lineno>O2b||e.colno!==void 0&&e.colno>v2b}function j2b(e,t){let r=Szn.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 C2b(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=hcl(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+tHa:(i.push(n),n=hcl(o)),t++}return i}function hcl(e){return[_cl(e),vcl(e)]}function _cl(e){return Math.max(1,e-tHa)}function vcl(e){return e+tHa}function S2b(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function B2b(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}function D2b(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(a=>a.name!=="domainUncaughtExceptionClear"&&a._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function Ocl(e,t){globalThis.process?.on("uncaughtException",D2b(e,t))}function wcl(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var T2b=2e3,fxe=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new bzn({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return Ful(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i};n||(o.$process_person_profile=!1);let a=this.errorPropertiesBuilder.buildFromUnknown(t,r);return a.$exception_list=await this.errorPropertiesBuilder.modifyFrames(a.$exception_list),{event:"$exception",distinctId:n||RNe(),properties:{...a,...o}}}startAutocaptureIfEnabled(){this.isEnabled()&&(Ocl(this.onException.bind(this),this.onFatalError.bind(this)),wcl(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(T2b),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var Pcl="5.24.7";var C$r={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function Ecl(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 R2b=6e4,F2b=1152921504606847e3,N2b=["is_not"],iur=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},kw=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},NNe=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Bzn=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:a,...s}){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=s.fetch||fetch,this.onError=s.onError,this.customHeaders=a,this.onLoad=s.onLoad,this.cacheProvider=s.cacheProvider,this.strictLocalEvaluation=s.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let a,s;if(!this.loadedSuccessfullyOnce)return a;if(s=this.featureFlagsByKey[t],s!==void 0)try{a=(await this.computeFlagAndPayloadLocally(s,r,n,i,o)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${a}`))}catch(c){c instanceof NNe||c instanceof kw?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${t}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${c}`))}return a}async getAllFlagsAndPayloads(t,r={},n={},i={},o){await this.loadFeatureFlags();let a={},s={},c=this.featureFlags.length==0,l=o?o.map(p=>this.featureFlagsByKey[p]).filter(Boolean):this.featureFlags,u={};return await Promise.all(l.map(async p=>{try{let{value:d,payload:m}=await this.computeFlagAndPayloadLocally(p,t,r,n,i,void 0,u);a[p.key]=d,m&&(s[p.key]=m)}catch(d){d instanceof NNe||d instanceof kw?this.logMsgIfDebug(()=>console.debug(`${d.name} when computing flag locally: ${p.key}: ${d.message}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${p.key}: ${d}`)),c=!0}})),{response:a,payloads:s,fallbackToFlags:c}}async computeFlagAndPayloadLocally(t,r,n={},i={},o={},a,s,c=!1){if(c||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let l;l=a!==void 0?a:await this.computeFlagValueLocally(t,r,n,i,o,s);let u=this.getFeatureFlagPayload(t.key,l);return{value:l,payload:u}}async computeFlagValueLocally(t,r,n={},i={},o={},a={}){if(t.ensure_experience_continuity)throw new kw("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c==null)return await this.matchFeatureFlagProperties(t,r,i,a);{let l=this.groupTypeMapping[String(c)];if(!l)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new kw("Flag has unknown group type index");if(!(l in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let u=o[l];return await this.matchFeatureFlagProperties(t,n[l],u,a)}}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,i){let o=t.key;if(!this.featureFlagsByKey)throw new kw("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new kw(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let a=t.dependency_chain;if(!Array.isArray(a))throw new kw(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof a})`);if(a.length===0)throw new kw(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let c of a){if(!(c in i)){let u=this.featureFlagsByKey[c];if(u)if(u.active)try{let p=await this.matchFeatureFlagProperties(u,r,n,i);i[c]=p}catch(p){throw new kw(`Error evaluating flag dependency '${c}' for flag '${o}': ${p}`)}else i[c]=!1;else throw new kw(`Missing flag dependency '${c}' for flag '${o}'`)}if(i[c]==null)throw new kw(`Dependency '${c}' could not be evaluated`)}let s=i[o];return this.flagEvaluatesToExpectedValue(t.value,s)}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||{},a=o.groups||[],s=!1,c;for(let l of a)try{if(await this.isConditionMatch(t,r,l,n,i)){let u=l.variant,p=o.multivariate?.variants||[];c=u&&p.some(d=>d.key===u)?u:await this.getMatchingVariant(t,r)||!0;break}}catch(u){if(u instanceof NNe)throw u;if(u instanceof kw)s=!0;else throw u}if(c!==void 0)return c;if(s)throw new kw("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o={}){let a=n.rollout_percentage,s=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let l=c.type,u=!1;if(u=l==="cohort"?Scl(c,i,this.cohorts,this.debugMode):l==="flag"?await this.evaluateFlagDependency(c,r,i,o):Ccl(c,i,s),!u)return!1}if(a==null)return!0}return!(a!=null&&await Icl(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await Icl(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(s=>{i=n+s.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:s.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}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(R2b,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 iur(`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 iur(`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 iur(`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.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 iur&&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}/api/feature_flag/local_evaluation?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=O4t(()=>{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 Icl(e,t,r=""){let n=await Ecl(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/F2b}function Ccl(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new kw("Operator is_not_set is not supported")}else throw new kw(`Property ${n} not found in propertyValues`);let a=t[n];if(a==null&&!N2b.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function s(l,u){return Array.isArray(l)?l.map(p=>String(p).toLowerCase()).includes(String(u).toLowerCase()):String(l).toLowerCase()===String(u).toLowerCase()}function c(l,u,p){if(p==="gt")return l>u;if(p==="gte")return l>=u;if(p==="lt")return l<u;if(p==="lte")return l<=u;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return s(i,a);case"is_not":return!s(i,a);case"is_set":return n in t;case"icontains":return String(a).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(a).toLowerCase().includes(String(i).toLowerCase());case"regex":return xcl(String(i))&&String(a).match(String(i))!==null;case"not_regex":return xcl(String(i))&&String(a).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let l=typeof i=="number"?i:null;if(typeof i=="string")try{l=parseFloat(i)}catch{}return l==null||a==null?c(String(a),String(i),o):typeof a=="string"?c(a,String(i),o):c(a,l,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new kw("Date operations cannot be performed on boolean values");let l=z2b(String(i));if(l==null&&(l=jcl(i)),l==null)throw new kw(`Invalid date: ${i}`);let u=jcl(a);return["is_date_before"].includes(o)?u<l:u>l}default:throw new kw(`Unknown operator: ${o}`)}}function M2b(e,t){if(!(e in t))throw new NNe(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function Scl(e,t,r,n=!1){let i=String(e.value);M2b(i,r);let o=r[i];return Bcl(o,t,r,n)}function Bcl(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let a=!1;if("values"in o[0]){for(let s of o)try{let c=Bcl(s,t,r,n);if(i==="AND"){if(!c)return!1}else if(c)return!0}catch(c){if(c instanceof NNe)throw c;if(c instanceof kw)n&&console.debug(`Failed to compute property ${s} locally: ${c}`),a=!0;else throw c}if(a)throw new kw("Can't match cohort without a given cohort property value");return i==="AND"}for(let s of o)try{let c;if(s.type==="cohort")c=Scl(s,t,r,n);else if(s.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${s.key||"unknown"}'`);continue}else c=Ccl(s,t);let l=s.negation||!1;if(i==="AND"){if(!c&&!l||c&&l)return!1}else if(c&&!l||!c&&l)return!0}catch(c){if(c instanceof NNe)throw c;if(c instanceof kw)n&&console.debug(`Failed to compute property ${s} locally: ${c}`),a=!0;else throw c}if(a)throw new kw("can't match cohort without a given cohort property value");return i==="AND"}function xcl(e){try{return new RegExp(e),!0}catch{return!1}}function jcl(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 kw(`${e} is in an invalid date format`)}throw new kw(`The date provided ${e} must be a string, number, or date object`)}function z2b(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 Dzn=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var Q2b=100,Dcl=3e4,q2b=5e4,Tzn=class extends j$r{constructor(t,r={}){if(super(t,r),this._memoryStorage=new Dzn,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,Q2b):Dcl,r.personalApiKey){if(r.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.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new Bzn({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new fxe(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||q2b}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 Pcl}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."),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."),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:a,...s}=r,u={$set:i||s,$set_once:o||{},$anon_distinct_id:a??void 0};super.identifyStateless(t,u,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:a,...s}=r,u={$set:i||s,$set_once:o||{},$anon_distinct_id:a??void 0};super.identifyStatelessImmediate(t,u,{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=Dcl){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)})})}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let v=this._flagOverrides[t];if(v===void 0)return;let P=this._payloadOverrides?.[t];return{key:t,enabled:v!==!1,variant:typeof v=="string"?v:void 0,payload:P}}let{groups:a,disableGeoip:s}=n,{onlyEvaluateLocally:c,personProperties:l,groupProperties:u}=n,p=this.addLocalPersonAndGroupProperties(r,a,l,u);l=p.allPersonProperties,u=p.allGroupProperties,c==null&&(c=this.options.strictLocalEvaluation??!1);let d,m=!1,h,y,g,b,_,O;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let v=this.featureFlagsPoller?.featureFlagsByKey[t];if(v)try{let P=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(v,r,a,l,u,i);if(P){m=!0;let I=P.value;b=v.id,O="Evaluated locally",d={key:t,enabled:I!==!1,variant:typeof I=="string"?I:void 0,payload:P.payload??void 0}}}catch(P){if(P instanceof NNe||P instanceof kw)this._logger?.info(`${P.name} when computing flag locally: ${t}: ${P.message}`);else throw P}}if(!m&&!c){let v=await super.getFeatureFlagDetailsStateless(r,a,l,u,s,[t]);if(v===void 0)g=C$r.UNKNOWN_ERROR;else{h=v.requestId,y=v.evaluatedAt;let P=[];v.errorsWhileComputingFlags&&P.push(C$r.ERRORS_WHILE_COMPUTING),v.quotaLimited?.includes("feature_flags")&&P.push(C$r.QUOTA_LIMITED);let I=v.flags[t];if(I===void 0)P.push(C$r.FLAG_MISSING);else{b=I.metadata?.id,_=I.metadata?.version,O=I.reason?.description??I.reason?.code;let E;if(I.metadata?.payload!==void 0)try{E=JSON.parse(I.metadata.payload)}catch{E=I.metadata.payload}d={key:t,enabled:I.enabled,variant:I.variant,payload:E}}P.length>0&&(g=P.join(","))}}if(o){let v=d===void 0?void 0:d.enabled===!1?!1:d.variant??!0,P=`${t}_${v}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(P)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(P):this.distinctIdHasSentFlagCalls[r]=[P];let I={$feature_flag:t,$feature_flag_response:v,$feature_flag_id:b,$feature_flag_version:_,$feature_flag_reason:O,locally_evaluated:m,[`$feature/${t}`]:v,$feature_flag_request_id:h,$feature_flag_evaluated_at:y};g&&(I.$feature_flag_error=g),this.capture({distinctId:r,event:"$feature_flag_called",properties:I,groups:a,disableGeoip:s})}}return d!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(d={...d,payload:this._payloadOverrides[t]}),d}async getFeatureFlag(t,r,n){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(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){return this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0})}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){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:n,disableGeoip:i,flagKeys:o}=r||{},{onlyEvaluateLocally:a,personProperties:s,groupProperties:c}=r||{},l=this.addLocalPersonAndGroupProperties(t,n,s,c);s=l.allPersonProperties,c=l.allGroupProperties,a==null&&(a=this.options.strictLocalEvaluation??!1);let u=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,s,c,o),p={},d={},m=!0;if(u&&(p=u.response,d=u.payloads,m=u.fallbackToFlags),m&&!a){let h=await super.getFeatureFlagsAndPayloadsStateless(t,n,s,c,i,o);p={...p,...h.flags||{}},d={...d,...h.payloads||{}}}return this._flagOverrides!==void 0&&(p={...p,...this._flagOverrides}),this._payloadOverrides!==void 0&&(d={...d,...this._payloadOverrides}),{featureFlags:p,featureFlagPayloads:d}}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()}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown(),super._shutdown(t)}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=O4t(()=>{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,a]of Object.entries(t))if(Qul(a)&&r&&o in r){let s={};for(let[c,l]of Object.entries(a))s[String(c)]=String(l);i[String(o)]=s}else n[String(o)]=String(a);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},a=i?.groupProperties||{},s=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let l={};for(let[u,p]of Object.entries(r||{}))l[u]=String(p);return await this.getAllFlags(t,{groups:l,personProperties:o,groupProperties:a,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:s})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let l={};for(let[u,p]of Object.entries(r||{}))l[u]=String(p);return await this.getAllFlags(t,{groups:l,personProperties:o,groupProperties:a,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:s})}return(await super.getFeatureFlagsStateless(t,r,o,a,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},a={};if(r)for(let s of Object.keys(r))a[s]={$group_key:r[s],...i?.[s]||{}};return{allPersonProperties:o,allGroupProperties:a}}captureException(t,r,n,i){if(!fxe.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(fxe.buildEventMessage(t,{syntheticException:o},r,n).then(a=>this.capture({...a,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!fxe.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");this.addPendingPromise(fxe.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:a,timestamp:s,disableGeoip:c,uuid:l}=t,u=this.context?.get(),p=r||u?.distinctId,d={...u?.properties||{},...i||{}};p||(p=RNe(),d.$process_person_profile=!1),u?.sessionId&&!d.$session_id&&(d.$session_id=u.sessionId);let m=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:a,timestamp:s,disableGeoip:c,uuid:l});if(!m)return Promise.reject(null);let h=await Promise.resolve().then(async()=>{if(a){let y=typeof a=="object"?a:void 0;return await this.getFeatureFlagsForEvent(m.distinctId,o,c,y)}return m.event,{}}).then(y=>{let g={};if(y)for(let[_,O]of Object.entries(y))g[`$feature/${_}`]=O;let b=Object.keys(y||{}).filter(_=>y?.[_]!==!1).sort();return b.length>0&&(g.$active_feature_flags=b),g}).catch(()=>({})).then(y=>({...y,...m.properties||{},$groups:m.groups||o}));return m.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof h.$raw_user_agent=="string"&&Tul(h.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(m.event="$bot_pageview",h.$browser_type="bot"),{distinctId:m.distinctId,event:m.event,properties:h,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 a=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(a)}}return i}};var Tcl=require("async_hooks"),Rzn=class{constructor(){this.storage=new Tcl.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){if(n?.fresh===!0)return this.storage.run(t,r);{let o=this.get()||{},a={distinctId:t.distinctId??o.distinctId,sessionId:t.sessionId??o.sessionId,properties:{...o.properties||{},...t.properties||{}}};return this.storage.run(a,r)}}};var Rcl="posthog-node";function V2b(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return a=>{if(!(i==="*"||i.includes(a.level)))return a;a.tags||(a.tags={});let c=a.tags[rHa.POSTHOG_ID_TAG];if(c===void 0)return a;let l=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${c}`,l).toString();a.tags["PostHog Person URL"]=u;let p=a.exception?.values||[],d=p.map(h=>({...h,stacktrace:h.stacktrace?{...h.stacktrace,type:"raw",frames:(h.stacktrace.frames||[]).map(y=>({...y,platform:"node:javascript"}))}:void 0})),m={$exception_message:p[0]?.value||a.message,$exception_type:p[0]?.type,$exception_level:a.level,$exception_list:d,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:p[0]?.value||a.message,$sentry_exception_type:p[0]?.type,$sentry_tags:a.tags};return t&&r&&(m.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),o&&e.capture({event:"$exception",distinctId:c,properties:m}),a}}var rHa=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=Rcl,this.name=Rcl,this.setupOnce=function(a,s){let c=s()?.getClient()?.getDsn()?.projectId;a(V2b(t,{organization:r,projectId:c,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};fxe.errorPropertiesBuilder=new p5.ErrorPropertiesBuilder([new p5.EventCoercer,new p5.ErrorCoercer,new p5.ObjectCoercer,new p5.StringCoercer,new p5.PrimitiveCoercer],p5.createStackParser("node:javascript",p5.nodeStackLineParser),[jul(),Acl]);var our=class extends Tzn{getLibraryId(){return"posthog-node"}initializeContext(){return new Rzn}};var Fzn=class{posthog;constructor({posthogApiKey:t}){this.posthog=new our(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"3.70.2",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var S$r=class{async sendEvent(){}async identify(){}async flush(){}};var aur=require("fs/promises"),zcl=require("os"),Qcl=require("path");var Fcl=We(require("crypto")),Mzn=new Uint8Array(256),Nzn=Mzn.length;function nHa(){return Nzn>Mzn.length-16&&(Fcl.default.randomFillSync(Mzn),Nzn=0),Mzn.slice(Nzn,Nzn+=16)}var LM=[];for(let e=0;e<256;++e)LM.push((e+256).toString(16).slice(1));function Ncl(e,t=0){return LM[e[t+0]]+LM[e[t+1]]+LM[e[t+2]]+LM[e[t+3]]+"-"+LM[e[t+4]]+LM[e[t+5]]+"-"+LM[e[t+6]]+LM[e[t+7]]+"-"+LM[e[t+8]]+LM[e[t+9]]+"-"+LM[e[t+10]]+LM[e[t+11]]+LM[e[t+12]]+LM[e[t+13]]+LM[e[t+14]]+LM[e[t+15]]}var Mcl=We(require("crypto")),iHa={randomUUID:Mcl.default.randomUUID};function k2b(e,t,r){if(iHa.randomUUID&&!t&&!e)return iHa.randomUUID();e=e||{};let n=e.random||(e.rng||nHa)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Ncl(n)}var qJ=k2b;var U2b="id",L2b=".fern",B$r=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new our(r),this.userId=t==null?void 0:V3a(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:"3.70.2",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){await this.posthog.flush()}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 xx({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=vt(xr.of((0,zcl.homedir)()),Xe.of(L2b),Xe.of(U2b));await un(t)||(await(0,aur.mkdir)((0,Qcl.dirname)(t),{recursive:!0}),await(0,aur.writeFile)(t,qJ())),this.persistedDistinctId=(await(0,aur.readFile)(t)).toString()}return this.persistedDistinctId}};var oHa;async function sur(){return oHa==null&&(oHa=await W2b()),oHa}async function W2b(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new S$r;let r=await eTn();return r!=null?new B$r({token:r,posthogApiKey:e}):await hNe()!=null?new Fzn({posthogApiKey:e}):new B$r({token:void 0,posthogApiKey:e})}catch{return new S$r}}function D$r(e,t){return function(){return e.apply(t,arguments)}}var{toString:G2b}=Object.prototype,{getPrototypeOf:sHa}=Object,{iterator:Qzn,toStringTag:Vcl}=Symbol,qzn=(e=>t=>{let r=G2b.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),dxe=e=>(e=e.toLowerCase(),t=>qzn(t)===e),Vzn=e=>t=>typeof t===e,{isArray:cur}=Array,uur=Vzn("undefined");function T$r(e){return e!==null&&!uur(e)&&e.constructor!==null&&!uur(e.constructor)&&f5(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var kcl=dxe("ArrayBuffer");function H2b(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&kcl(e.buffer),t}var $2b=Vzn("string"),f5=Vzn("function"),Ucl=Vzn("number"),R$r=e=>e!==null&&typeof e=="object",J2b=e=>e===!0||e===!1,zzn=e=>{if(qzn(e)!=="object")return!1;let t=sHa(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Vcl in e)&&!(Qzn in e)},K2b=e=>{if(!R$r(e)||T$r(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Y2b=dxe("Date"),X2b=dxe("File"),Z2b=dxe("Blob"),eLb=dxe("FileList"),tLb=e=>R$r(e)&&f5(e.pipe),rLb=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||f5(e.append)&&((t=qzn(e))==="formdata"||t==="object"&&f5(e.toString)&&e.toString()==="[object FormData]"))},nLb=dxe("URLSearchParams"),[iLb,oLb,aLb,sLb]=["ReadableStream","Request","Response","Headers"].map(dxe),uLb=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F$r(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),cur(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(T$r(e))return;let o=r?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length,s;for(n=0;n<a;n++)s=o[n],t.call(null,e[s],s,e)}}function Lcl(e,t){if(T$r(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var P4t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Wcl=e=>!uur(e)&&e!==P4t;function aHa(){let{caseless:e,skipUndefined:t}=Wcl(this)&&this||{},r={},n=(i,o)=>{let a=e&&Lcl(r,o)||o;zzn(r[a])&&zzn(i)?r[a]=aHa(r[a],i):zzn(i)?r[a]=aHa({},i):cur(i)?r[a]=i.slice():(!t||!uur(i))&&(r[a]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&F$r(arguments[i],n);return r}var cLb=(e,t,r,{allOwnKeys:n}={})=>(F$r(t,(i,o)=>{r&&f5(i)?Object.defineProperty(e,o,{value:D$r(i,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),lLb=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),pLb=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},fLb=(e,t,r,n)=>{let i,o,a,s={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)a=i[o],(!n||n(a,e,t))&&!s[a]&&(t[a]=e[a],s[a]=!0);e=r!==!1&&sHa(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},dLb=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},mLb=e=>{if(!e)return null;if(cur(e))return e;let t=e.length;if(!Ucl(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},hLb=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&sHa(Uint8Array)),yLb=(e,t)=>{let n=(e&&e[Qzn]).call(e),i;for(;(i=n.next())&&!i.done;){let o=i.value;t.call(e,o[0],o[1])}},gLb=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},bLb=dxe("HTMLFormElement"),ALb=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),qcl=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),_Lb=dxe("RegExp"),Gcl=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};F$r(r,(i,o)=>{let a;(a=t(i,o,e))!==!1&&(n[o]=a||i)}),Object.defineProperties(e,n)},vLb=e=>{Gcl(e,(t,r)=>{if(f5(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(f5(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},OLb=(e,t)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return cur(e)?n(e):n(String(e).split(t)),r},wLb=()=>{},PLb=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ELb(e){return!!(e&&f5(e.append)&&e[Vcl]==="FormData"&&e[Qzn])}var ILb=e=>{let t=new Array(10),r=(n,i)=>{if(R$r(n)){if(t.indexOf(n)>=0)return;if(T$r(n))return n;if(!("toJSON"in n)){t[i]=n;let o=cur(n)?[]:{};return F$r(n,(a,s)=>{let c=r(a,i+1);!uur(c)&&(o[s]=c)}),t[i]=void 0,o}}return n};return r(e,0)},xLb=dxe("AsyncFunction"),jLb=e=>e&&(R$r(e)||f5(e))&&f5(e.then)&&f5(e.catch),Hcl=((e,t)=>e?setImmediate:t?((r,n)=>(P4t.addEventListener("message",({source:i,data:o})=>{i===P4t&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),P4t.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",f5(P4t.postMessage)),CLb=typeof queueMicrotask<"u"?queueMicrotask.bind(P4t):typeof process<"u"&&process.nextTick||Hcl,SLb=e=>e!=null&&f5(e[Qzn]),_r={isArray:cur,isArrayBuffer:kcl,isBuffer:T$r,isFormData:rLb,isArrayBufferView:H2b,isString:$2b,isNumber:Ucl,isBoolean:J2b,isObject:R$r,isPlainObject:zzn,isEmptyObject:K2b,isReadableStream:iLb,isRequest:oLb,isResponse:aLb,isHeaders:sLb,isUndefined:uur,isDate:Y2b,isFile:X2b,isBlob:Z2b,isRegExp:_Lb,isFunction:f5,isStream:tLb,isURLSearchParams:nLb,isTypedArray:hLb,isFileList:eLb,forEach:F$r,merge:aHa,extend:cLb,trim:uLb,stripBOM:lLb,inherits:pLb,toFlatObject:fLb,kindOf:qzn,kindOfTest:dxe,endsWith:dLb,toArray:mLb,forEachEntry:yLb,matchAll:gLb,isHTMLForm:bLb,hasOwnProperty:qcl,hasOwnProp:qcl,reduceDescriptors:Gcl,freezeMethods:vLb,toObjectSet:OLb,toCamelCase:ALb,noop:wLb,toFiniteNumber:PLb,findKey:Lcl,global:P4t,isContextDefined:Wcl,isSpecCompliantForm:ELb,toJSONObject:ILb,isAsyncFn:xLb,isThenable:jLb,setImmediate:Hcl,asap:CLb,isIterable:SLb};var vU=class e extends Error{static from(t,r,n,i,o,a){let s=new e(t.message,r||t.code,n,i,o);return s.cause=t,s.name=t.name,a&&Object.assign(s,a),s}constructor(t,r,n,i,o){super(t),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_r.toJSONObject(this.config),code:this.code,status:this.status}}};vU.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";vU.ERR_BAD_OPTION="ERR_BAD_OPTION";vU.ECONNABORTED="ECONNABORTED";vU.ETIMEDOUT="ETIMEDOUT";vU.ERR_NETWORK="ERR_NETWORK";vU.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";vU.ERR_DEPRECATED="ERR_DEPRECATED";vU.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";vU.ERR_BAD_REQUEST="ERR_BAD_REQUEST";vU.ERR_CANCELED="ERR_CANCELED";vU.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";vU.ERR_INVALID_URL="ERR_INVALID_URL";var ca=vU;var $cl=We(Hnr(),1),kzn=$cl.default;function uHa(e){return _r.isPlainObject(e)||_r.isArray(e)}function Kcl(e){return _r.endsWith(e,"[]")?e.slice(0,-2):e}function Jcl(e,t,r){return e?e.concat(t).map(function(i,o){return i=Kcl(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function BLb(e){return _r.isArray(e)&&!e.some(uHa)}var DLb=_r.toFlatObject(_r,{},null,function(t){return/^is[A-Z]/.test(t)});function TLb(e,t,r){if(!_r.isObject(e))throw new TypeError("target must be an object");t=t||new(kzn||FormData),r=_r.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,g){return!_r.isUndefined(g[y])});let n=r.metaTokens,i=r.visitor||u,o=r.dots,a=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&_r.isSpecCompliantForm(t);if(!_r.isFunction(i))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(_r.isDate(h))return h.toISOString();if(_r.isBoolean(h))return h.toString();if(!c&&_r.isBlob(h))throw new ca("Blob is not supported. Use a Buffer instead.");return _r.isArrayBuffer(h)||_r.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,y,g){let b=h;if(h&&!g&&typeof h=="object"){if(_r.endsWith(y,"{}"))y=n?y:y.slice(0,-2),h=JSON.stringify(h);else if(_r.isArray(h)&&BLb(h)||(_r.isFileList(h)||_r.endsWith(y,"[]"))&&(b=_r.toArray(h)))return y=Kcl(y),b.forEach(function(O,A){!(_r.isUndefined(O)||O===null)&&t.append(a===!0?Jcl([y],A,o):a===null?y:y+"[]",l(O))}),!1}return uHa(h)?!0:(t.append(Jcl(g,y,o),l(h)),!1)}let p=[],d=Object.assign(DLb,{defaultVisitor:u,convertValue:l,isVisitable:uHa});function m(h,y){if(!_r.isUndefined(h)){if(p.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(h),_r.forEach(h,function(b,_){(!(_r.isUndefined(b)||b===null)&&i.call(t,b,_r.isString(_)?_.trim():_,y,d))===!0&&m(b,y?y.concat(_):[_])}),p.pop()}}if(!_r.isObject(e))throw new TypeError("data must be an object");return m(e),t}var Jht=TLb;function Ycl(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Xcl(e,t){this._pairs=[],e&&Jht(e,this,t)}var Zcl=Xcl.prototype;Zcl.append=function(t,r){this._pairs.push([t,r])};Zcl.toString=function(t){let r=t?function(n){return t.call(this,n,Ycl)}:Ycl;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var ell=Xcl;function RLb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function E4t(e,t,r){if(!t)return e;let n=r&&r.encode||RLb,i=_r.isFunction(r)?{serialize:r}:r,o=i&&i.serialize,a;if(o?a=o(t,i):a=_r.isURLSearchParams(t)?t.toString():new ell(t,i).toString(n),a){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var cHa=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_r.forEach(this.handlers,function(n){n!==null&&t(n)})}},lHa=cHa;var lur={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ill=We(require("crypto"),1);var tll=We(require("url"),1),rll=tll.default.URLSearchParams;var pHa="abcdefghijklmnopqrstuvwxyz",nll="0123456789",oll={DIGIT:nll,ALPHA:pHa,ALPHA_DIGIT:pHa+pHa.toUpperCase()+nll},FLb=(e=16,t=oll.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);ill.default.randomFillSync(i);for(let o=0;o<e;o++)r+=t[i[o]%n];return r},all={isNode:!0,classes:{URLSearchParams:rll,FormData:kzn,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:oll,generateString:FLb,protocols:["http","https","file","data"]};var mHa={};Q(mHa,{hasBrowserEnv:()=>dHa,hasStandardBrowserEnv:()=>NLb,hasStandardBrowserWebWorkerEnv:()=>MLb,navigator:()=>fHa,origin:()=>zLb});var dHa=typeof window<"u"&&typeof document<"u",fHa=typeof navigator=="object"&&navigator||void 0,NLb=dHa&&(!fHa||["ReactNative","NativeScript","NS"].indexOf(fHa.product)<0),MLb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zLb=dHa&&window.location.href||"http://localhost";var jv={...mHa,...all};function hHa(e,t){return Jht(e,new jv.classes.URLSearchParams,{visitor:function(r,n,i,o){return jv.isNode&&_r.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function QLb(e){return _r.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function qLb(e){let t={},r=Object.keys(e),n,i=r.length,o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function VLb(e){function t(r,n,i,o){let a=r[o++];if(a==="__proto__")return!0;let s=Number.isFinite(+a),c=o>=r.length;return a=!a&&_r.isArray(i)?i.length:a,c?(_r.hasOwnProp(i,a)?i[a]=[i[a],n]:i[a]=n,!s):((!i[a]||!_r.isObject(i[a]))&&(i[a]=[]),t(r,n,i[a],o)&&_r.isArray(i[a])&&(i[a]=qLb(i[a])),!s)}if(_r.isFormData(e)&&_r.isFunction(e.entries)){let r={};return _r.forEachEntry(e,(n,i)=>{t(QLb(n),i,r,0)}),r}return null}var Uzn=VLb;function kLb(e,t,r){if(_r.isString(e))try{return(t||JSON.parse)(e),_r.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var yHa={transitional:lur,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=_r.isObject(t);if(o&&_r.isHTMLForm(t)&&(t=new FormData(t)),_r.isFormData(t))return i?JSON.stringify(Uzn(t)):t;if(_r.isArrayBuffer(t)||_r.isBuffer(t)||_r.isStream(t)||_r.isFile(t)||_r.isBlob(t)||_r.isReadableStream(t))return t;if(_r.isArrayBufferView(t))return t.buffer;if(_r.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return hHa(t,this.formSerializer).toString();if((s=_r.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return Jht(s?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),kLb(t)):t}],transformResponse:[function(t){let r=this.transitional||yHa.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(_r.isResponse(t)||_r.isReadableStream(t))return t;if(t&&_r.isString(t)&&(n&&!this.responseType||i)){let a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(s){if(a)throw s.name==="SyntaxError"?ca.from(s,ca.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jv.classes.FormData,Blob:jv.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_r.forEach(["delete","get","head","post","put","patch"],e=>{yHa.headers[e]={}});var pur=yHa;var ULb=_r.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sll=e=>{let t={},r,n,i;return e&&e.split(`
1302
+ `);for(let a=n;a<o.length;a++){let s=o[a];if(s.length>1024)continue;let c=ccl.test(s)?s.replace(ccl,"$1"):s;if(!c.match(/\S*Error: /)){for(let l of t){let u=l(c,e);if(u){i.push(u);break}}if(i.length>=lcl)break}}return pcl(i)}}var G7a=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=P$r(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 v4t(t,"DOMException")}isDOMError(t){return v4t(t,"DOMError")}};var H7a=class{match(t){return R7a(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 $7a=class{constructor(){}match(t){return zul(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 _2b=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,J7a=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(_2b);return i&&(r=i[1],n=i[2]),[r,n]}};var dcl=["fatal","error","warning","log","info","debug"];function Czn(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 K7a=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 gzn(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=Czn(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return P$r(t)&&!Nul(t)&&dcl.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(Xul(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var Y7a=class{match(t){return gzn(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Czn(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var X7a=class{match(t){return E$r(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var Z7a=class{match(t){return v4t(t,"PromiseRejectionEvent")}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return E$r(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){if(E$r(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var eHa=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 ycl=require("fs"),gcl=require("readline"),Szn=new p5.ReduceableCache(25),bcl=new p5.ReduceableCache(20),tHa=7,v2b=1e3,O2b=1e4;async function Acl(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],a=o?.filename;if(!o||typeof a!="string"||typeof o.lineno!="number"||I2b(a)||x2b(o))continue;t[a]||(t[a]=[]),t[a].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(bcl.get(i))continue;let o=t[i];if(!o)continue;o.sort((c,l)=>c-l);let a=C2b(o);if(a.every(c=>j2b(i,c)))continue;let s=S2b(Szn,i,{});n.push(w2b(i,a,s))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&P2b(e,Szn),Szn.reduce(),e}function w2b(e,t,r){return new Promise(n=>{let i=(0,ycl.createReadStream)(e),o=(0,gcl.createInterface)({input:i});function a(){i.destroy(),n()}let s=0,c=0,l=t[c];if(l===void 0)return void a();let u=l[0],p=l[1];function d(){bcl.set(e,1),o.close(),o.removeAllListeners(),a()}i.on("error",d),o.on("error",d),o.on("close",a),o.on("line",m=>{if(s++,!(s<u)&&(r[s]=B2b(m,0),s>=p)){if(c===t.length-1){o.close(),o.removeAllListeners();return}c++;let h=t[c];if(h===void 0){o.close(),o.removeAllListeners();return}u=h[0],p=h[1]}})})}function P2b(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;E2b(r.lineno,r,n)}}function E2b(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=_cl(e);i<e;i++){let o=r[i];if(o===void 0)return void mcl(t);t.pre_context.push(o)}if(r[e]===void 0)return void mcl(t);t.context_line=r[e];let n=vcl(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 mcl(e){delete e.pre_context,delete e.context_line,delete e.post_context}function I2b(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function x2b(e){return e.lineno!==void 0&&e.lineno>O2b||e.colno!==void 0&&e.colno>v2b}function j2b(e,t){let r=Szn.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 C2b(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=hcl(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+tHa:(i.push(n),n=hcl(o)),t++}return i}function hcl(e){return[_cl(e),vcl(e)]}function _cl(e){return Math.max(1,e-tHa)}function vcl(e){return e+tHa}function S2b(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function B2b(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}function D2b(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(a=>a.name!=="domainUncaughtExceptionClear"&&a._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function Ocl(e,t){globalThis.process?.on("uncaughtException",D2b(e,t))}function wcl(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var T2b=2e3,fxe=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new bzn({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return Ful(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i};n||(o.$process_person_profile=!1);let a=this.errorPropertiesBuilder.buildFromUnknown(t,r);return a.$exception_list=await this.errorPropertiesBuilder.modifyFrames(a.$exception_list),{event:"$exception",distinctId:n||RNe(),properties:{...a,...o}}}startAutocaptureIfEnabled(){this.isEnabled()&&(Ocl(this.onException.bind(this),this.onFatalError.bind(this)),wcl(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(T2b),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var Pcl="5.24.7";var C$r={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function Ecl(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 R2b=6e4,F2b=1152921504606847e3,N2b=["is_not"],iur=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},kw=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},NNe=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Bzn=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:a,...s}){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=s.fetch||fetch,this.onError=s.onError,this.customHeaders=a,this.onLoad=s.onLoad,this.cacheProvider=s.cacheProvider,this.strictLocalEvaluation=s.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let a,s;if(!this.loadedSuccessfullyOnce)return a;if(s=this.featureFlagsByKey[t],s!==void 0)try{a=(await this.computeFlagAndPayloadLocally(s,r,n,i,o)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${a}`))}catch(c){c instanceof NNe||c instanceof kw?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${t}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${c}`))}return a}async getAllFlagsAndPayloads(t,r={},n={},i={},o){await this.loadFeatureFlags();let a={},s={},c=this.featureFlags.length==0,l=o?o.map(p=>this.featureFlagsByKey[p]).filter(Boolean):this.featureFlags,u={};return await Promise.all(l.map(async p=>{try{let{value:d,payload:m}=await this.computeFlagAndPayloadLocally(p,t,r,n,i,void 0,u);a[p.key]=d,m&&(s[p.key]=m)}catch(d){d instanceof NNe||d instanceof kw?this.logMsgIfDebug(()=>console.debug(`${d.name} when computing flag locally: ${p.key}: ${d.message}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${p.key}: ${d}`)),c=!0}})),{response:a,payloads:s,fallbackToFlags:c}}async computeFlagAndPayloadLocally(t,r,n={},i={},o={},a,s,c=!1){if(c||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let l;l=a!==void 0?a:await this.computeFlagValueLocally(t,r,n,i,o,s);let u=this.getFeatureFlagPayload(t.key,l);return{value:l,payload:u}}async computeFlagValueLocally(t,r,n={},i={},o={},a={}){if(t.ensure_experience_continuity)throw new kw("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c==null)return await this.matchFeatureFlagProperties(t,r,i,a);{let l=this.groupTypeMapping[String(c)];if(!l)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new kw("Flag has unknown group type index");if(!(l in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let u=o[l];return await this.matchFeatureFlagProperties(t,n[l],u,a)}}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,i){let o=t.key;if(!this.featureFlagsByKey)throw new kw("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new kw(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let a=t.dependency_chain;if(!Array.isArray(a))throw new kw(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof a})`);if(a.length===0)throw new kw(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let c of a){if(!(c in i)){let u=this.featureFlagsByKey[c];if(u)if(u.active)try{let p=await this.matchFeatureFlagProperties(u,r,n,i);i[c]=p}catch(p){throw new kw(`Error evaluating flag dependency '${c}' for flag '${o}': ${p}`)}else i[c]=!1;else throw new kw(`Missing flag dependency '${c}' for flag '${o}'`)}if(i[c]==null)throw new kw(`Dependency '${c}' could not be evaluated`)}let s=i[o];return this.flagEvaluatesToExpectedValue(t.value,s)}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||{},a=o.groups||[],s=!1,c;for(let l of a)try{if(await this.isConditionMatch(t,r,l,n,i)){let u=l.variant,p=o.multivariate?.variants||[];c=u&&p.some(d=>d.key===u)?u:await this.getMatchingVariant(t,r)||!0;break}}catch(u){if(u instanceof NNe)throw u;if(u instanceof kw)s=!0;else throw u}if(c!==void 0)return c;if(s)throw new kw("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o={}){let a=n.rollout_percentage,s=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let l=c.type,u=!1;if(u=l==="cohort"?Scl(c,i,this.cohorts,this.debugMode):l==="flag"?await this.evaluateFlagDependency(c,r,i,o):Ccl(c,i,s),!u)return!1}if(a==null)return!0}return!(a!=null&&await Icl(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await Icl(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(s=>{i=n+s.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:s.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}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(R2b,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 iur(`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 iur(`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 iur(`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.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 iur&&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}/api/feature_flag/local_evaluation?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=O4t(()=>{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 Icl(e,t,r=""){let n=await Ecl(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/F2b}function Ccl(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new kw("Operator is_not_set is not supported")}else throw new kw(`Property ${n} not found in propertyValues`);let a=t[n];if(a==null&&!N2b.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function s(l,u){return Array.isArray(l)?l.map(p=>String(p).toLowerCase()).includes(String(u).toLowerCase()):String(l).toLowerCase()===String(u).toLowerCase()}function c(l,u,p){if(p==="gt")return l>u;if(p==="gte")return l>=u;if(p==="lt")return l<u;if(p==="lte")return l<=u;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return s(i,a);case"is_not":return!s(i,a);case"is_set":return n in t;case"icontains":return String(a).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(a).toLowerCase().includes(String(i).toLowerCase());case"regex":return xcl(String(i))&&String(a).match(String(i))!==null;case"not_regex":return xcl(String(i))&&String(a).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let l=typeof i=="number"?i:null;if(typeof i=="string")try{l=parseFloat(i)}catch{}return l==null||a==null?c(String(a),String(i),o):typeof a=="string"?c(a,String(i),o):c(a,l,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new kw("Date operations cannot be performed on boolean values");let l=z2b(String(i));if(l==null&&(l=jcl(i)),l==null)throw new kw(`Invalid date: ${i}`);let u=jcl(a);return["is_date_before"].includes(o)?u<l:u>l}default:throw new kw(`Unknown operator: ${o}`)}}function M2b(e,t){if(!(e in t))throw new NNe(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function Scl(e,t,r,n=!1){let i=String(e.value);M2b(i,r);let o=r[i];return Bcl(o,t,r,n)}function Bcl(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let a=!1;if("values"in o[0]){for(let s of o)try{let c=Bcl(s,t,r,n);if(i==="AND"){if(!c)return!1}else if(c)return!0}catch(c){if(c instanceof NNe)throw c;if(c instanceof kw)n&&console.debug(`Failed to compute property ${s} locally: ${c}`),a=!0;else throw c}if(a)throw new kw("Can't match cohort without a given cohort property value");return i==="AND"}for(let s of o)try{let c;if(s.type==="cohort")c=Scl(s,t,r,n);else if(s.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${s.key||"unknown"}'`);continue}else c=Ccl(s,t);let l=s.negation||!1;if(i==="AND"){if(!c&&!l||c&&l)return!1}else if(c&&!l||!c&&l)return!0}catch(c){if(c instanceof NNe)throw c;if(c instanceof kw)n&&console.debug(`Failed to compute property ${s} locally: ${c}`),a=!0;else throw c}if(a)throw new kw("can't match cohort without a given cohort property value");return i==="AND"}function xcl(e){try{return new RegExp(e),!0}catch{return!1}}function jcl(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 kw(`${e} is in an invalid date format`)}throw new kw(`The date provided ${e} must be a string, number, or date object`)}function z2b(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 Dzn=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var Q2b=100,Dcl=3e4,q2b=5e4,Tzn=class extends j$r{constructor(t,r={}){if(super(t,r),this._memoryStorage=new Dzn,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,Q2b):Dcl,r.personalApiKey){if(r.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.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new Bzn({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new fxe(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||q2b}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 Pcl}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."),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."),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:a,...s}=r,u={$set:i||s,$set_once:o||{},$anon_distinct_id:a??void 0};super.identifyStateless(t,u,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:a,...s}=r,u={$set:i||s,$set_once:o||{},$anon_distinct_id:a??void 0};super.identifyStatelessImmediate(t,u,{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=Dcl){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)})})}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let v=this._flagOverrides[t];if(v===void 0)return;let P=this._payloadOverrides?.[t];return{key:t,enabled:v!==!1,variant:typeof v=="string"?v:void 0,payload:P}}let{groups:a,disableGeoip:s}=n,{onlyEvaluateLocally:c,personProperties:l,groupProperties:u}=n,p=this.addLocalPersonAndGroupProperties(r,a,l,u);l=p.allPersonProperties,u=p.allGroupProperties,c==null&&(c=this.options.strictLocalEvaluation??!1);let d,m=!1,h,y,g,b,_,O;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let v=this.featureFlagsPoller?.featureFlagsByKey[t];if(v)try{let P=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(v,r,a,l,u,i);if(P){m=!0;let I=P.value;b=v.id,O="Evaluated locally",d={key:t,enabled:I!==!1,variant:typeof I=="string"?I:void 0,payload:P.payload??void 0}}}catch(P){if(P instanceof NNe||P instanceof kw)this._logger?.info(`${P.name} when computing flag locally: ${t}: ${P.message}`);else throw P}}if(!m&&!c){let v=await super.getFeatureFlagDetailsStateless(r,a,l,u,s,[t]);if(v===void 0)g=C$r.UNKNOWN_ERROR;else{h=v.requestId,y=v.evaluatedAt;let P=[];v.errorsWhileComputingFlags&&P.push(C$r.ERRORS_WHILE_COMPUTING),v.quotaLimited?.includes("feature_flags")&&P.push(C$r.QUOTA_LIMITED);let I=v.flags[t];if(I===void 0)P.push(C$r.FLAG_MISSING);else{b=I.metadata?.id,_=I.metadata?.version,O=I.reason?.description??I.reason?.code;let E;if(I.metadata?.payload!==void 0)try{E=JSON.parse(I.metadata.payload)}catch{E=I.metadata.payload}d={key:t,enabled:I.enabled,variant:I.variant,payload:E}}P.length>0&&(g=P.join(","))}}if(o){let v=d===void 0?void 0:d.enabled===!1?!1:d.variant??!0,P=`${t}_${v}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(P)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(P):this.distinctIdHasSentFlagCalls[r]=[P];let I={$feature_flag:t,$feature_flag_response:v,$feature_flag_id:b,$feature_flag_version:_,$feature_flag_reason:O,locally_evaluated:m,[`$feature/${t}`]:v,$feature_flag_request_id:h,$feature_flag_evaluated_at:y};g&&(I.$feature_flag_error=g),this.capture({distinctId:r,event:"$feature_flag_called",properties:I,groups:a,disableGeoip:s})}}return d!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(d={...d,payload:this._payloadOverrides[t]}),d}async getFeatureFlag(t,r,n){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(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){return this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0})}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){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:n,disableGeoip:i,flagKeys:o}=r||{},{onlyEvaluateLocally:a,personProperties:s,groupProperties:c}=r||{},l=this.addLocalPersonAndGroupProperties(t,n,s,c);s=l.allPersonProperties,c=l.allGroupProperties,a==null&&(a=this.options.strictLocalEvaluation??!1);let u=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,s,c,o),p={},d={},m=!0;if(u&&(p=u.response,d=u.payloads,m=u.fallbackToFlags),m&&!a){let h=await super.getFeatureFlagsAndPayloadsStateless(t,n,s,c,i,o);p={...p,...h.flags||{}},d={...d,...h.payloads||{}}}return this._flagOverrides!==void 0&&(p={...p,...this._flagOverrides}),this._payloadOverrides!==void 0&&(d={...d,...this._payloadOverrides}),{featureFlags:p,featureFlagPayloads:d}}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()}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown(),super._shutdown(t)}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=O4t(()=>{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,a]of Object.entries(t))if(Qul(a)&&r&&o in r){let s={};for(let[c,l]of Object.entries(a))s[String(c)]=String(l);i[String(o)]=s}else n[String(o)]=String(a);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},a=i?.groupProperties||{},s=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let l={};for(let[u,p]of Object.entries(r||{}))l[u]=String(p);return await this.getAllFlags(t,{groups:l,personProperties:o,groupProperties:a,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:s})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let l={};for(let[u,p]of Object.entries(r||{}))l[u]=String(p);return await this.getAllFlags(t,{groups:l,personProperties:o,groupProperties:a,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:s})}return(await super.getFeatureFlagsStateless(t,r,o,a,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},a={};if(r)for(let s of Object.keys(r))a[s]={$group_key:r[s],...i?.[s]||{}};return{allPersonProperties:o,allGroupProperties:a}}captureException(t,r,n,i){if(!fxe.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(fxe.buildEventMessage(t,{syntheticException:o},r,n).then(a=>this.capture({...a,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!fxe.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");this.addPendingPromise(fxe.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:a,timestamp:s,disableGeoip:c,uuid:l}=t,u=this.context?.get(),p=r||u?.distinctId,d={...u?.properties||{},...i||{}};p||(p=RNe(),d.$process_person_profile=!1),u?.sessionId&&!d.$session_id&&(d.$session_id=u.sessionId);let m=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:a,timestamp:s,disableGeoip:c,uuid:l});if(!m)return Promise.reject(null);let h=await Promise.resolve().then(async()=>{if(a){let y=typeof a=="object"?a:void 0;return await this.getFeatureFlagsForEvent(m.distinctId,o,c,y)}return m.event,{}}).then(y=>{let g={};if(y)for(let[_,O]of Object.entries(y))g[`$feature/${_}`]=O;let b=Object.keys(y||{}).filter(_=>y?.[_]!==!1).sort();return b.length>0&&(g.$active_feature_flags=b),g}).catch(()=>({})).then(y=>({...y,...m.properties||{},$groups:m.groups||o}));return m.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof h.$raw_user_agent=="string"&&Tul(h.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(m.event="$bot_pageview",h.$browser_type="bot"),{distinctId:m.distinctId,event:m.event,properties:h,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 a=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(a)}}return i}};var Tcl=require("async_hooks"),Rzn=class{constructor(){this.storage=new Tcl.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){if(n?.fresh===!0)return this.storage.run(t,r);{let o=this.get()||{},a={distinctId:t.distinctId??o.distinctId,sessionId:t.sessionId??o.sessionId,properties:{...o.properties||{},...t.properties||{}}};return this.storage.run(a,r)}}};var Rcl="posthog-node";function V2b(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return a=>{if(!(i==="*"||i.includes(a.level)))return a;a.tags||(a.tags={});let c=a.tags[rHa.POSTHOG_ID_TAG];if(c===void 0)return a;let l=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${c}`,l).toString();a.tags["PostHog Person URL"]=u;let p=a.exception?.values||[],d=p.map(h=>({...h,stacktrace:h.stacktrace?{...h.stacktrace,type:"raw",frames:(h.stacktrace.frames||[]).map(y=>({...y,platform:"node:javascript"}))}:void 0})),m={$exception_message:p[0]?.value||a.message,$exception_type:p[0]?.type,$exception_level:a.level,$exception_list:d,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:p[0]?.value||a.message,$sentry_exception_type:p[0]?.type,$sentry_tags:a.tags};return t&&r&&(m.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),o&&e.capture({event:"$exception",distinctId:c,properties:m}),a}}var rHa=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=Rcl,this.name=Rcl,this.setupOnce=function(a,s){let c=s()?.getClient()?.getDsn()?.projectId;a(V2b(t,{organization:r,projectId:c,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};fxe.errorPropertiesBuilder=new p5.ErrorPropertiesBuilder([new p5.EventCoercer,new p5.ErrorCoercer,new p5.ObjectCoercer,new p5.StringCoercer,new p5.PrimitiveCoercer],p5.createStackParser("node:javascript",p5.nodeStackLineParser),[jul(),Acl]);var our=class extends Tzn{getLibraryId(){return"posthog-node"}initializeContext(){return new Rzn}};var Fzn=class{posthog;constructor({posthogApiKey:t}){this.posthog=new our(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"3.70.3",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var S$r=class{async sendEvent(){}async identify(){}async flush(){}};var aur=require("fs/promises"),zcl=require("os"),Qcl=require("path");var Fcl=We(require("crypto")),Mzn=new Uint8Array(256),Nzn=Mzn.length;function nHa(){return Nzn>Mzn.length-16&&(Fcl.default.randomFillSync(Mzn),Nzn=0),Mzn.slice(Nzn,Nzn+=16)}var LM=[];for(let e=0;e<256;++e)LM.push((e+256).toString(16).slice(1));function Ncl(e,t=0){return LM[e[t+0]]+LM[e[t+1]]+LM[e[t+2]]+LM[e[t+3]]+"-"+LM[e[t+4]]+LM[e[t+5]]+"-"+LM[e[t+6]]+LM[e[t+7]]+"-"+LM[e[t+8]]+LM[e[t+9]]+"-"+LM[e[t+10]]+LM[e[t+11]]+LM[e[t+12]]+LM[e[t+13]]+LM[e[t+14]]+LM[e[t+15]]}var Mcl=We(require("crypto")),iHa={randomUUID:Mcl.default.randomUUID};function k2b(e,t,r){if(iHa.randomUUID&&!t&&!e)return iHa.randomUUID();e=e||{};let n=e.random||(e.rng||nHa)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return Ncl(n)}var qJ=k2b;var U2b="id",L2b=".fern",B$r=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new our(r),this.userId=t==null?void 0:V3a(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:"3.70.3",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){await this.posthog.flush()}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 xx({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=vt(xr.of((0,zcl.homedir)()),Xe.of(L2b),Xe.of(U2b));await un(t)||(await(0,aur.mkdir)((0,Qcl.dirname)(t),{recursive:!0}),await(0,aur.writeFile)(t,qJ())),this.persistedDistinctId=(await(0,aur.readFile)(t)).toString()}return this.persistedDistinctId}};var oHa;async function sur(){return oHa==null&&(oHa=await W2b()),oHa}async function W2b(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new S$r;let r=await eTn();return r!=null?new B$r({token:r,posthogApiKey:e}):await hNe()!=null?new Fzn({posthogApiKey:e}):new B$r({token:void 0,posthogApiKey:e})}catch{return new S$r}}function D$r(e,t){return function(){return e.apply(t,arguments)}}var{toString:G2b}=Object.prototype,{getPrototypeOf:sHa}=Object,{iterator:Qzn,toStringTag:Vcl}=Symbol,qzn=(e=>t=>{let r=G2b.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),dxe=e=>(e=e.toLowerCase(),t=>qzn(t)===e),Vzn=e=>t=>typeof t===e,{isArray:cur}=Array,uur=Vzn("undefined");function T$r(e){return e!==null&&!uur(e)&&e.constructor!==null&&!uur(e.constructor)&&f5(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var kcl=dxe("ArrayBuffer");function H2b(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&kcl(e.buffer),t}var $2b=Vzn("string"),f5=Vzn("function"),Ucl=Vzn("number"),R$r=e=>e!==null&&typeof e=="object",J2b=e=>e===!0||e===!1,zzn=e=>{if(qzn(e)!=="object")return!1;let t=sHa(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Vcl in e)&&!(Qzn in e)},K2b=e=>{if(!R$r(e)||T$r(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Y2b=dxe("Date"),X2b=dxe("File"),Z2b=dxe("Blob"),eLb=dxe("FileList"),tLb=e=>R$r(e)&&f5(e.pipe),rLb=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||f5(e.append)&&((t=qzn(e))==="formdata"||t==="object"&&f5(e.toString)&&e.toString()==="[object FormData]"))},nLb=dxe("URLSearchParams"),[iLb,oLb,aLb,sLb]=["ReadableStream","Request","Response","Headers"].map(dxe),uLb=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F$r(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),cur(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(T$r(e))return;let o=r?Object.getOwnPropertyNames(e):Object.keys(e),a=o.length,s;for(n=0;n<a;n++)s=o[n],t.call(null,e[s],s,e)}}function Lcl(e,t){if(T$r(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var P4t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Wcl=e=>!uur(e)&&e!==P4t;function aHa(){let{caseless:e,skipUndefined:t}=Wcl(this)&&this||{},r={},n=(i,o)=>{let a=e&&Lcl(r,o)||o;zzn(r[a])&&zzn(i)?r[a]=aHa(r[a],i):zzn(i)?r[a]=aHa({},i):cur(i)?r[a]=i.slice():(!t||!uur(i))&&(r[a]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&F$r(arguments[i],n);return r}var cLb=(e,t,r,{allOwnKeys:n}={})=>(F$r(t,(i,o)=>{r&&f5(i)?Object.defineProperty(e,o,{value:D$r(i,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),lLb=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),pLb=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},fLb=(e,t,r,n)=>{let i,o,a,s={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)a=i[o],(!n||n(a,e,t))&&!s[a]&&(t[a]=e[a],s[a]=!0);e=r!==!1&&sHa(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},dLb=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},mLb=e=>{if(!e)return null;if(cur(e))return e;let t=e.length;if(!Ucl(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},hLb=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&sHa(Uint8Array)),yLb=(e,t)=>{let n=(e&&e[Qzn]).call(e),i;for(;(i=n.next())&&!i.done;){let o=i.value;t.call(e,o[0],o[1])}},gLb=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},bLb=dxe("HTMLFormElement"),ALb=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),qcl=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),_Lb=dxe("RegExp"),Gcl=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};F$r(r,(i,o)=>{let a;(a=t(i,o,e))!==!1&&(n[o]=a||i)}),Object.defineProperties(e,n)},vLb=e=>{Gcl(e,(t,r)=>{if(f5(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(f5(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},OLb=(e,t)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return cur(e)?n(e):n(String(e).split(t)),r},wLb=()=>{},PLb=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ELb(e){return!!(e&&f5(e.append)&&e[Vcl]==="FormData"&&e[Qzn])}var ILb=e=>{let t=new Array(10),r=(n,i)=>{if(R$r(n)){if(t.indexOf(n)>=0)return;if(T$r(n))return n;if(!("toJSON"in n)){t[i]=n;let o=cur(n)?[]:{};return F$r(n,(a,s)=>{let c=r(a,i+1);!uur(c)&&(o[s]=c)}),t[i]=void 0,o}}return n};return r(e,0)},xLb=dxe("AsyncFunction"),jLb=e=>e&&(R$r(e)||f5(e))&&f5(e.then)&&f5(e.catch),Hcl=((e,t)=>e?setImmediate:t?((r,n)=>(P4t.addEventListener("message",({source:i,data:o})=>{i===P4t&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),P4t.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",f5(P4t.postMessage)),CLb=typeof queueMicrotask<"u"?queueMicrotask.bind(P4t):typeof process<"u"&&process.nextTick||Hcl,SLb=e=>e!=null&&f5(e[Qzn]),_r={isArray:cur,isArrayBuffer:kcl,isBuffer:T$r,isFormData:rLb,isArrayBufferView:H2b,isString:$2b,isNumber:Ucl,isBoolean:J2b,isObject:R$r,isPlainObject:zzn,isEmptyObject:K2b,isReadableStream:iLb,isRequest:oLb,isResponse:aLb,isHeaders:sLb,isUndefined:uur,isDate:Y2b,isFile:X2b,isBlob:Z2b,isRegExp:_Lb,isFunction:f5,isStream:tLb,isURLSearchParams:nLb,isTypedArray:hLb,isFileList:eLb,forEach:F$r,merge:aHa,extend:cLb,trim:uLb,stripBOM:lLb,inherits:pLb,toFlatObject:fLb,kindOf:qzn,kindOfTest:dxe,endsWith:dLb,toArray:mLb,forEachEntry:yLb,matchAll:gLb,isHTMLForm:bLb,hasOwnProperty:qcl,hasOwnProp:qcl,reduceDescriptors:Gcl,freezeMethods:vLb,toObjectSet:OLb,toCamelCase:ALb,noop:wLb,toFiniteNumber:PLb,findKey:Lcl,global:P4t,isContextDefined:Wcl,isSpecCompliantForm:ELb,toJSONObject:ILb,isAsyncFn:xLb,isThenable:jLb,setImmediate:Hcl,asap:CLb,isIterable:SLb};var vU=class e extends Error{static from(t,r,n,i,o,a){let s=new e(t.message,r||t.code,n,i,o);return s.cause=t,s.name=t.name,a&&Object.assign(s,a),s}constructor(t,r,n,i,o){super(t),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:_r.toJSONObject(this.config),code:this.code,status:this.status}}};vU.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";vU.ERR_BAD_OPTION="ERR_BAD_OPTION";vU.ECONNABORTED="ECONNABORTED";vU.ETIMEDOUT="ETIMEDOUT";vU.ERR_NETWORK="ERR_NETWORK";vU.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";vU.ERR_DEPRECATED="ERR_DEPRECATED";vU.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";vU.ERR_BAD_REQUEST="ERR_BAD_REQUEST";vU.ERR_CANCELED="ERR_CANCELED";vU.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";vU.ERR_INVALID_URL="ERR_INVALID_URL";var ca=vU;var $cl=We(Hnr(),1),kzn=$cl.default;function uHa(e){return _r.isPlainObject(e)||_r.isArray(e)}function Kcl(e){return _r.endsWith(e,"[]")?e.slice(0,-2):e}function Jcl(e,t,r){return e?e.concat(t).map(function(i,o){return i=Kcl(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function BLb(e){return _r.isArray(e)&&!e.some(uHa)}var DLb=_r.toFlatObject(_r,{},null,function(t){return/^is[A-Z]/.test(t)});function TLb(e,t,r){if(!_r.isObject(e))throw new TypeError("target must be an object");t=t||new(kzn||FormData),r=_r.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,g){return!_r.isUndefined(g[y])});let n=r.metaTokens,i=r.visitor||u,o=r.dots,a=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&_r.isSpecCompliantForm(t);if(!_r.isFunction(i))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(_r.isDate(h))return h.toISOString();if(_r.isBoolean(h))return h.toString();if(!c&&_r.isBlob(h))throw new ca("Blob is not supported. Use a Buffer instead.");return _r.isArrayBuffer(h)||_r.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,y,g){let b=h;if(h&&!g&&typeof h=="object"){if(_r.endsWith(y,"{}"))y=n?y:y.slice(0,-2),h=JSON.stringify(h);else if(_r.isArray(h)&&BLb(h)||(_r.isFileList(h)||_r.endsWith(y,"[]"))&&(b=_r.toArray(h)))return y=Kcl(y),b.forEach(function(O,A){!(_r.isUndefined(O)||O===null)&&t.append(a===!0?Jcl([y],A,o):a===null?y:y+"[]",l(O))}),!1}return uHa(h)?!0:(t.append(Jcl(g,y,o),l(h)),!1)}let p=[],d=Object.assign(DLb,{defaultVisitor:u,convertValue:l,isVisitable:uHa});function m(h,y){if(!_r.isUndefined(h)){if(p.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(h),_r.forEach(h,function(b,_){(!(_r.isUndefined(b)||b===null)&&i.call(t,b,_r.isString(_)?_.trim():_,y,d))===!0&&m(b,y?y.concat(_):[_])}),p.pop()}}if(!_r.isObject(e))throw new TypeError("data must be an object");return m(e),t}var Jht=TLb;function Ycl(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Xcl(e,t){this._pairs=[],e&&Jht(e,this,t)}var Zcl=Xcl.prototype;Zcl.append=function(t,r){this._pairs.push([t,r])};Zcl.toString=function(t){let r=t?function(n){return t.call(this,n,Ycl)}:Ycl;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var ell=Xcl;function RLb(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function E4t(e,t,r){if(!t)return e;let n=r&&r.encode||RLb,i=_r.isFunction(r)?{serialize:r}:r,o=i&&i.serialize,a;if(o?a=o(t,i):a=_r.isURLSearchParams(t)?t.toString():new ell(t,i).toString(n),a){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var cHa=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){_r.forEach(this.handlers,function(n){n!==null&&t(n)})}},lHa=cHa;var lur={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var ill=We(require("crypto"),1);var tll=We(require("url"),1),rll=tll.default.URLSearchParams;var pHa="abcdefghijklmnopqrstuvwxyz",nll="0123456789",oll={DIGIT:nll,ALPHA:pHa,ALPHA_DIGIT:pHa+pHa.toUpperCase()+nll},FLb=(e=16,t=oll.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);ill.default.randomFillSync(i);for(let o=0;o<e;o++)r+=t[i[o]%n];return r},all={isNode:!0,classes:{URLSearchParams:rll,FormData:kzn,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:oll,generateString:FLb,protocols:["http","https","file","data"]};var mHa={};Q(mHa,{hasBrowserEnv:()=>dHa,hasStandardBrowserEnv:()=>NLb,hasStandardBrowserWebWorkerEnv:()=>MLb,navigator:()=>fHa,origin:()=>zLb});var dHa=typeof window<"u"&&typeof document<"u",fHa=typeof navigator=="object"&&navigator||void 0,NLb=dHa&&(!fHa||["ReactNative","NativeScript","NS"].indexOf(fHa.product)<0),MLb=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",zLb=dHa&&window.location.href||"http://localhost";var jv={...mHa,...all};function hHa(e,t){return Jht(e,new jv.classes.URLSearchParams,{visitor:function(r,n,i,o){return jv.isNode&&_r.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function QLb(e){return _r.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function qLb(e){let t={},r=Object.keys(e),n,i=r.length,o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function VLb(e){function t(r,n,i,o){let a=r[o++];if(a==="__proto__")return!0;let s=Number.isFinite(+a),c=o>=r.length;return a=!a&&_r.isArray(i)?i.length:a,c?(_r.hasOwnProp(i,a)?i[a]=[i[a],n]:i[a]=n,!s):((!i[a]||!_r.isObject(i[a]))&&(i[a]=[]),t(r,n,i[a],o)&&_r.isArray(i[a])&&(i[a]=qLb(i[a])),!s)}if(_r.isFormData(e)&&_r.isFunction(e.entries)){let r={};return _r.forEachEntry(e,(n,i)=>{t(QLb(n),i,r,0)}),r}return null}var Uzn=VLb;function kLb(e,t,r){if(_r.isString(e))try{return(t||JSON.parse)(e),_r.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var yHa={transitional:lur,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=_r.isObject(t);if(o&&_r.isHTMLForm(t)&&(t=new FormData(t)),_r.isFormData(t))return i?JSON.stringify(Uzn(t)):t;if(_r.isArrayBuffer(t)||_r.isBuffer(t)||_r.isStream(t)||_r.isFile(t)||_r.isBlob(t)||_r.isReadableStream(t))return t;if(_r.isArrayBufferView(t))return t.buffer;if(_r.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return hHa(t,this.formSerializer).toString();if((s=_r.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return Jht(s?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),kLb(t)):t}],transformResponse:[function(t){let r=this.transitional||yHa.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(_r.isResponse(t)||_r.isReadableStream(t))return t;if(t&&_r.isString(t)&&(n&&!this.responseType||i)){let a=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(s){if(a)throw s.name==="SyntaxError"?ca.from(s,ca.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jv.classes.FormData,Blob:jv.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_r.forEach(["delete","get","head","post","put","patch"],e=>{yHa.headers[e]={}});var pur=yHa;var ULb=_r.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sll=e=>{let t={},r,n,i;return e&&e.split(`
1303
1303
  `).forEach(function(a){i=a.indexOf(":"),r=a.substring(0,i).trim().toLowerCase(),n=a.substring(i+1).trim(),!(!r||t[r]&&ULb[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var ull=Symbol("internals");function N$r(e){return e&&String(e).trim().toLowerCase()}function Lzn(e){return e===!1||e==null?e:_r.isArray(e)?e.map(Lzn):String(e)}function LLb(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var WLb=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function gHa(e,t,r,n,i){if(_r.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!_r.isString(t)){if(_r.isString(n))return t.indexOf(n)!==-1;if(_r.isRegExp(n))return n.test(t)}}function GLb(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function HLb(e,t){let r=_r.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,o,a){return this[n].call(this,t,i,o,a)},configurable:!0})})}var fur=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function o(s,c,l){let u=N$r(c);if(!u)throw new Error("header name must be a non-empty string");let p=_r.findKey(i,u);(!p||i[p]===void 0||l===!0||l===void 0&&i[p]!==!1)&&(i[p||c]=Lzn(s))}let a=(s,c)=>_r.forEach(s,(l,u)=>o(l,u,c));if(_r.isPlainObject(t)||t instanceof this.constructor)a(t,r);else if(_r.isString(t)&&(t=t.trim())&&!WLb(t))a(sll(t),r);else if(_r.isObject(t)&&_r.isIterable(t)){let s={},c,l;for(let u of t){if(!_r.isArray(u))throw TypeError("Object iterator must return a key-value pair");s[l=u[0]]=(c=s[l])?_r.isArray(c)?[...c,u[1]]:[c,u[1]]:u[1]}a(s,r)}else t!=null&&o(r,t,n);return this}get(t,r){if(t=N$r(t),t){let n=_r.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return LLb(i);if(_r.isFunction(r))return r.call(this,i,n);if(_r.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=N$r(t),t){let n=_r.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||gHa(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function o(a){if(a=N$r(a),a){let s=_r.findKey(n,a);s&&(!r||gHa(n,n[s],s,r))&&(delete n[s],i=!0)}}return _r.isArray(t)?t.forEach(o):o(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let o=r[n];(!t||gHa(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){let r=this,n={};return _r.forEach(this,(i,o)=>{let a=_r.findKey(n,o);if(a){r[a]=Lzn(i),delete r[o];return}let s=t?GLb(o):String(o).trim();s!==o&&delete r[o],r[s]=Lzn(i),n[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return _r.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&_r.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
1304
1304
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[ull]=this[ull]={accessors:{}}).accessors,i=this.prototype;function o(a){let s=N$r(a);n[s]||(HLb(i,a),n[s]=!0)}return _r.isArray(t)?t.forEach(o):o(t),this}};fur.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);_r.reduceDescriptors(fur.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});_r.freezeMethods(fur);var Sx=fur;function M$r(e,t){let r=this||pur,n=t||r,i=Sx.from(n.headers),o=n.data;return _r.forEach(e,function(s){o=s.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function z$r(e){return!!(e&&e.__CANCEL__)}var bHa=class extends ca{constructor(t,r,n){super(t??"canceled",ca.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}},VJ=bHa;function MNe(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new ca("Request failed with status code "+r.status,[ca.ERR_BAD_REQUEST,ca.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function AHa(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function _Ha(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function I4t(e,t,r){let n=!AHa(t);return e&&(n||r==!1)?_Ha(e,t):t}var Dll=We(vHa(),1),Tll=We(require("http"),1),Rll=We(require("https"),1),kHa=We(require("http2"),1),UHa=We(require("util"),1),Fll=We(yll(),1),Bot=We(require("zlib"),1);var C4t="1.13.4";function U$r(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var l3b=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function RHa(e,t,r){let n=r&&r.Blob||jv.classes.Blob,i=U$r(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let o=l3b.exec(e);if(!o)throw new ca("Invalid URL",ca.ERR_INVALID_URL);let a=o[1],s=o[2],c=o[3],l=Buffer.from(decodeURIComponent(c),s?"base64":"utf8");if(t){if(!n)throw new ca("Blob is not supported",ca.ERR_NOT_SUPPORT);return new n([l],{type:a})}return l}throw new ca("Unsupported protocol "+i,ca.ERR_NOT_SUPPORT)}var Sot=We(require("stream"),1);var gll=We(require("stream"),1);var FHa=Symbol("internals"),NHa=class extends gll.default.Transform{constructor(t){t=_r.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!_r.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[FHa]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",n=>{n==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[FHa];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[FHa],o=i.maxRate,a=this.readableHighWaterMark,s=i.timeWindow,c=1e3/s,l=o/c,u=i.minChunkSize!==!1?Math.max(i.minChunkSize,l*.01):0,p=(m,h)=>{let y=Buffer.byteLength(m);i.bytesSeen+=y,i.bytes+=y,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(m)?process.nextTick(h):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(h)}},d=(m,h)=>{let y=Buffer.byteLength(m),g=null,b=a,_,O=0;if(o){let A=Date.now();(!i.ts||(O=A-i.ts)>=s)&&(i.ts=A,_=l-i.bytes,i.bytes=_<0?-_:0,O=0),_=l-i.bytes}if(o){if(_<=0)return setTimeout(()=>{h(null,m)},s-O);_<b&&(b=_)}b&&y>b&&y-b>u&&(g=m.subarray(b),m=m.subarray(0,b)),p(m,g?()=>{process.nextTick(h,null,g)}:h)};d(t,function m(h,y){if(h)return n(h);y?d(y,m):n(null)})}},MHa=NHa;var Nll=require("events");var All=We(require("util"),1),_ll=require("stream");var{asyncIterator:bll}=Symbol,p3b=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[bll]?yield*e[bll]():yield e},Wzn=p3b;var f3b=jv.ALPHABET.ALPHA_DIGIT+"-_",L$r=typeof TextEncoder=="function"?new TextEncoder:new All.default.TextEncoder,S4t=`\r
1305
1305
  `,d3b=L$r.encode(S4t),m3b=2,zHa=class{constructor(t,r){let{escapeName:n}=this.constructor,i=_r.isString(r),o=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${S4t}`;i?r=L$r.encode(String(r).replace(/\r?\n|\r\n?/g,S4t)):o+=`Content-Type: ${r.type||"application/octet-stream"}${S4t}`,this.headers=L$r.encode(o+S4t),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+m3b,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;_r.isTypedArray(t)?yield t:yield*Wzn(t),yield d3b}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},h3b=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:o=n+"-"+jv.generateString(i,f3b)}=r||{};if(!_r.isFormData(e))throw TypeError("FormData instance required");if(o.length<1||o.length>70)throw Error("boundary must be 10-70 characters long");let a=L$r.encode("--"+o+S4t),s=L$r.encode("--"+o+"--"+S4t),c=s.byteLength,l=Array.from(e.entries()).map(([p,d])=>{let m=new zHa(p,d);return c+=m.size,m});c+=a.byteLength*l.length,c=_r.toFiniteNumber(c);let u={"Content-Type":`multipart/form-data; boundary=${o}`};return Number.isFinite(c)&&(u["Content-Length"]=c),t&&t(u),_ll.Readable.from((async function*(){for(let p of l)yield a,yield*p.encode();yield s})())},vll=h3b;var Oll=We(require("stream"),1),QHa=class extends Oll.default.Transform{__transform(t,r,n){this.push(t),n()}_transform(t,r,n){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,r)}this.__transform(t,r,n)}},wll=QHa;var y3b=(e,t)=>_r.isAsyncFn(e)?function(...r){let n=r.pop();e.apply(this,r).then(i=>{try{t?n(null,...t(i)):n(null,i)}catch(o){n(o)}},n)}:e,Pll=y3b;function g3b(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,o=0,a;return t=t!==void 0?t:1e3,function(c){let l=Date.now(),u=n[o];a||(a=l),r[i]=c,n[i]=l;let p=o,d=0;for(;p!==i;)d+=r[p++],p=p%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),l-a<t)return;let m=u&&l-u;return m?Math.round(d*1e3/m):void 0}}var Ell=g3b;function b3b(e,t){let r=0,n=1e3/t,i,o,a=(l,u=Date.now())=>{r=u,i=null,o&&(clearTimeout(o),o=null),e(...l)};return[(...l)=>{let u=Date.now(),p=u-r;p>=n?a(l,u):(i=l,o||(o=setTimeout(()=>{o=null,a(i)},n-p)))},()=>i&&a(i)]}var Ill=b3b;var Cot=(e,t,r=3)=>{let n=0,i=Ell(50,250);return Ill(o=>{let a=o.loaded,s=o.lengthComputable?o.total:void 0,c=a-n,l=i(c),u=a<=s;n=a;let p={loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:l||void 0,estimated:l&&s&&u?(s-a)/l:void 0,event:o,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(p)},r)},mur=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},hur=e=>(...t)=>_r.asap(()=>e(...t));function qHa(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;let t=e.indexOf(",");if(t<0)return 0;let r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let o=n.length,a=n.length;for(let d=0;d<a;d++)if(n.charCodeAt(d)===37&&d+2<a){let m=n.charCodeAt(d+1),h=n.charCodeAt(d+2);(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102)&&(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102)&&(o-=2,d+=2)}let s=0,c=a-1,l=d=>d>=2&&n.charCodeAt(d-2)===37&&n.charCodeAt(d-1)===51&&(n.charCodeAt(d)===68||n.charCodeAt(d)===100);c>=0&&(n.charCodeAt(c)===61?(s++,c--):l(c)&&(s++,c-=3)),s===1&&c>=0&&(n.charCodeAt(c)===61||l(c))&&s++;let p=Math.floor(o/4)*3-(s||0);return p>0?p:0}return Buffer.byteLength(n,"utf8")}var xll={flush:Bot.default.constants.Z_SYNC_FLUSH,finishFlush:Bot.default.constants.Z_SYNC_FLUSH},A3b={flush:Bot.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Bot.default.constants.BROTLI_OPERATION_FLUSH},jll=_r.isFunction(Bot.default.createBrotliDecompress),{http:_3b,https:v3b}=Fll.default,O3b=/https:?/,Cll=jv.protocols.map(e=>e+":"),Sll=(e,[t,r])=>(e.on("end",r).on("error",r),t),VHa=class{constructor(){this.sessions=Object.create(null)}getSession(t,r){r=Object.assign({sessionTimeout:1e3},r);let n=this.sessions[t];if(n){let u=n.length;for(let p=0;p<u;p++){let[d,m]=n[p];if(!d.destroyed&&!d.closed&&UHa.default.isDeepStrictEqual(m,r))return d}}let i=kHa.default.connect(t,r),o,a=()=>{if(o)return;o=!0;let u=n,p=u.length,d=p;for(;d--;)if(u[d][0]===i){p===1?delete this.sessions[t]:u.splice(d,1);return}},s=i.request,{sessionTimeout:c}=r;if(c!=null){let u,p=0;i.request=function(){let d=s.apply(this,arguments);return p++,u&&(clearTimeout(u),u=null),d.once("close",()=>{--p||(u=setTimeout(()=>{u=null,a()},c))}),d}}i.once("close",a);let l=[i,r];return n?n.push(l):n=this.sessions[t]=[l],i}},w3b=new VHa;function P3b(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function Mll(e,t,r){let n=t;if(!n&&n!==!1){let i=Dll.default.getProxyForUrl(r);i&&(n=new URL(i))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){if(!!(n.auth.username||n.auth.password))n.auth=(n.auth.username||"")+":"+(n.auth.password||"");else if(typeof n.auth=="object")throw new ca("Invalid proxy authorization",ca.ERR_BAD_OPTION,{proxy:n});let a=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let i=n.hostname||n.host;e.hostname=i,e.host=i,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(o){Mll(o,t,o.href)}}var E3b=typeof process<"u"&&_r.kindOf(process)==="process",I3b=e=>new Promise((t,r)=>{let n,i,o=(c,l)=>{i||(i=!0,n&&n(c,l))},a=c=>{o(c),t(c)},s=c=>{o(c,!0),r(c)};e(a,s,c=>n=c).catch(s)}),x3b=({address:e,family:t})=>{if(!_r.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},Bll=(e,t)=>x3b(_r.isObject(e)?e:{address:e,family:t}),j3b={request(e,t){let r=e.protocol+"//"+e.hostname+":"+(e.port||(e.protocol==="https:"?443:80)),{http2Options:n,headers:i}=e,o=w3b.getSession(r,n),{HTTP2_HEADER_SCHEME:a,HTTP2_HEADER_METHOD:s,HTTP2_HEADER_PATH:c,HTTP2_HEADER_STATUS:l}=kHa.default.constants,u={[a]:e.protocol.replace(":",""),[s]:e.method,[c]:e.path};_r.forEach(i,(d,m)=>{m.charAt(0)!==":"&&(u[m]=d)});let p=o.request(u);return p.once("response",d=>{let m=p;d=Object.assign({},d);let h=d[l];delete d[l],m.headers=d,m.statusCode=+h,t(m)}),p}},zll=E3b&&function(t){return I3b(async function(n,i,o){let{data:a,lookup:s,family:c,httpVersion:l=1,http2Options:u}=t,{responseType:p,responseEncoding:d}=t,m=t.method.toUpperCase(),h,y=!1,g;if(l=+l,Number.isNaN(l))throw TypeError(`Invalid protocol version: '${t.httpVersion}' is not a number`);if(l!==1&&l!==2)throw TypeError(`Unsupported protocol version '${l}'`);let b=l===2;if(s){let X=Pll(s,Y=>_r.isArray(Y)?Y:[Y]);s=(Y,Be,Pe)=>{X(Y,Be,(ke,Ye,Oe)=>{if(ke)return Pe(ke);let he=_r.isArray(Ye)?Ye.map(pt=>Bll(pt)):[Bll(Ye,Oe)];Be.all?Pe(ke,he):Pe(ke,he[0].address,he[0].family)})}}let _=new Nll.EventEmitter;function O(X){try{_.emit("abort",!X||X.type?new VJ(null,t,g):X)}catch(Y){console.warn("emit error",Y)}}_.once("abort",i);let A=()=>{t.cancelToken&&t.cancelToken.unsubscribe(O),t.signal&&t.signal.removeEventListener("abort",O),_.removeAllListeners()};(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(O),t.signal&&(t.signal.aborted?O():t.signal.addEventListener("abort",O))),o((X,Y)=>{if(h=!0,Y){y=!0,A();return}let{data:Be}=X;if(Be instanceof Sot.default.Readable||Be instanceof Sot.default.Duplex){let Pe=Sot.default.finished(Be,()=>{Pe(),A()})}else A()});let v=I4t(t.baseURL,t.url,t.allowAbsoluteUrls),P=new URL(v,jv.hasBrowserEnv?jv.origin:void 0),I=P.protocol||Cll[0];if(I==="data:"){if(t.maxContentLength>-1){let Y=String(t.url||v||"");if(qHa(Y)>t.maxContentLength)return i(new ca("maxContentLength size of "+t.maxContentLength+" exceeded",ca.ERR_BAD_RESPONSE,t))}let X;if(m!=="GET")return MNe(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{X=RHa(t.url,p==="blob",{Blob:t.env&&t.env.Blob})}catch(Y){throw ca.from(Y,ca.ERR_BAD_REQUEST,t)}return p==="text"?(X=X.toString(d),(!d||d==="utf8")&&(X=_r.stripBOM(X))):p==="stream"&&(X=Sot.default.Readable.from(X)),MNe(n,i,{data:X,status:200,statusText:"OK",headers:new Sx,config:t})}if(Cll.indexOf(I)===-1)return i(new ca("Unsupported protocol "+I,ca.ERR_BAD_REQUEST,t));let E=Sx.from(t.headers).normalize();E.set("User-Agent","axios/"+C4t,!1);let{onUploadProgress:x,onDownloadProgress:T}=t,W=t.maxRate,H,G;if(_r.isSpecCompliantForm(a)){let X=E.getContentType(/boundary=([-_\w\d]{10,70})/i);a=vll(a,Y=>{E.set(Y)},{tag:`axios-${C4t}-boundary`,boundary:X&&X[1]||void 0})}else if(_r.isFormData(a)&&_r.isFunction(a.getHeaders)){if(E.set(a.getHeaders()),!E.hasContentLength())try{let X=await UHa.default.promisify(a.getLength).call(a);Number.isFinite(X)&&X>=0&&E.setContentLength(X)}catch{}}else if(_r.isBlob(a)||_r.isFile(a))a.size&&E.setContentType(a.type||"application/octet-stream"),E.setContentLength(a.size||0),a=Sot.default.Readable.from(Wzn(a));else if(a&&!_r.isStream(a)){if(!Buffer.isBuffer(a))if(_r.isArrayBuffer(a))a=Buffer.from(new Uint8Array(a));else if(_r.isString(a))a=Buffer.from(a,"utf-8");else return i(new ca("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",ca.ERR_BAD_REQUEST,t));if(E.setContentLength(a.length,!1),t.maxBodyLength>-1&&a.length>t.maxBodyLength)return i(new ca("Request body larger than maxBodyLength limit",ca.ERR_BAD_REQUEST,t))}let ie=_r.toFiniteNumber(E.getContentLength());_r.isArray(W)?(H=W[0],G=W[1]):H=G=W,a&&(x||H)&&(_r.isStream(a)||(a=Sot.default.Readable.from(a,{objectMode:!1})),a=Sot.default.pipeline([a,new MHa({maxRate:_r.toFiniteNumber(H)})],_r.noop),x&&a.on("progress",Sll(a,mur(ie,Cot(hur(x),!1,3)))));let oe;if(t.auth){let X=t.auth.username||"",Y=t.auth.password||"";oe=X+":"+Y}if(!oe&&P.username){let X=P.username,Y=P.password;oe=X+":"+Y}oe&&E.delete("authorization");let $;try{$=E4t(P.pathname+P.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(X){let Y=new Error(X.message);return Y.config=t,Y.url=t.url,Y.exists=!0,i(Y)}E.set("Accept-Encoding","gzip, compress, deflate"+(jll?", br":""),!1);let te={path:$,method:m,headers:E.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:oe,protocol:I,family:c,beforeRedirect:P3b,beforeRedirects:{},http2Options:u};!_r.isUndefined(s)&&(te.lookup=s),t.socketPath?te.socketPath=t.socketPath:(te.hostname=P.hostname.startsWith("[")?P.hostname.slice(1,-1):P.hostname,te.port=P.port,Mll(te,t.proxy,I+"//"+P.hostname+(P.port?":"+P.port:"")+te.path));let Ge,Ke=O3b.test(te.protocol);if(te.agent=Ke?t.httpsAgent:t.httpAgent,b?Ge=j3b:t.transport?Ge=t.transport:t.maxRedirects===0?Ge=Ke?Rll.default:Tll.default:(t.maxRedirects&&(te.maxRedirects=t.maxRedirects),t.beforeRedirect&&(te.beforeRedirects.config=t.beforeRedirect),Ge=Ke?v3b:_3b),t.maxBodyLength>-1?te.maxBodyLength=t.maxBodyLength:te.maxBodyLength=1/0,t.insecureHTTPParser&&(te.insecureHTTPParser=t.insecureHTTPParser),g=Ge.request(te,function(Y){if(g.destroyed)return;let Be=[Y],Pe=_r.toFiniteNumber(Y.headers["content-length"]);if(T||G){let he=new MHa({maxRate:_r.toFiniteNumber(G)});T&&he.on("progress",Sll(he,mur(Pe,Cot(hur(T),!0,3)))),Be.push(he)}let ke=Y,Ye=Y.req||g;if(t.decompress!==!1&&Y.headers["content-encoding"])switch((m==="HEAD"||Y.statusCode===204)&&delete Y.headers["content-encoding"],(Y.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":Be.push(Bot.default.createUnzip(xll)),delete Y.headers["content-encoding"];break;case"deflate":Be.push(new wll),Be.push(Bot.default.createUnzip(xll)),delete Y.headers["content-encoding"];break;case"br":jll&&(Be.push(Bot.default.createBrotliDecompress(A3b)),delete Y.headers["content-encoding"])}ke=Be.length>1?Sot.default.pipeline(Be,_r.noop):Be[0];let Oe={status:Y.statusCode,statusText:Y.statusMessage,headers:new Sx(Y.headers),config:t,request:Ye};if(p==="stream")Oe.data=ke,MNe(n,i,Oe);else{let he=[],pt=0;ke.on("data",function(br){he.push(br),pt+=br.length,t.maxContentLength>-1&&pt>t.maxContentLength&&(y=!0,ke.destroy(),O(new ca("maxContentLength size of "+t.maxContentLength+" exceeded",ca.ERR_BAD_RESPONSE,t,Ye)))}),ke.on("aborted",function(){if(y)return;let br=new ca("stream has been aborted",ca.ERR_BAD_RESPONSE,t,Ye);ke.destroy(br),i(br)}),ke.on("error",function(br){g.destroyed||i(ca.from(br,null,t,Ye))}),ke.on("end",function(){try{let br=he.length===1?he[0]:Buffer.concat(he);p!=="arraybuffer"&&(br=br.toString(d),(!d||d==="utf8")&&(br=_r.stripBOM(br))),Oe.data=br}catch(br){return i(ca.from(br,null,t,Oe.request,Oe))}MNe(n,i,Oe)})}_.once("abort",he=>{ke.destroyed||(ke.emit("error",he),ke.destroy())})}),_.once("abort",X=>{g.close?g.close():g.destroy(X)}),g.on("error",function(Y){i(ca.from(Y,null,t,g))}),g.on("socket",function(Y){Y.setKeepAlive(!0,1e3*60)}),t.timeout){let X=parseInt(t.timeout,10);if(Number.isNaN(X)){O(new ca("error trying to parse `config.timeout` to int",ca.ERR_BAD_OPTION_VALUE,t,g));return}g.setTimeout(X,function(){if(h)return;let Be=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Pe=t.transitional||lur;t.timeoutErrorMessage&&(Be=t.timeoutErrorMessage),O(new ca(Be,Pe.clarifyTimeoutError?ca.ETIMEDOUT:ca.ECONNABORTED,t,g))})}else g.setTimeout(0);if(_r.isStream(a)){let X=!1,Y=!1;a.on("end",()=>{X=!0}),a.once("error",Be=>{Y=!0,g.destroy(Be)}),a.on("close",()=>{!X&&!Y&&O(new VJ("Request stream has been aborted",t,g))}),a.pipe(g)}else a&&g.write(a),g.end()})};var Qll=jv.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,jv.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(jv.origin),jv.navigator&&/(msie|trident)/i.test(jv.navigator.userAgent)):()=>!0;var qll=jv.hasStandardBrowserEnv?{write(e,t,r,n,i,o,a){if(typeof document>"u")return;let s=[`${e}=${encodeURIComponent(t)}`];_r.isNumber(r)&&s.push(`expires=${new Date(r).toUTCString()}`),_r.isString(n)&&s.push(`path=${n}`),_r.isString(i)&&s.push(`domain=${i}`),o===!0&&s.push("secure"),_r.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if(typeof document>"u")return null;let t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};var Vll=e=>e instanceof Sx?{...e}:e;function mxe(e,t){t=t||{};let r={};function n(l,u,p,d){return _r.isPlainObject(l)&&_r.isPlainObject(u)?_r.merge.call({caseless:d},l,u):_r.isPlainObject(u)?_r.merge({},u):_r.isArray(u)?u.slice():u}function i(l,u,p,d){if(_r.isUndefined(u)){if(!_r.isUndefined(l))return n(void 0,l,p,d)}else return n(l,u,p,d)}function o(l,u){if(!_r.isUndefined(u))return n(void 0,u)}function a(l,u){if(_r.isUndefined(u)){if(!_r.isUndefined(l))return n(void 0,l)}else return n(void 0,u)}function s(l,u,p){if(p in t)return n(l,u);if(p in e)return n(void 0,l)}let c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(l,u,p)=>i(Vll(l),Vll(u),p,!0)};return _r.forEach(Object.keys({...e,...t}),function(u){let p=c[u]||i,d=p(e[u],t[u],u);_r.isUndefined(d)&&p!==s||(r[u]=d)}),r}var Gzn=e=>{let t=mxe({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:a,auth:s}=t;if(t.headers=a=Sx.from(a),t.url=E4t(I4t(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),_r.isFormData(r)){if(jv.hasStandardBrowserEnv||jv.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(_r.isFunction(r.getHeaders)){let c=r.getHeaders(),l=["content-type","content-length"];Object.entries(c).forEach(([u,p])=>{l.includes(u.toLowerCase())&&a.set(u,p)})}}if(jv.hasStandardBrowserEnv&&(n&&_r.isFunction(n)&&(n=n(t)),n||n!==!1&&Qll(t.url))){let c=i&&o&&qll.read(o);c&&a.set(i,c)}return t};var C3b=typeof XMLHttpRequest<"u",kll=C3b&&function(e){return new Promise(function(r,n){let i=Gzn(e),o=i.data,a=Sx.from(i.headers).normalize(),{responseType:s,onUploadProgress:c,onDownloadProgress:l}=i,u,p,d,m,h;function y(){m&&m(),h&&h(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let g=new XMLHttpRequest;g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout;function b(){if(!g)return;let O=Sx.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),v={data:!s||s==="text"||s==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:O,config:e,request:g};MNe(function(I){r(I),y()},function(I){n(I),y()},v),g=null}"onloadend"in g?g.onloadend=b:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(b)},g.onabort=function(){g&&(n(new ca("Request aborted",ca.ECONNABORTED,e,g)),g=null)},g.onerror=function(A){let v=A&&A.message?A.message:"Network Error",P=new ca(v,ca.ERR_NETWORK,e,g);P.event=A||null,n(P),g=null},g.ontimeout=function(){let A=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",v=i.transitional||lur;i.timeoutErrorMessage&&(A=i.timeoutErrorMessage),n(new ca(A,v.clarifyTimeoutError?ca.ETIMEDOUT:ca.ECONNABORTED,e,g)),g=null},o===void 0&&a.setContentType(null),"setRequestHeader"in g&&_r.forEach(a.toJSON(),function(A,v){g.setRequestHeader(v,A)}),_r.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),s&&s!=="json"&&(g.responseType=i.responseType),l&&([d,h]=Cot(l,!0),g.addEventListener("progress",d)),c&&g.upload&&([p,m]=Cot(c),g.upload.addEventListener("progress",p),g.upload.addEventListener("loadend",m)),(i.cancelToken||i.signal)&&(u=O=>{g&&(n(!O||O.type?new VJ(null,e,g):O),g.abort(),g=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));let _=U$r(i.url);if(_&&jv.protocols.indexOf(_)===-1){n(new ca("Unsupported protocol "+_+":",ca.ERR_BAD_REQUEST,e));return}g.send(o||null)})};var S3b=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,o=function(l){if(!i){i=!0,s();let u=l instanceof Error?l:this.reason;n.abort(u instanceof ca?u:new VJ(u instanceof Error?u.message:u))}},a=t&&setTimeout(()=>{a=null,o(new ca(`timeout of ${t}ms exceeded`,ca.ETIMEDOUT))},t),s=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(o):l.removeEventListener("abort",o)}),e=null)};e.forEach(l=>l.addEventListener("abort",o));let{signal:c}=n;return c.unsubscribe=()=>_r.asap(s),c}},Ull=S3b;var B3b=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},D3b=async function*(e,t){for await(let r of T3b(e))yield*B3b(r,t)},T3b=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},LHa=(e,t,r,n)=>{let i=D3b(e,t),o=0,a,s=c=>{a||(a=!0,n&&n(c))};return new ReadableStream({async pull(c){try{let{done:l,value:u}=await i.next();if(l){s(),c.close();return}let p=u.byteLength;if(r){let d=o+=p;r(d)}c.enqueue(new Uint8Array(u))}catch(l){throw s(l),l}},cancel(c){return s(c),i.return()}},{highWaterMark:2})};var Lll=64*1024,{isFunction:Hzn}=_r,R3b=(({Request:e,Response:t})=>({Request:e,Response:t}))(_r.global),{ReadableStream:Wll,TextEncoder:Gll}=_r.global,Hll=(e,...t)=>{try{return!!e(...t)}catch{return!1}},F3b=e=>{e=_r.merge.call({skipUndefined:!0},R3b,e);let{fetch:t,Request:r,Response:n}=e,i=t?Hzn(t):typeof fetch=="function",o=Hzn(r),a=Hzn(n);if(!i)return!1;let s=i&&Hzn(Wll),c=i&&(typeof Gll=="function"?(h=>y=>h.encode(y))(new Gll):async h=>new Uint8Array(await new r(h).arrayBuffer())),l=o&&s&&Hll(()=>{let h=!1,y=new r(jv.origin,{body:new Wll,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!y}),u=a&&s&&Hll(()=>_r.isReadableStream(new n("").body)),p={stream:u&&(h=>h.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!p[h]&&(p[h]=(y,g)=>{let b=y&&y[h];if(b)return b.call(y);throw new ca(`Response type '${h}' is not supported`,ca.ERR_NOT_SUPPORT,g)})});let d=async h=>{if(h==null)return 0;if(_r.isBlob(h))return h.size;if(_r.isSpecCompliantForm(h))return(await new r(jv.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(_r.isArrayBufferView(h)||_r.isArrayBuffer(h))return h.byteLength;if(_r.isURLSearchParams(h)&&(h=h+""),_r.isString(h))return(await c(h)).byteLength},m=async(h,y)=>{let g=_r.toFiniteNumber(h.getContentLength());return g??d(y)};return async h=>{let{url:y,method:g,data:b,signal:_,cancelToken:O,timeout:A,onDownloadProgress:v,onUploadProgress:P,responseType:I,headers:E,withCredentials:x="same-origin",fetchOptions:T}=Gzn(h),W=t||fetch;I=I?(I+"").toLowerCase():"text";let H=Ull([_,O&&O.toAbortSignal()],A),G=null,ie=H&&H.unsubscribe&&(()=>{H.unsubscribe()}),oe;try{if(P&&l&&g!=="get"&&g!=="head"&&(oe=await m(E,b))!==0){let Y=new r(y,{method:"POST",body:b,duplex:"half"}),Be;if(_r.isFormData(b)&&(Be=Y.headers.get("content-type"))&&E.setContentType(Be),Y.body){let[Pe,ke]=mur(oe,Cot(hur(P)));b=LHa(Y.body,Lll,Pe,ke)}}_r.isString(x)||(x=x?"include":"omit");let $=o&&"credentials"in r.prototype,te={...T,signal:H,method:g.toUpperCase(),headers:E.normalize().toJSON(),body:b,duplex:"half",credentials:$?x:void 0};G=o&&new r(y,te);let Ge=await(o?W(G,T):W(y,te)),Ke=u&&(I==="stream"||I==="response");if(u&&(v||Ke&&ie)){let Y={};["status","statusText","headers"].forEach(Ye=>{Y[Ye]=Ge[Ye]});let Be=_r.toFiniteNumber(Ge.headers.get("content-length")),[Pe,ke]=v&&mur(Be,Cot(hur(v),!0))||[];Ge=new n(LHa(Ge.body,Lll,Pe,()=>{ke&&ke(),ie&&ie()}),Y)}I=I||"text";let X=await p[_r.findKey(p,I)||"text"](Ge,h);return!Ke&&ie&&ie(),await new Promise((Y,Be)=>{MNe(Y,Be,{data:X,headers:Sx.from(Ge.headers),status:Ge.status,statusText:Ge.statusText,config:h,request:G})})}catch($){throw ie&&ie(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new ca("Network Error",ca.ERR_NETWORK,h,G),{cause:$.cause||$}):ca.from($,$&&$.code,h,G)}}},N3b=new Map,WHa=e=>{let t=e&&e.env||{},{fetch:r,Request:n,Response:i}=t,o=[n,i,r],a=o.length,s=a,c,l,u=N3b;for(;s--;)c=o[s],l=u.get(c),l===void 0&&u.set(c,l=s?new Map:F3b(t)),u=l;return l},j0C=WHa();var GHa={http:zll,xhr:kll,fetch:{get:WHa}};_r.forEach(GHa,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var $ll=e=>`- ${e}`,z3b=e=>_r.isFunction(e)||e===null||e===!1;function Q3b(e,t){e=_r.isArray(e)?e:[e];let{length:r}=e,n,i,o={};for(let a=0;a<r;a++){n=e[a];let s;if(i=n,!z3b(n)&&(i=GHa[(s=String(n)).toLowerCase()],i===void 0))throw new ca(`Unknown adapter '${s}'`);if(i&&(_r.isFunction(i)||(i=i.get(t))))break;o[s||"#"+a]=i}if(!i){let a=Object.entries(o).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build")),s=r?a.length>1?`since :
@@ -1524,7 +1524,7 @@ ${r}`);return i!=null?i(a):a},Cvl(n))}var Jts=class{async handle(t,r){let n=r["d
1524
1524
  `));throw Object.assign(a,{event:t}),r.forEach(s=>iIl(s,a)),a})}function uIl(e,t,r){if(Array.isArray(t)){t.forEach(n=>uIl(e,n,r));return}if(e.hooks[t]){for(let n=e.hooks[t].length-1;n>=0;n--)if(e.hooks[t][n]===r){e.hooks[t].splice(n,1);return}}}function NrA(e){let t={hooks:{},log:aIl(e&&e.log)};return e&&e.transform&&(t.transform=e.transform),{on:sIl.bind(null,t),onAny:DrA.bind(null,t),onError:TrA.bind(null,t),removeListener:uIl.bind(null,t),receive:FrA.bind(null,t)}}async function MrA(e,t){if(!await nIl(e.secret,t.payload,t.signature,e.additionalSecrets).catch(()=>!1)){let i=new Error("[@octokit/webhooks] signature does not match event payload and secret");return i.event=t,i.status=400,e.eventHandler.receive(i)}let n;try{n=JSON.parse(t.payload)}catch(i){throw i.message="Invalid JSON",i.status=400,new AggregateError([i],i.message)}return e.eventHandler.receive({id:t.id,name:t.name,payload:n})}var oIl=new TextDecoder("utf-8",{fatal:!1}),RvS=oIl.decode.bind(oIl);var cIl=class{sign;verify;on;onAny;onError;removeListener;receive;verifyAndReceive;constructor(e){if(!e||!e.secret)throw new Error("[@octokit/webhooks] options.secret required");let t={eventHandler:NrA(e),secret:e.secret,additionalSecrets:e.additionalSecrets,hooks:{},log:aIl(e.log)};this.sign=PWn.bind(null,e.secret),this.verify=hYr.bind(null,e.secret),this.on=t.eventHandler.on,this.onAny=t.eventHandler.onAny,this.onError=t.eventHandler.onError,this.removeListener=t.eventHandler.removeListener,this.receive=t.eventHandler.receive,this.verifyAndReceive=MrA.bind(null,t)}};var zrA="16.1.2";function QrA(e,t){return new cIl({secret:t.secret,transform:async r=>{if(!("installation"in r.payload)||typeof r.payload.installation!="object"){let o=new e.constructor({authStrategy:P2t,auth:{reason:'"installation" key missing in webhook event payload'}});return{...r,octokit:o}}let n=r.payload.installation.id,i=await e.auth({type:"installation",installationId:n,factory(o){return new o.octokit.constructor({...o.octokitOptions,authStrategy:tpr,auth:{...o,installationId:n}})}});return i.hook.before("request",o=>{o.headers["x-github-delivery"]=r.id}),{...r,octokit:i}}})}async function lIl(e,t){return e.octokit.auth({type:"installation",installationId:t,factory(r){let n={...r.octokitOptions,authStrategy:tpr,auth:{...r,installationId:t}};return new r.octokit.constructor(n)}})}function qrA(e){return Object.assign(VrA.bind(null,e),{iterator:pIl.bind(null,e)})}async function VrA(e,t){let r=pIl(e)[Symbol.asyncIterator](),n=await r.next();for(;!n.done;)await t(n.value),n=await r.next()}function pIl(e){return{async*[Symbol.asyncIterator](){let t=fWn.iterator(e.octokit,"GET /app/installations");for await(let{data:r}of t)for(let n of r)yield{octokit:await lIl(e,n.id),installation:n}}}}function krA(e){return Object.assign(UrA.bind(null,e),{iterator:fIl.bind(null,e)})}async function UrA(e,t,r){let n=fIl(e,r?t:void 0)[Symbol.asyncIterator](),i=await n.next();for(;!i.done;)r?await r(i.value):await t(i.value),i=await n.next()}function LrA(e,t){return{async*[Symbol.asyncIterator](){yield{octokit:await e.getInstallationOctokit(t)}}}}function fIl(e,t){return{async*[Symbol.asyncIterator](){let r=t?LrA(e,t.installationId):e.eachInstallation.iterator();for await(let{octokit:n}of r){let i=fWn.iterator(n,"GET /installation/repositories");for await(let{data:o}of i)for(let a of o)yield{octokit:n,repository:a}}}}}function WrA(e){let t;return async function(n={}){t||(t=GrA(e));let i=await t,o=new URL(i);return n.target_id!==void 0&&(o.pathname+="/permissions",o.searchParams.append("target_id",n.target_id.toFixed())),n.state!==void 0&&o.searchParams.append("state",n.state),o.href}}async function GrA(e){let{data:t}=await e.octokit.request("GET /app");if(!t)throw new Error("[@octokit/app] unable to fetch metadata for app");return`${t.html_url}/installations/new`}var dIl=class{static VERSION=zrA;static defaults(e){return class extends this{constructor(...r){super({...e,...r[0]})}}}octokit;webhooks;oauth;getInstallationOctokit;eachInstallation;eachRepository;getInstallationUrl;log;constructor(e){let t=e.Octokit||Zyt,r=Object.assign({appId:e.appId,privateKey:e.privateKey},e.oauth?{clientId:e.oauth.clientId,clientSecret:e.oauth.clientSecret}:{}),n={authStrategy:tpr,auth:r};"log"in e&&typeof e.log<"u"&&(n.log=e.log),this.octokit=new t(n),this.log=Object.assign({debug:()=>{},info:()=>{},warn:console.warn.bind(console),error:console.error.bind(console)},e.log),e.webhooks?this.webhooks=QrA(this.octokit,e.webhooks):Object.defineProperty(this,"webhooks",{get(){throw new Error("[@octokit/app] webhooks option not set")}}),e.oauth?this.oauth=new wWn({...e.oauth,clientType:"github-app",Octokit:t}):Object.defineProperty(this,"oauth",{get(){throw new Error("[@octokit/app] oauth.clientId / oauth.clientSecret options are not set")}}),this.getInstallationOctokit=lIl.bind(null,this),this.eachInstallation=qrA(this),this.eachRepository=krA(this),this.getInstallationUrl=WrA(this)}};var HrA="0.0.0-development",EWn=Zyt.plugin(xis,wis,AEl,Bis,dWn).defaults({userAgent:`octokit.js/${HrA}`,throttle:{onRateLimit:$rA,onSecondaryRateLimit:JrA}});function $rA(e,t,r){if(r.log.warn(`Request quota exhausted for request ${t.method} ${t.url}`),t.request.retryCount===0)return r.log.info(`Retrying after ${e} seconds!`),!0}function JrA(e,t,r){if(r.log.warn(`SecondaryRateLimit detected for request ${t.method} ${t.url}`),t.request.retryCount===0)return r.log.info(`Retrying after ${e} seconds!`),!0}var nOS=dIl.defaults({Octokit:EWn}),iOS=wWn.defaults({Octokit:EWn});var mIl=We(K3(),1);async function Vis({packageName:e,generatorInvocation:t}){if(t.language==null||e==null)return;let r=await KrA({packageName:e,language:t.language,githubRepository:tnA(t)});return r==null?void 0:mIl.default.inc(r,"patch")??void 0}async function KrA({packageName:e,language:t,githubRepository:r}){let n;switch(t){case"typescript":n=await YrA(e);break;case"python":n=await XrA(e);break;case"csharp":case"go":case"java":case"ruby":case"php":case"swift":break}return n!=null||r!=null&&(n=await ZrA(r)),n}async function YrA(e){try{return await sYr(e)}catch{return}}async function XrA(e){try{let t=await fetch(`https://pypi.org/pypi/${e}/json`);return t.ok?(await t.json()).info.version:void 0}catch{return}}async function ZrA(e){try{let{owner:t,repo:r}=enA(e);return(await new EWn().rest.repos.listTags({owner:t,repo:r,per_page:1})).data?.[0]?.name}catch{return}}function enA(e){let[t,r]=e.split("/");if(t==null||r==null)throw new Error(`Invalid github repository: ${e}`);return{owner:t,repo:r}}function tnA(e){if(e.outputMode.type==="githubV2")return`${e.outputMode.githubV2.owner}/${e.outputMode.githubV2.repo}`}var I5=class extends xxe{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(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var dP="fern",sI="definition",yYr="openapi",hIl="changelog",kis="asyncapi",Qj="api.yml",E2t="__package__",Ky=`${E2t}.yml`,IWn="dependencies.yml",uI="generators.yml",rpr="generators.yaml",yIl="dependencies.yml",Ww="docs.yml",qj="fern.config.json",Uis="api",uMe=".fernignore",gIl="snippet.json",bIl="snippet-templates.json";var npr="default-group",AIl="spec-origin",_Il="async-api",vIl="openapi",OIl="openapi-overrides",wIl="api-settings";var SU="apis",gYr="local";var Gt={};Q(Gt,{BRAND:()=>xnA,DIRTY:()=>I2t,EMPTY_PATH:()=>onA,INVALID:()=>ql,NEVER:()=>piA,OK:()=>YQ,ParseStatus:()=>tz,Schema:()=>Gh,ZodAny:()=>rgt,ZodArray:()=>Zot,ZodBigInt:()=>j2t,ZodBoolean:()=>C2t,ZodBranded:()=>AYr,ZodCatch:()=>q2t,ZodDate:()=>S2t,ZodDefault:()=>Q2t,ZodDiscriminatedUnion:()=>CWn,ZodEffects:()=>Jte,ZodEnum:()=>M2t,ZodError:()=>x5,ZodFirstPartyTypeKind:()=>kp,ZodFunction:()=>BWn,ZodIntersection:()=>R2t,ZodIssueCode:()=>ui,ZodLazy:()=>F2t,ZodLiteral:()=>N2t,ZodMap:()=>cpr,ZodNaN:()=>ppr,ZodNativeEnum:()=>z2t,ZodNever:()=>Cxe,ZodNull:()=>D2t,ZodNullable:()=>pMe,ZodNumber:()=>x2t,ZodObject:()=>j5,ZodOptional:()=>Hte,ZodParsedType:()=>ls,ZodPipeline:()=>_Yr,ZodPromise:()=>ngt,ZodReadonly:()=>V2t,ZodRecord:()=>SWn,ZodSchema:()=>Gh,ZodSet:()=>lpr,ZodString:()=>tgt,ZodSymbol:()=>spr,ZodTransformer:()=>Jte,ZodTuple:()=>lMe,ZodType:()=>Gh,ZodUndefined:()=>B2t,ZodUnion:()=>T2t,ZodUnknown:()=>Xot,ZodVoid:()=>upr,addIssueToContext:()=>ba,any:()=>NnA,array:()=>qnA,bigint:()=>BnA,boolean:()=>RIl,coerce:()=>liA,custom:()=>BIl,date:()=>DnA,datetimeRegex:()=>CIl,defaultErrorMap:()=>Kot,discriminatedUnion:()=>LnA,effect:()=>riA,enum:()=>ZnA,function:()=>KnA,getErrorMap:()=>ipr,getParsedType:()=>cMe,instanceof:()=>CnA,intersection:()=>WnA,isAborted:()=>xWn,isAsync:()=>opr,isDirty:()=>jWn,isValid:()=>egt,late:()=>jnA,lazy:()=>YnA,literal:()=>XnA,makeIssue:()=>bYr,map:()=>$nA,nan:()=>SnA,nativeEnum:()=>eiA,never:()=>znA,null:()=>FnA,nullable:()=>iiA,number:()=>TIl,object:()=>VnA,objectUtil:()=>Lis,oboolean:()=>ciA,onumber:()=>uiA,optional:()=>niA,ostring:()=>siA,pipeline:()=>aiA,preprocess:()=>oiA,promise:()=>tiA,quotelessJson:()=>rnA,record:()=>HnA,set:()=>JnA,setErrorMap:()=>inA,strictObject:()=>knA,string:()=>DIl,symbol:()=>TnA,transformer:()=>riA,tuple:()=>GnA,undefined:()=>RnA,union:()=>UnA,unknown:()=>MnA,util:()=>Fg,void:()=>QnA});var Fg;(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 a of i)o[a]=a;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(let s of o)a[s]=i[s];return e.objectValues(a)},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 a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(let a of i)if(o(a))return a},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(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Fg||(Fg={}));var Lis;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Lis||(Lis={}));var ls=Fg.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),cMe=e=>{switch(typeof e){case"undefined":return ls.undefined;case"string":return ls.string;case"number":return Number.isNaN(e)?ls.nan:ls.number;case"boolean":return ls.boolean;case"function":return ls.function;case"bigint":return ls.bigint;case"symbol":return ls.symbol;case"object":return Array.isArray(e)?ls.array:e===null?ls.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ls.promise:typeof Map<"u"&&e instanceof Map?ls.map:typeof Set<"u"&&e instanceof Set?ls.set:typeof Date<"u"&&e instanceof Date?ls.date:ls.object;default:return ls.unknown}};var ui=Fg.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"]),rnA=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),x5=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 a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let l=a.path[c];c===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],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,Fg.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()}};x5.create=e=>new x5(e);var nnA=(e,t)=>{let r;switch(e.code){case ui.invalid_type:e.received===ls.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case ui.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Fg.jsonStringifyReplacer)}`;break;case ui.unrecognized_keys:r=`Unrecognized key(s) in object: ${Fg.joinValues(e.keys,", ")}`;break;case ui.invalid_union:r="Invalid input";break;case ui.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Fg.joinValues(e.options)}`;break;case ui.invalid_enum_value:r=`Invalid enum value. Expected ${Fg.joinValues(e.options)}, received '${e.received}'`;break;case ui.invalid_arguments:r="Invalid function arguments";break;case ui.invalid_return_type:r="Invalid function return type";break;case ui.invalid_date:r="Invalid date";break;case ui.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}"`:Fg.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case ui.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 ui.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 ui.custom:r="Invalid input";break;case ui.invalid_intersection_types:r="Intersection results could not be merged";break;case ui.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case ui.not_finite:r="Number must be finite";break;default:r=t.defaultError,Fg.assertNever(e)}return{message:r}},Kot=nnA;var PIl=Kot;function inA(e){PIl=e}function ipr(){return PIl}var bYr=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],a={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let s="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)s=l(a,{data:t,defaultError:s}).message;return{...i,path:o,message:s}},onA=[];function ba(e,t){let r=ipr(),n=bYr({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Kot?void 0:Kot].filter(i=>!!i)});e.common.issues.push(n)}var tz=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 ql;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,a=await i.value;n.push({key:o,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return ql;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[o.value]=a.value)}return{status:t.value,value:n}}},ql=Object.freeze({status:"aborted"}),I2t=e=>({status:"dirty",value:e}),YQ=e=>({status:"valid",value:e}),xWn=e=>e.status==="aborted",jWn=e=>e.status==="dirty",egt=e=>e.status==="valid",opr=e=>typeof Promise<"u"&&e instanceof Promise;var mc;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(mc||(mc={}));var $te=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}},EIl=(e,t)=>{if(egt(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 x5(e.common.issues);return this._error=r,this._error}}};function Hm(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:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var Gh=class{get description(){return this._def.description}_getType(t){return cMe(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:cMe(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new tz,ctx:{common:t.parent.common,data:t.data,parsedType:cMe(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(opr(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:cMe(t)},i=this._parseSync({data:t,path:n.path,parent:n});return EIl(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:cMe(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return egt(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=>egt(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:cMe(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(opr(i)?i:Promise.resolve(i));return EIl(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 a=t(i),s=()=>o.addIssue({code:ui.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!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 Jte({schema:this,typeName:kp.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 Hte.create(this,this._def)}nullable(){return pMe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zot.create(this)}promise(){return ngt.create(this,this._def)}or(t){return T2t.create([this,t],this._def)}and(t){return R2t.create(this,t,this._def)}transform(t){return new Jte({...Hm(this._def),schema:this,typeName:kp.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Q2t({...Hm(this._def),innerType:this,defaultValue:r,typeName:kp.ZodDefault})}brand(){return new AYr({typeName:kp.ZodBranded,type:this,...Hm(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new q2t({...Hm(this._def),innerType:this,catchValue:r,typeName:kp.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return _Yr.create(this,t)}readonly(){return V2t.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},anA=/^c[^\s-]{8,}$/i,snA=/^[0-9a-z]+$/,unA=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cnA=/^[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,lnA=/^[a-z0-9_-]{21}$/i,pnA=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fnA=/^[-+]?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)?)??$/,dnA=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mnA="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Wis,hnA=/^(?:(?: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])$/,ynA=/^(?:(?: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])$/,gnA=/^(([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]))$/,bnA=/^(([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])$/,AnA=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_nA=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xIl="((\\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])))",vnA=new RegExp(`^${xIl}$`);function jIl(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 OnA(e){return new RegExp(`^${jIl(e)}$`)}function CIl(e){let t=`${xIl}T${jIl(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 wnA(e,t){return!!((t==="v4"||!t)&&hnA.test(e)||(t==="v6"||!t)&&gnA.test(e))}function PnA(e,t){if(!pnA.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 EnA(e,t){return!!((t==="v4"||!t)&&ynA.test(e)||(t==="v6"||!t)&&bnA.test(e))}var tgt=class e extends Gh{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ls.string){let o=this._getOrReturnCtx(t);return ba(o,{code:ui.invalid_type,expected:ls.string,received:o.parsedType}),ql}let n=new tz,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),ba(i,{code:ui.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),ba(i,{code:ui.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let a=t.data.length>o.value,s=t.data.length<o.value;(a||s)&&(i=this._getOrReturnCtx(t,i),a?ba(i,{code:ui.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&ba(i,{code:ui.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")dnA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"email",code:ui.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Wis||(Wis=new RegExp(mnA,"u")),Wis.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"emoji",code:ui.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")cnA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"uuid",code:ui.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")lnA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"nanoid",code:ui.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")anA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"cuid",code:ui.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")snA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"cuid2",code:ui.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")unA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"ulid",code:ui.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),ba(i,{validation:"url",code:ui.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),ba(i,{validation:"regex",code:ui.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),ba(i,{code:ui.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),ba(i,{code:ui.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),ba(i,{code:ui.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?CIl(o).test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{code:ui.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?vnA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{code:ui.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?OnA(o).test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{code:ui.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?fnA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"duration",code:ui.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?wnA(t.data,o.version)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"ip",code:ui.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?PnA(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"jwt",code:ui.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?EnA(t.data,o.version)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"cidr",code:ui.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?AnA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"base64",code:ui.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?_nA.test(t.data)||(i=this._getOrReturnCtx(t,i),ba(i,{validation:"base64url",code:ui.invalid_string,message:o.message}),n.dirty()):Fg.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:ui.invalid_string,...mc.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...mc.errToObj(t)})}url(t){return this._addCheck({kind:"url",...mc.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...mc.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...mc.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...mc.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...mc.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...mc.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...mc.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...mc.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...mc.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...mc.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...mc.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...mc.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,...mc.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,...mc.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...mc.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...mc.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...mc.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...mc.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...mc.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...mc.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...mc.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...mc.errToObj(r)})}nonempty(t){return this.min(1,mc.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}};tgt.create=e=>new tgt({checks:[],typeName:kp.ZodString,coerce:e?.coerce??!1,...Hm(e)});function InA(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(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return o%a/10**i}var x2t=class e extends Gh{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)!==ls.number){let o=this._getOrReturnCtx(t);return ba(o,{code:ui.invalid_type,expected:ls.number,received:o.parsedType}),ql}let n,i=new tz;for(let o of this._def.checks)o.kind==="int"?Fg.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),ba(n,{code:ui.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),ba(n,{code:ui.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),ba(n,{code:ui.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?InA(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),ba(n,{code:ui.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),ba(n,{code:ui.not_finite,message:o.message}),i.dirty()):Fg.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,mc.toString(r))}gt(t,r){return this.setLimit("min",t,!1,mc.toString(r))}lte(t,r){return this.setLimit("max",t,!0,mc.toString(r))}lt(t,r){return this.setLimit("max",t,!1,mc.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:mc.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:mc.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:mc.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:mc.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:mc.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:mc.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:mc.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:mc.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:mc.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:mc.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"&&Fg.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)}};x2t.create=e=>new x2t({checks:[],typeName:kp.ZodNumber,coerce:e?.coerce||!1,...Hm(e)});var j2t=class e extends Gh{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)!==ls.bigint)return this._getInvalidInput(t);let n,i=new tz;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),ba(n,{code:ui.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),ba(n,{code:ui.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),ba(n,{code:ui.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Fg.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return ba(r,{code:ui.invalid_type,expected:ls.bigint,received:r.parsedType}),ql}gte(t,r){return this.setLimit("min",t,!0,mc.toString(r))}gt(t,r){return this.setLimit("min",t,!1,mc.toString(r))}lte(t,r){return this.setLimit("max",t,!0,mc.toString(r))}lt(t,r){return this.setLimit("max",t,!1,mc.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:mc.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:mc.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:mc.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:mc.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:mc.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:mc.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}};j2t.create=e=>new j2t({checks:[],typeName:kp.ZodBigInt,coerce:e?.coerce??!1,...Hm(e)});var C2t=class extends Gh{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ls.boolean){let n=this._getOrReturnCtx(t);return ba(n,{code:ui.invalid_type,expected:ls.boolean,received:n.parsedType}),ql}return YQ(t.data)}};C2t.create=e=>new C2t({typeName:kp.ZodBoolean,coerce:e?.coerce||!1,...Hm(e)});var S2t=class e extends Gh{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ls.date){let o=this._getOrReturnCtx(t);return ba(o,{code:ui.invalid_type,expected:ls.date,received:o.parsedType}),ql}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return ba(o,{code:ui.invalid_date}),ql}let n=new tz,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),ba(i,{code:ui.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),ba(i,{code:ui.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Fg.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:mc.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:mc.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}};S2t.create=e=>new S2t({checks:[],coerce:e?.coerce||!1,typeName:kp.ZodDate,...Hm(e)});var spr=class extends Gh{_parse(t){if(this._getType(t)!==ls.symbol){let n=this._getOrReturnCtx(t);return ba(n,{code:ui.invalid_type,expected:ls.symbol,received:n.parsedType}),ql}return YQ(t.data)}};spr.create=e=>new spr({typeName:kp.ZodSymbol,...Hm(e)});var B2t=class extends Gh{_parse(t){if(this._getType(t)!==ls.undefined){let n=this._getOrReturnCtx(t);return ba(n,{code:ui.invalid_type,expected:ls.undefined,received:n.parsedType}),ql}return YQ(t.data)}};B2t.create=e=>new B2t({typeName:kp.ZodUndefined,...Hm(e)});var D2t=class extends Gh{_parse(t){if(this._getType(t)!==ls.null){let n=this._getOrReturnCtx(t);return ba(n,{code:ui.invalid_type,expected:ls.null,received:n.parsedType}),ql}return YQ(t.data)}};D2t.create=e=>new D2t({typeName:kp.ZodNull,...Hm(e)});var rgt=class extends Gh{constructor(){super(...arguments),this._any=!0}_parse(t){return YQ(t.data)}};rgt.create=e=>new rgt({typeName:kp.ZodAny,...Hm(e)});var Xot=class extends Gh{constructor(){super(...arguments),this._unknown=!0}_parse(t){return YQ(t.data)}};Xot.create=e=>new Xot({typeName:kp.ZodUnknown,...Hm(e)});var Cxe=class extends Gh{_parse(t){let r=this._getOrReturnCtx(t);return ba(r,{code:ui.invalid_type,expected:ls.never,received:r.parsedType}),ql}};Cxe.create=e=>new Cxe({typeName:kp.ZodNever,...Hm(e)});var upr=class extends Gh{_parse(t){if(this._getType(t)!==ls.undefined){let n=this._getOrReturnCtx(t);return ba(n,{code:ui.invalid_type,expected:ls.void,received:n.parsedType}),ql}return YQ(t.data)}};upr.create=e=>new upr({typeName:kp.ZodVoid,...Hm(e)});var Zot=class e extends Gh{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==ls.array)return ba(r,{code:ui.invalid_type,expected:ls.array,received:r.parsedType}),ql;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(a||s)&&(ba(r,{code:a?ui.too_big:ui.too_small,minimum:s?i.exactLength.value:void 0,maximum:a?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&&(ba(r,{code:ui.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&&(ba(r,{code:ui.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((a,s)=>i.type._parseAsync(new $te(r,a,r.path,s)))).then(a=>tz.mergeArray(n,a));let o=[...r.data].map((a,s)=>i.type._parseSync(new $te(r,a,r.path,s)));return tz.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:mc.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:mc.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:mc.toString(r)}})}nonempty(t){return this.min(1,t)}};Zot.create=(e,t)=>new Zot({type:e,minLength:null,maxLength:null,exactLength:null,typeName:kp.ZodArray,...Hm(t)});function apr(e){if(e instanceof j5){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Hte.create(apr(n))}return new j5({...e._def,shape:()=>t})}else return e instanceof Zot?new Zot({...e._def,type:apr(e.element)}):e instanceof Hte?Hte.create(apr(e.unwrap())):e instanceof pMe?pMe.create(apr(e.unwrap())):e instanceof lMe?lMe.create(e.items.map(t=>apr(t))):e}var j5=class e extends Gh{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=Fg.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==ls.object){let l=this._getOrReturnCtx(t);return ba(l,{code:ui.invalid_type,expected:ls.object,received:l.parsedType}),ql}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Cxe&&this._def.unknownKeys==="strip"))for(let l in i.data)a.includes(l)||s.push(l);let c=[];for(let l of a){let u=o[l],p=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new $te(i,p,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Cxe){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")s.length>0&&(ba(i,{code:ui.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of s){let p=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new $te(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let p=await u.key,d=await u.value;l.push({key:p,value:d,alwaysSet:u.alwaysSet})}return l}).then(l=>tz.mergeObjectSync(n,l)):tz.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return mc.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:mc.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:kp.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 Fg.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 Fg.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return apr(this)}partial(t){let r={};for(let n of Fg.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 Fg.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Hte;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return SIl(Fg.objectKeys(this.shape))}};j5.create=(e,t)=>new j5({shape:()=>e,unknownKeys:"strip",catchall:Cxe.create(),typeName:kp.ZodObject,...Hm(t)});j5.strictCreate=(e,t)=>new j5({shape:()=>e,unknownKeys:"strict",catchall:Cxe.create(),typeName:kp.ZodObject,...Hm(t)});j5.lazycreate=(e,t)=>new j5({shape:e,unknownKeys:"strip",catchall:Cxe.create(),typeName:kp.ZodObject,...Hm(t)});var T2t=class extends Gh{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new x5(s.ctx.common.issues));return ba(r,{code:ui.invalid_union,unionErrors:a}),ql}if(r.common.async)return Promise.all(n.map(async o=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let o,a=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(c=>new x5(c));return ba(r,{code:ui.invalid_union,unionErrors:s}),ql}}get options(){return this._def.options}};T2t.create=(e,t)=>new T2t({options:e,typeName:kp.ZodUnion,...Hm(t)});var Yot=e=>e instanceof F2t?Yot(e.schema):e instanceof Jte?Yot(e.innerType()):e instanceof N2t?[e.value]:e instanceof M2t?e.options:e instanceof z2t?Fg.objectValues(e.enum):e instanceof Q2t?Yot(e._def.innerType):e instanceof B2t?[void 0]:e instanceof D2t?[null]:e instanceof Hte?[void 0,...Yot(e.unwrap())]:e instanceof pMe?[null,...Yot(e.unwrap())]:e instanceof AYr||e instanceof V2t?Yot(e.unwrap()):e instanceof q2t?Yot(e._def.innerType):[],CWn=class e extends Gh{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ls.object)return ba(r,{code:ui.invalid_type,expected:ls.object,received:r.parsedType}),ql;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}):(ba(r,{code:ui.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ql)}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 a=Yot(o.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new e({typeName:kp.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...Hm(n)})}};function Gis(e,t){let r=cMe(e),n=cMe(t);if(e===t)return{valid:!0,data:e};if(r===ls.object&&n===ls.object){let i=Fg.objectKeys(t),o=Fg.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(let s of o){let c=Gis(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===ls.array&&n===ls.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let a=e[o],s=t[o],c=Gis(a,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===ls.date&&n===ls.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var R2t=class extends Gh{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,a)=>{if(xWn(o)||xWn(a))return ql;let s=Gis(o.value,a.value);return s.valid?((jWn(o)||jWn(a))&&r.dirty(),{status:r.value,value:s.data}):(ba(n,{code:ui.invalid_intersection_types}),ql)};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,a])=>i(o,a)):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}))}};R2t.create=(e,t,r)=>new R2t({left:e,right:t,typeName:kp.ZodIntersection,...Hm(r)});var lMe=class e extends Gh{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ls.array)return ba(n,{code:ui.invalid_type,expected:ls.array,received:n.parsedType}),ql;if(n.data.length<this._def.items.length)return ba(n,{code:ui.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ql;!this._def.rest&&n.data.length>this._def.items.length&&(ba(n,{code:ui.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new $te(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(o).then(a=>tz.mergeArray(r,a)):tz.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};lMe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new lMe({items:e,typeName:kp.ZodTuple,rest:null,...Hm(t)})};var SWn=class e extends Gh{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!==ls.object)return ba(n,{code:ui.invalid_type,expected:ls.object,received:n.parsedType}),ql;let i=[],o=this._def.keyType,a=this._def.valueType;for(let s in n.data)i.push({key:o._parse(new $te(n,s,n.path,s)),value:a._parse(new $te(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?tz.mergeObjectAsync(r,i):tz.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Gh?new e({keyType:t,valueType:r,typeName:kp.ZodRecord,...Hm(n)}):new e({keyType:tgt.create(),valueType:t,typeName:kp.ZodRecord,...Hm(r)})}},cpr=class extends Gh{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!==ls.map)return ba(n,{code:ui.invalid_type,expected:ls.map,received:n.parsedType}),ql;let i=this._def.keyType,o=this._def.valueType,a=[...n.data.entries()].map(([s,c],l)=>({key:i._parse(new $te(n,s,n.path,[l,"key"])),value:o._parse(new $te(n,c,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return ql;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return ql;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}}}};cpr.create=(e,t,r)=>new cpr({valueType:t,keyType:e,typeName:kp.ZodMap,...Hm(r)});var lpr=class e extends Gh{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==ls.set)return ba(n,{code:ui.invalid_type,expected:ls.set,received:n.parsedType}),ql;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(ba(n,{code:ui.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&&(ba(n,{code:ui.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function a(c){let l=new Set;for(let u of c){if(u.status==="aborted")return ql;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((c,l)=>o._parse(new $te(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:mc.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:mc.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};lpr.create=(e,t)=>new lpr({valueType:e,minSize:null,maxSize:null,typeName:kp.ZodSet,...Hm(t)});var BWn=class e extends Gh{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ls.function)return ba(r,{code:ui.invalid_type,expected:ls.function,received:r.parsedType}),ql;function n(s,c){return bYr({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ipr(),Kot].filter(l=>!!l),issueData:{code:ui.invalid_arguments,argumentsError:c}})}function i(s,c){return bYr({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ipr(),Kot].filter(l=>!!l),issueData:{code:ui.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof ngt){let s=this;return YQ(async function(...c){let l=new x5([]),u=await s._def.args.parseAsync(c,o).catch(m=>{throw l.addIssue(n(c,m)),l}),p=await Reflect.apply(a,this,u);return await s._def.returns._def.type.parseAsync(p,o).catch(m=>{throw l.addIssue(i(p,m)),l})})}else{let s=this;return YQ(function(...c){let l=s._def.args.safeParse(c,o);if(!l.success)throw new x5([n(c,l.error)]);let u=Reflect.apply(a,this,l.data),p=s._def.returns.safeParse(u,o);if(!p.success)throw new x5([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:lMe.create(t).rest(Xot.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||lMe.create([]).rest(Xot.create()),returns:r||Xot.create(),typeName:kp.ZodFunction,...Hm(n)})}},F2t=class extends Gh{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})}};F2t.create=(e,t)=>new F2t({getter:e,typeName:kp.ZodLazy,...Hm(t)});var N2t=class extends Gh{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return ba(r,{received:r.data,code:ui.invalid_literal,expected:this._def.value}),ql}return{status:"valid",value:t.data}}get value(){return this._def.value}};N2t.create=(e,t)=>new N2t({value:e,typeName:kp.ZodLiteral,...Hm(t)});function SIl(e,t){return new M2t({values:e,typeName:kp.ZodEnum,...Hm(t)})}var M2t=class e extends Gh{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return ba(r,{expected:Fg.joinValues(n),received:r.parsedType,code:ui.invalid_type}),ql}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 ba(r,{received:r.data,code:ui.invalid_enum_value,options:n}),ql}return YQ(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})}};M2t.create=SIl;var z2t=class extends Gh{_parse(t){let r=Fg.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==ls.string&&n.parsedType!==ls.number){let i=Fg.objectValues(r);return ba(n,{expected:Fg.joinValues(i),received:n.parsedType,code:ui.invalid_type}),ql}if(this._cache||(this._cache=new Set(Fg.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=Fg.objectValues(r);return ba(n,{received:n.data,code:ui.invalid_enum_value,options:i}),ql}return YQ(t.data)}get enum(){return this._def.values}};z2t.create=(e,t)=>new z2t({values:e,typeName:kp.ZodNativeEnum,...Hm(t)});var ngt=class extends Gh{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==ls.promise&&r.common.async===!1)return ba(r,{code:ui.invalid_type,expected:ls.promise,received:r.parsedType}),ql;let n=r.parsedType===ls.promise?r.data:Promise.resolve(r.data);return YQ(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ngt.create=(e,t)=>new ngt({type:e,typeName:kp.ZodPromise,...Hm(t)});var Jte=class extends Gh{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===kp.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:a=>{ba(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let a=i.transform(n.data,o);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return ql;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?ql:c.status==="dirty"?I2t(c.value):r.value==="dirty"?I2t(c.value):c});{if(r.value==="aborted")return ql;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?ql:s.status==="dirty"?I2t(s.value):r.value==="dirty"?I2t(s.value):s}}if(i.type==="refinement"){let a=s=>{let c=i.refinement(s,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 s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ql:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?ql:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!egt(a))return ql;let s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>egt(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:r.value,value:s})):ql);Fg.assertNever(i)}};Jte.create=(e,t,r)=>new Jte({schema:e,typeName:kp.ZodEffects,effect:t,...Hm(r)});Jte.createWithPreprocess=(e,t,r)=>new Jte({schema:t,effect:{type:"preprocess",transform:e},typeName:kp.ZodEffects,...Hm(r)});var Hte=class extends Gh{_parse(t){return this._getType(t)===ls.undefined?YQ(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Hte.create=(e,t)=>new Hte({innerType:e,typeName:kp.ZodOptional,...Hm(t)});var pMe=class extends Gh{_parse(t){return this._getType(t)===ls.null?YQ(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};pMe.create=(e,t)=>new pMe({innerType:e,typeName:kp.ZodNullable,...Hm(t)});var Q2t=class extends Gh{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===ls.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Q2t.create=(e,t)=>new Q2t({innerType:e,typeName:kp.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Hm(t)});var q2t=class extends Gh{_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 opr(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new x5(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new x5(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};q2t.create=(e,t)=>new q2t({innerType:e,typeName:kp.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Hm(t)});var ppr=class extends Gh{_parse(t){if(this._getType(t)!==ls.nan){let n=this._getOrReturnCtx(t);return ba(n,{code:ui.invalid_type,expected:ls.nan,received:n.parsedType}),ql}return{status:"valid",value:t.data}}};ppr.create=e=>new ppr({typeName:kp.ZodNaN,...Hm(e)});var xnA=Symbol("zod_brand"),AYr=class extends Gh{_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}},_Yr=class e extends Gh{_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"?ql:o.status==="dirty"?(r.dirty(),I2t(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"?ql: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:kp.ZodPipeline})}},V2t=class extends Gh{_parse(t){let r=this._def.innerType._parse(t),n=i=>(egt(i)&&(i.value=Object.freeze(i.value)),i);return opr(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};V2t.create=(e,t)=>new V2t({innerType:e,typeName:kp.ZodReadonly,...Hm(t)});function IIl(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function BIl(e,t={},r){return e?rgt.create().superRefine((n,i)=>{let o=e(n);if(o instanceof Promise)return o.then(a=>{if(!a){let s=IIl(t,n),c=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:c})}});if(!o){let a=IIl(t,n),s=a.fatal??r??!0;i.addIssue({code:"custom",...a,fatal:s})}}):rgt.create()}var jnA={object:j5.lazycreate},kp;(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"})(kp||(kp={}));var CnA=(e,t={message:`Input not instance of ${e.name}`})=>BIl(r=>r instanceof e,t),DIl=tgt.create,TIl=x2t.create,SnA=ppr.create,BnA=j2t.create,RIl=C2t.create,DnA=S2t.create,TnA=spr.create,RnA=B2t.create,FnA=D2t.create,NnA=rgt.create,MnA=Xot.create,znA=Cxe.create,QnA=upr.create,qnA=Zot.create,VnA=j5.create,knA=j5.strictCreate,UnA=T2t.create,LnA=CWn.create,WnA=R2t.create,GnA=lMe.create,HnA=SWn.create,$nA=cpr.create,JnA=lpr.create,KnA=BWn.create,YnA=F2t.create,XnA=N2t.create,ZnA=M2t.create,eiA=z2t.create,tiA=ngt.create,riA=Jte.create,niA=Hte.create,iiA=pMe.create,oiA=Jte.createWithPreprocess,aiA=_Yr.create,siA=()=>DIl().optional(),uiA=()=>TIl().optional(),ciA=()=>RIl().optional(),liA={string:(e=>tgt.create({...e,coerce:!0})),number:(e=>x2t.create({...e,coerce:!0})),boolean:(e=>C2t.create({...e,coerce:!0})),bigint:(e=>j2t.create({...e,coerce:!0})),date:(e=>S2t.create({...e,coerce:!0}))};var piA=ql;var S5={};Q(S5,{RawSchemas:()=>Cos});var Cos={};Q(Cos,{AiChatLocation:()=>His,AiChatModel:()=>$is,Availability:()=>Jis,BodyThemeConfig:()=>Kis,ContentAlignment:()=>Yis,EditThisPageLaunch:()=>Xis,FernDocsConfig:()=>vos,FernDocsConfigError:()=>vYr,FernDocsConfigTimeoutError:()=>OYr,FontDisplay:()=>Zis,FontStyle:()=>eos,FooterNavThemeConfig:()=>tos,HeaderPosition:()=>ros,HttpSnippetLanguage:()=>nos,JsScriptStrategy:()=>ios,Language:()=>oos,LanguageSwitcherThemeConfig:()=>aos,LibraryLanguage:()=>sos,PageActionOption:()=>uos,PageActionsThemeConfig:()=>cos,ProductSwitcherThemeConfig:()=>los,ProgrammingLanguage:()=>pos,SearchbarPlacement:()=>fos,Serializer:()=>C5,SidebarThemeConfig:()=>dos,SwitcherPlacement:()=>mos,TabsPlacement:()=>hos,TabsThemeConfig:()=>yos,Target:()=>gos,TitleSource:()=>bos,TwitterCardSetting:()=>Aos,VersionAvailability:()=>_os,docs:()=>DWn,logging:()=>wos,serialization:()=>C5});var vos={};Q(vos,{AiChatLocation:()=>His,AiChatModel:()=>$is,Availability:()=>Jis,BodyThemeConfig:()=>Kis,ContentAlignment:()=>Yis,EditThisPageLaunch:()=>Xis,FontDisplay:()=>Zis,FontStyle:()=>eos,FooterNavThemeConfig:()=>tos,HeaderPosition:()=>ros,HttpSnippetLanguage:()=>nos,JsScriptStrategy:()=>ios,Language:()=>oos,LanguageSwitcherThemeConfig:()=>aos,LibraryLanguage:()=>sos,PageActionOption:()=>uos,PageActionsThemeConfig:()=>cos,ProductSwitcherThemeConfig:()=>los,ProgrammingLanguage:()=>pos,SearchbarPlacement:()=>fos,SidebarThemeConfig:()=>dos,SwitcherPlacement:()=>mos,TabsPlacement:()=>hos,TabsThemeConfig:()=>yos,Target:()=>gos,TitleSource:()=>bos,TwitterCardSetting:()=>Aos,VersionAvailability:()=>_os,docs:()=>DWn});var DWn={};Q(DWn,{AiChatLocation:()=>His,AiChatModel:()=>$is,Availability:()=>Jis,BodyThemeConfig:()=>Kis,ContentAlignment:()=>Yis,EditThisPageLaunch:()=>Xis,FontDisplay:()=>Zis,FontStyle:()=>eos,FooterNavThemeConfig:()=>tos,HeaderPosition:()=>ros,HttpSnippetLanguage:()=>nos,JsScriptStrategy:()=>ios,Language:()=>oos,LanguageSwitcherThemeConfig:()=>aos,LibraryLanguage:()=>sos,PageActionOption:()=>uos,PageActionsThemeConfig:()=>cos,ProductSwitcherThemeConfig:()=>los,ProgrammingLanguage:()=>pos,SearchbarPlacement:()=>fos,SidebarThemeConfig:()=>dos,SwitcherPlacement:()=>mos,TabsPlacement:()=>hos,TabsThemeConfig:()=>yos,Target:()=>gos,TitleSource:()=>bos,TwitterCardSetting:()=>Aos,VersionAvailability:()=>_os});var His={Docs:"docs",Slack:"slack",Discord:"discord"};var $is={Claude37:"claude-3.7",Claude4:"claude-4",CommandA:"command-a"};var Jis={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",Beta:"beta"};var Kis={Default:"default",Canvas:"canvas"};var Yis={Center:"center",Left:"left"};var Xis={Github:"github",Dashboard:"dashboard"};var Zis={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var eos={Normal:"normal",Italic:"italic"};var tos={Default:"default",Minimal:"minimal"};var ros={Fixed:"fixed",Static:"static"};var nos={Curl:"curl",Csharp:"csharp",Go:"go",Java:"java",Javascript:"javascript",Php:"php",Python:"python",Ruby:"ruby",Swift:"swift",Typescript:"typescript"};var ios={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var oos={En:"en",Es:"es",Fr:"fr",De:"de",It:"it",Pt:"pt",Ja:"ja",Zh:"zh",Ko:"ko",El:"el",No:"no",Pl:"pl",Ru:"ru",Sv:"sv",Tr:"tr"};var aos={Default:"default",Minimal:"minimal"};var sos={Python:"python",Cpp:"cpp"};var uos={CopyPage:"copy-page",ViewAsMarkdown:"view-as-markdown",AskAi:"ask-ai",Chatgpt:"chatgpt",Claude:"claude",Cursor:"cursor",Vscode:"vscode"};var cos={Default:"default",Toolbar:"toolbar"};var los={Default:"default",Toggle:"toggle"};var pos={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var fos={Header:"header",HeaderTabs:"header-tabs",Sidebar:"sidebar"};var dos={Default:"default",Minimal:"minimal"};var mos={Header:"header",Sidebar:"sidebar"};var hos={Header:"header",Sidebar:"sidebar"};var yos={Default:"default",Bubble:"bubble"};var gos={Blank:"_blank",Self:"_self",Parent:"_parent",Top:"_top"};var bos={Frontmatter:"frontmatter",Filename:"filename"};var Aos={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var _os={Deprecated:"deprecated",Ga:"ga",Stable:"stable",Beta:"beta"};var FIl=(e,t,r)=>JSON.stringify(e,t,r);var vYr=class extends Error{statusCode;body;rawResponse;constructor({message:t,statusCode:r,body:n,rawResponse:i}){super(fiA({message:t,statusCode:r,body:n})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=r,this.body=n,this.rawResponse=i}};function fiA({message:e,statusCode:t,body:r}){let n=[];return e!=null&&n.push(e),t!=null&&n.push(`Status code: ${t.toString()}`),r!=null&&n.push(`Body: ${FIl(r,void 0,2)}`),n.join(`
1525
1525
  `)}var OYr=class extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var Sxe={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},NIl={[Sxe.Debug]:1,[Sxe.Info]:2,[Sxe.Warn]:3,[Sxe.Error]:4},wYr=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)}},Oos=class{level;logger;silent;constructor(t){this.level=NIl[t.level],this.logger=t.logger,this.silent=t.silent}shouldLog(t){return!this.silent&&this.level<=NIl[t]}isDebug(){return this.shouldLog(Sxe.Debug)}debug(t,...r){this.isDebug()&&this.logger.debug(t,...r)}isInfo(){return this.shouldLog(Sxe.Info)}info(t,...r){this.isInfo()&&this.logger.info(t,...r)}isWarn(){return this.shouldLog(Sxe.Warn)}warn(t,...r){this.isWarn()&&this.logger.warn(t,...r)}isError(){return this.shouldLog(Sxe.Error)}error(t,...r){this.isError()&&this.logger.error(t,...r)}};var w0S=new Oos({level:Sxe.Info,logger:new wYr,silent:!0});var wos;(function(e){e.LogLevel=Sxe,e.ConsoleLogger=wYr})(wos||(wos={}));var C5={};Q(C5,{AbsoluteProductPath:()=>MWn,AiChatConfig:()=>xYr,AiChatDatasource:()=>QWn,AiChatLocation:()=>qWn,AiChatModel:()=>VWn,AiChatWebsiteDatasource:()=>zWn,AiExamplesConfig:()=>kWn,AnalyticsConfig:()=>JWn,AnnouncementConfig:()=>ogt,ApiReferenceConfiguration:()=>e9n,ApiReferenceEndpointConfiguration:()=>t9n,ApiReferenceLayoutItem:()=>mMe,ApiReferencePackageConfiguration:()=>r9n,ApiReferencePackageConfigurationWithOptions:()=>i9n,ApiReferenceSectionConfiguration:()=>n9n,Audience:()=>fMe,AudienceId:()=>jYr,Availability:()=>XQ,BackgroundImageConfiguration:()=>a9n,BackgroundImageThemedConfig:()=>o9n,BodyThemeConfig:()=>s9n,ChangelogConfiguration:()=>u9n,ChangelogFolderRelativePath:()=>gpr,ColorConfig:()=>hMe,ColorThemedConfig:()=>c9n,ColorsConfiguration:()=>l9n,ContentAlignment:()=>p9n,CssConfig:()=>f9n,CustomDomain:()=>d9n,CustomPageAction:()=>m9n,DocsConfiguration:()=>pxl,DocsInstance:()=>b9n,DocsSettingsConfig:()=>v9n,DocsTypographyConfig:()=>E9n,EditThisPageConfig:()=>g9n,EditThisPageLaunch:()=>h9n,ExperimentalConfig:()=>I9n,ExternalProduct:()=>sGn,FeatureFlag:()=>CYr,FeatureFlagConfiguration:()=>ZWn,FolderConfiguration:()=>AGn,FontConfig:()=>Opr,FontConfigPath:()=>w9n,FontConfigVariant:()=>O9n,FontDisplay:()=>P9n,FontStyle:()=>_pr,FontWeight:()=>vpr,FooterLinksConfig:()=>x9n,FooterNavThemeConfig:()=>fGn,FullStoryAnalyticsConfig:()=>UWn,GitLibraryInputSchema:()=>z9n,GithubEditThisPageConfig:()=>y9n,GoogleAnalytics4Config:()=>LWn,GtmConfig:()=>WWn,HeaderPosition:()=>T9n,HttpSnippetLanguage:()=>A9n,HttpSnippetsConfig:()=>_9n,IntegrationsConfig:()=>j9n,IntercomConfig:()=>GWn,InternalProduct:()=>uGn,JsConfig:()=>D9n,JsConfigOptions:()=>SYr,JsFileConfig:()=>S9n,JsFileConfigSettings:()=>C9n,JsRemoteConfig:()=>B9n,JsScriptStrategy:()=>wpr,Language:()=>bpr,LanguageSwitcherThemeConfig:()=>dGn,LayoutConfig:()=>M9n,LibraryConfiguration:()=>U9n,LibraryInputConfiguration:()=>q9n,LibraryLanguage:()=>V9n,LibraryName:()=>Ppr,LibraryOutputConfiguration:()=>k9n,LibraryReferenceConfiguration:()=>_Gn,LinkConfiguration:()=>ypr,LogoConfiguration:()=>L9n,MetadataConfig:()=>G9n,NavbarDropdownConfig:()=>H9n,NavbarGithubConfig:()=>J9n,NavbarGithubConfigWithOptions:()=>$9n,NavbarLink:()=>K9n,NavbarLinkConfig:()=>yMe,NavigationConfig:()=>sgt,NavigationItem:()=>gMe,PageActionOption:()=>nGn,PageActionOptions:()=>iGn,PageActionsConfig:()=>oGn,PageActionsThemeConfig:()=>mGn,PageConfiguration:()=>Xte,PathLibraryInputSchema:()=>Q9n,PlaygroundButtonSettings:()=>KWn,PlaygroundSettings:()=>dMe,PostHogConfig:()=>HWn,ProductConfig:()=>cGn,ProductConfigBase:()=>Ipr,ProductFileConfig:()=>fxl,ProductPath:()=>dxl,ProductSwitcherThemeConfig:()=>hGn,ProgrammingLanguage:()=>lGn,PythonDocsConfiguration:()=>vGn,RedirectConfig:()=>pGn,RelativeProductPath:()=>wGn,Role:()=>hpr,RoleId:()=>U2t,SearchbarPlacement:()=>R9n,SectionConfiguration:()=>OGn,SegmentConfig:()=>$Wn,SidebarThemeConfig:()=>yGn,SnippetLanguageConfiguration:()=>Kte,SnippetsConfiguration:()=>XWn,SwitcherPlacement:()=>F9n,TabConfig:()=>ugt,TabId:()=>Zte,TabVariant:()=>X9n,TabbedNavigationConfig:()=>tGn,TabbedNavigationItem:()=>eGn,TabbedNavigationItemWithLayout:()=>Y9n,TabbedNavigationItemWithVariants:()=>Z9n,TabsPlacement:()=>N9n,TabsThemeConfig:()=>gGn,Target:()=>Yte,ThemeConfig:()=>bGn,TitleSource:()=>Apr,TwitterCardSetting:()=>W9n,UntabbedNavigationConfig:()=>rGn,VersionAvailability:()=>aGn,VersionConfig:()=>Epr,VersionFileConfig:()=>mxl,VersionedSnippetLanguageConfiguration:()=>YWn,WithFeatureFlags:()=>m0,WithPermissions:()=>h0,WithViewers:()=>agt,docs:()=>jos});var jos={};Q(jos,{AbsoluteProductPath:()=>MWn,AiChatConfig:()=>xYr,AiChatDatasource:()=>QWn,AiChatLocation:()=>qWn,AiChatModel:()=>VWn,AiChatWebsiteDatasource:()=>zWn,AiExamplesConfig:()=>kWn,AnalyticsConfig:()=>JWn,AnnouncementConfig:()=>ogt,ApiReferenceConfiguration:()=>e9n,ApiReferenceEndpointConfiguration:()=>t9n,ApiReferenceLayoutItem:()=>mMe,ApiReferencePackageConfiguration:()=>r9n,ApiReferencePackageConfigurationWithOptions:()=>i9n,ApiReferenceSectionConfiguration:()=>n9n,Audience:()=>fMe,AudienceId:()=>jYr,Availability:()=>XQ,BackgroundImageConfiguration:()=>a9n,BackgroundImageThemedConfig:()=>o9n,BodyThemeConfig:()=>s9n,ChangelogConfiguration:()=>u9n,ChangelogFolderRelativePath:()=>gpr,ColorConfig:()=>hMe,ColorThemedConfig:()=>c9n,ColorsConfiguration:()=>l9n,ContentAlignment:()=>p9n,CssConfig:()=>f9n,CustomDomain:()=>d9n,CustomPageAction:()=>m9n,DocsConfiguration:()=>pxl,DocsInstance:()=>b9n,DocsSettingsConfig:()=>v9n,DocsTypographyConfig:()=>E9n,EditThisPageConfig:()=>g9n,EditThisPageLaunch:()=>h9n,ExperimentalConfig:()=>I9n,ExternalProduct:()=>sGn,FeatureFlag:()=>CYr,FeatureFlagConfiguration:()=>ZWn,FolderConfiguration:()=>AGn,FontConfig:()=>Opr,FontConfigPath:()=>w9n,FontConfigVariant:()=>O9n,FontDisplay:()=>P9n,FontStyle:()=>_pr,FontWeight:()=>vpr,FooterLinksConfig:()=>x9n,FooterNavThemeConfig:()=>fGn,FullStoryAnalyticsConfig:()=>UWn,GitLibraryInputSchema:()=>z9n,GithubEditThisPageConfig:()=>y9n,GoogleAnalytics4Config:()=>LWn,GtmConfig:()=>WWn,HeaderPosition:()=>T9n,HttpSnippetLanguage:()=>A9n,HttpSnippetsConfig:()=>_9n,IntegrationsConfig:()=>j9n,IntercomConfig:()=>GWn,InternalProduct:()=>uGn,JsConfig:()=>D9n,JsConfigOptions:()=>SYr,JsFileConfig:()=>S9n,JsFileConfigSettings:()=>C9n,JsRemoteConfig:()=>B9n,JsScriptStrategy:()=>wpr,Language:()=>bpr,LanguageSwitcherThemeConfig:()=>dGn,LayoutConfig:()=>M9n,LibraryConfiguration:()=>U9n,LibraryInputConfiguration:()=>q9n,LibraryLanguage:()=>V9n,LibraryName:()=>Ppr,LibraryOutputConfiguration:()=>k9n,LibraryReferenceConfiguration:()=>_Gn,LinkConfiguration:()=>ypr,LogoConfiguration:()=>L9n,MetadataConfig:()=>G9n,NavbarDropdownConfig:()=>H9n,NavbarGithubConfig:()=>J9n,NavbarGithubConfigWithOptions:()=>$9n,NavbarLink:()=>K9n,NavbarLinkConfig:()=>yMe,NavigationConfig:()=>sgt,NavigationItem:()=>gMe,PageActionOption:()=>nGn,PageActionOptions:()=>iGn,PageActionsConfig:()=>oGn,PageActionsThemeConfig:()=>mGn,PageConfiguration:()=>Xte,PathLibraryInputSchema:()=>Q9n,PlaygroundButtonSettings:()=>KWn,PlaygroundSettings:()=>dMe,PostHogConfig:()=>HWn,ProductConfig:()=>cGn,ProductConfigBase:()=>Ipr,ProductFileConfig:()=>fxl,ProductPath:()=>dxl,ProductSwitcherThemeConfig:()=>hGn,ProgrammingLanguage:()=>lGn,PythonDocsConfiguration:()=>vGn,RedirectConfig:()=>pGn,RelativeProductPath:()=>wGn,Role:()=>hpr,RoleId:()=>U2t,SearchbarPlacement:()=>R9n,SectionConfiguration:()=>OGn,SegmentConfig:()=>$Wn,SidebarThemeConfig:()=>yGn,SnippetLanguageConfiguration:()=>Kte,SnippetsConfiguration:()=>XWn,SwitcherPlacement:()=>F9n,TabConfig:()=>ugt,TabId:()=>Zte,TabVariant:()=>X9n,TabbedNavigationConfig:()=>tGn,TabbedNavigationItem:()=>eGn,TabbedNavigationItemWithLayout:()=>Y9n,TabbedNavigationItemWithVariants:()=>Z9n,TabsPlacement:()=>N9n,TabsThemeConfig:()=>gGn,Target:()=>Yte,ThemeConfig:()=>bGn,TitleSource:()=>Apr,TwitterCardSetting:()=>W9n,UntabbedNavigationConfig:()=>rGn,VersionAvailability:()=>aGn,VersionConfig:()=>Epr,VersionFileConfig:()=>mxl,VersionedSnippetLanguageConfiguration:()=>YWn,WithFeatureFlags:()=>m0,WithPermissions:()=>h0,WithViewers:()=>agt});var pe={};Q(pe,{JsonError:()=>fpr,ParseError:()=>dpr,any:()=>YIl,bigint:()=>zIl,boolean:()=>XIl,booleanLiteral:()=>JIl,date:()=>QIl,discriminant:()=>uxl,enum_:()=>RWn,getObjectLikeUtils:()=>Bxe,getObjectUtils:()=>k2t,getSchemaUtils:()=>Dv,isProperty:()=>igt,lazy:()=>qIl,lazyObject:()=>HIl,list:()=>NWn,never:()=>ZIl,number:()=>exl,object:()=>FWn,objectWithoutOptionalProperties:()=>GIl,optional:()=>Pos,property:()=>kIl,record:()=>ixl,set:()=>oxl,string:()=>txl,stringLiteral:()=>KIl,transform:()=>Eos,undiscriminatedUnion:()=>sxl,union:()=>lxl,unknown:()=>rxl,withParsedProperties:()=>xos});var $f={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 y_(e,t){return`Expected ${t}. Received ${miA(e)}.`}function miA(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}function vR(e){return{...e,json:MIl(e.json),parse:MIl(e.parse)}}function MIl(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(`
1526
1526
  `)),{ok:!0,value:t}):n}}function TWn(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var fpr=class e extends Error{errors;constructor(t){super(t.map(TWn).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var dpr=class e extends Error{errors;constructor(t){super(t.map(TWn).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Dv(e){return{nullable:()=>hiA(e),optional:()=>Pos(e),optionalNullable:()=>yiA(e),transform:t=>Eos(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new dpr(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new fpr(n.errors)}}}function hiA(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:()=>$f.NULLABLE};return{...t,...Dv(t)}}function Pos(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:()=>$f.OPTIONAL};return{...t,...Dv(t)}}function yiA(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:()=>$f.OPTIONAL_NULLABLE};return{...t,...Dv(t)}}function Eos(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,...Dv(r)}}function zIl(){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:y_(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:y_(t,"bigint")}]}:{ok:!0,value:t},getType:()=>$f.BIGINT};return{...vR(e),...Dv(e)}}var giA=/^([+-]?\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)?)?)?)?$/;function QIl(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:y_(t,"string")}]}:giA.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:y_(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:y_(t,"Date object")}]},getType:()=>$f.DATE};return{...vR(e),...Dv(e)}}function OR(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...vR(r),...Dv(r)}}}function RWn(e){let t=new Set(e);return OR($f.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:y_(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:y_(n,"enum")}]}:{ok:!0,value:n})()}function qIl(e){let t=Ios(e);return{...t,...Dv(t)}}function Ios(e){return{parse:(t,r)=>mpr(e).parse(t,r),json:(t,r)=>mpr(e).json(t,r),getType:()=>mpr(e).getType()}}function mpr(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function PYr(e){return Object.entries(e)}function EYr(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function eat(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function IYr(e){return Object.keys(e)}function VIl(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function Bxe(e){return{withParsedProperties:t=>xos(e,t)}}function xos(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let a=Object.entries(t).reduce((s,[c,l])=>({...s,[c]:typeof l=="function"?l(o.value):l}),{});return{ok:!0,value:{...o.value,...a}}},json:(n,i)=>{if(!eat(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:y_(n,"object")}]};let o=new Set(Object.keys(t)),a=EYr(n,Object.keys(n).filter(s=>!o.has(s)));return e.json(a,i)},getType:()=>e.getType()};return{...r,...Dv(r),...Bxe(r)}}function kIl(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function igt(e){return e.isProperty}function FWn(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>igt(n)?n.rawKey:r),_getParsedProperties:()=>IYr(e),parse:(r,n)=>{let i={},o=[];for(let[a,s]of PYr(e)){let c=igt(s)?s.rawKey:a,l=igt(s)?s.valueSchema:s,u={rawKey:c,parsedKey:a,valueSchema:l};i[c]=u,WIl(l)&&o.push(c)}return UIl({value:r,requiredKeys:o,getProperty:a=>{let s=i[a];if(s!=null)return{transformedKey:s.parsedKey,transform:c=>s.valueSchema.parse(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[o,a]of PYr(e)){let s=igt(a)?a.valueSchema:a;WIl(s)&&i.push(o)}return UIl({value:r,requiredKeys:i,getProperty:o=>{let a=e[o];if(a!=null)return igt(a)?{transformedKey:a.rawKey,transform:s=>a.valueSchema.json(s,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}:{transformedKey:o,transform:s=>a.json(s,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>$f.OBJECT};return{...vR(t),...Dv(t),...Bxe(t),...k2t(t)}}function UIl({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:o=[]}){if(!eat(e))return{ok:!1,errors:[{path:o,message:y_(e,"object")}]};let a=new Set(t),s=[],c={};for(let[l,u]of Object.entries(e)){let p=r(l);if(p!=null){a.delete(l);let d=p.transform(u);d.ok?c[p.transformedKey]=d.value:(c[l]=u,s.push(...d.errors))}else switch(n){case"fail":s.push({path:[...o,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=u;break}}return s.push(...t.filter(l=>a.has(l)).map(l=>({path:o,message:`Missing required key "${l}"`}))),s.length===0||i?{ok:!0,value:c}:{ok:!1,errors:s}}function k2t(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>LIl({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>LIl({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>$f.OBJECT};return{...r,...Dv(r),...Bxe(r),...k2t(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let a=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!a.ok)return a;let s={};if(typeof i=="object"&&i!=null)for(let[c,l]of Object.entries(i))t.has(c)||(s[c]=l);return{ok:!0,value:{...s,...a.value}}},json:(i,o)=>{let a=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!a.ok)return a;let s={};if(typeof i=="object"&&i!=null)for(let[c,l]of Object.entries(i))r.has(c)||(s[c]=l);return{ok:!0,value:{...s,...a.value}}},getType:()=>$f.OBJECT};return{...n,...Dv(n),...Bxe(n),...k2t(n)}}}}function LIl({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!eat(t))return{ok:!1,errors:[{path:i,message:y_(t,"object")}]};let o=new Set(e),[a,s]=VIl(IYr(t),u=>o.has(u)),c=r(EYr(t,s)),l=n(EYr(t,a));return c.ok&&l.ok?{ok:!0,value:{...c.value,...l.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...l.ok?[]:l.errors]}}function WIl(e){return!biA(e)}function biA(e){switch(e.getType()){case $f.ANY:case $f.UNKNOWN:case $f.OPTIONAL:case $f.OPTIONAL_NULLABLE:return!0;default:return!1}}function GIl(e){return FWn(e)}function HIl(e){let t={...Ios(e),_getRawProperties:()=>mpr(e)._getRawProperties(),_getParsedProperties:()=>mpr(e)._getParsedProperties()};return{...t,...Dv(t),...Bxe(t),...k2t(t)}}function NWn(e){let t={parse:(r,n)=>$Il(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>$Il(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>$f.LIST};return{...vR(t),...Dv(t)}}function $Il(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let o=[];return n.ok||o.push(...n.errors),i.ok||o.push(...i.errors),{ok:!1,errors:o}},{ok:!0,value:[]}):{ok:!1,errors:[{message:y_(e,"list"),path:[]}]}}function JIl(e){return OR($f.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:y_(r,`${e.toString()}`)}]})()}function KIl(e){return OR($f.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:y_(r,`"${e}"`)}]})()}var YIl=OR($f.ANY,e=>({ok:!0,value:e}));var XIl=OR($f.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:y_(e,"boolean")}]});var ZIl=OR($f.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var exl=OR($f.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:y_(e,"number")}]});var txl=OR($f.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:y_(e,"string")}]});var rxl=OR($f.UNKNOWN,e=>({ok:!0,value:e}));function ixl(e,t){let r={parse:(n,i)=>nxl({value:n,isKeyNumeric:e.getType()===$f.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,a)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>nxl({value:n,isKeyNumeric:e.getType()===$f.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,a)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>$f.RECORD};return{...vR(r),...Dv(r)}}function nxl({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return eat(e)?PYr(e).reduce((o,[a,s])=>{if(s===void 0)return o;let c=o,l=a;if(t){let m=a.length>0?Number(a):NaN;Number.isNaN(m)||(l=m)}let u=r(l),p=n(s,l);if(c.ok&&u.ok&&p.ok)return{ok:!0,value:{...c.value,[u.value]:p.value}};let d=[];return c.ok||d.push(...c.errors),u.ok||d.push(...u.errors),p.ok||d.push(...p.errors),{ok:!1,errors:d}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:y_(e,"object")}]}}function oxl(e){let t=NWn(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:y_(n,"Set")}]},getType:()=>$f.SET};return{...vR(r),...Dv(r)}}function sxl(e){let t={parse:(r,n)=>axl((i,o)=>i.parse(r,o),e,n),json:(r,n)=>axl((i,o)=>i.json(r,o),e,n),getType:()=>$f.UNDISCRIMINATED_UNION};return{...vR(t),...Dv(t)}}function axl(e,t,r){let n=[];for(let[i,o]of t.entries()){let a=e(o,{...r,skipValidation:!1});if(a.ok)return a;for(let s of a.errors)n.push({path:s.path,message:`[Variant ${i}] ${s.message}`})}return{ok:!1,errors:n}}function uxl(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function lxl(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=RWn(IYr(t)),o={parse:(a,s)=>cxl({value:a,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,l)=>l.parse(c,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(a,s)=>cxl({value:a,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,l)=>l.json(c,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>$f.UNION};return{...vR(o),...Dv(o),...Bxe(o)}}function cxl({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!eat(e))return{ok:!1,errors:[{path:s,message:y_(e,"object")}]};let{[t]:c,...l}=e;if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${t}")`}]};let u=n(c);if(!u.ok)return{ok:!1,errors:u.errors};let p=i(u.value);if(p==null)return o?{ok:!0,value:{[r]:u.value,...l}}:{ok:!1,errors:[{path:[...s,t],message:"Unexpected discriminant value"}]};let d=a(l,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var MWn=pe.object({href:pe.string()});var zWn=pe.object({url:pe.string(),title:pe.string().optional()});var QWn=pe.undiscriminatedUnion([zWn]);var qWn=pe.enum_(["docs","slack","discord"]);var VWn=pe.enum_(["claude-3.7","claude-4","command-a"]);var xYr=pe.object({model:VWn.optional(),systemPrompt:pe.property("system-prompt",pe.string().optional()),location:pe.list(qWn).optional(),datasources:pe.list(QWn).optional()});var kWn=pe.object({enabled:pe.boolean().optional(),style:pe.string().optional()});var UWn=pe.object({orgId:pe.property("org-id",pe.string())});var LWn=pe.object({measurementId:pe.property("measurement-id",pe.string())});var WWn=pe.object({containerId:pe.property("container-id",pe.string())});var GWn=pe.object({appId:pe.property("app-id",pe.string()),apiBase:pe.property("api-base",pe.string().optional())});var HWn=pe.object({apiKey:pe.property("api-key",pe.string()),endpoint:pe.string().optional()});var $Wn=pe.object({writeKey:pe.property("write-key",pe.string())});var JWn=pe.object({segment:$Wn.optional(),fullstory:UWn.optional(),intercom:GWn.optional(),posthog:HWn.optional(),gtm:WWn.optional(),ga4:LWn.optional()});var ogt=pe.object({message:pe.string()});var jYr=pe.string();var fMe=pe.undiscriminatedUnion([jYr,pe.list(jYr)]);var XQ=pe.enum_(["stable","generally-available","in-development","pre-release","deprecated","beta"]);var KWn=pe.object({href:pe.string().optional()});var dMe=pe.object({hidden:pe.boolean().optional(),environments:pe.list(pe.string()).optional(),button:KWn.optional(),oauth:pe.boolean().optional(),limitWebsocketMessagesPerConnection:pe.property("limit-websocket-messages-per-connection",pe.number().optional())});var YWn=pe.object({version:pe.string(),package:pe.string()});var Kte=pe.undiscriminatedUnion([pe.string(),YWn]);var XWn=pe.object({python:Kte.optional(),typescript:Kte.optional(),go:Kte.optional(),java:Kte.optional(),ruby:Kte.optional(),csharp:Kte.optional(),php:Kte.optional(),swift:Kte.optional(),rust:Kte.optional()});var CYr=pe.object({flag:pe.string(),fallbackValue:pe.property("fallback-value",pe.unknown().optional()),match:pe.unknown().optional()});var ZWn=pe.undiscriminatedUnion([pe.string(),CYr,pe.list(CYr)]);var m0=pe.object({featureFlag:pe.property("feature-flag",ZWn.optional())});var U2t=pe.string();var hpr=pe.undiscriminatedUnion([U2t,pe.list(U2t)]);var h0=pe.object({viewers:hpr.optional(),orphaned:pe.boolean().optional()});var e9n=pe.object({api:pe.string(),apiName:pe.property("api-name",pe.string().optional()),openrpc:pe.string().optional(),audiences:fMe.optional(),displayErrors:pe.property("display-errors",pe.boolean().optional()),tagDescriptionPages:pe.property("tag-description-pages",pe.boolean().optional()),snippets:XWn.optional(),postman:pe.string().optional(),summary:pe.string().optional(),layout:pe.list(pe.lazy(()=>mMe)).optional(),collapsed:pe.boolean().optional(),icon:pe.string().optional(),slug:pe.string().optional(),hidden:pe.boolean().optional(),availability:XQ.optional(),skipSlug:pe.property("skip-slug",pe.boolean().optional()),alphabetized:pe.boolean().optional(),flattened:pe.boolean().optional(),paginated:pe.boolean().optional(),playground:dMe.optional()}).extend(h0).extend(m0);var t9n=pe.object({endpoint:pe.string(),title:pe.string().optional(),slug:pe.string().optional(),icon:pe.string().optional(),hidden:pe.boolean().optional(),availability:XQ.optional(),playground:dMe.optional()}).extend(h0).extend(m0);var Yte=pe.enum_(["_blank","_self","_parent","_top"]);var ypr=pe.object({link:pe.string(),href:pe.string(),icon:pe.string().optional(),target:Yte.optional()});var Xte=pe.object({page:pe.string(),path:pe.string(),slug:pe.string().optional(),icon:pe.string().optional(),hidden:pe.boolean().optional(),noindex:pe.boolean().optional(),availability:XQ.optional()}).extend(h0).extend(m0);var mMe=pe.undiscriminatedUnion([pe.string(),pe.record(pe.string(),pe.lazy(()=>r9n)),pe.lazyObject(()=>n9n),t9n,Xte,ypr]);var r9n=pe.undiscriminatedUnion([pe.list(pe.lazy(()=>mMe)),pe.lazyObject(()=>i9n)]);var i9n=pe.object({title:pe.string().optional(),summary:pe.string().optional(),contents:pe.list(pe.lazy(()=>mMe)).optional(),availability:XQ.optional(),slug:pe.string().optional(),icon:pe.string().optional(),hidden:pe.boolean().optional(),skipSlug:pe.property("skip-slug",pe.boolean().optional()),playground:dMe.optional()}).extend(h0).extend(m0);var n9n=pe.object({section:pe.string(),referencedPackages:pe.property("referenced-packages",pe.list(pe.string()).optional()),summary:pe.string().optional(),contents:pe.list(pe.lazy(()=>mMe)).optional(),slug:pe.string().optional(),icon:pe.string().optional(),hidden:pe.boolean().optional(),skipSlug:pe.property("skip-slug",pe.boolean().optional()),availability:XQ.optional(),playground:dMe.optional()}).extend(h0).extend(m0);var o9n=pe.object({dark:pe.string().optional(),light:pe.string().optional()});var a9n=pe.undiscriminatedUnion([pe.string(),o9n]);var s9n=pe.enum_(["default","canvas"]);var gpr=pe.string();var u9n=pe.object({changelog:gpr,title:pe.string().optional(),slug:pe.string().optional(),icon:pe.string().optional(),hidden:pe.boolean().optional()}).extend(h0).extend(m0);var c9n=pe.object({dark:pe.string().optional(),light:pe.string().optional()});var hMe=pe.undiscriminatedUnion([pe.string(),c9n]);var l9n=pe.object({accentPrimary:pe.property("accent-primary",hMe.optional()),accentPrimaryDeprecated:pe.property("accentPrimary",hMe.optional()),background:hMe.optional(),border:hMe.optional(),sidebarBackground:pe.property("sidebar-background",hMe.optional()),headerBackground:pe.property("header-background",hMe.optional()),cardBackground:pe.property("card-background",hMe.optional())});var p9n=pe.enum_(["center","left"]);var f9n=pe.undiscriminatedUnion([pe.string(),pe.list(pe.string())]);var d9n=pe.undiscriminatedUnion([pe.string(),pe.list(pe.string())]);var m9n=pe.object({title:pe.string(),subtitle:pe.string().optional(),url:pe.string(),icon:pe.string().optional(),default:pe.boolean().optional()});var h9n=pe.enum_(["github","dashboard"]);var y9n=pe.object({host:pe.string().optional(),owner:pe.string(),repo:pe.string(),branch:pe.string().optional()});var g9n=pe.object({github:y9n.optional(),launch:h9n.optional()});var b9n=pe.object({url:pe.string(),customDomain:pe.property("custom-domain",d9n.optional()),private:pe.boolean().optional(),editThisPage:pe.property("edit-this-page",g9n.optional()),audiences:fMe.optional()});var A9n=pe.enum_(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]);var _9n=pe.undiscriminatedUnion([pe.boolean(),pe.list(A9n)]);var bpr=pe.enum_(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]);var Apr=pe.enum_(["frontmatter","filename"]);var v9n=pe.object({searchText:pe.property("search-text",pe.string().optional()),disableSearch:pe.property("disable-search",pe.boolean().optional()),darkModeCode:pe.property("dark-mode-code",pe.boolean().optional()),defaultSearchFilters:pe.property("default-search-filters",pe.boolean().optional()),httpSnippets:pe.property("http-snippets",_9n.optional()),hide404Page:pe.property("hide-404-page",pe.boolean().optional()),useJavascriptAsTypescript:pe.property("use-javascript-as-typescript",pe.boolean().optional()),disableExplorerProxy:pe.property("disable-explorer-proxy",pe.boolean().optional()),disableAnalytics:pe.property("disable-analytics",pe.boolean().optional()),language:bpr.optional(),folderTitleSource:pe.property("folder-title-source",Apr.optional()),substituteEnvVars:pe.property("substitute-env-vars",pe.boolean().optional())});var _pr=pe.enum_(["normal","italic"]);var vpr=pe.undiscriminatedUnion([pe.string(),pe.number()]);var O9n=pe.object({path:pe.string(),weight:vpr.optional(),style:_pr.optional()});var w9n=pe.undiscriminatedUnion([pe.string(),O9n]);var P9n=pe.enum_(["auto","block","swap","fallback","optional"]);var Opr=pe.object({name:pe.string().optional(),path:pe.string().optional(),weight:vpr.optional(),style:_pr.optional(),paths:pe.list(w9n).optional(),display:P9n.optional(),fallback:pe.list(pe.string()).optional(),fontVariationSettings:pe.property("font-variation-settings",pe.string().optional())});var E9n=pe.object({headingsFont:Opr.optional(),bodyFont:Opr.optional(),codeFont:Opr.optional()});var I9n=pe.object({mdxComponents:pe.property("mdx-components",pe.list(pe.string()).optional()),disableStreamToggle:pe.property("disable-stream-toggle",pe.boolean().optional()),openapiParserV2:pe.property("openapi-parser-v2",pe.boolean().optional()),openapiParserV3:pe.property("openapi-parser-v3",pe.boolean().optional()),dynamicSnippets:pe.property("dynamic-snippets",pe.boolean().optional()),aiExamples:pe.property("ai-examples",pe.boolean().optional()),aiExampleStyleInstructions:pe.property("ai-example-style-instructions",pe.string().optional()),excludeApis:pe.property("exclude-apis",pe.boolean().optional())});var x9n=pe.object({github:pe.string().optional(),twitter:pe.string().optional(),x:pe.string().optional(),linkedin:pe.string().optional(),youtube:pe.string().optional(),instagram:pe.string().optional(),facebook:pe.string().optional(),discord:pe.string().optional(),slack:pe.string().optional(),hackernews:pe.string().optional(),medium:pe.string().optional(),website:pe.string().optional()});var j9n=pe.object({intercom:pe.string().optional()});var wpr=pe.enum_(["beforeInteractive","afterInteractive","lazyOnload"]);var C9n=pe.object({path:pe.string(),strategy:wpr.optional()});var S9n=pe.undiscriminatedUnion([pe.string(),C9n]);var B9n=pe.object({url:pe.string(),strategy:wpr.optional()});var SYr=pe.undiscriminatedUnion([B9n,S9n]);var D9n=pe.undiscriminatedUnion([SYr,pe.list(SYr)]);var T9n=pe.enum_(["fixed","static"]);var R9n=pe.enum_(["header","header-tabs","sidebar"]);var F9n=pe.enum_(["header","sidebar"]);var N9n=pe.enum_(["header","sidebar"]);var M9n=pe.object({pageWidth:pe.property("page-width",pe.string().optional()),contentWidth:pe.property("content-width",pe.string().optional()),sidebarWidth:pe.property("sidebar-width",pe.string().optional()),headerHeight:pe.property("header-height",pe.string().optional()),searchbarPlacement:pe.property("searchbar-placement",R9n.optional()),tabsPlacement:pe.property("tabs-placement",N9n.optional()),switcherPlacement:pe.property("switcher-placement",F9n.optional()),contentAlignment:pe.property("content-alignment",p9n.optional()),headerPosition:pe.property("header-position",T9n.optional()),disableHeader:pe.property("disable-header",pe.boolean().optional()),hideNavLinks:pe.property("hide-nav-links",pe.boolean().optional()),hideFeedback:pe.property("hide-feedback",pe.boolean().optional())});var z9n=pe.object({git:pe.string(),subpath:pe.string().optional()});var Q9n=pe.object({path:pe.string()});var q9n=pe.undiscriminatedUnion([z9n,Q9n]);var V9n=pe.enum_(["python","cpp"]);var k9n=pe.object({path:pe.string()});var U9n=pe.object({input:q9n,output:k9n,lang:V9n});var Ppr=pe.string();var L9n=pe.object({dark:pe.string().optional(),light:pe.string().optional(),height:pe.number().optional(),href:pe.string().optional(),rightText:pe.property("right-text",pe.string().optional())});var W9n=pe.enum_(["summary","summary_large_image","app","player"]);var G9n=pe.object({ogSiteName:pe.property("og:site_name",pe.string().optional()),ogTitle:pe.property("og:title",pe.string().optional()),ogDescription:pe.property("og:description",pe.string().optional()),ogUrl:pe.property("og:url",pe.string().optional()),ogImage:pe.property("og:image",pe.string().optional()),ogImageWidth:pe.property("og:image:width",pe.number().optional()),ogImageHeight:pe.property("og:image:height",pe.number().optional()),ogLocale:pe.property("og:locale",pe.string().optional()),ogLogo:pe.property("og:logo",pe.string().optional()),twitterTitle:pe.property("twitter:title",pe.string().optional()),twitterDescription:pe.property("twitter:description",pe.string().optional()),twitterHandle:pe.property("twitter:handle",pe.string().optional()),twitterImage:pe.property("twitter:image",pe.string().optional()),twitterSite:pe.property("twitter:site",pe.string().optional()),twitterUrl:pe.property("twitter:url",pe.string().optional()),twitterCard:pe.property("twitter:card",W9n.optional()),canonicalHost:pe.property("canonical-host",pe.string().optional())});var agt=pe.object({viewers:hpr.optional()});var yMe=pe.object({href:pe.string().optional(),target:Yte.optional(),url:pe.string().optional(),text:pe.string().optional(),icon:pe.string().optional(),rightIcon:pe.string().optional(),rounded:pe.boolean().optional()}).extend(agt);var H9n=pe.object({links:pe.list(yMe),text:pe.string().optional(),icon:pe.string().optional(),rightIcon:pe.string().optional(),rounded:pe.boolean().optional()}).extend(agt);var $9n=pe.object({url:pe.string(),target:Yte.optional()}).extend(agt);var J9n=pe.undiscriminatedUnion([pe.string(),$9n]);var K9n=pe.union("type",{filled:yMe,outlined:yMe,minimal:yMe,github:pe.object({value:J9n}),dropdown:H9n,primary:yMe,secondary:yMe}).transform({transform:e=>e,untransform:e=>e});var Zte=pe.string();var Y9n=pe.object({tab:Zte,layout:pe.list(pe.lazy(()=>gMe)).optional()});var X9n=pe.object({title:pe.string(),subtitle:pe.string().optional(),icon:pe.string().optional(),layout:pe.list(pe.lazy(()=>gMe)),slug:pe.string().optional(),skipSlug:pe.property("skip-slug",pe.boolean().optional()),hidden:pe.boolean().optional(),default:pe.boolean().optional()}).extend(h0).extend(m0);var Z9n=pe.object({tab:Zte,variants:pe.list(X9n)});var eGn=pe.undiscriminatedUnion([Y9n,Z9n]);var tGn=pe.list(eGn);var rGn=pe.list(pe.lazy(()=>gMe));var sgt=pe.undiscriminatedUnion([rGn,tGn]);var nGn=pe.enum_(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]);var iGn=pe.object({copyPage:pe.property("copy-page",pe.boolean().optional()),viewAsMarkdown:pe.property("view-as-markdown",pe.boolean().optional()),askAi:pe.property("ask-ai",pe.boolean().optional()),chatgpt:pe.boolean().optional(),claude:pe.boolean().optional(),cursor:pe.boolean().optional(),vscode:pe.boolean().optional(),custom:pe.list(m9n).optional()});var oGn=pe.object({default:nGn.optional(),options:iGn.optional()});var aGn=pe.enum_(["deprecated","ga","stable","beta"]);var Epr=pe.object({displayName:pe.property("display-name",pe.string()),path:pe.string(),slug:pe.string().optional(),availability:aGn.optional(),audiences:fMe.optional(),hidden:pe.boolean().optional(),announcement:ogt.optional()}).extend(h0).extend(m0);var Ipr=pe.object({displayName:pe.property("display-name",pe.string()),subtitle:pe.string().optional(),icon:pe.string().optional(),image:pe.string().optional(),versions:pe.list(Epr).optional(),audiences:fMe.optional()}).extend(h0).extend(m0);var sGn=pe.object({href:pe.string(),target:Yte.optional()}).extend(Ipr);var uGn=pe.object({path:pe.string(),slug:pe.string().optional(),announcement:ogt.optional()}).extend(Ipr);var cGn=pe.undiscriminatedUnion([uGn,sGn]);var lGn=pe.enum_(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]);var pGn=pe.object({source:pe.string(),destination:pe.string(),permanent:pe.boolean().optional()});var ugt=pe.object({displayName:pe.property("display-name",pe.string()),icon:pe.string().optional(),slug:pe.string().optional(),skipSlug:pe.property("skip-slug",pe.boolean().optional()),hidden:pe.boolean().optional(),href:pe.string().optional(),target:Yte.optional(),changelog:gpr.optional()}).extend(h0).extend(m0);var fGn=pe.enum_(["default","minimal"]);var dGn=pe.enum_(["default","minimal"]);var mGn=pe.enum_(["default","toolbar"]);var hGn=pe.enum_(["default","toggle"]);var yGn=pe.enum_(["default","minimal"]);var gGn=pe.enum_(["default","bubble"]);var bGn=pe.object({sidebar:yGn.optional(),body:s9n.optional(),tabs:gGn.optional(),pageActions:pe.property("page-actions",mGn.optional()),footerNav:pe.property("footer-nav",fGn.optional()),languageSwitcher:pe.property("language-switcher",dGn.optional()),productSwitcher:pe.property("product-switcher",hGn.optional())});var pxl=pe.object({instances:pe.list(b9n),title:pe.string().optional(),libraries:pe.record(Ppr,U9n).optional(),analytics:JWn.optional(),announcement:ogt.optional(),roles:pe.list(U2t).optional(),tabs:pe.record(Zte,ugt).optional(),versions:pe.list(Epr).optional(),products:pe.list(cGn).optional(),landingPage:pe.property("landing-page",Xte.optional()),navigation:sgt.optional(),navbarLinks:pe.property("navbar-links",pe.list(K9n).optional()),footerLinks:pe.property("footer-links",x9n.optional()),pageActions:pe.property("page-actions",oGn.optional()),experimental:I9n.optional(),defaultLanguage:pe.property("default-language",lGn.optional()),languages:pe.list(bpr).optional(),aiChat:pe.property("ai-chat",xYr.optional()),aiSearch:pe.property("ai-search",xYr.optional()),aiExamples:pe.property("ai-examples",kWn.optional()),metadata:G9n.optional(),redirects:pe.list(pGn).optional(),logo:L9n.optional(),favicon:pe.string().optional(),backgroundImage:pe.property("background-image",a9n.optional()),colors:l9n.optional(),typography:E9n.optional(),layout:M9n.optional(),settings:v9n.optional(),theme:bGn.optional(),integrations:j9n.optional(),css:f9n.optional(),js:D9n.optional(),header:pe.string().optional(),footer:pe.string().optional()});var AGn=pe.object({folder:pe.string(),title:pe.string().optional(),titleSource:pe.property("title-source",Apr.optional()),slug:pe.string().optional(),icon:pe.string().optional(),hidden:pe.boolean().optional(),skipSlug:pe.property("skip-slug",pe.boolean().optional()),collapsed:pe.boolean().optional(),availability:XQ.optional()}).extend(h0).extend(m0);var _Gn=pe.object({library:Ppr,title:pe.string().optional(),slug:pe.string().optional()}).extend(h0).extend(m0);var vGn=pe.object({pythonDocs:pe.property("python-docs",pe.string()),title:pe.string().optional(),slug:pe.string().optional()});var gMe=pe.undiscriminatedUnion([Xte,pe.lazyObject(()=>OGn),e9n,vGn,_Gn,ypr,u9n,AGn]);var fxl=pe.object({tabs:pe.record(Zte,ugt).optional(),landingPage:pe.property("landing-page",Xte.optional()),navigation:sgt});var wGn=pe.object({displayName:pe.property("display-name",pe.string()),path:pe.string(),slug:pe.string().optional()}).extend(h0).extend(m0);var dxl=pe.undiscriminatedUnion([wGn,MWn]);var OGn=pe.object({section:pe.string(),path:pe.string().optional(),contents:pe.list(pe.lazy(()=>gMe)),collapsed:pe.boolean().optional(),slug:pe.string().optional(),icon:pe.string().optional(),hidden:pe.boolean().optional(),skipSlug:pe.property("skip-slug",pe.boolean().optional()),availability:XQ.optional()}).extend(h0).extend(m0);var mxl=pe.object({tabs:pe.record(Zte,ugt).optional(),landingPage:pe.property("landing-page",Xte.optional()),navigation:sgt});var hxl=require("fs/promises");var AiA=/\r?\n/;async function L2t({absolutePathToFernignore:e}){let t=(await(0,hxl.readFile)(e)).toString();return yxl(t)}function yxl(e){return[uMe,...e.trim().split(AiA).map(t=>{let r=t.indexOf("#");return r!==-1?t.slice(0,r).trim():t.trim()}).filter(t=>t.length>0)]}var vi={};Q(vi,{API_ORIGIN_LOCATION_KEY:()=>AIl,API_SETTINGS_KEY:()=>wIl,ASYNC_API_LOCATION_KEY:()=>_Il,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>npr,DEFAULT_GROUP_NAME:()=>gYr,DefaultIntegerFormat:()=>Sxl,ExampleStyle:()=>Bxl,FormParameterEncoding:()=>Dxl,GenerationLanguage:()=>gxl,GithubCommitAndReleaseMode:()=>zxl,GithubLicenseType:()=>qxl,GithubSelfhostedMode:()=>Qxl,Language:()=>Txl,MessageNamingSettingsSchema:()=>Rxl,ModelProvider:()=>_xl,OPENAPI_LOCATION_KEY:()=>vIl,OPENAPI_OVERRIDES_LOCATION_KEY:()=>OIl,PathParameterOrder:()=>Fxl,RemoveDiscriminantsFromSchemas:()=>Nxl,UnionSettingsSchema:()=>Mxl,ai:()=>Sos,fernDefinition:()=>Dos,generators:()=>Tos,getPackageName:()=>bxl,group:()=>Ros,isApiConfigurationV2Schema:()=>gjl,isAsyncApiSpecSchema:()=>bjl,isConjureSchema:()=>Ajl,isGraphQLSpecSchema:()=>_jl,isNamespacedApiConfiguration:()=>vjl,isOpenApiSpecSchema:()=>Ojl,isOpenRpcSpecSchema:()=>wjl,isProtoSpecSchema:()=>Pjl,isRawProtobufAPIDefinitionSchema:()=>Axl,license:()=>Fos,reviewers:()=>Vxl,serialization:()=>tas});var gxl={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function bxl({generatorInvocation:e}){return e.language==="go"?_iA(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function _iA(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}function Axl(e){return typeof e!="string"&&"proto"in e}var Sos={};Q(Sos,{ModelProvider:()=>_xl});var _xl={Openai:"openai",Anthropic:"anthropic",Bedrock:"bedrock"};var Dos={};Q(Dos,{AvailabilityStatusSchema:()=>Oxl,auth:()=>vxl,availability:()=>Bos,commons:()=>wxl,encoding:()=>Pxl,environments:()=>Exl,file:()=>Ixl,service:()=>xxl,types:()=>jxl,validation:()=>Cxl});var vxl={};var Bos={};Q(Bos,{AvailabilityStatusSchema:()=>Oxl});var Oxl={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var wxl={};var Pxl={};var Exl={};var Ixl={};var xxl={};var jxl={};var Cxl={};var Tos={};Q(Tos,{DefaultIntegerFormat:()=>Sxl,ExampleStyle:()=>Bxl,FormParameterEncoding:()=>Dxl,Language:()=>Txl,MessageNamingSettingsSchema:()=>Rxl,PathParameterOrder:()=>Fxl,RemoveDiscriminantsFromSchemas:()=>Nxl,UnionSettingsSchema:()=>Mxl});var Sxl={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};var Bxl={Minimal:"minimal",Comprehensive:"comprehensive"};var Dxl={Form:"form",Json:"json"};var Txl={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};var Rxl={V1:"v1",V2:"v2"};var Fxl={UrlOrder:"url-order",SpecOrder:"spec-order"};var Nxl={Always:"always",Never:"never"};var Mxl={V1:"v1"};var Ros={};Q(Ros,{GithubCommitAndReleaseMode:()=>zxl,GithubSelfhostedMode:()=>Qxl});var zxl={Commit:"commit",Release:"release"};var Qxl={PullRequest:"pull-request",Push:"push"};var Fos={};Q(Fos,{GithubLicenseType:()=>qxl});var qxl={Mit:"MIT",Apache:"Apache-2.0"};var Vxl={};var tas={};Q(tas,{AiServicesSchema:()=>SGn,ApiConfigurationSchema:()=>F7n,ApiConfigurationSchemaInternal:()=>kpr,ApiConfigurationV2Schema:()=>T7n,ApiConfigurationV2SettingsSchema:()=>Wpr,ApiConfigurationV2SpecsSchema:()=>Gpr,ApiDefinitionList:()=>A7n,ApiDefinitionPathSchema:()=>dgt,ApiDefinitionSchema:()=>b7n,ApiDefinitionSettingsSchema:()=>zpr,ApiDefinitionWithOverridesSchema:()=>Qpr,AsyncApiSettingsSchema:()=>Lpr,AsyncApiSpecSchema:()=>x7n,BaseApiSettingsSchema:()=>Upr,ConjureSchema:()=>I7n,CratesOutputLocationSchema:()=>Q7n,DefaultIntegerFormat:()=>_7n,ExampleStyle:()=>N7n,FormParameterEncoding:()=>v7n,GeneratorApiSettingsSchema:()=>z7n,GeneratorGroupSchema:()=>sHn,GeneratorInvocationSchema:()=>aHn,GeneratorOutputSchema:()=>J7n,GeneratorPublishMetadataSchema:()=>NYr,GeneratorSnippetsSchema:()=>X7n,GeneratorsConfigurationSchema:()=>yjl,GeneratorsOpenApiObjectSchema:()=>uHn,GeneratorsOpenApiSchema:()=>cHn,GithubCommitAndReleaseMode:()=>Z7n,GithubCommitAndReleaseSchema:()=>eHn,GithubConfigurationSchema:()=>oHn,GithubLicenseCustomSchema:()=>K7n,GithubLicenseSchema:()=>ere,GithubLicenseType:()=>Y7n,GithubPullRequestSchema:()=>tHn,GithubPushSchema:()=>rHn,GithubSelfhostedMode:()=>nHn,GithubSelfhostedSchema:()=>iHn,GraphQlSpecSchema:()=>j7n,Language:()=>lHn,LocalFileSystemOutputLocationSchema:()=>q7n,MavenOutputLocationSchema:()=>k7n,MavenOutputSignatureSchema:()=>V7n,MessageNamingSettingsSchema:()=>Fpr,ModelName:()=>jGn,ModelProvider:()=>CGn,NamespacedApiConfigurationSchema:()=>R7n,NpmOutputLocationSchema:()=>U7n,NugetOutputLocationSchema:()=>L7n,OpenApiExampleGenerationSchema:()=>O7n,OpenApiFilterSchema:()=>w7n,OpenApiSettingsSchema:()=>mgt,OpenApiSpecSchema:()=>C7n,OpenRpcSpecSchema:()=>S7n,OutputMetadataAuthor:()=>M7n,OutputMetadataSchema:()=>hgt,PathParameterOrder:()=>Npr,PostmanOutputLocationSchema:()=>W7n,ProtobufApiDefinitionSchema:()=>Vpr,ProtobufDefinitionSchema:()=>qpr,ProtobufSpecSchema:()=>B7n,PypiOutputLocationSchema:()=>H7n,PypiOutputMetadataSchema:()=>G7n,ReadmeCustomSectionSchema:()=>pHn,ReadmeEndpointObjectSchema:()=>fHn,ReadmeEndpointSchema:()=>MYr,ReadmeSchema:()=>dHn,RemoveDiscriminantsFromSchemas:()=>Mpr,RequestOrResponseExampleGenerationSchema:()=>RYr,ResolveAliases:()=>E7n,ResolveAliasesSchema:()=>P7n,ReviewerSchema:()=>FYr,ReviewersSchema:()=>ygt,RubyGemsOutputLocationSchema:()=>$7n,SpecSchema:()=>D7n,UnionSettingsSchema:()=>g7n,WhitelabelConfigurationSchema:()=>hHn,WhitelabelGithubConfigurationSchema:()=>mHn,ai:()=>qos,fernDefinition:()=>Kos,generators:()=>Yos,group:()=>Xos,license:()=>Zos,reviewers:()=>eas});var qos={};Q(qos,{AiServicesSchema:()=>SGn,ModelName:()=>jGn,ModelProvider:()=>CGn});var Ue={};Q(Ue,{JsonError:()=>xpr,ParseError:()=>jpr,any:()=>rjl,bigint:()=>Uxl,boolean:()=>njl,booleanLiteral:()=>ejl,date:()=>Lxl,discriminant:()=>djl,enum_:()=>EGn,getObjectLikeUtils:()=>Dxe,getObjectUtils:()=>W2t,getSchemaUtils:()=>Tv,isProperty:()=>cgt,lazy:()=>Wxl,lazyObject:()=>Xxl,list:()=>xGn,never:()=>ijl,number:()=>ojl,object:()=>IGn,objectWithoutOptionalProperties:()=>Yxl,optional:()=>Nos,property:()=>Hxl,record:()=>cjl,set:()=>ljl,string:()=>ajl,stringLiteral:()=>tjl,transform:()=>Mos,undiscriminatedUnion:()=>fjl,union:()=>hjl,unknown:()=>sjl,withParsedProperties:()=>Qos});var Jf={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 g_(e,t){return`Expected ${t}. Received ${viA(e)}.`}function viA(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}function wR(e){return{...e,json:kxl(e.json),parse:kxl(e.parse)}}function kxl(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(`
1527
- `)),{ok:!0,value:t}):n}}function PGn(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var xpr=class e extends Error{errors;constructor(t){super(t.map(PGn).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var jpr=class e extends Error{errors;constructor(t){super(t.map(PGn).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Tv(e){return{nullable:()=>OiA(e),optional:()=>Nos(e),optionalNullable:()=>wiA(e),transform:t=>Mos(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new jpr(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new xpr(n.errors)}}}function OiA(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:()=>Jf.NULLABLE};return{...t,...Tv(t)}}function Nos(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:()=>Jf.OPTIONAL};return{...t,...Tv(t)}}function wiA(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:()=>Jf.OPTIONAL_NULLABLE};return{...t,...Tv(t)}}function Mos(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,...Tv(r)}}function Uxl(){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:g_(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:g_(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Jf.BIGINT};return{...wR(e),...Tv(e)}}var PiA=/^([+-]?\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)?)?)?)?$/;function Lxl(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:g_(t,"string")}]}:PiA.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:g_(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:g_(t,"Date object")}]},getType:()=>Jf.DATE};return{...wR(e),...Tv(e)}}function PR(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...wR(r),...Tv(r)}}}function EGn(e){let t=new Set(e);return PR(Jf.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:g_(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:g_(n,"enum")}]}:{ok:!0,value:n})()}function Wxl(e){let t=zos(e);return{...t,...Tv(t)}}function zos(e){return{parse:(t,r)=>Cpr(e).parse(t,r),json:(t,r)=>Cpr(e).json(t,r),getType:()=>Cpr(e).getType()}}function Cpr(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function BYr(e){return Object.entries(e)}function DYr(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function tat(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function TYr(e){return Object.keys(e)}function Gxl(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function Dxe(e){return{withParsedProperties:t=>Qos(e,t)}}function Qos(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let a=Object.entries(t).reduce((s,[c,l])=>({...s,[c]:typeof l=="function"?l(o.value):l}),{});return{ok:!0,value:{...o.value,...a}}},json:(n,i)=>{if(!tat(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:g_(n,"object")}]};let o=new Set(Object.keys(t)),a=DYr(n,Object.keys(n).filter(s=>!o.has(s)));return e.json(a,i)},getType:()=>e.getType()};return{...r,...Tv(r),...Dxe(r)}}function Hxl(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function cgt(e){return e.isProperty}function IGn(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>cgt(n)?n.rawKey:r),_getParsedProperties:()=>TYr(e),parse:(r,n)=>{let i={},o=[];for(let[a,s]of BYr(e)){let c=cgt(s)?s.rawKey:a,l=cgt(s)?s.valueSchema:s,u={rawKey:c,parsedKey:a,valueSchema:l};i[c]=u,Kxl(l)&&o.push(c)}return $xl({value:r,requiredKeys:o,getProperty:a=>{let s=i[a];if(s!=null)return{transformedKey:s.parsedKey,transform:c=>s.valueSchema.parse(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[o,a]of BYr(e)){let s=cgt(a)?a.valueSchema:a;Kxl(s)&&i.push(o)}return $xl({value:r,requiredKeys:i,getProperty:o=>{let a=e[o];if(a!=null)return cgt(a)?{transformedKey:a.rawKey,transform:s=>a.valueSchema.json(s,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}:{transformedKey:o,transform:s=>a.json(s,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>Jf.OBJECT};return{...wR(t),...Tv(t),...Dxe(t),...W2t(t)}}function $xl({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:o=[]}){if(!tat(e))return{ok:!1,errors:[{path:o,message:g_(e,"object")}]};let a=new Set(t),s=[],c={};for(let[l,u]of Object.entries(e)){let p=r(l);if(p!=null){a.delete(l);let d=p.transform(u);d.ok?c[p.transformedKey]=d.value:(c[l]=u,s.push(...d.errors))}else switch(n){case"fail":s.push({path:[...o,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=u;break}}return s.push(...t.filter(l=>a.has(l)).map(l=>({path:o,message:`Missing required key "${l}"`}))),s.length===0||i?{ok:!0,value:c}:{ok:!1,errors:s}}function W2t(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>Jxl({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>Jxl({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Jf.OBJECT};return{...r,...Tv(r),...Dxe(r),...W2t(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let a=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!a.ok)return a;let s={};if(typeof i=="object"&&i!=null)for(let[c,l]of Object.entries(i))t.has(c)||(s[c]=l);return{ok:!0,value:{...s,...a.value}}},json:(i,o)=>{let a=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!a.ok)return a;let s={};if(typeof i=="object"&&i!=null)for(let[c,l]of Object.entries(i))r.has(c)||(s[c]=l);return{ok:!0,value:{...s,...a.value}}},getType:()=>Jf.OBJECT};return{...n,...Tv(n),...Dxe(n),...W2t(n)}}}}function Jxl({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!tat(t))return{ok:!1,errors:[{path:i,message:g_(t,"object")}]};let o=new Set(e),[a,s]=Gxl(TYr(t),u=>o.has(u)),c=r(DYr(t,s)),l=n(DYr(t,a));return c.ok&&l.ok?{ok:!0,value:{...c.value,...l.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...l.ok?[]:l.errors]}}function Kxl(e){return!EiA(e)}function EiA(e){switch(e.getType()){case Jf.ANY:case Jf.UNKNOWN:case Jf.OPTIONAL:case Jf.OPTIONAL_NULLABLE:return!0;default:return!1}}function Yxl(e){return IGn(e)}function Xxl(e){let t={...zos(e),_getRawProperties:()=>Cpr(e)._getRawProperties(),_getParsedProperties:()=>Cpr(e)._getParsedProperties()};return{...t,...Tv(t),...Dxe(t),...W2t(t)}}function xGn(e){let t={parse:(r,n)=>Zxl(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>Zxl(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Jf.LIST};return{...wR(t),...Tv(t)}}function Zxl(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let o=[];return n.ok||o.push(...n.errors),i.ok||o.push(...i.errors),{ok:!1,errors:o}},{ok:!0,value:[]}):{ok:!1,errors:[{message:g_(e,"list"),path:[]}]}}function ejl(e){return PR(Jf.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:g_(r,`${e.toString()}`)}]})()}function tjl(e){return PR(Jf.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:g_(r,`"${e}"`)}]})()}var rjl=PR(Jf.ANY,e=>({ok:!0,value:e}));var njl=PR(Jf.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:g_(e,"boolean")}]});var ijl=PR(Jf.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var ojl=PR(Jf.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:g_(e,"number")}]});var ajl=PR(Jf.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:g_(e,"string")}]});var sjl=PR(Jf.UNKNOWN,e=>({ok:!0,value:e}));function cjl(e,t){let r={parse:(n,i)=>ujl({value:n,isKeyNumeric:e.getType()===Jf.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,a)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>ujl({value:n,isKeyNumeric:e.getType()===Jf.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,a)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Jf.RECORD};return{...wR(r),...Tv(r)}}function ujl({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return tat(e)?BYr(e).reduce((o,[a,s])=>{if(s===void 0)return o;let c=o,l=a;if(t){let m=a.length>0?Number(a):NaN;Number.isNaN(m)||(l=m)}let u=r(l),p=n(s,l);if(c.ok&&u.ok&&p.ok)return{ok:!0,value:{...c.value,[u.value]:p.value}};let d=[];return c.ok||d.push(...c.errors),u.ok||d.push(...u.errors),p.ok||d.push(...p.errors),{ok:!1,errors:d}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:g_(e,"object")}]}}function ljl(e){let t=xGn(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:g_(n,"Set")}]},getType:()=>Jf.SET};return{...wR(r),...Tv(r)}}function fjl(e){let t={parse:(r,n)=>pjl((i,o)=>i.parse(r,o),e,n),json:(r,n)=>pjl((i,o)=>i.json(r,o),e,n),getType:()=>Jf.UNDISCRIMINATED_UNION};return{...wR(t),...Tv(t)}}function pjl(e,t,r){let n=[];for(let[i,o]of t.entries()){let a=e(o,{...r,skipValidation:!1});if(a.ok)return a;for(let s of a.errors)n.push({path:s.path,message:`[Variant ${i}] ${s.message}`})}return{ok:!1,errors:n}}function djl(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function hjl(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=EGn(TYr(t)),o={parse:(a,s)=>mjl({value:a,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,l)=>l.parse(c,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(a,s)=>mjl({value:a,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,l)=>l.json(c,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>Jf.UNION};return{...wR(o),...Tv(o),...Dxe(o)}}function mjl({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!tat(e))return{ok:!1,errors:[{path:s,message:g_(e,"object")}]};let{[t]:c,...l}=e;if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${t}")`}]};let u=n(c);if(!u.ok)return{ok:!1,errors:u.errors};let p=i(u.value);if(p==null)return o?{ok:!0,value:{[r]:u.value,...l}}:{ok:!1,errors:[{path:[...s,t],message:"Unexpected discriminant value"}]};let d=a(l,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var jGn=Ue.string();var CGn=Ue.enum_(["openai","anthropic","bedrock"]);var SGn=Ue.object({provider:CGn,model:jGn});var Kos={};Q(Kos,{AnyAuthItem:()=>BGn,AnyAuthSchemesSchema:()=>DGn,ApiAuthSchema:()=>Bpr,AuthSchemeDeclarationSchema:()=>pgt,AuthSchemeReferenceSchema:()=>Spr,AuthScope:()=>UGn,AuthVariable:()=>G2t,AvailabilitySchema:()=>YGn,AvailabilityStatusSchema:()=>Tpr,AvailabilityUnionSchema:()=>XGn,BaseTypeReferenceSchema:()=>p7n,BasicAuthSchemeSchema:()=>FGn,BearerAuthSchemeSchema:()=>VGn,EncodingSchema:()=>t7n,EndpointSecuritySchema:()=>RGn,EndpointSecuritySchemaDetails:()=>TGn,EnvironmentSchema:()=>i7n,HeaderAuthSchemeSchema:()=>kGn,HttpHeaderSchema:()=>h7n,InferredAuthenticatedRequestHeader:()=>NGn,InferredBearerAuthSchema:()=>QGn,InferredGetTokenEndpointSchema:()=>zGn,InferredGetTokenEndpointSchemaObject:()=>MGn,ListValidationSchema:()=>a7n,MapValidationSchema:()=>s7n,MultipleBaseUrlsEnvironmentSchema:()=>r7n,NumberValidationSchema:()=>u7n,OAuthAccessTokenRequestPropertiesSchema:()=>LGn,OAuthAccessTokenResponsePropertiesSchema:()=>WGn,OAuthGetTokenEndpointSchema:()=>GGn,OAuthRefreshTokenEndpointSchema:()=>JGn,OAuthRefreshTokenRequestPropertiesSchema:()=>HGn,OAuthRefreshTokenResponsePropertiesSchema:()=>$Gn,OAuthSchemeSchema:()=>KGn,ProtobufTypeSchema:()=>e7n,ServerVariableSchema:()=>Rpr,SingleBaseUrlEnvironmentSchema:()=>n7n,StringValidationSchema:()=>c7n,TokenBearerAuthSchema:()=>qGn,TypeReferenceDeclarationWithEnvOverride:()=>m7n,TypeReferenceDeclarationWithEnvOverrideSchema:()=>d7n,TypeReferenceDeclarationWithName:()=>f7n,ValidationSchema:()=>l7n,WithAudiences:()=>fgt,WithAvailability:()=>ZGn,WithDocsSchema:()=>LI,WithEnvironmentVariable:()=>Dpr,WithEnvironmentsSchema:()=>o7n,WithHeadersSchema:()=>y7n,WithName:()=>lgt,auth:()=>Vos,availability:()=>kos,commons:()=>Uos,encoding:()=>Los,environments:()=>Wos,file:()=>Gos,service:()=>Hos,types:()=>$os,validation:()=>Jos});var Vos={};Q(Vos,{AnyAuthItem:()=>BGn,AnyAuthSchemesSchema:()=>DGn,ApiAuthSchema:()=>Bpr,AuthSchemeDeclarationSchema:()=>pgt,AuthSchemeReferenceSchema:()=>Spr,AuthScope:()=>UGn,AuthVariable:()=>G2t,BasicAuthSchemeSchema:()=>FGn,BearerAuthSchemeSchema:()=>VGn,EndpointSecuritySchema:()=>RGn,EndpointSecuritySchemaDetails:()=>TGn,HeaderAuthSchemeSchema:()=>kGn,InferredAuthenticatedRequestHeader:()=>NGn,InferredBearerAuthSchema:()=>QGn,InferredGetTokenEndpointSchema:()=>zGn,InferredGetTokenEndpointSchemaObject:()=>MGn,OAuthAccessTokenRequestPropertiesSchema:()=>LGn,OAuthAccessTokenResponsePropertiesSchema:()=>WGn,OAuthGetTokenEndpointSchema:()=>GGn,OAuthRefreshTokenEndpointSchema:()=>JGn,OAuthRefreshTokenRequestPropertiesSchema:()=>HGn,OAuthRefreshTokenResponsePropertiesSchema:()=>$Gn,OAuthSchemeSchema:()=>KGn,TokenBearerAuthSchema:()=>qGn,WithEnvironmentVariable:()=>Dpr});var LI=Ue.object({docs:Ue.string().optional()});var Spr=Ue.object({scheme:Ue.string()}).extend(LI);var BGn=Ue.undiscriminatedUnion([Ue.string(),Spr]);var DGn=Ue.object({any:Ue.list(BGn)}).extend(LI);var TGn=Ue.object({});var RGn=Ue.object({"endpoint-security":TGn}).extend(LI);var Bpr=Ue.undiscriminatedUnion([Ue.string(),Spr,DGn,RGn]);var lgt=Ue.object({name:Ue.string().optional()});var Dpr=Ue.object({env:Ue.string().optional()});var G2t=Ue.object({omit:Ue.boolean().optional()}).extend(Dpr).extend(lgt);var FGn=Ue.object({scheme:Ue.stringLiteral("basic"),username:G2t.optional(),password:G2t.optional()}).extend(LI);var NGn=Ue.object({"response-property":Ue.string(),"header-name":Ue.string(),"value-prefix":Ue.string().optional()});var MGn=Ue.object({endpoint:Ue.string(),"expiry-response-property":Ue.string().optional(),"authenticated-request-headers":Ue.list(NGn).optional()});var zGn=Ue.undiscriminatedUnion([Ue.string(),MGn]);var QGn=Ue.object({scheme:Ue.stringLiteral("bearer"),"get-token":zGn}).extend(LI);var qGn=Ue.object({scheme:Ue.stringLiteral("bearer"),token:G2t.optional()}).extend(LI);var VGn=Ue.undiscriminatedUnion([qGn,QGn]);var kGn=Ue.object({header:Ue.string(),type:Ue.string().optional(),prefix:Ue.string().optional()}).extend(Dpr).extend(lgt).extend(LI);var UGn=Ue.string();var LGn=Ue.object({"client-id":Ue.string().optional(),"client-secret":Ue.string().optional(),scopes:Ue.string().optional()});var WGn=Ue.object({"access-token":Ue.string().optional(),"expires-in":Ue.string().optional(),"refresh-token":Ue.string().optional()});var GGn=Ue.object({endpoint:Ue.string(),"request-properties":LGn.optional(),"response-properties":WGn.optional()});var HGn=Ue.object({"refresh-token":Ue.string()});var $Gn=Ue.object({"access-token":Ue.string().optional(),"expires-in":Ue.string().optional(),"refresh-token":Ue.string().optional()});var JGn=Ue.object({endpoint:Ue.string(),"request-properties":HGn.optional(),"response-properties":$Gn.optional()});var KGn=Ue.object({scheme:Ue.stringLiteral("oauth"),type:Ue.stringLiteral("client-credentials"),scopes:Ue.list(UGn).optional(),"client-id-env":Ue.string().optional(),"client-secret-env":Ue.string().optional(),"token-prefix":Ue.string().optional(),"token-header":Ue.string().optional(),"get-token":GGn,"refresh-token":JGn.optional()}).extend(LI);var pgt=Ue.undiscriminatedUnion([KGn,kGn,FGn,VGn]);var kos={};Q(kos,{AvailabilitySchema:()=>YGn,AvailabilityStatusSchema:()=>Tpr,AvailabilityUnionSchema:()=>XGn});var Tpr=Ue.enum_(["in-development","pre-release","deprecated","generally-available"]);var YGn=Ue.object({status:Tpr,message:Ue.string().optional()});var XGn=Ue.undiscriminatedUnion([Tpr,YGn]);var Uos={};Q(Uos,{WithAudiences:()=>fgt,WithAvailability:()=>ZGn,WithDocsSchema:()=>LI,WithName:()=>lgt});var fgt=Ue.object({audiences:Ue.list(Ue.string()).optional()});var ZGn=Ue.object({availability:XGn.optional()});var Los={};Q(Los,{EncodingSchema:()=>t7n,ProtobufTypeSchema:()=>e7n});var e7n=Ue.object({type:Ue.string()});var t7n=Ue.object({proto:e7n.optional()});var Wos={};Q(Wos,{EnvironmentSchema:()=>i7n,MultipleBaseUrlsEnvironmentSchema:()=>r7n,ServerVariableSchema:()=>Rpr,SingleBaseUrlEnvironmentSchema:()=>n7n,WithEnvironmentsSchema:()=>o7n});var Rpr=Ue.object({id:Ue.string(),default:Ue.string().optional(),values:Ue.list(Ue.string()).optional()});var r7n=Ue.object({urls:Ue.record(Ue.string(),Ue.string()),"url-templates":Ue.record(Ue.string(),Ue.string()).optional(),"default-urls":Ue.record(Ue.string(),Ue.string()).optional(),variables:Ue.record(Ue.string(),Ue.list(Rpr)).optional()}).extend(fgt).extend(LI);var n7n=Ue.object({url:Ue.string(),"default-url":Ue.string().optional(),"url-template":Ue.string().optional(),variables:Ue.list(Rpr).optional()}).extend(fgt).extend(LI);var i7n=Ue.undiscriminatedUnion([Ue.string(),n7n,r7n]);var o7n=Ue.object({"default-url":Ue.string().optional(),"default-environment":Ue.string().optional(),environments:Ue.record(Ue.string(),i7n).optional()});var Gos={};Q(Gos,{WithHeadersSchema:()=>y7n});var a7n=Ue.object({minItems:Ue.number().optional(),maxItems:Ue.number().optional()});var s7n=Ue.object({minProperties:Ue.number().optional(),maxProperties:Ue.number().optional()});var u7n=Ue.object({min:Ue.number().optional(),max:Ue.number().optional(),exclusiveMin:Ue.boolean().optional(),exclusiveMax:Ue.boolean().optional(),multipleOf:Ue.number().optional()});var c7n=Ue.object({minLength:Ue.number().optional(),maxLength:Ue.number().optional(),pattern:Ue.string().optional(),format:Ue.string().optional()});var l7n=Ue.undiscriminatedUnion([c7n,u7n,a7n,s7n]);var p7n=Ue.object({default:Ue.unknown().optional(),encoding:t7n.optional(),validation:l7n.optional()}).extend(LI).extend(ZGn);var f7n=Ue.object({type:Ue.string()}).extend(p7n).extend(lgt).extend(fgt);var d7n=Ue.object({env:Ue.string().optional()}).extend(f7n);var m7n=Ue.undiscriminatedUnion([Ue.string(),d7n]);var h7n=m7n;var y7n=Ue.object({headers:Ue.record(Ue.string(),h7n).optional()});var Hos={};Q(Hos,{HttpHeaderSchema:()=>h7n,TypeReferenceDeclarationWithEnvOverride:()=>m7n,TypeReferenceDeclarationWithEnvOverrideSchema:()=>d7n});var $os={};Q($os,{BaseTypeReferenceSchema:()=>p7n,TypeReferenceDeclarationWithName:()=>f7n});var Jos={};Q(Jos,{ListValidationSchema:()=>a7n,MapValidationSchema:()=>s7n,NumberValidationSchema:()=>u7n,StringValidationSchema:()=>c7n,ValidationSchema:()=>l7n});var Yos={};Q(Yos,{ApiConfigurationSchema:()=>F7n,ApiConfigurationSchemaInternal:()=>kpr,ApiConfigurationV2Schema:()=>T7n,ApiConfigurationV2SettingsSchema:()=>Wpr,ApiConfigurationV2SpecsSchema:()=>Gpr,ApiDefinitionList:()=>A7n,ApiDefinitionPathSchema:()=>dgt,ApiDefinitionSchema:()=>b7n,ApiDefinitionSettingsSchema:()=>zpr,ApiDefinitionWithOverridesSchema:()=>Qpr,AsyncApiSettingsSchema:()=>Lpr,AsyncApiSpecSchema:()=>x7n,BaseApiSettingsSchema:()=>Upr,ConjureSchema:()=>I7n,DefaultIntegerFormat:()=>_7n,ExampleStyle:()=>N7n,FormParameterEncoding:()=>v7n,GeneratorsConfigurationSchema:()=>yjl,GeneratorsOpenApiObjectSchema:()=>uHn,GeneratorsOpenApiSchema:()=>cHn,GraphQlSpecSchema:()=>j7n,Language:()=>lHn,MessageNamingSettingsSchema:()=>Fpr,NamespacedApiConfigurationSchema:()=>R7n,OpenApiExampleGenerationSchema:()=>O7n,OpenApiFilterSchema:()=>w7n,OpenApiSettingsSchema:()=>mgt,OpenApiSpecSchema:()=>C7n,OpenRpcSpecSchema:()=>S7n,OutputMetadataAuthor:()=>M7n,OutputMetadataSchema:()=>hgt,PathParameterOrder:()=>Npr,ProtobufApiDefinitionSchema:()=>Vpr,ProtobufDefinitionSchema:()=>qpr,ProtobufSpecSchema:()=>B7n,ReadmeCustomSectionSchema:()=>pHn,ReadmeEndpointObjectSchema:()=>fHn,ReadmeEndpointSchema:()=>MYr,ReadmeSchema:()=>dHn,RemoveDiscriminantsFromSchemas:()=>Mpr,RequestOrResponseExampleGenerationSchema:()=>RYr,ResolveAliases:()=>E7n,ResolveAliasesSchema:()=>P7n,SpecSchema:()=>D7n,UnionSettingsSchema:()=>g7n,WhitelabelConfigurationSchema:()=>hHn,WhitelabelGithubConfigurationSchema:()=>mHn});var dgt=Ue.string();var Fpr=Ue.enum_(["v1","v2"]);var Npr=Ue.enum_(["url-order","spec-order"]);var Mpr=Ue.enum_(["always","never"]);var g7n=Ue.enum_(["v1"]);var zpr=Ue.object({"use-title":Ue.boolean().optional(),unions:g7n.optional(),"message-naming":Fpr.optional(),"respect-nullable-schemas":Ue.boolean().optional(),"only-include-referenced-schemas":Ue.boolean().optional(),"inline-path-parameters":Ue.boolean().optional(),"idiomatic-request-names":Ue.boolean().optional(),"wrap-references-to-nullable-in-optional":Ue.boolean().optional(),"coerce-optional-schemas-to-nullable":Ue.boolean().optional(),"group-environments-by-host":Ue.boolean().optional(),"remove-discriminants-from-schemas":Mpr.optional(),"path-parameter-order":Npr.optional()});var Qpr=Ue.object({path:dgt,origin:Ue.string().optional(),overrides:Ue.string().optional(),audiences:Ue.list(Ue.string()).optional(),settings:zpr.optional()});var qpr=Ue.object({target:Ue.string().optional(),root:Ue.string(),overrides:Ue.string().optional(),"local-generation":Ue.boolean().optional(),"from-openapi":Ue.boolean().optional(),dependencies:Ue.list(Ue.string()).optional()});var Vpr=Ue.object({proto:qpr});var b7n=Ue.undiscriminatedUnion([dgt,Qpr,Vpr]);var A7n=Ue.list(b7n);var kpr=Ue.undiscriminatedUnion([dgt,Qpr,A7n,Vpr]);var Upr=Ue.object({"respect-nullable-schemas":Ue.boolean().optional(),"title-as-schema-name":Ue.boolean().optional(),"optional-additional-properties":Ue.boolean().optional(),"coerce-enums-to-literals":Ue.boolean().optional(),"idiomatic-request-names":Ue.boolean().optional(),"wrap-references-to-nullable-in-optional":Ue.boolean().optional(),"coerce-optional-schemas-to-nullable":Ue.boolean().optional(),"group-environments-by-host":Ue.boolean().optional(),"remove-discriminants-from-schemas":Mpr.optional(),"path-parameter-order":Npr.optional(),"resolve-schema-collisions":Ue.boolean().optional()});var Lpr=Ue.object({"message-naming":Fpr.optional()}).extend(Upr);var _7n=Ue.enum_(["int32","int64","uint32","uint64"]);var v7n=Ue.enum_(["form","json"]);var RYr=Ue.object({"max-depth":Ue.number().optional()});var O7n=Ue.object({request:RYr.optional(),response:RYr.optional()});var w7n=Ue.object({endpoints:Ue.list(Ue.string()).optional()});var P7n=Ue.object({except:Ue.list(Ue.string()).optional()});var E7n=Ue.undiscriminatedUnion([Ue.boolean(),P7n]);var mgt=Ue.object({"only-include-referenced-schemas":Ue.boolean().optional(),"inline-path-parameters":Ue.boolean().optional(),"prefer-undiscriminated-unions-with-literals":Ue.boolean().optional(),"object-query-parameters":Ue.boolean().optional(),"respect-readonly-schemas":Ue.boolean().optional(),"respect-forward-compatible-enums":Ue.boolean().optional(),"use-bytes-for-binary-response":Ue.boolean().optional(),"default-form-parameter-encoding":v7n.optional(),filter:w7n.optional(),"example-generation":O7n.optional(),"additional-properties-defaults-to":Ue.boolean().optional(),"type-dates-as-strings":Ue.boolean().optional(),"preserve-single-schema-oneof":Ue.boolean().optional(),"inline-all-of-schemas":Ue.boolean().optional(),"resolve-aliases":E7n.optional(),"group-multi-api-environments":Ue.boolean().optional(),"default-integer-format":_7n.optional()}).extend(Upr);var Wpr=Ue.object({}).extend(mgt).extend(Lpr);var I7n=Ue.object({conjure:Ue.string()});var x7n=Ue.object({asyncapi:Ue.string(),origin:Ue.string().optional(),overrides:Ue.string().optional(),namespace:Ue.string().optional(),settings:Lpr.optional()});var j7n=Ue.object({graphql:Ue.string(),origin:Ue.string().optional(),overrides:Ue.string().optional(),resource:Ue.string().optional()});var C7n=Ue.object({openapi:Ue.string(),origin:Ue.string().optional(),overrides:Ue.string().optional(),overlays:Ue.string().optional(),namespace:Ue.string().optional(),settings:mgt.optional()});var S7n=Ue.object({openrpc:Ue.string(),overrides:Ue.string().optional(),namespace:Ue.string().optional()});var B7n=Ue.object({proto:qpr});var D7n=Ue.undiscriminatedUnion([C7n,x7n,B7n,S7n,j7n]);var Gpr=Ue.undiscriminatedUnion([Ue.list(D7n),I7n]);var T7n=Ue.object({auth:Bpr.optional(),"auth-schemes":Ue.record(Ue.string(),pgt).optional(),specs:Gpr,settings:Wpr.optional()}).extend(y7n).extend(o7n);var R7n=Ue.object({namespaces:Ue.record(Ue.string(),kpr)});var F7n=Ue.undiscriminatedUnion([kpr,R7n,T7n]);var N7n=Ue.enum_(["minimal","comprehensive"]);var M7n=Ue.object({name:Ue.string(),email:Ue.string()});var hgt=Ue.object({description:Ue.string().optional(),authors:Ue.list(M7n).optional()});var FYr=Ue.object({name:Ue.string()});var ygt=Ue.object({teams:Ue.list(FYr).optional(),users:Ue.list(FYr).optional()});var z7n=Ue.object({auth:Bpr.optional(),"auth-schemes":Ue.record(Ue.string(),pgt).optional(),settings:Wpr.optional(),specs:Gpr.optional()});var Q7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),token:Ue.string().optional()});var q7n=Ue.object({path:Ue.string()});var V7n=Ue.object({keyId:Ue.string(),password:Ue.string(),secretKey:Ue.string()});var k7n=Ue.object({url:Ue.string().optional(),coordinate:Ue.string(),username:Ue.string().optional(),password:Ue.string().optional(),signature:V7n.optional()});var U7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),token:Ue.string().optional()});var L7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),"api-key":Ue.string().optional()});var W7n=Ue.object({"api-key":Ue.string(),"workspace-id":Ue.string(),"collection-id":Ue.string().optional()});var G7n=Ue.object({keywords:Ue.list(Ue.string()).optional(),"documentation-link":Ue.string().optional(),"homepage-link":Ue.string().optional()}).extend(hgt);var H7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),token:Ue.string().optional(),username:Ue.string().optional(),password:Ue.string().optional(),metadata:G7n.optional()});var $7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),"api-key":Ue.string().optional()});var J7n=Ue.union("location",{npm:U7n,maven:k7n,pypi:H7n,postman:W7n,"local-file-system":q7n,nuget:L7n,rubygems:$7n,crates:Q7n}).transform({transform:e=>e,untransform:e=>e});var K7n=Ue.object({custom:Ue.string()});var Y7n=Ue.enum_(["MIT","Apache-2.0"]);var ere=Ue.undiscriminatedUnion([Y7n,K7n]);var NYr=Ue.object({"package-description":Ue.string().optional(),email:Ue.string().optional(),"reference-url":Ue.string().optional(),author:Ue.string().optional(),license:ere.optional()});var X7n=Ue.object({path:Ue.string()});var Z7n=Ue.enum_(["commit","release"]);var eHn=Ue.object({repository:Ue.string(),license:ere.optional(),mode:Z7n.optional()});var tHn=Ue.object({repository:Ue.string(),branch:Ue.string().optional(),license:ere.optional(),mode:Ue.stringLiteral("pull-request"),reviewers:ygt.optional()});var rHn=Ue.object({repository:Ue.string(),license:ere.optional(),mode:Ue.stringLiteral("push"),branch:Ue.string().optional()});var nHn=Ue.enum_(["pull-request","push"]);var iHn=Ue.object({uri:Ue.string(),token:Ue.string(),mode:nHn.optional(),branch:Ue.string().optional(),license:ere.optional()});var oHn=Ue.undiscriminatedUnion([iHn,eHn,tHn,rHn]);var aHn=Ue.object({name:Ue.string(),version:Ue.string(),output:J7n.optional(),github:oHn.optional(),config:Ue.unknown().optional(),metadata:NYr.optional(),keywords:Ue.list(Ue.string()).optional(),snippets:X7n.optional(),"ir-version":Ue.string().optional(),"smart-casing":Ue.boolean().optional(),api:z7n.optional(),"disable-examples":Ue.boolean().optional(),"publish-metadata":NYr.optional(),autorelease:Ue.boolean().optional()});var sHn=Ue.object({audiences:Ue.list(Ue.string()).optional(),generators:Ue.list(aHn),metadata:hgt.optional(),reviewers:ygt.optional()});var uHn=Ue.object({path:Ue.string(),origin:Ue.string().optional(),overrides:Ue.string().optional(),"disable-examples":Ue.boolean().optional(),settings:mgt});var cHn=Ue.undiscriminatedUnion([uHn,Ue.string()]);var lHn=Ue.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var pHn=Ue.object({title:Ue.string(),language:lHn,content:Ue.string()});var fHn=Ue.object({method:Ue.string(),path:Ue.string(),stream:Ue.boolean().optional()});var MYr=Ue.undiscriminatedUnion([Ue.string(),fHn]);var dHn=Ue.object({bannerLink:Ue.string().optional(),introduction:Ue.string().optional(),apiReferenceLink:Ue.string().optional(),apiName:Ue.string().optional(),disabledSections:Ue.list(Ue.string()).optional(),defaultEndpoint:MYr.optional(),features:Ue.record(Ue.string(),Ue.list(MYr)).optional(),customSections:Ue.list(pHn).optional(),exampleStyle:N7n.optional()});var mHn=Ue.object({username:Ue.string(),email:Ue.string(),token:Ue.string()});var hHn=Ue.object({github:mHn.optional()});var yjl=Ue.object({"auth-schemes":Ue.record(Ue.string(),pgt).optional(),api:F7n.optional(),whitelabel:hHn.optional(),metadata:hgt.optional(),readme:dHn.optional(),"default-group":Ue.string().optional(),aliases:Ue.record(Ue.string(),Ue.list(Ue.string())).optional(),groups:Ue.record(Ue.string(),sHn).optional(),reviewers:ygt.optional(),ai:SGn.optional(),autorelease:Ue.boolean().optional(),openapi:cHn.optional(),"openapi-overrides":Ue.string().optional(),"spec-origin":Ue.string().optional(),"async-api":Ue.string().optional(),"api-settings":zpr.optional()});var Xos={};Q(Xos,{CratesOutputLocationSchema:()=>Q7n,GeneratorApiSettingsSchema:()=>z7n,GeneratorGroupSchema:()=>sHn,GeneratorInvocationSchema:()=>aHn,GeneratorOutputSchema:()=>J7n,GeneratorPublishMetadataSchema:()=>NYr,GeneratorSnippetsSchema:()=>X7n,GithubCommitAndReleaseMode:()=>Z7n,GithubCommitAndReleaseSchema:()=>eHn,GithubConfigurationSchema:()=>oHn,GithubPullRequestSchema:()=>tHn,GithubPushSchema:()=>rHn,GithubSelfhostedMode:()=>nHn,GithubSelfhostedSchema:()=>iHn,LocalFileSystemOutputLocationSchema:()=>q7n,MavenOutputLocationSchema:()=>k7n,MavenOutputSignatureSchema:()=>V7n,NpmOutputLocationSchema:()=>U7n,NugetOutputLocationSchema:()=>L7n,PostmanOutputLocationSchema:()=>W7n,PypiOutputLocationSchema:()=>H7n,PypiOutputMetadataSchema:()=>G7n,RubyGemsOutputLocationSchema:()=>$7n});var Zos={};Q(Zos,{GithubLicenseCustomSchema:()=>K7n,GithubLicenseSchema:()=>ere,GithubLicenseType:()=>Y7n});var eas={};Q(eas,{ReviewerSchema:()=>FYr,ReviewersSchema:()=>ygt});function gjl(e){return e?.specs!=null}function bjl(e){return e?.asyncapi!=null}function Ajl(e){return e?.conjure!=null}function _jl(e){return e?.graphql!=null}function vjl(e){return e?.namespaces!=null}function Ojl(e){return e?.openapi!=null}function wjl(e){return e?.openrpc!=null}function Pjl(e){return e?.proto!=null}var IiA={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!0,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,groupEnvironmentsByHost:!1,removeDiscriminantsFromSchemas:vi.RemoveDiscriminantsFromSchemas.Always};function xiA(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,a={};for(let s of Object.keys(t))i.has(s)?a[s]=n?.[s]!==void 0?n[s]:t[s]:o.has(s)?a[s]=n?.[s]!==void 0?n[s]:r?.[s]!==void 0?r[s]:void 0:a[s]=n?.[s]??r?.[s]??t[s];return a}function H2t({options:e,overrides:t}){return xiA({defaults:IiA,options:e,overrides:t})}var Hpr={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Hpr._visit(this,t)}}),_visit:(e,t)=>e.type==="protobuf"?t.protobuf(e):t._other(e)};var ER={basic:e=>({...e,type:"basic",_visit:function(t){return ER._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return ER._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return ER._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return ER._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return ER._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 ZQ={openapi:e=>({...e,type:"openapi",_visit:function(t){return ZQ._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return ZQ._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 Al={primitive:e=>({value:e,type:"primitive",_visit:function(t){return Al._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Al._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return Al._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return Al._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return Al._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return Al._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Al._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return Al._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return Al._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 ggt={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return ggt._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return ggt._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 bgt={boolean:e=>({value:e,type:"boolean",_visit:function(t){return bgt._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return bgt._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 Ga={int:e=>({value:e,type:"int",_visit:function(t){return Ga._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return Ga._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return Ga._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return Ga._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return Ga._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return Ga._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Ga._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return Ga._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return Ga._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return Ga._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return Ga._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"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 yHn={};Q(yHn,{Availability:()=>IR,CustomCodeSample:()=>bMe,EndpointExample:()=>tre,EndpointResponseExample:()=>rre,HttpMethod:()=>xR,LiteralSchemaValue:()=>WP,MultipartRequestPropertyEncoding:()=>ras,MultipartSchema:()=>AMe,OneOfSchema:()=>_Me,Pagination:()=>JJ,PrimitiveSchemaValue:()=>Ph,Request:()=>Txe,Response:()=>rz,RetriesConfiguration:()=>zYr,Schema:()=>Pc,SupportedSdkLanguage:()=>jR,WebhookHttpMethod:()=>nas,WebsocketMessageOrigin:()=>ias});var jiA={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated"},IR={...jiA,_visit:(e,t)=>{switch(e){case IR.GenerallyAvailable:return t.generallyAvailable();case IR.Beta:return t.beta();case IR.Deprecated:return t.deprecated();default:return t._other()}}};var bMe={language:e=>({...e,type:"language",_visit:function(t){return bMe._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return bMe._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 tre={unknown:e=>({value:e,type:"unknown",_visit:function(t){return tre._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return tre._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 rre={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return rre._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return rre._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 CiA={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE"},xR={...CiA,_visit:(e,t)=>{switch(e){case xR.Get:return t.get();case xR.Post:return t.post();case xR.Put:return t.put();case xR.Patch:return t.patch();case xR.Delete:return t.delete();case xR.Head:return t.head();case xR.Options:return t.options();case xR.Trace:return t.trace();default:return t._other()}}};var WP={boolean:e=>({value:e,type:"boolean",_visit:function(t){return WP._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return WP._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 SiA={Json:"json",Form:"form"},ras={...SiA,_visit:(e,t)=>{switch(e){case ras.Json:return t.json();case ras.Form:return t.form();default:return t._other()}}};var AMe={file:e=>({...e,type:"file",_visit:function(t){return AMe._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return AMe._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 _Me={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return _Me._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return _Me._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 JJ={cursor:e=>({...e,type:"cursor",_visit:function(t){return JJ._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return JJ._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return JJ._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);default:return t._other(e)}}};var Ph={int:e=>({...e,type:"int",_visit:function(t){return Ph._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Ph._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Ph._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Ph._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Ph._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Ph._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Ph._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Ph._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Ph._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Ph._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Ph._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"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var Txe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Txe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Txe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Txe._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return Txe._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 rz={file:e=>({...e,type:"file",_visit:function(t){return rz._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return rz._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return rz._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return rz._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return rz._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return rz._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return rz._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 zYr={disabled:e=>({value:e,type:"disabled",_visit:function(t){return zYr._visit(this,t)}}),_visit:(e,t)=>e.type==="disabled"?t.disabled(e.value):t._other(e)};var Pc={primitive:e=>({...e,type:"primitive",_visit:function(t){return Pc._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Pc._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Pc._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Pc._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Pc._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Pc._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Pc._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Pc._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Pc._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Pc._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Pc._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 BiA={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"},jR={...BiA,_visit:(e,t)=>{switch(e){case jR.Curl:return t.curl();case jR.Python:return t.python();case jR.Javascript:return t.javascript();case jR.Typescript:return t.typescript();case jR.Go:return t.go();case jR.Ruby:return t.ruby();case jR.Csharp:return t.csharp();case jR.Java:return t.java();case jR.Js:return t.js();case jR.Node:return t.node();case jR.Ts:return t.ts();case jR.Nodets:return t.nodets();case jR.Golang:return t.golang();case jR.Dotnet:return t.dotnet();case jR.Jvm:return t.jvm();default:return t._other()}}};var DiA={Get:"GET",Post:"POST"},nas={...DiA,_visit:(e,t)=>{switch(e){case nas.Get:return t.get();case nas.Post:return t.post();default:return t._other()}}};var TiA={Client:"client",Server:"server"},ias={...TiA,_visit:(e,t)=>{switch(e){case ias.Client:return t.client();case ias.Server:return t.server();default:return t._other()}}};var KJ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return KJ._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return KJ._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 Yo={int:e=>({...e,type:"int",_visit:function(t){return Yo._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Yo._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Yo._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Yo._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Yo._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Yo._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Yo._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Yo._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Yo._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Yo._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Yo._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"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var BU={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return BU._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return BU._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return BU._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return BU._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 Gw={file:e=>({...e,type:"file",_visit:function(t){return Gw._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Gw._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Gw._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return Gw._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Gw._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Gw._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Gw._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 Bn={primitive:e=>({...e,type:"primitive",_visit:function(t){return Bn._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Bn._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Bn._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Bn._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Bn._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Bn._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Bn._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Bn._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Bn._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Bn._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Bn._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 Ec={};Q(Ec,{AllOfPropertyConflict:()=>efr,ArraySchema:()=>LHn,ArraySchemaWithExample:()=>U$n,Availability:()=>jHn,Base64WithExample:()=>L$n,BasicSecurityScheme:()=>vHn,BearerSecurityScheme:()=>OHn,BooleanSchema:()=>WHn,BooleanWithExample:()=>W$n,BytesResponse:()=>tfr,CasingOverrides:()=>THn,CommonProperty:()=>GHn,CommonPropertyWithExample:()=>G$n,CursorPagination:()=>HHn,CustomCodeSample:()=>YHn,CustomCodeSampleLanguage:()=>$Hn,CustomCodeSampleSdk:()=>KHn,CustomPagination:()=>XHn,DateWithExample:()=>$$n,DatetimeWithExample:()=>H$n,DiscriminatedOneOfSchema:()=>ZHn,DiscriminatedOneOfSchemaWithExample:()=>J$n,DoubleSchema:()=>e$n,DoubleWithExample:()=>K$n,Encoding:()=>PHn,Endpoint:()=>h$n,EndpointExample:()=>ifr,EndpointResponseExample:()=>n$n,EndpointSdkName:()=>wMe,EndpointSecurity:()=>ofr,EndpointWithExample:()=>eCl,EnumSchema:()=>Ypr,EnumSchemaWithExample:()=>iJn,EnumValue:()=>vgt,ErrorExample:()=>a$n,FernExample:()=>t$n,FileResponse:()=>dfr,FileSchema:()=>f$n,FloatWithExample:()=>oJn,FormUrlEncodedRequest:()=>c$n,FullEndpointExample:()=>o$n,FullExample:()=>y0,FullObjectExample:()=>VHn,FullOneOfExample:()=>kHn,GlobalHeader:()=>y$n,GlobalSecurity:()=>g$n,Header:()=>wgt,HeaderExample:()=>rfr,HeaderSecurityScheme:()=>EHn,HeaderWithExample:()=>xgt,HttpEndpointServer:()=>afr,HttpError:()=>s$n,HttpErrorWithExample:()=>Y$n,HttpMethod:()=>sfr,IdempotencyHeader:()=>b$n,Int64WithExample:()=>aJn,IntSchema:()=>A$n,IntWithExample:()=>sJn,JsonRequest:()=>l$n,JsonRequestWithExample:()=>Z$n,JsonResponse:()=>mfr,JsonResponseWithExample:()=>Ofr,KeyValuePair:()=>UHn,LiteralExample:()=>QHn,LiteralSchema:()=>gfr,LiteralSchemaValue:()=>_$n,LongSchema:()=>v$n,MapSchema:()=>P$n,MapSchemaWithExample:()=>fJn,MultipartFormDataWebhookPayload:()=>E$n,MultipartFormDataWebhookPayloadWithExample:()=>dJn,MultipartRequest:()=>pfr,MultipartRequestProperty:()=>Pgt,MultipartRequestPropertyEncoding:()=>p$n,MultipartSchema:()=>d$n,NamedFullExample:()=>D5,Namespace:()=>IHn,NamespaceId:()=>xHn,NullExample:()=>qHn,NullableSchema:()=>I$n,NullableSchemaWithExample:()=>mJn,OauthSecurityScheme:()=>RHn,ObjectProperty:()=>x$n,ObjectPropertyConflictInfo:()=>bfr,ObjectPropertyWithExample:()=>hJn,ObjectSchema:()=>j$n,ObjectSchemaWithExample:()=>yJn,OctetStreamRequest:()=>ffr,OffsetPagination:()=>u$n,OneOfSchema:()=>C$n,OneOfSchemaWithExample:()=>gJn,OpenApiIntermediateRepresentation:()=>Zjl,OpenApiSource:()=>SHn,OptionalSchema:()=>k$n,OptionalSchemaWithExample:()=>AJn,Pagination:()=>ufr,ParseFormUrlEncodedRequest:()=>eJn,ParseMultipartRequest:()=>tJn,ParseOctetStreamRequest:()=>rJn,PathParameter:()=>cfr,PathParameterExample:()=>i$n,PathParameterWithExample:()=>X$n,PrimitiveExample:()=>Xpr,PrimitiveSchema:()=>Igt,PrimitiveSchemaValue:()=>w$n,PrimitiveSchemaValueWithExample:()=>pJn,PrimitiveSchemaWithExample:()=>Pfr,PropertyKey:()=>Zpr,ProtobufEncoding:()=>wHn,ProtobufSource:()=>BHn,QueryParameter:()=>lfr,QueryParameterExample:()=>nfr,QueryParameterWithExample:()=>vfr,QuerySecurityScheme:()=>FHn,ReferencedSchema:()=>PMe,Request:()=>m$n,RequestWithExample:()=>nJn,Response:()=>hfr,ResponseWithExample:()=>wfr,RetriesConfiguration:()=>yfr,Schema:()=>Vd,SchemaId:()=>DU,SchemaWithExample:()=>NA,Schemas:()=>B$n,SdkGroup:()=>CHn,SdkGroupInfo:()=>D$n,SdkGroupName:()=>_gt,SecurityScheme:()=>NHn,SecuritySchemeId:()=>Ogt,Server:()=>kYr,ServerVariable:()=>MHn,Source:()=>DHn,StatusCode:()=>vMe,StreamingResponseExample:()=>r$n,StringSchema:()=>O$n,StringSchemaWithExample:()=>uJn,SupportedSdkLanguage:()=>JHn,Tag:()=>zHn,TagId:()=>TU,Tags:()=>T$n,TextResponse:()=>Egt,Uint64WithExample:()=>cJn,UintWithExample:()=>lJn,UnDiscriminatedOneOfSchema:()=>S$n,UnDiscriminatedOneOfSchemaWithExample:()=>bJn,UnknownSchemaWithExample:()=>_Jn,Webhook:()=>R$n,WebhookExampleCall:()=>Afr,WebhookHttpMethod:()=>_fr,WebhookWithExample:()=>tCl,WebsocketChannel:()=>V$n,WebsocketHandshake:()=>F$n,WebsocketHandshakeWithExample:()=>rCl,WebsocketMessageExample:()=>Q$n,WebsocketMessageOrigin:()=>N$n,WebsocketMessageSchema:()=>M$n,WebsocketServer:()=>z$n,WebsocketSessionExample:()=>q$n,WithAvailability:()=>tu,WithDescription:()=>gi,WithEncoding:()=>B5,WithInline:()=>FA,WithName:()=>Pp,WithNamespace:()=>Pl,WithSdkGroupName:()=>Zd,WithSdkMethodName:()=>OMe,WithSource:()=>Ja,WithStatusCode:()=>nre,WithTitle:()=>em,commons:()=>cas,example:()=>las,finalIr:()=>pas,parseIr:()=>fas});var cas={};Q(cas,{BasicSecurityScheme:()=>vHn,BearerSecurityScheme:()=>OHn,Encoding:()=>PHn,HeaderSecurityScheme:()=>EHn,Namespace:()=>IHn,NamespaceId:()=>xHn,OauthSecurityScheme:()=>RHn,OpenApiSource:()=>SHn,ProtobufEncoding:()=>wHn,ProtobufSource:()=>BHn,QuerySecurityScheme:()=>FHn,SchemaId:()=>DU,SdkGroup:()=>CHn,SdkGroupName:()=>_gt,SecurityScheme:()=>NHn,SecuritySchemeId:()=>Ogt,Server:()=>kYr,ServerVariable:()=>MHn,Source:()=>DHn,StatusCode:()=>vMe,Tag:()=>zHn,TagId:()=>TU,WithAvailability:()=>tu,WithDescription:()=>gi,WithEncoding:()=>B5,WithInline:()=>FA,WithName:()=>Pp,WithNamespace:()=>Pl,WithSdkGroupName:()=>Zd,WithSdkMethodName:()=>OMe,WithSource:()=>Ja,WithStatusCode:()=>nre,WithTitle:()=>em});var Z={};Q(Z,{JsonError:()=>$pr,ParseError:()=>Jpr,any:()=>Qjl,bigint:()=>Ijl,boolean:()=>qjl,booleanLiteral:()=>Mjl,date:()=>xjl,discriminant:()=>Kjl,enum_:()=>bHn,getObjectLikeUtils:()=>Rxe,getObjectUtils:()=>$2t,getSchemaUtils:()=>Rv,isProperty:()=>Agt,lazy:()=>jjl,lazyObject:()=>Fjl,list:()=>_Hn,never:()=>Vjl,number:()=>kjl,object:()=>AHn,objectWithoutOptionalProperties:()=>Rjl,optional:()=>oas,property:()=>Sjl,record:()=>Gjl,set:()=>Hjl,string:()=>Ujl,stringLiteral:()=>zjl,transform:()=>aas,undiscriminatedUnion:()=>Jjl,union:()=>Xjl,unknown:()=>Ljl,withParsedProperties:()=>uas});var Kf={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 b_(e,t){return`Expected ${t}. Received ${RiA(e)}.`}function RiA(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}function CR(e){return{...e,json:Ejl(e.json),parse:Ejl(e.parse)}}function Ejl(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(`
1527
+ `)),{ok:!0,value:t}):n}}function PGn(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var xpr=class e extends Error{errors;constructor(t){super(t.map(PGn).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var jpr=class e extends Error{errors;constructor(t){super(t.map(PGn).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Tv(e){return{nullable:()=>OiA(e),optional:()=>Nos(e),optionalNullable:()=>wiA(e),transform:t=>Mos(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new jpr(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new xpr(n.errors)}}}function OiA(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:()=>Jf.NULLABLE};return{...t,...Tv(t)}}function Nos(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:()=>Jf.OPTIONAL};return{...t,...Tv(t)}}function wiA(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:()=>Jf.OPTIONAL_NULLABLE};return{...t,...Tv(t)}}function Mos(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,...Tv(r)}}function Uxl(){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:g_(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:g_(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Jf.BIGINT};return{...wR(e),...Tv(e)}}var PiA=/^([+-]?\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)?)?)?)?$/;function Lxl(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:g_(t,"string")}]}:PiA.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:g_(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:g_(t,"Date object")}]},getType:()=>Jf.DATE};return{...wR(e),...Tv(e)}}function PR(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...wR(r),...Tv(r)}}}function EGn(e){let t=new Set(e);return PR(Jf.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:g_(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:g_(n,"enum")}]}:{ok:!0,value:n})()}function Wxl(e){let t=zos(e);return{...t,...Tv(t)}}function zos(e){return{parse:(t,r)=>Cpr(e).parse(t,r),json:(t,r)=>Cpr(e).json(t,r),getType:()=>Cpr(e).getType()}}function Cpr(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function BYr(e){return Object.entries(e)}function DYr(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function tat(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function TYr(e){return Object.keys(e)}function Gxl(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function Dxe(e){return{withParsedProperties:t=>Qos(e,t)}}function Qos(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let a=Object.entries(t).reduce((s,[c,l])=>({...s,[c]:typeof l=="function"?l(o.value):l}),{});return{ok:!0,value:{...o.value,...a}}},json:(n,i)=>{if(!tat(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:g_(n,"object")}]};let o=new Set(Object.keys(t)),a=DYr(n,Object.keys(n).filter(s=>!o.has(s)));return e.json(a,i)},getType:()=>e.getType()};return{...r,...Tv(r),...Dxe(r)}}function Hxl(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function cgt(e){return e.isProperty}function IGn(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>cgt(n)?n.rawKey:r),_getParsedProperties:()=>TYr(e),parse:(r,n)=>{let i={},o=[];for(let[a,s]of BYr(e)){let c=cgt(s)?s.rawKey:a,l=cgt(s)?s.valueSchema:s,u={rawKey:c,parsedKey:a,valueSchema:l};i[c]=u,Kxl(l)&&o.push(c)}return $xl({value:r,requiredKeys:o,getProperty:a=>{let s=i[a];if(s!=null)return{transformedKey:s.parsedKey,transform:c=>s.valueSchema.parse(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[o,a]of BYr(e)){let s=cgt(a)?a.valueSchema:a;Kxl(s)&&i.push(o)}return $xl({value:r,requiredKeys:i,getProperty:o=>{let a=e[o];if(a!=null)return cgt(a)?{transformedKey:a.rawKey,transform:s=>a.valueSchema.json(s,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}:{transformedKey:o,transform:s=>a.json(s,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>Jf.OBJECT};return{...wR(t),...Tv(t),...Dxe(t),...W2t(t)}}function $xl({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:o=[]}){if(!tat(e))return{ok:!1,errors:[{path:o,message:g_(e,"object")}]};let a=new Set(t),s=[],c={};for(let[l,u]of Object.entries(e)){let p=r(l);if(p!=null){a.delete(l);let d=p.transform(u);d.ok?c[p.transformedKey]=d.value:(c[l]=u,s.push(...d.errors))}else switch(n){case"fail":s.push({path:[...o,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=u;break}}return s.push(...t.filter(l=>a.has(l)).map(l=>({path:o,message:`Missing required key "${l}"`}))),s.length===0||i?{ok:!0,value:c}:{ok:!1,errors:s}}function W2t(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>Jxl({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>Jxl({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Jf.OBJECT};return{...r,...Tv(r),...Dxe(r),...W2t(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let a=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!a.ok)return a;let s={};if(typeof i=="object"&&i!=null)for(let[c,l]of Object.entries(i))t.has(c)||(s[c]=l);return{ok:!0,value:{...s,...a.value}}},json:(i,o)=>{let a=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!a.ok)return a;let s={};if(typeof i=="object"&&i!=null)for(let[c,l]of Object.entries(i))r.has(c)||(s[c]=l);return{ok:!0,value:{...s,...a.value}}},getType:()=>Jf.OBJECT};return{...n,...Tv(n),...Dxe(n),...W2t(n)}}}}function Jxl({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!tat(t))return{ok:!1,errors:[{path:i,message:g_(t,"object")}]};let o=new Set(e),[a,s]=Gxl(TYr(t),u=>o.has(u)),c=r(DYr(t,s)),l=n(DYr(t,a));return c.ok&&l.ok?{ok:!0,value:{...c.value,...l.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...l.ok?[]:l.errors]}}function Kxl(e){return!EiA(e)}function EiA(e){switch(e.getType()){case Jf.ANY:case Jf.UNKNOWN:case Jf.OPTIONAL:case Jf.OPTIONAL_NULLABLE:return!0;default:return!1}}function Yxl(e){return IGn(e)}function Xxl(e){let t={...zos(e),_getRawProperties:()=>Cpr(e)._getRawProperties(),_getParsedProperties:()=>Cpr(e)._getParsedProperties()};return{...t,...Tv(t),...Dxe(t),...W2t(t)}}function xGn(e){let t={parse:(r,n)=>Zxl(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>Zxl(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Jf.LIST};return{...wR(t),...Tv(t)}}function Zxl(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let o=[];return n.ok||o.push(...n.errors),i.ok||o.push(...i.errors),{ok:!1,errors:o}},{ok:!0,value:[]}):{ok:!1,errors:[{message:g_(e,"list"),path:[]}]}}function ejl(e){return PR(Jf.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:g_(r,`${e.toString()}`)}]})()}function tjl(e){return PR(Jf.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:g_(r,`"${e}"`)}]})()}var rjl=PR(Jf.ANY,e=>({ok:!0,value:e}));var njl=PR(Jf.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:g_(e,"boolean")}]});var ijl=PR(Jf.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var ojl=PR(Jf.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:g_(e,"number")}]});var ajl=PR(Jf.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:g_(e,"string")}]});var sjl=PR(Jf.UNKNOWN,e=>({ok:!0,value:e}));function cjl(e,t){let r={parse:(n,i)=>ujl({value:n,isKeyNumeric:e.getType()===Jf.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,a)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>ujl({value:n,isKeyNumeric:e.getType()===Jf.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,a)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Jf.RECORD};return{...wR(r),...Tv(r)}}function ujl({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return tat(e)?BYr(e).reduce((o,[a,s])=>{if(s===void 0)return o;let c=o,l=a;if(t){let m=a.length>0?Number(a):NaN;Number.isNaN(m)||(l=m)}let u=r(l),p=n(s,l);if(c.ok&&u.ok&&p.ok)return{ok:!0,value:{...c.value,[u.value]:p.value}};let d=[];return c.ok||d.push(...c.errors),u.ok||d.push(...u.errors),p.ok||d.push(...p.errors),{ok:!1,errors:d}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:g_(e,"object")}]}}function ljl(e){let t=xGn(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:g_(n,"Set")}]},getType:()=>Jf.SET};return{...wR(r),...Tv(r)}}function fjl(e){let t={parse:(r,n)=>pjl((i,o)=>i.parse(r,o),e,n),json:(r,n)=>pjl((i,o)=>i.json(r,o),e,n),getType:()=>Jf.UNDISCRIMINATED_UNION};return{...wR(t),...Tv(t)}}function pjl(e,t,r){let n=[];for(let[i,o]of t.entries()){let a=e(o,{...r,skipValidation:!1});if(a.ok)return a;for(let s of a.errors)n.push({path:s.path,message:`[Variant ${i}] ${s.message}`})}return{ok:!1,errors:n}}function djl(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function hjl(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=EGn(TYr(t)),o={parse:(a,s)=>mjl({value:a,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,l)=>l.parse(c,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(a,s)=>mjl({value:a,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,l)=>l.json(c,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>Jf.UNION};return{...wR(o),...Tv(o),...Dxe(o)}}function mjl({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!tat(e))return{ok:!1,errors:[{path:s,message:g_(e,"object")}]};let{[t]:c,...l}=e;if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${t}")`}]};let u=n(c);if(!u.ok)return{ok:!1,errors:u.errors};let p=i(u.value);if(p==null)return o?{ok:!0,value:{[r]:u.value,...l}}:{ok:!1,errors:[{path:[...s,t],message:"Unexpected discriminant value"}]};let d=a(l,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var jGn=Ue.string();var CGn=Ue.enum_(["openai","anthropic","bedrock"]);var SGn=Ue.object({provider:CGn,model:jGn});var Kos={};Q(Kos,{AnyAuthItem:()=>BGn,AnyAuthSchemesSchema:()=>DGn,ApiAuthSchema:()=>Bpr,AuthSchemeDeclarationSchema:()=>pgt,AuthSchemeReferenceSchema:()=>Spr,AuthScope:()=>UGn,AuthVariable:()=>G2t,AvailabilitySchema:()=>YGn,AvailabilityStatusSchema:()=>Tpr,AvailabilityUnionSchema:()=>XGn,BaseTypeReferenceSchema:()=>p7n,BasicAuthSchemeSchema:()=>FGn,BearerAuthSchemeSchema:()=>VGn,EncodingSchema:()=>t7n,EndpointSecuritySchema:()=>RGn,EndpointSecuritySchemaDetails:()=>TGn,EnvironmentSchema:()=>i7n,HeaderAuthSchemeSchema:()=>kGn,HttpHeaderSchema:()=>h7n,InferredAuthenticatedRequestHeader:()=>NGn,InferredBearerAuthSchema:()=>QGn,InferredGetTokenEndpointSchema:()=>zGn,InferredGetTokenEndpointSchemaObject:()=>MGn,ListValidationSchema:()=>a7n,MapValidationSchema:()=>s7n,MultipleBaseUrlsEnvironmentSchema:()=>r7n,NumberValidationSchema:()=>u7n,OAuthAccessTokenRequestPropertiesSchema:()=>LGn,OAuthAccessTokenResponsePropertiesSchema:()=>WGn,OAuthGetTokenEndpointSchema:()=>GGn,OAuthRefreshTokenEndpointSchema:()=>JGn,OAuthRefreshTokenRequestPropertiesSchema:()=>HGn,OAuthRefreshTokenResponsePropertiesSchema:()=>$Gn,OAuthSchemeSchema:()=>KGn,ProtobufTypeSchema:()=>e7n,ServerVariableSchema:()=>Rpr,SingleBaseUrlEnvironmentSchema:()=>n7n,StringValidationSchema:()=>c7n,TokenBearerAuthSchema:()=>qGn,TypeReferenceDeclarationWithEnvOverride:()=>m7n,TypeReferenceDeclarationWithEnvOverrideSchema:()=>d7n,TypeReferenceDeclarationWithName:()=>f7n,ValidationSchema:()=>l7n,WithAudiences:()=>fgt,WithAvailability:()=>ZGn,WithDocsSchema:()=>LI,WithEnvironmentVariable:()=>Dpr,WithEnvironmentsSchema:()=>o7n,WithHeadersSchema:()=>y7n,WithName:()=>lgt,auth:()=>Vos,availability:()=>kos,commons:()=>Uos,encoding:()=>Los,environments:()=>Wos,file:()=>Gos,service:()=>Hos,types:()=>$os,validation:()=>Jos});var Vos={};Q(Vos,{AnyAuthItem:()=>BGn,AnyAuthSchemesSchema:()=>DGn,ApiAuthSchema:()=>Bpr,AuthSchemeDeclarationSchema:()=>pgt,AuthSchemeReferenceSchema:()=>Spr,AuthScope:()=>UGn,AuthVariable:()=>G2t,BasicAuthSchemeSchema:()=>FGn,BearerAuthSchemeSchema:()=>VGn,EndpointSecuritySchema:()=>RGn,EndpointSecuritySchemaDetails:()=>TGn,HeaderAuthSchemeSchema:()=>kGn,InferredAuthenticatedRequestHeader:()=>NGn,InferredBearerAuthSchema:()=>QGn,InferredGetTokenEndpointSchema:()=>zGn,InferredGetTokenEndpointSchemaObject:()=>MGn,OAuthAccessTokenRequestPropertiesSchema:()=>LGn,OAuthAccessTokenResponsePropertiesSchema:()=>WGn,OAuthGetTokenEndpointSchema:()=>GGn,OAuthRefreshTokenEndpointSchema:()=>JGn,OAuthRefreshTokenRequestPropertiesSchema:()=>HGn,OAuthRefreshTokenResponsePropertiesSchema:()=>$Gn,OAuthSchemeSchema:()=>KGn,TokenBearerAuthSchema:()=>qGn,WithEnvironmentVariable:()=>Dpr});var LI=Ue.object({docs:Ue.string().optional()});var Spr=Ue.object({scheme:Ue.string()}).extend(LI);var BGn=Ue.undiscriminatedUnion([Ue.string(),Spr]);var DGn=Ue.object({any:Ue.list(BGn)}).extend(LI);var TGn=Ue.object({});var RGn=Ue.object({"endpoint-security":TGn}).extend(LI);var Bpr=Ue.undiscriminatedUnion([Ue.string(),Spr,DGn,RGn]);var lgt=Ue.object({name:Ue.string().optional()});var Dpr=Ue.object({env:Ue.string().optional()});var G2t=Ue.object({omit:Ue.boolean().optional()}).extend(Dpr).extend(lgt);var FGn=Ue.object({scheme:Ue.stringLiteral("basic"),username:G2t.optional(),password:G2t.optional()}).extend(LI);var NGn=Ue.object({"response-property":Ue.string(),"header-name":Ue.string(),"value-prefix":Ue.string().optional()});var MGn=Ue.object({endpoint:Ue.string(),"expiry-response-property":Ue.string().optional(),"authenticated-request-headers":Ue.list(NGn).optional()});var zGn=Ue.undiscriminatedUnion([Ue.string(),MGn]);var QGn=Ue.object({scheme:Ue.stringLiteral("bearer"),"get-token":zGn}).extend(LI);var qGn=Ue.object({scheme:Ue.stringLiteral("bearer"),token:G2t.optional()}).extend(LI);var VGn=Ue.undiscriminatedUnion([qGn,QGn]);var kGn=Ue.object({header:Ue.string(),type:Ue.string().optional(),prefix:Ue.string().optional()}).extend(Dpr).extend(lgt).extend(LI);var UGn=Ue.string();var LGn=Ue.object({"client-id":Ue.string().optional(),"client-secret":Ue.string().optional(),scopes:Ue.string().optional()});var WGn=Ue.object({"access-token":Ue.string().optional(),"expires-in":Ue.string().optional(),"refresh-token":Ue.string().optional()});var GGn=Ue.object({endpoint:Ue.string(),"request-properties":LGn.optional(),"response-properties":WGn.optional()});var HGn=Ue.object({"refresh-token":Ue.string()});var $Gn=Ue.object({"access-token":Ue.string().optional(),"expires-in":Ue.string().optional(),"refresh-token":Ue.string().optional()});var JGn=Ue.object({endpoint:Ue.string(),"request-properties":HGn.optional(),"response-properties":$Gn.optional()});var KGn=Ue.object({scheme:Ue.stringLiteral("oauth"),type:Ue.stringLiteral("client-credentials"),scopes:Ue.list(UGn).optional(),"client-id-env":Ue.string().optional(),"client-secret-env":Ue.string().optional(),"token-prefix":Ue.string().optional(),"token-header":Ue.string().optional(),"get-token":GGn,"refresh-token":JGn.optional()}).extend(LI);var pgt=Ue.undiscriminatedUnion([KGn,kGn,FGn,VGn]);var kos={};Q(kos,{AvailabilitySchema:()=>YGn,AvailabilityStatusSchema:()=>Tpr,AvailabilityUnionSchema:()=>XGn});var Tpr=Ue.enum_(["in-development","pre-release","deprecated","generally-available"]);var YGn=Ue.object({status:Tpr,message:Ue.string().optional()});var XGn=Ue.undiscriminatedUnion([Tpr,YGn]);var Uos={};Q(Uos,{WithAudiences:()=>fgt,WithAvailability:()=>ZGn,WithDocsSchema:()=>LI,WithName:()=>lgt});var fgt=Ue.object({audiences:Ue.list(Ue.string()).optional()});var ZGn=Ue.object({availability:XGn.optional()});var Los={};Q(Los,{EncodingSchema:()=>t7n,ProtobufTypeSchema:()=>e7n});var e7n=Ue.object({type:Ue.string()});var t7n=Ue.object({proto:e7n.optional()});var Wos={};Q(Wos,{EnvironmentSchema:()=>i7n,MultipleBaseUrlsEnvironmentSchema:()=>r7n,ServerVariableSchema:()=>Rpr,SingleBaseUrlEnvironmentSchema:()=>n7n,WithEnvironmentsSchema:()=>o7n});var Rpr=Ue.object({id:Ue.string(),default:Ue.string().optional(),values:Ue.list(Ue.string()).optional()});var r7n=Ue.object({urls:Ue.record(Ue.string(),Ue.string()),"url-templates":Ue.record(Ue.string(),Ue.string()).optional(),"default-urls":Ue.record(Ue.string(),Ue.string()).optional(),variables:Ue.record(Ue.string(),Ue.list(Rpr)).optional()}).extend(fgt).extend(LI);var n7n=Ue.object({url:Ue.string(),"default-url":Ue.string().optional(),"url-template":Ue.string().optional(),variables:Ue.list(Rpr).optional()}).extend(fgt).extend(LI);var i7n=Ue.undiscriminatedUnion([Ue.string(),n7n,r7n]);var o7n=Ue.object({"default-url":Ue.string().optional(),"default-environment":Ue.string().optional(),environments:Ue.record(Ue.string(),i7n).optional()});var Gos={};Q(Gos,{WithHeadersSchema:()=>y7n});var a7n=Ue.object({minItems:Ue.number().optional(),maxItems:Ue.number().optional()});var s7n=Ue.object({minProperties:Ue.number().optional(),maxProperties:Ue.number().optional()});var u7n=Ue.object({min:Ue.number().optional(),max:Ue.number().optional(),exclusiveMin:Ue.boolean().optional(),exclusiveMax:Ue.boolean().optional(),multipleOf:Ue.number().optional()});var c7n=Ue.object({minLength:Ue.number().optional(),maxLength:Ue.number().optional(),pattern:Ue.string().optional(),format:Ue.string().optional()});var l7n=Ue.undiscriminatedUnion([c7n,u7n,a7n,s7n]);var p7n=Ue.object({default:Ue.unknown().optional(),encoding:t7n.optional(),validation:l7n.optional()}).extend(LI).extend(ZGn);var f7n=Ue.object({type:Ue.string()}).extend(p7n).extend(lgt).extend(fgt);var d7n=Ue.object({env:Ue.string().optional()}).extend(f7n);var m7n=Ue.undiscriminatedUnion([Ue.string(),d7n]);var h7n=m7n;var y7n=Ue.object({headers:Ue.record(Ue.string(),h7n).optional()});var Hos={};Q(Hos,{HttpHeaderSchema:()=>h7n,TypeReferenceDeclarationWithEnvOverride:()=>m7n,TypeReferenceDeclarationWithEnvOverrideSchema:()=>d7n});var $os={};Q($os,{BaseTypeReferenceSchema:()=>p7n,TypeReferenceDeclarationWithName:()=>f7n});var Jos={};Q(Jos,{ListValidationSchema:()=>a7n,MapValidationSchema:()=>s7n,NumberValidationSchema:()=>u7n,StringValidationSchema:()=>c7n,ValidationSchema:()=>l7n});var Yos={};Q(Yos,{ApiConfigurationSchema:()=>F7n,ApiConfigurationSchemaInternal:()=>kpr,ApiConfigurationV2Schema:()=>T7n,ApiConfigurationV2SettingsSchema:()=>Wpr,ApiConfigurationV2SpecsSchema:()=>Gpr,ApiDefinitionList:()=>A7n,ApiDefinitionPathSchema:()=>dgt,ApiDefinitionSchema:()=>b7n,ApiDefinitionSettingsSchema:()=>zpr,ApiDefinitionWithOverridesSchema:()=>Qpr,AsyncApiSettingsSchema:()=>Lpr,AsyncApiSpecSchema:()=>x7n,BaseApiSettingsSchema:()=>Upr,ConjureSchema:()=>I7n,DefaultIntegerFormat:()=>_7n,ExampleStyle:()=>N7n,FormParameterEncoding:()=>v7n,GeneratorsConfigurationSchema:()=>yjl,GeneratorsOpenApiObjectSchema:()=>uHn,GeneratorsOpenApiSchema:()=>cHn,GraphQlSpecSchema:()=>j7n,Language:()=>lHn,MessageNamingSettingsSchema:()=>Fpr,NamespacedApiConfigurationSchema:()=>R7n,OpenApiExampleGenerationSchema:()=>O7n,OpenApiFilterSchema:()=>w7n,OpenApiSettingsSchema:()=>mgt,OpenApiSpecSchema:()=>C7n,OpenRpcSpecSchema:()=>S7n,OutputMetadataAuthor:()=>M7n,OutputMetadataSchema:()=>hgt,PathParameterOrder:()=>Npr,ProtobufApiDefinitionSchema:()=>Vpr,ProtobufDefinitionSchema:()=>qpr,ProtobufSpecSchema:()=>B7n,ReadmeCustomSectionSchema:()=>pHn,ReadmeEndpointObjectSchema:()=>fHn,ReadmeEndpointSchema:()=>MYr,ReadmeSchema:()=>dHn,RemoveDiscriminantsFromSchemas:()=>Mpr,RequestOrResponseExampleGenerationSchema:()=>RYr,ResolveAliases:()=>E7n,ResolveAliasesSchema:()=>P7n,SpecSchema:()=>D7n,UnionSettingsSchema:()=>g7n,WhitelabelConfigurationSchema:()=>hHn,WhitelabelGithubConfigurationSchema:()=>mHn});var dgt=Ue.string();var Fpr=Ue.enum_(["v1","v2"]);var Npr=Ue.enum_(["url-order","spec-order"]);var Mpr=Ue.enum_(["always","never"]);var g7n=Ue.enum_(["v1"]);var zpr=Ue.object({"use-title":Ue.boolean().optional(),unions:g7n.optional(),"message-naming":Fpr.optional(),"respect-nullable-schemas":Ue.boolean().optional(),"only-include-referenced-schemas":Ue.boolean().optional(),"inline-path-parameters":Ue.boolean().optional(),"idiomatic-request-names":Ue.boolean().optional(),"wrap-references-to-nullable-in-optional":Ue.boolean().optional(),"coerce-optional-schemas-to-nullable":Ue.boolean().optional(),"group-environments-by-host":Ue.boolean().optional(),"remove-discriminants-from-schemas":Mpr.optional(),"path-parameter-order":Npr.optional()});var Qpr=Ue.object({path:dgt,origin:Ue.string().optional(),overrides:Ue.string().optional(),audiences:Ue.list(Ue.string()).optional(),settings:zpr.optional()});var qpr=Ue.object({target:Ue.string().optional(),root:Ue.string(),overrides:Ue.string().optional(),"local-generation":Ue.boolean().optional(),"from-openapi":Ue.boolean().optional(),dependencies:Ue.list(Ue.string()).optional()});var Vpr=Ue.object({proto:qpr});var b7n=Ue.undiscriminatedUnion([dgt,Qpr,Vpr]);var A7n=Ue.list(b7n);var kpr=Ue.undiscriminatedUnion([dgt,Qpr,A7n,Vpr]);var Upr=Ue.object({"respect-nullable-schemas":Ue.boolean().optional(),"title-as-schema-name":Ue.boolean().optional(),"optional-additional-properties":Ue.boolean().optional(),"coerce-enums-to-literals":Ue.boolean().optional(),"idiomatic-request-names":Ue.boolean().optional(),"wrap-references-to-nullable-in-optional":Ue.boolean().optional(),"coerce-optional-schemas-to-nullable":Ue.boolean().optional(),"group-environments-by-host":Ue.boolean().optional(),"remove-discriminants-from-schemas":Mpr.optional(),"path-parameter-order":Npr.optional(),"resolve-schema-collisions":Ue.boolean().optional()});var Lpr=Ue.object({"message-naming":Fpr.optional()}).extend(Upr);var _7n=Ue.enum_(["int32","int64","uint32","uint64"]);var v7n=Ue.enum_(["form","json"]);var RYr=Ue.object({"max-depth":Ue.number().optional()});var O7n=Ue.object({request:RYr.optional(),response:RYr.optional()});var w7n=Ue.object({endpoints:Ue.list(Ue.string()).optional()});var P7n=Ue.object({except:Ue.list(Ue.string()).optional()});var E7n=Ue.undiscriminatedUnion([Ue.boolean(),P7n]);var mgt=Ue.object({"only-include-referenced-schemas":Ue.boolean().optional(),"inline-path-parameters":Ue.boolean().optional(),"prefer-undiscriminated-unions-with-literals":Ue.boolean().optional(),"object-query-parameters":Ue.boolean().optional(),"respect-readonly-schemas":Ue.boolean().optional(),"respect-forward-compatible-enums":Ue.boolean().optional(),"use-bytes-for-binary-response":Ue.boolean().optional(),"default-form-parameter-encoding":v7n.optional(),filter:w7n.optional(),"example-generation":O7n.optional(),"additional-properties-defaults-to":Ue.boolean().optional(),"type-dates-as-strings":Ue.boolean().optional(),"preserve-single-schema-oneof":Ue.boolean().optional(),"inline-all-of-schemas":Ue.boolean().optional(),"resolve-aliases":E7n.optional(),"group-multi-api-environments":Ue.boolean().optional(),"default-integer-format":_7n.optional()}).extend(Upr);var Wpr=Ue.object({}).extend(mgt).extend(Lpr);var I7n=Ue.object({conjure:Ue.string()});var x7n=Ue.object({asyncapi:Ue.string(),origin:Ue.string().optional(),overrides:Ue.string().optional(),namespace:Ue.string().optional(),settings:Lpr.optional()});var j7n=Ue.object({graphql:Ue.string(),origin:Ue.string().optional(),overrides:Ue.string().optional(),name:Ue.string().optional()});var C7n=Ue.object({openapi:Ue.string(),origin:Ue.string().optional(),overrides:Ue.string().optional(),overlays:Ue.string().optional(),namespace:Ue.string().optional(),settings:mgt.optional()});var S7n=Ue.object({openrpc:Ue.string(),overrides:Ue.string().optional(),namespace:Ue.string().optional()});var B7n=Ue.object({proto:qpr});var D7n=Ue.undiscriminatedUnion([C7n,x7n,B7n,S7n,j7n]);var Gpr=Ue.undiscriminatedUnion([Ue.list(D7n),I7n]);var T7n=Ue.object({auth:Bpr.optional(),"auth-schemes":Ue.record(Ue.string(),pgt).optional(),specs:Gpr,settings:Wpr.optional()}).extend(y7n).extend(o7n);var R7n=Ue.object({namespaces:Ue.record(Ue.string(),kpr)});var F7n=Ue.undiscriminatedUnion([kpr,R7n,T7n]);var N7n=Ue.enum_(["minimal","comprehensive"]);var M7n=Ue.object({name:Ue.string(),email:Ue.string()});var hgt=Ue.object({description:Ue.string().optional(),authors:Ue.list(M7n).optional()});var FYr=Ue.object({name:Ue.string()});var ygt=Ue.object({teams:Ue.list(FYr).optional(),users:Ue.list(FYr).optional()});var z7n=Ue.object({auth:Bpr.optional(),"auth-schemes":Ue.record(Ue.string(),pgt).optional(),settings:Wpr.optional(),specs:Gpr.optional()});var Q7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),token:Ue.string().optional()});var q7n=Ue.object({path:Ue.string()});var V7n=Ue.object({keyId:Ue.string(),password:Ue.string(),secretKey:Ue.string()});var k7n=Ue.object({url:Ue.string().optional(),coordinate:Ue.string(),username:Ue.string().optional(),password:Ue.string().optional(),signature:V7n.optional()});var U7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),token:Ue.string().optional()});var L7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),"api-key":Ue.string().optional()});var W7n=Ue.object({"api-key":Ue.string(),"workspace-id":Ue.string(),"collection-id":Ue.string().optional()});var G7n=Ue.object({keywords:Ue.list(Ue.string()).optional(),"documentation-link":Ue.string().optional(),"homepage-link":Ue.string().optional()}).extend(hgt);var H7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),token:Ue.string().optional(),username:Ue.string().optional(),password:Ue.string().optional(),metadata:G7n.optional()});var $7n=Ue.object({url:Ue.string().optional(),"package-name":Ue.string(),"api-key":Ue.string().optional()});var J7n=Ue.union("location",{npm:U7n,maven:k7n,pypi:H7n,postman:W7n,"local-file-system":q7n,nuget:L7n,rubygems:$7n,crates:Q7n}).transform({transform:e=>e,untransform:e=>e});var K7n=Ue.object({custom:Ue.string()});var Y7n=Ue.enum_(["MIT","Apache-2.0"]);var ere=Ue.undiscriminatedUnion([Y7n,K7n]);var NYr=Ue.object({"package-description":Ue.string().optional(),email:Ue.string().optional(),"reference-url":Ue.string().optional(),author:Ue.string().optional(),license:ere.optional()});var X7n=Ue.object({path:Ue.string()});var Z7n=Ue.enum_(["commit","release"]);var eHn=Ue.object({repository:Ue.string(),license:ere.optional(),mode:Z7n.optional()});var tHn=Ue.object({repository:Ue.string(),branch:Ue.string().optional(),license:ere.optional(),mode:Ue.stringLiteral("pull-request"),reviewers:ygt.optional()});var rHn=Ue.object({repository:Ue.string(),license:ere.optional(),mode:Ue.stringLiteral("push"),branch:Ue.string().optional()});var nHn=Ue.enum_(["pull-request","push"]);var iHn=Ue.object({uri:Ue.string(),token:Ue.string(),mode:nHn.optional(),branch:Ue.string().optional(),license:ere.optional()});var oHn=Ue.undiscriminatedUnion([iHn,eHn,tHn,rHn]);var aHn=Ue.object({name:Ue.string(),version:Ue.string(),output:J7n.optional(),github:oHn.optional(),config:Ue.unknown().optional(),metadata:NYr.optional(),keywords:Ue.list(Ue.string()).optional(),snippets:X7n.optional(),"ir-version":Ue.string().optional(),"smart-casing":Ue.boolean().optional(),api:z7n.optional(),"disable-examples":Ue.boolean().optional(),"publish-metadata":NYr.optional(),autorelease:Ue.boolean().optional()});var sHn=Ue.object({audiences:Ue.list(Ue.string()).optional(),generators:Ue.list(aHn),metadata:hgt.optional(),reviewers:ygt.optional()});var uHn=Ue.object({path:Ue.string(),origin:Ue.string().optional(),overrides:Ue.string().optional(),"disable-examples":Ue.boolean().optional(),settings:mgt});var cHn=Ue.undiscriminatedUnion([uHn,Ue.string()]);var lHn=Ue.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var pHn=Ue.object({title:Ue.string(),language:lHn,content:Ue.string()});var fHn=Ue.object({method:Ue.string(),path:Ue.string(),stream:Ue.boolean().optional()});var MYr=Ue.undiscriminatedUnion([Ue.string(),fHn]);var dHn=Ue.object({bannerLink:Ue.string().optional(),introduction:Ue.string().optional(),apiReferenceLink:Ue.string().optional(),apiName:Ue.string().optional(),disabledSections:Ue.list(Ue.string()).optional(),defaultEndpoint:MYr.optional(),features:Ue.record(Ue.string(),Ue.list(MYr)).optional(),customSections:Ue.list(pHn).optional(),exampleStyle:N7n.optional()});var mHn=Ue.object({username:Ue.string(),email:Ue.string(),token:Ue.string()});var hHn=Ue.object({github:mHn.optional()});var yjl=Ue.object({"auth-schemes":Ue.record(Ue.string(),pgt).optional(),api:F7n.optional(),whitelabel:hHn.optional(),metadata:hgt.optional(),readme:dHn.optional(),"default-group":Ue.string().optional(),aliases:Ue.record(Ue.string(),Ue.list(Ue.string())).optional(),groups:Ue.record(Ue.string(),sHn).optional(),reviewers:ygt.optional(),ai:SGn.optional(),autorelease:Ue.boolean().optional(),openapi:cHn.optional(),"openapi-overrides":Ue.string().optional(),"spec-origin":Ue.string().optional(),"async-api":Ue.string().optional(),"api-settings":zpr.optional()});var Xos={};Q(Xos,{CratesOutputLocationSchema:()=>Q7n,GeneratorApiSettingsSchema:()=>z7n,GeneratorGroupSchema:()=>sHn,GeneratorInvocationSchema:()=>aHn,GeneratorOutputSchema:()=>J7n,GeneratorPublishMetadataSchema:()=>NYr,GeneratorSnippetsSchema:()=>X7n,GithubCommitAndReleaseMode:()=>Z7n,GithubCommitAndReleaseSchema:()=>eHn,GithubConfigurationSchema:()=>oHn,GithubPullRequestSchema:()=>tHn,GithubPushSchema:()=>rHn,GithubSelfhostedMode:()=>nHn,GithubSelfhostedSchema:()=>iHn,LocalFileSystemOutputLocationSchema:()=>q7n,MavenOutputLocationSchema:()=>k7n,MavenOutputSignatureSchema:()=>V7n,NpmOutputLocationSchema:()=>U7n,NugetOutputLocationSchema:()=>L7n,PostmanOutputLocationSchema:()=>W7n,PypiOutputLocationSchema:()=>H7n,PypiOutputMetadataSchema:()=>G7n,RubyGemsOutputLocationSchema:()=>$7n});var Zos={};Q(Zos,{GithubLicenseCustomSchema:()=>K7n,GithubLicenseSchema:()=>ere,GithubLicenseType:()=>Y7n});var eas={};Q(eas,{ReviewerSchema:()=>FYr,ReviewersSchema:()=>ygt});function gjl(e){return e?.specs!=null}function bjl(e){return e?.asyncapi!=null}function Ajl(e){return e?.conjure!=null}function _jl(e){return e?.graphql!=null}function vjl(e){return e?.namespaces!=null}function Ojl(e){return e?.openapi!=null}function wjl(e){return e?.openrpc!=null}function Pjl(e){return e?.proto!=null}var IiA={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!0,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,groupEnvironmentsByHost:!1,removeDiscriminantsFromSchemas:vi.RemoveDiscriminantsFromSchemas.Always};function xiA(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,a={};for(let s of Object.keys(t))i.has(s)?a[s]=n?.[s]!==void 0?n[s]:t[s]:o.has(s)?a[s]=n?.[s]!==void 0?n[s]:r?.[s]!==void 0?r[s]:void 0:a[s]=n?.[s]??r?.[s]??t[s];return a}function H2t({options:e,overrides:t}){return xiA({defaults:IiA,options:e,overrides:t})}var Hpr={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Hpr._visit(this,t)}}),_visit:(e,t)=>e.type==="protobuf"?t.protobuf(e):t._other(e)};var ER={basic:e=>({...e,type:"basic",_visit:function(t){return ER._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return ER._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return ER._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return ER._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return ER._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 ZQ={openapi:e=>({...e,type:"openapi",_visit:function(t){return ZQ._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return ZQ._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 Al={primitive:e=>({value:e,type:"primitive",_visit:function(t){return Al._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Al._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return Al._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return Al._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return Al._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return Al._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Al._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return Al._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return Al._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 ggt={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return ggt._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return ggt._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 bgt={boolean:e=>({value:e,type:"boolean",_visit:function(t){return bgt._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return bgt._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 Ga={int:e=>({value:e,type:"int",_visit:function(t){return Ga._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return Ga._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return Ga._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return Ga._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return Ga._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return Ga._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Ga._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return Ga._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return Ga._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return Ga._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return Ga._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"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 yHn={};Q(yHn,{Availability:()=>IR,CustomCodeSample:()=>bMe,EndpointExample:()=>tre,EndpointResponseExample:()=>rre,HttpMethod:()=>xR,LiteralSchemaValue:()=>WP,MultipartRequestPropertyEncoding:()=>ras,MultipartSchema:()=>AMe,OneOfSchema:()=>_Me,Pagination:()=>JJ,PrimitiveSchemaValue:()=>Ph,Request:()=>Txe,Response:()=>rz,RetriesConfiguration:()=>zYr,Schema:()=>Pc,SupportedSdkLanguage:()=>jR,WebhookHttpMethod:()=>nas,WebsocketMessageOrigin:()=>ias});var jiA={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated"},IR={...jiA,_visit:(e,t)=>{switch(e){case IR.GenerallyAvailable:return t.generallyAvailable();case IR.Beta:return t.beta();case IR.Deprecated:return t.deprecated();default:return t._other()}}};var bMe={language:e=>({...e,type:"language",_visit:function(t){return bMe._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return bMe._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 tre={unknown:e=>({value:e,type:"unknown",_visit:function(t){return tre._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return tre._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 rre={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return rre._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return rre._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 CiA={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE"},xR={...CiA,_visit:(e,t)=>{switch(e){case xR.Get:return t.get();case xR.Post:return t.post();case xR.Put:return t.put();case xR.Patch:return t.patch();case xR.Delete:return t.delete();case xR.Head:return t.head();case xR.Options:return t.options();case xR.Trace:return t.trace();default:return t._other()}}};var WP={boolean:e=>({value:e,type:"boolean",_visit:function(t){return WP._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return WP._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 SiA={Json:"json",Form:"form"},ras={...SiA,_visit:(e,t)=>{switch(e){case ras.Json:return t.json();case ras.Form:return t.form();default:return t._other()}}};var AMe={file:e=>({...e,type:"file",_visit:function(t){return AMe._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return AMe._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 _Me={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return _Me._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return _Me._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 JJ={cursor:e=>({...e,type:"cursor",_visit:function(t){return JJ._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return JJ._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return JJ._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);default:return t._other(e)}}};var Ph={int:e=>({...e,type:"int",_visit:function(t){return Ph._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Ph._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Ph._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Ph._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Ph._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Ph._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Ph._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Ph._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Ph._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Ph._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Ph._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"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var Txe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Txe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Txe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Txe._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return Txe._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 rz={file:e=>({...e,type:"file",_visit:function(t){return rz._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return rz._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return rz._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return rz._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return rz._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return rz._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return rz._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 zYr={disabled:e=>({value:e,type:"disabled",_visit:function(t){return zYr._visit(this,t)}}),_visit:(e,t)=>e.type==="disabled"?t.disabled(e.value):t._other(e)};var Pc={primitive:e=>({...e,type:"primitive",_visit:function(t){return Pc._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Pc._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Pc._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Pc._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Pc._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Pc._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Pc._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Pc._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Pc._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Pc._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Pc._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 BiA={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"},jR={...BiA,_visit:(e,t)=>{switch(e){case jR.Curl:return t.curl();case jR.Python:return t.python();case jR.Javascript:return t.javascript();case jR.Typescript:return t.typescript();case jR.Go:return t.go();case jR.Ruby:return t.ruby();case jR.Csharp:return t.csharp();case jR.Java:return t.java();case jR.Js:return t.js();case jR.Node:return t.node();case jR.Ts:return t.ts();case jR.Nodets:return t.nodets();case jR.Golang:return t.golang();case jR.Dotnet:return t.dotnet();case jR.Jvm:return t.jvm();default:return t._other()}}};var DiA={Get:"GET",Post:"POST"},nas={...DiA,_visit:(e,t)=>{switch(e){case nas.Get:return t.get();case nas.Post:return t.post();default:return t._other()}}};var TiA={Client:"client",Server:"server"},ias={...TiA,_visit:(e,t)=>{switch(e){case ias.Client:return t.client();case ias.Server:return t.server();default:return t._other()}}};var KJ={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return KJ._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return KJ._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 Yo={int:e=>({...e,type:"int",_visit:function(t){return Yo._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Yo._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Yo._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Yo._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Yo._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Yo._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Yo._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Yo._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Yo._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Yo._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Yo._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"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var BU={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return BU._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return BU._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return BU._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return BU._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 Gw={file:e=>({...e,type:"file",_visit:function(t){return Gw._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Gw._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Gw._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return Gw._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Gw._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Gw._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Gw._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 Bn={primitive:e=>({...e,type:"primitive",_visit:function(t){return Bn._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Bn._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Bn._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Bn._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Bn._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Bn._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Bn._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Bn._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Bn._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Bn._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Bn._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 Ec={};Q(Ec,{AllOfPropertyConflict:()=>efr,ArraySchema:()=>LHn,ArraySchemaWithExample:()=>U$n,Availability:()=>jHn,Base64WithExample:()=>L$n,BasicSecurityScheme:()=>vHn,BearerSecurityScheme:()=>OHn,BooleanSchema:()=>WHn,BooleanWithExample:()=>W$n,BytesResponse:()=>tfr,CasingOverrides:()=>THn,CommonProperty:()=>GHn,CommonPropertyWithExample:()=>G$n,CursorPagination:()=>HHn,CustomCodeSample:()=>YHn,CustomCodeSampleLanguage:()=>$Hn,CustomCodeSampleSdk:()=>KHn,CustomPagination:()=>XHn,DateWithExample:()=>$$n,DatetimeWithExample:()=>H$n,DiscriminatedOneOfSchema:()=>ZHn,DiscriminatedOneOfSchemaWithExample:()=>J$n,DoubleSchema:()=>e$n,DoubleWithExample:()=>K$n,Encoding:()=>PHn,Endpoint:()=>h$n,EndpointExample:()=>ifr,EndpointResponseExample:()=>n$n,EndpointSdkName:()=>wMe,EndpointSecurity:()=>ofr,EndpointWithExample:()=>eCl,EnumSchema:()=>Ypr,EnumSchemaWithExample:()=>iJn,EnumValue:()=>vgt,ErrorExample:()=>a$n,FernExample:()=>t$n,FileResponse:()=>dfr,FileSchema:()=>f$n,FloatWithExample:()=>oJn,FormUrlEncodedRequest:()=>c$n,FullEndpointExample:()=>o$n,FullExample:()=>y0,FullObjectExample:()=>VHn,FullOneOfExample:()=>kHn,GlobalHeader:()=>y$n,GlobalSecurity:()=>g$n,Header:()=>wgt,HeaderExample:()=>rfr,HeaderSecurityScheme:()=>EHn,HeaderWithExample:()=>xgt,HttpEndpointServer:()=>afr,HttpError:()=>s$n,HttpErrorWithExample:()=>Y$n,HttpMethod:()=>sfr,IdempotencyHeader:()=>b$n,Int64WithExample:()=>aJn,IntSchema:()=>A$n,IntWithExample:()=>sJn,JsonRequest:()=>l$n,JsonRequestWithExample:()=>Z$n,JsonResponse:()=>mfr,JsonResponseWithExample:()=>Ofr,KeyValuePair:()=>UHn,LiteralExample:()=>QHn,LiteralSchema:()=>gfr,LiteralSchemaValue:()=>_$n,LongSchema:()=>v$n,MapSchema:()=>P$n,MapSchemaWithExample:()=>fJn,MultipartFormDataWebhookPayload:()=>E$n,MultipartFormDataWebhookPayloadWithExample:()=>dJn,MultipartRequest:()=>pfr,MultipartRequestProperty:()=>Pgt,MultipartRequestPropertyEncoding:()=>p$n,MultipartSchema:()=>d$n,NamedFullExample:()=>D5,Namespace:()=>IHn,NamespaceId:()=>xHn,NullExample:()=>qHn,NullableSchema:()=>I$n,NullableSchemaWithExample:()=>mJn,OauthSecurityScheme:()=>RHn,ObjectProperty:()=>x$n,ObjectPropertyConflictInfo:()=>bfr,ObjectPropertyWithExample:()=>hJn,ObjectSchema:()=>j$n,ObjectSchemaWithExample:()=>yJn,OctetStreamRequest:()=>ffr,OffsetPagination:()=>u$n,OneOfSchema:()=>C$n,OneOfSchemaWithExample:()=>gJn,OpenApiIntermediateRepresentation:()=>Zjl,OpenApiSource:()=>SHn,OptionalSchema:()=>k$n,OptionalSchemaWithExample:()=>AJn,Pagination:()=>ufr,ParseFormUrlEncodedRequest:()=>eJn,ParseMultipartRequest:()=>tJn,ParseOctetStreamRequest:()=>rJn,PathParameter:()=>cfr,PathParameterExample:()=>i$n,PathParameterWithExample:()=>X$n,PrimitiveExample:()=>Xpr,PrimitiveSchema:()=>Igt,PrimitiveSchemaValue:()=>w$n,PrimitiveSchemaValueWithExample:()=>pJn,PrimitiveSchemaWithExample:()=>Pfr,PropertyKey:()=>Zpr,ProtobufEncoding:()=>wHn,ProtobufSource:()=>BHn,QueryParameter:()=>lfr,QueryParameterExample:()=>nfr,QueryParameterWithExample:()=>vfr,QuerySecurityScheme:()=>FHn,ReferencedSchema:()=>PMe,Request:()=>m$n,RequestWithExample:()=>nJn,Response:()=>hfr,ResponseWithExample:()=>wfr,RetriesConfiguration:()=>yfr,Schema:()=>Vd,SchemaId:()=>DU,SchemaWithExample:()=>NA,Schemas:()=>B$n,SdkGroup:()=>CHn,SdkGroupInfo:()=>D$n,SdkGroupName:()=>_gt,SecurityScheme:()=>NHn,SecuritySchemeId:()=>Ogt,Server:()=>kYr,ServerVariable:()=>MHn,Source:()=>DHn,StatusCode:()=>vMe,StreamingResponseExample:()=>r$n,StringSchema:()=>O$n,StringSchemaWithExample:()=>uJn,SupportedSdkLanguage:()=>JHn,Tag:()=>zHn,TagId:()=>TU,Tags:()=>T$n,TextResponse:()=>Egt,Uint64WithExample:()=>cJn,UintWithExample:()=>lJn,UnDiscriminatedOneOfSchema:()=>S$n,UnDiscriminatedOneOfSchemaWithExample:()=>bJn,UnknownSchemaWithExample:()=>_Jn,Webhook:()=>R$n,WebhookExampleCall:()=>Afr,WebhookHttpMethod:()=>_fr,WebhookWithExample:()=>tCl,WebsocketChannel:()=>V$n,WebsocketHandshake:()=>F$n,WebsocketHandshakeWithExample:()=>rCl,WebsocketMessageExample:()=>Q$n,WebsocketMessageOrigin:()=>N$n,WebsocketMessageSchema:()=>M$n,WebsocketServer:()=>z$n,WebsocketSessionExample:()=>q$n,WithAvailability:()=>tu,WithDescription:()=>gi,WithEncoding:()=>B5,WithInline:()=>FA,WithName:()=>Pp,WithNamespace:()=>Pl,WithSdkGroupName:()=>Zd,WithSdkMethodName:()=>OMe,WithSource:()=>Ja,WithStatusCode:()=>nre,WithTitle:()=>em,commons:()=>cas,example:()=>las,finalIr:()=>pas,parseIr:()=>fas});var cas={};Q(cas,{BasicSecurityScheme:()=>vHn,BearerSecurityScheme:()=>OHn,Encoding:()=>PHn,HeaderSecurityScheme:()=>EHn,Namespace:()=>IHn,NamespaceId:()=>xHn,OauthSecurityScheme:()=>RHn,OpenApiSource:()=>SHn,ProtobufEncoding:()=>wHn,ProtobufSource:()=>BHn,QuerySecurityScheme:()=>FHn,SchemaId:()=>DU,SdkGroup:()=>CHn,SdkGroupName:()=>_gt,SecurityScheme:()=>NHn,SecuritySchemeId:()=>Ogt,Server:()=>kYr,ServerVariable:()=>MHn,Source:()=>DHn,StatusCode:()=>vMe,Tag:()=>zHn,TagId:()=>TU,WithAvailability:()=>tu,WithDescription:()=>gi,WithEncoding:()=>B5,WithInline:()=>FA,WithName:()=>Pp,WithNamespace:()=>Pl,WithSdkGroupName:()=>Zd,WithSdkMethodName:()=>OMe,WithSource:()=>Ja,WithStatusCode:()=>nre,WithTitle:()=>em});var Z={};Q(Z,{JsonError:()=>$pr,ParseError:()=>Jpr,any:()=>Qjl,bigint:()=>Ijl,boolean:()=>qjl,booleanLiteral:()=>Mjl,date:()=>xjl,discriminant:()=>Kjl,enum_:()=>bHn,getObjectLikeUtils:()=>Rxe,getObjectUtils:()=>$2t,getSchemaUtils:()=>Rv,isProperty:()=>Agt,lazy:()=>jjl,lazyObject:()=>Fjl,list:()=>_Hn,never:()=>Vjl,number:()=>kjl,object:()=>AHn,objectWithoutOptionalProperties:()=>Rjl,optional:()=>oas,property:()=>Sjl,record:()=>Gjl,set:()=>Hjl,string:()=>Ujl,stringLiteral:()=>zjl,transform:()=>aas,undiscriminatedUnion:()=>Jjl,union:()=>Xjl,unknown:()=>Ljl,withParsedProperties:()=>uas});var Kf={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 b_(e,t){return`Expected ${t}. Received ${RiA(e)}.`}function RiA(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}function CR(e){return{...e,json:Ejl(e.json),parse:Ejl(e.parse)}}function Ejl(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(`
1528
1528
  `)),{ok:!0,value:t}):n}}function gHn(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var $pr=class e extends Error{errors;constructor(t){super(t.map(gHn).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var Jpr=class e extends Error{errors;constructor(t){super(t.map(gHn).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function Rv(e){return{nullable:()=>FiA(e),optional:()=>oas(e),optionalNullable:()=>NiA(e),transform:t=>aas(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new Jpr(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new $pr(n.errors)}}}function FiA(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:()=>Kf.NULLABLE};return{...t,...Rv(t)}}function oas(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:()=>Kf.OPTIONAL};return{...t,...Rv(t)}}function NiA(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:()=>Kf.OPTIONAL_NULLABLE};return{...t,...Rv(t)}}function aas(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,...Rv(r)}}function Ijl(){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:b_(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:b_(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Kf.BIGINT};return{...CR(e),...Rv(e)}}var MiA=/^([+-]?\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)?)?)?)?$/;function xjl(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:b_(t,"string")}]}:MiA.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:b_(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:b_(t,"Date object")}]},getType:()=>Kf.DATE};return{...CR(e),...Rv(e)}}function SR(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...CR(r),...Rv(r)}}}function bHn(e){let t=new Set(e);return SR(Kf.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:b_(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:b_(n,"enum")}]}:{ok:!0,value:n})()}function jjl(e){let t=sas(e);return{...t,...Rv(t)}}function sas(e){return{parse:(t,r)=>Kpr(e).parse(t,r),json:(t,r)=>Kpr(e).json(t,r),getType:()=>Kpr(e).getType()}}function Kpr(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function QYr(e){return Object.entries(e)}function qYr(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function rat(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function VYr(e){return Object.keys(e)}function Cjl(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function Rxe(e){return{withParsedProperties:t=>uas(e,t)}}function uas(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let a=Object.entries(t).reduce((s,[c,l])=>({...s,[c]:typeof l=="function"?l(o.value):l}),{});return{ok:!0,value:{...o.value,...a}}},json:(n,i)=>{if(!rat(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:b_(n,"object")}]};let o=new Set(Object.keys(t)),a=qYr(n,Object.keys(n).filter(s=>!o.has(s)));return e.json(a,i)},getType:()=>e.getType()};return{...r,...Rv(r),...Rxe(r)}}function Sjl(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Agt(e){return e.isProperty}function AHn(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>Agt(n)?n.rawKey:r),_getParsedProperties:()=>VYr(e),parse:(r,n)=>{let i={},o=[];for(let[a,s]of QYr(e)){let c=Agt(s)?s.rawKey:a,l=Agt(s)?s.valueSchema:s,u={rawKey:c,parsedKey:a,valueSchema:l};i[c]=u,Tjl(l)&&o.push(c)}return Bjl({value:r,requiredKeys:o,getProperty:a=>{let s=i[a];if(s!=null)return{transformedKey:s.parsedKey,transform:c=>s.valueSchema.parse(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[o,a]of QYr(e)){let s=Agt(a)?a.valueSchema:a;Tjl(s)&&i.push(o)}return Bjl({value:r,requiredKeys:i,getProperty:o=>{let a=e[o];if(a!=null)return Agt(a)?{transformedKey:a.rawKey,transform:s=>a.valueSchema.json(s,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}:{transformedKey:o,transform:s=>a.json(s,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>Kf.OBJECT};return{...CR(t),...Rv(t),...Rxe(t),...$2t(t)}}function Bjl({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:o=[]}){if(!rat(e))return{ok:!1,errors:[{path:o,message:b_(e,"object")}]};let a=new Set(t),s=[],c={};for(let[l,u]of Object.entries(e)){let p=r(l);if(p!=null){a.delete(l);let d=p.transform(u);d.ok?c[p.transformedKey]=d.value:(c[l]=u,s.push(...d.errors))}else switch(n){case"fail":s.push({path:[...o,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=u;break}}return s.push(...t.filter(l=>a.has(l)).map(l=>({path:o,message:`Missing required key "${l}"`}))),s.length===0||i?{ok:!0,value:c}:{ok:!1,errors:s}}function $2t(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>Djl({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>Djl({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Kf.OBJECT};return{...r,...Rv(r),...Rxe(r),...$2t(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let a=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!a.ok)return a;let s={};if(typeof i=="object"&&i!=null)for(let[c,l]of Object.entries(i))t.has(c)||(s[c]=l);return{ok:!0,value:{...s,...a.value}}},json:(i,o)=>{let a=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!a.ok)return a;let s={};if(typeof i=="object"&&i!=null)for(let[c,l]of Object.entries(i))r.has(c)||(s[c]=l);return{ok:!0,value:{...s,...a.value}}},getType:()=>Kf.OBJECT};return{...n,...Rv(n),...Rxe(n),...$2t(n)}}}}function Djl({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!rat(t))return{ok:!1,errors:[{path:i,message:b_(t,"object")}]};let o=new Set(e),[a,s]=Cjl(VYr(t),u=>o.has(u)),c=r(qYr(t,s)),l=n(qYr(t,a));return c.ok&&l.ok?{ok:!0,value:{...c.value,...l.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...l.ok?[]:l.errors]}}function Tjl(e){return!ziA(e)}function ziA(e){switch(e.getType()){case Kf.ANY:case Kf.UNKNOWN:case Kf.OPTIONAL:case Kf.OPTIONAL_NULLABLE:return!0;default:return!1}}function Rjl(e){return AHn(e)}function Fjl(e){let t={...sas(e),_getRawProperties:()=>Kpr(e)._getRawProperties(),_getParsedProperties:()=>Kpr(e)._getParsedProperties()};return{...t,...Rv(t),...Rxe(t),...$2t(t)}}function _Hn(e){let t={parse:(r,n)=>Njl(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>Njl(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>Kf.LIST};return{...CR(t),...Rv(t)}}function Njl(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let o=[];return n.ok||o.push(...n.errors),i.ok||o.push(...i.errors),{ok:!1,errors:o}},{ok:!0,value:[]}):{ok:!1,errors:[{message:b_(e,"list"),path:[]}]}}function Mjl(e){return SR(Kf.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:b_(r,`${e.toString()}`)}]})()}function zjl(e){return SR(Kf.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:b_(r,`"${e}"`)}]})()}var Qjl=SR(Kf.ANY,e=>({ok:!0,value:e}));var qjl=SR(Kf.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:b_(e,"boolean")}]});var Vjl=SR(Kf.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var kjl=SR(Kf.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:b_(e,"number")}]});var Ujl=SR(Kf.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:b_(e,"string")}]});var Ljl=SR(Kf.UNKNOWN,e=>({ok:!0,value:e}));function Gjl(e,t){let r={parse:(n,i)=>Wjl({value:n,isKeyNumeric:e.getType()===Kf.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,a)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>Wjl({value:n,isKeyNumeric:e.getType()===Kf.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,a)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>Kf.RECORD};return{...CR(r),...Rv(r)}}function Wjl({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return rat(e)?QYr(e).reduce((o,[a,s])=>{if(s===void 0)return o;let c=o,l=a;if(t){let m=a.length>0?Number(a):NaN;Number.isNaN(m)||(l=m)}let u=r(l),p=n(s,l);if(c.ok&&u.ok&&p.ok)return{ok:!0,value:{...c.value,[u.value]:p.value}};let d=[];return c.ok||d.push(...c.errors),u.ok||d.push(...u.errors),p.ok||d.push(...p.errors),{ok:!1,errors:d}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:b_(e,"object")}]}}function Hjl(e){let t=_Hn(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:b_(n,"Set")}]},getType:()=>Kf.SET};return{...CR(r),...Rv(r)}}function Jjl(e){let t={parse:(r,n)=>$jl((i,o)=>i.parse(r,o),e,n),json:(r,n)=>$jl((i,o)=>i.json(r,o),e,n),getType:()=>Kf.UNDISCRIMINATED_UNION};return{...CR(t),...Rv(t)}}function $jl(e,t,r){let n=[];for(let[i,o]of t.entries()){let a=e(o,{...r,skipValidation:!1});if(a.ok)return a;for(let s of a.errors)n.push({path:s.path,message:`[Variant ${i}] ${s.message}`})}return{ok:!1,errors:n}}function Kjl(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function Xjl(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=bHn(VYr(t)),o={parse:(a,s)=>Yjl({value:a,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:c=>i.parse(c,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,l)=>l.parse(c,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),json:(a,s)=>Yjl({value:a,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:c=>i.json(c,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...s?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:c=>t[c],allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(c,l)=>l.json(c,s),breadcrumbsPrefix:s?.breadcrumbsPrefix}),getType:()=>Kf.UNION};return{...CR(o),...Rv(o),...Rxe(o)}}function Yjl({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:a,breadcrumbsPrefix:s=[]}){if(!rat(e))return{ok:!1,errors:[{path:s,message:b_(e,"object")}]};let{[t]:c,...l}=e;if(c==null)return{ok:!1,errors:[{path:s,message:`Missing discriminant ("${t}")`}]};let u=n(c);if(!u.ok)return{ok:!1,errors:u.errors};let p=i(u.value);if(p==null)return o?{ok:!0,value:{[r]:u.value,...l}}:{ok:!1,errors:[{path:[...s,t],message:"Unexpected discriminant value"}]};let d=a(l,p);return d.ok?{ok:!0,value:{[r]:c,...d.value}}:d}var vHn=Z.objectWithoutOptionalProperties({usernameVariableName:Z.string().optional(),usernameEnvVar:Z.string().optional(),passwordVariableName:Z.string().optional(),passwordEnvVar:Z.string().optional()});var OHn=Z.objectWithoutOptionalProperties({tokenVariableName:Z.string().optional(),tokenEnvVar:Z.string().optional()});var wHn=Z.objectWithoutOptionalProperties({typeName:Z.string()});var PHn=Z.union("type",{protobuf:wHn}).transform({transform:e=>e.type==="protobuf"?Hpr.protobuf(e):e,untransform:({_visit:e,...t})=>t});var EHn=Z.objectWithoutOptionalProperties({headerName:Z.string(),prefix:Z.string().optional(),headerVariableName:Z.string().optional(),headerEnvVar:Z.string().optional()});var IHn=Z.objectWithoutOptionalProperties({type:Z.stringLiteral("namespace"),name:Z.string()});var xHn=Z.string();var jHn=Z.enum_(["GenerallyAvailable","Beta","Deprecated"]);var tu=Z.objectWithoutOptionalProperties({availability:jHn.optional()});var gi=Z.objectWithoutOptionalProperties({description:Z.string().optional()});var FA=Z.objectWithoutOptionalProperties({inline:Z.boolean().optional()});var Pp=Z.objectWithoutOptionalProperties({nameOverride:Z.string().optional(),generatedName:Z.string()});var Pl=Z.objectWithoutOptionalProperties({namespace:Z.string().optional()});var CHn=Z.undiscriminatedUnion([Z.string(),IHn]);var _gt=Z.list(CHn);var Zd=Z.objectWithoutOptionalProperties({groupName:_gt.optional()});var SHn=Z.objectWithoutOptionalProperties({file:Z.string()});var BHn=Z.objectWithoutOptionalProperties({file:Z.string()});var DHn=Z.union("type",{openapi:SHn,protobuf:BHn}).transform({transform:e=>{switch(e.type){case"openapi":return ZQ.openapi(e);case"protobuf":return ZQ.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ja=Z.objectWithoutOptionalProperties({source:DHn.optional()});var em=Z.objectWithoutOptionalProperties({title:Z.string().optional()});var THn=Z.objectWithoutOptionalProperties({snake:Z.string().optional(),camel:Z.string().optional(),screamingSnake:Z.string().optional(),pascal:Z.string().optional()});var vgt=Z.objectWithoutOptionalProperties({nameOverride:Z.string().optional(),generatedName:Z.string(),value:Z.string(),casing:THn.optional()}).extend(gi).extend(tu);var Ypr=Z.objectWithoutOptionalProperties({default:vgt.optional(),values:Z.list(vgt)}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(Ja).extend(em).extend(FA);var RHn=Z.objectWithoutOptionalProperties({scopesEnum:Ypr.optional()});var FHn=Z.objectWithoutOptionalProperties({queryParameterName:Z.string()});var DU=Z.string();var NHn=Z.union("type",{basic:vHn,bearer:OHn,header:EHn,query:FHn,oauth:RHn}).transform({transform:e=>{switch(e.type){case"basic":return ER.basic(e);case"bearer":return ER.bearer(e);case"header":return ER.header(e);case"query":return ER.query(e);case"oauth":return ER.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ogt=Z.string();var MHn=Z.objectWithoutOptionalProperties({id:Z.string(),default:Z.string().optional(),values:Z.list(Z.string()).optional()});var kYr=Z.objectWithoutOptionalProperties({name:Z.string().optional(),url:Z.string(),audiences:Z.list(Z.string()).optional(),defaultUrl:Z.string().optional(),urlTemplate:Z.string().optional(),variables:Z.list(MHn).optional()}).extend(gi);var vMe=Z.number();var TU=Z.string();var zHn=Z.objectWithoutOptionalProperties({id:TU}).extend(gi);var B5=Z.objectWithoutOptionalProperties({encoding:PHn.optional()});var OMe=Z.objectWithoutOptionalProperties({sdkMethodName:Z.string().optional()});var nre=Z.objectWithoutOptionalProperties({statusCode:vMe.optional()});var las={};Q(las,{FullExample:()=>y0,FullObjectExample:()=>VHn,FullOneOfExample:()=>kHn,KeyValuePair:()=>UHn,LiteralExample:()=>QHn,NullExample:()=>qHn,PrimitiveExample:()=>Xpr,PropertyKey:()=>Zpr});var QHn=Z.union("type",{boolean:Z.object({value:Z.boolean()}),string:Z.object({value:Z.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return bgt.boolean(e.value);case"string":return bgt.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var qHn=Z.objectWithoutOptionalProperties({});var Xpr=Z.union("type",{int:Z.object({value:Z.number()}),int64:Z.object({value:Z.number()}),uint:Z.object({value:Z.number()}),uint64:Z.object({value:Z.number()}),float:Z.object({value:Z.number()}),double:Z.object({value:Z.number()}),string:Z.object({value:Z.string()}),datetime:Z.object({value:Z.string()}),date:Z.object({value:Z.string()}),base64:Z.object({value:Z.string()}),boolean:Z.object({value:Z.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return Ga.int(e.value);case"int64":return Ga.int64(e.value);case"uint":return Ga.uint(e.value);case"uint64":return Ga.uint64(e.value);case"float":return Ga.float(e.value);case"double":return Ga.double(e.value);case"string":return Ga.string(e.value);case"datetime":return Ga.datetime(e.value);case"date":return Ga.date(e.value);case"base64":return Ga.base64(e.value);case"boolean":return Ga.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var y0=Z.union("type",{primitive:Z.object({value:Xpr}),object:Z.lazyObject(()=>VHn),array:Z.object({value:Z.list(Z.lazy(()=>y0))}),map:Z.object({value:Z.list(Z.lazyObject(()=>UHn))}),enum:Z.object({value:Z.string()}),literal:Z.object({value:QHn}),oneOf:Z.object({value:Z.lazy(()=>kHn)}),null:qHn,unknown:Z.object({value:Z.lazy(()=>y0)})}).transform({transform:e=>{switch(e.type){case"primitive":return Al.primitive(e.value);case"object":return Al.object(e);case"array":return Al.array(e.value);case"map":return Al.map(e.value);case"enum":return Al.enum(e.value);case"literal":return Al.literal(e.value);case"oneOf":return Al.oneOf(e.value);case"null":return Al.null(e);case"unknown":return Al.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Zpr=Z.string();var VHn=Z.objectWithoutOptionalProperties({properties:Z.record(Zpr,Z.lazy(()=>y0))});var kHn=Z.union("type",{discriminated:Z.object({value:Z.record(Zpr,Z.lazy(()=>y0))}),undiscriminated:Z.object({value:Z.lazy(()=>y0)})}).transform({transform:e=>{switch(e.type){case"discriminated":return ggt.discriminated(e.value);case"undiscriminated":return ggt.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var UHn=Z.objectWithoutOptionalProperties({key:Xpr,value:Z.lazy(()=>y0)});var pas={};Q(pas,{AllOfPropertyConflict:()=>efr,ArraySchema:()=>LHn,Availability:()=>jHn,BooleanSchema:()=>WHn,BytesResponse:()=>tfr,CasingOverrides:()=>THn,CommonProperty:()=>GHn,CursorPagination:()=>HHn,CustomCodeSample:()=>YHn,CustomCodeSampleLanguage:()=>$Hn,CustomCodeSampleSdk:()=>KHn,CustomPagination:()=>XHn,DiscriminatedOneOfSchema:()=>ZHn,DoubleSchema:()=>e$n,Endpoint:()=>h$n,EndpointExample:()=>ifr,EndpointResponseExample:()=>n$n,EndpointSdkName:()=>wMe,EndpointSecurity:()=>ofr,EnumSchema:()=>Ypr,EnumValue:()=>vgt,ErrorExample:()=>a$n,FernExample:()=>t$n,FileResponse:()=>dfr,FileSchema:()=>f$n,FormUrlEncodedRequest:()=>c$n,FullEndpointExample:()=>o$n,GlobalHeader:()=>y$n,GlobalSecurity:()=>g$n,Header:()=>wgt,HeaderExample:()=>rfr,HttpEndpointServer:()=>afr,HttpError:()=>s$n,HttpMethod:()=>sfr,IdempotencyHeader:()=>b$n,IntSchema:()=>A$n,JsonRequest:()=>l$n,JsonResponse:()=>mfr,LiteralSchema:()=>gfr,LiteralSchemaValue:()=>_$n,LongSchema:()=>v$n,MapSchema:()=>P$n,MultipartFormDataWebhookPayload:()=>E$n,MultipartRequest:()=>pfr,MultipartRequestProperty:()=>Pgt,MultipartRequestPropertyEncoding:()=>p$n,MultipartSchema:()=>d$n,NullableSchema:()=>I$n,ObjectProperty:()=>x$n,ObjectPropertyConflictInfo:()=>bfr,ObjectSchema:()=>j$n,OctetStreamRequest:()=>ffr,OffsetPagination:()=>u$n,OneOfSchema:()=>C$n,OpenApiIntermediateRepresentation:()=>Zjl,OptionalSchema:()=>k$n,Pagination:()=>ufr,PathParameter:()=>cfr,PathParameterExample:()=>i$n,PrimitiveSchema:()=>Igt,PrimitiveSchemaValue:()=>w$n,QueryParameter:()=>lfr,QueryParameterExample:()=>nfr,ReferencedSchema:()=>PMe,Request:()=>m$n,Response:()=>hfr,RetriesConfiguration:()=>yfr,Schema:()=>Vd,Schemas:()=>B$n,SdkGroupInfo:()=>D$n,StreamingResponseExample:()=>r$n,StringSchema:()=>O$n,SupportedSdkLanguage:()=>JHn,Tags:()=>T$n,TextResponse:()=>Egt,UnDiscriminatedOneOfSchema:()=>S$n,Webhook:()=>R$n,WebhookExampleCall:()=>Afr,WebhookHttpMethod:()=>_fr,WebsocketChannel:()=>V$n,WebsocketHandshake:()=>F$n,WebsocketMessageExample:()=>Q$n,WebsocketMessageOrigin:()=>N$n,WebsocketMessageSchema:()=>M$n,WebsocketServer:()=>z$n,WebsocketSessionExample:()=>q$n});var efr=Z.objectWithoutOptionalProperties({propertyKey:Z.string(),allOfSchemaIds:Z.list(DU),conflictingTypeSignatures:Z.boolean()});var LHn=Z.objectWithoutOptionalProperties({value:Z.lazy(()=>Vd),minItems:Z.number().optional(),maxItems:Z.number().optional()}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em).extend(FA);var WHn=Z.objectWithoutOptionalProperties({default:Z.boolean().optional()});var tfr=Z.objectWithoutOptionalProperties({}).extend(gi).extend(Ja).extend(nre);var GHn=Z.objectWithoutOptionalProperties({key:Z.string(),schema:Z.lazy(()=>Vd)});var HHn=Z.objectWithoutOptionalProperties({cursor:Z.string(),nextCursor:Z.property("next_cursor",Z.string()),results:Z.string()});var $Hn=Z.objectWithoutOptionalProperties({name:Z.string().optional(),language:Z.string(),code:Z.string(),install:Z.string().optional()}).extend(gi);var JHn=Z.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var KHn=Z.objectWithoutOptionalProperties({name:Z.string().optional(),sdk:JHn,code:Z.string()}).extend(gi);var YHn=Z.union("type",{language:$Hn,sdk:KHn}).transform({transform:e=>{switch(e.type){case"language":return bMe.language(e);case"sdk":return bMe.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var XHn=Z.objectWithoutOptionalProperties({results:Z.string()});var ZHn=Z.objectWithoutOptionalProperties({discriminantProperty:Z.string(),discriminantPropertyNameOverride:Z.string().optional(),commonProperties:Z.list(Z.lazyObject(()=>GHn)),schemas:Z.record(Z.string(),Z.lazy(()=>Vd))}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(B5).extend(Ja).extend(em).extend(FA);var e$n=Z.objectWithoutOptionalProperties({default:Z.number().optional(),minimum:Z.number().optional(),maximum:Z.number().optional(),exclusiveMinimum:Z.boolean().optional(),exclusiveMaximum:Z.boolean().optional(),multipleOf:Z.number().optional()});var t$n=Z.unknown();var r$n=Z.objectWithoutOptionalProperties({sse:Z.boolean(),events:Z.list(Z.lazy(()=>y0))});var n$n=Z.union("type",{withStreaming:r$n,withoutStreaming:Z.object({value:Z.lazy(()=>y0)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return rre.withStreaming(e);case"withoutStreaming":return rre.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var rfr=Z.objectWithoutOptionalProperties({name:Z.string(),value:Z.lazy(()=>y0)});var i$n=Z.objectWithoutOptionalProperties({name:Z.string(),parameterNameOverride:Z.string().optional(),value:Z.lazy(()=>y0)});var nfr=Z.objectWithoutOptionalProperties({name:Z.string(),value:Z.lazy(()=>y0)});var o$n=Z.objectWithoutOptionalProperties({name:Z.string().optional(),pathParameters:Z.list(i$n).optional(),queryParameters:Z.list(nfr).optional(),headers:Z.list(rfr).optional(),request:Z.lazy(()=>y0).optional(),response:n$n.optional(),codeSamples:Z.list(YHn)}).extend(gi);var ifr=Z.union("type",{unknown:Z.object({value:t$n}),full:o$n}).transform({transform:e=>{switch(e.type){case"unknown":return tre.unknown(e.value);case"full":return tre.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var wMe=Z.objectWithoutOptionalProperties({groupName:_gt,methodName:Z.string()});var ofr=Z.list(Z.record(Ogt,Z.list(Z.string())));var wgt=Z.objectWithoutOptionalProperties({name:Z.string(),schema:Z.lazy(()=>Vd),env:Z.string().optional(),parameterNameOverride:Z.string().optional()}).extend(gi).extend(tu).extend(Ja);var afr=Z.objectWithoutOptionalProperties({name:Z.string().optional(),url:Z.string().optional(),audiences:Z.list(Z.string()).optional()});var a$n=Z.objectWithoutOptionalProperties({name:Z.string().optional(),description:Z.string().optional(),example:Z.lazy(()=>y0)});var s$n=Z.objectWithoutOptionalProperties({schema:Z.lazy(()=>Vd).optional(),examples:Z.list(a$n).optional()}).extend(gi).extend(Pp).extend(Ja);var sfr=Z.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var u$n=Z.objectWithoutOptionalProperties({offset:Z.string(),results:Z.string(),step:Z.string().optional(),hasNextPage:Z.string().optional()});var ufr=Z.union("type",{cursor:HHn,offset:u$n,custom:XHn}).transform({transform:e=>{switch(e.type){case"cursor":return JJ.cursor(e);case"offset":return JJ.offset(e);case"custom":return JJ.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var cfr=Z.objectWithoutOptionalProperties({name:Z.string(),schema:Z.lazy(()=>Vd),variableReference:Z.string().optional(),parameterNameOverride:Z.string().optional()}).extend(gi).extend(tu).extend(Ja);var lfr=Z.objectWithoutOptionalProperties({name:Z.string(),schema:Z.lazy(()=>Vd),parameterNameOverride:Z.string().optional()}).extend(gi).extend(tu).extend(Ja);var c$n=Z.objectWithoutOptionalProperties({schema:Z.lazy(()=>Vd),contentType:Z.string().optional(),additionalProperties:Z.boolean()}).extend(gi).extend(Ja);var l$n=Z.objectWithoutOptionalProperties({schema:Z.lazy(()=>Vd),contentType:Z.string().optional(),additionalProperties:Z.boolean()}).extend(gi).extend(Ja);var p$n=Z.enum_(["json","form"]);var f$n=Z.objectWithoutOptionalProperties({isOptional:Z.boolean(),isArray:Z.boolean()}).extend(gi);var d$n=Z.union("type",{file:f$n,json:Z.object({value:Z.lazy(()=>Vd)})}).transform({transform:e=>{switch(e.type){case"file":return AMe.file(e);case"json":return AMe.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Pgt=Z.objectWithoutOptionalProperties({key:Z.string(),schema:d$n,contentType:Z.string().optional(),exploded:Z.boolean().optional(),encoding:p$n.optional()}).extend(gi);var pfr=Z.objectWithoutOptionalProperties({name:Z.string().optional(),properties:Z.list(Pgt)}).extend(gi).extend(Ja);var ffr=Z.objectWithoutOptionalProperties({contentType:Z.string().optional()}).extend(gi).extend(Ja);var m$n=Z.union("type",{octetStream:ffr,multipart:pfr,json:l$n,formUrlEncoded:c$n}).transform({transform:e=>{switch(e.type){case"octetStream":return Txe.octetStream(e);case"multipart":return Txe.multipart(e);case"json":return Txe.json(e);case"formUrlEncoded":return Txe.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var dfr=Z.objectWithoutOptionalProperties({}).extend(gi).extend(Ja).extend(nre);var mfr=Z.objectWithoutOptionalProperties({schema:Z.lazy(()=>Vd),responseProperty:Z.string().optional()}).extend(gi).extend(Ja).extend(nre);var Egt=Z.objectWithoutOptionalProperties({}).extend(gi).extend(Ja).extend(nre);var hfr=Z.union("type",{file:dfr,json:mfr,text:Egt,bytes:tfr,streamingSse:mfr,streamingText:Egt,streamingJson:mfr}).transform({transform:e=>{switch(e.type){case"file":return rz.file(e);case"json":return rz.json(e);case"text":return rz.text(e);case"bytes":return rz.bytes(e);case"streamingSse":return rz.streamingSse(e);case"streamingText":return rz.streamingText(e);case"streamingJson":return rz.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var yfr=Z.union("type",{disabled:Z.object({value:Z.boolean().optional()})}).transform({transform:e=>e.type==="disabled"?zYr.disabled(e.value):e,untransform:({_visit:e,...t})=>t});var h$n=Z.objectWithoutOptionalProperties({authed:Z.boolean(),security:ofr.optional(),internal:Z.boolean().optional(),idempotent:Z.boolean().optional(),method:sfr,audiences:Z.list(Z.string()),path:Z.string(),summary:Z.string().optional(),operationId:Z.string().optional(),tags:Z.list(TU),pathParameters:Z.list(cfr),queryParameters:Z.list(lfr),headers:Z.list(wgt),sdkName:wMe.optional(),generatedRequestName:Z.string(),requestNameOverride:Z.string().optional(),request:m$n.optional(),response:hfr.optional(),errors:Z.record(vMe,s$n),servers:Z.list(afr),examples:Z.list(ifr),pagination:ufr.optional(),retries:yfr.optional()}).extend(gi).extend(tu).extend(Ja).extend(Pl);var y$n=Z.objectWithoutOptionalProperties({header:Z.string(),name:Z.string().optional(),optional:Z.boolean().optional(),env:Z.string().optional(),schema:Z.lazy(()=>Vd).optional()});var g$n=Z.list(Z.record(Ogt,Z.list(Z.string())));var b$n=Z.objectWithoutOptionalProperties({header:Z.string(),name:Z.string().optional(),env:Z.string().optional(),schema:Z.lazy(()=>Vd).optional()});var A$n=Z.objectWithoutOptionalProperties({default:Z.number().optional(),minimum:Z.number().optional(),maximum:Z.number().optional(),exclusiveMinimum:Z.boolean().optional(),exclusiveMaximum:Z.boolean().optional(),multipleOf:Z.number().optional()});var _$n=Z.union("type",{boolean:Z.object({value:Z.boolean()}),string:Z.object({value:Z.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return WP.boolean(e.value);case"string":return WP.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var gfr=Z.objectWithoutOptionalProperties({value:_$n}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em);var v$n=Z.objectWithoutOptionalProperties({default:Z.number().optional()});var O$n=Z.objectWithoutOptionalProperties({default:Z.string().optional(),pattern:Z.string().optional(),format:Z.string().optional(),minLength:Z.number().optional(),maxLength:Z.number().optional()});var w$n=Z.union("type",{int:A$n,int64:v$n,uint:Z.object({}),uint64:Z.object({}),float:Z.object({}),double:e$n,string:O$n,datetime:Z.object({}),date:Z.object({}),base64:Z.object({}),boolean:WHn}).transform({transform:e=>{switch(e.type){case"int":return Ph.int(e);case"int64":return Ph.int64(e);case"uint":return Ph.uint();case"uint64":return Ph.uint64();case"float":return Ph.float();case"double":return Ph.double(e);case"string":return Ph.string(e);case"datetime":return Ph.datetime();case"date":return Ph.date();case"base64":return Ph.base64();case"boolean":return Ph.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var Igt=Z.objectWithoutOptionalProperties({schema:w$n}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em);var P$n=Z.objectWithoutOptionalProperties({key:Igt,value:Z.lazy(()=>Vd),minProperties:Z.number().optional(),maxProperties:Z.number().optional()}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(B5).extend(em).extend(FA);var E$n=Z.objectWithoutOptionalProperties({name:Z.string().optional(),properties:Z.list(Pgt)}).extend(gi).extend(Ja);var I$n=Z.objectWithoutOptionalProperties({value:Z.lazy(()=>Vd)}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em).extend(FA);var bfr=Z.objectWithoutOptionalProperties({differentSchema:Z.boolean()});var x$n=Z.objectWithoutOptionalProperties({key:Z.string(),schema:Z.lazy(()=>Vd),readonly:Z.boolean().optional(),writeonly:Z.boolean().optional(),conflict:Z.record(DU,bfr),generatedName:Z.string(),nameOverride:Z.string().optional(),audiences:Z.list(Z.string())}).extend(tu);var PMe=Z.objectWithoutOptionalProperties({schema:DU}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(Ja).extend(em);var j$n=Z.objectWithoutOptionalProperties({allOf:Z.list(PMe),properties:Z.list(Z.lazyObject(()=>x$n)),allOfPropertyConflicts:Z.list(efr),additionalProperties:Z.boolean(),minProperties:Z.number().optional(),maxProperties:Z.number().optional()}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(Ja).extend(em).extend(FA);var C$n=Z.union("type",{discriminated:Z.lazyObject(()=>ZHn),undiscriminated:Z.lazyObject(()=>S$n)}).transform({transform:e=>{switch(e.type){case"discriminated":return _Me.discriminated(e);case"undiscriminated":return _Me.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var B$n=Z.objectWithoutOptionalProperties({rootSchemas:Z.record(DU,Z.lazy(()=>Vd)),namespacedSchemas:Z.record(xHn,Z.record(DU,Z.lazy(()=>Vd)))});var D$n=Z.objectWithoutOptionalProperties({summary:Z.string().optional(),description:Z.string().optional()});var T$n=Z.objectWithoutOptionalProperties({tagsById:Z.record(TU,zHn),orderedTagIds:Z.list(TU).optional()});var Afr=Z.objectWithoutOptionalProperties({name:Z.string().optional(),payload:Z.lazy(()=>y0)}).extend(gi);var _fr=Z.enum_(["GET","POST"]);var R$n=Z.objectWithoutOptionalProperties({audiences:Z.list(Z.string()),sdkName:wMe.optional(),method:_fr,summary:Z.string().optional(),operationId:Z.string(),tags:Z.list(TU),headers:Z.list(wgt),generatedPayloadName:Z.string(),payload:Z.lazy(()=>Vd),multipartFormData:E$n.optional(),response:hfr.optional(),examples:Z.list(Afr)}).extend(gi).extend(Ja).extend(Pl);var F$n=Z.objectWithoutOptionalProperties({queryParameters:Z.list(lfr),headers:Z.list(wgt),pathParameters:Z.list(cfr)});var N$n=Z.enum_(["client","server"]);var M$n=Z.objectWithoutOptionalProperties({name:Z.string(),origin:N$n,body:Z.lazy(()=>Vd),methodName:Z.string().optional()});var z$n=Z.objectWithoutOptionalProperties({name:Z.string(),url:Z.string()});var Q$n=Z.objectWithoutOptionalProperties({messageType:Z.string(),payload:Z.lazy(()=>y0)}).extend(gi);var q$n=Z.objectWithoutOptionalProperties({name:Z.string().optional(),queryParameters:Z.list(nfr).optional(),headers:Z.list(rfr).optional(),messages:Z.list(Q$n)}).extend(gi);var V$n=Z.objectWithoutOptionalProperties({audiences:Z.list(Z.string()),path:Z.string(),groupName:_gt,summary:Z.string().optional(),handshake:F$n,messages:Z.list(M$n),servers:Z.list(z$n),examples:Z.list(q$n)}).extend(gi).extend(Ja);var Zjl=Z.objectWithoutOptionalProperties({apiVersion:Z.unknown().optional(),title:Z.string().optional(),description:Z.string().optional(),basePath:Z.string().optional(),servers:Z.list(kYr),websocketServers:Z.list(kYr),groups:Z.record(Z.string(),D$n),tags:T$n,hasEndpointsMarkedInternal:Z.boolean(),endpoints:Z.list(h$n),webhooks:Z.list(R$n),channels:Z.record(Z.string(),V$n),groupedSchemas:B$n,variables:Z.record(Z.string(),Igt),nonRequestReferencedSchemas:Z.set(DU),securitySchemes:Z.record(Ogt,NHn),security:g$n.optional(),globalHeaders:Z.list(y$n).optional(),idempotencyHeaders:Z.list(b$n).optional()});var k$n=Z.objectWithoutOptionalProperties({value:Z.lazy(()=>Vd)}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em).extend(FA);var Vd=Z.union("type",{primitive:Igt,object:Z.lazyObject(()=>j$n),array:Z.lazyObject(()=>LHn),map:Z.lazyObject(()=>P$n),optional:Z.lazyObject(()=>k$n),enum:Ypr,reference:PMe,literal:gfr,oneOf:Z.object({value:Z.lazy(()=>C$n)}),nullable:Z.lazyObject(()=>I$n),unknown:Pp}).transform({transform:e=>{switch(e.type){case"primitive":return Pc.primitive(e);case"object":return Pc.object(e);case"array":return Pc.array(e);case"map":return Pc.map(e);case"optional":return Pc.optional(e);case"enum":return Pc.enum(e);case"reference":return Pc.reference(e);case"literal":return Pc.literal(e);case"oneOf":return Pc.oneOf(e.value);case"nullable":return Pc.nullable(e);case"unknown":return Pc.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var S$n=Z.objectWithoutOptionalProperties({schemas:Z.list(Z.lazy(()=>Vd))}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(B5).extend(Ja).extend(em).extend(FA);var fas={};Q(fas,{ArraySchemaWithExample:()=>U$n,Base64WithExample:()=>L$n,BooleanWithExample:()=>W$n,CommonPropertyWithExample:()=>G$n,DateWithExample:()=>$$n,DatetimeWithExample:()=>H$n,DiscriminatedOneOfSchemaWithExample:()=>J$n,DoubleWithExample:()=>K$n,EndpointWithExample:()=>eCl,EnumSchemaWithExample:()=>iJn,FloatWithExample:()=>oJn,HeaderWithExample:()=>xgt,HttpErrorWithExample:()=>Y$n,Int64WithExample:()=>aJn,IntWithExample:()=>sJn,JsonRequestWithExample:()=>Z$n,JsonResponseWithExample:()=>Ofr,MapSchemaWithExample:()=>fJn,MultipartFormDataWebhookPayloadWithExample:()=>dJn,NamedFullExample:()=>D5,NullableSchemaWithExample:()=>mJn,ObjectPropertyWithExample:()=>hJn,ObjectSchemaWithExample:()=>yJn,OneOfSchemaWithExample:()=>gJn,OptionalSchemaWithExample:()=>AJn,ParseFormUrlEncodedRequest:()=>eJn,ParseMultipartRequest:()=>tJn,ParseOctetStreamRequest:()=>rJn,PathParameterWithExample:()=>X$n,PrimitiveSchemaValueWithExample:()=>pJn,PrimitiveSchemaWithExample:()=>Pfr,QueryParameterWithExample:()=>vfr,RequestWithExample:()=>nJn,ResponseWithExample:()=>wfr,SchemaWithExample:()=>NA,StringSchemaWithExample:()=>uJn,Uint64WithExample:()=>cJn,UintWithExample:()=>lJn,UnDiscriminatedOneOfSchemaWithExample:()=>bJn,UnknownSchemaWithExample:()=>_Jn,WebhookWithExample:()=>tCl,WebsocketHandshakeWithExample:()=>rCl});var U$n=Z.objectWithoutOptionalProperties({value:Z.lazy(()=>NA),minItems:Z.number().optional(),maxItems:Z.number().optional(),example:Z.list(Z.unknown()).optional()}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em).extend(FA);var L$n=Z.objectWithoutOptionalProperties({example:Z.string().optional()});var W$n=Z.objectWithoutOptionalProperties({default:Z.boolean().optional(),example:Z.boolean().optional()});var G$n=Z.objectWithoutOptionalProperties({key:Z.string(),schema:Z.lazy(()=>NA)});var H$n=Z.objectWithoutOptionalProperties({example:Z.string().optional()});var $$n=Z.objectWithoutOptionalProperties({example:Z.string().optional()});var J$n=Z.objectWithoutOptionalProperties({discriminantProperty:Z.string(),discriminantPropertyNameOverride:Z.string().optional(),commonProperties:Z.list(Z.lazyObject(()=>G$n)),schemas:Z.record(Z.string(),Z.lazy(()=>NA))}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(B5).extend(Ja).extend(em).extend(FA);var K$n=Z.objectWithoutOptionalProperties({default:Z.number().optional(),minimum:Z.number().optional(),maximum:Z.number().optional(),exclusiveMinimum:Z.boolean().optional(),exclusiveMaximum:Z.boolean().optional(),multipleOf:Z.number().optional(),example:Z.number().optional()});var xgt=Z.objectWithoutOptionalProperties({name:Z.string(),schema:Z.lazy(()=>NA),env:Z.string().optional(),parameterNameOverride:Z.string().optional()}).extend(gi).extend(tu).extend(Ja);var D5=Z.objectWithoutOptionalProperties({name:Z.string().optional(),value:Z.unknown()}).extend(gi);var Y$n=Z.objectWithoutOptionalProperties({statusCode:vMe,schema:Z.lazy(()=>NA),fullExamples:Z.list(D5).optional()}).extend(gi).extend(Pp).extend(Ja);var X$n=Z.objectWithoutOptionalProperties({name:Z.string(),schema:Z.lazy(()=>NA),variableReference:Z.string().optional(),parameterNameOverride:Z.string().optional(),explode:Z.boolean().optional()}).extend(gi).extend(tu).extend(Ja);var vfr=Z.objectWithoutOptionalProperties({name:Z.string(),schema:Z.lazy(()=>NA),parameterNameOverride:Z.string().optional(),explode:Z.boolean().optional()}).extend(gi).extend(tu).extend(Ja);var Z$n=Z.objectWithoutOptionalProperties({schema:Z.lazy(()=>NA),contentType:Z.string().optional(),fullExamples:Z.list(D5).optional(),additionalProperties:Z.boolean()}).extend(gi).extend(Ja).extend(OMe);var eJn=Z.objectWithoutOptionalProperties({schema:Z.lazy(()=>NA),contentType:Z.string().optional(),fullExamples:Z.list(D5).optional(),additionalProperties:Z.boolean()}).extend(gi).extend(Ja).extend(OMe);var tJn=Z.objectWithoutOptionalProperties({fullExamples:Z.list(D5).optional()}).extend(pfr).extend(OMe);var rJn=Z.objectWithoutOptionalProperties({}).extend(ffr).extend(OMe);var nJn=Z.union("type",{octetStream:rJn,multipart:tJn,json:Z$n,formUrlEncoded:eJn}).transform({transform:e=>{switch(e.type){case"octetStream":return BU.octetStream(e);case"multipart":return BU.multipart(e);case"json":return BU.json(e);case"formUrlEncoded":return BU.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ofr=Z.objectWithoutOptionalProperties({schema:Z.lazy(()=>NA),responseProperty:Z.string().optional(),fullExamples:Z.list(D5).optional()}).extend(gi).extend(Ja).extend(nre);var wfr=Z.union("type",{file:dfr,json:Ofr,text:Egt,bytes:tfr,streamingSse:Ofr,streamingText:Egt,streamingJson:Ofr}).transform({transform:e=>{switch(e.type){case"file":return Gw.file(e);case"json":return Gw.json(e);case"text":return Gw.text(e);case"bytes":return Gw.bytes(e);case"streamingSse":return Gw.streamingSse(e);case"streamingText":return Gw.streamingText(e);case"streamingJson":return Gw.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var eCl=Z.objectWithoutOptionalProperties({authed:Z.boolean(),security:ofr.optional(),internal:Z.boolean().optional(),idempotent:Z.boolean().optional(),method:sfr,audiences:Z.list(Z.string()),path:Z.string(),summary:Z.string().optional(),operationId:Z.string().optional(),tags:Z.list(TU),pathParameters:Z.list(X$n),queryParameters:Z.list(vfr),headers:Z.list(xgt),sdkName:wMe.optional(),generatedRequestName:Z.string(),requestNameOverride:Z.string().optional(),request:nJn.optional(),response:wfr.optional(),errors:Z.record(vMe,Y$n),servers:Z.list(afr),examples:Z.list(ifr),pagination:ufr.optional(),retries:yfr.optional()}).extend(gi).extend(tu).extend(Ja).extend(Pl);var iJn=Z.objectWithoutOptionalProperties({default:vgt.optional(),values:Z.list(vgt),example:Z.string().optional()}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(Ja).extend(em).extend(FA);var oJn=Z.objectWithoutOptionalProperties({example:Z.number().optional()});var aJn=Z.objectWithoutOptionalProperties({default:Z.number().optional(),example:Z.number().optional()});var sJn=Z.objectWithoutOptionalProperties({default:Z.number().optional(),minimum:Z.number().optional(),maximum:Z.number().optional(),exclusiveMinimum:Z.boolean().optional(),exclusiveMaximum:Z.boolean().optional(),multipleOf:Z.number().optional(),example:Z.number().optional()});var uJn=Z.objectWithoutOptionalProperties({default:Z.string().optional(),pattern:Z.string().optional(),format:Z.string().optional(),minLength:Z.number().optional(),maxLength:Z.number().optional(),example:Z.string().optional()});var cJn=Z.objectWithoutOptionalProperties({default:Z.number().optional(),example:Z.number().optional()});var lJn=Z.objectWithoutOptionalProperties({default:Z.number().optional(),example:Z.number().optional()});var pJn=Z.union("type",{int:sJn,int64:aJn,uint:lJn,uint64:cJn,float:oJn,double:K$n,string:uJn,datetime:H$n,date:$$n,base64:L$n,boolean:W$n}).transform({transform:e=>{switch(e.type){case"int":return Yo.int(e);case"int64":return Yo.int64(e);case"uint":return Yo.uint(e);case"uint64":return Yo.uint64(e);case"float":return Yo.float(e);case"double":return Yo.double(e);case"string":return Yo.string(e);case"datetime":return Yo.datetime(e);case"date":return Yo.date(e);case"base64":return Yo.base64(e);case"boolean":return Yo.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var Pfr=Z.objectWithoutOptionalProperties({schema:pJn}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em);var fJn=Z.objectWithoutOptionalProperties({key:Pfr,value:Z.lazy(()=>NA),minProperties:Z.number().optional(),maxProperties:Z.number().optional(),example:Z.unknown().optional()}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(B5).extend(em).extend(FA);var dJn=Z.objectWithoutOptionalProperties({name:Z.string().optional(),properties:Z.list(Pgt)}).extend(gi).extend(Ja);var mJn=Z.objectWithoutOptionalProperties({value:Z.lazy(()=>NA)}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em).extend(FA);var hJn=Z.objectWithoutOptionalProperties({key:Z.string(),schema:Z.lazy(()=>NA),readonly:Z.boolean().optional(),writeonly:Z.boolean().optional(),audiences:Z.list(Z.string()),conflict:Z.record(DU,bfr),nameOverride:Z.string().optional(),generatedName:Z.string()}).extend(tu);var yJn=Z.objectWithoutOptionalProperties({allOf:Z.list(PMe),properties:Z.list(Z.lazyObject(()=>hJn)),allOfPropertyConflicts:Z.list(efr),fullExamples:Z.list(D5).optional(),additionalProperties:Z.boolean(),minProperties:Z.number().optional(),maxProperties:Z.number().optional()}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(Ja).extend(em).extend(FA);var gJn=Z.union("type",{discriminated:Z.lazyObject(()=>J$n),undiscriminated:Z.lazyObject(()=>bJn)}).transform({transform:e=>{switch(e.type){case"discriminated":return KJ.discriminated(e);case"undiscriminated":return KJ.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var AJn=Z.objectWithoutOptionalProperties({value:Z.lazy(()=>NA)}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em).extend(FA);var _Jn=Z.objectWithoutOptionalProperties({example:Z.unknown()}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(em);var NA=Z.union("type",{primitive:Pfr,object:Z.lazyObject(()=>yJn),array:Z.lazyObject(()=>U$n),map:Z.lazyObject(()=>fJn),optional:Z.lazyObject(()=>AJn),enum:iJn,reference:PMe,literal:gfr,oneOf:Z.object({value:Z.lazy(()=>gJn)}),nullable:Z.lazyObject(()=>mJn),unknown:_Jn}).transform({transform:e=>{switch(e.type){case"primitive":return Bn.primitive(e);case"object":return Bn.object(e);case"array":return Bn.array(e);case"map":return Bn.map(e);case"optional":return Bn.optional(e);case"enum":return Bn.enum(e);case"reference":return Bn.reference(e);case"literal":return Bn.literal(e);case"oneOf":return Bn.oneOf(e.value);case"nullable":return Bn.nullable(e);case"unknown":return Bn.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var bJn=Z.objectWithoutOptionalProperties({schemas:Z.list(Z.lazy(()=>NA))}).extend(Zd).extend(Pl).extend(Pp).extend(gi).extend(tu).extend(B5).extend(Ja).extend(em).extend(FA);var tCl=Z.objectWithoutOptionalProperties({audiences:Z.list(Z.string()),sdkName:wMe.optional(),method:_fr,summary:Z.string().optional(),operationId:Z.string(),tags:Z.list(TU),headers:Z.list(xgt),generatedPayloadName:Z.string(),payload:Z.lazy(()=>NA),multipartFormData:dJn.optional(),response:wfr.optional(),examples:Z.list(Afr)}).extend(gi).extend(Ja).extend(Pl);var rCl=Z.objectWithoutOptionalProperties({queryParameters:Z.list(vfr),headers:Z.list(xgt)});var nCl=/^(\d+)/,Efr=/^[a-zA-Z][a-zA-Z0-9_]*$/,iCl={"<":"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 J2t(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 a=Math.floor(e/10),s=e%10;return s===0?n[a]:`${n[a]}_${t[s]}`}if(e<1e3){let a=Math.floor(e/100),s=e%100;return s===0?`${t[a]}_hundred`:`${t[a]}_hundred_${J2t(s)}`}let i=Math.floor(e/1e3),o=e%1e3;return o===0?`${t[i]}_thousand`:`${t[i]}_thousand_${J2t(o)}`}function UYr(e){let t=e.match(nCl);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let o=J2t(i);return n.length>0?`${o}_${n}`:o}}}function Ifr(e){let t=UYr(e),r=iCl[e];return t!=null?Xd(Xi(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":Xd(Xi(e)))}function T5(e,t){return e.type==="primitive"&&t.type==="primitive"?oCl(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?QiA(e.values,t.values):e.type==="array"&&t.type==="array"?T5(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"?T5(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?qiA(e.value,t.value):e.type==="object"&&t.type==="object"?ViA(e,t):e.type==="map"&&t.type==="map"?oCl(e.key.schema,t.key.schema)&&T5(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function oCl(e,t){return e.type===t.type}function QiA(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return Sj(r,n)}function qiA(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:T5(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:T5(r,i)}):!1}function ViA(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let o=r[n];return o==null?!1:T5(o,i.schema)})}function WI(e){switch(e){case IR.Deprecated:return"deprecated";case IR.Beta:return"pre-release";case IR.GenerallyAvailable:return"generally-available";default:return}}function vJn(e){if(e.type==="protobuf")return{proto:{type:e.typeName}};qe(e.type)}function kiA(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 aCl(e){let t=e?kiA(e):void 0;if(t==null||t.length===0)return E2t;let r=[];for(let[n,i]of t.entries())typeof i=="string"?r.push(Xi(i)):typeof i=="object"?i.type==="namespace"?n<t.length-1?r.push(Xi(i.name)):r.push(i.name,E2t):qe(i.type):qe(i);return r.join("/")}function nat(e){return eu.of(`${aCl(e)}.yml`)}function das({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?E2t:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,aCl(r))}function sCl({sdkName:e,namespaceOverride:t}){return eu.of(`${das({sdkName:e,namespaceOverride:t})}.yml`)}function uCl({location:e,namespaceOverride:t}){return t!=null?xj(eu.of(t),e):e}var UiA=eu.of(Ky);function cCl(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return OJn({namespace:e.namespace,groupName:e.groupName});case"oneOf":return OJn({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return UiA;default:qe(e)}}function OJn({namespace:e,groupName:t}){return e!=null&&t!=null?nat([{type:"namespace",name:e},...t]):e!=null?nat([{type:"namespace",name:e}]):nat(t)}function iat(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;case"unknown":return;default:qe(e)}}function Cy(e){return typeof e=="string"?e:e.type}function xfr(e){if(typeof e!="string")return e.docs}function LYr(e){if(typeof e!="string")return e.default}function mas(e){if(typeof e!="string")return e.validation}function jfr(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}function pCl(e){let t=Cy(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?lCl(e):{...e,type:lCl(e.type)}}function lCl(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function K2t(e){return Cy(e).startsWith("optional<")?e:typeof e=="string"?fCl(e):{...e,type:fCl(e.type)}}function fCl(e){return e.startsWith("optional<")?e:`optional<${e}>`}var LiA=-2147483648,WiA=2147483647,GiA=-17976931348623157e292,HiA=17976931348623157e292;function _l({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:o}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return wJn(e);case"array":return gas({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o});case"map":return bas({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o});case"reference":return yas({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return _as();case"optional":return PJn({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o});case"nullable":return Aas({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o});case"enum":return roA({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:o});case"literal":return e.value,vas(e);case"object":return noA({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o});case"oneOf":return ioA({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o});default:qe(e)}}function wJn(e){switch(e.schema.type){case"string":return KiA({description:e.description,schema:e.schema});case"int":return YiA({description:e.description,schema:e.schema});case"float":return XiA({description:e.description,schema:e.schema});case"double":return ZiA({description:e.description,schema:e.schema});case"boolean":return $iA({description:e.description,schema:e.schema});case"int64":return JiA({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",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:WI(e.availability)}:{}}}function $iA({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 JiA({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 KiA({description:e,schema:t}){let r="string",n=eoA(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 YiA({description:e,schema:t}){let r="integer",n=dCl(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 XiA({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function ZiA({description:e,schema:t}){let r="double",n=dCl(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 eoA(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,o=toA(t);if(!(o==null&&r==null&&n==null&&i==null))return{format:o,pattern:r,minLength:n,maxLength:i}}function toA(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 dCl(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:o,exclusiveMaximum:a}=e;if(r=has(r,t),n=has(n,t),i=has(i,t),!(r==null&&n==null&&o==null&&a==null&&i==null))return{min:r,max:n,exclusiveMin:o,exclusiveMax:a,multipleOf:i}}function has(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[LiA,WiA]:[GiA,HiA];return e<r||e>n?void 0:e}function yas({schema:e,fileContainingReference:t,context:r}){let n=r.getSchema(e.schema,e.namespace);if(n==null)return"unknown";let i=ooA(n)??e.schema,o=iat(n),a=aoA(n),c=EJn({context:r,fileContainingReference:t,declarationFile:OJn({namespace:e.namespace,groupName:o}),type:i});return n.type==="nullable"&&(c=r.options.wrapReferencesToNullableInOptional?`optional<${c}>`:`nullable<${c}>`),n.type==="optional"&&!c.startsWith("optional<")&&(c=`optional<${c}>`),e.description==null&&a==null?c:{type:c,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:WI(e.availability)}:{}}}function gas({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}){let a=_l({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}),s=`list<${Cy(a)}>`;return e.description==null&&e.title==null?s:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:WI(e.availability)}:{},type:s}}function bas({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}){let a=wJn(e.key),s=_l({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}),c=e.encoding!=null?vJn(e.encoding):void 0,l=`map<${Cy(a)}, ${Cy(s)}>`;if(e.description==null&&c==null&&e.title==null)return l;let u={type:l};return e.description!=null&&(u.docs=e.description),e.encoding!=null&&(u.encoding=c),e.availability!=null&&(u.availability=WI(e.availability)),u}function Aas({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}){if(!n.options.respectNullableSchemas)return PJn({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o});let a=_l({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}),s=Cy(a),c=xfr(a),l=LYr(a),u=mas(a),p=pCl(s);if(n.options.wrapReferencesToNullableInOptional&&(p=K2t(p)),e.availability==null&&e.description==null&&c==null&&l==null&&u==null&&e.title==null)return p;let d=typeof p=="string"?{type:p}:p;return(e.description!=null||c!=null)&&(d.docs=e.description??c),l!=null&&(d.default=l),u!=null&&(d.validation=u),e.availability!=null&&(d.availability=WI(e.availability)),d}function PJn({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}){let a=_l({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}),s=Cy(a),c=xfr(a),l=LYr(a),u=mas(a),p=K2t(s);if(e.availability==null&&e.description==null&&c==null&&l==null&&u==null&&e.title==null)return p;let d=typeof p=="string"?{type:p}:p;return(e.description!=null||c!=null)&&(d.docs=e.description??c),l!=null&&(d.default=l),u!=null&&(d.validation=u),e.availability!=null&&(d.availability=WI(e.availability)),d}function _as(){return"unknown"}function vas(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:qe(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:WI(e.availability)}:{}}}function roA({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let o=WYr(e,i),a=e.nameOverride??e.generatedName;n.builder.addType(r,{name:a,schema:o.schema});let s=EJn({type:a,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return s;let c={type:s};return e.description!=null&&(c.docs=e.description),e.default!=null&&(c.default=e.default.value),e.availability!=null&&(c.availability=WI(e.availability)),c}function noA({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}){let a=Oas({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o}),s=e.nameOverride??e.generatedName;n.builder.addType(r,{name:s,schema:a.schema});let c=EJn({type:s,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?c:{type:c,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:WI(e.availability)}:{}}}function ioA({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o}){let a=was({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o}),s=e.nameOverride??e.generatedName;n.builder.addType(r,{name:s,schema:a.schema});let c=EJn({type:s,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?c:{...e.title!=null?{"display-name":e.title}:{},type:c,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:WI(e.availability)}:{}}}function EJn({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 ooA(e){return Pc._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 aoA(e){return Pc._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 MT;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(MT||(MT={}));function oat(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:qe(e)}}function hCl({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let o;switch(e.type){case"primitive":o=coA(e);break;case"array":o=soA({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":o=uoA({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":o=loA({schema:e,context:t,declarationFile:r,namespace:n});break;case"unknown":o=foA(e.nameOverride,e.generatedName);break;case"optional":o=gCl({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":o=poA({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":o=WYr(e,i);break;case"literal":o=doA(e,e.nameOverride,e.generatedName);break;case"object":o=Oas({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"oneOf":o=was({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;default:qe(e)}return o}function Oas({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let o=t.isInState(MT.Request)&&t.options.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),a=!1,s={},c=new Set;for(let m of e.properties){if(m.readonly&&(a=!0),o&&m.readonly)continue;if(Object.keys(m.conflict).length>0){if(Object.entries(m.conflict).every(([A,v])=>!v.differentSchema))continue;Object.entries(m.conflict).forEach(([A])=>{Pas({property:m.key,schemaId:A,context:t,namespace:n}).forEach(P=>{c.add(P)})})}let h=_l({schema:m.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}),y=m.audiences,g=m.nameOverride,b=WI(m.availability),_=goA(m);s[m.key]=yoA({typeReference:h,audiences:y,name:g,availability:b,propertyAccess:_})}let l=new Set;for(let m of e.allOfPropertyConflicts)m.allOfSchemaIds.forEach(h=>c.add(h)),m.conflictingTypeSignatures&&l.add(m.propertyKey);let u=[];for(let m of e.allOf){let h=IJn({schema:m.schema,context:t,namespace:n});if(h==null||c.has(m.schema)||c.has(h))continue;let y=_l({schema:Pc.reference(m),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});u.push(jfr(Cy(y)))}for(let m of c){let h=Cfr(t,m,n);for(let y of h.properties)s[y.key]==null&&(l.has(y.key)&&(s[y.key]="unknown"),s[y.key]=_l({schema:y.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}));for(let y of h.allOf){if(c.has(y.schema))continue;let g=_l({schema:Pc.reference(y),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});u.push(jfr(Cy(g)))}}let p={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(s).map(([m,h])=>hoA(m)?[m,typeof h=="string"?{type:h,name:`_${m}`}:{...h,name:`_${m}`}]:[m,h]))};u.length>0&&(p.extends=u),e.additionalProperties&&(p["extra-properties"]=!0),e.availability!=null&&(p.availability=WI(e.availability)),e.source!=null&&(p.source=oat(e.source)),p.inline=Eas(e,i);let d=e.nameOverride??e.generatedName;return{name:a&&t.options.respectReadonlySchemas&&!o?`${d}Read`:d,schema:p}}function Pas({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return Pas({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:o,allOf:a}=Cfr(r,t,n),s=o.some(l=>l.key===e),c=[...a.flatMap(l=>Pas({property:e,context:r,schemaId:l.schema,namespace:n}))];if(s||c.length>0)return[t,...c]}return[]}function yCl(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?Cfr(e,t.schema,r):t.type==="nullable"?yCl(e,t.value,r):{properties:[],allOf:[]}}function Cfr(e,t,r){let n=e.getSchema(t,r);return n==null?{properties:[],allOf:[]}:yCl(e,n,r)}function soA({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:gas({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function uoA({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:bas({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function coA(e){let t=wJn(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 mCl(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function WYr(e,t){let r={enum:e.values.map(o=>{let a=o.nameOverride??o.generatedName,s=o.value;if(a===s&&o.description==null&&(o.casing==null||mCl(o.casing)))return a;let c={value:o.value};if(a!==s&&(c.name=a),o.description!=null&&(c.docs=o.description),o.casing!=null&&!mCl(o.casing)){let l={},u=!1;o.casing.camel!=null&&(l.camel=o.casing.camel,u=!0),o.casing.screamingSnake!=null&&(l["screaming-snake"]=o.casing.screamingSnake,u=!0),o.casing.snake!=null&&(l.snake=o.casing.snake,u=!0),o.casing.pascal!=null&&(l.pascal=o.casing.pascal,u=!0),u&&(c.casing=l)}return c})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=Eas(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?oat(e.source):void 0};for(let o of r.enum){let a=typeof o=="string"?o:o.name??o.value;n.has(a.toLowerCase())||(i.enum.push(o),n.add(a.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function loA({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:yas({schema:e,context:t,fileContainingReference:r,namespace:n})}}function poA({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.options.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:Aas({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:gCl({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function gCl({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:PJn({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function foA(e,t){return{name:e??t,schema:_as()}}function doA(e,t,r){return{name:t??r,schema:vas(e)}}function was({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let o=e.encoding!=null?vJn(e.encoding):void 0;if(e.type==="discriminated"){let s={};for(let l of e.commonProperties)s[l.key]=_l({schema:l.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1});let c={};for(let[l,u]of Object.entries(e.schemas))c[l]=_l({schema:u,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantPropertyNameOverride!=null?{name:e.discriminantPropertyNameOverride,value:e.discriminantProperty}:e.discriminantProperty,"base-properties":s,docs:e.description??void 0,availability:e.availability!=null?WI(e.availability):void 0,union:c,encoding:o,source:e.source!=null?oat(e.source):void 0}}}let a=[];for(let s of e.schemas)a.push(_l({schema:s,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:a,encoding:o,source:e.source!=null?oat(e.source):void 0,inline:Eas(e,i)}}}var moA=/^[0-9]/;function hoA(e){return moA.test(e)}function IJn({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?IJn({context:t,schema:n.schema,namespace:r}):e}function yoA({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i}){return t.length===0&&r==null&&n==null&&i==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}:{}}}function Eas(e,t){return e.inline===!0||t>0?!0:void 0}function goA(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return Mj.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return Mj.ObjectPropertyAccess.WriteOnly}}function bCl(e){let t=e.replace(/^x-|^X-/,"");return Xi(t)}function ACl(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.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),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),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??bCl(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),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(eu.of("__package__.yml"),{name:"OauthScope",schema:WYr(n.scopesEnum,0).schema})}}function EMe({header:e,context:t,fileContainingReference:r,namespace:n}){let i=_l({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),o=Cy(i),a=e.name.replace(/^x-|^X-/,""),s=e.parameterNameOverride!=null?e.parameterNameOverride:Xi(a);if(e.description==null&&e.name===s&&e.env==null&&e.availability==null)return o;let c={type:o};return s!==e.name&&(c.name=s),e.description!=null&&(c.docs=e.description),e.env!=null&&(c.env=e.env),e.availability!=null&&(c.availability=WI(e.availability)),c}function xJn({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=_l({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return Cy(i);let o=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:Cy(i)};return e.description!=null&&(o.docs=e.description),e.availability!=null&&(o.availability=WI(e.availability)),o}function CJn({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=Ias({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let o=Cy(i.value),a=LYr(i.value);o==="unknown"?o="string":o==="optional<unknown>"&&(o="optional<string>");let s={type:o};return a!=null&&(s.default=a),i.allowMultiple&&(s["allow-multiple"]=!0),e.description!=null&&(s.docs=e.description),e.parameterNameOverride!=null&&(s.name=e.parameterNameOverride),e.availability!=null&&(s.availability=WI(e.availability)),boA(i.value)&&i.value.validation!==void 0&&(s.validation=i.value.validation),s.default==null&&s["allow-multiple"]==null&&s.docs==null&&s.name==null&&s.availability==null&&s.validation==null?o:s}function Ias({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:_l({schema:Pc.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:eu.of(Ky),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let o=[],a=!1;for(let[s,c]of Object.entries(i.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(a=!0),c.type==="literal"&&c.value.type==="string"&&(Efr.test(c.value.value)?o.push(c.value.value):o.push({value:c.value.value,name:Ifr(c.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),a&&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[s,c]=i.value.schemas;if(s!=null&&c!=null&&jJn({array:s,primitive:c}))return{value:_l({schema:Pc.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(s!=null&&c!=null&&jJn({array:s,primitive:c}))return{value:_l({schema:Pc.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:s,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[s,c]of Object.entries(i.value.schemas))return Ias({schema:c,context:t,fileContainingReference:r,namespace:n})}else if(t.options.objectQueryParameters)return{value:_l({schema:e,context:t,fileContainingReference:r,declarationFile:eu.of(Ky),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?Pc.optional:Pc.nullable;if(e.value.type==="reference"){let o=t.getSchema(e.value.schema,n);if(o==null)return;if(o.type==="array")return{value:_l({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:eu.of(Ky),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.options.objectQueryParameters)return{value:_l({schema:e,context:t,fileContainingReference:r,declarationFile:eu.of(Ky),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:_l({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=[],a=!1;for(let[s,c]of Object.entries(e.value.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(a=!0),c.type==="literal"&&c.value.type==="string"&&(Efr.test(c.value.value)?o.push(c.value.value):o.push({value:c.value.value,name:Ifr(c.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),a&&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[s,c]=e.value.value.schemas;if(s!=null&&c!=null&&jJn({array:s,primitive:c}))return{value:_l({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(s!=null&&c!=null&&jJn({array:c,primitive:s}))return{value:_l({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:s,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:_l({schema:e,context:t,fileContainingReference:r,declarationFile:eu.of(Ky),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[s,c]of Object.entries(e.value.value.schemas))return Ias({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:_l({schema:e,context:t,fileContainingReference:r,declarationFile:eu.of(Ky),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:_l({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:_l({schema:Pc.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:_l({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function jJn({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function boA(e){return typeof e=="object"&&e!==null&&"type"in e}function _Cl({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"]=AoA(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=_oA({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=jgt(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function AoA(e){let t={};return e.forEach(r=>{let n=jgt(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function _oA({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let o=jgt(i.value);r.has(i.name)||o!=null&&(n[i.name]=o)}),n}function jgt(e){switch(e.type){case"primitive":return vCl(e.value);case"object":return OCl(e.properties);case"array":return voA(e.value);case"map":return OoA(e.value);case"oneOf":return woA(e.value);case"enum":return e.value;case"literal":return PoA(e.value);case"unknown":return jgt(e.value);case"null":return null;default:qe(e)}}function vCl(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"date":return e.value;case"base64":case"boolean":return e.value;default:qe(e)}}function OCl(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,jgt(r)]))}function voA(e){return e.map(t=>jgt(t))}function OoA(e){return Object.fromEntries(e.map(t=>[vCl(t.key),jgt(t.value)]))}function woA(e){return e.type==="discriminated"?OCl(e.value):jgt(e.value)}function PoA(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:qe(e)}}function GYr(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 SJn(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function BJn(e,t,r=!1){let n=GYr(t);return r&&n!=null?n:e!=null&&n!=null?`${e}_${n}`:n??e??"websocket"}function aat(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function DJn(e,t){return t??(e?.groupName!=null?aat(e.groupName):void 0)}function wCl({channel:e,context:t,declarationFile:r}){let n=e.servers[0],i=n!=null?t.options.groupEnvironmentsByHost?t.getUrlId(n.url)??BJn(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="${i}" (from collision map: ${t.getUrlId(n?.url??"")!=null})`);let o=e.path;for(let p of e.handshake.pathParameters)p.parameterNameOverride!=null&&(o=o.replace(`{${p.name}}`,`{${p.parameterNameOverride}}`));let a={path:o,url:i,auth:!1};e.audiences!=null&&e.audiences.length>0&&(a.audiences=e.audiences),e.summary!=null&&(a["display-name"]=e.summary),e.description!=null&&(a.docs=e.description);let s=aat(e.groupName),c={};if(e.handshake.pathParameters.length>0)for(let p of e.handshake.pathParameters){let d=p.parameterNameOverride??p.name;c[d]=xJn({pathParameter:p,context:t,fileContainingReference:r,namespace:s})}Object.keys(c).length>0&&(a["path-parameters"]=c);let l={};if(e.handshake.queryParameters.length>0)for(let p of e.handshake.queryParameters){let d=CJn({queryParameter:p,context:t,fileContainingReference:r,namespace:s});d!=null&&(l[p.name]=d)}Object.keys(l).length>0&&(a["query-parameters"]=l);let u={};if(e.handshake.headers.length>0)for(let p of e.handshake.headers){let d=EMe({header:p,context:t,fileContainingReference:r,namespace:s});u[p.name]=d}Object.keys(u).length>0&&(a.headers=u),t.builder.addChannel(r,{channel:a});for(let p of e.messages){let d={origin:p.origin,body:_l({schema:p.body,context:t,fileContainingReference:r,namespace:s,declarationDepth:0})};p.methodName!=null&&(d["method-name"]=p.methodName),t.builder.addChannelMessage(r,{messageId:p.name,message:d})}for(let p of e.examples){let d=_Cl({context:t,websocketExample:p});t.builder.addChannelExample(r,{example:d})}}function xas(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var RU="Base",ICl="Default";function PCl(e){try{return new URL(e).hostname}catch{return}}function ECl(e){return e??ICl}function EoA(e,t){let r=new Map;for(let n of e){if(xas(n)||!("url"in n)||!n.url)continue;let i=PCl(n.url)??n.url;r.has(i)||r.set(i,{environmentName:ECl(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=PCl(n.url)??n.url;r.has(i)||r.set(i,{environmentName:ECl(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.websocketServers.push(n)}return r}function Y2t(e){return Object.entries(e).reduce((t,[r,n])=>(E5(n)?Object.entries(n.urls).forEach(([i,o])=>{t[i]=o}):t[r]=typeof n=="string"?n:n.url,t),{})}function xCl(e){if(e.environmentOverrides!=null){for(let[A,v]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:A,schema:v});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 t={},r=[],n=e.ir.servers.some(A=>xas(A)),i=e.ir.servers;for(let A of i)if(xas(A)){let v={urls:{}},P={},I={},E={};for(let[T,W]of Object.entries(A.urls))v.urls[T]=W.defaultUrl??W.url,W.urlTemplate&&(P[T]=W.urlTemplate),W.defaultUrl&&(I[T]=W.defaultUrl),W.variables&&W.variables.length>0&&(E[T]=W.variables);(Object.keys(P).length>0||Object.keys(E).length>0)&&(v["url-templates"]=P,v["default-urls"]=I,v.variables=E),A.name&&(t[A.name]=v)}else if("url"in A&&A.url){let P=A.urlTemplate!=null&&A.variables!=null&&A.variables.length>0?{url:A.url,audiences:A.audiences,"default-url":A.defaultUrl,"url-template":A.urlTemplate,variables:A.variables?.map(I=>({id:I.id,default:I.default,values:I.values}))}:A.audiences?{url:A.url,audiences:A.audiences}:A.url;if(A.name==null){r.push(P);continue}t[A.name]=P}let o={},a={},s=[],c={},l={},u={};for(let A of e.ir.endpoints)for(let v of A.servers){if(v.url==null&&v.name!=null){o[v.name]||(o[v.name]=[]);continue}if(v.url==null)continue;let P=v,I="defaultUrl"in v&&typeof P.defaultUrl=="string"?P.defaultUrl:void 0,E="urlTemplate"in v&&typeof P.urlTemplate=="string"?P.urlTemplate:void 0,x="variables"in v&&Array.isArray(P.variables)?P.variables:void 0,T=I??v.url,W=v.audiences?{url:T,audiences:v.audiences}:T;if(v.name==null){s.push(W);continue}o[v.name]||(o[v.name]=[]),o[v.name]?.push({url:T,audiences:v.audiences}),a[v.name]=W,E&&v.name&&(c[v.name]=E),I&&v.name&&(l[v.name]=I),x&&x.length>0&&v.name&&(u[v.name]=x)}let p={},d=[];for(let A of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${A.name}", url="${A.url}"`);let v=A.audiences?{url:A.url,audiences:A.audiences}:A.url;if(A.name==null){d.push(v);continue}p[A.name]=v}let m=Object.keys(t).length,h=m>0,y=Object.keys(a).length>0,g=Object.keys(o).some(A=>o[A]?.length===0),b=Object.keys(p).length>0;if(e.options.groupEnvironmentsByHost&&b&&(h||e.ir.servers.length>0)){let A=Object.entries(p).map(([P,I])=>({name:P,url:typeof I=="string"?I:I.url,audiences:typeof I=="string"?void 0:I.audiences})),v=EoA(i,A);if(v.size>0){let P=!0;for(let[I,E]of v.entries()){let x={},T=[...E.httpServers.map(H=>({...H,isHttp:!0})),...E.websocketServers.map(H=>({...H,isHttp:!1}))],W=new Map;for(let H of T){let G=GYr(H.url),ie=SJn(H.url);G&&ie&&(W.has(G)||W.set(G,new Set),W.get(G)?.add(ie))}if(E.httpServers.length>0){let H=E.httpServers[0];H!=null&&(x[RU]=H.url,e.setUrlId(H.url,RU));for(let G=1;G<E.httpServers.length;G++){let ie=E.httpServers[G];if(ie!=null){let oe=GYr(ie.url),$=SJn(ie.url),te=oe?W.get(oe):void 0,Ge=te&&te.size>1,X=Ge&&$!=="https"?`${oe}_${$}`:oe||`Http${G+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${ie.url}", pathSegment="${oe}", protocol="${$}", hasCollision=${Ge}, urlId="${X}"`),x[X]=ie.url,e.setUrlId(ie.url,X)}}}for(let H of E.websocketServers){let G=GYr(H.url),ie=SJn(H.url),oe=G?W.get(G):void 0,$=oe&&oe.size>1,te=$?`${G}_${ie}`:BJn(H.name,H.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${H.name}", url="${H.url}", pathSegment="${G}", protocol="${ie}", hasCollision=${$}, urlId="${te}"`),x[te]=H.url,e.setUrlId(H.url,te)}if(Object.keys(x).length>1)e.builder.addEnvironment({name:E.environmentName,schema:{urls:x}});else if(Object.keys(x).length===1){let H=Object.values(x)[0];H!=null&&e.builder.addEnvironment({name:E.environmentName,schema:H})}P&&(e.builder.setDefaultEnvironment(E.environmentName),Object.keys(x).length>1&&e.builder.setDefaultUrl(RU),P=!1)}return}}if(!h&&!y&&b&&e.ir.servers.length===0){for(let[A,v]of Object.entries(p))e.builder.addEnvironment({name:A,schema:v});e.builder.setDefaultEnvironment(Object.keys(p)[0]),e.builder.setDefaultUrl(RU);return}if(s.length>0&&e.logger.debug(`Skipping endpoint level servers ${s.map(A=>typeof A=="string"?A:A.url).join(", ")} because x-fern-server-name was not provided.`),!h){let A=e.ir.servers[0],v=A?.url,P=A?.audiences,I=A?.defaultUrl,E=A?.urlTemplate,x=A?.variables;if(v!=null){let W=E!=null&&x!=null&&x.length>0?{url:v,audiences:P,"default-url":I,"url-template":E,variables:x?.map(H=>({id:H.id,default:H.default,values:H.values}))}:P?{url:v,audiences:P}:v;t[ICl]=W}}let _=Object.values(t).map(A=>typeof A=="string"?A:E5(A)?Object.values(A.urls)[0]:A.url),O=r.filter(A=>{let v=typeof A=="string"?A:A.url;return!_.includes(v)});if(O.length>0&&e.logger.debug(`Skipping top level servers ${O.map(A=>typeof A=="string"?A:A.url).join(", ")} because x-fern-server-name was not provided.`),n){let A=!0;for(let[v,P]of Object.entries(t))if(e.builder.addEnvironment({name:v,schema:P}),A){if(e.builder.setDefaultEnvironment(v),E5(P)){let I=Object.keys(P.urls)[0];I&&e.builder.setDefaultUrl(I)}A=!1}return}if(!y&&!g){let A=!0;for(let[v,P]of Object.entries(t))if(A){if(b){let I=typeof P=="string"?P:E5(P)?Object.values(P.urls)[0]:P["default-url"]??P.url;e.builder.addEnvironment({name:v,schema:{urls:{[RU]:I??"",...Y2t(p)}}})}else e.builder.addEnvironment({name:v,schema:P});e.builder.setDefaultEnvironment(v),A=!1}else if(b){let I=typeof P=="string"?P:E5(P)?Object.values(P.urls)[0]:P["default-url"]??P.url;e.builder.addEnvironment({name:v,schema:{urls:{[RU]:I??"",...Y2t(p)}}})}else e.builder.addEnvironment({name:v,schema:P});b&&e.builder.setDefaultUrl(RU)}else if(m===1){let A=Object.keys(t)[0],v=Object.values(t)[0],P=typeof v=="string"?v:E5(v)?Object.values(v.urls)[0]:v["default-url"]??v.url,I={},E={},x={};typeof v!="string"&&!E5(v)&&(v["url-template"]&&(I[RU]=v["url-template"]),v["default-url"]&&(E[RU]=v["default-url"]),v.variables&&v.variables.length>0&&(x[RU]=v.variables)),Object.assign(I,c),Object.assign(E,l),Object.assign(x,u);let T=Object.keys(I).length>0||Object.keys(x).length>0,W={urls:{[RU]:P??"",...Y2t(a),...Y2t(p)},...T?{"url-templates":I,"default-urls":E,variables:x}:{}};e.builder.addEnvironment({name:A,schema:W}),e.builder.setDefaultEnvironment(A),e.builder.setDefaultUrl(RU)}else{let A=new Map;for(let v of e.ir.endpoints)for(let P of v.servers)if(P.url!=null&&P.name!=null){A.has(P.name)||A.set(P.name,new Map);let I=P.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",E=A.get(P.name);E&&E.set(I,P.url)}if(A.size>0){let v=!0;for(let[P,I]of Object.entries(t)){let E=typeof I=="string"?I:E5(I)?Object.values(I.urls)[0]:I["default-url"]??I.url;if(!E)continue;let x=E.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",T={[RU]:E};for(let[W,H]of A.entries()){let G=H.get(x)||H.get("production")||H.values().next().value;G&&(T[W]=G)}b&&Object.assign(T,Y2t(p)),Object.keys(T).length>1?e.builder.addEnvironment({name:P,schema:{urls:T}}):e.builder.addEnvironment({name:P,schema:E}),v&&(e.builder.setDefaultEnvironment(P),v=!1)}A.size>0&&e.builder.setDefaultUrl(RU)}else{let v=!0;for(let[P,I]of Object.entries(t)){if(b||Object.keys(a).length>0){let E=typeof I=="string"?I:E5(I)?Object.values(I.urls)[0]:I["default-url"]??I.url;e.builder.addEnvironment({name:P,schema:{urls:{[RU]:E??"",...Y2t(a),...Y2t(p)}}})}else e.builder.addEnvironment({name:P,schema:I});v&&(e.builder.setDefaultEnvironment(P),v=!1)}}}}var jas=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},IoA=.75,xoA=new Set("authorization");function jCl(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 i="optional<string>";if(n.name==null&&n.env==null&&typeof n.schema=="string")i=n.schema;else if(n!=null){let o=n.schema?iat(n.schema):void 0,a=o!=null?aat(o):void 0,s=eu.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?Cy(_l({schema:n.schema,context:e,fileContainingReference:a?xj(eu.of(Xi(a)),s):s,namespace:a,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:i})}if(e.options.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let o of i.headers){if(xoA.has(o.name.toLowerCase()))continue;let a=r[o.name];if(a==null){let s=t[o.name],c=EMe({header:{...o,schema:s?.schema??o.schema,name:s?.name??o.name},fileContainingReference:eu.of(Qj),context:e,namespace:void 0});a=new jas(c),r[o.name]=a}a.increment()}let n=e.ir.endpoints.length*IoA;for(let[i,o]of Object.entries(r)){let a=t[i],s=o.count===e.ir.endpoints.length,c=o.count>=n;a==null&&(s?e.builder.addGlobalHeader({name:i,schema:o.schema}):c&&e.builder.addGlobalHeader({name:i,schema:K2t(o.schema)}))}}}function CCl(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?iat(t.schema):void 0,n=r!=null?aat(r):void 0,i=EMe({header:{...t,schema:t.schema??Pc.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:Ph.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},fileContainingReference:eu.of(Qj),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:K2t(i)})}}function eq(e){switch(e.type){case"primitive":return BCl(e.value);case"object":return DCl(e.properties);case"array":return TCl(e.value);case"map":return CoA(e.value);case"oneOf":return SoA(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return BoA(e.value);case"unknown":return eq(e.value);case"null":return null;default:qe(e)}}function SCl(e){switch(e.type){case"withStreaming":return e.sse?{stream:joA(e.events)}:{stream:TCl(e.events)};case"withoutStreaming":return{body:eq(e.value)};default:qe(e)}}function BCl(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"date":return e.value;case"base64":case"boolean":return e.value;default:qe(e)}}function DCl(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,eq(r)]))}function joA(e){return e.map(t=>({event:"",data:eq(t)}))}function TCl(e){return e.map(t=>eq(t))}function CoA(e){return Object.fromEntries(e.map(t=>[BCl(t.key),eq(t.value)]))}function SoA(e){return e.type==="discriminated"?DCl(e.value):eq(e.value)}function BoA(e){switch(e.type){case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"boolean":return e.value;default:qe(e)}}function RCl({endpointExample:e,context:t}){let r={};if(e.type!=="full")return e.value;e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.pathParameters!=null&&e.pathParameters.length>0&&(r["path-parameters"]=DoA(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=ToA(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),o=Object.keys(i).length>0,a=new Set(e.headers?.map(s=>s.name)??[]);if(n||o){let s=[];if(e.headers!=null)for(let c of e.headers)c.name!==t.builder.getAuthHeaderName()&&s.push(c);for(let[c,l]of Object.entries(i)){if(l!=null&&typeof l=="object"&&l.type!=null){let u=LC({type:l.type,_default:void 0,validation:void 0,visitor:{primitive:Rt,map:Rt,list:Rt,optional:p=>p,nullable:p=>p,set:Rt,named:Rt,literal:p=>{if(p.type==="string")return p.string;if(p.type==="boolean")return p.boolean.toString()},unknown:Rt}});if(u!=null){let p=s.findIndex(m=>m.name===c),d={name:c,value:Al.literal(bgt.string(u))};p>=0?s[p]=d:s.push(d);continue}}a.has(c)||s.push({name:c,value:Al.primitive(Ga.string(c))})}r.headers=RoA({context:t,namedFullExamples:s})}return e.request!=null&&(r.request=eq(e.request)),e.response!=null&&(r.response=SCl(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(s=>s.type==="language"?{name:s.name??void 0,docs:s.description??void 0,language:s.language,code:s.code,install:s.install??void 0}:{name:s.name??void 0,docs:s.description??void 0,sdk:s.sdk,code:s.code}).filter(Gu)),r}function DoA(e){let t={};return e.forEach(r=>{let n=eq(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function ToA(e){let t={};return e.forEach(r=>{let n=eq(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function RoA({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=eq(n.value);i!=null&&(r[n.name]=i)}),r}function FCl(e){return xR._visit(e,{get:()=>Mj.HttpMethodSchema.Get,post:()=>Mj.HttpMethodSchema.Post,put:()=>Mj.HttpMethodSchema.Put,patch:()=>Mj.HttpMethodSchema.Patch,delete:()=>Mj.HttpMethodSchema.Delete,head:()=>Mj.HttpMethodSchema.Head,options:()=>{throw new Error("OPTIONS is unsupported")},trace:()=>{throw new Error("TRACE is unsupported")},_other:()=>{throw new Error("Unknown http method is unsupported")}})}function NCl(e){return e==="POST"||e==="PUT"||e==="PATCH"}function MCl({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],o=new Set,a=e.path,s=DJn(e.sdkName,e.namespace),c={};for(let g of e.pathParameters)g.parameterNameOverride&&(a=a.replace(g.name,g.parameterNameOverride)),c[g.parameterNameOverride??g.name]=xJn({pathParameter:g,context:r,fileContainingReference:t,namespace:s}),o.add(g.name);let l={};for(let g of e.queryParameters){let b=CJn({queryParameter:g,context:r,fileContainingReference:t,namespace:s});b!=null&&(l[g.name]=b,o.add(g.name))}let u;if(e.pagination!=null)switch(e.pagination.type){case"cursor":u={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":u={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":u={type:"custom",results:e.pagination.results};break;default:qe(e.pagination)}let p={path:a,method:FCl(e.method),auth:FoA({endpoint:e,context:r}),docs:e.description??void 0,pagination:u,source:e.source!=null?oat(e.source):void 0};!QoA({context:r,request:e.request})&&Object.keys(c).length>0&&(p["path-parameters"]=c),e.summary!=null&&(p["display-name"]=e.summary);let d={},m=r.builder.getGlobalHeaderNames(),h=r.builder.getAuthHeaderName();h!=null&&m.add(h);let y=e.headers.filter(g=>!m.has(g.name));for(let g of y){let b=EMe({header:g,context:r,fileContainingReference:t,namespace:s});d[g.name]=b,o.add(typeof b=="string"?g.name:b.name??g.name)}if(e.request!=null){r.setInState(MT.Request);let g=zoA({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.options.inlinePathParameters&&Object.keys(c).length>0?c:void 0,queryParameters:Object.keys(l).length>0?l:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(d).length>0?d:void 0,usedNames:o,namespace:s});p.request=g.value,i=[...i,...g.schemaIdsToExclude??[]],r.unsetInState(MT.Request)}else{let g=r.options.inlinePathParameters&&Object.keys(c).length>0,b=Object.keys(l).length>0,_=Object.keys(d).length>0,O={};(g||b||_)&&(O.name=e.requestNameOverride??e.generatedRequestName),g&&(O["path-parameters"]=c),b&&(O["query-parameters"]=l),_&&(O.headers=d),Object.keys(O).length>0&&(p.request=O)}if(e.response!=null&&e.response._visit({json:g=>{let b=_l({schema:g.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});p.response={docs:g.description??void 0,type:Cy(b)},g.statusCode!=null&&(p.response["status-code"]=g.statusCode),g.responseProperty!=null&&(p.response.property=g.responseProperty)},streamingJson:g=>{let b=_l({schema:g.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});p["response-stream"]={docs:g.description??void 0,type:Cy(b),format:"json"}},streamingSse:g=>{let b=_l({schema:g.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});p["response-stream"]={docs:g.description??void 0,type:Cy(b),format:"sse"}},file:g=>{p.response={docs:g.description??void 0,type:"file","status-code":g.statusCode}},bytes:g=>{p.response={docs:g.description??void 0,type:"bytes","status-code":g.statusCode}},streamingText:g=>{p["response-stream"]={docs:g.description??void 0,type:"text"}},text:g=>{p.response={docs:g.description??void 0,type:"text","status-code":g.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let g=r.getDefaultServerName(),b=e.servers[0];b==null?g!=null&&(p.url=g):p.url=b.name??void 0}return e.idempotent&&(p.idempotent=!0),e.availability!=null&&(p.availability=WI(e.availability)),Object.entries(e.errors).forEach(([g,b])=>{let _=b.generatedName,O=eu.of(Ky);r.builder.enableUniqueErrorsPerEndpoint&&(_=`${e.generatedRequestName}${b.generatedName}`,b.schema!=null&&(b.schema.type!=="reference"&&b.schema.type!=="oneOf"?b.schema.generatedName=`${e.generatedRequestName}${b.schema.generatedName}`:b.schema.type==="oneOf"&&(b.schema.value.generatedName=`${e.generatedRequestName}${b.schema.value.generatedName}`)));let A={"status-code":parseInt(g)},v=uCl({location:zCl,namespaceOverride:s});if(b.schema!=null){let E=_l({schema:b.schema,context:r,fileContainingReference:v,declarationFile:v,namespace:s,declarationDepth:0});A.type=Cy(E),A.docs=b.description}r.builder.addError(v,{name:_,schema:r.isErrorUnknownSchema(parseInt(g))?{...A,type:"unknown"}:A}),p.errors==null&&(p.errors=[]);let P=r.builder.addImport({file:t,fileToImport:v});p.errors.push(P!=null?`${P}.${_}`:_),A.type!=null&&b.examples?.forEach(E=>{let x={value:eq(E.example),name:E.name,docs:E.description};r.builder.addErrorExample(v,{name:_,example:x})})}),e.examples.length>0&&(p.examples=NoA({endpointExamples:e.examples,context:r})),e.retries!=null&&(p.retries=MoA({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?p.audiences=[Cas,...e.audiences]:e.audiences.length>0&&(p.audiences=e.audiences),{value:p,schemaIdsToExclude:i}}function FoA({endpoint:e,context:t}){if(e.security==null)return t.authOverrides?.auth!=null?!0:t.ir.security==null?void 0:t.ir.security.length>0?!0:void 0;if(e.security.length!==0)return JSON.stringify(e.security)===JSON.stringify(t.ir.security)?!0:e.security}function NoA({endpointExamples:e,context:t}){return e.map(r=>{try{return RCl({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function MoA({retries:e}){if(e!=null){if(e.type==="disabled")return{disabled:e.value??void 0};qe(e)}}function zoA({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:o,pathParameters:a,queryParameters:s,nonRequestReferencedSchemas:c,headers:l,usedNames:u,namespace:p}){if(n.type==="json"||n.type==="formUrlEncoded"){let d=n.schema.type==="reference"?n.schema.schema:void 0,m=n.schema.type==="reference"?r.getSchema(n.schema.schema,p):n.schema;if(m?.type!=="object"||d!=null&&c.includes(d)){let v=_l({schema:n.schema,fileContainingReference:t,context:r,namespace:p,declarationDepth:0}),P={schemaIdsToExclude:[],value:{body:v}},I=Object.keys(a??{}).length>0,E=Object.keys(s??{}).length>0,x=Object.keys(l??{}).length>0;return I&&(P.value["path-parameters"]=a),E&&(P.value["query-parameters"]=s),x&&(P.value.headers=l),(I||E||x)&&(P.value.name=i??o),n.contentType!=null&&(P.value["content-type"]=n.contentType),n.description!=null&&(P.value.docs=n.description),P}let h=new Map;for(let v of m.allOf){let P=r.getSchema(v.schema,p);if(P==null)continue;let I=iat(P),E=nat(I),{properties:x}=Cfr(r,v.schema,p);for(let T of x)h.set(T.key,E)}let y=Object.fromEntries(m.properties.filter(v=>v.readonly==null?!0:!(NCl(e.method)&&v.readonly)).map(v=>{let P=h.get(v.key)??t,I=_l({schema:v.schema,fileContainingReference:t,declarationFile:P,context:r,namespace:p,declarationDepth:1}),E=v.nameOverride??v.key,x=WI(v.availability);if(!u.has(E)&&v.audiences.length<=0)return u.add(E),v.nameOverride!=null?[v.key,{type:Cy(I),docs:xfr(I),name:v.nameOverride,availability:x}]:[v.key,x?{...typeof I=="string"?{type:I}:I,availability:x}:I];let T={type:Cy(I),docs:xfr(I)};return u.has(E)&&(T.name=v.generatedName),v.audiences.length>0&&(T.audiences=v.audiences),x!=null&&(T.availability=x),u.add(E),[v.key,T]})),g=new Set,b=new Set;for(let v of m.allOfPropertyConflicts)v.allOfSchemaIds.forEach(P=>g.add(P)),v.conflictingTypeSignatures&&b.add(v.propertyKey);let _=[];for(let v of m.allOf){let P=IJn({schema:v.schema,context:r,namespace:p});if(P==null||g.has(v.schema)||g.has(P))continue;let I=_l({schema:Pc.reference(v),fileContainingReference:t,context:r,namespace:p,declarationDepth:0}),E=jfr(Cy(I));E!=="unknown"&&_.push(E)}for(let v of g){let P=Cfr(r,v,p),I=r.getSchema(v,p),E=I!=null?nat(iat(I)):t;for(let x of P.properties)y[x.key]==null&&(b.has(x.key)?y[x.key]="unknown":y[x.key]=_l({schema:x.schema,fileContainingReference:t,declarationFile:E,context:r,namespace:p,declarationDepth:1}));for(let x of P.allOf){if(g.has(x.schema))continue;let T=_l({schema:Pc.reference(x),fileContainingReference:t,context:r,namespace:p,declarationDepth:0}),W=jfr(Cy(T));W!=="unknown"&&!_.includes(W)&&_.push(W)}}let O={properties:y};_.length>0&&(O.extends=_),n.additionalProperties&&(O["extra-properties"]=!0);let A={name:i??m.nameOverride??m.generatedName,"path-parameters":a,"query-parameters":s,headers:l,body:O};return n.contentType!=null&&(A["content-type"]=n.contentType),n.description!=null&&(A.docs=n.description),{schemaIdsToExclude:d!=null?[d]:[],value:A}}else if(n.type==="octetStream"){let d={body:"bytes","content-type":n.contentType??SA.APPLICATION_OCTET_STREAM,"query-parameters":s};return s!=null&&(d.name=i??o),n.description!=null&&(d.docs=n.description),{schemaIdsToExclude:[],value:d}}else if(n.type==="multipart"){let d=Object.fromEntries(n.properties.map(m=>{if(m.schema.type==="file"){let h=m.schema.isArray?"list<file>":"file";if(h=m.schema.isOptional?`optional<${h}>`:h,m.description!=null||m.contentType!=null){let y={type:h};if(m.description!=null&&(y.docs=m.description),m.contentType!=null){let g=m.contentType.split(",")[0];y["content-type"]=g}return[m.key,y]}return[m.key,h]}else{let h=_l({schema:m.schema.value,fileContainingReference:t,context:r,namespace:p,declarationDepth:1});if(m.contentType||m.exploded||m.encoding){let y=typeof h=="string"?{type:h}:h;m.contentType!=null&&(y["content-type"]=m.contentType),m.encoding==="form"?y.style="form":m.encoding==="json"?y.style="json":m.exploded&&(y.style="exploded"),h=y}return[m.key,h]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??o,"path-parameters":a,"query-parameters":s,headers:l,body:{properties:d},"content-type":SA.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else qe(n)}function QoA({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:qe(t)}}function qoA({location:e,namespaceOverride:t}){return t!=null?{...e,file:xj(eu.of(t),e.file)}:e}function VoA(e){let t=e.namespace,r=e.tags.filter(c=>c!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:eu.of(`${Xi(r)}.yml`),endpointId:e.summary!=null?Xi(e.summary):Xi(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:eu.of(Ky),endpointId:Xi(e.summary)}:{file:eu.of(Ky),endpointId:Xi(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:eu.of(Ky),endpointId:n};let i=HYr(r),o=HYr(n);if(Sj(i,o))return{file:eu.of("__package__.yml"),endpointId:r};let a=LoA({operationId:n,tag:r,path:e.path,method:e.method});if(a!=null)return a;let s=[];for(let c=0;c<i.length;++c){let l=i[c];if(l!=null&&l===o[c])s.push(l);else{let u=Xi(r);return{file:eu.of(`${u}.yml`),endpointId:n,tag:r}}}if(s.length>=o.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:eu.of(Xi(s.join("_"))+".yml"),endpointId:Xi(o.slice(s.length).join("_")),tag:r}}function $Yr(e){let t=e.tags[0];if(e.sdkName!=null){let r=das({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:eu.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return qoA({namespaceOverride:e.namespace,location:VoA(e)})}function HYr(e){let t;return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)?t=e.split(/(?=[A-Z])/):t=e.split(/[^a-zA-Z0-9]+/),t=t.map(r=>r.toLowerCase()),t=Yee(t),t}var koA=new RegExp("[^a-zA-Z0-9{}]+"),UoA=new RegExp("[{}]","g");function LoA({operationId:e,tag:t,path:r,method:n}){let o=`${r.split(koA).join("_").replaceAll(UoA,"_")}_${n.toLowerCase()}`;if(e.endsWith(o))return{file:eu.of(Xi(t)+".yml"),endpointId:Xi(e.slice(0,-1*o.length)),tag:t}}function QCl(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let o of r){let{endpointId:a,file:s,tag:c}=$Yr(o),l=s.split(".")[0];l!=null&&t.add(l);let u;if(o.sdkName!=null){let m=e.ir.groups;for(let h of o.sdkName.groupName){let y=typeof h=="string"?h:h.name,g=m[y];if(g==null)break;if(g.summary!=null||g.description!=null){u=m[y];break}}}let p=c==null?void 0:n.tagsById[c];e.setInState(MT.Endpoint),e.setEndpointMethod(o.method);let d=MCl({context:e,endpoint:o,declarationFile:s});e.unsetEndpointMethod(),e.unsetInState(MT.Endpoint),i=[...i,...d.schemaIdsToExclude],e.builder.addEndpoint(s,{name:a,schema:d.value,source:o.source!=null?oat(o.source):void 0}),(p?.id!=null||p?.description!=null)&&e.builder.setServiceInfo(s,{"display-name":u?.summary??p?.id,docs:u?.description??p?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function qCl(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?aat(r.groupName):void 0,i=_l({schema:Pc.primitive(r),context:e,fileContainingReference:eu.of(Ky),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:Cy(i),docs:r.description??void 0}})}}function VCl(e){for(let t of e.ir.webhooks){let r=HoA({webhook:t,context:e});if(r==null)continue;let n=DJn(t.sdkName,t.namespace),i={};for(let a of t.headers)i[a.name]=EMe({header:a,context:e,fileContainingReference:r.file,namespace:n});let o={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:_l({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),examples:t.examples!=null?t.examples.map(a=>({docs:a.description,name:a.name,payload:eq(a.payload)})):void 0};t.response!=null&&t.response._visit({json:a=>{let s=_l({schema:a.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o.response={docs:a.description??void 0,type:Cy(s)},a.statusCode!=null&&(o.response["status-code"]=a.statusCode)},file:a=>{o.response={docs:a.description??void 0,type:"file","status-code":a.statusCode}},bytes:a=>{o.response={docs:a.description??void 0,type:"bytes","status-code":a.statusCode}},text:a=>{o.response={docs:a.description??void 0,type:"text","status-code":a.statusCode}},streamingJson:a=>{let s=_l({schema:a.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:a.description??void 0,type:Cy(s),format:"json"}},streamingSse:a=>{let s=_l({schema:a.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:a.description??void 0,type:Cy(s),format:"sse"}},streamingText:a=>{o["response-stream"]={docs:a.description??void 0,type:"text"}},_other:()=>{throw new Error("Unrecognized Response type: "+t.response?.type)}}),e.builder.addWebhook(r.file,{name:r.endpointId,schema:o}),t.description!=null&&(o.docs=t.description)}}function WoA({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:xj(eu.of(t),e.file)}:e}function GoA({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:eu.of(Ky),endpointId:n};let i=HYr(r),o=HYr(n);if(Sj(i,o))return{file:eu.of("__package__.yml"),endpointId:r};let a=[];for(let s=0;s<i.length;++s){let c=i[s];if(c!=null&&c===o[s])a.push(c);else{let l=Xi(r);return{file:eu.of(`${l}.yml`),endpointId:n,tag:r}}}if(a.length>=o.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:eu.of(Xi(a.join("_"))+".yml"),endpointId:Xi(o.slice(a.length).join("_")),tag:r}}function HoA({webhook:e,context:t}){return e.sdkName!=null?{file:sCl({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:WoA({namespaceOverride:e.namespace,location:GoA({webhook:e,context:t})})}var Cas="external",zCl=eu.of(Ky);function kCl({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,o]of Object.entries(e)){if(t.includes(i))continue;let a=cCl(o),s=hCl({schema:o,context:n,declarationFile:a,namespace:r,declarationDepth:0});if(Jyt(s.schema)){let c=Cy(s.schema);if(c===(s.name??i)||c===`optional<${s.name??i}>`||c===`nullable<${s.name??i}>`||c===`optional<nullable<${s.name??i}>>`)continue}n.builder.addType(a,{name:s.name??i,schema:s.schema})}}function UCl(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),xCl(e),jCl(e),CCl(e),ACl(e),qCl(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(Cas);let t=QCl(e),r=t.sdkGroups;e.setInState(MT.Webhook),VCl(e),e.unsetInState(MT.Webhook),e.setInState(MT.Channel);for(let i of Object.values(e.ir.channels)){let o=nat(i.groupName);wCl({channel:i,context:e,declarationFile:o})}e.unsetInState(MT.Channel);let n=$oA({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});kCl({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,o]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))kCl({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 $oA({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return 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 Array.from(i)}var JYr=class{context;constructor(t){this.context=t}};var TJn=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[a,s]of Object.entries(n.files)){let c=i!=null?eu.of(`${i}${"/"}${a}`):eu.of(a);t[c]=s}let o=Object.keys(n.directories).sort();for(let a of o){let s=i!=null?`${i}${"/"}${a}`:a,c=n.directories[a];r(c,s)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[eu.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}};var X2t=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new TJn,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 a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(a.service.auth=r),n!=null&&(a.service["base-path"]=n),i!=null&&(a.service["display-name"]=i),o!=null&&(a.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}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return sMe(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"]))LCl(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(LCl(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}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??Xi((Gee(r)+"/"+MIe(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===eu.of(Qj))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=cor(Gee(uor.of(`/${t}`)),uor.of(`/${r}`)),i;let o=this.getOrCreateFile(t);return o.imports==null&&(o.imports={}),o.imports[i]=cor(Gee(uor.of(`/${t}`)),uor.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===eu.of(Qj))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(s=>Sj(s,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=xj(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;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,o])=>[i,{...o,path:xj(r,o.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([o,a])=>[o,{...a,path:xj(r,a.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===Ky?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}};function LCl(e){return e?.header!=null}var RJn=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;options;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:o,authOverrides:a}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=a,this.globalHeaderOverrides=o,this.options=H2t({options:n}),this.enableUniqueErrorsPerEndpoint=this.options.enableUniqueErrorsPerEndpoint,this.referencedSchemaIds=this.options.onlyIncludeReferencedSchemas?new Set:void 0,this.builder=new X2t(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let s={};if(!this.enableUniqueErrorsPerEndpoint)for(let c of r.endpoints)for(let[l,u]of Object.entries(c.errors)){let p=parseInt(l),d=s[p];d==null&&u.schema!=null?s[p]=u.schema:d!=null&&u.schema!=null&&T5(d,u.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(t){return this.unknownSchema.has(t)}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(MT.Channel,MT.Endpoint,MT.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:qe(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:qe(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))}};function Sas(e){let t=new RJn(e);return UCl(t)}function JoA(e,t){return c2t(e,{single:r=>[typeof r=="string"?r:r.scheme],any:r=>r.any.map(n=>typeof n=="string"?n:n.scheme),endpointSecurity:()=>t!=null?Object.keys(t):[]})}function KoA(e,t){if(e==null)return;let r=JoA(t,e),n={};for(let i of r)e[i]!=null&&(n[i]=e[i]);return Object.keys(n).length>0?n:void 0}var FJn=class{args;constructor(t){this.args=t}buildAuthOverrides(t,r){let n=this.args.generatorsConfiguration?.api?.["auth-schemes"],i=this.args.generatorsConfiguration?.api?.auth,o=t??i;if(o==null)return;let a=r!=null||n!=null?{...n,...r}:void 0,s=KoA(a,o);return{auth:o,"auth-schemes":s}}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let o=Sas({taskContext:t,ir:r,options:H2t({options:n,overrides:this.args}),authOverrides:this.buildAuthOverrides(n?.auth,n?.authSchemes),environmentOverrides:this.args.generatorsConfiguration?.api?.environments!=null?{...this.args.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.args.generatorsConfiguration?.api?.headers!=null?{...this.args.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:i??this.args.absoluteFilePath,rootApiFile:{defaultUrl:o.rootApiFile["default-url"],contents:o.rootApiFile,rawContents:Un.dump(o.rootApiFile)},namedDefinitionFiles:{...Mi(o.definitionFiles,a=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Un.dump(a),contents:a})),[eu.of(Ky)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Un.dump(o.packageMarkerFile),contents:o.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var KYr=class extends xxe{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;coerceEnumsToLiterals;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;resolveAliases;groupEnvironmentsByHost;removeDiscriminantsFromSchemas;defaultIntegerFormat;pathParameterOrder;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.wrapReferencesToNullableInOptional=t.wrapReferencesToNullableInOptional,this.coerceOptionalSchemasToNullable=t.coerceOptionalSchemasToNullable,this.coerceEnumsToLiterals=t.coerceEnumsToLiterals,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.resolveAliases=t.resolveAliases,this.groupEnvironmentsByHost=t.groupEnvironmentsByHost,this.removeDiscriminantsFromSchemas=t.removeDiscriminantsFromSchemas,this.defaultIntegerFormat=t.defaultIntegerFormat,this.pathParameterOrder=t.pathParameterOrder,this.converter=new FJn(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:n},i){let o=await this.getOpenAPIIr({context:t,relativePathToDependency:n},i);return this.converter.convert({context:t,ir:o,settings:i,absoluteFilePath:r})}async toFernWorkspace({context:t},r,n){let i=await this.getDefinition({context:t},r);return new I5({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion})}};var nz={BEARER_FORMAT:"x-bearer-format",ENUM_VAR_NAMES:"x-enum-varnames",INTERNAL:"x-internal",EXAMPLES:"x-examples",TAGS:"x-tags",REDOCLY_CODE_SAMPLES_KEBAB:"x-code-samples",REDOCLY_CODE_SAMPLES_CAMEL:"x-codeSamples"};var Sfr={of(e){return e}};var WCl={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},Bas={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:WCl,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},wi={SOURCE:Sfr.of("source"),SDK_NAMESPACE:Sfr.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:Sfr.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:Sfr.of("x-fern-sdk-group-name"),REQUEST_NAME_V1:"x-request-name",REQUEST_NAME_V2:"x-fern-request-name",TYPE_NAME:"x-fern-type-name",BOOLEAN_LITERAL:"x-fern-boolean-literal",SERVER_NAME_V1:"x-name",SERVER_NAME_V2:"x-fern-server-name",BASE_PATH:"x-fern-base-path",GROUPS:Sfr.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",RETRIES:"x-fern-retries",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport",IS_DISCRIMINATED:"x-fern-discriminated",EXPLORER_ENABLED:"x-fern-explorer-enabled"};var YoA={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!1,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!1,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,preserveSchemaIds:!1,objectQueryParameters:!0,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!0,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!1,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,resolveAliases:!1,groupMultiApiEnvironments:!1,groupEnvironmentsByHost:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,removeDiscriminantsFromSchemas:vi.RemoveDiscriminantsFromSchemas.Always,defaultIntegerFormat:vi.DefaultIntegerFormat.Int32,pathParameterOrder:vi.PathParameterOrder.UrlOrder,resolveSchemaCollisions:!1};function XoA(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,a={};for(let s of Object.keys(t))i.has(s)?a[s]=n?.[s]!==void 0?n[s]:t[s]:o.has(s)?a[s]=n?.[s]!==void 0?n[s]:r?.[s]!==void 0?r[s]:void 0:a[s]=n?.[s]??r?.[s]??t[s];return a}function ire({options:e,overrides:t}){return XoA({defaults:YoA,options:e,overrides:t,overrideOnly:new Set(["disableExamples","preserveSchemaIds"]),undefinedIfAbsent:new Set(["exampleGeneration","defaultFormParameterEncoding"])})}var GCl={naming:"v1"};function ni(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function YYr(e,t,r,n,i=[]){try{let o=ni(e,t);if(o!=null)return r.parse(o)}catch{let a=Yee(i).join(" -> ");n.error(`${a.length>0?`${a}: `:""}Failed to parse ${t}`)}}function Z2t(e){let t=ni(e,"examples");if(t!=null){if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null)return Object.values(t).map(r=>typeof r=="object"&&r!==null&&"value"in r?r.value:r)}return[]}function HCl({schema:e,logger:t}){return ni(e,wi.ENCODING)??void 0}function $Cl(e){return ni(e,wi.FERN_ENUM)}function JCl({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:o}){let a=ni(n,wi.SDK_NAMESPACE),s=ni(n,wi.SDK_GROUP_NAME),c=ni(n,wi.TYPE_DEFINITION);if(c!=null)return XYr({fernType:c,nameOverride:e,generatedName:t,title:r,description:i,availability:o,namespace:a,groupName:typeof s=="string"?[s]:s})}function XYr({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s}){return LC({type:e,_default:void 0,validation:void 0,visitor:{primitive:c=>{switch(c.v1){case"BASE_64":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.base64({example:void 0})});case"BOOLEAN":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.boolean({default:void 0,example:void 0})});case"DATE":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.date({example:void 0})});case"DATE_TIME":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.datetime({example:void 0})});case"FLOAT":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.float({example:void 0})});case"DOUBLE":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.double({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.uint({default:void 0,example:void 0})});case"INTEGER":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.int({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT_64":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.uint64({default:void 0,example:void 0})});case"LONG":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return Bn.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,schema:Yo.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:qe(c.v1)}},unknown:()=>Bn.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:o,namespace:a,groupName:s}),map:({keyType:c,valueType:l})=>c?.type==="primitive"&&l!=null?Bn.map({nameOverride:t,generatedName:r,title:n,key:c,value:l,description:i,availability:o,namespace:a,groupName:s,encoding:void 0,example:void 0,inline:void 0,minProperties:void 0,maxProperties:void 0}):void 0,list:c=>c!=null?Bn.array({nameOverride:t,generatedName:r,title:n,value:c,description:i,availability:o,namespace:a,groupName:s,example:void 0,inline:void 0,minItems:void 0,maxItems:void 0}):void 0,optional:c=>c!=null?Bn.optional({nameOverride:t,generatedName:r,title:n,value:c,description:i,availability:o,namespace:a,groupName:s,inline:void 0}):void 0,nullable:c=>c!=null?Bn.nullable({nameOverride:t,generatedName:r,title:n,value:c,description:i,availability:o,namespace:a,groupName:s,inline:void 0}):void 0,set:c=>c!=null?Bn.array({nameOverride:t,generatedName:r,title:n,value:c,description:i,availability:o,namespace:a,groupName:s,example:void 0,inline:void 0,minItems:void 0,maxItems:void 0}):void 0,literal:c=>Bn.literal({nameOverride:t,generatedName:r,title:n,value:c._visit({string:l=>WP.string(l),boolean:l=>WP.boolean(l),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:o,namespace:a,groupName:s}),named:c=>Bn.reference({schema:c,nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:a,groupName:s,source:ZQ.openapi({file:"<memory>"})})}})}function KCl(e){let t=ni(e,wi.SOURCE);if(t!=null)return t.endsWith(".proto")?ZQ.protobuf({file:t}):ZQ.openapi({file:t})}function eLt(e){if(e!=null&&typeof e=="boolean")return e}function IMe(){let e=new Map,t=new Map;return{getUniqueSchemaId(r,n,i=!1){let o=e.get(r)||0;if(e.set(r,o+1),o>0&&i){let a=`${r}${o+1}`;return n?.warn?.(`Schema name collision detected: '${r}' already exists. Renaming to '${a}' to avoid conflicts.`),a}return r},getUniqueTitleName(r,n,i,o=!1){let a=t.get(r)||0;if(t.set(r,a+1),a>0&&o){let s=`${r}${a+1}`;return i?.warn(`Schema title collision detected: Multiple schemas use title '${r}'. Schema '${n}' retitled to '${s}' to avoid conflicts.`),s}return r},reset(){e.clear(),t.clear()}}}function fo(e){return e?.$ref!=null}function YCl({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:o,availability:a,wrapAsOptional:s,wrapAsNullable:c,context:l,namespace:u,groupName:p,example:d,encoding:m,source:h,minProperties:y,maxProperties:g}){return i===void 0&&(i=l.options.additionalPropertiesDefaultsTo),Das({nameOverride:e,generatedName:t,title:r,wrapAsOptional:s,wrapAsNullable:c,description:o,availability:a,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Yo.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:typeof i=="boolean"||ZYr(i,l.options)?Bn.unknown({...ZoA(i),generatedName:`${t}Value`}):XCl(El(i,!1,l.options.optionalAdditionalProperties?c:!1,l,[...n,"Value"],h,u,void 0,void 0,void 0)),namespace:u,groupName:p,example:d,encoding:m,minProperties:y,maxProperties:g})}function XCl(e){switch(e.type){case"array":case"enum":case"map":case"object":e.inline=!0;break;case"literal":case"primitive":case"reference":case"unknown":break;case"nullable":case"optional":e.inline=!0,e.value=XCl(e.value);break;case"oneOf":e.value.inline=!0;break;default:qe(e)}return e}function Das({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsOptional:o,wrapAsNullable:a,description:s,availability:c,namespace:l,groupName:u,example:p,encoding:d,minProperties:m,maxProperties:h}){let y=Bn.map({nameOverride:e,generatedName:t,title:r,description:s,availability:c,key:n,value:i,namespace:l,groupName:u,encoding:d,example:p,inline:void 0,minProperties:m,maxProperties:h});return a&&(y=Bn.nullable({nameOverride:e,generatedName:t,title:r,value:y,description:s,availability:c,namespace:l,groupName:u,inline:void 0})),o&&(y=Bn.optional({nameOverride:e,generatedName:t,title:r,value:y,description:s,availability:c,namespace:l,groupName:u,inline:void 0})),y}function ZYr(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:fo(e)||"type"in e&&e.type!=null||"oneOf"in e&&e.oneOf!=null||"anyOf"in e&&e.anyOf!=null?!1:"allOf"in e&&e.allOf!=null?!e.allOf.some(n=>fo(n)?!0:n.type!=null||n.properties!=null||n.allOf!=null||n.oneOf!=null||n.anyOf!=null||n.enum!=null||"items"in n||n.additionalProperties!=null):!("enum"in e&&e.enum!=null)}function ZoA(e){let t={nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0};return e==null||typeof e=="boolean"||fo(e)||typeof e!="object"||(e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description)),t}function ZCl({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:o,availability:a,wrapAsOptional:s,wrapAsNullable:c,context:l,namespace:u,groupName:p,example:d,source:m,minItems:h,maxItems:y}){let g=i==null?Bn.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:u,groupName:p}):El(i,!1,!1,l,[...n,"Item"],m,u);return eaA({nameOverride:e,generatedName:t,title:r,namespace:u,groupName:p,itemSchema:g,wrapAsOptional:s,wrapAsNullable:c,description:o,availability:a,example:d,minItems:h,maxItems:y})}function eaA({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsOptional:i,wrapAsNullable:o,description:a,availability:s,namespace:c,groupName:l,example:u,minItems:p,maxItems:d}){let m=Bn.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:s,namespace:c,groupName:l,example:u,inline:void 0,minItems:p,maxItems:d});return o&&(m=Bn.nullable({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:s,namespace:c,groupName:l,inline:void 0})),i&&(m=Bn.optional({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:s,namespace:c,groupName:l,inline:void 0})),m}function tq(e){switch(ni(e,wi.AVAILABILITY)){case"deprecated":return IR.Deprecated;case"beta":return IR.Beta;case"generally-available":return IR.GenerallyAvailable;default:break}if(!fo(e)&&e.deprecated)return IR.Deprecated}function NJn({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:o,availability:a,required:s,wrapAsOptional:c,wrapAsNullable:l,discriminator:u,context:p,namespace:d,groupName:m,encoding:h,source:y}){let g=u.propertyName,b=ni(u,wi.FERN_PROPERTY_NAME),_=Object.fromEntries(Object.entries(u.mapping??{}).map(([A,v])=>{let P=sat({$ref:v},!1,!1,p,[v],h,y,d);return p.markReferencedByDiscriminatedUnion({$ref:v},g,1),[A,P]})),O=Object.entries(i).filter(([A])=>A!==g).map(([A,v])=>{let P=s!=null&&s.includes(A),[I,E]=p.options.coerceOptionalSchemasToNullable?[!1,!P]:[!P,!1],x=El(v,I,E,p,[...n,A],y,d);return{key:A,schema:x}});return eSl({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:l,properties:O,description:o,availability:a,discriminant:g,discriminantNameOverride:b,subtypes:_,namespace:d,groupName:m,source:y})}function Tas({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:o,availability:a,required:s,wrapAsOptional:c,wrapAsNullable:l,discriminant:u,variants:p,context:d,namespace:m,groupName:h,encoding:y,source:g}){let b=Object.fromEntries(Object.entries(p).map(([O,A])=>{if(fo(A)){let v=sat(A,!1,!1,d,[A.$ref],y,g,m);return d.markReferencedByDiscriminatedUnion(A,u,1),[O,v]}else{let v=Bfr(A,!1,!1,d,[...n,O],y,g,m,new Set([u]));return[O,v]}})),_=Object.entries(i).filter(([O])=>O!==u).map(([O,A])=>{let v=s!=null&&s.includes(O),[P,I]=d.options.coerceOptionalSchemasToNullable?[!1,!v]:[!v,!1],E=El(A,P,I,d,[...n,O],g,m);return{key:O,schema:E}});return eSl({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:l,properties:_,description:o,availability:a,discriminant:u,discriminantNameOverride:void 0,subtypes:b,namespace:m,groupName:h,source:g})}function eSl({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:o,description:a,availability:s,discriminant:c,discriminantNameOverride:l,subtypes:u,namespace:p,groupName:d,source:m}){let h=Bn.oneOf(KJ.discriminated({description:a,availability:s,discriminantProperty:c,discriminantPropertyNameOverride:l,nameOverride:e,generatedName:t,title:r,schemas:u,commonProperties:o,namespace:p,groupName:d,encoding:void 0,source:m,inline:void 0}));return i&&(h=Bn.nullable({nameOverride:e,generatedName:t,title:r,value:h,namespace:p,groupName:d,description:a,availability:s,inline:void 0})),n&&(h=Bn.optional({nameOverride:e,generatedName:t,title:r,value:h,namespace:p,groupName:d,description:a,availability:s,inline:void 0})),h}function tSl(e){if(e.proto!=null)return Hpr.protobuf({typeName:e.proto.type})}function Cgt({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:o,_default:a,description:s,availability:c,wrapAsOptional:l,wrapAsNullable:u,namespace:p,groupName:d,context:m,source:h,inline:y}){let g=raA(i??[]),b=new Set(o),_=Array.from(b).map((A,v)=>{let P=n?.[A],I=g[v],E=Efr.test(A),x=P?.name??I,T=E?A:Ifr(A);return x!=null&&!Efr.test(x)&&(m?.logger.warn(`Enum name override ${x} is not a valid name. Falling back on ${T}.`),x=void 0),{nameOverride:x,generatedName:T,value:A,description:P?.description,availability:c,casing:{snake:P?.casing?.snake??void 0,pascal:P?.casing?.pascal??void 0,screamingSnake:P?.casing?.screamingSnake??void 0,camel:P?.casing?.camel??void 0}}}),O=a!=null?_.find(A=>A.value===a):void 0;return taA({wrapAsOptional:l,wrapAsNullable:u,nameOverride:e,generatedName:t,title:r,values:_,_default:O,description:s,availability:c,namespace:p,groupName:d,source:h,inline:y})}function taA({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:n,title:i,values:o,_default:a,description:s,availability:c,namespace:l,groupName:u,source:p,inline:d}){let m=Bn.enum({nameOverride:r,generatedName:n,title:i,values:o,description:s,availability:c,default:a,example:void 0,namespace:l,groupName:u,source:p,inline:d});return t&&(m=Bn.nullable({nameOverride:r,generatedName:n,title:i,value:m,description:s,availability:c,namespace:l,groupName:u,inline:d})),e&&(m=Bn.optional({nameOverride:r,generatedName:n,title:i,value:m,description:s,availability:c,namespace:l,groupName:u,inline:d})),m}function raA(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(n=>n[r]===t[r]);)r++;return e.map(n=>n.substring(r))}function rSl({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:o,maximum:a,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,description:u,availability:p,wrapAsOptional:d,wrapAsNullable:m,example:h,namespace:y,groupName:g,defaultIntegerFormat:b=vi.DefaultIntegerFormat.Int32}){let _=n??b,O=(()=>{switch(_){case vi.DefaultIntegerFormat.Int64:return Yo.int64({default:i,example:h});case vi.DefaultIntegerFormat.Uint32:return Yo.uint({default:i,example:h});case vi.DefaultIntegerFormat.Uint64:return Yo.uint64({default:i,example:h});default:return Yo.int({default:i,minimum:o,maximum:a,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,example:h})}})();return rq({nameOverride:e,generatedName:t,title:r,primitive:O,wrapAsOptional:d,wrapAsNullable:m,description:u,availability:p,namespace:y,groupName:g})}function naA(e){return typeof e=="string"?WP.string(e):typeof e=="boolean"?WP.boolean(e):WP.string(`${e}`)}function nSl({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,value:o,description:a,availability:s,namespace:c,groupName:l}){let u=Bn.literal({nameOverride:e,generatedName:t,title:r,value:naA(o),description:a,availability:s,namespace:c,groupName:l});return i&&(u=Bn.nullable({nameOverride:e,generatedName:t,title:r,value:u,description:a,availability:s,namespace:c,groupName:l,inline:void 0})),n&&(u=Bn.optional({nameOverride:e,generatedName:t,title:r,value:u,description:a,availability:s,namespace:c,groupName:l,inline:void 0})),u}function Ras({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:o,maximum:a,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,description:u,availability:p,wrapAsOptional:d,wrapAsNullable:m,example:h,namespace:y,groupName:g}){return n==null||n==="double"?rq({nameOverride:e,generatedName:t,title:r,primitive:Yo.double({default:i,minimum:o,maximum:a,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,example:h}),wrapAsOptional:d,wrapAsNullable:m,description:u,availability:p,namespace:y,groupName:g}):n==="float"?rq({nameOverride:e,generatedName:t,title:r,primitive:Yo.float({example:h}),wrapAsOptional:d,wrapAsNullable:m,description:u,availability:p,namespace:y,groupName:g}):n==="int32"?rq({nameOverride:e,generatedName:t,title:r,primitive:Yo.int({default:i,minimum:o,maximum:a,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,example:h}),wrapAsOptional:d,wrapAsNullable:m,description:u,availability:p,namespace:y,groupName:g}):n==="int64"?rq({nameOverride:e,generatedName:t,title:r,primitive:Yo.int64({default:i,example:h}),wrapAsOptional:d,wrapAsNullable:m,description:u,availability:p,namespace:y,groupName:g}):n==="uint32"?rq({nameOverride:e,generatedName:t,title:r,primitive:Yo.uint({default:i,example:h}),wrapAsOptional:d,wrapAsNullable:m,description:u,availability:p,namespace:y,groupName:g}):n==="uint64"?rq({nameOverride:e,generatedName:t,title:r,primitive:Yo.uint64({default:i,example:h}),wrapAsOptional:d,wrapAsNullable:m,description:u,availability:p,namespace:y,groupName:g}):n==="time-delta"?rq({nameOverride:e,generatedName:t,title:r,primitive:Yo.float({example:h}),wrapAsOptional:d,wrapAsNullable:m,description:u,availability:p,namespace:y,groupName:g}):rq({nameOverride:e,generatedName:t,title:r,primitive:Yo.float({example:h}),wrapAsOptional:d,wrapAsNullable:m,description:u,availability:p,namespace:y,groupName:g})}var iaA={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},oaA={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="responses",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},aaA={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="parameters",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),e[0]==="schema"&&(e=e.slice(1)),{refUnderProcessing:e,newBreadcrumbs:t}}},saA={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},uaA={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},caA={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},laA={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},paA={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function eXr(e){let t=e.split("/").map(o=>o.replace(/~1/g,"/")),r=[],n=[iaA,oaA,aaA,saA,uaA,caA,laA,paA],i;do{i=t;for(let o of n)if(o.isApplicable(t)){let{refUnderProcessing:a,newBreadcrumbs:s}=o.applyStrategy(t);t=a,r=[...r,...s]}}while(t.join("")!==i.join(""));return r}function GC(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:Xd(Xi(i))).join("");return/^\d/.test(n)?UYr(n)??n:n}function iSl(e){let t=e.join("_");return Xi(t)}function MA(e){switch(e.type){case"object":return Pc.object({allOf:e.allOf,properties:e.properties.map(t=>daA(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source,inline:e.inline,minProperties:e.minProperties,maxProperties:e.maxProperties});case"array":return Pc.array({description:e.description,availability:e.availability,value:MA(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline,minItems:e.minItems,maxItems:e.maxItems});case"enum":return Pc.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,namespace:e.namespace,groupName:e.groupName,source:e.source,inline:e.inline});case"literal":return Pc.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"nullable":return Pc.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:MA(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return Pc.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:MA(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return Pc.primitive({description:e.description,availability:e.availability,schema:oSl(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Pc.map({description:e.description,availability:e.availability,key:Pc.primitive({description:e.key.description,availability:e.key.availability,schema:oSl(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:MA(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,inline:e.inline,minProperties:e.minProperties,maxProperties:e.maxProperties});case"reference":return Pc.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,namespace:e.namespace,groupName:e.groupName,source:e.source});case"oneOf":return Pc.oneOf(faA(e.value));case"unknown":return Pc.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:qe(e)}}function faA(e){switch(e.type){case"discriminated":return _Me.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:MA(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,discriminantPropertyNameOverride:e.discriminantPropertyNameOverride,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,MA(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return _Me.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>MA(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:qe(e)}}function oSl(e){switch(e.type){case"string":return Ph.string(e);case"base64":return Ph.base64();case"boolean":return Ph.boolean(e);case"date":return Ph.date();case"datetime":return Ph.datetime();case"double":return Ph.double(e);case"float":return Ph.float();case"int":return Ph.int(e);case"int64":return Ph.int64(e);case"uint":return Ph.uint();case"uint64":return Ph.uint64();default:qe(e)}}function daA(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:MA(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function MJn(e,t){return T5(MA(e),MA(t))}function aSl({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:o,required:a,wrapAsOptional:s,wrapAsNullable:c,allOf:l,context:u,propertiesToExclude:p,namespace:d,groupName:m,fullExamples:h,additionalProperties:y,availability:g,source:b,minProperties:_,maxProperties:O}){let A=[...a??[]],v={...sSl({properties:i,breadcrumbs:n,context:u})},P=[],I=[];for(let H of l)if(!u.options.inlineAllOfSchemas&&fo(H)){let G=u.resolveSchemaReference(H);if(G.discriminator!=null&&G.discriminator.mapping!=null)continue;if(G.oneOf!=null||G.anyOf!=null){let oe=G.oneOf??G.anyOf;if(oe!=null){for(let $ of oe){let te=fo($)?u.resolveSchemaReference($):$,Ge=El(te,!1,!1,u.DUMMY,n,b,d);Ge.type==="object"&&P.push(...Ge.properties.map(Ke=>Ke.schema.type!=="optional"&&Ke.schema.type!=="nullable"?{...Ke,schema:Bn.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Ke.schema,description:void 0,availability:Ke.availability,namespace:void 0,groupName:void 0,inline:void 0})}:Ke))}continue}}let ie=Sgt(H);if(ie==null)continue;I.push({schemaId:ie,convertedSchema:Fas(H,[ie],b,u.options.preserveSchemaIds,u),properties:uSl({schema:H,context:u,breadcrumbs:n,source:b,namespace:d})}),u.markSchemaAsReferencedByNonRequest(ie)}else if(fo(H)){let G=u.resolveSchemaReference(H),ie=El(G,!1,!1,u,n,b,d);ie.type==="object"&&P.push(...ie.properties)}else{let G=H.required??[];P=P.map(oe=>(oe.schema.type==="optional"||oe.schema.type==="nullable")&&G.includes(oe.key)?{...oe,schema:oe.schema.value}:oe);let ie=El(H,!1,!1,u,n,b,d);ie.type==="object"&&P.push(...ie.properties)}let E={};for(let H of I)for(let[G,ie]of Object.entries(H.properties)){let oe=E[G];oe!=null?(oe.schemaIds.push(H.schemaId),oe.schemas.some(te=>MJn(te,ie))||oe.schemas.push(ie)):E[G]={schemaIds:[H.schemaId],schemas:[ie]}}let x=[];for(let[H,G]of Object.entries(E))G.schemaIds.length>1&&x.push({propertyKey:H,allOfSchemaIds:G.schemaIds,conflictingTypeSignatures:G.schemas.length>1});let T=Object.fromEntries(Object.entries(v).filter(([H,G])=>!(!fo(G)&&G.type==="null"))),W=Object.entries(T).map(([H,G])=>{let ie=ni(G,wi.AUDIENCES)??[],oe=tq(G),$=fo(G)?!1:G.readOnly,te=fo(G)?!1:G.writeOnly,Ke=!(A.includes(H)&&!$),X=ni(G,wi.FERN_PROPERTY_NAME),Y=[...n,H],Be=iSl(Y),Pe=El(G,Ke,!1,u,Y,b,d),ke={};for(let Ye of I){let Oe=Ye.properties[H];Oe!=null&&!MJn(Pe,Oe)?ke[Ye.schemaId]={differentSchema:!0}:Oe!=null&&(ke[Ye.schemaId]={differentSchema:!1})}return{key:H,schema:Pe,nameOverride:X,audiences:ie,conflict:ke,generatedName:Be,availability:oe,readonly:$,writeonly:te}});return W.push(...P.map(H=>{let G=H.conflict;for(let ie of I){let oe=ie.properties[H.key];oe!=null&&!MJn(H.schema,oe)?G[ie.schemaId]={differentSchema:!0}:oe!=null&&(G[ie.schemaId]={differentSchema:!1})}return{...H,conflict:G}})),maA({nameOverride:e,generatedName:t,title:r,wrapAsOptional:s,wrapAsNullable:c,properties:W.filter(H=>!p.has(H.key)),description:o,allOf:I.map(H=>H.convertedSchema),allOfPropertyConflicts:x,namespace:d,groupName:m,fullExamples:h,additionalProperties:y,availability:g,source:b,context:u,minProperties:_,maxProperties:O})}function maA({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:o,description:a,allOf:s,allOfPropertyConflicts:c,namespace:l,groupName:u,fullExamples:p,additionalProperties:d,availability:m,source:h,context:y,minProperties:g,maxProperties:b}){let _=Bn.object({description:a,properties:o,nameOverride:e,generatedName:t,title:r,allOf:s,allOfPropertyConflicts:c,namespace:l,groupName:u,fullExamples:p,additionalProperties:ZYr(d,y.options),availability:m,source:h,inline:void 0,minProperties:g,maxProperties:b});return i&&(_=Bn.nullable({nameOverride:e,generatedName:t,title:r,value:_,description:a,availability:m,namespace:l,groupName:u,inline:void 0})),n&&(_=Bn.optional({nameOverride:e,generatedName:t,title:r,value:_,description:a,availability:m,namespace:l,groupName:u,inline:void 0})),_}function sSl({properties:e,breadcrumbs:t,context:r}){return Object.fromEntries(Object.entries(e).filter(([n,i])=>{let o=ni(i,wi.IGNORE);return o&&r.logger.debug(`Property ${t.join(".")}.${n} is marked with x-fern-ignore. Skipping.`),!o}))}function uSl({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let o={},[a,s]=fo(e)?[t.resolveSchemaReference(e),eXr(e.$ref)]:[e,r];for(let c of a.allOf??[])o={...o,...uSl({schema:c,context:t,breadcrumbs:s,source:n,namespace:i})};for(let[c,l]of Object.entries(sSl({properties:a.properties??{},breadcrumbs:r,context:t}))){let u=El(l,!1,!1,t,[...s,c],n,i);o[c]=u}return o}function Bgt({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:o,wrapAsOptional:a,wrapAsNullable:s,context:c,subtypes:l,namespace:u,groupName:p,encoding:d,source:m,subtypeSuffixOverrides:h}){let y=gaA({schemas:l}),g=l.flatMap((_,O)=>{if(!fo(_)&&_.enum!=null&&c.options.coerceEnumsToLiterals&&_.type==="string")return _.enum.map(v=>Bn.literal({nameOverride:void 0,generatedName:GC([t,v],c.options.preserveSchemaIds),title:void 0,value:WP.string(String(v)),namespace:u,groupName:void 0,description:void 0,availability:v.availability}));let A=y[O];if(h!=null){let v=h[O];v!=null&&"name"in v&&(A=v.name)}return[El(_,!1,!1,c,[...n,A??`${O}`],m,u)]}),b=haA(g);return yaA({uniqueSubtypes:b,nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:s,description:i,availability:o,namespace:u,groupName:p,context:c,encoding:d,source:m})}function haA(e){let t=[];for(let r=0;r<e.length;++r){let n=e[r],i=!1;for(let o=r+1;o<e.length;++o){let a=e[o];if(n!=null&&a!=null&&T5(n,a)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function yaA({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:o,description:a,availability:s,namespace:c,groupName:l,context:u,encoding:p,source:d}){if(Object.entries(e).every(([h,y])=>y.type==="literal")){let h={},y=[];return Object.entries(e).forEach(([g,b])=>{b.type==="literal"&&b.value.type==="string"&&(y.push(b.value.value),b.description!=null&&(h[b.value.value]={description:b.description}))}),Cgt({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:o,description:a,availability:s,fernEnum:h,enumVarNames:void 0,enumValues:y,_default:void 0,namespace:c,groupName:l,context:u,source:d,inline:void 0})}if(e.length===1&&e[0]!=null&&!u.options.preserveSingleSchemaOneOf){let h=e[0];return o&&(h=Bn.nullable({nameOverride:t,generatedName:r,title:n,value:h,description:a,availability:s,namespace:c,groupName:l,inline:void 0})),i&&(h=Bn.optional({nameOverride:t,generatedName:r,title:n,value:h,description:a,availability:s,namespace:c,groupName:l,inline:void 0})),h}return cSl({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:o,description:a,availability:s,subtypes:e,namespace:c,groupName:l,encoding:p,source:d})}function Nas({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsOptional:o,wrapAsNullable:a,context:s,namespace:c,groupName:l,discriminator:u,encoding:p,source:d}){let m=Object.entries(u.mapping??{}).map(([g,b],_)=>{let O={$ref:b},A=sat(O,!1,!1,s,[b],p,d,c);return s.markSchemaWithDiscriminantValue(O,u.propertyName,g),A.type==="object"&&(A.properties={[u.propertyName]:Bn.literal({nameOverride:void 0,generatedName:GC([t,g],s.options.preserveSchemaIds),title:void 0,value:WP.string(g),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...A.properties.filter(v=>v.key!==u.propertyName)}),A}),h=[];for(let g=0;g<m.length;++g){let b=m[g],_=!1;for(let O=g+1;O<m.length;++O){let A=m[O];if(b!=null&&A!=null&&T5(b,A)){_=!0;break}}b!=null&&!_&&h.push(b)}if(Object.entries(h).every(([g,b])=>b.type==="literal")){let g={},b=[];return Object.entries(h).forEach(([_,O])=>{O.type==="literal"&&O.value.type==="string"&&(b.push(O.value.value),O.description!=null&&(g[O.value.value]={description:O.description}))}),Cgt({nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:a,description:n,availability:i,fernEnum:g,enumVarNames:void 0,enumValues:b,_default:void 0,namespace:c,groupName:l,context:s,source:d,inline:void 0})}return h.length===1&&h[0]!=null&&!s.options.preserveSingleSchemaOneOf?h[0]:cSl({nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:a,description:n,availability:i,subtypes:h,namespace:c,groupName:l,encoding:p,source:d})}function gaA({schemas:e}){let t={},r=0;for(let i of e){if(!fo(i)){if(i.properties!=null&&Object.entries(i.properties).length>0){let o=Object.keys(i.properties),a={},s=o;for(let[c,l]of Object.entries(t)){let u=rDn(l,o);s=rDn(s,l),a[c]=u}a[r]=s,t=a}}r++}return e.map((i,o)=>{let a=t[o];if(a!=null&&a.length>0){let s=a.sort();if(s[0]!=null)return s[0]}return J2t(o)??`${o}`})}function cSl({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,description:o,availability:a,subtypes:s,namespace:c,groupName:l,encoding:u,source:p}){let d=Bn.oneOf(KJ.undiscriminated({description:o,availability:a,nameOverride:e,generatedName:t,title:r,schemas:s,namespace:c,groupName:l,encoding:u,source:p,inline:void 0}));return i&&(d=Bn.nullable({nameOverride:e,generatedName:t,title:r,value:d,description:o,availability:a,namespace:c,groupName:l,inline:void 0})),n&&(d=Bn.optional({nameOverride:e,generatedName:t,title:r,value:d,description:o,availability:a,namespace:c,groupName:l,inline:void 0})),d}function Dfr(e){if(e.default!=null&&typeof e.default=="string")return e.default}function zJn({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=Z2t(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function lSl({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=Z2t(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function xMe({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=Z2t(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function pSl({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=Z2t(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var tLt="#/components/schemas/";var hSl=IMe();function kJn(){hSl.reset()}function baA(e,t,r){let n=ni(e,wi.TYPE_NAME),i=t.options.useTitlesAsName?vaA(e.title):void 0,o=n??i;if(!o)return;let a=r.split(".");return n!=null||a.length===1?hSl.getUniqueTitleName(o,r,t.logger,t.options.resolveSchemaCollisions):o}function ySl(e,t){let r=fo(e)?t.resolveSchemaReference(e):e;switch(r.type){case"boolean":case"number":case"integer":return!0;case"string":return r.enum==null;case"array":return ySl(r.items,t);case"object":return!1;case void 0:return!1;default:return t.logger.warn("Unhandled schema type. Will not inline this schema",JSON.stringify(r)),!1}}function AaA(e,t,r){return r.options.resolveAliases?typeof r.options.resolveAliases=="object"&&r.options.resolveAliases.except?.includes(e)?!1:ySl(t,r):!1}function El(e,t,r,n,i,o,a,s=!1,c=new Set,l){let u=KCl(e)??o,p=xaA({schema:e,logger:n.logger}),d=l;if(fo(e)){let m=_aA(e);m!==void 0&&(d=m)}if(fo(e)){let m=Sgt(e);return m!=null?AaA(m,e,n)?Bfr(n.resolveSchemaReference(e),t,r,n,eXr(e.$ref),p,u,a,c,s,d):(s?n.markSchemaAsReferencedByRequest(m):n.markSchemaAsReferencedByNonRequest(m),sat(e,t,r,n,i,p,u,a)):Bfr(n.resolveSchemaReference(e),t,r,n,eXr(e.$ref),p,u,a,c,s,d)}return Bfr(e,t,r,n,i,p,u,a,c,s,l)}function _aA(e){if("example"in e&&e.example!==void 0){let t=e.example;if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"||Array.isArray(t))return t}if("examples"in e){let t=e.examples;if(Array.isArray(t)&&t.length>0){let r=t[0];if(typeof r=="string"||typeof r=="number"||typeof r=="boolean"||Array.isArray(r))return r}}}function sat(e,t,r,n,i,o,a,s){let c=e.$ref.includes("properties")?Bfr(n.resolveSchemaReference(e),t,r,n,i,o,a,s,new Set):Bn.reference(Fas(e,i,a,n.options.preserveSchemaIds,n));if(r===!1){let l=n.resolveSchemaReference(e);(l.nullable===!0||Array.isArray(l.type)&&l.type.length>=2&&l.type.includes("null"))&&(r=!0)}return r&&(c=Bn.nullable({title:void 0,nameOverride:void 0,generatedName:GC(i,n.options.preserveSchemaIds),value:c,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(c=Bn.optional({title:void 0,nameOverride:void 0,generatedName:GC(i,n.options.preserveSchemaIds),value:c,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),c}function vaA(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function Bfr(e,t,r,n,i,o,a,s,c=new Set,l=!1,u){typeof e=="string"&&(e={type:e});let p=baA(e,n,i.join(".")),d=ni(e,wi.SDK_GROUP_NAME)??ni(e,nz.TAGS)?.[0],m=(typeof d=="string"?[d]:d)??[];m=n.resolveGroupName(m);let h=GC(i,n.options.preserveSchemaIds),y=e.title,g=e.description,b=tq(e),_=[];e.example!=null&&_.push({name:void 0,value:e.example,description:void 0});let O=ni(e,nz.EXAMPLES);O!=null&&Object.keys(O).length>0&&_.push(...Object.entries(O).map(([P,I])=>({name:I?.summary??P,value:I.value,description:I.description})));let A=Z2t(e);A!=null&&Object.keys(A).length>0&&_.push(...A.map(P=>({name:void 0,value:P,description:void 0})));let v=JCl({schema:e,description:g,title:y,nameOverride:p,generatedName:h,availability:b});if(v!=null){let P=v;return r&&(P=Bn.nullable({availability:b,namespace:s,groupName:m,description:g,generatedName:h,inline:void 0,nameOverride:p,title:y,value:P})),t&&(P=Bn.optional({availability:b,namespace:s,groupName:m,description:g,generatedName:h,inline:void 0,nameOverride:p,title:y,value:P})),P}try{if(Array.isArray(e.type)){let E=e.type.indexOf("null"),x=E!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&x)e.type.splice(E,1),e.type=e.type[0],e.nullable=!0;else if(x&&(e.type.splice(E,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let T=new Set([...e.oneOf,...e.type]);e.oneOf=[...T]}}if(r=r||e.nullable===!0,"const"in e&&(e.enum=[e.const]),e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(e.enum=e.enum.filter(x=>x!==null),!VJn(e.enum))return rq({nameOverride:p,generatedName:h,title:y,primitive:Yo.string({default:Dfr(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:xMe({schema:e,logger:n.logger,fallback:u})}),namespace:s,groupName:m,wrapAsOptional:t,wrapAsNullable:r,description:g,availability:b});let E=$Cl(e);return n.options.coerceEnumsToLiterals&&e.enum.length===1&&e.enum[0]!=null&&E==null?nSl({nameOverride:p,generatedName:h,title:y,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:g,availability:b,namespace:s,groupName:m}):Cgt({nameOverride:p,generatedName:h,title:y,fernEnum:E,enumVarNames:ni(e,[nz.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,namespace:s,groupName:m,context:n,source:a,inline:void 0})}if(VJn(e.type)&&e.type.length>1){let E=e.type.includes("null"),x=e.type.filter(T=>T!=="null").map(T=>({type:T,nullable:E}));return Bgt({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:x,namespace:s,groupName:m,encoding:o,source:a})}if(e.type==="boolean"){let E=ni(e,wi.BOOLEAN_LITERAL);return E!=null?dSl({nameOverride:p,generatedName:h,title:y,literal:WP.boolean(E),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:b,namespace:s,groupName:m}):rq({nameOverride:p,generatedName:h,title:y,primitive:Yo.boolean({default:OaA(e.default),example:lSl({schema:e,logger:n.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:b,namespace:s,groupName:m})}if(e.type==="number")return Ras({nameOverride:p,generatedName:h,title:y,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:eLt(e.exclusiveMinimum),exclusiveMaximum:eLt(e.exclusiveMaximum),multipleOf:e.multipleOf,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,example:zJn({schema:e,logger:n.logger,fallback:u}),namespace:s,groupName:m});if(e.type==="integer")return rSl({nameOverride:p,generatedName:h,title:y,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:eLt(e.exclusiveMinimum),exclusiveMaximum:eLt(e.exclusiveMaximum),multipleOf:e.multipleOf,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,example:zJn({schema:e,logger:n.logger,fallback:u}),namespace:s,groupName:m,defaultIntegerFormat:n.options.defaultIntegerFormat});if(e.type==="float")return Ras({nameOverride:p,generatedName:h,title:y,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:eLt(e.exclusiveMinimum),exclusiveMaximum:eLt(e.exclusiveMaximum),multipleOf:e.multipleOf,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,example:zJn({schema:e,logger:n.logger,fallback:u}),namespace:s,groupName:m});if(e.type==="string"){if(e.format==="date-time")return rq({nameOverride:p,generatedName:h,title:y,primitive:Yo.datetime({example:xMe({schema:e,logger:n.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:b,namespace:s,groupName:m});if(e.format==="date"&&n.options.typeDatesAsStrings===!1)return rq({nameOverride:p,generatedName:h,title:y,primitive:Yo.date({example:xMe({schema:e,logger:n.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:b,namespace:s,groupName:m});if(e.format==="json-string"){let x=Bn.unknown({nameOverride:p,generatedName:h,title:y,description:g,availability:b,namespace:s,groupName:m,example:void 0});return r&&(x=Bn.nullable({availability:b,namespace:s,groupName:m,description:g,generatedName:h,inline:void 0,nameOverride:p,title:y,value:x})),t&&(x=Bn.optional({availability:b,namespace:s,groupName:m,description:g,generatedName:h,inline:void 0,nameOverride:p,title:y,value:x})),x}let E=bSl(e,"const");return E!=null?dSl({nameOverride:p,generatedName:h,title:y,literal:WP.string(E),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:b,namespace:s,groupName:m}):rq({nameOverride:p,generatedName:h,title:y,primitive:Yo.string({default:Dfr(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:xMe({schema:e,logger:n.logger,fallback:u})}),namespace:s,groupName:m,wrapAsOptional:t,wrapAsNullable:r,description:g,availability:b})}if(e.type==="array")return ZCl({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,item:e.items,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:s,groupName:m,example:pSl({schema:e,logger:n.logger,fallback:u}),source:a,minItems:e.minItems,maxItems:e.maxItems});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&QJn(e)&&fSl(e))return YCl({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,additionalProperties:e.additionalProperties,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:s,groupName:m,encoding:o,example:e.example,source:a,minProperties:e.minProperties,maxProperties:e.maxProperties});if(e.oneOf!=null&&e.oneOf.length>0&&ni(e,wi.IS_DISCRIMINATED)===!1)return Bgt({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf,namespace:s,groupName:m,encoding:o,source:a});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return n.options.discriminatedUnionV2?Nas({nameOverride:p,generatedName:h,title:y,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:s,groupName:m,discriminator:e.discriminator,encoding:o,source:a}):NJn({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,description:g,availability:b,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:s,groupName:m,encoding:o,source:a});if(e.oneOf!=null&&e.oneOf.length>0){let E=ni(e,wi.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return n.options.discriminatedUnionV2||E?Nas({nameOverride:p,generatedName:h,title:y,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:s,groupName:m,discriminator:e.discriminator,encoding:o,source:a}):NJn({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,description:g,availability:b,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:s,groupName:m,encoding:o,source:a});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(n.options.preserveSingleSchemaOneOf)return Bgt({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf.filter(T=>fo(T)||T.type!=="null"),encoding:o,namespace:s,groupName:m,source:a});let x=El(e.oneOf[0],t,r,n,i,a,s,l);return jMe(x,g,s,m)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let H=e.oneOf[0],G=e.oneOf[1];if(!fo(H)&&H.type==="null"){let ie=El(G,t,!0,n,i,a,s);return jMe(ie,g,s,m)}else if(!fo(G)&&G.type==="null"){let ie=El(H,t,!0,n,i,a,s);return jMe(ie,g,s,m)}}let x=PaA({schemas:e.oneOf});if(x!=null)return Cgt({nameOverride:p,generatedName:h,title:y,fernEnum:void 0,enumVarNames:void 0,enumValues:x,_default:e.default,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,namespace:s,groupName:m,context:n,source:a,inline:void 0});let T=mSl({schemas:e.oneOf,context:n});if(T!=null&&!n.options.discriminatedUnionV2&&!E)return Tas({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,properties:e.properties??{},required:e.required,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,discriminant:T.discriminant,variants:T.schemas,context:n,namespace:s,groupName:m,encoding:o,source:a});let W=e.oneOf.filter(H=>!fo(H)&&H.type==="null").length>0;return Bgt({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r||W,context:n,subtypes:e.oneOf.filter(H=>fo(H)||H.type!=="null"),encoding:o,namespace:s,groupName:m,source:a})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let T=El(e.anyOf[0],t,r,n,i,a,s,l);return jMe(T,g,s,m)}if(e.anyOf.length===2){let[T,W]=e.anyOf;if(T!=null&&W!=null){if(!fo(T)&&T.type==="null"){let H=El(W,t,!0,n,i,a,s);return jMe(H,g,s,m)}else if(!fo(W)&&W.type==="null"){let H=El(T,t,!0,n,i,a,s);return jMe(H,g,s,m)}}}let E=mSl({schemas:e.anyOf,context:n});if(E!=null&&!n.options.discriminatedUnionV2)return Tas({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,properties:e.properties??{},required:e.required,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,discriminant:E.discriminant,variants:E.schemas,context:n,namespace:s,groupName:m,encoding:o,source:a});let x=e.anyOf.filter(T=>!fo(T)&&T.type==="null").length>0;return Bgt({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r||x,context:n,subtypes:e.anyOf.filter(T=>fo(T)||T.type!=="null"),encoding:o,namespace:s,groupName:m,source:a})}if(e.discriminator?.mapping!=null&&Object.keys(e.discriminator.mapping).length>0&&e.oneOf==null&&e.anyOf==null)return NJn({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,description:g,availability:b,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:s,groupName:m,encoding:o,source:a});if(e.allOf!=null||e.properties!=null){let E=[];for(let T of e.allOf??[])(fo(T)||Object.keys(T).length>0)&&E.push(T);if((e.properties==null||QJn(e))&&E.length===1&&E[0]!=null&&(e.additionalProperties==null||e.additionalProperties===!1)){let T=El(E[0],t,r,n,i,a,s,l);return jMe(T,g,s,m)}let x=E.filter(T=>{let W=qJn(T);return W||n.logger.debug(`Skipping non-object allOf element: ${JSON.stringify(T)}`),W});if((e.properties==null||QJn(e))&&x.length===1&&x[0]!=null&&(e.additionalProperties==null||e.additionalProperties===!1)){let T=El(x[0],t,r,n,i,a,s,l);return jMe(T,g,s,m)}return aSl({nameOverride:p,generatedName:h,title:y,breadcrumbs:i,properties:e.properties??{},description:g,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:x,context:n,propertiesToExclude:c,namespace:s,groupName:m,fullExamples:_,additionalProperties:e.additionalProperties,availability:b,encoding:o,source:a,minProperties:e.minProperties,maxProperties:e.maxProperties})}if(e.type==="object"&&waA(e)&&fSl(e)&&QJn(e))return Das({nameOverride:p,generatedName:h,title:y,description:g,availability:b,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${h}Key`,title:void 0,description:void 0,availability:void 0,schema:Yo.string({default:Dfr(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:xMe({schema:e,logger:n.logger,fallback:u})}),namespace:s,groupName:m},valueSchema:Bn.unknown({nameOverride:void 0,generatedName:`${h}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:s,groupName:m}),namespace:s,groupName:m,encoding:o,example:e.example,minProperties:e.minProperties,maxProperties:e.maxProperties});e.type!=null&&n.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${i.join("->")}. Coercing to unknown.`);let P=e.example??e.default,I=Bn.unknown({nameOverride:p,generatedName:h,title:y,description:g,availability:b,namespace:s,groupName:m,example:P});return r&&(I=Bn.nullable({availability:b,namespace:s,groupName:m,description:g,generatedName:h,inline:void 0,nameOverride:p,title:y,value:I})),t&&(I=Bn.optional({availability:b,namespace:s,groupName:m,description:g,generatedName:h,inline:void 0,nameOverride:p,title:y,value:I})),I}catch(P){return n.logger.debug(`Error converting schema: ${P.message}
1529
1529
  Location: ${i.join("-> ")}`),Bn.unknown({nameOverride:p,generatedName:h,title:y,description:g,availability:b,namespace:s,groupName:m,example:void 0})}}function OaA(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 Sgt(e){if(e.$ref.startsWith(tLt))return e.$ref.replace(tLt,"")}function Fas(e,t,r,n,i){let o=ni(e,wi.TYPE_NAME),a=GC(t,n),s=e.description,c=tq(e),l=Sgt(e);if(l==null)throw new Error(`Invalid schema reference ${JSON.stringify(e)}`);return Pc.reference({generatedName:a,nameOverride:o,title:void 0,schema:l,description:s??void 0,availability:c,namespace:i.getNamespace(l),groupName:void 0,source:r})}function waA(e){return e.oneOf==null||e.oneOf.length===0}function fSl(e){return e.allOf==null||e.allOf.length===0}function QJn(e){return e.properties==null||qO(e.properties)===0}function VJn(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function jMe(e,t,r,n){if(e.type==="reference")return Bn.reference({...e,description:t,availability:e.availability,namespace:r,groupName:n});if(e.type==="optional"){let i=jMe(e.value,t,r,n);return Bn.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=jMe(e.value,t,r,n);return Bn.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 Bn.primitive({...e,description:t});return e}function qJn(e){return fo(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>qJn(t)):e.oneOf!=null?e.oneOf.every(t=>qJn(t)):e.anyOf!=null?e.anyOf.every(t=>qJn(t)):!1}function dSl({literal:e,wrapAsOptional:t,wrapAsNullable:r,namespace:n,groupName:i,description:o,availability:a,nameOverride:s,generatedName:c,title:l}){let u=Bn.literal({nameOverride:s,generatedName:c,title:l,value:e,namespace:n,groupName:i,description:o,availability:a});return r&&(u=Bn.nullable({nameOverride:s,generatedName:c,title:l,value:u,namespace:n,groupName:i,description:o,availability:a,inline:void 0})),t&&(u=Bn.optional({nameOverride:s,generatedName:c,title:l,value:u,namespace:n,groupName:i,description:o,availability:a,inline:void 0})),u}function rq({primitive:e,wrapAsOptional:t,wrapAsNullable:r,namespace:n,groupName:i,description:o,availability:a,generatedName:s,nameOverride:c,title:l}){i=typeof i=="string"?[i]:i;let u=Bn.primitive({nameOverride:c,generatedName:s,title:l,schema:e,description:o,availability:a,namespace:n,groupName:i});return r&&(u=Bn.nullable({nameOverride:c,generatedName:s,title:l,value:u,namespace:n,groupName:i,description:o,availability:a,inline:void 0})),t&&(u=Bn.optional({nameOverride:c,generatedName:s,title:l,value:u,namespace:n,groupName:i,description:o,availability:a,inline:void 0})),u}function PaA({schemas:e}){let t=new Set;for(let r of e){if(fo(r))return;if(r.enum!=null&&VJn(r.enum))r.enum.forEach(n=>t.add(n));else return}return Array.from(t)}function mSl({schemas:e,context:t}){let r={};for(let n of e){let i=gSl({schema:n,context:t});for(let[o,a]of Object.entries(i)){let s=r[o];s!=null?s[a]=n:r[o]={[a]:n}}}for(let[n,i]of Object.entries(r))if(Object.keys(i).length===e.length)return{discriminant:n,schemas:i}}function gSl({schema:e,context:t}){let r=fo(e)?t.resolveSchemaReference(e):e;return EaA({schema:r,context:t})}function EaA({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let n of e.anyOf){let i=gSl({schema:n,context:t});for(let[o,a]of Object.entries(i??{}))r[o]=a}return r}for(let[n,i]of Object.entries(e.properties??{})){let o=fo(i)?t.resolveSchemaReference(i):i;o.type==="string"&&o.enum!=null&&VJn(o.enum)&&IaA(o.enum).length===1&&o.enum[0]!=null&&(r[n]=o.enum[0]);let a=bSl(o,"const");o.type==="string"&&a!=null&&(r[n]=a),n==="type"&&o.example!=null&&(r[n]=o.example)}return r}function IaA(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 bSl(e,t){let r=e[t];if(r!=null)return r}function xaA({schema:e,logger:t}){let r=HCl({schema:e,logger:t});if(r!=null)return tSl(r)}var Tfr=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(tLt))throw new Error(`Failed to resolve schema reference: ${t.$ref}`);let n=t.$ref.substring(tLt.length).split("/"),i=this.document.components;if(i==null||i.schemas==null)throw new Error("Document does not have components.schemas.");let[o,a,s]=n;if(o==null||o==="")throw new Error(`${t.$ref} cannot be resolved. No schema key provided.`);let c=i.schemas[o];if(c==null)throw new Error(`Schema "${o}" is undefined in document.components.schemas.`);if(fo(c)&&(c=this.resolveSchemaReference(c)),a==="properties"&&s!=null){let l=c.properties?.[s];if(l==null)throw new Error(`Property "${s}" not found on "${o}". Full ref: ${t.$ref}`);fo(l)?c=this.resolveSchemaReference(l):c=l}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 UJn=class extends Tfr{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 Error(`Failed to resolve message reference: ${t.$ref} in v2 components`);let i=t.$ref.substring(r.length),o=n.messages[i];if(o==null)throw new Error(`${t.$ref} is undefined`);return o}};function Rfr(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 a=o.namespace;n[a]??={},n[a][i]=o;continue}case"oneOf":case"unknown":r[i]=o;continue;default:qe(o)}return{rootSchemas:r,namespacedSchemas:n}}var Ffr=We(require("fs"),1),rLt=We(require("path"),1);function Dgt(e){if(typeof e=="string")return Al.primitive(Ga.string(e));if(typeof e=="number")return Number.isInteger(e)?Al.primitive(Ga.int(e)):Al.primitive(Ga.double(e));if(typeof e=="boolean")return Al.primitive(Ga.boolean(e));if(Array.isArray(e)){let t=e.map(r=>Dgt(r));return t.length===0?void 0:Al.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=Dgt(n);i!=null&&t.push({key:Ga.string(r),value:i})}return Al.map(t)}}function tXr(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function ASl(e){if(e!=null&&Array.isArray(e))return e}var Tgt=class{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:a,skipReadonly:s}){switch(n.type){case"enum":return typeof r=="string"&&_Sl({schema:n,value:r})?Al.enum(r):n.values[0]!=null?Al.enum(n.values[0]?.value):void 0;case"literal":return Al.literal(n.value);case"nullable":{if(r===null)return Al.null({});if(r==null&&!this.hasExample(n.value,0,o,a)&&this.exceedsMaxDepth(i,a))return Al.null({});let c=this.buildExampleHelper({schema:n.value,visitedSchemaIds:o,exampleId:t,example:r,depth:i,options:a,skipReadonly:s});return c??Al.null({})}case"optional":{if(r==null&&!this.hasExample(n.value,0,o,a)&&(a.ignoreOptionals||this.exceedsMaxDepth(i,a))||Object.is(r,null))return;let c=this.buildExampleHelper({schema:n.value,visitedSchemaIds:o,exampleId:t,example:r,depth:i,options:a,skipReadonly:s});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:a});return Al.primitive(c)}case"reference":{let c=this.schemas[n.schema];if(c!=null&&!o.has(n.schema)){o.add(n.schema);let l=c?.type==="object"&&!this.nonRequestReferencedSchemas.has(n.schema),u=this.buildExampleHelper({example:r,schema:c,exampleId:t,visitedSchemaIds:o,depth:i,options:a,skipReadonly:l||this.context.options.respectReadonlySchemas?s:!1});return o.delete(n.schema),u}return}case"oneOf":switch(n.value.type){case"discriminated":{let c={},l={},u={},p=tXr(r),d=p?.[n.value.discriminantProperty],m=n.value.schemas[d],h=[],y=this.getDiscriminatedUnionVariantSchema(n.value,p);y!=null&&h.push(y),h.push(...Object.entries(n.value.schemas));for(let g of h)if(d!=null&&m!=null&&m.type==="object"){l=this.getAllProperties(m),u=this.getAllRequiredProperties(m),c[n.value.discriminantProperty]=Al.primitive(Ga.string(d));break}else{let b=this.buildExampleHelper({exampleId:t,schema:g[1],example:void 0,visitedSchemaIds:o,depth:i,options:a,skipReadonly:s});if(b!=null){this.mergeExampleWith(b,c),c[n.value.discriminantProperty]=Al.primitive(Ga.string(g[0]));break}}for(let g of n.value.commonProperties){l[g.key]={schema:g.schema,readonly:!1};let b=this.getResolvedSchema(g.schema);b.type!=="optional"&&b.type!=="nullable"&&(u[g.key]=g.schema)}for(let[g,b]of Object.entries(l)){let _=g in u;if(_&&p?.[g]!=null){let O=this.buildExampleHelper({schema:b.schema,exampleId:t,example:p[g],visitedSchemaIds:o,depth:i+1,options:a,skipReadonly:s});if(O!=null)c[g]=O;else return}else{let O=this.buildExampleHelper({exampleId:t,schema:b.schema,example:p?.[g],visitedSchemaIds:o,depth:i+1,options:a,skipReadonly:s});if(O!=null)c[g]=O;else if(_)return}}return Al.oneOf(ggt.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:a,skipReadonly:s});break}}return;case"unknown":if(r!=null){let c=Dgt(r);if(c!=null)return Al.unknown(c)}return a.ignoreOptionals||this.exceedsMaxDepth(i,a)?void 0:a.isParameter?Al.primitive(Ga.string(a.name??"string")):Al.map([{key:Ga.string("key"),value:Al.primitive(Ga.string("value"))}]);case"array":{let c=ASl(r),l=[];if(c!=null&&c.length>0)for(let u of c){let p=this.buildExampleHelper({exampleId:t,example:u,schema:n.value,depth:i+1,visitedSchemaIds:o,options:a,skipReadonly:s});p!=null&&l.push(p)}else if(n.example!=null&&n.example.length>0)for(let u of n.example){let p=this.buildExampleHelper({exampleId:t,example:u,schema:n.value,depth:i+1,visitedSchemaIds:o,options:a,skipReadonly:s});p!=null&&l.push(p)}else{let u=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,depth:i+1,visitedSchemaIds:o,options:a,skipReadonly:s});u!=null&&l.push(u)}return Al.array(l)}case"map":{let c=tXr(r??n.example);if(c!=null&&Object.entries(c).length>0){let p=[];for(let[d,m]of Object.entries(c)){let h=this.buildExampleFromPrimitive({schema:n.key.schema,example:d,options:a}),y=this.buildExampleHelper({exampleId:t,example:m,schema:n.value,visitedSchemaIds:o,depth:i+1,options:a,skipReadonly:s});y!=null&&p.push({key:h,value:y})}return Al.map(p)}if(n.key.schema.type==="string"&&n.value.type==="unknown")return Al.map([{key:Ga.string("key"),value:Al.unknown(Al.primitive(Ga.string("value")))}]);let l=this.buildExampleFromPrimitive({schema:n.key.schema,example:void 0,options:{...a,name:"key"}}),u=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,visitedSchemaIds:o,depth:i+1,options:{...a,name:"value"},skipReadonly:s});return u!=null&&u.type!=="null"?Al.map([{key:l,value:u}]):Al.map([])}case"object":{let c={},l=n.fullExamples?.find(m=>m.name===t)??n.fullExamples?.find(m=>m.name==null)??n.fullExamples?.[0],u=tXr(r)??(l!=null?tXr(l.value):{})??{},p=this.getAllProperties(n),d=this.getAllRequiredProperties(n);for(let[m,h]of Object.entries(p)){if(s&&h.readonly||h.schema._visit({optional:v=>typeof v.availability=="string"&&v.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 y=m in d,g=Object.keys(u).includes(m),b=u[m],_=this.getSchemaExample(h.schema),O=g?b:_,A=this.buildExampleHelper({schema:h.schema,exampleId:t,example:O,visitedSchemaIds:o,depth:i+1,options:{...a,name:m},skipReadonly:s});if(y&&A!=null)c[m]=A;else{if(y)return;(g&&A!=null||!a.ignoreOptionals&&A!=null)&&(c[m]=A)}}if(n.additionalProperties){for(let[m,h]of Object.entries(u))if(!(m in c)){let y=this.buildExampleHelper({schema:Bn.unknown({example:h,title:void 0,availability:void 0,description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0}),exampleId:t,example:h,visitedSchemaIds:o,depth:i+1,options:{...a,name:m},skipReadonly:s});y!=null&&(c[m]=y)}}return Al.object({properties:c})}default:qe(n)}}mergeExampleWith(t,r){t._visit({array:Rt,enum:Rt,literal:Rt,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:Rt,unknown:Rt,null:Rt,_other:Rt})}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(s=>this.hasExample(s,0,new Set,{ignoreOptionals:!1,isParameter:!1}));if(o!=null)return o;let a=t.schemas.find(s=>this.hasInherentExample(s));return a??t.schemas[0]}return t.schemas.map(o=>({schema:o,heuristic:this.calcExampleHeuristic(o,r)})).sort((o,a)=>a.heuristic-o.heuristic)[0]?.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return _Sl({schema:t,value:r})?5:0;case"object":{if(!il(r))return 0;let n=this.getAllProperties(t),i=0;for(let[o,a]of Object.entries(n))r[o]!=null?(i++,i+=this.calcExampleHeuristic(a.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(!il(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",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 a of t.properties)if(this.hasExample(a.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 a=this.hasExample(o,r,n,i);return n.delete(t.schema),a}return!1}case"unknown":return t.example!=null;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){let i=this.getResolvedSchema(n.schema);i.type!=="optional"&&i.type!=="nullable"&&(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 Error(`Unexpected error: Failed to resolve schema reference: ${t.schema}`);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"?Ga.string(t):r.example!=null?Ga.string(r.example):Ga.string(n.name??Wo.STRING);case"base64":return t!=null&&typeof t=="string"?Ga.base64(t):r.example!=null?Ga.base64(r.example):Ga.base64(Wo.BASE64);case"boolean":return t!=null&&typeof t=="boolean"?Ga.boolean(t):r.example!=null?Ga.boolean(r.example):Ga.boolean(Wo.BOOLEAN);case"date":return t!=null&&typeof t=="string"?Ga.date(t):r.example!=null?Ga.date(r.example):Ga.date(Wo.DATE);case"datetime":return t!=null&&typeof t=="string"?Ga.datetime(t):r.example!=null?Ga.datetime(r.example):Ga.datetime(Wo.DATE_TIME);case"double":return t!=null&&typeof t=="number"?Ga.double(t):r.example!=null?Ga.double(r.example):Ga.double(Wo.DOUBLE);case"float":return t!=null&&typeof t=="number"?Ga.float(t):r.example!=null?Ga.float(r.example):Ga.float(Wo.FLOAT);case"int":return t!=null&&typeof t=="number"?Ga.int(t):r.example!=null?Ga.int(r.example):Ga.int(Wo.INT);case"int64":return t!=null&&typeof t=="number"?Ga.int64(t):r.example!=null?Ga.int64(r.example):Ga.int64(Wo.INT64);case"uint":return t!=null&&typeof t=="number"?Ga.uint(t):r.example!=null?Ga.uint(r.example):Ga.uint(Wo.UINT);case"uint64":return t!=null&&typeof t=="number"?Ga.uint64(t):r.example!=null?Ga.uint64(r.example):Ga.uint64(Wo.UINT64);default:qe(r)}}};function _Sl({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}function Fxe(e){switch(e.type){case"object":return Bn.object({allOf:e.allOf,properties:e.properties.map(t=>CaA(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,source:e.source,inline:void 0,minProperties:e.minProperties,maxProperties:e.maxProperties});case"array":return Bn.array({description:e.description,availability:e.availability,value:Fxe(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});case"enum":return Bn.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 Bn.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 Bn.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:Fxe(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"optional":return Bn.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:Fxe(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"primitive":return Bn.primitive({description:e.description,availability:e.availability,schema:vSl(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Bn.map({description:e.description,availability:e.availability,key:Bn.primitive({description:e.key.description,availability:e.key.availability,schema:vSl(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,namespace:e.namespace,groupName:e.groupName}),value:Fxe(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 Bn.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 Bn.oneOf(jaA(e.value));case"unknown":return Bn.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:void 0,example:void 0,namespace:void 0,groupName:void 0,description:void 0,availability:void 0});default:qe(e)}}function jaA(e){switch(e.type){case"discriminated":return KJ.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:Fxe(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,discriminantPropertyNameOverride:e.discriminantPropertyNameOverride,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,Fxe(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});case"undiscriminated":return KJ.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:e.schemas.map(t=>Fxe(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});default:qe(e)}}function vSl(e){switch(e.type){case"string":return Yo.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return Yo.base64({example:void 0});case"boolean":return Yo.boolean({default:e.default,example:void 0});case"date":return Yo.date({example:void 0});case"datetime":return Yo.datetime({example:void 0});case"double":return Yo.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 Yo.float({example:void 0});case"int":return Yo.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 Yo.int64({default:e.default,example:void 0});case"uint":return Yo.uint({default:void 0,example:void 0});case"uint64":return Yo.uint64({default:void 0,example:void 0});default:qe(e)}}function CaA(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:Fxe(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function LJn(e){return e.type!=="optional"&&e.type!=="nullable"}function Mas(e){return e==="POST"||e==="PUT"||e==="PATCH"}function rXr(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 WJn=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 Tgt(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,a=rLt.dirname(o),s=a;for(;s!==rLt.dirname(s);){let c=rLt.join(s,"fern");if(Ffr.existsSync(c)&&Ffr.statSync(c).isDirectory()){t=c;break}s=rLt.dirname(s)}t||(t=a)}else t=process.cwd();let r=t??process.cwd(),n=rLt.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 a=[];if(a.push(`${o.method} ${o.endpoint} - ${o.type.toUpperCase()} (${o.schemaType}): ${o.reason}`),o.operationSummary&&a.push(` Operation: ${o.operationSummary}`),o.operationDescription&&o.operationDescription!==o.operationSummary&&a.push(` Description: ${o.operationDescription}`),o.schemaDescription&&a.push(` ${o.type==="request"?"Request":"Response"} Schema: ${o.schemaDescription}`),o.autoGeneratedExample){a.push(" Auto-generated example:");let c=JSON.stringify(o.autoGeneratedExample,null,4).split(`
1530
1530
  `).map(l=>` ${l}`).join(`
@@ -1535,7 +1535,7 @@ ${r}`);return i!=null?i(a):a},Cvl(n))}var Jts=class{async handle(t,r){let n=r["d
1535
1535
  `){return e.split(r).reduce((n,i)=>{let o=t?i.trim():i;return o&&n.push(o),n},[])}function Dds(e,t){return MZr(e,!0).map(r=>t(r))}function Tds(e){return(0,Vei.exists)(e,Vei.FOLDER)}function Fv(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function N4l(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function kei(e,t){if(Array.isArray(e)){let r=e.indexOf(t);r>=0&&e.splice(r,1)}else e.delete(t);return t}function UMe(e){return Array.isArray(e)?e:[e]}function M4l(e){return e.replace(/[\s-]+(.)/g,(t,r)=>r.toUpperCase())}function rmr(e){return UMe(e).map(t=>t instanceof String?t:String(t))}function HP(e,t=0){if(e==null)return t;let r=parseInt(e,10);return Number.isNaN(r)?t:r}function TZr(e,t){let r=[];for(let n=0,i=e.length;n<i;n++)r.push(t,e[n]);return r}function RZr(e){return(Array.isArray(e)?S4l.Buffer.concat(e):e).toString("utf-8")}function z4l(e,t){let r={};return t.forEach(n=>{e[n]!==void 0&&(r[n]=e[n])}),r}function yds(e=0){return new Promise(t=>setTimeout(t,e))}function gds(e){if(e!==!1)return e}var emr,$Lt,zZr,Uei=pa({"src/lib/utils/util.ts"(){"use strict";Rds(),emr="\0",$Lt=()=>{},zZr=Object.prototype.toString.call.bind(Object.prototype.toString)}});function aK(e,t,r){return t(e)?e:arguments.length>2?r:void 0}function bds(e,t){let r=Fei(e)?"string":typeof e;return/number|string|boolean/.test(r)&&(!t||!t.includes(r))}function Lei(e){return!!e&&zZr(e)==="[object Object]"}function Q4l(e){return typeof e=="function"}var QZr,q4l,RR,Nei,Wei,Rds=pa({"src/lib/utils/argument-filters.ts"(){"use strict";FZr(),Uei(),QZr=e=>Array.isArray(e),q4l=e=>typeof e=="number",RR=e=>typeof e=="string",Nei=e=>RR(e)||Array.isArray(e)&&e.every(RR),Wei=e=>e==null||"number|boolean|function".includes(typeof e)?!1:typeof e.length=="number"}}),Ads,ANA=pa({"src/lib/utils/exit-codes.ts"(){"use strict";Ads=(e=>(e[e.SUCCESS=0]="SUCCESS",e[e.ERROR=1]="ERROR",e[e.NOT_FOUND=-2]="NOT_FOUND",e[e.UNCLEAN=128]="UNCLEAN",e))(Ads||{})}}),Mei,_NA=pa({"src/lib/utils/git-output-streams.ts"(){"use strict";Mei=class V4l{constructor(t,r){this.stdOut=t,this.stdErr=r}asStrings(){return new V4l(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function vNA(){throw new Error("LineParser:useMatches not implemented")}var rm,fbt,ONA=pa({"src/lib/utils/line-parser.ts"(){"use strict";rm=class{constructor(e,t){this.matches=[],this.useMatches=vNA,this.parse=(r,n)=>(this.resetMatches(),this._regExp.every((i,o)=>this.addMatch(i,o,r(o)))?this.useMatches(n,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,r){let n=r&&e.exec(r);return n&&this.pushMatch(t,n),!!n}pushMatch(e,t){this.matches.push(...t.slice(1))}},fbt=class extends rm{addMatch(e,t,r){return/^remote:\s/.test(String(r))&&super.addMatch(e,t,r)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}});function k4l(...e){let t=process.cwd(),r=Object.assign({baseDir:t,...U4l},...e.filter(n=>typeof n=="object"&&n));return r.baseDir=r.baseDir||t,r.trimmed=r.trimmed===!0,r}var U4l,wNA=pa({"src/lib/utils/simple-git-options.ts"(){"use strict";U4l={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Fds(e,t=[]){return Lei(e)?Object.keys(e).reduce((r,n)=>{let i=e[n];if(Fei(i))r.push(i);else if(bds(i,["boolean"]))r.push(n+"="+i);else if(Array.isArray(i))for(let o of i)bds(o,["string","number"])||r.push(n+"="+o);else r.push(n);return r},t):t}function L5(e,t=0,r=!1){let n=[];for(let i=0,o=t<0?e.length:t;i<o;i++)"string|number".includes(typeof e[i])&&n.push(String(e[i]));return Fds(Nds(e),n),r||n.push(...PNA(e)),n}function PNA(e){let t=typeof HLt(e)=="function";return rmr(aK(HLt(e,t?1:0),QZr,[]))}function Nds(e){let t=Q4l(HLt(e));return aK(HLt(e,t?1:0),Lei)}function Wj(e,t=!0){let r=B4l(HLt(e));return t||D4l(r)?r:void 0}var ENA=pa({"src/lib/utils/task-options.ts"(){"use strict";Rds(),Uei(),FZr()}});function _ds(e,t){return e(t.stdOut,t.stdErr)}function G5(e,t,r,n=!0){return UMe(r).forEach(i=>{for(let o=MZr(i,n),a=0,s=o.length;a<s;a++){let c=(l=0)=>{if(!(a+l>=s))return o[a+l]};t.some(({parse:l})=>l(c,e))}}),e}var INA=pa({"src/lib/utils/task-parser.ts"(){"use strict";Uei()}}),L4l={};YC(L4l,{ExitCodes:()=>Ads,GitOutputStreams:()=>Mei,LineParser:()=>rm,NOOP:()=>$Lt,NULL:()=>emr,RemoteLineParser:()=>fbt,append:()=>Fv,appendTaskOptions:()=>Fds,asArray:()=>UMe,asCamelCase:()=>M4l,asFunction:()=>B4l,asNumber:()=>HP,asStringArray:()=>rmr,bufferToString:()=>RZr,callTaskParser:()=>_ds,createInstanceConfig:()=>k4l,delay:()=>yds,filterArray:()=>QZr,filterFunction:()=>Q4l,filterHasLength:()=>Wei,filterNumber:()=>q4l,filterPlainObject:()=>Lei,filterPrimitives:()=>bds,filterString:()=>RR,filterStringOrStringArray:()=>Nei,filterType:()=>aK,first:()=>R4l,folderExists:()=>Tds,forEachLineWithContent:()=>Dds,getTrailingOptions:()=>L5,including:()=>N4l,isUserFunction:()=>D4l,last:()=>HLt,objectToString:()=>zZr,orVoid:()=>gds,parseStringResponse:()=>G5,pick:()=>z4l,prefixedArray:()=>TZr,remove:()=>kei,splitOn:()=>T4l,toLinesWithContent:()=>MZr,trailingFunctionArgument:()=>Wj,trailingOptionsArgument:()=>Nds});var Sf=pa({"src/lib/utils/index.ts"(){"use strict";Rds(),ANA(),_NA(),ONA(),wNA(),ENA(),INA(),Uei()}}),W4l={};YC(W4l,{CheckRepoActions:()=>vds,checkIsBareRepoTask:()=>H4l,checkIsRepoRootTask:()=>G4l,checkIsRepoTask:()=>xNA});function xNA(e){switch(e){case"bare":return H4l();case"root":return G4l()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:Gei,parser:Mds}}function G4l(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:Gei,parser(t){return/^\.(git)?$/.test(t.trim())}}}function H4l(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:Gei,parser:Mds}}function jNA(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}var vds,Gei,Mds,$4l=pa({"src/lib/tasks/check-is-repo.ts"(){"use strict";Sf(),vds=(e=>(e.BARE="bare",e.IN_TREE="tree",e.IS_REPO_ROOT="root",e))(vds||{}),Gei=({exitCode:e},t,r,n)=>{if(e===128&&jNA(t))return r(Buffer.from("false"));n(t)},Mds=e=>e.trim()==="true"}});function CNA(e,t){let r=new J4l(e),n=e?Y4l:K4l;return MZr(t).forEach(i=>{let o=i.replace(n,"");r.paths.push(o),(X4l.test(o)?r.folders:r.files).push(o)}),r}var J4l,K4l,Y4l,X4l,SNA=pa({"src/lib/responses/CleanSummary.ts"(){"use strict";Sf(),J4l=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},K4l=/^[a-z]+\s*/i,Y4l=/^[a-z]+\s+[a-z]+\s*/i,X4l=/\/$/}}),Ods={};YC(Ods,{EMPTY_COMMANDS:()=>Hei,adhocExecTask:()=>Z4l,configurationErrorTask:()=>W5,isBufferTask:()=>t2l,isEmptyTask:()=>r2l,straightThroughBufferTask:()=>e2l,straightThroughStringTask:()=>LU});function Z4l(e){return{commands:Hei,format:"empty",parser:e}}function W5(e){return{commands:Hei,format:"empty",parser(){throw typeof e=="string"?new j4l(e):e}}}function LU(e,t=!1){return{commands:e,format:"utf-8",parser(r){return t?String(r).trim():r}}}function e2l(e){return{commands:e,format:"buffer",parser(t){return t}}}function t2l(e){return e.format==="buffer"}function r2l(e){return e.format==="empty"||!e.commands.length}var Hei,KC=pa({"src/lib/tasks/task.ts"(){"use strict";C4l(),Hei=[]}}),n2l={};YC(n2l,{CONFIG_ERROR_INTERACTIVE_MODE:()=>zds,CONFIG_ERROR_MODE_REQUIRED:()=>Qds,CONFIG_ERROR_UNKNOWN_OPTION:()=>qds,CleanOptions:()=>Bei,cleanTask:()=>i2l,cleanWithOptionsTask:()=>BNA,isCleanOptionsArray:()=>DNA});function BNA(e,t){let{cleanMode:r,options:n,valid:i}=TNA(e);return r?i.options?(n.push(...t),n.some(NNA)?W5(zds):i2l(r,n)):W5(qds+JSON.stringify(e)):W5(Qds)}function i2l(e,t){return{commands:["clean",`-${e}`,...t],format:"utf-8",parser(n){return CNA(e==="n",n)}}}function DNA(e){return Array.isArray(e)&&e.every(t=>Vds.has(t))}function TNA(e){let t,r=[],n={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,"").split("").forEach(i=>{RNA(i)?(t=i,n.cleanMode=!0):n.options=n.options&&FNA(r[r.length]=`-${i}`)}),{cleanMode:t,options:r,valid:n}}function RNA(e){return e==="f"||e==="n"}function FNA(e){return/^-[a-z]$/i.test(e)&&Vds.has(e.charAt(1))}function NNA(e){return/^-[^\-]/.test(e)?e.indexOf("i")>0:e==="--interactive"}var zds,Qds,qds,Bei,Vds,o2l=pa({"src/lib/tasks/clean.ts"(){"use strict";SNA(),Sf(),KC(),zds="Git clean interactive mode is not supported",Qds='Git clean mode parameter ("n" or "f") is required',qds="Git clean unknown option found in: ",Bei=(e=>(e.DRY_RUN="n",e.FORCE="f",e.IGNORED_INCLUDED="x",e.IGNORED_ONLY="X",e.EXCLUDING="e",e.QUIET="q",e.RECURSIVE="d",e))(Bei||{}),Vds=new Set(["i",...rmr(Object.values(Bei))])}});function MNA(e){let t=new s2l;for(let r of a2l(e))t.addValue(r.file,String(r.key),r.value);return t}function zNA(e,t){let r=null,n=[],i=new Map;for(let o of a2l(e,t))o.key===t&&(n.push(r=o.value),i.has(o.file)||i.set(o.file,[]),i.get(o.file).push(r));return{key:t,paths:Array.from(i.keys()),scopes:i,value:r,values:n}}function QNA(e){return e.replace(/^(file):/,"")}function*a2l(e,t=null){let r=e.split("\0");for(let n=0,i=r.length-1;n<i;){let o=QNA(r[n++]),a=r[n++],s=t;if(a.includes(`
1536
1536
  `)){let c=T4l(a,`
1537
1537
  `);s=c[0],a=c[1]}yield{file:o,key:s,value:a}}}var s2l,qNA=pa({"src/lib/responses/ConfigList.ts"(){"use strict";Sf(),s2l=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{})),this._all}addFile(e){if(!(e in this.values)){let t=HLt(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,r){let n=this.addFile(e);Object.hasOwn(n,t)?Array.isArray(n[t])?n[t].push(r):n[t]=[n[t],r]:n[t]=r,this._all=void 0}}}});function lds(e,t){return typeof e=="string"&&Object.hasOwn(wds,e)?e:t}function VNA(e,t,r,n){let i=["config",`--${n}`];return r&&i.push("--add"),i.push(e,t),{commands:i,format:"utf-8",parser(o){return o}}}function kNA(e,t){let r=["config","--null","--show-origin","--get-all",e];return t&&r.splice(1,0,`--${t}`),{commands:r,format:"utf-8",parser(n){return zNA(n,e)}}}function UNA(e){let t=["config","--list","--show-origin","--null"];return e&&t.push(`--${e}`),{commands:t,format:"utf-8",parser(r){return MNA(r)}}}function LNA(){return{addConfig(e,t,...r){return this._runTask(VNA(e,t,r[0]===!0,lds(r[1],"local")),Wj(arguments))},getConfig(e,t){return this._runTask(kNA(e,lds(t,void 0)),Wj(arguments))},listConfig(...e){return this._runTask(UNA(lds(e[0],void 0)),Wj(arguments))}}}var wds,u2l=pa({"src/lib/tasks/config.ts"(){"use strict";qNA(),Sf(),wds=(e=>(e.system="system",e.global="global",e.local="local",e.worktree="worktree",e))(wds||{})}});function WNA(e){return c2l.has(e)}var pds,c2l,l2l=pa({"src/lib/tasks/diff-name-status.ts"(){"use strict";pds=(e=>(e.ADDED="A",e.COPIED="C",e.DELETED="D",e.MODIFIED="M",e.RENAMED="R",e.CHANGED="T",e.UNMERGED="U",e.UNKNOWN="X",e.BROKEN="B",e))(pds||{}),c2l=new Set(Object.values(pds))}});function GNA(...e){return new f2l().param(...e)}function HNA(e){let t=new Set,r={};return Dds(e,n=>{let[i,o,a]=n.split(emr);t.add(i),(r[i]=r[i]||[]).push({line:HP(o),path:i,preview:a})}),{paths:t,results:r}}function $NA(){return{grep(e){let t=Wj(arguments),r=L5(arguments);for(let i of p2l)if(r.includes(i))return this._runTask(W5(`git.grep: use of "${i}" is not supported.`),t);typeof e=="string"&&(e=GNA().param(e));let n=["grep","--null","-n","--full-name",...r,...e];return this._runTask({commands:n,format:"utf-8",parser(i){return HNA(i)}},t)}}}var p2l,DZr,XUl,f2l,d2l=pa({"src/lib/tasks/grep.ts"(){"use strict";Sf(),KC(),p2l=["-h"],DZr=Symbol("grepQuery"),f2l=class{constructor(){this[XUl]=[]}*[(XUl=DZr,Symbol.iterator)](){for(let e of this[DZr])yield e}and(...e){return e.length&&this[DZr].push("--and","(",...TZr(e,"-e"),")"),this}param(...e){return this[DZr].push(...TZr(e,"-e")),this}}}}),m2l={};YC(m2l,{ResetMode:()=>Dei,getResetMode:()=>KNA,resetTask:()=>JNA});function JNA(e,t){let r=["reset"];return h2l(e)&&r.push(`--${e}`),r.push(...t),LU(r)}function KNA(e){if(h2l(e))return e;switch(typeof e){case"string":case"undefined":return"soft"}}function h2l(e){return typeof e=="string"&&y2l.includes(e)}var Dei,y2l,g2l=pa({"src/lib/tasks/reset.ts"(){"use strict";Sf(),KC(),Dei=(e=>(e.MIXED="mixed",e.SOFT="soft",e.HARD="hard",e.MERGE="merge",e.KEEP="keep",e))(Dei||{}),y2l=rmr(Object.values(Dei))}});function YNA(){return(0,zei.default)("simple-git")}function ZUl(e,t,r){return!t||!String(t).replace(/\s*/,"")?r?(n,...i)=>{e(n,...i),r(n,...i)}:e:(n,...i)=>{e(`%s ${n}`,t,...i),r&&r(n,...i)}}function XNA(e,t,{namespace:r}){if(typeof e=="string")return e;let n=t&&t.namespace||"";return n.startsWith(r)?n.substr(r.length+1):n||r}function kds(e,t,r,n=YNA()){let i=e&&`[${e}]`||"",o=[],a=typeof t=="string"?n.extend(t):t,s=XNA(aK(t,RR),a,n);return l(r);function c(u,p){return Fv(o,kds(e,s.replace(/^[^:]+/,u),p,n))}function l(u){let p=u&&`[${u}]`||"",d=a&&ZUl(a,p)||$Lt,m=ZUl(n,`${i} ${p}`,d);return Object.assign(a?d:m,{label:e,sibling:c,info:m,step:l})}}var b2l=pa({"src/lib/git-logger.ts"(){"use strict";Sf(),zei.default.formatters.L=e=>String(Wei(e)?e.length:"-"),zei.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString("utf8"):zZr(e)}}),A2l,ZNA=pa({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";dbt(),b2l(),A2l=class Pds{constructor(t="GitExecutor"){this.logLabel=t,this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){let r=Pds.getName(t.commands[0]),n=kds(this.logLabel,r);return{task:t,logger:n,name:r}}push(t){let r=this.createProgress(t);return r.logger("Adding task to the queue, commands = %o",t.commands),this._queue.set(t,r),r}fatal(t){for(let[r,{logger:n}]of Array.from(this._queue.entries()))r===t.task?(n.info("Failed %o",t),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",t.message),this.complete(r);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(t){this.withProgress(t)&&this._queue.delete(t)}attempt(t){let r=this.withProgress(t);if(!r)throw new Bat(void 0,"TasksPendingQueue: attempt called for an unknown task");return r.logger("Starting task"),r}static getName(t="empty"){return`task:${t}:${++Pds.counter}`}static{this.counter=0}}}});function GLt(e,t){return{method:R4l(e.commands)||"",commands:t}}function eMA(e,t){return r=>{t("[ERROR] child process exception %o",r),e.push(Buffer.from(String(r.stack),"ascii"))}}function e4l(e,t,r,n){return i=>{r("%s received %L bytes",t,i),n("%B",i),e.push(i)}}var Eds,tMA=pa({"src/lib/runners/git-executor-chain.ts"(){"use strict";dbt(),KC(),Sf(),ZNA(),Eds=class{constructor(e,t,r){this._executor=e,this._scheduler=t,this._plugins=r,this._chain=Promise.resolve(),this._queue=new A2l}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),r=()=>this._queue.complete(e);try{let{logger:n}=this._queue.attempt(e);return await(r2l(e)?this.attemptEmptyTask(e,n):this.attemptRemoteTask(e,n))}catch(n){throw this.onFatalException(e,n)}finally{r(),t()}}onFatalException(e,t){let r=t instanceof Bat?Object.assign(t,{task:e}):new Bat(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(r),r}async attemptRemoteTask(e,t){let r=this._plugins.exec("spawn.binary","",GLt(e,e.commands)),n=this._plugins.exec("spawn.args",[...e.commands],GLt(e,e.commands)),i=await this.gitResponse(e,r,n,this.outputHandler,t.step("SPAWN")),o=await this.handleTaskData(e,n,i,t.step("HANDLE"));return t("passing response to task's parser as a %s",e.format),t2l(e)?_ds(e.parser,o):_ds(e.parser,o.asStrings())}async attemptEmptyTask(e,t){return t("empty task bypassing child process to call to task's parser"),e.parser(this)}handleTaskData(e,t,r,n){let{exitCode:i,rejection:o,stdOut:a,stdErr:s}=r;return new Promise((c,l)=>{n("Preparing to handle process response exitCode=%d stdOut=",i);let{error:u}=this._plugins.exec("task.error",{error:o},{...GLt(e,t),...r});if(u&&e.onError)return n.info("exitCode=%s handling with custom error handler"),e.onError(r,u,p=>{n.info("custom error handler treated as success"),n("custom error returned a %s",zZr(p)),c(new Mei(Array.isArray(p)?Buffer.concat(p):p,Buffer.concat(s)))},l);if(u)return n.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,s.length,o),l(u);n.info("retrieving task output complete"),c(new Mei(Buffer.concat(a),Buffer.concat(s)))})}async gitResponse(e,t,r,n,i){let o=i.sibling("output"),a=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},GLt(e,e.commands));return new Promise(s=>{let c=[],l=[];i.info("%s %o",t,r),i("%O",a);let u=this._beforeSpawn(e,r);if(u)return s({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,{...GLt(e,r),kill(d){u=d||u}});let p=(0,_2l.spawn)(t,r,a);p.stdout.on("data",e4l(c,"stdOut",i,o.step("stdOut"))),p.stderr.on("data",e4l(l,"stdErr",i,o.step("stdErr"))),p.on("error",eMA(l,i)),n&&(i("Passing child process stdOut/stdErr to custom outputHandler"),n(t,p.stdout,p.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...GLt(e,r),spawned:p,close(d,m){s({stdOut:c,stdErr:l,exitCode:d,rejection:u||m})},kill(d){p.killed||(u=d,p.kill("SIGINT"))}})})}_beforeSpawn(e,t){let r;return this._plugins.exec("spawn.before",void 0,{...GLt(e,t),kill(n){r=n||r}}),r}}}}),v2l={};YC(v2l,{GitExecutor:()=>O2l});var O2l,rMA=pa({"src/lib/runners/git-executor.ts"(){"use strict";tMA(),O2l=class{constructor(e,t,r){this.cwd=e,this._scheduler=t,this._plugins=r,this._chain=new Eds(this,this._scheduler,this._plugins)}chain(){return new Eds(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function nMA(e,t,r=$Lt){let n=o=>{r(null,o)},i=o=>{o?.task===e&&r(o instanceof NZr?iMA(o):o,void 0)};t.then(n,i)}function iMA(e){let t=n=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${n} should be GitResponseError.git.${n}, this will no longer be available in version 3`),t=$Lt};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(r,{}));function r(n,i){return i in e||(n[i]={enumerable:!1,configurable:!1,get(){return t(i),e.git[i]}}),n}}var oMA=pa({"src/lib/task-callback.ts"(){"use strict";tmr(),Sf()}});function t4l(e,t){return Z4l(r=>{if(!Tds(e))throw new Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||r).cwd=e})}var aMA=pa({"src/lib/tasks/change-working-directory.ts"(){"use strict";Sf(),KC()}});function fds(e){let t=["checkout",...e];return t[1]==="-b"&&t.includes("-B")&&(t[1]=kei(t,"-B")),LU(t)}function sMA(){return{checkout(){return this._runTask(fds(L5(arguments,1)),Wj(arguments))},checkoutBranch(e,t){return this._runTask(fds(["-b",e,t,...L5(arguments)]),Wj(arguments))},checkoutLocalBranch(e){return this._runTask(fds(["-b",e,...L5(arguments)]),Wj(arguments))}}}var uMA=pa({"src/lib/tasks/checkout.ts"(){"use strict";Sf(),KC()}});function cMA(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function lMA(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(e){return G5(cMA(),[w2l],e)}})}}}var w2l,pMA=pa({"src/lib/tasks/count-objects.ts"(){"use strict";Sf(),w2l=new rm(/([a-z-]+): (\d+)$/,(e,[t,r])=>{let n=M4l(t);Object.hasOwn(e,n)&&(e[n]=HP(r))})}});function fMA(e){return G5({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},P2l,e)}var P2l,dMA=pa({"src/lib/parsers/parse-commit.ts"(){"use strict";Sf(),P2l=[new rm(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,r,n])=>{e.branch=t,e.commit=n,e.root=!!r}),new rm(/\s*Author:\s(.+)/i,(e,[t])=>{let r=t.split("<"),n=r.pop();!n||!n.includes("@")||(e.author={email:n.substr(0,n.length-1),name:r.join("<").trim()})}),new rm(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,r,n])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(r,10)||0,e.summary.deletions=parseInt(n,10)||0}),new rm(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,r,n])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(r,10)||0;n==="-"?e.summary.deletions=i:n==="+"&&(e.summary.insertions=i)})]}});function mMA(e,t,r){return{commands:["-c","core.abbrev=40","commit",...TZr(e,"-m"),...t,...r],format:"utf-8",parser:fMA}}function hMA(){return{commit(t,...r){let n=Wj(arguments),i=e(t)||mMA(UMe(t),UMe(aK(r[0],Nei,[])),[...rmr(aK(r[1],QZr,[])),...L5(arguments,0,!0)]);return this._runTask(i,n)}};function e(t){return!Nei(t)&&W5("git.commit: requires the commit message to be supplied as a string/string[]")}}var yMA=pa({"src/lib/tasks/commit.ts"(){"use strict";dMA(),Sf(),KC()}});function gMA(){return{firstCommit(){return this._runTask(LU(["rev-list","--max-parents=0","HEAD"],!0),Wj(arguments))}}}var bMA=pa({"src/lib/tasks/first-commit.ts"(){"use strict";Sf(),KC()}});function AMA(e,t){let r=["hash-object",e];return t&&r.push("-w"),LU(r,!0)}var _MA=pa({"src/lib/tasks/hash-object.ts"(){"use strict";KC()}});function vMA(e,t,r){let n=String(r).trim(),i;if(i=E2l.exec(n))return new Tei(e,t,!1,i[1]);if(i=I2l.exec(n))return new Tei(e,t,!0,i[1]);let o="",a=n.split(" ");for(;a.length;)if(a.shift()==="in"){o=a.join(" ");break}return new Tei(e,t,/^re/i.test(n),o)}var Tei,E2l,I2l,OMA=pa({"src/lib/responses/InitSummary.ts"(){"use strict";Tei=class{constructor(e,t,r,n){this.bare=e,this.path=t,this.existing=r,this.gitDir=n}},E2l=/^Init.+ repository in (.+)$/,I2l=/^Rein.+ in (.+)$/}});function wMA(e){return e.includes(Uds)}function PMA(e=!1,t,r){let n=["init",...r];return e&&!wMA(n)&&n.splice(1,0,Uds),{commands:n,format:"utf-8",parser(i){return vMA(n.includes("--bare"),t,i)}}}var Uds,EMA=pa({"src/lib/tasks/init.ts"(){"use strict";OMA(),Uds="--bare"}});function Lds(e){for(let t=0;t<e.length;t++){let r=Wds.exec(e[t]);if(r)return`--${r[1]}`}return""}function IMA(e){return Wds.test(e)}var Wds,qZr=pa({"src/lib/args/log-format.ts"(){"use strict";Wds=/^--(stat|numstat|name-only|name-status)(=|$)/}}),x2l,xMA=pa({"src/lib/responses/DiffSummary.ts"(){"use strict";x2l=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function j2l(e=""){let t=C2l[e];return r=>G5(new x2l,t,r,!1)}var dds,r4l,n4l,i4l,C2l,S2l=pa({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";qZr(),xMA(),l2l(),Sf(),dds=[new rm(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,r,n=""])=>{e.files.push({file:t.trim(),changes:HP(r),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new rm(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,r,n])=>{e.files.push({file:t.trim(),before:HP(r),after:HP(n),binary:!0})}),new rm(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,r])=>{let n=/(\d+) i/.exec(r),i=/(\d+) d/.exec(r);e.changed=HP(t),e.insertions=HP(n?.[1]),e.deletions=HP(i?.[1])})],r4l=[new rm(/(\d+)\t(\d+)\t(.+)$/,(e,[t,r,n])=>{let i=HP(t),o=HP(r);e.changed++,e.insertions+=i,e.deletions+=o,e.files.push({file:n,changes:i+o,insertions:i,deletions:o,binary:!1})}),new rm(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],n4l=[new rm(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],i4l=[new rm(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,r,n,i,o])=>{e.changed++,e.files.push({file:o??n,changes:0,insertions:0,deletions:0,binary:!1,status:gds(WNA(t)&&t),from:gds(!!o&&n!==o&&n),similarity:HP(r)})})],C2l={"":dds,"--stat":dds,"--numstat":r4l,"--name-status":i4l,"--name-only":n4l}}});function jMA(e,t){return t.reduce((r,n,i)=>(r[n]=e[i]||"",r),Object.create({diff:null}))}function B2l(e=$ds,t=D2l,r=""){let n=j2l(r);return function(i){let o=MZr(i.trim(),!1,Gds).map(function(a){let s=a.split(Hds),c=jMA(s[0].split(e),t);return s.length>1&&s[1].trim()&&(c.diff=n(s[1])),c});return{all:o,latest:o.length&&o[0]||null,total:o.length}}}var Gds,Hds,$ds,D2l,T2l=pa({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";Sf(),S2l(),qZr(),Gds="\xF2\xF2\xF2\xF2\xF2\xF2 ",Hds=" \xF2\xF2",$ds=" \xF2 ",D2l=["hash","date","message","refs","author_name","author_email"]}}),R2l={};YC(R2l,{diffSummaryTask:()=>CMA,validateLogFormatConfig:()=>$ei});function CMA(e){let t=Lds(e),r=["diff"];return t===""&&(t="--stat",r.push("--stat=4096")),r.push(...e),$ei(r)||{commands:r,format:"utf-8",parser:j2l(t)}}function $ei(e){let t=e.filter(IMA);if(t.length>1)return W5(`Summary flags are mutually exclusive - pick one of ${t.join(",")}`);if(t.length&&e.includes("-z"))return W5(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var Jds=pa({"src/lib/tasks/diff.ts"(){"use strict";qZr(),S2l(),KC()}});function SMA(e,t){let r=[],n=[];return Object.keys(e).forEach(i=>{r.push(i),n.push(String(e[i]))}),[r,n.join(t)]}function BMA(e){return Object.keys(e).reduce((t,r)=>(r in Ids||(t[r]=e[r]),t),{})}function F2l(e={},t=[]){let r=aK(e.splitter,RR,$ds),n=Lei(e.format)?e.format:{hash:"%H",date:e.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:e.multiLine?"%B":"%b",author_name:e.mailMap!==!1?"%aN":"%an",author_email:e.mailMap!==!1?"%aE":"%ae"},[i,o]=SMA(n,r),a=[],s=[`--pretty=format:${Gds}${o}${Hds}`,...t],c=e.n||e["max-count"]||e.maxCount;if(c&&s.push(`--max-count=${c}`),e.from||e.to){let l=e.symmetric!==!1?"...":"..";a.push(`${e.from||""}${l}${e.to||""}`)}return RR(e.file)&&s.push("--follow",bNA(e.file)),Fds(BMA(e),s),{fields:i,splitter:r,commands:[...s,...a]}}function DMA(e,t,r){let n=B2l(e,t,Lds(r));return{commands:["log",...r],format:"utf-8",parser:n}}function TMA(){return{log(...r){let n=Wj(arguments),i=F2l(Nds(arguments),rmr(aK(arguments[0],QZr,[]))),o=t(...r)||$ei(i.commands)||e(i);return this._runTask(o,n)}};function e(r){return DMA(r.splitter,r.fields,r.commands)}function t(r,n){return RR(r)&&RR(n)&&W5("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var Ids,N2l=pa({"src/lib/tasks/log.ts"(){"use strict";qZr(),FZr(),T2l(),Sf(),KC(),Jds(),Ids=(e=>(e[e["--pretty"]=0]="--pretty",e[e["max-count"]=1]="max-count",e[e.maxCount=2]="maxCount",e[e.n=3]="n",e[e.file=4]="file",e[e.format=5]="format",e[e.from=6]="from",e[e.to=7]="to",e[e.splitter=8]="splitter",e[e.symmetric=9]="symmetric",e[e.mailMap=10]="mailMap",e[e.multiLine=11]="multiLine",e[e.strictDate=12]="strictDate",e))(Ids||{})}}),Rei,M2l,RMA=pa({"src/lib/responses/MergeSummary.ts"(){"use strict";Rei=class{constructor(e,t=null,r){this.reason=e,this.file=t,this.meta=r}toString(){return`${this.file}:${this.reason}`}},M2l=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),xds,z2l,FMA=pa({"src/lib/responses/PullSummary.ts"(){"use strict";xds=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},z2l=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function mds(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function o4l(e){let t=/^\s*(\d+)/.exec(e),r=/delta (\d+)/i.exec(e);return{count:HP(t&&t[1]||"0"),delta:HP(r&&r[1]||"0")}}var Q2l,NMA=pa({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";Sf(),Q2l=[new fbt(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,r])=>{let n=t.toLowerCase(),i=mds(e.remoteMessages);Object.assign(i,{[n]:HP(r)})}),new fbt(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,r])=>{let n=t.toLowerCase(),i=mds(e.remoteMessages);Object.assign(i,{[n]:HP(r)})}),new fbt(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,r,n])=>{let i=mds(e.remoteMessages);i.total=o4l(t),i.reused=o4l(r),i.packReused=HP(n)})]}});function q2l(e,t){return G5({remoteMessages:new k2l},V2l,t)}var V2l,k2l,U2l=pa({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";Sf(),NMA(),V2l=[new fbt(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...Q2l,new fbt([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new fbt([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,r,n])=>{e.remoteMessages.vulnerabilities={count:HP(t),summary:r,url:n}})],k2l=class{constructor(){this.all=[]}}}});function MMA(e,t){let r=G5(new z2l,L2l,[e,t]);return r.message&&r}var a4l,s4l,u4l,c4l,L2l,l4l,Kds,W2l=pa({"src/lib/parsers/parse-pull.ts"(){"use strict";FMA(),Sf(),U2l(),a4l=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,s4l=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,u4l=/^(create|delete) mode \d+ (.+)/,c4l=[new rm(a4l,(e,[t,r,n])=>{e.files.push(t),r&&(e.insertions[t]=r.length),n&&(e.deletions[t]=n.length)}),new rm(s4l,(e,[t,,r,,n])=>r!==void 0||n!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+r||0,e.summary.deletions=+n||0,!0):!1),new rm(u4l,(e,[t,r])=>{Fv(e.files,r),Fv(t==="create"?e.created:e.deleted,r)})],L2l=[new rm(/^from\s(.+)$/i,(e,[t])=>{e.remote=t}),new rm(/^fatal:\s(.+)$/,(e,[t])=>{e.message=t}),new rm(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,r,n,i])=>{e.branch.local=n,e.hash.local=t,e.branch.remote=i,e.hash.remote=r})],l4l=(e,t)=>G5(new xds,c4l,[e,t]),Kds=(e,t)=>Object.assign(new xds,l4l(e,t),q2l(e,t))}}),p4l,G2l,f4l,zMA=pa({"src/lib/parsers/parse-merge.ts"(){"use strict";RMA(),Sf(),W2l(),p4l=[new rm(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new rm(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,r])=>{e.conflicts.push(new Rei(t,r))}),new rm(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,r,n])=>{e.conflicts.push(new Rei(t,r,{deleteRef:n}))}),new rm(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new Rei(t,null))}),new rm(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],G2l=(e,t)=>Object.assign(f4l(e,t),Kds(e,t)),f4l=e=>G5(new M2l,p4l,e)}});function d4l(e){return e.length?{commands:["merge",...e],format:"utf-8",parser(t,r){let n=G2l(t,r);if(n.failed)throw new NZr(n);return n}}:W5("Git.merge requires at least one option")}var QMA=pa({"src/lib/tasks/merge.ts"(){"use strict";tmr(),zMA(),KC()}});function qMA(e,t,r){let n=r.includes("deleted"),i=r.includes("tag")||/^refs\/tags/.test(e),o=!r.includes("new");return{deleted:n,tag:i,branch:!i,new:!o,alreadyUpdated:o,local:e,remote:t}}var m4l,H2l,h4l,VMA=pa({"src/lib/parsers/parse-push.ts"(){"use strict";Sf(),U2l(),m4l=[new rm(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new rm(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new rm(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,r,n])=>{e.pushed.push(qMA(t,r,n))}),new rm(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,r,n])=>{e.branch={...e.branch||{},local:t,remote:r,remoteName:n}}),new rm(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,r,n,i])=>{e.update={head:{local:t,remote:r},hash:{from:n,to:i}}})],H2l=(e,t)=>{let r=h4l(e,t),n=q2l(e,t);return{...r,...n}},h4l=(e,t)=>G5({pushed:[]},m4l,[e,t])}}),$2l={};YC($2l,{pushTagsTask:()=>kMA,pushTask:()=>Yds});function kMA(e={},t){return Fv(t,"--tags"),Yds(e,t)}function Yds(e={},t){let r=["push",...t];return e.branch&&r.splice(1,0,e.branch),e.remote&&r.splice(1,0,e.remote),kei(r,"-v"),Fv(r,"--verbose"),Fv(r,"--porcelain"),{commands:r,format:"utf-8",parser:H2l}}var J2l=pa({"src/lib/tasks/push.ts"(){"use strict";VMA(),Sf()}});function UMA(){return{showBuffer(){let e=["show",...L5(arguments,1)];return e.includes("--binary")||e.splice(1,0,"--binary"),this._runTask(e2l(e),Wj(arguments))},show(){let e=["show",...L5(arguments,1)];return this._runTask(LU(e),Wj(arguments))}}}var LMA=pa({"src/lib/tasks/show.ts"(){"use strict";Sf(),KC()}}),y4l,K2l,WMA=pa({"src/lib/responses/FileStatusSummary.ts"(){"use strict";y4l=/^(.+)\0(.+)$/,K2l=class{constructor(e,t,r){if(this.path=e,this.index=t,this.working_dir=r,t==="R"||r==="R"){let n=y4l.exec(e)||[null,e,e];this.from=n[2]||"",this.path=n[1]||""}}}}});function g4l(e){let[t,r]=e.split(emr);return{from:r||t,to:t}}function oK(e,t,r){return[`${e}${t}`,r]}function hds(e,...t){return t.map(r=>oK(e,r,(n,i)=>Fv(n.conflicted,i)))}function GMA(e,t){let r=t.trim();switch(" "){case r.charAt(2):return n(r.charAt(0),r.charAt(1),r.substr(3));case r.charAt(1):return n(" ",r.charAt(0),r.substr(2));default:return}function n(i,o,a){let s=`${i}${o}`,c=Y2l.get(s);c&&c(e,a),s!=="##"&&s!=="!!"&&e.files.push(new K2l(a,i,o))}}var b4l,Y2l,X2l,HMA=pa({"src/lib/responses/StatusSummary.ts"(){"use strict";Sf(),WMA(),b4l=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},Y2l=new Map([oK(" ","A",(e,t)=>Fv(e.created,t)),oK(" ","D",(e,t)=>Fv(e.deleted,t)),oK(" ","M",(e,t)=>Fv(e.modified,t)),oK("A"," ",(e,t)=>Fv(e.created,t)&&Fv(e.staged,t)),oK("A","M",(e,t)=>Fv(e.created,t)&&Fv(e.staged,t)&&Fv(e.modified,t)),oK("D"," ",(e,t)=>Fv(e.deleted,t)&&Fv(e.staged,t)),oK("M"," ",(e,t)=>Fv(e.modified,t)&&Fv(e.staged,t)),oK("M","M",(e,t)=>Fv(e.modified,t)&&Fv(e.staged,t)),oK("R"," ",(e,t)=>{Fv(e.renamed,g4l(t))}),oK("R","M",(e,t)=>{let r=g4l(t);Fv(e.renamed,r),Fv(e.modified,r.to)}),oK("!","!",(e,t)=>{Fv(e.ignored=e.ignored||[],t)}),oK("?","?",(e,t)=>Fv(e.not_added,t)),...hds("A","A","U"),...hds("D","D","U"),...hds("U","A","D","U"),["##",(e,t)=>{let r=/ahead (\d+)/,n=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,o=/\.{3}(\S*)/,a=/\son\s(\S+?)(?=\.{3}|$)/,s=r.exec(t);e.ahead=s&&+s[1]||0,s=n.exec(t),e.behind=s&&+s[1]||0,s=i.exec(t),e.current=aK(s?.[1],RR,null),s=o.exec(t),e.tracking=aK(s?.[1],RR,null),s=a.exec(t),s&&(e.current=aK(s?.[1],RR,e.current)),e.detached=/\(no branch\)/.test(t)}]]),X2l=function(e){let t=e.split(emr),r=new b4l;for(let n=0,i=t.length;n<i;){let o=t[n++].trim();o&&(o.charAt(0)==="R"&&(o+=emr+(t[n++]||"")),GMA(r,o))}return r}}});function $MA(e){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...e.filter(r=>!Z2l.includes(r))],parser(r){return X2l(r)}}}var Z2l,JMA=pa({"src/lib/tasks/status.ts"(){"use strict";HMA(),Z2l=["--null","-z"]}});function Qei(e=0,t=0,r=0,n="",i=!0){return Object.defineProperty({major:e,minor:t,patch:r,agent:n,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function KMA(){return Qei(0,0,0,"",!1)}function YMA(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:XMA,onError(e,t,r,n){if(e.exitCode===-2)return r(Buffer.from(Xds));n(t)}})}}}function XMA(e){return e===Xds?KMA():G5(Qei(0,0,0,e),eLl,e)}var Xds,eLl,ZMA=pa({"src/lib/tasks/version.ts"(){"use strict";Sf(),Xds="installed=false",eLl=[new rm(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,r,n,i=""])=>{Object.assign(e,Qei(HP(t),HP(r),HP(n),i))}),new rm(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,r,n,i=""])=>{Object.assign(e,Qei(HP(t),HP(r),n,i))})]}}),tLl={};YC(tLl,{SimpleGitApi:()=>jds});var jds,ezA=pa({"src/lib/simple-git-api.ts"(){"use strict";oMA(),aMA(),uMA(),pMA(),yMA(),u2l(),bMA(),d2l(),_MA(),EMA(),N2l(),QMA(),J2l(),LMA(),JMA(),KC(),ZMA(),Sf(),jds=class{constructor(e){this._executor=e}_runTask(e,t){let r=this._executor.chain(),n=r.push(e);return t&&nMA(e,n,t),Object.create(this,{then:{value:n.then.bind(n)},catch:{value:n.catch.bind(n)},_executor:{value:r}})}add(e){return this._runTask(LU(["add",...UMe(e)]),Wj(arguments))}cwd(e){let t=Wj(arguments);return typeof e=="string"?this._runTask(t4l(e,this._executor),t):typeof e?.path=="string"?this._runTask(t4l(e.path,e.root&&this._executor||void 0),t):this._runTask(W5("Git.cwd: workingDirectory must be supplied as a string"),t)}hashObject(e,t){return this._runTask(AMA(e,t===!0),Wj(arguments))}init(e){return this._runTask(PMA(e===!0,this._executor.cwd,L5(arguments)),Wj(arguments))}merge(){return this._runTask(d4l(L5(arguments)),Wj(arguments))}mergeFromTo(e,t){return RR(e)&&RR(t)?this._runTask(d4l([e,t,...L5(arguments)]),Wj(arguments,!1)):this._runTask(W5("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=Yds({remote:aK(arguments[0],RR),branch:aK(arguments[1],RR)},L5(arguments));return this._runTask(e,Wj(arguments))}stash(){return this._runTask(LU(["stash",...L5(arguments)]),Wj(arguments))}status(){return this._runTask($MA(L5(arguments)),Wj(arguments))}},Object.assign(jds.prototype,sMA(),hMA(),LNA(),lMA(),gMA(),$NA(),TMA(),UMA(),YMA())}}),rLl={};YC(rLl,{Scheduler:()=>iLl});var A4l,iLl,tzA=pa({"src/lib/runners/scheduler.ts"(){"use strict";Sf(),b2l(),A4l=(()=>{let e=0;return()=>{e++;let{promise:t,done:r}=(0,nLl.createDeferred)();return{promise:t,done:r,id:e}}})(),iLl=class{constructor(e=2){this.concurrency=e,this.logger=kds("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let e=Fv(this.running,this.pending.shift());this.logger("Attempting id=%s",e.id),e.done(()=>{this.logger("Completing id=",e.id),kei(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=Fv(this.pending,A4l());return this.logger("Scheduling id=%s",t),this.schedule(),e}}}}),oLl={};YC(oLl,{applyPatchTask:()=>rzA});function rzA(e,t){return LU(["apply",...t,...e])}var nzA=pa({"src/lib/tasks/apply-patch.ts"(){"use strict";KC()}});function izA(e,t){return{branch:e,hash:t,success:!0}}function ozA(e){return{branch:e,hash:null,success:!1}}var aLl,azA=pa({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";aLl=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function sLl(e,t){return t===1&&Cds.test(e)}var _4l,Cds,v4l,Jei,szA=pa({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";azA(),Sf(),_4l=/(\S+)\s+\(\S+\s([^)]+)\)/,Cds=/^error[^']+'([^']+)'/m,v4l=[new rm(_4l,(e,[t,r])=>{let n=izA(t,r);e.all.push(n),e.branches[t]=n}),new rm(Cds,(e,[t])=>{let r=ozA(t);e.errors.push(r),e.all.push(r),e.branches[t]=r})],Jei=(e,t)=>G5(new aLl,v4l,[e,t])}}),uLl,uzA=pa({"src/lib/responses/BranchSummary.ts"(){"use strict";uLl=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(e,t,r,n,i){e==="*"&&(this.detached=t,this.current=r),this.all.push(r),this.branches[r]={current:e==="*",linkedWorkTree:e==="+",name:r,commit:n,label:i}}}}});function O4l(e){return e?e.charAt(0):""}function cLl(e,t=!1){return G5(new uLl,t?[pLl]:lLl,e)}var lLl,pLl,czA=pa({"src/lib/parsers/parse-branch.ts"(){"use strict";uzA(),Sf(),lLl=[new rm(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,r,n,i])=>{e.push(O4l(t),!0,r,n,i)}),new rm(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,r,n,i])=>{e.push(O4l(t),!1,r,n,i)})],pLl=new rm(/^(\S+)$/s,(e,[t])=>{e.push("*",!1,t,"","")})}}),fLl={};YC(fLl,{branchLocalTask:()=>pzA,branchTask:()=>lzA,containsDeleteBranchCommand:()=>dLl,deleteBranchTask:()=>dzA,deleteBranchesTask:()=>fzA});function dLl(e){let t=["-d","-D","--delete"];return e.some(r=>t.includes(r))}function lzA(e){let t=dLl(e),r=e.includes("--show-current"),n=["branch",...e];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(i,o){return t?Jei(i,o).all[0]:cLl(i,r)}}}function pzA(){return{format:"utf-8",commands:["branch","-v"],parser(e){return cLl(e)}}}function fzA(e,t=!1){return{format:"utf-8",commands:["branch","-v",t?"-D":"-d",...e],parser(r,n){return Jei(r,n)},onError({exitCode:r,stdOut:n},i,o,a){if(!sLl(String(i),r))return a(i);o(n)}}}function dzA(e,t=!1){let r={format:"utf-8",commands:["branch","-v",t?"-D":"-d",e],parser(n,i){return Jei(n,i).branches[e]},onError({exitCode:n,stdErr:i,stdOut:o},a,s,c){if(!sLl(String(a),n))return c(a);throw new NZr(r.parser(RZr(o),RZr(i)),String(a))}};return r}var mzA=pa({"src/lib/tasks/branch.ts"(){"use strict";tmr(),szA(),czA(),Sf()}});function hzA(e){let t=e.trim().replace(/^["']|["']$/g,"");return t&&(0,mLl.normalize)(t)}var hLl,yzA=pa({"src/lib/responses/CheckIgnore.ts"(){"use strict";hLl=e=>e.split(/\n/g).map(hzA).filter(Boolean)}}),yLl={};YC(yLl,{checkIgnoreTask:()=>gzA});function gzA(e){return{commands:["check-ignore",...e],format:"utf-8",parser:hLl}}var bzA=pa({"src/lib/tasks/check-ignore.ts"(){"use strict";yzA()}}),gLl={};YC(gLl,{cloneMirrorTask:()=>_zA,cloneTask:()=>bLl});function AzA(e){return/^--upload-pack(=|$)/.test(e)}function bLl(e,t,r){let n=["clone",...r];return RR(e)&&n.push(e),RR(t)&&n.push(t),n.find(AzA)?W5("git.fetch: potential exploit argument blocked."):LU(n)}function _zA(e,t,r){return Fv(r,"--mirror"),bLl(e,t,r)}var vzA=pa({"src/lib/tasks/clone.ts"(){"use strict";KC(),Sf()}});function OzA(e,t){return G5({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},ALl,[e,t])}var ALl,wzA=pa({"src/lib/parsers/parse-fetch.ts"(){"use strict";Sf(),ALl=[new rm(/From (.+)$/,(e,[t])=>{e.remote=t}),new rm(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,r])=>{e.branches.push({name:t,tracking:r})}),new rm(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,r])=>{e.tags.push({name:t,tracking:r})}),new rm(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new rm(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,r,n,i])=>{e.updated.push({name:n,tracking:i,to:r,from:t})})]}}),_Ll={};YC(_Ll,{fetchTask:()=>EzA});function PzA(e){return/^--upload-pack(=|$)/.test(e)}function EzA(e,t,r){let n=["fetch",...r];return e&&t&&n.push(e,t),n.find(PzA)?W5("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:OzA}}var IzA=pa({"src/lib/tasks/fetch.ts"(){"use strict";wzA(),KC()}});function xzA(e){return G5({moves:[]},vLl,e)}var vLl,jzA=pa({"src/lib/parsers/parse-move.ts"(){"use strict";Sf(),vLl=[new rm(/^Renaming (.+) to (.+)$/,(e,[t,r])=>{e.moves.push({from:t,to:r})})]}}),OLl={};YC(OLl,{moveTask:()=>CzA});function CzA(e,t){return{commands:["mv","-v",...UMe(e),t],format:"utf-8",parser:xzA}}var SzA=pa({"src/lib/tasks/move.ts"(){"use strict";jzA(),Sf()}}),wLl={};YC(wLl,{pullTask:()=>BzA});function BzA(e,t,r){let n=["pull",...r];return e&&t&&n.splice(1,0,e,t),{commands:n,format:"utf-8",parser(i,o){return Kds(i,o)},onError(i,o,a,s){let c=MMA(RZr(i.stdOut),RZr(i.stdErr));if(c)return s(new NZr(c));s(o)}}}var DzA=pa({"src/lib/tasks/pull.ts"(){"use strict";tmr(),W2l(),Sf()}});function TzA(e){let t={};return PLl(e,([r])=>t[r]={name:r}),Object.values(t)}function RzA(e){let t={};return PLl(e,([r,n,i])=>{Object.hasOwn(t,r)||(t[r]={name:r,refs:{fetch:"",push:""}}),i&&n&&(t[r].refs[i.replace(/[^a-z]/g,"")]=n)}),Object.values(t)}function PLl(e,t){Dds(e,r=>t(r.split(/\s+/)))}var FzA=pa({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";Sf()}}),ELl={};YC(ELl,{addRemoteTask:()=>NzA,getRemotesTask:()=>MzA,listRemotesTask:()=>zzA,remoteTask:()=>QzA,removeRemoteTask:()=>qzA});function NzA(e,t,r){return LU(["remote","add",...r,e,t])}function MzA(e){let t=["remote"];return e&&t.push("-v"),{commands:t,format:"utf-8",parser:e?RzA:TzA}}function zzA(e){let t=[...e];return t[0]!=="ls-remote"&&t.unshift("ls-remote"),LU(t)}function QzA(e){let t=[...e];return t[0]!=="remote"&&t.unshift("remote"),LU(t)}function qzA(e){return LU(["remote","remove",e])}var VzA=pa({"src/lib/tasks/remote.ts"(){"use strict";FzA(),KC()}}),ILl={};YC(ILl,{stashListTask:()=>kzA});function kzA(e={},t){let r=F2l(e),n=["stash","list",...r.commands,...t],i=B2l(r.splitter,r.fields,Lds(n));return $ei(n)||{commands:n,format:"utf-8",parser:i}}var UzA=pa({"src/lib/tasks/stash-list.ts"(){"use strict";qZr(),T2l(),Jds(),N2l()}}),xLl={};YC(xLl,{addSubModuleTask:()=>LzA,initSubModuleTask:()=>WzA,subModuleTask:()=>Kei,updateSubModuleTask:()=>GzA});function LzA(e,t){return Kei(["add",e,t])}function WzA(e){return Kei(["init",...e])}function Kei(e){let t=[...e];return t[0]!=="submodule"&&t.unshift("submodule"),LU(t)}function GzA(e){return Kei(["update",...e])}var HzA=pa({"src/lib/tasks/sub-module.ts"(){"use strict";KC()}});function $zA(e,t){let r=Number.isNaN(e),n=Number.isNaN(t);return r!==n?r?1:-1:r?jLl(e,t):0}function jLl(e,t){return e===t?0:e>t?1:-1}function JzA(e){return e.trim()}function Sei(e){return typeof e=="string"&&parseInt(e.replace(/^\D+/g,""),10)||0}var w4l,CLl,KzA=pa({"src/lib/responses/TagList.ts"(){"use strict";w4l=class{constructor(e,t){this.all=e,this.latest=t}},CLl=function(e,t=!1){let r=e.split(`
1538
- `).map(JzA).filter(Boolean);t||r.sort(function(i,o){let a=i.split("."),s=o.split(".");if(a.length===1||s.length===1)return $zA(Sei(a[0]),Sei(s[0]));for(let c=0,l=Math.max(a.length,s.length);c<l;c++){let u=jLl(Sei(a[c]),Sei(s[c]));if(u)return u}return 0});let n=t?r[0]:[...r].reverse().find(i=>i.indexOf(".")>=0);return new w4l(r,n)}}}),SLl={};YC(SLl,{addAnnotatedTagTask:()=>ZzA,addTagTask:()=>XzA,tagListTask:()=>YzA});function YzA(e=[]){let t=e.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...e],parser(r){return CLl(r,t)}}}function XzA(e){return{format:"utf-8",commands:["tag",e],parser(){return{name:e}}}}function ZzA(e,t){return{format:"utf-8",commands:["tag","-a","-m",t,e],parser(){return{name:e}}}}var eQA=pa({"src/lib/tasks/tag.ts"(){"use strict";KzA()}}),tQA=yNA({"src/git.js"(e,t){"use strict";var{GitExecutor:r}=(rMA(),Lj(v2l)),{SimpleGitApi:n}=(ezA(),Lj(tLl)),{Scheduler:i}=(tzA(),Lj(rLl)),{configurationErrorTask:o}=(KC(),Lj(Ods)),{asArray:a,filterArray:s,filterPrimitives:c,filterString:l,filterStringOrStringArray:u,filterType:p,getTrailingOptions:d,trailingFunctionArgument:m,trailingOptionsArgument:h}=(Sf(),Lj(L4l)),{applyPatchTask:y}=(nzA(),Lj(oLl)),{branchTask:g,branchLocalTask:b,deleteBranchesTask:_,deleteBranchTask:O}=(mzA(),Lj(fLl)),{checkIgnoreTask:A}=(bzA(),Lj(yLl)),{checkIsRepoTask:v}=($4l(),Lj(W4l)),{cloneTask:P,cloneMirrorTask:I}=(vzA(),Lj(gLl)),{cleanWithOptionsTask:E,isCleanOptionsArray:x}=(o2l(),Lj(n2l)),{diffSummaryTask:T}=(Jds(),Lj(R2l)),{fetchTask:W}=(IzA(),Lj(_Ll)),{moveTask:H}=(SzA(),Lj(OLl)),{pullTask:G}=(DzA(),Lj(wLl)),{pushTagsTask:ie}=(J2l(),Lj($2l)),{addRemoteTask:oe,getRemotesTask:$,listRemotesTask:te,remoteTask:Ge,removeRemoteTask:Ke}=(VzA(),Lj(ELl)),{getResetMode:X,resetTask:Y}=(g2l(),Lj(m2l)),{stashListTask:Be}=(UzA(),Lj(ILl)),{addSubModuleTask:Pe,initSubModuleTask:ke,subModuleTask:Ye,updateSubModuleTask:Oe}=(HzA(),Lj(xLl)),{addAnnotatedTagTask:he,addTagTask:pt,tagListTask:mt}=(eQA(),Lj(SLl)),{straightThroughBufferTask:br,straightThroughStringTask:Yt}=(KC(),Lj(Ods));function Wt(Xt,Se){this._plugins=Se,this._executor=new r(Xt.baseDir,new i(Xt.maxConcurrentProcesses),Se),this._trimmed=Xt.trimmed}(Wt.prototype=Object.create(n.prototype)).constructor=Wt,Wt.prototype.customBinary=function(Xt){return this._plugins.reconfigure("binary",Xt),this},Wt.prototype.env=function(Xt,Se){return arguments.length===1&&typeof Xt=="object"?this._executor.env=Xt:(this._executor.env=this._executor.env||{})[Xt]=Se,this},Wt.prototype.stashList=function(Xt){return this._runTask(Be(h(arguments)||{},s(Xt)&&Xt||[]),m(arguments))};function or(Xt,Se,Ze,Dt){return typeof Ze!="string"?o(`git.${Xt}() requires a string 'repoPath'`):Se(Ze,p(Dt,l),d(arguments))}Wt.prototype.clone=function(){return this._runTask(or("clone",P,...arguments),m(arguments))},Wt.prototype.mirror=function(){return this._runTask(or("mirror",I,...arguments),m(arguments))},Wt.prototype.mv=function(Xt,Se){return this._runTask(H(Xt,Se),m(arguments))},Wt.prototype.checkoutLatestTag=function(Xt){var Se=this;return this.pull(function(){Se.tags(function(Ze,Dt){Se.checkout(Dt.latest,Xt)})})},Wt.prototype.pull=function(Xt,Se,Ze,Dt){return this._runTask(G(p(Xt,l),p(Se,l),d(arguments)),m(arguments))},Wt.prototype.fetch=function(Xt,Se){return this._runTask(W(p(Xt,l),p(Se,l),d(arguments)),m(arguments))},Wt.prototype.silent=function(Xt){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},Wt.prototype.tags=function(Xt,Se){return this._runTask(mt(d(arguments)),m(arguments))},Wt.prototype.rebase=function(){return this._runTask(Yt(["rebase",...d(arguments)]),m(arguments))},Wt.prototype.reset=function(Xt){return this._runTask(Y(X(Xt),d(arguments)),m(arguments))},Wt.prototype.revert=function(Xt){let Se=m(arguments);return typeof Xt!="string"?this._runTask(o("Commit must be a string"),Se):this._runTask(Yt(["revert",...d(arguments,0,!0),Xt]),Se)},Wt.prototype.addTag=function(Xt){let Se=typeof Xt=="string"?pt(Xt):o("Git.addTag requires a tag name");return this._runTask(Se,m(arguments))},Wt.prototype.addAnnotatedTag=function(Xt,Se){return this._runTask(he(Xt,Se),m(arguments))},Wt.prototype.deleteLocalBranch=function(Xt,Se,Ze){return this._runTask(O(Xt,typeof Se=="boolean"?Se:!1),m(arguments))},Wt.prototype.deleteLocalBranches=function(Xt,Se,Ze){return this._runTask(_(Xt,typeof Se=="boolean"?Se:!1),m(arguments))},Wt.prototype.branch=function(Xt,Se){return this._runTask(g(d(arguments)),m(arguments))},Wt.prototype.branchLocal=function(Xt){return this._runTask(b(),m(arguments))},Wt.prototype.raw=function(Xt){let Se=!Array.isArray(Xt),Ze=[].slice.call(Se?arguments:Xt,0);for(let Pt=0;Pt<Ze.length&&Se;Pt++)if(!c(Ze[Pt])){Ze.splice(Pt,Ze.length-Pt);break}Ze.push(...d(arguments,0,!0));var Dt=m(arguments);return Ze.length?this._runTask(Yt(Ze,this._trimmed),Dt):this._runTask(o("Raw: must supply one or more command to execute"),Dt)},Wt.prototype.submoduleAdd=function(Xt,Se,Ze){return this._runTask(Pe(Xt,Se),m(arguments))},Wt.prototype.submoduleUpdate=function(Xt,Se){return this._runTask(Oe(d(arguments,!0)),m(arguments))},Wt.prototype.submoduleInit=function(Xt,Se){return this._runTask(ke(d(arguments,!0)),m(arguments))},Wt.prototype.subModule=function(Xt,Se){return this._runTask(Ye(d(arguments)),m(arguments))},Wt.prototype.listRemote=function(){return this._runTask(te(d(arguments)),m(arguments))},Wt.prototype.addRemote=function(Xt,Se,Ze){return this._runTask(oe(Xt,Se,d(arguments)),m(arguments))},Wt.prototype.removeRemote=function(Xt,Se){return this._runTask(Ke(Xt),m(arguments))},Wt.prototype.getRemotes=function(Xt,Se){return this._runTask($(Xt===!0),m(arguments))},Wt.prototype.remote=function(Xt,Se){return this._runTask(Ge(d(arguments)),m(arguments))},Wt.prototype.tag=function(Xt,Se){let Ze=d(arguments);return Ze[0]!=="tag"&&Ze.unshift("tag"),this._runTask(Yt(Ze),m(arguments))},Wt.prototype.updateServerInfo=function(Xt){return this._runTask(Yt(["update-server-info"]),m(arguments))},Wt.prototype.pushTags=function(Xt,Se){let Ze=ie({remote:p(Xt,l)},d(arguments));return this._runTask(Ze,m(arguments))},Wt.prototype.rm=function(Xt){return this._runTask(Yt(["rm","-f",...a(Xt)]),m(arguments))},Wt.prototype.rmKeepLocal=function(Xt){return this._runTask(Yt(["rm","--cached",...a(Xt)]),m(arguments))},Wt.prototype.catFile=function(Xt,Se){return this._catFile("utf-8",arguments)},Wt.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},Wt.prototype._catFile=function(Xt,Se){var Ze=m(Se),Dt=["cat-file"],Pt=Se[0];if(typeof Pt=="string")return this._runTask(o("Git.catFile: options must be supplied as an array of strings"),Ze);Array.isArray(Pt)&&Dt.push.apply(Dt,Pt);let rt=Xt==="buffer"?br(Dt):Yt(Dt);return this._runTask(rt,Ze)},Wt.prototype.diff=function(Xt,Se){let Ze=l(Xt)?o("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):Yt(["diff",...d(arguments)]);return this._runTask(Ze,m(arguments))},Wt.prototype.diffSummary=function(){return this._runTask(T(d(arguments,1)),m(arguments))},Wt.prototype.applyPatch=function(Xt){let Se=u(Xt)?y(a(Xt),d([].slice.call(arguments,1))):o("git.applyPatch requires one or more string patches as the first argument");return this._runTask(Se,m(arguments))},Wt.prototype.revparse=function(){let Xt=["rev-parse",...d(arguments,!0)];return this._runTask(Yt(Xt,!0),m(arguments))},Wt.prototype.clean=function(Xt,Se,Ze){let Dt=x(Xt),Pt=Dt&&Xt.join("")||p(Xt,l)||"",rt=d([].slice.call(arguments,Dt?1:0));return this._runTask(E(Pt,rt),m(arguments))},Wt.prototype.exec=function(Xt){let Se={commands:[],format:"utf-8",parser(){typeof Xt=="function"&&Xt()}};return this._runTask(Se)},Wt.prototype.clearQueue=function(){return this},Wt.prototype.checkIgnore=function(Xt,Se){return this._runTask(A(a(p(Xt,u,[]))),m(arguments))},Wt.prototype.checkIsRepo=function(Xt,Se){return this._runTask(v(p(Xt,l)),m(arguments))},t.exports=Wt}});FZr();dbt();var rQA=class extends Bat{constructor(e,t){super(void 0,t),this.config=e}};dbt();dbt();var Sat=class extends Bat{constructor(e,t,r){super(e,r),this.task=e,this.plugin=t,Object.setPrototypeOf(this,new.target.prototype)}};tmr();C4l();$4l();o2l();u2l();l2l();d2l();g2l();function nQA(e){return e?[{type:"spawn.before",action(n,i){e.aborted&&i.kill(new Sat(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(n,i){function o(){i.kill(new Sat(void 0,"abort","Abort signal received"))}e.addEventListener("abort",o),i.spawned.on("close",()=>e.removeEventListener("abort",o))}}]:void 0}function iQA(e){return typeof e=="string"&&e.trim().toLowerCase()==="-c"}function oQA(e,t){if(iQA(e)&&/^\s*protocol(.[a-z]+)?.allow/.test(t))throw new Sat(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function aQA(e,t){if(/^\s*--(upload|receive)-pack/.test(e))throw new Sat(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(t==="clone"&&/^\s*-u\b/.test(e))throw new Sat(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(t==="push"&&/^\s*--exec\b/.test(e))throw new Sat(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function sQA({allowUnsafeProtocolOverride:e=!1,allowUnsafePack:t=!1}={}){return{type:"spawn.args",action(r,n){return r.forEach((i,o)=>{let a=o<r.length?r[o+1]:"";e||oQA(i,a),t||aQA(i,n.method)}),r}}}Sf();function uQA(e){let t=TZr(e,"-c");return{type:"spawn.args",action(r){return[...t,...r]}}}Sf();var P4l=(0,Zdr.deferred)().promise;function cQA({onClose:e=!0,onExit:t=50}={}){function r(){let i=-1,o={close:(0,Zdr.deferred)(),closeTimeout:(0,Zdr.deferred)(),exit:(0,Zdr.deferred)(),exitTimeout:(0,Zdr.deferred)()},a=Promise.race([e===!1?P4l:o.closeTimeout.promise,t===!1?P4l:o.exitTimeout.promise]);return n(e,o.close,o.closeTimeout),n(t,o.exit,o.exitTimeout),{close(s){i=s,o.close.done()},exit(s){i=s,o.exit.done()},get exitCode(){return i},result:a}}function n(i,o,a){i!==!1&&(i===!0?o.promise:o.promise.then(()=>yds(i))).then(a.done)}return{type:"spawn.after",async action(i,{spawned:o,close:a}){let s=r(),c=!0,l=()=>{c=!1};o.stdout?.on("data",l),o.stderr?.on("data",l),o.on("error",l),o.on("close",u=>s.close(u)),o.on("exit",u=>s.exit(u));try{await s.result,c&&await yds(50),a(s.exitCode)}catch(u){a(s.exitCode,u)}}}}Sf();var lQA="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",E4l="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function pQA(e){return!e||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(e)}function I4l(e,t){if(e.length<1||e.length>2)throw new Sat(void 0,"binary",lQA);if(e.some(pQA))if(t)console.warn(E4l);else throw new Sat(void 0,"binary",E4l);let[n,i]=e;return{binary:n,prefix:i}}function fQA(e,t=["git"],r=!1){let n=I4l(UMe(t),r);e.on("binary",i=>{n=I4l(UMe(i),r)}),e.append("spawn.binary",()=>n.binary),e.append("spawn.args",i=>n.prefix?[n.prefix,...i]:i)}dbt();function dQA(e){return!!(e.exitCode&&e.stdErr.length)}function mQA(e){return Buffer.concat([...e.stdOut,...e.stdErr])}function hQA(e=!1,t=dQA,r=mQA){return(n,i)=>!e&&n||!t(i)?n:r(i)}function x4l(e){return{type:"task.error",action(t,r){let n=e(t.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new Bat(void 0,n.toString("utf-8"))}:{error:n}}}}Sf();var yQA=class{constructor(){this.plugins=new Set,this.events=new BLl.EventEmitter}on(e,t){this.events.on(e,t)}reconfigure(e,t){this.events.emit(e,t)}append(e,t){let r=Fv(this.plugins,{type:e,action:t});return()=>this.plugins.delete(r)}add(e){let t=[];return UMe(e).forEach(r=>r&&this.plugins.add(Fv(t,r))),()=>{t.forEach(r=>this.plugins.delete(r))}}exec(e,t,r){let n=t,i=Object.freeze(Object.create(r));for(let o of this.plugins)o.type===e&&(n=o.action(n,i));return n}};Sf();function gQA(e){let t="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(o,a){return r.includes(a.method)?N4l(o,t):o}},{type:"spawn.after",action(o,a){a.commands.includes(t)&&a.spawned.stderr?.on("data",s=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(s.toString("utf8"));c&&e({method:a.method,stage:bQA(c[1]),progress:HP(c[2]),processed:HP(c[3]),total:HP(c[4])})})}}]}function bQA(e){return String(e.toLowerCase().split(" ",1))||"unknown"}Sf();function AQA(e){let t=z4l(e,["uid","gid"]);return{type:"spawn.options",action(r){return{...t,...r}}}}function _QA({block:e,stdErr:t=!0,stdOut:r=!0}){if(e>0)return{type:"spawn.after",action(n,i){let o;function a(){o&&clearTimeout(o),o=setTimeout(c,e)}function s(){i.spawned.stdout?.off("data",a),i.spawned.stderr?.off("data",a),i.spawned.off("exit",s),i.spawned.off("close",s),o&&clearTimeout(o)}function c(){s(),i.kill(new Sat(void 0,"timeout","block timeout reached"))}r&&i.spawned.stdout?.on("data",a),t&&i.spawned.stderr?.on("data",a),i.spawned.on("exit",s),i.spawned.on("close",s),a()}}}FZr();function vQA(){return{type:"spawn.args",action(e){let t=[],r;function n(i){(r=r||[]).push(...i)}for(let i=0;i<e.length;i++){let o=e[i];if(Fei(o)){n(YUl(o));continue}if(o==="--"){n(e.slice(i+1).flatMap(a=>Fei(a)&&YUl(a)||a));break}t.push(o)}return r?[...t,"--",...r.map(String)]:t}}}Sf();var OQA=tQA();function wQA(e,t){let r=new yQA,n=k4l(e&&(typeof e=="string"?{baseDir:e}:e)||{},t);if(!Tds(n.baseDir))throw new rQA(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&r.add(uQA(n.config)),r.add(sQA(n.unsafe)),r.add(vQA()),r.add(cQA(n.completion)),n.abort&&r.add(nQA(n.abort)),n.progress&&r.add(gQA(n.progress)),n.timeout&&r.add(_QA(n.timeout)),n.spawnOptions&&r.add(AQA(n.spawnOptions)),r.add(x4l(hQA(!0))),n.errors&&r.add(x4l(n.errors)),fQA(r,n.binary,n.unsafe?.allowUnsafeCustomBinary),new OQA(n,r)}tmr();var Yei=wQA;var DLl="github.com",TLl="README.md";var Zds=".fernignore",RLl=".gitignore",FLl=".git";var NLl=[Zds,RLl,FLl],KLt=class e{clonePath;git;constructor({clonePath:t,git:r}){this.clonePath=t,this.git=r}async setUserAndEmail({name:t,email:r}){await this.git.cwd(this.clonePath),await this.git.addConfig("user.name",t),await this.git.addConfig("user.email",r)}static createAtPath(t){return new e({clonePath:t,git:Yei(t)})}async getDefaultBranch(){await this.git.cwd(this.clonePath);let t=await this.git.remote(["show","origin"]);if(t==null)throw new Error("Could not determine default branch");let r=t.match(/HEAD branch: (.+)/);if(!r?.[1])throw new Error("Could not determine default branch");return r[1].trim()}async getCurrentBranch(){return await this.git.cwd(this.clonePath),(await this.git.branchLocal()).current}async getReadme(){return await this.readFile({relativeFilePath:TLl})}async getFernignore(){return await this.readFile({relativeFilePath:Zds})}async add(t){await this.git.cwd(this.clonePath),await this.git.add(t)}async fileExists({relativeFilePath:t}){return await MLl(JLt.default.join(this.clonePath,t))}async restoreFiles({files:t,staged:r}){await this.git.cwd(this.clonePath);let n=["restore","--source=HEAD"];r&&n.push("--staged"),await this.git.raw([...n,...Array.isArray(t)?t:[t]])}async commit(t){await this.git.cwd(this.clonePath),await this.git.commit(t??"Automated commit",void 0,{"--allow-empty":null})}async commitAllChanges(t){await this.git.cwd(this.clonePath),await this.git.add("."),await this.commit(t)}async checkout(t){await this.git.cwd(this.clonePath);try{await this.git.checkout(t)}catch{await this.git.checkoutLocalBranch(t),await this.git.push("origin",t,{"--set-upstream":null})}}async pull(t){await this.git.cwd(this.clonePath),await this.git.pull("origin",t)}async pullWithMerge(t){await this.git.cwd(this.clonePath),await this.git.raw(["pull","origin",t,"--no-rebase"])}async push(){await this.git.cwd(this.clonePath);let t=await this.getCurrentBranch();try{await this.git.push()}catch(r){let n=String(r);if(n.includes("has no upstream branch")||n.includes("no upstream branch")){await this.pushUpstream(t);return}throw r}}async pushWithMergingRemote(){await this.git.cwd(this.clonePath);let t=await this.getCurrentBranch(),r=i=>i.includes("fetch first")||i.includes("Updates were rejected")||i.includes("non-fast-forward"),n=i=>i.includes("divergent branches")||i.includes("You have divergent branches");try{await this.push()}catch(i){let o=String(i);if(r(o))try{await this.pull(t),await this.push();return}catch(a){let s=String(a);if(n(s))try{await this.pullWithMerge(t),await this.push();return}catch{throw i}else throw i}else throw i}}async pushWithRebasingRemote(){await this.git.cwd(this.clonePath);let t=await this.getCurrentBranch(),r=n=>n.includes("fetch first")||n.includes("Updates were rejected")||n.includes("non-fast-forward");try{await this.push()}catch(n){let i=String(n);if(r(i))try{await this.git.raw(["pull","origin",t,"--rebase"]),await this.push();return}catch(o){throw new Error(`Push failed: ${i}. Attempted to rebase but that also failed: ${String(o)}`)}else throw n}}async isRemoteEmpty(){await this.git.cwd(this.clonePath);try{return(await this.git.raw(["ls-remote","--heads","origin"])).trim().length===0}catch{return!0}}async checkoutOrCreateLocal(t){await this.git.cwd(this.clonePath);try{await this.git.checkout(t)}catch{await this.git.checkoutLocalBranch(t)}}async checkoutRemoteBranch(t){await this.git.cwd(this.clonePath);try{await this.git.checkout(t)}catch{try{await this.git.checkout(["-b",t,`origin/${t}`])}catch{await this.git.checkoutLocalBranch(t)}}}async remoteBranchExists(t){await this.git.cwd(this.clonePath);try{return(await this.git.raw(["ls-remote","--heads","origin",t])).trim().length>0}catch{return!1}}async pushUpstream(t){await this.git.cwd(this.clonePath),await this.git.push("origin",t,{"--set-upstream":null})}async overwriteLocalContents(t){let[r,n]=await Promise.all([(0,Hxe.readdir)(t),(0,Hxe.readdir)(this.clonePath)]);await Promise.all(n.filter(i=>!NLl.includes(i)).map(async i=>{await(0,Hxe.rm)((0,JLt.resolve)(this.clonePath,i),{recursive:!0,force:!0})})),await Promise.all(r.filter(i=>!NLl.includes(i)).map(async i=>{let o=(0,JLt.resolve)(t,i);await(0,Hxe.cp)(o,(0,JLt.resolve)(this.clonePath,i),{recursive:!0})}))}async readFile({relativeFilePath:t}){let r=JLt.default.join(this.clonePath,t);if(await MLl(r))return await(0,Hxe.readFile)(r,"utf-8")}};async function MLl(e){try{return await(0,Hxe.lstat)(e),!0}catch{return!1}}var VZr=require("child_process");var QLl=We(CM(),1);function LMe(e){let t=DLl,r,n;e.startsWith("https://")&&(e=e.replace("https://","")),e.endsWith(".git")&&(e=e.slice(0,-4));let i=e.split("/");if(i.length===2&&i[0]!=null&&i[1]!=null)[r,n]=i;else if(i.length===3&&i[0]!=null&&i[1]!=null&&i[2]!=null)[t,r,n]=i;else throw new Error(`Failed to parse GitHub repostiory ${e}`);return PQA({remote:t,owner:r,repo:n})}function PQA({remote:e,owner:t,repo:r}){let n=EQA({remote:e,owner:t,repo:r}),i=IQA({remote:e,owner:t,repo:r});return{remote:e,owner:t,repo:r,repoUrl:n,cloneUrl:i,getAuthedCloneUrl:o=>i.replace("https://",`https://x-access-token:${o}@`)}}function EQA({remote:e,owner:t,repo:r}){return`https://${e}/${t}/${r}`}function IQA({remote:e,owner:t,repo:r}){return`https://${e}/${t}/${r}.git`}function xQA(e){return e.replace(/\/\/[^@]+@/,"//[REDACTED]@")}function jQA(){try{return(0,VZr.execSync)("git --version",{encoding:"utf-8",stdio:"pipe"}),!0}catch{return!1}}function zLl(){let e=[];try{let t=process.platform==="win32"?"where git":"which git",r=(0,VZr.execSync)(`${t} 2>/dev/null || echo 'not found'`,{encoding:"utf-8"}).trim();e.push(`git path: ${r}`)}catch{e.push("git path: unable to determine")}try{let t=(0,VZr.execSync)("git --version 2>/dev/null || echo 'unknown'",{encoding:"utf-8"}).trim();e.push(`version: ${t}`)}catch{e.push("version: unknown")}try{let t=(0,VZr.execSync)("test -f /.dockerenv && echo 'yes' || echo 'no'",{encoding:"utf-8"}).trim()==="yes";e.push(`in container: ${t}`)}catch{e.push("in container: unknown")}return e.push(`PATH: ${process.env.PATH??"unset"}`),e.join(", ")}async function ems({githubRepository:e,installationToken:t,targetDirectory:r,timeoutMs:n}){let i=LMe(e),o=t!=null?i.getAuthedCloneUrl(t):i.cloneUrl,a=r??(await QLl.default.dir()).path,s=xQA(o);if(!jQA()){let u=zLl();throw new Error(`Git is not installed or not found in PATH. Self-hosted GitHub mode requires git to be installed on the host machine where the Fern CLI runs. Please install git and ensure it is available in your PATH. Repository: ${e}. Debug info: ${u}`)}let c=Yei(a,{timeout:n!=null?{block:n}:void 0}),l=Date.now();try{await c.clone(o,".")}catch(u){let p=Date.now()-l,d=u instanceof Error?u.message:String(u);if(d.includes("ENOENT")||d.includes("spawn git")){let m=zLl();throw new Error(`Failed to clone repository: git command not found. Self-hosted GitHub mode requires git to be installed on the host machine where the Fern CLI runs. URL: ${s}. Elapsed: ${p}ms. Debug info: ${m}. Original error: ${d}`)}throw d.includes("Authentication failed")||d.includes("could not read Username")||d.includes("401")||d.includes("403")?new Error(`Failed to clone repository: authentication failed. Ensure your GitHub token is set and has access to the repository. URL: ${s}. Elapsed: ${p}ms. Original error: ${d}`):d.includes("Repository not found")||d.includes("not found")||d.includes("404")?new Error(`Failed to clone repository: repository not found. Check that ${e} exists and your token has access. URL: ${s}. Elapsed: ${p}ms. Original error: ${d}`):d.includes("Connection refused")||d.includes("Connection timed out")||d.includes("Could not resolve host")||d.includes("unable to access")?new Error(`Failed to clone repository: network error. Check network connectivity and proxy settings. URL: ${s}. Elapsed: ${p}ms. Original error: ${d}`):new Error(`Failed to clone repository ${e}. URL: ${s}. Elapsed: ${p}ms. Original error: ${d}`)}return new KLt({clonePath:a,git:c})}var uA=We(Yit(),1),tms=We(Md(),1),VLl=require("fs/promises"),kLl=We(require("path"),1);var ULl={shouldUseTitleAsName:void 0,shouldUseUndiscriminatedUnionsWithLiterals:void 0,shouldUseIdiomaticRequestNames:void 0,asyncApiMessageNaming:void 0,onlyIncludeReferencedSchemas:void 0,shouldUseOptionalAdditionalProperties:void 0,coerceEnumsToLiterals:void 0,objectQueryParameters:void 0,respectReadonlySchemas:void 0,respectNullableSchemas:void 0,inlinePathParameters:void 0,useBytesForBinaryResponse:void 0,respectForwardCompatibleEnums:void 0,filter:void 0,exampleGeneration:void 0,defaultFormParameterEncoding:void 0,additionalPropertiesDefaultsTo:void 0,typeDatesAsStrings:void 0,preserveSingleSchemaOneOf:void 0,inlineAllOfSchemas:void 0,resolveAliases:void 0,groupMultiApiEnvironments:void 0,groupEnvironmentsByHost:void 0,wrapReferencesToNullableInOptional:void 0,coerceOptionalSchemasToNullable:void 0,removeDiscriminantsFromSchemas:void 0,pathParameterOrder:void 0,defaultIntegerFormat:void 0,resolveSchemaCollisions:void 0};async function LLl({absolutePathToGeneratorsConfiguration:e,rawGeneratorsConfiguration:t,context:r}){let n=JLl(t.metadata),i=t.readme;kQA(r,t);let o=await BQA(t);return{absolutePathToConfiguration:e,api:o,rawConfiguration:t,defaultGroup:t["default-group"],groupAliases:t.aliases??{},reviewers:t.reviewers,groups:t.groups!=null?await Promise.all(Object.entries(t.groups).map(([a,s])=>DQA({absolutePathToGeneratorsConfiguration:e,groupName:a,group:s,maybeTopLevelMetadata:n,maybeTopLevelReviewers:t.reviewers,readme:i}))):[],whitelabel:t.whitelabel!=null&&t.whitelabel.github!=null?{github:t.whitelabel.github}:void 0,ai:t.ai}}function Xei(e){return{...ULl,shouldUseTitleAsName:e?.["use-title"],shouldUseUndiscriminatedUnionsWithLiterals:e?.unions==="v1",asyncApiMessageNaming:e?.["message-naming"],respectNullableSchemas:e?.["respect-nullable-schemas"],wrapReferencesToNullableInOptional:e?.["wrap-references-to-nullable-in-optional"],coerceOptionalSchemasToNullable:e?.["coerce-optional-schemas-to-nullable"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],inlinePathParameters:e?.["inline-path-parameters"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"],removeDiscriminantsFromSchemas:GLl(e?.["remove-discriminants-from-schemas"]),pathParameterOrder:e?.["path-parameter-order"]}}function WLl(e){return{...Zei(e),shouldUseUndiscriminatedUnionsWithLiterals:e?.["prefer-undiscriminated-unions-with-literals"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],objectQueryParameters:e?.["object-query-parameters"],respectReadonlySchemas:e?.["respect-readonly-schemas"],inlinePathParameters:e?.["inline-path-parameters"],filter:e?.filter,exampleGeneration:e?.["example-generation"],defaultFormParameterEncoding:e?.["default-form-parameter-encoding"],useBytesForBinaryResponse:e?.["use-bytes-for-binary-response"],respectForwardCompatibleEnums:e?.["respect-forward-compatible-enums"],additionalPropertiesDefaultsTo:e?.["additional-properties-defaults-to"],typeDatesAsStrings:e?.["type-dates-as-strings"],preserveSingleSchemaOneOf:e?.["preserve-single-schema-oneof"],inlineAllOfSchemas:e?.["inline-all-of-schemas"],resolveAliases:e?.["resolve-aliases"],groupMultiApiEnvironments:e?.["group-multi-api-environments"],groupEnvironmentsByHost:e?.["group-environments-by-host"],defaultIntegerFormat:e?.["default-integer-format"],pathParameterOrder:e?.["path-parameter-order"]}}function CQA(e){return{...Zei(e),asyncApiMessageNaming:e?.["message-naming"]}}function Zei(e){return{...ULl,shouldUseTitleAsName:e?.["title-as-schema-name"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"],shouldUseOptionalAdditionalProperties:e?.["optional-additional-properties"],coerceEnumsToLiterals:e?.["coerce-enums-to-literals"],respectNullableSchemas:e?.["respect-nullable-schemas"],wrapReferencesToNullableInOptional:e?.["wrap-references-to-nullable-in-optional"],coerceOptionalSchemasToNullable:e?.["coerce-optional-schemas-to-nullable"],groupEnvironmentsByHost:e?.["group-environments-by-host"],groupMultiApiEnvironments:e!=null&&"group-multi-api-environments"in e?e["group-multi-api-environments"]:void 0,removeDiscriminantsFromSchemas:GLl(e?.["remove-discriminants-from-schemas"]),pathParameterOrder:e?.["path-parameter-order"],resolveSchemaCollisions:e?.["resolve-schema-collisions"]}}function GLl(e){if(e==null||e==="always")return vi.RemoveDiscriminantsFromSchemas.Always;if(e==="never")return vi.RemoveDiscriminantsFromSchemas.Never;throw new Error(`Unknown value for generators.yml API setting: remove-discriminants-from-schemas: ${e}`)}function mbt(e,t){return{...e,...Object.fromEntries(Object.entries(t).filter(([r,n])=>n!==void 0))}}async function qLl(e,t,r){let n=[];if(e!=null)if(typeof e=="string")n.push({schema:{type:"oss",path:e},origin:void 0,overrides:void 0,overlays:void 0,audiences:[],settings:r});else if(vi.isRawProtobufAPIDefinitionSchema(e))n.push({schema:{type:"protobuf",root:e.proto.root,target:e.proto.target??"",localGeneration:e.proto["local-generation"]??!1,fromOpenAPI:e.proto["from-openapi"]??!1,dependencies:e.proto.dependencies??[]},origin:void 0,overrides:e.proto.overrides,overlays:void 0,audiences:[],settings:r});else if(Array.isArray(e))for(let i of e)typeof i=="string"?n.push({schema:{type:"oss",path:i},origin:void 0,overrides:void 0,overlays:void 0,audiences:[],settings:r}):vi.isRawProtobufAPIDefinitionSchema(i)?n.push({schema:{type:"protobuf",root:i.proto.root,target:i.proto.target??"",localGeneration:i.proto["local-generation"]??!1,fromOpenAPI:i.proto["from-openapi"]??!1,dependencies:i.proto.dependencies??[]},origin:void 0,overrides:i.proto.overrides,overlays:void 0,audiences:[],settings:r}):n.push({schema:{type:"oss",path:i.path},origin:i.origin,overrides:i.overrides,overlays:void 0,audiences:i.audiences,settings:mbt(r,Xei(i.settings))});else n.push({schema:{type:"oss",path:e.path},origin:e.origin,overrides:e.overrides,overlays:void 0,audiences:e.audiences,settings:mbt(r,Xei(e.settings))});else{let i=t[vi.API_SETTINGS_KEY],o=t[vi.OPENAPI_LOCATION_KEY],a=t[vi.API_ORIGIN_LOCATION_KEY],s=t[vi.OPENAPI_OVERRIDES_LOCATION_KEY],c=t[vi.ASYNC_API_LOCATION_KEY];o!=null&&(typeof o=="string"?n.push({schema:{type:"oss",path:o},origin:a,overrides:s,overlays:void 0,audiences:[],settings:mbt(r,Xei(i))}):typeof o=="object"&&n.push({schema:{type:"oss",path:o.path},origin:o.origin,overrides:o.overrides,overlays:void 0,audiences:[],settings:mbt(r,WLl(o.settings))})),c!=null&&n.push({schema:{type:"oss",path:c},origin:a,overrides:void 0,overlays:void 0,audiences:[],settings:mbt(r,Xei(i))})}return n}async function SQA({apiConfiguration:e,rawConfiguration:t,apiSettings:r}){let n={"auth-schemes":t["auth-schemes"],...e};if(vi.isConjureSchema(e.specs))return{type:"conjure",pathToConjureDefinition:e.specs.conjure,...n,settings:r};let i=[],o={};for(let a of e.specs??[]){let s;if(vi.isOpenApiSpecSchema(a))s={schema:{type:"oss",path:a.openapi},origin:a.origin,overrides:a.overrides,overlays:a.overlays,audiences:[],settings:mbt(r,WLl(a.settings))};else if(vi.isAsyncApiSpecSchema(a))s={schema:{type:"oss",path:a.asyncapi},origin:a.origin,overrides:a.overrides,overlays:void 0,audiences:[],settings:mbt(r,CQA(a.settings))};else if(vi.isProtoSpecSchema(a))s={schema:{type:"protobuf",root:a.proto.root,target:a.proto.target??"",localGeneration:a.proto["local-generation"]??!1,fromOpenAPI:a.proto["from-openapi"]??!1,dependencies:a.proto.dependencies??[]},origin:void 0,overrides:a.proto.overrides,overlays:void 0,audiences:[],settings:r};else if(vi.isOpenRpcSpecSchema(a))s={schema:{type:"openrpc",path:a.openrpc},origin:void 0,overrides:a.overrides,overlays:void 0,audiences:[],settings:r};else if(vi.isGraphQLSpecSchema(a))s={schema:{type:"graphql",path:a.graphql},origin:a.origin,overrides:a.overrides,overlays:void 0,audiences:[],settings:r};else continue;let c=vi.isGraphQLSpecSchema(a)&&"resource"in a?a.resource:"namespace"in a?a.namespace:void 0;c!=null?(o[c]??=[],o[c].push(s)):i.push(s)}return Object.keys(o).length===0?{type:"singleNamespace",definitions:i,...n,settings:r}:{type:"multiNamespace",rootDefinitions:i,definitions:o,...n,settings:r}}async function BQA(e){let t=e.api;if(t!=null){if(vi.isApiConfigurationV2Schema(t)){let n=Zei(t.settings);return SQA({apiConfiguration:t,rawConfiguration:e,apiSettings:n})}if(vi.isNamespacedApiConfiguration(t)){let n={},i={};for(let[o,a]of Object.entries(t.namespaces))n[o]=await qLl(a,e,i);return{type:"multiNamespace",rootDefinitions:void 0,definitions:n}}}return{type:"singleNamespace",definitions:await qLl(t,e,{})}}async function DQA({absolutePathToGeneratorsConfiguration:e,groupName:t,group:r,maybeTopLevelMetadata:n,maybeTopLevelReviewers:i,readme:o}){let a=JLl(r.metadata);return{groupName:t,reviewers:r.reviewers,audiences:r.audiences==null?{type:"all"}:{type:"select",audiences:r.audiences},generators:await Promise.all(r.generators.map(s=>TQA({absolutePathToGeneratorsConfiguration:e,generator:s,maybeTopLevelMetadata:n,maybeGroupLevelMetadata:a,maybeTopLevelReviewers:i,maybeGroupLevelReviewers:r.reviewers,readme:o})))}}async function TQA({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n,maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o,readme:a}){let s=TR(t.name);return{raw:t,name:s,version:t.version,config:t.config,outputMode:await NQA({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n,maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o}),keywords:t.keywords,smartCasing:t["smart-casing"]??!0,disableExamples:t["disable-examples"]??!1,absolutePathToLocalOutput:t.output?.location==="local-file-system"?Ys(Fi(e),t.output.path):void 0,absolutePathToLocalSnippets:t.snippets?.path!=null?Ys(Fi(e),t.snippets.path):void 0,language:QQA(s),irVersionOverride:t["ir-version"]??void 0,publishMetadata:RQA({generatorInvocation:t}),readme:a,settings:t.api?.settings??void 0,apiOverride:t.api?.specs!=null||t.api?.auth!=null||t.api?.["auth-schemes"]!=null?{specs:t.api?.specs,auth:t.api?.auth,"auth-schemes":t.api?.["auth-schemes"]}:void 0}}function RQA({generatorInvocation:e}){let t=e["publish-metadata"];if(t!=null)return{packageDescription:t["package-description"],publisherEmail:t.email,publisherName:t.author,referenceUrl:t["reference-url"]};if(e.metadata!=null)return{packageDescription:e.metadata["package-description"],publisherEmail:e.metadata.email,publisherName:e.metadata.author,referenceUrl:e.metadata["reference-url"]}}function HLl({pypiOutputMetadata:e,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r}){let n;return e!=null&&(n=VQA(e),n={...r,...t,...n}),n}function FQA({topLevelReviewers:e,groupLevelReviewers:t,outputModeReviewers:r}){let n=new Set,i=new Set,o=[],a=[...e?.teams??[],...t?.teams??[],...r?.teams??[]],s=[...e?.users??[],...t?.users??[],...r?.users??[]];for(let c of a)n.has(c.name)||(o.push(tms.GithubPullRequestReviewer.team({name:c.name})),n.add(c.name));for(let c of s)i.has(c.name)||(o.push(tms.GithubPullRequestReviewer.user({name:c.name})),i.add(c.name));return o}async function NQA({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r={},maybeTopLevelMetadata:n={},maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o}){let a=t.snippets!=null&&t.snippets.path!=="";if(t.github){let s=kZr(t.github)?t.github.uri:t.github.repository,{owner:c,repo:l}=LMe(s),u=t.output!=null?zQA(t.output,r,n):void 0,p=qQA(t),d=p!=null?await MQA({absolutePathToGeneratorsConfiguration:e,githubLicense:p}):void 0,m=t.github.mode??"release";switch(m){case"commit":case"release":return uA.FernFiddle.OutputMode.githubV2(uA.FernFiddle.GithubOutputModeV2.commitAndRelease({owner:c,repo:l,license:d,publishInfo:u,downloadSnippets:a}));case"pull-request":{let h=t.github,y=FQA({topLevelReviewers:o,groupLevelReviewers:i,outputModeReviewers:h.reviewers});return uA.FernFiddle.OutputMode.githubV2(uA.FernFiddle.GithubOutputModeV2.pullRequest({owner:c,repo:l,license:d,publishInfo:u,downloadSnippets:a,reviewers:y,branch:h.branch}))}case"push":return uA.FernFiddle.OutputMode.githubV2(uA.FernFiddle.GithubOutputModeV2.push({owner:c,repo:l,branch:t.github.mode==="push"?t.github.branch:void 0,license:d,publishInfo:u,downloadSnippets:a}));default:qe(m)}}if(t.output==null)return uA.FernFiddle.remoteGen.OutputMode.publish({registryOverrides:{}});switch(t.output.location){case"local-file-system":return uA.FernFiddle.OutputMode.downloadFiles({downloadSnippets:a});case"npm":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.npmOverride({registryUrl:t.output.url??"https://registry.npmjs.org",packageName:t.output["package-name"],token:t.output.token??"",downloadSnippets:a}));case"maven":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.mavenOverride({registryUrl:$Ll(t.output),username:t.output.username??"",password:t.output.password??"",coordinate:t.output.coordinate,signature:t.output.signature!=null?{keyId:t.output.signature.keyId,secretKey:t.output.signature.secretKey,password:t.output.signature.password}:void 0,downloadSnippets:a}));case"postman":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.postman({apiKey:t.output["api-key"],workspaceId:t.output["workspace-id"]}));case"pypi":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.pypiOverride({registryUrl:t.output.url??"https://upload.pypi.org/legacy/",username:t.output.token!=null?"__token__":t.output.password??"",password:t.output.token??t.output.password??"",coordinate:t.output["package-name"],downloadSnippets:a,pypiMetadata:HLl({pypiOutputMetadata:t.output.metadata,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n})}));case"nuget":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.nugetOverride({registryUrl:t.output.url??"https://nuget.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:a}));case"rubygems":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.rubyGemsOverride({registryUrl:t.output.url??"https://rubygems.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:a}));case"crates":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.cratesOverride({registryUrl:t.output.url??"https://crates.io/api/v1/crates",packageName:t.output["package-name"],token:t.output.token??"",downloadSnippets:a}));default:qe(t.output)}}async function MQA({absolutePathToGeneratorsConfiguration:e,githubLicense:t}){if(typeof t=="string")switch(t){case"MIT":return uA.FernFiddle.GithubLicense.basic({id:uA.FernFiddle.GithubLicenseId.Mit});case"Apache-2.0":return uA.FernFiddle.GithubLicense.basic({id:uA.FernFiddle.GithubLicenseId.Apache});default:qe(t)}let r=vt(xr.of(kLl.default.dirname(e)),Xe.of(t.custom)),n=await(0,VLl.readFile)(r);return uA.FernFiddle.GithubLicense.custom({contents:n.toString()})}function zQA(e,t,r){switch(e.location){case"local-file-system":throw new Error("Cannot use local-file-system with github publishing");case"npm":return uA.FernFiddle.GithubPublishInfo.npm({registryUrl:e.url??"https://registry.npmjs.org",packageName:e["package-name"],token:e.token});case"maven":return uA.FernFiddle.GithubPublishInfo.maven({registryUrl:$Ll(e),coordinate:e.coordinate,credentials:e.username!=null&&e.password!=null?{username:e.username,password:e.password}:void 0,signature:e.signature!=null?{keyId:e.signature.keyId,password:e.signature.password,secretKey:e.signature.secretKey}:void 0});case"postman":return uA.FernFiddle.GithubPublishInfo.postman({apiKey:e["api-key"],workspaceId:e["workspace-id"]});case"pypi":return uA.FernFiddle.GithubPublishInfo.pypi({registryUrl:e.url??"https://upload.pypi.org/legacy/",packageName:e["package-name"],credentials:e.token!=null?{username:"__token__",password:e.token}:{username:e.username??"",password:e.password??""},pypiMetadata:HLl({pypiOutputMetadata:e.metadata,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r})});case"nuget":return uA.FernFiddle.GithubPublishInfo.nuget({registryUrl:e.url??"https://nuget.org/",packageName:e["package-name"],apiKey:e["api-key"]});case"rubygems":return uA.FernFiddle.GithubPublishInfo.rubygems({registryUrl:e.url??"https://rubygems.org/",packageName:e["package-name"],apiKey:e["api-key"]});case"crates":return uA.FernFiddle.GithubPublishInfo.crates({registryUrl:e.url??"https://crates.io/api/v1/crates",packageName:e["package-name"],token:e.token});default:qe(e)}}function QQA(e){if(e.includes("csharp"))return vi.GenerationLanguage.CSHARP;if(e.includes("go"))return vi.GenerationLanguage.GO;if(e.includes("java")||e.includes("spring"))return vi.GenerationLanguage.JAVA;if(e.includes("php"))return vi.GenerationLanguage.PHP;if(e.includes("python")||e.includes("fastapi")||e.includes("pydantic"))return vi.GenerationLanguage.PYTHON;if(e.includes("ruby"))return vi.GenerationLanguage.RUBY;if(e.includes("swift"))return vi.GenerationLanguage.SWIFT;if(e.includes("typescript"))return vi.GenerationLanguage.TYPESCRIPT}function $Ll(e){return e.url!=null?e.url:e.signature!=null?"https://oss.sonatype.org/service/local/staging/deploy/maven2/":"https://s01.oss.sonatype.org/content/repositories/releases/"}function qQA(e){return e["publish-metadata"]?.license!=null?e["publish-metadata"].license:e.metadata?.license!=null?e.metadata.license:kZr(e.github)&&e.github.license!=null?e.github.license:e.github?.license}function JLl(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email}))}:void 0}function VQA(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email})),keywords:e.keywords,documentationLink:e["documentation-link"],homepageLink:e["homepage-link"]}:void 0}function kQA(e,t){let r=[];t["api-settings"]!=null&&r.push('"api-settings" is deprecated. Please use "api.settings" for global defaults or "api.specs[].settings" for spec-specific settings instead.'),t["async-api"]!=null&&r.push('"async-api" is deprecated. Please use "api.specs[].asyncapi" instead.'),t.openapi!=null&&r.push('"openapi" is deprecated. Please use "api.specs[].openapi" instead.'),t["openapi-overrides"]!=null&&r.push('"openapi-overrides" is deprecated. Please use "api.specs[].overrides" instead.'),t["spec-origin"]&&r.push('"spec-origin" is deprecated. Please use "api.specs[].origin" instead.'),t.api!=null&&(typeof t.api=="string"&&r.push('Using an OpenAPI or AsyncAPI path string for "api" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),Array.isArray(t.api)?r.push('Using an array for "api" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" instead.'):typeof t.api=="object"&&("path"in t.api&&r.push('Using "api.path" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),"proto"in t.api&&r.push('Using "api.proto" is deprecated. Please use "api.specs[].proto" instead.'),"namespaces"in t.api&&r.push('Using "api.namespaces" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" with the "namespace" property instead.'))),r.length>0&&(e.logger.warn("Warnings for generators.yml:"),e.logger.warn(" "+r.join(`
1538
+ `).map(JzA).filter(Boolean);t||r.sort(function(i,o){let a=i.split("."),s=o.split(".");if(a.length===1||s.length===1)return $zA(Sei(a[0]),Sei(s[0]));for(let c=0,l=Math.max(a.length,s.length);c<l;c++){let u=jLl(Sei(a[c]),Sei(s[c]));if(u)return u}return 0});let n=t?r[0]:[...r].reverse().find(i=>i.indexOf(".")>=0);return new w4l(r,n)}}}),SLl={};YC(SLl,{addAnnotatedTagTask:()=>ZzA,addTagTask:()=>XzA,tagListTask:()=>YzA});function YzA(e=[]){let t=e.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...e],parser(r){return CLl(r,t)}}}function XzA(e){return{format:"utf-8",commands:["tag",e],parser(){return{name:e}}}}function ZzA(e,t){return{format:"utf-8",commands:["tag","-a","-m",t,e],parser(){return{name:e}}}}var eQA=pa({"src/lib/tasks/tag.ts"(){"use strict";KzA()}}),tQA=yNA({"src/git.js"(e,t){"use strict";var{GitExecutor:r}=(rMA(),Lj(v2l)),{SimpleGitApi:n}=(ezA(),Lj(tLl)),{Scheduler:i}=(tzA(),Lj(rLl)),{configurationErrorTask:o}=(KC(),Lj(Ods)),{asArray:a,filterArray:s,filterPrimitives:c,filterString:l,filterStringOrStringArray:u,filterType:p,getTrailingOptions:d,trailingFunctionArgument:m,trailingOptionsArgument:h}=(Sf(),Lj(L4l)),{applyPatchTask:y}=(nzA(),Lj(oLl)),{branchTask:g,branchLocalTask:b,deleteBranchesTask:_,deleteBranchTask:O}=(mzA(),Lj(fLl)),{checkIgnoreTask:A}=(bzA(),Lj(yLl)),{checkIsRepoTask:v}=($4l(),Lj(W4l)),{cloneTask:P,cloneMirrorTask:I}=(vzA(),Lj(gLl)),{cleanWithOptionsTask:E,isCleanOptionsArray:x}=(o2l(),Lj(n2l)),{diffSummaryTask:T}=(Jds(),Lj(R2l)),{fetchTask:W}=(IzA(),Lj(_Ll)),{moveTask:H}=(SzA(),Lj(OLl)),{pullTask:G}=(DzA(),Lj(wLl)),{pushTagsTask:ie}=(J2l(),Lj($2l)),{addRemoteTask:oe,getRemotesTask:$,listRemotesTask:te,remoteTask:Ge,removeRemoteTask:Ke}=(VzA(),Lj(ELl)),{getResetMode:X,resetTask:Y}=(g2l(),Lj(m2l)),{stashListTask:Be}=(UzA(),Lj(ILl)),{addSubModuleTask:Pe,initSubModuleTask:ke,subModuleTask:Ye,updateSubModuleTask:Oe}=(HzA(),Lj(xLl)),{addAnnotatedTagTask:he,addTagTask:pt,tagListTask:mt}=(eQA(),Lj(SLl)),{straightThroughBufferTask:br,straightThroughStringTask:Yt}=(KC(),Lj(Ods));function Wt(Xt,Se){this._plugins=Se,this._executor=new r(Xt.baseDir,new i(Xt.maxConcurrentProcesses),Se),this._trimmed=Xt.trimmed}(Wt.prototype=Object.create(n.prototype)).constructor=Wt,Wt.prototype.customBinary=function(Xt){return this._plugins.reconfigure("binary",Xt),this},Wt.prototype.env=function(Xt,Se){return arguments.length===1&&typeof Xt=="object"?this._executor.env=Xt:(this._executor.env=this._executor.env||{})[Xt]=Se,this},Wt.prototype.stashList=function(Xt){return this._runTask(Be(h(arguments)||{},s(Xt)&&Xt||[]),m(arguments))};function or(Xt,Se,Ze,Dt){return typeof Ze!="string"?o(`git.${Xt}() requires a string 'repoPath'`):Se(Ze,p(Dt,l),d(arguments))}Wt.prototype.clone=function(){return this._runTask(or("clone",P,...arguments),m(arguments))},Wt.prototype.mirror=function(){return this._runTask(or("mirror",I,...arguments),m(arguments))},Wt.prototype.mv=function(Xt,Se){return this._runTask(H(Xt,Se),m(arguments))},Wt.prototype.checkoutLatestTag=function(Xt){var Se=this;return this.pull(function(){Se.tags(function(Ze,Dt){Se.checkout(Dt.latest,Xt)})})},Wt.prototype.pull=function(Xt,Se,Ze,Dt){return this._runTask(G(p(Xt,l),p(Se,l),d(arguments)),m(arguments))},Wt.prototype.fetch=function(Xt,Se){return this._runTask(W(p(Xt,l),p(Se,l),d(arguments)),m(arguments))},Wt.prototype.silent=function(Xt){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},Wt.prototype.tags=function(Xt,Se){return this._runTask(mt(d(arguments)),m(arguments))},Wt.prototype.rebase=function(){return this._runTask(Yt(["rebase",...d(arguments)]),m(arguments))},Wt.prototype.reset=function(Xt){return this._runTask(Y(X(Xt),d(arguments)),m(arguments))},Wt.prototype.revert=function(Xt){let Se=m(arguments);return typeof Xt!="string"?this._runTask(o("Commit must be a string"),Se):this._runTask(Yt(["revert",...d(arguments,0,!0),Xt]),Se)},Wt.prototype.addTag=function(Xt){let Se=typeof Xt=="string"?pt(Xt):o("Git.addTag requires a tag name");return this._runTask(Se,m(arguments))},Wt.prototype.addAnnotatedTag=function(Xt,Se){return this._runTask(he(Xt,Se),m(arguments))},Wt.prototype.deleteLocalBranch=function(Xt,Se,Ze){return this._runTask(O(Xt,typeof Se=="boolean"?Se:!1),m(arguments))},Wt.prototype.deleteLocalBranches=function(Xt,Se,Ze){return this._runTask(_(Xt,typeof Se=="boolean"?Se:!1),m(arguments))},Wt.prototype.branch=function(Xt,Se){return this._runTask(g(d(arguments)),m(arguments))},Wt.prototype.branchLocal=function(Xt){return this._runTask(b(),m(arguments))},Wt.prototype.raw=function(Xt){let Se=!Array.isArray(Xt),Ze=[].slice.call(Se?arguments:Xt,0);for(let Pt=0;Pt<Ze.length&&Se;Pt++)if(!c(Ze[Pt])){Ze.splice(Pt,Ze.length-Pt);break}Ze.push(...d(arguments,0,!0));var Dt=m(arguments);return Ze.length?this._runTask(Yt(Ze,this._trimmed),Dt):this._runTask(o("Raw: must supply one or more command to execute"),Dt)},Wt.prototype.submoduleAdd=function(Xt,Se,Ze){return this._runTask(Pe(Xt,Se),m(arguments))},Wt.prototype.submoduleUpdate=function(Xt,Se){return this._runTask(Oe(d(arguments,!0)),m(arguments))},Wt.prototype.submoduleInit=function(Xt,Se){return this._runTask(ke(d(arguments,!0)),m(arguments))},Wt.prototype.subModule=function(Xt,Se){return this._runTask(Ye(d(arguments)),m(arguments))},Wt.prototype.listRemote=function(){return this._runTask(te(d(arguments)),m(arguments))},Wt.prototype.addRemote=function(Xt,Se,Ze){return this._runTask(oe(Xt,Se,d(arguments)),m(arguments))},Wt.prototype.removeRemote=function(Xt,Se){return this._runTask(Ke(Xt),m(arguments))},Wt.prototype.getRemotes=function(Xt,Se){return this._runTask($(Xt===!0),m(arguments))},Wt.prototype.remote=function(Xt,Se){return this._runTask(Ge(d(arguments)),m(arguments))},Wt.prototype.tag=function(Xt,Se){let Ze=d(arguments);return Ze[0]!=="tag"&&Ze.unshift("tag"),this._runTask(Yt(Ze),m(arguments))},Wt.prototype.updateServerInfo=function(Xt){return this._runTask(Yt(["update-server-info"]),m(arguments))},Wt.prototype.pushTags=function(Xt,Se){let Ze=ie({remote:p(Xt,l)},d(arguments));return this._runTask(Ze,m(arguments))},Wt.prototype.rm=function(Xt){return this._runTask(Yt(["rm","-f",...a(Xt)]),m(arguments))},Wt.prototype.rmKeepLocal=function(Xt){return this._runTask(Yt(["rm","--cached",...a(Xt)]),m(arguments))},Wt.prototype.catFile=function(Xt,Se){return this._catFile("utf-8",arguments)},Wt.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)},Wt.prototype._catFile=function(Xt,Se){var Ze=m(Se),Dt=["cat-file"],Pt=Se[0];if(typeof Pt=="string")return this._runTask(o("Git.catFile: options must be supplied as an array of strings"),Ze);Array.isArray(Pt)&&Dt.push.apply(Dt,Pt);let rt=Xt==="buffer"?br(Dt):Yt(Dt);return this._runTask(rt,Ze)},Wt.prototype.diff=function(Xt,Se){let Ze=l(Xt)?o("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):Yt(["diff",...d(arguments)]);return this._runTask(Ze,m(arguments))},Wt.prototype.diffSummary=function(){return this._runTask(T(d(arguments,1)),m(arguments))},Wt.prototype.applyPatch=function(Xt){let Se=u(Xt)?y(a(Xt),d([].slice.call(arguments,1))):o("git.applyPatch requires one or more string patches as the first argument");return this._runTask(Se,m(arguments))},Wt.prototype.revparse=function(){let Xt=["rev-parse",...d(arguments,!0)];return this._runTask(Yt(Xt,!0),m(arguments))},Wt.prototype.clean=function(Xt,Se,Ze){let Dt=x(Xt),Pt=Dt&&Xt.join("")||p(Xt,l)||"",rt=d([].slice.call(arguments,Dt?1:0));return this._runTask(E(Pt,rt),m(arguments))},Wt.prototype.exec=function(Xt){let Se={commands:[],format:"utf-8",parser(){typeof Xt=="function"&&Xt()}};return this._runTask(Se)},Wt.prototype.clearQueue=function(){return this},Wt.prototype.checkIgnore=function(Xt,Se){return this._runTask(A(a(p(Xt,u,[]))),m(arguments))},Wt.prototype.checkIsRepo=function(Xt,Se){return this._runTask(v(p(Xt,l)),m(arguments))},t.exports=Wt}});FZr();dbt();var rQA=class extends Bat{constructor(e,t){super(void 0,t),this.config=e}};dbt();dbt();var Sat=class extends Bat{constructor(e,t,r){super(e,r),this.task=e,this.plugin=t,Object.setPrototypeOf(this,new.target.prototype)}};tmr();C4l();$4l();o2l();u2l();l2l();d2l();g2l();function nQA(e){return e?[{type:"spawn.before",action(n,i){e.aborted&&i.kill(new Sat(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(n,i){function o(){i.kill(new Sat(void 0,"abort","Abort signal received"))}e.addEventListener("abort",o),i.spawned.on("close",()=>e.removeEventListener("abort",o))}}]:void 0}function iQA(e){return typeof e=="string"&&e.trim().toLowerCase()==="-c"}function oQA(e,t){if(iQA(e)&&/^\s*protocol(.[a-z]+)?.allow/.test(t))throw new Sat(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function aQA(e,t){if(/^\s*--(upload|receive)-pack/.test(e))throw new Sat(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(t==="clone"&&/^\s*-u\b/.test(e))throw new Sat(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(t==="push"&&/^\s*--exec\b/.test(e))throw new Sat(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function sQA({allowUnsafeProtocolOverride:e=!1,allowUnsafePack:t=!1}={}){return{type:"spawn.args",action(r,n){return r.forEach((i,o)=>{let a=o<r.length?r[o+1]:"";e||oQA(i,a),t||aQA(i,n.method)}),r}}}Sf();function uQA(e){let t=TZr(e,"-c");return{type:"spawn.args",action(r){return[...t,...r]}}}Sf();var P4l=(0,Zdr.deferred)().promise;function cQA({onClose:e=!0,onExit:t=50}={}){function r(){let i=-1,o={close:(0,Zdr.deferred)(),closeTimeout:(0,Zdr.deferred)(),exit:(0,Zdr.deferred)(),exitTimeout:(0,Zdr.deferred)()},a=Promise.race([e===!1?P4l:o.closeTimeout.promise,t===!1?P4l:o.exitTimeout.promise]);return n(e,o.close,o.closeTimeout),n(t,o.exit,o.exitTimeout),{close(s){i=s,o.close.done()},exit(s){i=s,o.exit.done()},get exitCode(){return i},result:a}}function n(i,o,a){i!==!1&&(i===!0?o.promise:o.promise.then(()=>yds(i))).then(a.done)}return{type:"spawn.after",async action(i,{spawned:o,close:a}){let s=r(),c=!0,l=()=>{c=!1};o.stdout?.on("data",l),o.stderr?.on("data",l),o.on("error",l),o.on("close",u=>s.close(u)),o.on("exit",u=>s.exit(u));try{await s.result,c&&await yds(50),a(s.exitCode)}catch(u){a(s.exitCode,u)}}}}Sf();var lQA="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",E4l="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function pQA(e){return!e||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(e)}function I4l(e,t){if(e.length<1||e.length>2)throw new Sat(void 0,"binary",lQA);if(e.some(pQA))if(t)console.warn(E4l);else throw new Sat(void 0,"binary",E4l);let[n,i]=e;return{binary:n,prefix:i}}function fQA(e,t=["git"],r=!1){let n=I4l(UMe(t),r);e.on("binary",i=>{n=I4l(UMe(i),r)}),e.append("spawn.binary",()=>n.binary),e.append("spawn.args",i=>n.prefix?[n.prefix,...i]:i)}dbt();function dQA(e){return!!(e.exitCode&&e.stdErr.length)}function mQA(e){return Buffer.concat([...e.stdOut,...e.stdErr])}function hQA(e=!1,t=dQA,r=mQA){return(n,i)=>!e&&n||!t(i)?n:r(i)}function x4l(e){return{type:"task.error",action(t,r){let n=e(t.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return Buffer.isBuffer(n)?{error:new Bat(void 0,n.toString("utf-8"))}:{error:n}}}}Sf();var yQA=class{constructor(){this.plugins=new Set,this.events=new BLl.EventEmitter}on(e,t){this.events.on(e,t)}reconfigure(e,t){this.events.emit(e,t)}append(e,t){let r=Fv(this.plugins,{type:e,action:t});return()=>this.plugins.delete(r)}add(e){let t=[];return UMe(e).forEach(r=>r&&this.plugins.add(Fv(t,r))),()=>{t.forEach(r=>this.plugins.delete(r))}}exec(e,t,r){let n=t,i=Object.freeze(Object.create(r));for(let o of this.plugins)o.type===e&&(n=o.action(n,i));return n}};Sf();function gQA(e){let t="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(o,a){return r.includes(a.method)?N4l(o,t):o}},{type:"spawn.after",action(o,a){a.commands.includes(t)&&a.spawned.stderr?.on("data",s=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(s.toString("utf8"));c&&e({method:a.method,stage:bQA(c[1]),progress:HP(c[2]),processed:HP(c[3]),total:HP(c[4])})})}}]}function bQA(e){return String(e.toLowerCase().split(" ",1))||"unknown"}Sf();function AQA(e){let t=z4l(e,["uid","gid"]);return{type:"spawn.options",action(r){return{...t,...r}}}}function _QA({block:e,stdErr:t=!0,stdOut:r=!0}){if(e>0)return{type:"spawn.after",action(n,i){let o;function a(){o&&clearTimeout(o),o=setTimeout(c,e)}function s(){i.spawned.stdout?.off("data",a),i.spawned.stderr?.off("data",a),i.spawned.off("exit",s),i.spawned.off("close",s),o&&clearTimeout(o)}function c(){s(),i.kill(new Sat(void 0,"timeout","block timeout reached"))}r&&i.spawned.stdout?.on("data",a),t&&i.spawned.stderr?.on("data",a),i.spawned.on("exit",s),i.spawned.on("close",s),a()}}}FZr();function vQA(){return{type:"spawn.args",action(e){let t=[],r;function n(i){(r=r||[]).push(...i)}for(let i=0;i<e.length;i++){let o=e[i];if(Fei(o)){n(YUl(o));continue}if(o==="--"){n(e.slice(i+1).flatMap(a=>Fei(a)&&YUl(a)||a));break}t.push(o)}return r?[...t,"--",...r.map(String)]:t}}}Sf();var OQA=tQA();function wQA(e,t){let r=new yQA,n=k4l(e&&(typeof e=="string"?{baseDir:e}:e)||{},t);if(!Tds(n.baseDir))throw new rQA(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&r.add(uQA(n.config)),r.add(sQA(n.unsafe)),r.add(vQA()),r.add(cQA(n.completion)),n.abort&&r.add(nQA(n.abort)),n.progress&&r.add(gQA(n.progress)),n.timeout&&r.add(_QA(n.timeout)),n.spawnOptions&&r.add(AQA(n.spawnOptions)),r.add(x4l(hQA(!0))),n.errors&&r.add(x4l(n.errors)),fQA(r,n.binary,n.unsafe?.allowUnsafeCustomBinary),new OQA(n,r)}tmr();var Yei=wQA;var DLl="github.com",TLl="README.md";var Zds=".fernignore",RLl=".gitignore",FLl=".git";var NLl=[Zds,RLl,FLl],KLt=class e{clonePath;git;constructor({clonePath:t,git:r}){this.clonePath=t,this.git=r}async setUserAndEmail({name:t,email:r}){await this.git.cwd(this.clonePath),await this.git.addConfig("user.name",t),await this.git.addConfig("user.email",r)}static createAtPath(t){return new e({clonePath:t,git:Yei(t)})}async getDefaultBranch(){await this.git.cwd(this.clonePath);let t=await this.git.remote(["show","origin"]);if(t==null)throw new Error("Could not determine default branch");let r=t.match(/HEAD branch: (.+)/);if(!r?.[1])throw new Error("Could not determine default branch");return r[1].trim()}async getCurrentBranch(){return await this.git.cwd(this.clonePath),(await this.git.branchLocal()).current}async getReadme(){return await this.readFile({relativeFilePath:TLl})}async getFernignore(){return await this.readFile({relativeFilePath:Zds})}async add(t){await this.git.cwd(this.clonePath),await this.git.add(t)}async fileExists({relativeFilePath:t}){return await MLl(JLt.default.join(this.clonePath,t))}async restoreFiles({files:t,staged:r}){await this.git.cwd(this.clonePath);let n=["restore","--source=HEAD"];r&&n.push("--staged"),await this.git.raw([...n,...Array.isArray(t)?t:[t]])}async commit(t){await this.git.cwd(this.clonePath),await this.git.commit(t??"Automated commit",void 0,{"--allow-empty":null})}async commitAllChanges(t){await this.git.cwd(this.clonePath),await this.git.add("."),await this.commit(t)}async checkout(t){await this.git.cwd(this.clonePath);try{await this.git.checkout(t)}catch{await this.git.checkoutLocalBranch(t),await this.git.push("origin",t,{"--set-upstream":null})}}async pull(t){await this.git.cwd(this.clonePath),await this.git.pull("origin",t)}async pullWithMerge(t){await this.git.cwd(this.clonePath),await this.git.raw(["pull","origin",t,"--no-rebase"])}async push(){await this.git.cwd(this.clonePath);let t=await this.getCurrentBranch();try{await this.git.push()}catch(r){let n=String(r);if(n.includes("has no upstream branch")||n.includes("no upstream branch")){await this.pushUpstream(t);return}throw r}}async pushWithMergingRemote(){await this.git.cwd(this.clonePath);let t=await this.getCurrentBranch(),r=i=>i.includes("fetch first")||i.includes("Updates were rejected")||i.includes("non-fast-forward"),n=i=>i.includes("divergent branches")||i.includes("You have divergent branches");try{await this.push()}catch(i){let o=String(i);if(r(o))try{await this.pull(t),await this.push();return}catch(a){let s=String(a);if(n(s))try{await this.pullWithMerge(t),await this.push();return}catch{throw i}else throw i}else throw i}}async pushWithRebasingRemote(){await this.git.cwd(this.clonePath);let t=await this.getCurrentBranch(),r=n=>n.includes("fetch first")||n.includes("Updates were rejected")||n.includes("non-fast-forward");try{await this.push()}catch(n){let i=String(n);if(r(i))try{await this.git.raw(["pull","origin",t,"--rebase"]),await this.push();return}catch(o){throw new Error(`Push failed: ${i}. Attempted to rebase but that also failed: ${String(o)}`)}else throw n}}async isRemoteEmpty(){await this.git.cwd(this.clonePath);try{return(await this.git.raw(["ls-remote","--heads","origin"])).trim().length===0}catch{return!0}}async checkoutOrCreateLocal(t){await this.git.cwd(this.clonePath);try{await this.git.checkout(t)}catch{await this.git.checkoutLocalBranch(t)}}async checkoutRemoteBranch(t){await this.git.cwd(this.clonePath);try{await this.git.checkout(t)}catch{try{await this.git.checkout(["-b",t,`origin/${t}`])}catch{await this.git.checkoutLocalBranch(t)}}}async remoteBranchExists(t){await this.git.cwd(this.clonePath);try{return(await this.git.raw(["ls-remote","--heads","origin",t])).trim().length>0}catch{return!1}}async pushUpstream(t){await this.git.cwd(this.clonePath),await this.git.push("origin",t,{"--set-upstream":null})}async overwriteLocalContents(t){let[r,n]=await Promise.all([(0,Hxe.readdir)(t),(0,Hxe.readdir)(this.clonePath)]);await Promise.all(n.filter(i=>!NLl.includes(i)).map(async i=>{await(0,Hxe.rm)((0,JLt.resolve)(this.clonePath,i),{recursive:!0,force:!0})})),await Promise.all(r.filter(i=>!NLl.includes(i)).map(async i=>{let o=(0,JLt.resolve)(t,i);await(0,Hxe.cp)(o,(0,JLt.resolve)(this.clonePath,i),{recursive:!0})}))}async readFile({relativeFilePath:t}){let r=JLt.default.join(this.clonePath,t);if(await MLl(r))return await(0,Hxe.readFile)(r,"utf-8")}};async function MLl(e){try{return await(0,Hxe.lstat)(e),!0}catch{return!1}}var VZr=require("child_process");var QLl=We(CM(),1);function LMe(e){let t=DLl,r,n;e.startsWith("https://")&&(e=e.replace("https://","")),e.endsWith(".git")&&(e=e.slice(0,-4));let i=e.split("/");if(i.length===2&&i[0]!=null&&i[1]!=null)[r,n]=i;else if(i.length===3&&i[0]!=null&&i[1]!=null&&i[2]!=null)[t,r,n]=i;else throw new Error(`Failed to parse GitHub repostiory ${e}`);return PQA({remote:t,owner:r,repo:n})}function PQA({remote:e,owner:t,repo:r}){let n=EQA({remote:e,owner:t,repo:r}),i=IQA({remote:e,owner:t,repo:r});return{remote:e,owner:t,repo:r,repoUrl:n,cloneUrl:i,getAuthedCloneUrl:o=>i.replace("https://",`https://x-access-token:${o}@`)}}function EQA({remote:e,owner:t,repo:r}){return`https://${e}/${t}/${r}`}function IQA({remote:e,owner:t,repo:r}){return`https://${e}/${t}/${r}.git`}function xQA(e){return e.replace(/\/\/[^@]+@/,"//[REDACTED]@")}function jQA(){try{return(0,VZr.execSync)("git --version",{encoding:"utf-8",stdio:"pipe"}),!0}catch{return!1}}function zLl(){let e=[];try{let t=process.platform==="win32"?"where git":"which git",r=(0,VZr.execSync)(`${t} 2>/dev/null || echo 'not found'`,{encoding:"utf-8"}).trim();e.push(`git path: ${r}`)}catch{e.push("git path: unable to determine")}try{let t=(0,VZr.execSync)("git --version 2>/dev/null || echo 'unknown'",{encoding:"utf-8"}).trim();e.push(`version: ${t}`)}catch{e.push("version: unknown")}try{let t=(0,VZr.execSync)("test -f /.dockerenv && echo 'yes' || echo 'no'",{encoding:"utf-8"}).trim()==="yes";e.push(`in container: ${t}`)}catch{e.push("in container: unknown")}return e.push(`PATH: ${process.env.PATH??"unset"}`),e.join(", ")}async function ems({githubRepository:e,installationToken:t,targetDirectory:r,timeoutMs:n}){let i=LMe(e),o=t!=null?i.getAuthedCloneUrl(t):i.cloneUrl,a=r??(await QLl.default.dir()).path,s=xQA(o);if(!jQA()){let u=zLl();throw new Error(`Git is not installed or not found in PATH. Self-hosted GitHub mode requires git to be installed on the host machine where the Fern CLI runs. Please install git and ensure it is available in your PATH. Repository: ${e}. Debug info: ${u}`)}let c=Yei(a,{timeout:n!=null?{block:n}:void 0}),l=Date.now();try{await c.clone(o,".")}catch(u){let p=Date.now()-l,d=u instanceof Error?u.message:String(u);if(d.includes("ENOENT")||d.includes("spawn git")){let m=zLl();throw new Error(`Failed to clone repository: git command not found. Self-hosted GitHub mode requires git to be installed on the host machine where the Fern CLI runs. URL: ${s}. Elapsed: ${p}ms. Debug info: ${m}. Original error: ${d}`)}throw d.includes("Authentication failed")||d.includes("could not read Username")||d.includes("401")||d.includes("403")?new Error(`Failed to clone repository: authentication failed. Ensure your GitHub token is set and has access to the repository. URL: ${s}. Elapsed: ${p}ms. Original error: ${d}`):d.includes("Repository not found")||d.includes("not found")||d.includes("404")?new Error(`Failed to clone repository: repository not found. Check that ${e} exists and your token has access. URL: ${s}. Elapsed: ${p}ms. Original error: ${d}`):d.includes("Connection refused")||d.includes("Connection timed out")||d.includes("Could not resolve host")||d.includes("unable to access")?new Error(`Failed to clone repository: network error. Check network connectivity and proxy settings. URL: ${s}. Elapsed: ${p}ms. Original error: ${d}`):new Error(`Failed to clone repository ${e}. URL: ${s}. Elapsed: ${p}ms. Original error: ${d}`)}return new KLt({clonePath:a,git:c})}var uA=We(Yit(),1),tms=We(Md(),1),VLl=require("fs/promises"),kLl=We(require("path"),1);var ULl={shouldUseTitleAsName:void 0,shouldUseUndiscriminatedUnionsWithLiterals:void 0,shouldUseIdiomaticRequestNames:void 0,asyncApiMessageNaming:void 0,onlyIncludeReferencedSchemas:void 0,shouldUseOptionalAdditionalProperties:void 0,coerceEnumsToLiterals:void 0,objectQueryParameters:void 0,respectReadonlySchemas:void 0,respectNullableSchemas:void 0,inlinePathParameters:void 0,useBytesForBinaryResponse:void 0,respectForwardCompatibleEnums:void 0,filter:void 0,exampleGeneration:void 0,defaultFormParameterEncoding:void 0,additionalPropertiesDefaultsTo:void 0,typeDatesAsStrings:void 0,preserveSingleSchemaOneOf:void 0,inlineAllOfSchemas:void 0,resolveAliases:void 0,groupMultiApiEnvironments:void 0,groupEnvironmentsByHost:void 0,wrapReferencesToNullableInOptional:void 0,coerceOptionalSchemasToNullable:void 0,removeDiscriminantsFromSchemas:void 0,pathParameterOrder:void 0,defaultIntegerFormat:void 0,resolveSchemaCollisions:void 0};async function LLl({absolutePathToGeneratorsConfiguration:e,rawGeneratorsConfiguration:t,context:r}){let n=JLl(t.metadata),i=t.readme;kQA(r,t);let o=await BQA(t);return{absolutePathToConfiguration:e,api:o,rawConfiguration:t,defaultGroup:t["default-group"],groupAliases:t.aliases??{},reviewers:t.reviewers,groups:t.groups!=null?await Promise.all(Object.entries(t.groups).map(([a,s])=>DQA({absolutePathToGeneratorsConfiguration:e,groupName:a,group:s,maybeTopLevelMetadata:n,maybeTopLevelReviewers:t.reviewers,readme:i}))):[],whitelabel:t.whitelabel!=null&&t.whitelabel.github!=null?{github:t.whitelabel.github}:void 0,ai:t.ai}}function Xei(e){return{...ULl,shouldUseTitleAsName:e?.["use-title"],shouldUseUndiscriminatedUnionsWithLiterals:e?.unions==="v1",asyncApiMessageNaming:e?.["message-naming"],respectNullableSchemas:e?.["respect-nullable-schemas"],wrapReferencesToNullableInOptional:e?.["wrap-references-to-nullable-in-optional"],coerceOptionalSchemasToNullable:e?.["coerce-optional-schemas-to-nullable"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],inlinePathParameters:e?.["inline-path-parameters"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"],removeDiscriminantsFromSchemas:GLl(e?.["remove-discriminants-from-schemas"]),pathParameterOrder:e?.["path-parameter-order"]}}function WLl(e){return{...Zei(e),shouldUseUndiscriminatedUnionsWithLiterals:e?.["prefer-undiscriminated-unions-with-literals"],onlyIncludeReferencedSchemas:e?.["only-include-referenced-schemas"],objectQueryParameters:e?.["object-query-parameters"],respectReadonlySchemas:e?.["respect-readonly-schemas"],inlinePathParameters:e?.["inline-path-parameters"],filter:e?.filter,exampleGeneration:e?.["example-generation"],defaultFormParameterEncoding:e?.["default-form-parameter-encoding"],useBytesForBinaryResponse:e?.["use-bytes-for-binary-response"],respectForwardCompatibleEnums:e?.["respect-forward-compatible-enums"],additionalPropertiesDefaultsTo:e?.["additional-properties-defaults-to"],typeDatesAsStrings:e?.["type-dates-as-strings"],preserveSingleSchemaOneOf:e?.["preserve-single-schema-oneof"],inlineAllOfSchemas:e?.["inline-all-of-schemas"],resolveAliases:e?.["resolve-aliases"],groupMultiApiEnvironments:e?.["group-multi-api-environments"],groupEnvironmentsByHost:e?.["group-environments-by-host"],defaultIntegerFormat:e?.["default-integer-format"],pathParameterOrder:e?.["path-parameter-order"]}}function CQA(e){return{...Zei(e),asyncApiMessageNaming:e?.["message-naming"]}}function Zei(e){return{...ULl,shouldUseTitleAsName:e?.["title-as-schema-name"],shouldUseIdiomaticRequestNames:e?.["idiomatic-request-names"],shouldUseOptionalAdditionalProperties:e?.["optional-additional-properties"],coerceEnumsToLiterals:e?.["coerce-enums-to-literals"],respectNullableSchemas:e?.["respect-nullable-schemas"],wrapReferencesToNullableInOptional:e?.["wrap-references-to-nullable-in-optional"],coerceOptionalSchemasToNullable:e?.["coerce-optional-schemas-to-nullable"],groupEnvironmentsByHost:e?.["group-environments-by-host"],groupMultiApiEnvironments:e!=null&&"group-multi-api-environments"in e?e["group-multi-api-environments"]:void 0,removeDiscriminantsFromSchemas:GLl(e?.["remove-discriminants-from-schemas"]),pathParameterOrder:e?.["path-parameter-order"],resolveSchemaCollisions:e?.["resolve-schema-collisions"]}}function GLl(e){if(e==null||e==="always")return vi.RemoveDiscriminantsFromSchemas.Always;if(e==="never")return vi.RemoveDiscriminantsFromSchemas.Never;throw new Error(`Unknown value for generators.yml API setting: remove-discriminants-from-schemas: ${e}`)}function mbt(e,t){return{...e,...Object.fromEntries(Object.entries(t).filter(([r,n])=>n!==void 0))}}async function qLl(e,t,r){let n=[];if(e!=null)if(typeof e=="string")n.push({schema:{type:"oss",path:e},origin:void 0,overrides:void 0,overlays:void 0,audiences:[],settings:r});else if(vi.isRawProtobufAPIDefinitionSchema(e))n.push({schema:{type:"protobuf",root:e.proto.root,target:e.proto.target??"",localGeneration:e.proto["local-generation"]??!1,fromOpenAPI:e.proto["from-openapi"]??!1,dependencies:e.proto.dependencies??[]},origin:void 0,overrides:e.proto.overrides,overlays:void 0,audiences:[],settings:r});else if(Array.isArray(e))for(let i of e)typeof i=="string"?n.push({schema:{type:"oss",path:i},origin:void 0,overrides:void 0,overlays:void 0,audiences:[],settings:r}):vi.isRawProtobufAPIDefinitionSchema(i)?n.push({schema:{type:"protobuf",root:i.proto.root,target:i.proto.target??"",localGeneration:i.proto["local-generation"]??!1,fromOpenAPI:i.proto["from-openapi"]??!1,dependencies:i.proto.dependencies??[]},origin:void 0,overrides:i.proto.overrides,overlays:void 0,audiences:[],settings:r}):n.push({schema:{type:"oss",path:i.path},origin:i.origin,overrides:i.overrides,overlays:void 0,audiences:i.audiences,settings:mbt(r,Xei(i.settings))});else n.push({schema:{type:"oss",path:e.path},origin:e.origin,overrides:e.overrides,overlays:void 0,audiences:e.audiences,settings:mbt(r,Xei(e.settings))});else{let i=t[vi.API_SETTINGS_KEY],o=t[vi.OPENAPI_LOCATION_KEY],a=t[vi.API_ORIGIN_LOCATION_KEY],s=t[vi.OPENAPI_OVERRIDES_LOCATION_KEY],c=t[vi.ASYNC_API_LOCATION_KEY];o!=null&&(typeof o=="string"?n.push({schema:{type:"oss",path:o},origin:a,overrides:s,overlays:void 0,audiences:[],settings:mbt(r,Xei(i))}):typeof o=="object"&&n.push({schema:{type:"oss",path:o.path},origin:o.origin,overrides:o.overrides,overlays:void 0,audiences:[],settings:mbt(r,WLl(o.settings))})),c!=null&&n.push({schema:{type:"oss",path:c},origin:a,overrides:void 0,overlays:void 0,audiences:[],settings:mbt(r,Xei(i))})}return n}async function SQA({apiConfiguration:e,rawConfiguration:t,apiSettings:r}){let n={"auth-schemes":t["auth-schemes"],...e};if(vi.isConjureSchema(e.specs))return{type:"conjure",pathToConjureDefinition:e.specs.conjure,...n,settings:r};let i=[],o={};for(let a of e.specs??[]){let s;if(vi.isOpenApiSpecSchema(a))s={schema:{type:"oss",path:a.openapi},origin:a.origin,overrides:a.overrides,overlays:a.overlays,audiences:[],settings:mbt(r,WLl(a.settings))};else if(vi.isAsyncApiSpecSchema(a))s={schema:{type:"oss",path:a.asyncapi},origin:a.origin,overrides:a.overrides,overlays:void 0,audiences:[],settings:mbt(r,CQA(a.settings))};else if(vi.isProtoSpecSchema(a))s={schema:{type:"protobuf",root:a.proto.root,target:a.proto.target??"",localGeneration:a.proto["local-generation"]??!1,fromOpenAPI:a.proto["from-openapi"]??!1,dependencies:a.proto.dependencies??[]},origin:void 0,overrides:a.proto.overrides,overlays:void 0,audiences:[],settings:r};else if(vi.isOpenRpcSpecSchema(a))s={schema:{type:"openrpc",path:a.openrpc},origin:void 0,overrides:a.overrides,overlays:void 0,audiences:[],settings:r};else if(vi.isGraphQLSpecSchema(a))s={schema:{type:"graphql",path:a.graphql},origin:a.origin,overrides:a.overrides,overlays:void 0,audiences:[],settings:r};else continue;let c=vi.isGraphQLSpecSchema(a)&&"name"in a?a.name:"namespace"in a?a.namespace:void 0;c!=null?(o[c]??=[],o[c].push(s)):i.push(s)}return Object.keys(o).length===0?{type:"singleNamespace",definitions:i,...n,settings:r}:{type:"multiNamespace",rootDefinitions:i,definitions:o,...n,settings:r}}async function BQA(e){let t=e.api;if(t!=null){if(vi.isApiConfigurationV2Schema(t)){let n=Zei(t.settings);return SQA({apiConfiguration:t,rawConfiguration:e,apiSettings:n})}if(vi.isNamespacedApiConfiguration(t)){let n={},i={};for(let[o,a]of Object.entries(t.namespaces))n[o]=await qLl(a,e,i);return{type:"multiNamespace",rootDefinitions:void 0,definitions:n}}}return{type:"singleNamespace",definitions:await qLl(t,e,{})}}async function DQA({absolutePathToGeneratorsConfiguration:e,groupName:t,group:r,maybeTopLevelMetadata:n,maybeTopLevelReviewers:i,readme:o}){let a=JLl(r.metadata);return{groupName:t,reviewers:r.reviewers,audiences:r.audiences==null?{type:"all"}:{type:"select",audiences:r.audiences},generators:await Promise.all(r.generators.map(s=>TQA({absolutePathToGeneratorsConfiguration:e,generator:s,maybeTopLevelMetadata:n,maybeGroupLevelMetadata:a,maybeTopLevelReviewers:i,maybeGroupLevelReviewers:r.reviewers,readme:o})))}}async function TQA({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n,maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o,readme:a}){let s=TR(t.name);return{raw:t,name:s,version:t.version,config:t.config,outputMode:await NQA({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n,maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o}),keywords:t.keywords,smartCasing:t["smart-casing"]??!0,disableExamples:t["disable-examples"]??!1,absolutePathToLocalOutput:t.output?.location==="local-file-system"?Ys(Fi(e),t.output.path):void 0,absolutePathToLocalSnippets:t.snippets?.path!=null?Ys(Fi(e),t.snippets.path):void 0,language:QQA(s),irVersionOverride:t["ir-version"]??void 0,publishMetadata:RQA({generatorInvocation:t}),readme:a,settings:t.api?.settings??void 0,apiOverride:t.api?.specs!=null||t.api?.auth!=null||t.api?.["auth-schemes"]!=null?{specs:t.api?.specs,auth:t.api?.auth,"auth-schemes":t.api?.["auth-schemes"]}:void 0}}function RQA({generatorInvocation:e}){let t=e["publish-metadata"];if(t!=null)return{packageDescription:t["package-description"],publisherEmail:t.email,publisherName:t.author,referenceUrl:t["reference-url"]};if(e.metadata!=null)return{packageDescription:e.metadata["package-description"],publisherEmail:e.metadata.email,publisherName:e.metadata.author,referenceUrl:e.metadata["reference-url"]}}function HLl({pypiOutputMetadata:e,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r}){let n;return e!=null&&(n=VQA(e),n={...r,...t,...n}),n}function FQA({topLevelReviewers:e,groupLevelReviewers:t,outputModeReviewers:r}){let n=new Set,i=new Set,o=[],a=[...e?.teams??[],...t?.teams??[],...r?.teams??[]],s=[...e?.users??[],...t?.users??[],...r?.users??[]];for(let c of a)n.has(c.name)||(o.push(tms.GithubPullRequestReviewer.team({name:c.name})),n.add(c.name));for(let c of s)i.has(c.name)||(o.push(tms.GithubPullRequestReviewer.user({name:c.name})),i.add(c.name));return o}async function NQA({absolutePathToGeneratorsConfiguration:e,generator:t,maybeGroupLevelMetadata:r={},maybeTopLevelMetadata:n={},maybeGroupLevelReviewers:i,maybeTopLevelReviewers:o}){let a=t.snippets!=null&&t.snippets.path!=="";if(t.github){let s=kZr(t.github)?t.github.uri:t.github.repository,{owner:c,repo:l}=LMe(s),u=t.output!=null?zQA(t.output,r,n):void 0,p=qQA(t),d=p!=null?await MQA({absolutePathToGeneratorsConfiguration:e,githubLicense:p}):void 0,m=t.github.mode??"release";switch(m){case"commit":case"release":return uA.FernFiddle.OutputMode.githubV2(uA.FernFiddle.GithubOutputModeV2.commitAndRelease({owner:c,repo:l,license:d,publishInfo:u,downloadSnippets:a}));case"pull-request":{let h=t.github,y=FQA({topLevelReviewers:o,groupLevelReviewers:i,outputModeReviewers:h.reviewers});return uA.FernFiddle.OutputMode.githubV2(uA.FernFiddle.GithubOutputModeV2.pullRequest({owner:c,repo:l,license:d,publishInfo:u,downloadSnippets:a,reviewers:y,branch:h.branch}))}case"push":return uA.FernFiddle.OutputMode.githubV2(uA.FernFiddle.GithubOutputModeV2.push({owner:c,repo:l,branch:t.github.mode==="push"?t.github.branch:void 0,license:d,publishInfo:u,downloadSnippets:a}));default:qe(m)}}if(t.output==null)return uA.FernFiddle.remoteGen.OutputMode.publish({registryOverrides:{}});switch(t.output.location){case"local-file-system":return uA.FernFiddle.OutputMode.downloadFiles({downloadSnippets:a});case"npm":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.npmOverride({registryUrl:t.output.url??"https://registry.npmjs.org",packageName:t.output["package-name"],token:t.output.token??"",downloadSnippets:a}));case"maven":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.mavenOverride({registryUrl:$Ll(t.output),username:t.output.username??"",password:t.output.password??"",coordinate:t.output.coordinate,signature:t.output.signature!=null?{keyId:t.output.signature.keyId,secretKey:t.output.signature.secretKey,password:t.output.signature.password}:void 0,downloadSnippets:a}));case"postman":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.postman({apiKey:t.output["api-key"],workspaceId:t.output["workspace-id"]}));case"pypi":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.pypiOverride({registryUrl:t.output.url??"https://upload.pypi.org/legacy/",username:t.output.token!=null?"__token__":t.output.password??"",password:t.output.token??t.output.password??"",coordinate:t.output["package-name"],downloadSnippets:a,pypiMetadata:HLl({pypiOutputMetadata:t.output.metadata,maybeGroupLevelMetadata:r,maybeTopLevelMetadata:n})}));case"nuget":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.nugetOverride({registryUrl:t.output.url??"https://nuget.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:a}));case"rubygems":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.rubyGemsOverride({registryUrl:t.output.url??"https://rubygems.org/",packageName:t.output["package-name"],apiKey:t.output["api-key"]??"",downloadSnippets:a}));case"crates":return uA.FernFiddle.OutputMode.publishV2(uA.FernFiddle.remoteGen.PublishOutputModeV2.cratesOverride({registryUrl:t.output.url??"https://crates.io/api/v1/crates",packageName:t.output["package-name"],token:t.output.token??"",downloadSnippets:a}));default:qe(t.output)}}async function MQA({absolutePathToGeneratorsConfiguration:e,githubLicense:t}){if(typeof t=="string")switch(t){case"MIT":return uA.FernFiddle.GithubLicense.basic({id:uA.FernFiddle.GithubLicenseId.Mit});case"Apache-2.0":return uA.FernFiddle.GithubLicense.basic({id:uA.FernFiddle.GithubLicenseId.Apache});default:qe(t)}let r=vt(xr.of(kLl.default.dirname(e)),Xe.of(t.custom)),n=await(0,VLl.readFile)(r);return uA.FernFiddle.GithubLicense.custom({contents:n.toString()})}function zQA(e,t,r){switch(e.location){case"local-file-system":throw new Error("Cannot use local-file-system with github publishing");case"npm":return uA.FernFiddle.GithubPublishInfo.npm({registryUrl:e.url??"https://registry.npmjs.org",packageName:e["package-name"],token:e.token});case"maven":return uA.FernFiddle.GithubPublishInfo.maven({registryUrl:$Ll(e),coordinate:e.coordinate,credentials:e.username!=null&&e.password!=null?{username:e.username,password:e.password}:void 0,signature:e.signature!=null?{keyId:e.signature.keyId,password:e.signature.password,secretKey:e.signature.secretKey}:void 0});case"postman":return uA.FernFiddle.GithubPublishInfo.postman({apiKey:e["api-key"],workspaceId:e["workspace-id"]});case"pypi":return uA.FernFiddle.GithubPublishInfo.pypi({registryUrl:e.url??"https://upload.pypi.org/legacy/",packageName:e["package-name"],credentials:e.token!=null?{username:"__token__",password:e.token}:{username:e.username??"",password:e.password??""},pypiMetadata:HLl({pypiOutputMetadata:e.metadata,maybeGroupLevelMetadata:t,maybeTopLevelMetadata:r})});case"nuget":return uA.FernFiddle.GithubPublishInfo.nuget({registryUrl:e.url??"https://nuget.org/",packageName:e["package-name"],apiKey:e["api-key"]});case"rubygems":return uA.FernFiddle.GithubPublishInfo.rubygems({registryUrl:e.url??"https://rubygems.org/",packageName:e["package-name"],apiKey:e["api-key"]});case"crates":return uA.FernFiddle.GithubPublishInfo.crates({registryUrl:e.url??"https://crates.io/api/v1/crates",packageName:e["package-name"],token:e.token});default:qe(e)}}function QQA(e){if(e.includes("csharp"))return vi.GenerationLanguage.CSHARP;if(e.includes("go"))return vi.GenerationLanguage.GO;if(e.includes("java")||e.includes("spring"))return vi.GenerationLanguage.JAVA;if(e.includes("php"))return vi.GenerationLanguage.PHP;if(e.includes("python")||e.includes("fastapi")||e.includes("pydantic"))return vi.GenerationLanguage.PYTHON;if(e.includes("ruby"))return vi.GenerationLanguage.RUBY;if(e.includes("swift"))return vi.GenerationLanguage.SWIFT;if(e.includes("typescript"))return vi.GenerationLanguage.TYPESCRIPT}function $Ll(e){return e.url!=null?e.url:e.signature!=null?"https://oss.sonatype.org/service/local/staging/deploy/maven2/":"https://s01.oss.sonatype.org/content/repositories/releases/"}function qQA(e){return e["publish-metadata"]?.license!=null?e["publish-metadata"].license:e.metadata?.license!=null?e.metadata.license:kZr(e.github)&&e.github.license!=null?e.github.license:e.github?.license}function JLl(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email}))}:void 0}function VQA(e){return e!=null?{description:e.description,authors:e.authors?.map(t=>({name:t.name,email:t.email})),keywords:e.keywords,documentationLink:e["documentation-link"],homepageLink:e["homepage-link"]}:void 0}function kQA(e,t){let r=[];t["api-settings"]!=null&&r.push('"api-settings" is deprecated. Please use "api.settings" for global defaults or "api.specs[].settings" for spec-specific settings instead.'),t["async-api"]!=null&&r.push('"async-api" is deprecated. Please use "api.specs[].asyncapi" instead.'),t.openapi!=null&&r.push('"openapi" is deprecated. Please use "api.specs[].openapi" instead.'),t["openapi-overrides"]!=null&&r.push('"openapi-overrides" is deprecated. Please use "api.specs[].overrides" instead.'),t["spec-origin"]&&r.push('"spec-origin" is deprecated. Please use "api.specs[].origin" instead.'),t.api!=null&&(typeof t.api=="string"&&r.push('Using an OpenAPI or AsyncAPI path string for "api" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),Array.isArray(t.api)?r.push('Using an array for "api" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" instead.'):typeof t.api=="object"&&("path"in t.api&&r.push('Using "api.path" is deprecated. Please use "api.specs[].openapi" or "api.specs[].asyncapi" instead.'),"proto"in t.api&&r.push('Using "api.proto" is deprecated. Please use "api.specs[].proto" instead.'),"namespaces"in t.api&&r.push('Using "api.namespaces" is deprecated. Please use "api.specs[].openapi", "api.specs[].asyncapi", or "api.specs[].proto" with the "namespace" property instead.'))),r.length>0&&(e.logger.warn("Warnings for generators.yml:"),e.logger.warn(" "+r.join(`
1539
1539
  `)))}function kZr(e){return e==null?!1:"uri"in e&&"token"in e}var KLl=require("fs/promises");var YLl=We(require("path"),1);async function nmr({absolutePathToWorkspace:e,context:t}){let r=await hbt({absolutePathToWorkspace:e});if(r==null)return;let n=await(0,KLl.readFile)(r);try{let i=Un.load(n.toString()),o=vi.serialization.GeneratorsConfigurationSchema.parse(i,{allowUnrecognizedEnumValues:!1,unrecognizedObjectKeys:"fail",allowUnrecognizedUnionMembers:!1,skipValidation:!1,breadcrumbsPrefix:void 0,omitUndefined:!1});if(o.ok)return o.value;throw new Error(o.errors.map(a=>a.message).join(`
1540
1540
  `))}catch(i){if(i instanceof Un.YAMLException){let a=`Failed to parse ${YLl.default.relative(process.cwd(),r)}: ${i.reason}`;i.mark!=null&&(a+=`
1541
1541
  at line ${i.mark.line+1}, column ${i.mark.column+1}`,i.mark.snippet&&(a+=`
@@ -2628,7 +2628,7 @@ For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides
2628
2628
  Run ${tt.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
2629
2629
  Run ${tt.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),gur(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function s8u({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!Cuy(e))return;let i=t??"",o=e.filter(s=>s.isUpgradeAvailable);r!=null&&(o=o.slice(0,r+1));let a=o.sort((s,c)=>s.generatorName.localeCompare(c.generatorName)||s.currentVersion.localeCompare(c.currentVersion));for(let s of a)i+=`
2630
2630
  ${await jRx(s.generatorName)} (${s.apiName!=null?"API: "+s.apiName+", ":""}Group: ${s.generatorGroup}) `+tt.dim(s.currentVersion)+tt.reset(" \u2192 ")+tt.green(s.latestVersion);return i+=`
2631
- `,n?gur(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function jRx(e){let r=await new juy.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new Error(`Generator ${e} not found`);return r.body.displayName}async function CRx({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let s={type:"singleApi",versions:{}};return await Buy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,l,u,p)=>{s.versions[l]==null&&(s.versions[l]={});let d=LLt(u.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${u.name}`);return}let m=await Gxe({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:o,context:p});m!=null&&(s.versions[l][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),s}let a={type:"multiApi",versions:{}};return await Buy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(s,c,l,u)=>{if(s==null)return;a.versions[s]==null&&(a.versions[s]={}),a.versions[s][c]==null&&(a.versions[s][c]={});let p=LLt(l.name);if(p==null){u.logger.debug(`Skipping unknown generator: ${l.name}`);return}let d=await Gxe({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:u});d!=null&&(a.versions[s][c][l.name]={previousVersion:l.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),a}async function Buy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async a=>{let s=await sK({absolutePathToWorkspace:o.absoluteFilePath,context:a});if(s==null||s.groups==null)return;let c=n!=null?TR(n):void 0;for(let l of s.groups)if(!(i!=null&&l.groupName!==i))for(let u of l.generators)c!=null&&u.name!==c||await r(o.workspaceName,l.groupName,u,a)})}))}function Duy(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[a,s]of Object.entries(o)){r.debug(`Checking if ${a} in group ${i} has an upgrade available...`);let c=J5(s.latestVersion,s.previousVersion);r.debug(`Latest version: ${s.latestVersion}. `+(c?"Upgrade available.":"No upgrade available.")),n.push({generatorName:a,generatorGroup:i,apiName:t,isUpgradeAvailable:c,currentVersion:s.previousVersion,latestVersion:s.latestVersion})}return n}async function mwa({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let a=[];if(e!=null){let s=await CRx({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(s.type==="multiApi")for(let[c,l]of Object.entries(s.versions))a.push(...Duy(l,c,t.logger));else a.push(...Duy(s.versions,void 0,t.logger))}return a}async function KQt({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:sYr(e.packageName,{version:t?"prerelease":"latest"})}var Tuy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],hwa=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=ho.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new D4t(t,r),this.isLocal=n??!1;let i=this.getPackageName(),o=this.getPackageVersion(),a=this.getCliName();(i==null||o==null||a==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:o,cliName:a}}getPackageName(){return"fern-api"}getPackageVersion(){return"3.70.2"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${tt.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new QP}failWithoutThrowing(t,r){this.didSucceed=!1,Y$r({message:t,error:r,logger:this.logger})}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await sur()).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 Suy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
2631
+ `,n?gur(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function jRx(e){let r=await new juy.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new Error(`Generator ${e} not found`);return r.body.displayName}async function CRx({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let s={type:"singleApi",versions:{}};return await Buy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,l,u,p)=>{s.versions[l]==null&&(s.versions[l]={});let d=LLt(u.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${u.name}`);return}let m=await Gxe({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:o,context:p});m!=null&&(s.versions[l][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),s}let a={type:"multiApi",versions:{}};return await Buy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(s,c,l,u)=>{if(s==null)return;a.versions[s]==null&&(a.versions[s]={}),a.versions[s][c]==null&&(a.versions[s][c]={});let p=LLt(l.name);if(p==null){u.logger.debug(`Skipping unknown generator: ${l.name}`);return}let d=await Gxe({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:u});d!=null&&(a.versions[s][c][l.name]={previousVersion:l.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),a}async function Buy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async a=>{let s=await sK({absolutePathToWorkspace:o.absoluteFilePath,context:a});if(s==null||s.groups==null)return;let c=n!=null?TR(n):void 0;for(let l of s.groups)if(!(i!=null&&l.groupName!==i))for(let u of l.generators)c!=null&&u.name!==c||await r(o.workspaceName,l.groupName,u,a)})}))}function Duy(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[a,s]of Object.entries(o)){r.debug(`Checking if ${a} in group ${i} has an upgrade available...`);let c=J5(s.latestVersion,s.previousVersion);r.debug(`Latest version: ${s.latestVersion}. `+(c?"Upgrade available.":"No upgrade available.")),n.push({generatorName:a,generatorGroup:i,apiName:t,isUpgradeAvailable:c,currentVersion:s.previousVersion,latestVersion:s.latestVersion})}return n}async function mwa({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let a=[];if(e!=null){let s=await CRx({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(s.type==="multiApi")for(let[c,l]of Object.entries(s.versions))a.push(...Duy(l,c,t.logger));else a.push(...Duy(s.versions,void 0,t.logger))}return a}async function KQt({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:sYr(e.packageName,{version:t?"prerelease":"latest"})}var Tuy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],hwa=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=ho.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new D4t(t,r),this.isLocal=n??!1;let i=this.getPackageName(),o=this.getPackageVersion(),a=this.getCliName();(i==null||o==null||a==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:o,cliName:a}}getPackageName(){return"fern-api"}getPackageVersion(){return"3.70.3"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${tt.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new QP}failWithoutThrowing(t,r){this.didSucceed=!1,Y$r({message:t,error:r,logger:this.logger})}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await sur()).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 Suy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
2632
2632
  `)||(r+=`
2633
2633
  `),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=q4a(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}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 T_n(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 o.message.includes("globalThis")?(n.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),n.failWithoutThrowing()):n.failWithoutThrowing(void 0,o),new QP}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await sur()).sendEvent(t)}logger=yU((t,...r)=>this.log(t,...r));stderr=yU((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=Ruy(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?Ruy(this.longestWorkspaceName):r).length,i=r.padEnd(n),o=Tuy[this.numTasks++%Tuy.length],a=tt.hex(o)(i);return{...this.constructTaskInit(),logPrefix:a}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===p_.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}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=>MM.indexOf(i.level)>=MM.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===ho.Debug,stderr:r})}_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 KQt({cliEnvironment:this.environment,includePreReleases:t}),n=J5(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},o=await mwa({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:o}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await o8u({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:tt.yellow("?"),style:{answer:i=>tt.cyan(i),message:i=>tt.bold(i),highlight:i=>tt.cyan(i)}}})}catch(n){throw n?.name==="ExitPromptError"?(this.logger.info(`
2634
2634
  Cancelled by user.`),new QP):n}}async getInput(t){return await r8u({message:t.message,default:t.default})}};function Ruy(e){return`[${e}]:`}var Fuy=require("fs/promises");async function u8u({context:e,nameOverride:t,...r}){let n=await pI(t);return n==null?e.failAndThrow(`Directory "${t??dP}" not found.`):await Nuy({absolutePathToFernDirectory:n,context:e,nameOverride:t,...r})}async function Nuy({absolutePathToFernDirectory:e,cliName:t,cliVersion:r,commandLineApiWorkspace:n,defaultToAllApiWorkspaces:i,context:o}){let a=[];(await un(vt(e,Xe.of(SU)))||await un(vt(e,Xe.of(sI)))||await un(vt(e,Xe.of(uI)))||await un(vt(e,Xe.of(rpr)))||await un(vt(e,Xe.of(yYr)))||await un(vt(e,Xe.of(kis))))&&(a=await Muy({cliName:t,fernDirectory:e,cliVersion:r,context:o,commandLineApiWorkspace:n,defaultToAllApiWorkspaces:i}));let s=await x1u({fernDirectory:e,context:o});return a.length===0&&s==null?o.failAndThrow(`No SDK specifications or docs specifications found. Please ensure one of the following .yml (not .yaml) files is present:
@@ -2664,7 +2664,7 @@ The generator configuration must be an object with a 'name' property, but the cu
2664
2664
 
2665
2665
  Please check your generators.yml file and ensure the generator is properly configured.`);let a=i,s=await Wuy({generatorName:t,logger:o});if(s==null)return;let c=BRx({migrations:s.migrations,from:r,to:n,logger:o});if(c.length!==0)return Guy({migrations:c,config:a,logger:o})}function Huy(e){return{"fernapi/fern-typescript-sdk":"https://buildwithfern.com/learn/sdks/generators/typescript/changelog","fernapi/fern-typescript-node-sdk":"https://buildwithfern.com/learn/sdks/generators/typescript/changelog","fernapi/fern-python-sdk":"https://buildwithfern.com/learn/sdks/generators/python/changelog","fernapi/fern-go-sdk":"https://buildwithfern.com/learn/sdks/generators/go/changelog","fernapi/fern-java-sdk":"https://buildwithfern.com/learn/sdks/generators/java/changelog","fernapi/fern-csharp-sdk":"https://buildwithfern.com/learn/sdks/generators/csharp/changelog","fernapi/fern-php-sdk":"https://buildwithfern.com/learn/sdks/generators/php/changelog","fernapi/fern-ruby-sdk":"https://buildwithfern.com/learn/sdks/generators/ruby/changelog","fernapi/fern-swift-sdk":"https://buildwithfern.com/learn/sdks/generators/swift/changelog"}[e]}async function TRx({absolutePathToWorkspace:e,context:t,generatorFilter:r,groupFilter:n,includeMajor:i,channel:o,cliVersion:a}){let s=await hbt({absolutePathToWorkspace:e});if(s==null||!await un(s))return t.logger.debug("Generators configuration file was not found, no generators to upgrade."),{updatedConfiguration:void 0,skippedMajorUpgrades:[],appliedUpgrades:[],alreadyUpToDate:[]};let c=await(0,bwa.readFile)(s);t.logger.debug(`Found generators: ${c.toString()}`);let l=n3r.default.parseDocument(c.toString()),u=l.get("groups");if(u==null)return t.logger.debug("No groups were found within the generators configuration, no generators to upgrade."),{updatedConfiguration:void 0,skippedMajorUpgrades:[],appliedUpgrades:[],alreadyUpToDate:[]};if(!n3r.default.isMap(u))return t.failAndThrow(`Expected 'groups' to be a map in ${F_n.default.relative(process.cwd(),s)}`),{updatedConfiguration:void 0,skippedMajorUpgrades:[],appliedUpgrades:[],alreadyUpToDate:[]};t.logger.debug(`Groups found: ${u.toString()}`);let p=[],d=[],m=[];for(let h of u.items){let y=h.key.value,g=h.value;if(!n3r.default.isMap(g)){t.failAndThrow(`Expected group ${y} to be a map in ${F_n.default.relative(process.cwd(),s)}`);continue}if(n!=null&&n!==y){t.logger.debug(`Skipping group ${y} as it does not match the filter: ${n}`);continue}let b=g.get("generators");if(!n3r.default.isSeq(b)){t.failAndThrow(`Expected group ${y} to have a 'generators' key in ${F_n.default.relative(process.cwd(),s)}`);continue}t.logger.debug(`Generators found: ${b.toString()}`);for(let _ of b.items){n3r.default.isMap(_)||t.failAndThrow(`Expected generator in group ${y} to be a map in ${F_n.default.relative(process.cwd(),s)}`);let O=_.get("name"),A=LLt(O);if(A==null){t.logger.warn(`Skipping unrecognized generator: ${O}. The generator will not be upgraded.`);continue}let v=r!=null?TR(r):void 0;if(v!=null&&A!==v){t.logger.debug(`Skipping generator ${O} as it does not match the filter: ${r}`);continue}let P=_.get("version"),I=await Gxe({generatorName:A,cliVersion:a,currentGeneratorVersion:P,channel:o,includeMajor:i,context:t}),E=I??P;if(I!=null)if(I!==P){t.logger.debug(tt.green(`Upgrading ${O} from ${P} to ${I}`)),_.set("version",I);let x=0,T=[],W=_.toJSON(),H=await c8u({generatorName:A,from:P,to:I,config:W,logger:t.logger});if(H!=null){x=H.migrationsApplied,T=H.appliedVersions;let G=new Set(Object.keys(W)),ie=new Set(Object.keys(H.config));for(let oe of G)ie.has(oe)||_.delete(oe);for(let[oe,$]of Object.entries(H.config))_.set(oe,$);t.logger.debug(tt.dim(`Applied ${x} migration(s): ${T.join(", ")}`))}d.push({generatorName:O,groupName:y,previousVersion:P,newVersion:I,migrationsApplied:x>0?x:void 0,migrationVersions:T.length>0?T:void 0})}else t.logger.debug(tt.gray(`${O} is already on the latest version: ${P}`)),m.push({generatorName:O,groupName:y,version:P});if(!i){let x=await Gxe({generatorName:A,cliVersion:a,currentGeneratorVersion:E,channel:o,includeMajor:!0,context:t});if(x!=null){let T=l8u.default.parse(E),W=l8u.default.parse(x);T!=null&&W!=null&&W.major>T.major&&p.push({generatorName:O,currentVersion:E,latestMajorVersion:x})}}}}return{updatedConfiguration:l.toString(),skippedMajorUpgrades:p,appliedUpgrades:d,alreadyUpToDate:m}}async function $uy({cliContext:e,generator:t,group:r,project:{apiWorkspaces:n},includeMajor:i,channel:o}){let a=[],s=[],c=[];if(await Promise.all(n.map(async l=>{await e.runTaskForWorkspace(l,async u=>{let p=await nmr({absolutePathToWorkspace:l.absoluteFilePath,context:u})??{};if(p==null||p.groups==null){u.logger.debug("No groups were found within the generators configuration, no generators to upgrade.");return}l.workspaceName==null?u.logger.info("Upgrading generators."):u.logger.info(`Upgrading generators in workspace: ${l.workspaceName}.`);let d=await TRx({absolutePathToWorkspace:l.absoluteFilePath,context:u,generatorFilter:t,groupFilter:r,includeMajor:i,channel:o,cliVersion:e.environment.packageVersion}),m=await hbt({absolutePathToWorkspace:l.absoluteFilePath});m!=null&&d.updatedConfiguration!=null&&await(0,bwa.writeFile)(m,d.updatedConfiguration),a.push(...d.skippedMajorUpgrades),d.appliedUpgrades.length>0&&s.push({workspace:l.workspaceName,upgrades:d.appliedUpgrades}),d.alreadyUpToDate.length>0&&c.push({workspace:l.workspaceName,upToDate:d.alreadyUpToDate})})})),s.length>0){e.logger.info(""),e.logger.info(tt.green("Successfully upgraded generators:"));for(let{workspace:l,upgrades:u}of s){let p=new Map;for(let d of u){let m=p.get(d.groupName)??[];m.push(d),p.set(d.groupName,m)}for(let[d,m]of p){let h=l!=null?`[${l}] `:"";e.logger.info(tt.green(`${h}Group ${d}:`));for(let y of m){e.logger.info(tt.green(` - ${y.generatorName}: ${tt.dim(y.previousVersion)} \u2192 ${y.newVersion}`)),y.migrationsApplied!=null&&y.migrationsApplied>0&&e.logger.info(tt.dim(` Applied ${y.migrationsApplied} migration(s): ${y.migrationVersions?.join(", ")??""}`));let g=Huy(TR(y.generatorName));g!=null&&e.logger.info(tt.dim(` Changelog: ${g}`))}}}}if(c.length>0){e.logger.info(""),e.logger.info(tt.dim("Generators already on latest version:"));for(let{workspace:l,upToDate:u}of c){let p=new Map;for(let d of u){let m=p.get(d.groupName)??[];m.push(d),p.set(d.groupName,m)}for(let[d,m]of p){let h=l!=null?`[${l}] `:"";e.logger.info(tt.dim(`${h}Group ${d}:`));for(let y of m)e.logger.info(tt.dim(` - ${y.generatorName}: ${y.version} (latest)`))}}}if(s.length===0&&c.length===0){let l=r!=null?` for group ${r}`:t!=null?` for generator ${t}`:"";e.logger.info(""),e.logger.info(tt.gray(`No generators found${l}.`))}if(a.length>0){e.logger.info(""),e.logger.info(tt.yellow("Major version upgrades available:"));for(let l of a){e.logger.info(tt.yellow(` - ${l.generatorName}: ${l.currentVersion} \u2192 ${l.latestMajorVersion}`));let u=t!=null?`fern generator upgrade --generator ${l.generatorName} --include-major`:"fern generator upgrade --include-major";e.logger.info(tt.yellow(` Run: ${u}`));let p=Huy(TR(l.generatorName));p!=null&&e.logger.info(tt.yellow(` Changelog: ${p}`))}}}function Yuy(e,t){e.command("organization",!1,r=>r.option("output",{string:!0,alias:"o",description:"The location to output the organization name as a text file, defaults to standard out."}),async r=>{await t.instrumentPostHogEvent({command:"fern organization",properties:{outputLocation:r.output}}),await Uuy({project:await ob(t,{commandLineApiWorkspace:void 0,defaultToAllApiWorkspaces:!0}),context:t,outputLocation:r.output})})}function Xuy(e,t){e.command("generator","Operate on the generators within your Fern configuration",r=>{r.command("list",!1,n=>n.option("output",{string:!0,alias:"o",description:"The location to output the list as a text file, defaults to standard out."}).option("generators",{string:!0,type:"array",description:"The type of generator to include in the list, ex: `fern-typescript-node-sdk`. If omitted, all generators will be listed."}).option("groups",{type:"array",string:!0,description:"The groups to include generators from, if group is not specified, the all generators of the specified type will be listed."}).option("apis",{type:"array",string:!0,description:"The APIs to list the generators for. If not specified, the generator will be upgraded for all APIs."}).option("api-fallback",{string:!0,description:"The APIs to list the generators for. If not specified, the generator will be upgraded for all APIs."}).option("include-mode",{choices:Object.values(r3r),type:"array",description:"The generator output modes to include within the outputted list."}).option("exclude-mode",{choices:Object.values(r3r),type:"array",description:"The generator output modes to exclude within the outputted list."}),async n=>{await t.instrumentPostHogEvent({command:"fern generator list",properties:{outputLocation:n.output}}),await quy({project:await ob(t,{commandLineApiWorkspace:void 0,defaultToAllApiWorkspaces:!0}),generatorFilter:n.generators?new Set(n.generators):void 0,groupFilter:n.groups?new Set(n.groups):void 0,apiFilter:n.apis?new Set(n.apis):void 0,apiKeyFallback:n.apiFallback,cliContext:t,outputLocation:n.output,includedModes:n["include-mode"]?new Set(n["include-mode"]):void 0,excludedModes:n["exclude-mode"]?new Set(n["exclude-mode"]):void 0})}).command("upgrade",`Upgrades the specified generator in ${uI} to the latest stable version.`,n=>n.option("generator",{string:!0,description:"The type of generator to upgrade, ex: `fern-typescript-node-sdk`."}).option("group",{string:!0,description:"The group in which the generator is located, if group is not specified, the all generators of the specified type will be upgraded."}).option("api",{string:!0,description:"The API to upgrade the generator for. If not specified, the generator will be upgraded for all APIs."}).option("yes",{alias:"y",boolean:!0,default:!1,description:"Automatically answer yes to any prompts that may appear during the upgrade process."}).option("include-major",{boolean:!0,default:!1,description:"Whether or not to include major versions within the upgrade. Defaults to false, meaning major versions will be skipped."}).option("channel",{demandOption:!1,choices:Object.values(Juy.FernRegistry.generators.ReleaseType)}).option("list",{demandOption:!1,boolean:!0,default:!1,description:"When specified, a list of available upgrades will be displayed, but no upgrade will be taken."}),async n=>{await t.instrumentPostHogEvent({command:"fern generator upgrade",properties:{generator:n.generator,version:n.version,api:n.api,group:n.group,includeMajor:n.includeMajor,rc:n.rc}});let i=await ob(t,{commandLineApiWorkspace:n.api,defaultToAllApiWorkspaces:!0});if(n.list){t.suppressUpgradeMessage();let o=await mwa({cliContext:t,project:i,generatorFilter:n.generator,groupFilter:n.group,includeMajor:n.includeMajor,channel:n.channel}),a=await s8u({generatorUpgradeInfo:o,header:`Generator Upgrades
2666
2666
  `,includeBoxen:!0});a!=null&&t.logger.info(a)}else await $uy({cliContext:t,generator:n.generator,group:n.group,project:await ob(t,{commandLineApiWorkspace:n.api,defaultToAllApiWorkspaces:!0}),includeMajor:n.includeMajor,channel:n.channel})}).command("get",!1,n=>n.option("output",{string:!0,alias:"o",description:"The location to output the list as a text file, defaults to standard out."}).option("generator",{string:!0,demandOption:!0,description:"The name of the generator to get, ex: `fern-typescript-node-sdk`."}).option("group",{string:!0,demandOption:!0,description:"The group in which the generator is located."}).option("api",{string:!0,description:"The API in which the generator is located."}).option("version",{boolean:!0,default:!1,description:"Get the version of the specified generator."}).option("language",{boolean:!0,default:!1,description:"Get the language of the specified generator."}).option("repository",{boolean:!0,default:!1,description:"Get repository for the generator invocation, if one is specified."}),async n=>{await t.instrumentPostHogEvent({command:"fern generator get",properties:{generator:n.generator,version:n.version,api:n.api,group:n.group,includeMajor:n.includeMajor}});let i=await Vuy({cliContext:t,generatorFilter:n.generator,groupFilter:n.group,apiFilter:n.api,project:await ob(t,{commandLineApiWorkspace:n.api,defaultToAllApiWorkspaces:!0})});if(i==null){let a=n.api?` for API ${n.api}`:"";t.failAndThrow(`Generator ${n.generator}, in group ${n.group}${a} was not found.`)}let o={};if(n.version&&(o.version=i.version,n.output==null)){process.stdout.write(i.version);return}if(n.language)if(i.language!=null){if(o.language=i.language,n.output==null){process.stdout.write(i.language);return}}else t.logger.warn(`Language information is not available for generator ${i.name} in group ${n.group}`);if(n.repository){let a=i.outputMode.type==="github"?i.outputMode.repo:i.outputMode.type==="githubV2"?i.outputMode.githubV2.repo:void 0;if(a!=null){if(o.repository=a,n.output==null){process.stdout.write(o.repository);return}}else t.logger.warn(`Repository information is not available for generator ${i.name} in group ${n.group}`)}if(n.output)try{await(0,Kuy.writeFile)(n.output,JSON.stringify(o,null,2))}catch(a){t.failAndThrow(`Could not write file to the specified location: ${n.output}`,a)}})})}var Zuy=require("fs/promises");async function ecy({project:{apiWorkspaces:e},generatorName:t,groupName:r,cliContext:n}){await Promise.all(e.map(async i=>{await n.runTaskForWorkspace(i,async o=>{let a=await nmr({absolutePathToWorkspace:i.absoluteFilePath,context:o})??{},s=await sds({generatorName:t,generatorsConfiguration:a,groupName:r,context:o,cliVersion:n.environment.packageVersion}),c=i.generatorsConfiguration?.absolutePathToConfiguration??await hbt({absolutePathToWorkspace:i.absoluteFilePath});c!=null&&(await(0,Zuy.writeFile)(c,`# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
2667
- `+Un.dump(s)),o.logger.info(tt.green(`Added ${t} generator`)))})}))}var rcy=require("fs/promises"),ncy=We(K3(),1);async function icy({context:e,from:t,to:r,fromVersion:n,generatorVersions:i}){let o=new GZr,a=RRx(await o.check({from:await tcy({context:e,filepath:t,flagName:"from"}),to:await tcy({context:e,filepath:r,flagName:"to"})})),s=MRx(e,i),{bump:c,errors:l}=FRx(a,s);if(n==null)return{bump:c??"patch",errors:l};if(c==="no_change")return{bump:"no_change",nextVersion:n,errors:l};let u=c??"patch",p=ncy.default.inc(n,u);if(!p)throw e.failWithoutThrowing(`Invalid current version: ${n}`),new QP;return{bump:u,nextVersion:p,errors:l}}async function tcy({context:e,filepath:t,flagName:r}){let n=xr.of(Ys(pb(),t));if(!await un(n,"file"))throw e.failWithoutThrowing(`File not found: ${n}`),new QP;let i=await(0,rcy.readFile)(n,"utf-8"),o=Vo.IntermediateRepresentation.parse(JSON.parse(i));if(!o.ok)throw e.failWithoutThrowing(`Invalid --${r}; expected a filepath containing a valid IR`),new QP;return o.value}function RRx(e){return{bump:e.bump,errors:e.errors.map(t=>t.message)}}function FRx(e,t){return{bump:NRx(e.bump,t.bump),errors:[...e.errors,...t.errors]}}function NRx(e,t){if(!(e===void 0&&t===void 0))return e==="no_change"&&(t===void 0||t==="no_change")||t==="no_change"&&(e===void 0||e==="no_change")?"no_change":e===void 0?t:t===void 0?e:e==="no_change"?t:t==="no_change"?e:e==="major"||t==="major"?"major":e==="minor"||t==="minor"?"minor":"patch"}function MRx(e,t){if(t===void 0)return{bump:void 0,errors:[]};let{from:r,to:n}=t;try{let i=zRx(P2a(r,n)),o=[];return i==="major"&&o.push("Generator version changed by major version."),{bump:i,errors:o}}catch(i){throw e.failWithoutThrowing(`Error diffing generator versions ${r} and ${n}: ${i}`),new QP}}function zRx(e){if(e!==null)switch(e){case"major":case"minor":case"patch":return e;default:return}}BP();var syy=We(d8u(),1),uyy=We(nPa(),1),TPa=require("fs/promises"),cyy=We(require("http"),1),lyy=We(require("path"),1);var emy=require("events"),uPa=We(require("fs"),1),Ver=We(require("path"),1);var Ndy=We(require("os"),1),Mdy=300,nqt=20,avn=1e7,zdy=Ndy.default.platform();var JVx=zdy==="darwin",D6u=zdy==="win32",iqt=JVx||D6u,Qdy=3e3,qdy=2e4,T6u=1250;var jrt;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(jrt||(jrt={}));var qer;(function(e){e.CHANGE="change",e.RENAME="rename"})(qer||(qer={}));var svn;(function(e){e.CHANGE="change",e.ERROR="error"})(svn||(svn={}));var Nl;(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"})(Nl||(Nl={}));var JL;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(JL||(JL={}));var KVx=(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),a,s,c=0,l=0,u=()=>{let A=Date.now(),v=A-c,P=A-l,I=v>=t||P>=o;return[A,I]},p=A=>{if(l=A,!a)return;let v=a;a=void 0,e.apply(void 0,v)},d=()=>{_(0)},m=()=>{s&&(d(),p(Date.now()))},h=A=>{if(l=A,n)return p(A)},y=A=>{if(i&&a)return p(A);a=void 0},g=()=>{s=void 0;let[A,v]=u();return v?y(A):b(A)},b=A=>{let v=A-c,P=A-l,I=t-v,E=o-P,x=Math.min(I,E);return _(x)},_=A=>{s&&clearTimeout(s),!(A<=0)&&(s=setTimeout(g,A))},O=(...A)=>{let[v,P]=u(),I=!!s;if(a=A,c=v,(P||!s)&&_(t),P)return I?p(v):h(v)};return O.cancel=d,O.flush=m,O},iPa=KVx;var M6u=We(require("fs"),1),aPa=We(require("path"),1);var t_=We(require("fs"),1),hQ=require("util");var Bft=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},Crt=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var R6u=We(require("process"),1),Vdy=R6u.default.getuid?!R6u.default.getuid():!1,kdy=1e4,Y$=()=>{};var uvn={isChangeErrorOk:e=>{if(!uvn.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!Vdy&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!uvn.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(!uvn.isNodeError(e))throw e;if(!uvn.isChangeErrorOk(e))throw e}},YS=uvn;var F6u=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=kdy,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()}}}}},Udy=new F6u;var Dft=(e,t)=>function(n){return function i(...o){return Udy.schedule().then(a=>{let s=l=>(a(),l),c=l=>{if(a(),Date.now()>=n)throw l;if(t(l)){let u=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,u)).then(()=>i.apply(void 0,o))}throw l};return e.apply(void 0,o).then(s,c)})}},Tft=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(a){if(Date.now()>n)throw a;if(t(a))return i.apply(void 0,o);throw a}}};var YVx={attempt:{chmod:Bft((0,hQ.promisify)(t_.default.chmod),YS.onChangeError),chown:Bft((0,hQ.promisify)(t_.default.chown),YS.onChangeError),close:Bft((0,hQ.promisify)(t_.default.close),Y$),fsync:Bft((0,hQ.promisify)(t_.default.fsync),Y$),mkdir:Bft((0,hQ.promisify)(t_.default.mkdir),Y$),realpath:Bft((0,hQ.promisify)(t_.default.realpath),Y$),stat:Bft((0,hQ.promisify)(t_.default.stat),Y$),unlink:Bft((0,hQ.promisify)(t_.default.unlink),Y$),chmodSync:Crt(t_.default.chmodSync,YS.onChangeError),chownSync:Crt(t_.default.chownSync,YS.onChangeError),closeSync:Crt(t_.default.closeSync,Y$),existsSync:Crt(t_.default.existsSync,Y$),fsyncSync:Crt(t_.default.fsync,Y$),mkdirSync:Crt(t_.default.mkdirSync,Y$),realpathSync:Crt(t_.default.realpathSync,Y$),statSync:Crt(t_.default.statSync,Y$),unlinkSync:Crt(t_.default.unlinkSync,Y$)},retry:{close:Dft((0,hQ.promisify)(t_.default.close),YS.isRetriableError),fsync:Dft((0,hQ.promisify)(t_.default.fsync),YS.isRetriableError),open:Dft((0,hQ.promisify)(t_.default.open),YS.isRetriableError),readFile:Dft((0,hQ.promisify)(t_.default.readFile),YS.isRetriableError),rename:Dft((0,hQ.promisify)(t_.default.rename),YS.isRetriableError),stat:Dft((0,hQ.promisify)(t_.default.stat),YS.isRetriableError),write:Dft((0,hQ.promisify)(t_.default.write),YS.isRetriableError),writeFile:Dft((0,hQ.promisify)(t_.default.writeFile),YS.isRetriableError),closeSync:Tft(t_.default.closeSync,YS.isRetriableError),fsyncSync:Tft(t_.default.fsyncSync,YS.isRetriableError),openSync:Tft(t_.default.openSync,YS.isRetriableError),readFileSync:Tft(t_.default.readFileSync,YS.isRetriableError),renameSync:Tft(t_.default.renameSync,YS.isRetriableError),statSync:Tft(t_.default.statSync,YS.isRetriableError),writeSync:Tft(t_.default.writeSync,YS.isRetriableError),writeFileSync:Tft(t_.default.writeFileSync,YS.isRetriableError)}},Ldy=YVx;var oPa=We(require("fs"),1),cvn=We(require("path"),1);var N6u=()=>{};var XVx=()=>{let e=N6u,t=N6u,r=!1,n=!1;return{promise:new Promise((c,l)=>{e=u=>(r=!0,c(u)),t=u=>(n=!0,l(u))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},Wdy=XVx;var ZVx=()=>{let{promise:e,resolve:t,isPending:r}=Wdy(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},Gdy=ZVx;var Hdy={then:e=>{e()}};var $dy=e=>Array.isArray(e)?e:[e],Jdy=e=>typeof e=="function";var ekx=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],a=$dy(o).map(X=>Jdy(X)?X:Y=>X.test(Y)),s=X=>a.some(Y=>Y(X)),c=t?.signal??{aborted:!1},l=t?.onDirents||(()=>{}),u=[],p=new Set,d={},m=[],h=new Set,y={},g=[],b=new Set,_={},O={},A=new Set,v={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},P={directories:u,directoriesNames:p,directoriesNamesToPaths:d,files:m,filesNames:h,filesNamesToPaths:y,symlinks:g,symlinksNames:b,symlinksNamesToPaths:_,map:O},{promise:I,increment:E,decrement:x}=Gdy(),T=0,W=(X,Y,Be,Pe)=>{A.has(Y)||T>=i||(T+=1,X.directories.push(Y),X.directoriesNames.add(Be),u.push(Y),p.add(Be),d.propertyIsEnumerable(Be)||(d[Be]=[]),d[Be].push(Y),A.add(Y),!(Pe>=n)&&(T>=i||te(Y,Pe+1)))},H=(X,Y,Be)=>{A.has(Y)||T>=i||(T+=1,X.files.push(Y),X.filesNames.add(Be),m.push(Y),h.add(Be),y.propertyIsEnumerable(Be)||(y[Be]=[]),y[Be].push(Y),A.add(Y))},G=(X,Y,Be,Pe)=>{A.has(Y)||T>=i||(T+=1,X.symlinks.push(Y),X.symlinksNames.add(Be),g.push(Y),b.add(Be),_.propertyIsEnumerable(Be)||(_[Be]=[]),_[Be].push(Y),A.add(Y),r&&(Pe>=n||T>=i||Ge(Y,Pe+1)))},ie=(X,Y,Be,Pe,ke)=>{c.aborted||s(Y)||(Pe.isDirectory()?W(X,Y,Be,ke):Pe.isFile()?H(X,Y,Be):Pe.isSymbolicLink()&&G(X,Y,Be,ke))},oe=(X,Y,Be,Pe)=>{if(c.aborted)return;let ke=Y===cvn.default.sep?"":cvn.default.sep,Ye=Be.name,Oe=`${Y}${ke}${Ye}`;s(Oe)||(Be.isDirectory()?W(X,Oe,Ye,Pe):Be.isFile()?H(X,Oe,Ye):Be.isSymbolicLink()&&G(X,Oe,Ye,Pe))},$=(X,Y,Be,Pe)=>{for(let ke=0,Ye=Be.length;ke<Ye;ke++)oe(X,Y,Be[ke],Pe)},te=(X,Y)=>{c.aborted||Y>n||T>=i||(E(),oPa.default.readdir(X,{withFileTypes:!0},(Be,Pe)=>{if(Be||c.aborted||!Pe.length)return x();(l(Pe)||Hdy).then(()=>{let Ye=O[X]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};$(Ye,X,Pe,Y),x()})}))},Ge=(X,Y)=>{E(),oPa.default.realpath(X,(Be,Pe)=>{if(Be||c.aborted)return x();oPa.default.stat(Pe,(ke,Ye)=>{if(ke||c.aborted)return x();let Oe=cvn.default.basename(Pe),he=O[X]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};ie(he,Pe,Oe,Ye,Y),x()})})};return(async(X,Y=1)=>(X=cvn.default.normalize(X),A.add(X),te(X,Y),await I,c.aborted?v:P))(e)},Kdy=ekx;var Srt={lang:{debounce:iPa,attempt:e=>{try{return e()}catch(t){return Srt.lang.castError(t)}},castArray:e=>Srt.lang.isArray(e)?e:[e],castError:e=>Srt.lang.isError(e)?e:Srt.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(Srt.lang.isNaN(e))return Srt.lang.isNaN(t);if(Srt.lang.isPrimitive(e)||Srt.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(aPa.default.sep).length-1),getRealPath:(e,t)=>{try{return t?M6u.default.realpathSync.native(e):M6u.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===aPa.default.sep&&t.length-e.length>aPa.default.sep.length,poll:(e,t=qdy)=>Ldy.retry.stat(t)(e,{bigint:!0}).catch(Srt.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let a=o[e];return[a.directories,a.files]}else{let a=await Kdy(e,{depth:r,limit:n,ignore:t,signal:i});return[a.directories,a.files]}}}},Qm=Srt;var sPa=We(require("path"),1);var z6u=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||Qm.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=Mdy){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(s,c)=>{let l=this.options.ignoreInitial?[]:s,u=await this.eventsPopulate([...c]),p=this.eventsDeduplicate([...l,...u]);this.onTargetEvents(p)},a=Qm.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(s,c="",l=!1)=>{l?await this.eventsPopulate([c],n,!0):i.add(c),r.then(a)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,a]=i,s=r[a];return o===s||o===Nl.CHANGE&&s===Nl.ADD||(r[a]=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 a=>{r.push([a,i]),a===Nl.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):a===Nl.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??nqt:Math.min(1,this.options.depth??nqt),a=this.options.limit??avn,[s,c]=await Qm.fs.readdir(r,this.options.ignore,o,a,this.watcher._closeSignal),l=[...s,...c];return await Promise.all(l.map(u=>{if(!this.watcher.isIgnored(u,this.options.ignore)&&!t.includes(u))return this.eventsPopulate([u],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())Qm.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(Nl.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!iqt&&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(Nl.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(Nl.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(sPa.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(Nl.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(sPa.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(Nl.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===Nl.ADD?this.onTargetAdd(n):r===Nl.ADD_DIR?this.onTargetAddDir(n):r===Nl.CHANGE?this.onTargetChange(n):r===Nl.UNLINK?this.onTargetUnlink(n):r===Nl.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=qer.CHANGE,r){if(this.watcher.isClosed())return;let n=sPa.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){D6u&&t.code==="EPERM"?this.onWatcherChange(qer.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(svn.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(svn.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(qer.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&iqt&&this.options.native!==!1?this.options.depth??nqt:Math.min(1,this.options.depth??nqt),n=this.options.limit??avn,[i,o]=await Qm.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),a=[this.folderPath,...i,...o];await Promise.all(a.map(s=>{if(!this.watcher._poller.stats.has(s)&&!this.watcher.isIgnored(s,this.options.ignore))return this.onWatcherEvent(qer.CHANGE,s,t)}))}}},Ydy=z6u;var KL={interval:100,intervalId:void 0,fns:new Map,init:()=>{KL.intervalId||(KL.intervalId=setInterval(KL.resolve,KL.interval))},reset:()=>{KL.intervalId&&(clearInterval(KL.intervalId),delete KL.intervalId)},add:(e,t)=>{KL.fns.set(e,Date.now()+t),KL.init()},remove:e=>{KL.fns.delete(e)},resolve:()=>{if(!KL.fns.size)return KL.reset();let e=Date.now();for(let[t,r]of KL.fns)r>=e||(KL.remove(t),t())}},lvn=KL;var pvn=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=T6u){let{ino:n,targetPath:i,events:o,locks:a}=t,s=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(Qm.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return s();let c=()=>{a.add.delete(n),lvn.remove(l)},l=()=>{c(),s()};lvn.add(l,r);let u=()=>{let p=a.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)};a.add.set(n,u),u()}getLockUnlink(t,r=T6u){let{ino:n,targetPath:i,events:o,locks:a}=t,s=()=>{this._watcher.event(o.unlink,i)};if(!n)return s();let c=()=>{a.unlink.delete(n),lvn.remove(l)},l=()=>{c(),s()};lvn.add(l,r);let u=()=>(c(),i);a.unlink.set(n,u),a.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,Nl.ADD,jrt.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,Nl.ADD_DIR,jrt.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,Nl.UNLINK,jrt.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,Nl.UNLINK_DIR,jrt.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}}};pvn.DIR_EVENTS={add:Nl.ADD_DIR,rename:Nl.RENAME_DIR,unlink:Nl.UNLINK_DIR};pvn.FILE_EVENTS={add:Nl.ADD,change:Nl.CHANGE,rename:Nl.RENAME,unlink:Nl.UNLINK};var Xdy=pvn;var Q6u=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(Qm.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(Qm.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(Qm.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(Qm.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return Qm.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);Qm.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},q6u=Q6u;var V6u=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}},Zdy=V6u;var k6u=class{constructor(){this.inos={},this.paths=new q6u,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 Qm.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new Zdy(n)}reset(){this.inos={},this.paths=new q6u,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,Nl.ADD,i),[Nl.ADD];if(i.isDirectory())return this.updateIno(t,Nl.ADD_DIR,i),[Nl.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,Nl.UNLINK,n),[Nl.UNLINK];if(n.isDirectory())return this.updateIno(t,Nl.UNLINK_DIR,n),[Nl.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,Nl.CHANGE,i),[Nl.CHANGE]);if(i.isDirectory())return this.updateIno(t,Nl.UNLINK,n),this.updateIno(t,Nl.ADD_DIR,i),[Nl.UNLINK,Nl.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,Nl.UNLINK_DIR,n),this.updateIno(t,Nl.ADD,i),[Nl.UNLINK_DIR,Nl.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,Nl.UNLINK_DIR,n),this.updateIno(t,Nl.ADD_DIR,i),[Nl.UNLINK_DIR,Nl.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?jrt.FILE:jrt.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)}}},U6u=k6u;var L6u=class e extends emy.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(JL.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(JL.CLOSE,i)),this._readyWait=new Promise(i=>this.on(JL.READY,i)),this._locker=new Xdy(this),this._roots=new Set,this._poller=new U6u,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&&(Qm.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(JL.CLOSE))}error(t){if(this.isClosed())return!1;let r=Qm.lang.castError(t);return this.emit(JL.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(JL.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(JL.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&Qm.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&Qm.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)Qm.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 Ydy(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=Qm.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(s=>s.handler===n&&(!s.filePath||s.filePath===i)&&s.options.ignore===r.ignore&&!!s.options.native==!!r.native&&(!r.recursive||s.options.recursive)))return!0;let a=Ver.default.dirname(t);for(let s=1;s<1/0;s++){if(this._watchers[a]?.find(u=>(s===1||u.options.recursive&&s<=(u.options.depth??nqt))&&u.handler===n&&(!u.filePath||u.filePath===i)&&u.options.ignore===r.ignore&&!!u.options.native==!!r.native&&(!r.recursive||u.options.recursive&&iqt&&u.options.native!==!1)))return!0;if(!iqt)break;let l=Ver.default.dirname(t);if(a===l)break;a=l}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=Qm.lang.uniq(t).sort();let a;for(let s of t)if(!this.isIgnored(s,r.ignore)&&!this.watcherExists(s,r,n,i))try{let c=!r.recursive||iqt&&r.native!==!1?r:{...r,recursive:!1},u={watcher:uPa.default.watch(s,c),handler:n,options:r,folderPath:s,filePath:i},p=a=await this.watcherAdd(u,o);if(this._roots.has(i||s)){let m={...r,ignoreInitial:!0,recursive:!1},h=Ver.default.dirname(s),y=s;await this.watchDirectories([h],m,n,y,p)}}catch(c){this.error(c)}return a}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||iqt&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let a=r.depth??nqt,s=r.limit??avn,[c]=await Qm.fs.readdir(t,r.ignore,a,s,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let l=await this.watchDirectories([t],r,n,i,o);if(c.length){let u=Qm.fs.getDepth(t);for(let p of c){let d=Qm.fs.getDepth(p),m=Math.max(0,a-(d-u)),h={...r,depth:m};await this.watchDirectories([p],h,n,i,o||l)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(l,u)=>{u===t&&(c(),n())},a=new e(o),s=()=>{this._subwatchers.add(i),this.on(JL.CLOSE,c),a.watchFile(t,r,o)},c=()=>{this._subwatchers.delete(i),this.removeListener(JL.CLOSE,c),a.close()};return s()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=Ver.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new U6u,a=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,a(),n())})}async watchPolling(t,r,n){if(this.isClosed())return Qm.lang.noop;if(this.pollerExists(t,r))return Qm.lang.noop;let i={...r,interval:r.pollingInterval??Qdy},o={targetPath:t,options:r},a=()=>{this._pollers.add(o),this.on(JL.CLOSE,s),uPa.default.watchFile(t,i,n)},s=()=>{this._pollers.delete(o),this.removeListener(JL.CLOSE,s),uPa.default.unwatchFile(t,n)};return Qm.lang.attempt(a),()=>Qm.lang.attempt(s)}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=Qm.lang.uniq(t).sort(),t.every((o,a)=>t.every((s,c)=>c===a||!Qm.fs.isSubPath(o,s))))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=Ver.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await Qm.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=Ver.default.dirname(t);return(await Qm.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=Qm.lang.noop){if(Qm.lang.isFunction(t))return this.watch([],{},t);if(Qm.lang.isUndefined(t))return this.watch([],r,n);if(Qm.lang.isFunction(r))return this.watch(t,{},r);if(Qm.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=Qm.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==Qm.lang.noop&&this.on(JL.ALL,n),r.readdirMap=void 0,this.ready())}},cPa=L6u;U_a();var A3r=require("fs/promises"),tmy=require("os"),rmy=We(require("path"),1),tkx=".fern",rkx="logs";function nkx(){return"cli@3.70.2"}var fvn=class{logFilePath=null;initialized=!1;sessionStartTime;constructor(){this.sessionStartTime=Date.now()}async initialize(){if(this.initialized)return;let t=vt(xr.of((0,tmy.homedir)()),Xe.of(tkx)),r=vt(t,Xe.of(rkx));await un(r)||await(0,A3r.mkdir)(r,{recursive:!0});let i=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=vt(r,Xe.of(i));let o=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${rmy.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
2667
+ `+Un.dump(s)),o.logger.info(tt.green(`Added ${t} generator`)))})}))}var rcy=require("fs/promises"),ncy=We(K3(),1);async function icy({context:e,from:t,to:r,fromVersion:n,generatorVersions:i}){let o=new GZr,a=RRx(await o.check({from:await tcy({context:e,filepath:t,flagName:"from"}),to:await tcy({context:e,filepath:r,flagName:"to"})})),s=MRx(e,i),{bump:c,errors:l}=FRx(a,s);if(n==null)return{bump:c??"patch",errors:l};if(c==="no_change")return{bump:"no_change",nextVersion:n,errors:l};let u=c??"patch",p=ncy.default.inc(n,u);if(!p)throw e.failWithoutThrowing(`Invalid current version: ${n}`),new QP;return{bump:u,nextVersion:p,errors:l}}async function tcy({context:e,filepath:t,flagName:r}){let n=xr.of(Ys(pb(),t));if(!await un(n,"file"))throw e.failWithoutThrowing(`File not found: ${n}`),new QP;let i=await(0,rcy.readFile)(n,"utf-8"),o=Vo.IntermediateRepresentation.parse(JSON.parse(i));if(!o.ok)throw e.failWithoutThrowing(`Invalid --${r}; expected a filepath containing a valid IR`),new QP;return o.value}function RRx(e){return{bump:e.bump,errors:e.errors.map(t=>t.message)}}function FRx(e,t){return{bump:NRx(e.bump,t.bump),errors:[...e.errors,...t.errors]}}function NRx(e,t){if(!(e===void 0&&t===void 0))return e==="no_change"&&(t===void 0||t==="no_change")||t==="no_change"&&(e===void 0||e==="no_change")?"no_change":e===void 0?t:t===void 0?e:e==="no_change"?t:t==="no_change"?e:e==="major"||t==="major"?"major":e==="minor"||t==="minor"?"minor":"patch"}function MRx(e,t){if(t===void 0)return{bump:void 0,errors:[]};let{from:r,to:n}=t;try{let i=zRx(P2a(r,n)),o=[];return i==="major"&&o.push("Generator version changed by major version."),{bump:i,errors:o}}catch(i){throw e.failWithoutThrowing(`Error diffing generator versions ${r} and ${n}: ${i}`),new QP}}function zRx(e){if(e!==null)switch(e){case"major":case"minor":case"patch":return e;default:return}}BP();var syy=We(d8u(),1),uyy=We(nPa(),1),TPa=require("fs/promises"),cyy=We(require("http"),1),lyy=We(require("path"),1);var emy=require("events"),uPa=We(require("fs"),1),Ver=We(require("path"),1);var Ndy=We(require("os"),1),Mdy=300,nqt=20,avn=1e7,zdy=Ndy.default.platform();var JVx=zdy==="darwin",D6u=zdy==="win32",iqt=JVx||D6u,Qdy=3e3,qdy=2e4,T6u=1250;var jrt;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(jrt||(jrt={}));var qer;(function(e){e.CHANGE="change",e.RENAME="rename"})(qer||(qer={}));var svn;(function(e){e.CHANGE="change",e.ERROR="error"})(svn||(svn={}));var Nl;(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"})(Nl||(Nl={}));var JL;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(JL||(JL={}));var KVx=(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),a,s,c=0,l=0,u=()=>{let A=Date.now(),v=A-c,P=A-l,I=v>=t||P>=o;return[A,I]},p=A=>{if(l=A,!a)return;let v=a;a=void 0,e.apply(void 0,v)},d=()=>{_(0)},m=()=>{s&&(d(),p(Date.now()))},h=A=>{if(l=A,n)return p(A)},y=A=>{if(i&&a)return p(A);a=void 0},g=()=>{s=void 0;let[A,v]=u();return v?y(A):b(A)},b=A=>{let v=A-c,P=A-l,I=t-v,E=o-P,x=Math.min(I,E);return _(x)},_=A=>{s&&clearTimeout(s),!(A<=0)&&(s=setTimeout(g,A))},O=(...A)=>{let[v,P]=u(),I=!!s;if(a=A,c=v,(P||!s)&&_(t),P)return I?p(v):h(v)};return O.cancel=d,O.flush=m,O},iPa=KVx;var M6u=We(require("fs"),1),aPa=We(require("path"),1);var t_=We(require("fs"),1),hQ=require("util");var Bft=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},Crt=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var R6u=We(require("process"),1),Vdy=R6u.default.getuid?!R6u.default.getuid():!1,kdy=1e4,Y$=()=>{};var uvn={isChangeErrorOk:e=>{if(!uvn.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!Vdy&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!uvn.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(!uvn.isNodeError(e))throw e;if(!uvn.isChangeErrorOk(e))throw e}},YS=uvn;var F6u=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=kdy,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()}}}}},Udy=new F6u;var Dft=(e,t)=>function(n){return function i(...o){return Udy.schedule().then(a=>{let s=l=>(a(),l),c=l=>{if(a(),Date.now()>=n)throw l;if(t(l)){let u=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,u)).then(()=>i.apply(void 0,o))}throw l};return e.apply(void 0,o).then(s,c)})}},Tft=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(a){if(Date.now()>n)throw a;if(t(a))return i.apply(void 0,o);throw a}}};var YVx={attempt:{chmod:Bft((0,hQ.promisify)(t_.default.chmod),YS.onChangeError),chown:Bft((0,hQ.promisify)(t_.default.chown),YS.onChangeError),close:Bft((0,hQ.promisify)(t_.default.close),Y$),fsync:Bft((0,hQ.promisify)(t_.default.fsync),Y$),mkdir:Bft((0,hQ.promisify)(t_.default.mkdir),Y$),realpath:Bft((0,hQ.promisify)(t_.default.realpath),Y$),stat:Bft((0,hQ.promisify)(t_.default.stat),Y$),unlink:Bft((0,hQ.promisify)(t_.default.unlink),Y$),chmodSync:Crt(t_.default.chmodSync,YS.onChangeError),chownSync:Crt(t_.default.chownSync,YS.onChangeError),closeSync:Crt(t_.default.closeSync,Y$),existsSync:Crt(t_.default.existsSync,Y$),fsyncSync:Crt(t_.default.fsync,Y$),mkdirSync:Crt(t_.default.mkdirSync,Y$),realpathSync:Crt(t_.default.realpathSync,Y$),statSync:Crt(t_.default.statSync,Y$),unlinkSync:Crt(t_.default.unlinkSync,Y$)},retry:{close:Dft((0,hQ.promisify)(t_.default.close),YS.isRetriableError),fsync:Dft((0,hQ.promisify)(t_.default.fsync),YS.isRetriableError),open:Dft((0,hQ.promisify)(t_.default.open),YS.isRetriableError),readFile:Dft((0,hQ.promisify)(t_.default.readFile),YS.isRetriableError),rename:Dft((0,hQ.promisify)(t_.default.rename),YS.isRetriableError),stat:Dft((0,hQ.promisify)(t_.default.stat),YS.isRetriableError),write:Dft((0,hQ.promisify)(t_.default.write),YS.isRetriableError),writeFile:Dft((0,hQ.promisify)(t_.default.writeFile),YS.isRetriableError),closeSync:Tft(t_.default.closeSync,YS.isRetriableError),fsyncSync:Tft(t_.default.fsyncSync,YS.isRetriableError),openSync:Tft(t_.default.openSync,YS.isRetriableError),readFileSync:Tft(t_.default.readFileSync,YS.isRetriableError),renameSync:Tft(t_.default.renameSync,YS.isRetriableError),statSync:Tft(t_.default.statSync,YS.isRetriableError),writeSync:Tft(t_.default.writeSync,YS.isRetriableError),writeFileSync:Tft(t_.default.writeFileSync,YS.isRetriableError)}},Ldy=YVx;var oPa=We(require("fs"),1),cvn=We(require("path"),1);var N6u=()=>{};var XVx=()=>{let e=N6u,t=N6u,r=!1,n=!1;return{promise:new Promise((c,l)=>{e=u=>(r=!0,c(u)),t=u=>(n=!0,l(u))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},Wdy=XVx;var ZVx=()=>{let{promise:e,resolve:t,isPending:r}=Wdy(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},Gdy=ZVx;var Hdy={then:e=>{e()}};var $dy=e=>Array.isArray(e)?e:[e],Jdy=e=>typeof e=="function";var ekx=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],a=$dy(o).map(X=>Jdy(X)?X:Y=>X.test(Y)),s=X=>a.some(Y=>Y(X)),c=t?.signal??{aborted:!1},l=t?.onDirents||(()=>{}),u=[],p=new Set,d={},m=[],h=new Set,y={},g=[],b=new Set,_={},O={},A=new Set,v={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},P={directories:u,directoriesNames:p,directoriesNamesToPaths:d,files:m,filesNames:h,filesNamesToPaths:y,symlinks:g,symlinksNames:b,symlinksNamesToPaths:_,map:O},{promise:I,increment:E,decrement:x}=Gdy(),T=0,W=(X,Y,Be,Pe)=>{A.has(Y)||T>=i||(T+=1,X.directories.push(Y),X.directoriesNames.add(Be),u.push(Y),p.add(Be),d.propertyIsEnumerable(Be)||(d[Be]=[]),d[Be].push(Y),A.add(Y),!(Pe>=n)&&(T>=i||te(Y,Pe+1)))},H=(X,Y,Be)=>{A.has(Y)||T>=i||(T+=1,X.files.push(Y),X.filesNames.add(Be),m.push(Y),h.add(Be),y.propertyIsEnumerable(Be)||(y[Be]=[]),y[Be].push(Y),A.add(Y))},G=(X,Y,Be,Pe)=>{A.has(Y)||T>=i||(T+=1,X.symlinks.push(Y),X.symlinksNames.add(Be),g.push(Y),b.add(Be),_.propertyIsEnumerable(Be)||(_[Be]=[]),_[Be].push(Y),A.add(Y),r&&(Pe>=n||T>=i||Ge(Y,Pe+1)))},ie=(X,Y,Be,Pe,ke)=>{c.aborted||s(Y)||(Pe.isDirectory()?W(X,Y,Be,ke):Pe.isFile()?H(X,Y,Be):Pe.isSymbolicLink()&&G(X,Y,Be,ke))},oe=(X,Y,Be,Pe)=>{if(c.aborted)return;let ke=Y===cvn.default.sep?"":cvn.default.sep,Ye=Be.name,Oe=`${Y}${ke}${Ye}`;s(Oe)||(Be.isDirectory()?W(X,Oe,Ye,Pe):Be.isFile()?H(X,Oe,Ye):Be.isSymbolicLink()&&G(X,Oe,Ye,Pe))},$=(X,Y,Be,Pe)=>{for(let ke=0,Ye=Be.length;ke<Ye;ke++)oe(X,Y,Be[ke],Pe)},te=(X,Y)=>{c.aborted||Y>n||T>=i||(E(),oPa.default.readdir(X,{withFileTypes:!0},(Be,Pe)=>{if(Be||c.aborted||!Pe.length)return x();(l(Pe)||Hdy).then(()=>{let Ye=O[X]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};$(Ye,X,Pe,Y),x()})}))},Ge=(X,Y)=>{E(),oPa.default.realpath(X,(Be,Pe)=>{if(Be||c.aborted)return x();oPa.default.stat(Pe,(ke,Ye)=>{if(ke||c.aborted)return x();let Oe=cvn.default.basename(Pe),he=O[X]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};ie(he,Pe,Oe,Ye,Y),x()})})};return(async(X,Y=1)=>(X=cvn.default.normalize(X),A.add(X),te(X,Y),await I,c.aborted?v:P))(e)},Kdy=ekx;var Srt={lang:{debounce:iPa,attempt:e=>{try{return e()}catch(t){return Srt.lang.castError(t)}},castArray:e=>Srt.lang.isArray(e)?e:[e],castError:e=>Srt.lang.isError(e)?e:Srt.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(Srt.lang.isNaN(e))return Srt.lang.isNaN(t);if(Srt.lang.isPrimitive(e)||Srt.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(aPa.default.sep).length-1),getRealPath:(e,t)=>{try{return t?M6u.default.realpathSync.native(e):M6u.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===aPa.default.sep&&t.length-e.length>aPa.default.sep.length,poll:(e,t=qdy)=>Ldy.retry.stat(t)(e,{bigint:!0}).catch(Srt.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let a=o[e];return[a.directories,a.files]}else{let a=await Kdy(e,{depth:r,limit:n,ignore:t,signal:i});return[a.directories,a.files]}}}},Qm=Srt;var sPa=We(require("path"),1);var z6u=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||Qm.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=Mdy){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(s,c)=>{let l=this.options.ignoreInitial?[]:s,u=await this.eventsPopulate([...c]),p=this.eventsDeduplicate([...l,...u]);this.onTargetEvents(p)},a=Qm.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(s,c="",l=!1)=>{l?await this.eventsPopulate([c],n,!0):i.add(c),r.then(a)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,a]=i,s=r[a];return o===s||o===Nl.CHANGE&&s===Nl.ADD||(r[a]=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 a=>{r.push([a,i]),a===Nl.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):a===Nl.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??nqt:Math.min(1,this.options.depth??nqt),a=this.options.limit??avn,[s,c]=await Qm.fs.readdir(r,this.options.ignore,o,a,this.watcher._closeSignal),l=[...s,...c];return await Promise.all(l.map(u=>{if(!this.watcher.isIgnored(u,this.options.ignore)&&!t.includes(u))return this.eventsPopulate([u],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())Qm.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(Nl.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!iqt&&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(Nl.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(Nl.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(sPa.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(Nl.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(sPa.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(Nl.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===Nl.ADD?this.onTargetAdd(n):r===Nl.ADD_DIR?this.onTargetAddDir(n):r===Nl.CHANGE?this.onTargetChange(n):r===Nl.UNLINK?this.onTargetUnlink(n):r===Nl.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=qer.CHANGE,r){if(this.watcher.isClosed())return;let n=sPa.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){D6u&&t.code==="EPERM"?this.onWatcherChange(qer.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(svn.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(svn.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(qer.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&iqt&&this.options.native!==!1?this.options.depth??nqt:Math.min(1,this.options.depth??nqt),n=this.options.limit??avn,[i,o]=await Qm.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),a=[this.folderPath,...i,...o];await Promise.all(a.map(s=>{if(!this.watcher._poller.stats.has(s)&&!this.watcher.isIgnored(s,this.options.ignore))return this.onWatcherEvent(qer.CHANGE,s,t)}))}}},Ydy=z6u;var KL={interval:100,intervalId:void 0,fns:new Map,init:()=>{KL.intervalId||(KL.intervalId=setInterval(KL.resolve,KL.interval))},reset:()=>{KL.intervalId&&(clearInterval(KL.intervalId),delete KL.intervalId)},add:(e,t)=>{KL.fns.set(e,Date.now()+t),KL.init()},remove:e=>{KL.fns.delete(e)},resolve:()=>{if(!KL.fns.size)return KL.reset();let e=Date.now();for(let[t,r]of KL.fns)r>=e||(KL.remove(t),t())}},lvn=KL;var pvn=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=T6u){let{ino:n,targetPath:i,events:o,locks:a}=t,s=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(Qm.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return s();let c=()=>{a.add.delete(n),lvn.remove(l)},l=()=>{c(),s()};lvn.add(l,r);let u=()=>{let p=a.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)};a.add.set(n,u),u()}getLockUnlink(t,r=T6u){let{ino:n,targetPath:i,events:o,locks:a}=t,s=()=>{this._watcher.event(o.unlink,i)};if(!n)return s();let c=()=>{a.unlink.delete(n),lvn.remove(l)},l=()=>{c(),s()};lvn.add(l,r);let u=()=>(c(),i);a.unlink.set(n,u),a.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,Nl.ADD,jrt.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,Nl.ADD_DIR,jrt.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,Nl.UNLINK,jrt.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,Nl.UNLINK_DIR,jrt.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}}};pvn.DIR_EVENTS={add:Nl.ADD_DIR,rename:Nl.RENAME_DIR,unlink:Nl.UNLINK_DIR};pvn.FILE_EVENTS={add:Nl.ADD,change:Nl.CHANGE,rename:Nl.RENAME,unlink:Nl.UNLINK};var Xdy=pvn;var Q6u=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(Qm.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(Qm.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(Qm.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(Qm.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return Qm.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);Qm.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},q6u=Q6u;var V6u=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}},Zdy=V6u;var k6u=class{constructor(){this.inos={},this.paths=new q6u,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 Qm.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new Zdy(n)}reset(){this.inos={},this.paths=new q6u,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,Nl.ADD,i),[Nl.ADD];if(i.isDirectory())return this.updateIno(t,Nl.ADD_DIR,i),[Nl.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,Nl.UNLINK,n),[Nl.UNLINK];if(n.isDirectory())return this.updateIno(t,Nl.UNLINK_DIR,n),[Nl.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,Nl.CHANGE,i),[Nl.CHANGE]);if(i.isDirectory())return this.updateIno(t,Nl.UNLINK,n),this.updateIno(t,Nl.ADD_DIR,i),[Nl.UNLINK,Nl.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,Nl.UNLINK_DIR,n),this.updateIno(t,Nl.ADD,i),[Nl.UNLINK_DIR,Nl.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,Nl.UNLINK_DIR,n),this.updateIno(t,Nl.ADD_DIR,i),[Nl.UNLINK_DIR,Nl.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?jrt.FILE:jrt.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)}}},U6u=k6u;var L6u=class e extends emy.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(JL.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(JL.CLOSE,i)),this._readyWait=new Promise(i=>this.on(JL.READY,i)),this._locker=new Xdy(this),this._roots=new Set,this._poller=new U6u,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&&(Qm.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(JL.CLOSE))}error(t){if(this.isClosed())return!1;let r=Qm.lang.castError(t);return this.emit(JL.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(JL.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(JL.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&Qm.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&Qm.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)Qm.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 Ydy(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=Qm.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(s=>s.handler===n&&(!s.filePath||s.filePath===i)&&s.options.ignore===r.ignore&&!!s.options.native==!!r.native&&(!r.recursive||s.options.recursive)))return!0;let a=Ver.default.dirname(t);for(let s=1;s<1/0;s++){if(this._watchers[a]?.find(u=>(s===1||u.options.recursive&&s<=(u.options.depth??nqt))&&u.handler===n&&(!u.filePath||u.filePath===i)&&u.options.ignore===r.ignore&&!!u.options.native==!!r.native&&(!r.recursive||u.options.recursive&&iqt&&u.options.native!==!1)))return!0;if(!iqt)break;let l=Ver.default.dirname(t);if(a===l)break;a=l}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=Qm.lang.uniq(t).sort();let a;for(let s of t)if(!this.isIgnored(s,r.ignore)&&!this.watcherExists(s,r,n,i))try{let c=!r.recursive||iqt&&r.native!==!1?r:{...r,recursive:!1},u={watcher:uPa.default.watch(s,c),handler:n,options:r,folderPath:s,filePath:i},p=a=await this.watcherAdd(u,o);if(this._roots.has(i||s)){let m={...r,ignoreInitial:!0,recursive:!1},h=Ver.default.dirname(s),y=s;await this.watchDirectories([h],m,n,y,p)}}catch(c){this.error(c)}return a}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||iqt&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let a=r.depth??nqt,s=r.limit??avn,[c]=await Qm.fs.readdir(t,r.ignore,a,s,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let l=await this.watchDirectories([t],r,n,i,o);if(c.length){let u=Qm.fs.getDepth(t);for(let p of c){let d=Qm.fs.getDepth(p),m=Math.max(0,a-(d-u)),h={...r,depth:m};await this.watchDirectories([p],h,n,i,o||l)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(l,u)=>{u===t&&(c(),n())},a=new e(o),s=()=>{this._subwatchers.add(i),this.on(JL.CLOSE,c),a.watchFile(t,r,o)},c=()=>{this._subwatchers.delete(i),this.removeListener(JL.CLOSE,c),a.close()};return s()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=Ver.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new U6u,a=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,a(),n())})}async watchPolling(t,r,n){if(this.isClosed())return Qm.lang.noop;if(this.pollerExists(t,r))return Qm.lang.noop;let i={...r,interval:r.pollingInterval??Qdy},o={targetPath:t,options:r},a=()=>{this._pollers.add(o),this.on(JL.CLOSE,s),uPa.default.watchFile(t,i,n)},s=()=>{this._pollers.delete(o),this.removeListener(JL.CLOSE,s),uPa.default.unwatchFile(t,n)};return Qm.lang.attempt(a),()=>Qm.lang.attempt(s)}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=Qm.lang.uniq(t).sort(),t.every((o,a)=>t.every((s,c)=>c===a||!Qm.fs.isSubPath(o,s))))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=Ver.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await Qm.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=Ver.default.dirname(t);return(await Qm.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=Qm.lang.noop){if(Qm.lang.isFunction(t))return this.watch([],{},t);if(Qm.lang.isUndefined(t))return this.watch([],r,n);if(Qm.lang.isFunction(r))return this.watch(t,{},r);if(Qm.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=Qm.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==Qm.lang.noop&&this.on(JL.ALL,n),r.readdirMap=void 0,this.ready())}},cPa=L6u;U_a();var A3r=require("fs/promises"),tmy=require("os"),rmy=We(require("path"),1),tkx=".fern",rkx="logs";function nkx(){return"cli@3.70.3"}var fvn=class{logFilePath=null;initialized=!1;sessionStartTime;constructor(){this.sessionStartTime=Date.now()}async initialize(){if(this.initialized)return;let t=vt(xr.of((0,tmy.homedir)()),Xe.of(tkx)),r=vt(t,Xe.of(rkx));await un(r)||await(0,A3r.mkdir)(r,{recursive:!0});let i=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=vt(r,Xe.of(i));let o=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${rmy.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
2668
2668
  `);await(0,A3r.writeFile)(this.logFilePath,o,"utf-8"),this.initialized=!0}getLogFilePath(){return this.logFilePath}async writeEntry(t){if(!this.initialized||!this.logFilePath)return;let r=JSON.stringify(t)+`
2669
2669
  `;try{await(0,A3r.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:nkx(),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)}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 pWu=We(Z6u(),1),Zhy=We(O1u(),1),X$=require("fs/promises"),eyy=require("os"),tyy=We(CM(),1),ryy=We(Yhy(),1),xPa=process.platform==="win32",lWu=tt.cyan("[docs]:"),jkx="etag",Ckx=23,Xhy=e=>e.padEnd(Ckx," "),Skx="preview",Bkx="app-preview",Dkx="bundle",Tkx=".next",Rkx="standalone",Fkx=".fern",Nkx="packages/fern-docs/bundle/.next/server/instrumentation.js",Mkx=".npmrc",zkx=".pnpmfile.cjs",Qkx="pnpm-workspace.yaml",qkx='Cannot find matching keyid: {"signatures":';function Vkx(){return vt(xr.of((0,eyy.homedir)()),Xe.of(Fkx))}function _3r({app:e=!1}){return vt(Vkx(),Xe.of(e?Bkx:Skx))}function sqt({app:e=!1}){return vt(_3r({app:e}),Xe.of(e?Tkx:Dkx))}function hvn({app:e=!1}){return vt(sqt({app:e}),Xe.of(Rkx))}function kkx({app:e=!1}){return vt(hvn({app:e}),Xe.of(Nkx))}function Ukx({app:e=!1}){return vt(hvn({app:e}),Xe.of(Qkx))}function Lkx({app:e=!1}){return vt(hvn({app:e}),Xe.of(zkx))}function Wkx({app:e=!1}){return vt(hvn({app:e}),Xe.of(Mkx))}function Ler(e){return new Error(`${e}. Please reach out to support@buildwithfern.com.`)}function Gkx({app:e=!1}){return vt(_3r({app:e}),Xe.of(jkx))}var Hkx=`module.exports = {
2670
2670
  hooks: {