@meet-ai/cli 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import{createRequire as zf}from"node:module";var Nf=Object.create;var{getPrototy
|
|
|
3
3
|
`)}function aD(A){return typeof A==="function"?A():A}function Sf(A=[],B={}){let E=new Set(B.boolean||[]),I=new Set(B.string||[]),Q=B.alias||{},g=B.default||{},U=new Map,N=new Map;for(let[T,u]of Object.entries(Q)){let EA=u;for(let GA of EA){if(U.set(T,GA),!N.has(GA))N.set(GA,[]);if(N.get(GA).push(T),U.set(GA,T),!N.has(T))N.set(T,[]);N.get(T).push(GA)}}let Y={};function v(T){if(E.has(T))return"boolean";let u=N.get(T)||[];for(let EA of u)if(E.has(EA))return"boolean";return"string"}let Z=new Set([...E,...I,...Object.keys(Q),...Object.values(Q).flat(),...Object.keys(g)]);for(let T of Z)if(!Y[T])Y[T]={type:v(T),default:g[T]};for(let[T,u]of U.entries())if(T.length===1&&Y[u]&&!Y[u].short)Y[u].short=T;let j=[],O={};for(let T=0;T<A.length;T++){let u=A[T];if(u==="--"){j.push(...A.slice(T));break}if(u.startsWith("--no-")){let EA=u.slice(5);O[EA]=!0;continue}j.push(u)}let z;try{z=Lf({args:j,options:Object.keys(Y).length>0?Y:void 0,allowPositionals:!0,strict:!1})}catch{z={values:{},positionals:j}}let L={_:[]};L._=z.positionals;for(let[T,u]of Object.entries(z.values))L[T]=u;for(let[T]of Object.entries(O)){L[T]=!1;let u=U.get(T);if(u)L[u]=!1;let EA=N.get(T);if(EA)for(let GA of EA)L[GA]=!1}for(let[T,u]of U.entries()){if(L[T]!==void 0&&L[u]===void 0)L[u]=L[T];if(L[u]!==void 0&&L[T]===void 0)L[T]=L[u]}return L}function yf(A,B){let E={boolean:[],string:[],alias:{},default:{}},I=Dq(B);for(let N of I){if(N.type==="positional")continue;if(N.type==="string"||N.type==="enum")E.string.push(N.name);else if(N.type==="boolean")E.boolean.push(N.name);if(N.default!==void 0)E.default[N.name]=N.default;if(N.alias)E.alias[N.name]=N.alias;let Y=M9(N.name),v=Y9(N.name);if(Y!==N.name||v!==N.name){let Z=Iq(E.alias[N.name]||[]);if(Y!==N.name&&!Z.includes(Y))Z.push(Y);if(v!==N.name&&!Z.includes(v))Z.push(v);if(Z.length>0)E.alias[N.name]=Z}}let Q=Sf(A,E),[...g]=Q._,U=new Proxy(Q,{get(N,Y){return N[Y]??N[M9(Y)]??N[Y9(Y)]}});for(let[,N]of I.entries())if(N.type==="positional"){let Y=g.shift();if(Y!==void 0)U[N.name]=Y;else if(N.default===void 0&&N.required!==!1)throw new z2(`Missing required positional argument: ${N.name.toUpperCase()}`,"EARG");else U[N.name]=N.default}else if(N.type==="enum"){let Y=U[N.name],v=N.options||[];if(Y!==void 0&&v.length>0&&!v.includes(Y))throw new z2(`Invalid value for argument: ${$C(`--${N.name}`)} (${$C(Y)}). Expected one of: ${v.map((Z)=>$C(Z)).join(", ")}.`,"EARG")}else if(N.required&&U[N.name]===void 0)throw new z2(`Missing required argument: --${N.name}`,"EARG");return U}function Dq(A){let B=[];for(let[E,I]of Object.entries(A||{}))B.push({...I,name:E,alias:Iq(I.alias)});return B}function BQ(A){return A}async function Cq(A,B){let E=await aD(A.args||{}),I=yf(B.rawArgs,E),Q={rawArgs:B.rawArgs,args:I,data:B.data,cmd:A};if(typeof A.setup==="function")await A.setup(Q);let g;try{let U=await aD(A.subCommands);if(U&&Object.keys(U).length>0){let N=B.rawArgs.findIndex((v)=>!v.startsWith("-")),Y=B.rawArgs[N];if(Y){if(!U[Y])throw new z2(`Unknown command ${$C(Y)}`,"E_UNKNOWN_COMMAND");let v=await aD(U[Y]);if(v)await Cq(v,{rawArgs:B.rawArgs.slice(N+1)})}else if(!A.run)throw new z2("No command specified.","E_NO_COMMAND")}if(typeof A.run==="function")g=await A.run(Q)}finally{if(typeof A.cleanup==="function")await A.cleanup(Q)}return{result:g}}async function v9(A,B,E){let I=await aD(A.subCommands);if(I&&Object.keys(I).length>0){let Q=B.findIndex((N)=>!N.startsWith("-")),g=B[Q],U=await aD(I[g]);if(U)return v9(U,B.slice(Q+1),A)}return[A,E]}async function Wf(A,B){try{console.log(await xf(A,B)+`
|
|
4
4
|
`)}catch(E){console.error(E)}}async function xf(A,B){let E=await aD(A.meta||{}),I=Dq(await aD(A.args||{})),Q=await aD(B?.meta||{}),g=`${Q.name?`${Q.name} `:""}`+(E.name||process.argv[1]),U=[],N=[],Y=[],v=[];for(let z of I)if(z.type==="positional"){let L=z.name.toUpperCase(),T=z.required!==!1&&z.default===void 0,u=z.default?`="${z.default}"`:"";N.push([$C(L+u),z.description||"",z.valueHint?`<${z.valueHint}>`:""]),v.push(T?`<${L}>`:`[${L}]`)}else{let L=z.required===!0&&z.default===void 0,T=[...(z.alias||[]).map((u)=>`-${u}`),`--${z.name}`].join(", ")+(z.type==="string"&&(z.valueHint||z.default)?`=${z.valueHint?`<${z.valueHint}>`:`"${z.default||""}"`}`:"")+(z.type==="enum"&&z.options?`=<${z.options.join("|")}>`:"");if(U.push([$C(T+(L?" (required)":"")),z.description||""]),z.type==="boolean"&&(z.default===!0||z.negativeDescription)&&!uf.test(z.name)){let u=[...(z.alias||[]).map((EA)=>`--no-${EA}`),`--no-${z.name}`].join(", ");U.push([$C(u+(L?" (required)":"")),z.negativeDescription||""])}if(L)v.push(T)}if(A.subCommands){let z=[],L=await aD(A.subCommands);for(let[T,u]of Object.entries(L)){let EA=await aD((await aD(u))?.meta);if(EA?.hidden)continue;Y.push([$C(T),EA?.description||""]),z.push(T)}v.push(z.join("|"))}let Z=[],j=E.version||Q.version;Z.push(wf(`${E.description} (${g+(j?` v${j}`:"")})`),"");let O=U.length>0||N.length>0;if(Z.push(`${S3(L3("USAGE"))} ${$C(`${g}${O?" [OPTIONS]":""} ${v.join(" ")}`)}`,""),N.length>0)Z.push(S3(L3("ARGUMENTS")),""),Z.push(X9(N," ")),Z.push("");if(U.length>0)Z.push(S3(L3("OPTIONS")),""),Z.push(X9(U," ")),Z.push("");if(Y.length>0)Z.push(S3(L3("COMMANDS")),""),Z.push(X9(Y," ")),Z.push("",`Use ${$C(`${g} <command> --help`)} for more information about a command.`);return Z.filter((z)=>typeof z==="string").join(`
|
|
5
5
|
`)}async function gq(A,B={}){let E=B.rawArgs||process.argv.slice(2),I=B.showUsage||Wf;try{if(E.includes("--help")||E.includes("-h"))await I(...await v9(A,E)),process.exit(0);else if(E.length===1&&E[0]==="--version"){let Q=typeof A.meta==="function"?await A.meta():await A.meta;if(!Q?.version)throw new z2("No version specified","E_NO_VERSION");console.log(Q.version)}else await Cq(A,{rawArgs:E})}catch(Q){if(Q instanceof z2)await I(...await v9(A,E)),console.error(Q.message);else console.error(Q,`
|
|
6
|
-
`);process.exit(1)}}var z2,Tf,T3=(A,B=39)=>(E)=>Tf?E:`\x1B[${A}m${E}\x1B[${B}m`,L3,$C,wf,S3,uf;var SE=P(()=>{Eq();z2=class extends Error{code;constructor(A,B){super(A);this.name="CLIError",this.code=B}};Tf=(()=>{let A=globalThis.process?.env??{};return A.NO_COLOR==="1"||A.TERM==="dumb"||A.TEST||A.CI})(),L3=T3(1,22),$C=T3(36),wf=T3(90),S3=T3(4,24);uf=/^no[-A-Z]/});var M8="0.6.3";var O9=()=>{};var R9=tQ((Rr,z9)=>{var y3=process||{},Uq=y3.argv||[],w3=y3.env||{},ff=!(!!w3.NO_COLOR||Uq.includes("--no-color"))&&(!!w3.FORCE_COLOR||Uq.includes("--color")||y3.platform==="win32"||(y3.stdout||{}).isTTY&&w3.TERM!=="dumb"||!!w3.CI),Pf=(A,B,E=A)=>(I)=>{let Q=""+I,g=Q.indexOf(B,A.length);return~g?A+hf(Q,B,E,g)+B:A+Q+B},hf=(A,B,E,I)=>{let Q="",g=0;do Q+=A.substring(g,I)+E,g=I+B.length,I=A.indexOf(B,g);while(~I);return Q+A.substring(g)},Gq=(A=ff)=>{let B=A?Pf:()=>String;return{isColorSupported:A,reset:B("\x1B[0m","\x1B[0m"),bold:B("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:B("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:B("\x1B[3m","\x1B[23m"),underline:B("\x1B[4m","\x1B[24m"),inverse:B("\x1B[7m","\x1B[27m"),hidden:B("\x1B[8m","\x1B[28m"),strikethrough:B("\x1B[9m","\x1B[29m"),black:B("\x1B[30m","\x1B[39m"),red:B("\x1B[31m","\x1B[39m"),green:B("\x1B[32m","\x1B[39m"),yellow:B("\x1B[33m","\x1B[39m"),blue:B("\x1B[34m","\x1B[39m"),magenta:B("\x1B[35m","\x1B[39m"),cyan:B("\x1B[36m","\x1B[39m"),white:B("\x1B[37m","\x1B[39m"),gray:B("\x1B[90m","\x1B[39m"),bgBlack:B("\x1B[40m","\x1B[49m"),bgRed:B("\x1B[41m","\x1B[49m"),bgGreen:B("\x1B[42m","\x1B[49m"),bgYellow:B("\x1B[43m","\x1B[49m"),bgBlue:B("\x1B[44m","\x1B[49m"),bgMagenta:B("\x1B[45m","\x1B[49m"),bgCyan:B("\x1B[46m","\x1B[49m"),bgWhite:B("\x1B[47m","\x1B[49m"),blackBright:B("\x1B[90m","\x1B[39m"),redBright:B("\x1B[91m","\x1B[39m"),greenBright:B("\x1B[92m","\x1B[39m"),yellowBright:B("\x1B[93m","\x1B[39m"),blueBright:B("\x1B[94m","\x1B[39m"),magentaBright:B("\x1B[95m","\x1B[39m"),cyanBright:B("\x1B[96m","\x1B[39m"),whiteBright:B("\x1B[97m","\x1B[39m"),bgBlackBright:B("\x1B[100m","\x1B[49m"),bgRedBright:B("\x1B[101m","\x1B[49m"),bgGreenBright:B("\x1B[102m","\x1B[49m"),bgYellowBright:B("\x1B[103m","\x1B[49m"),bgBlueBright:B("\x1B[104m","\x1B[49m"),bgMagentaBright:B("\x1B[105m","\x1B[49m"),bgCyanBright:B("\x1B[106m","\x1B[49m"),bgWhiteBright:B("\x1B[107m","\x1B[49m")}};z9.exports=Gq();z9.exports.createColors=Gq});var W3,lE=(A)=>console.log(W3.default.green(A)),uQ=(A)=>console.error(W3.default.red(`error: ${A}`)),u3=(A)=>console.log(W3.default.cyan(A));var UE=P(()=>{W3=kB(R9(),1)});function s(A,B,E){function I(N,Y){if(!N._zod)Object.defineProperty(N,"_zod",{value:{def:Y,constr:U,traits:new Set},enumerable:!1});if(N._zod.traits.has(A))return;N._zod.traits.add(A),B(N,Y);let v=U.prototype,Z=Object.keys(v);for(let j=0;j<Z.length;j++){let O=Z[j];if(!(O in N))N[O]=v[O].bind(N)}}let Q=E?.Parent??Object;class g extends Q{}Object.defineProperty(g,"name",{value:A});function U(N){var Y;let v=E?.Parent?new g:this;I(v,N),(Y=v._zod).deferred??(Y.deferred=[]);for(let Z of v._zod.deferred)Z();return v}return Object.defineProperty(U,"init",{value:I}),Object.defineProperty(U,Symbol.hasInstance,{value:(N)=>{if(E?.Parent&&N instanceof E.Parent)return!0;return N?._zod?.traits?.has(A)}}),Object.defineProperty(U,"name",{value:A}),U}function TE(A){if(A)Object.assign(gF,A);return gF}var Z9,q9,MC,R2,gF;var Y8=P(()=>{Z9=Object.freeze({status:"aborted"});q9=Symbol("zod_brand");MC=class MC extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};R2=class R2 extends Error{constructor(A){super(`Encountered unidirectional transform during encode: ${A}`);this.name="ZodEncodeError"}};gF={}});var mA={};jQ(mA,{unwrapMessage:()=>UF,uint8ArrayToHex:()=>JP,uint8ArrayToBase64url:()=>GP,uint8ArrayToBase64:()=>Nq,stringifyPrimitive:()=>PA,slugify:()=>j9,shallowClone:()=>S9,safeExtend:()=>EP,required:()=>CP,randomString:()=>of,propertyKeyTypes:()=>JF,promiseAllObject:()=>tf,primitiveTypes:()=>T9,prefixIssues:()=>ED,pick:()=>AP,partial:()=>DP,parsedType:()=>kA,optionalKeys:()=>w9,omit:()=>BP,objectClone:()=>df,numKeys:()=>rf,nullish:()=>E0,normalizeParams:()=>cA,mergeDefs:()=>Gg,merge:()=>IP,jsonStringifyReplacer:()=>X8,joinValues:()=>NA,issue:()=>O8,isPlainObject:()=>D0,isObject:()=>Z2,hexToUint8Array:()=>FP,getSizableOrigin:()=>NF,getParsedType:()=>sf,getLengthableOrigin:()=>HF,getEnumValues:()=>GF,getElementAtPath:()=>nf,floatSafeRemainder:()=>V9,finalizeIssue:()=>mI,extend:()=>QP,escapeRegex:()=>LD,esc:()=>x3,defineLazy:()=>QQ,createTransparentProxy:()=>ef,cloneDef:()=>af,clone:()=>ZI,cleanRegex:()=>FF,cleanEnum:()=>gP,captureStackTrace:()=>b3,cached:()=>v8,base64urlToUint8Array:()=>UP,base64ToUint8Array:()=>Jq,assignProp:()=>I0,assertNotEqual:()=>mf,assertNever:()=>cf,assertIs:()=>lf,assertEqual:()=>kf,assert:()=>pf,allowsEval:()=>L9,aborted:()=>C0,NUMBER_FORMAT_RANGES:()=>y9,Class:()=>Hq,BIGINT_FORMAT_RANGES:()=>W9});function kf(A){return A}function mf(A){return A}function lf(A){}function cf(A){throw Error("Unexpected value in exhaustive check")}function pf(A){}function GF(A){let B=Object.values(A).filter((I)=>typeof I==="number");return Object.entries(A).filter(([I,Q])=>B.indexOf(+I)===-1).map(([I,Q])=>Q)}function NA(A,B="|"){return A.map((E)=>PA(E)).join(B)}function X8(A,B){if(typeof B==="bigint")return B.toString();return B}function v8(A){return{get value(){{let E=A();return Object.defineProperty(this,"value",{value:E}),E}throw Error("cached value already set")}}}function E0(A){return A===null||A===void 0}function FF(A){let B=A.startsWith("^")?1:0,E=A.endsWith("$")?A.length-1:A.length;return A.slice(B,E)}function V9(A,B){let E=(A.toString().split(".")[1]||"").length,I=B.toString(),Q=(I.split(".")[1]||"").length;if(Q===0&&/\d?e-\d?/.test(I)){let Y=I.match(/\d?e-(\d?)/);if(Y?.[1])Q=Number.parseInt(Y[1])}let g=E>Q?E:Q,U=Number.parseInt(A.toFixed(g).replace(".","")),N=Number.parseInt(B.toFixed(g).replace(".",""));return U%N/10**g}function QQ(A,B,E){let I=void 0;Object.defineProperty(A,B,{get(){if(I===Fq)return;if(I===void 0)I=Fq,I=E();return I},set(Q){Object.defineProperty(A,B,{value:Q})},configurable:!0})}function df(A){return Object.create(Object.getPrototypeOf(A),Object.getOwnPropertyDescriptors(A))}function I0(A,B,E){Object.defineProperty(A,B,{value:E,writable:!0,enumerable:!0,configurable:!0})}function Gg(...A){let B={};for(let E of A){let I=Object.getOwnPropertyDescriptors(E);Object.assign(B,I)}return Object.defineProperties({},B)}function af(A){return Gg(A._zod.def)}function nf(A,B){if(!B)return A;return B.reduce((E,I)=>E?.[I],A)}function tf(A){let B=Object.keys(A),E=B.map((I)=>A[I]);return Promise.all(E).then((I)=>{let Q={};for(let g=0;g<B.length;g++)Q[B[g]]=I[g];return Q})}function of(A=10){let E="";for(let I=0;I<A;I++)E+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return E}function x3(A){return JSON.stringify(A)}function j9(A){return A.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Z2(A){return typeof A==="object"&&A!==null&&!Array.isArray(A)}function D0(A){if(Z2(A)===!1)return!1;let B=A.constructor;if(B===void 0)return!0;if(typeof B!=="function")return!0;let E=B.prototype;if(Z2(E)===!1)return!1;if(Object.prototype.hasOwnProperty.call(E,"isPrototypeOf")===!1)return!1;return!0}function S9(A){if(D0(A))return{...A};if(Array.isArray(A))return[...A];return A}function rf(A){let B=0;for(let E in A)if(Object.prototype.hasOwnProperty.call(A,E))B++;return B}function LD(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ZI(A,B,E){let I=new A._zod.constr(B??A._zod.def);if(!B||E?.parent)I._zod.parent=A;return I}function cA(A){let B=A;if(!B)return{};if(typeof B==="string")return{error:()=>B};if(B?.message!==void 0){if(B?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");B.error=B.message}if(delete B.message,typeof B.error==="string")return{...B,error:()=>B.error};return B}function ef(A){let B;return new Proxy({},{get(E,I,Q){return B??(B=A()),Reflect.get(B,I,Q)},set(E,I,Q,g){return B??(B=A()),Reflect.set(B,I,Q,g)},has(E,I){return B??(B=A()),Reflect.has(B,I)},deleteProperty(E,I){return B??(B=A()),Reflect.deleteProperty(B,I)},ownKeys(E){return B??(B=A()),Reflect.ownKeys(B)},getOwnPropertyDescriptor(E,I){return B??(B=A()),Reflect.getOwnPropertyDescriptor(B,I)},defineProperty(E,I,Q){return B??(B=A()),Reflect.defineProperty(B,I,Q)}})}function PA(A){if(typeof A==="bigint")return A.toString()+"n";if(typeof A==="string")return`"${A}"`;return`${A}`}function w9(A){return Object.keys(A).filter((B)=>{return A[B]._zod.optin==="optional"&&A[B]._zod.optout==="optional"})}function AP(A,B){let E=A._zod.def,I=E.checks;if(I&&I.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let g=Gg(A._zod.def,{get shape(){let U={};for(let N in B){if(!(N in E.shape))throw Error(`Unrecognized key: "${N}"`);if(!B[N])continue;U[N]=E.shape[N]}return I0(this,"shape",U),U},checks:[]});return ZI(A,g)}function BP(A,B){let E=A._zod.def,I=E.checks;if(I&&I.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let g=Gg(A._zod.def,{get shape(){let U={...A._zod.def.shape};for(let N in B){if(!(N in E.shape))throw Error(`Unrecognized key: "${N}"`);if(!B[N])continue;delete U[N]}return I0(this,"shape",U),U},checks:[]});return ZI(A,g)}function QP(A,B){if(!D0(B))throw Error("Invalid input to extend: expected a plain object");let E=A._zod.def.checks;if(E&&E.length>0){let g=A._zod.def.shape;for(let U in B)if(Object.getOwnPropertyDescriptor(g,U)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let Q=Gg(A._zod.def,{get shape(){let g={...A._zod.def.shape,...B};return I0(this,"shape",g),g}});return ZI(A,Q)}function EP(A,B){if(!D0(B))throw Error("Invalid input to safeExtend: expected a plain object");let E=Gg(A._zod.def,{get shape(){let I={...A._zod.def.shape,...B};return I0(this,"shape",I),I}});return ZI(A,E)}function IP(A,B){let E=Gg(A._zod.def,{get shape(){let I={...A._zod.def.shape,...B._zod.def.shape};return I0(this,"shape",I),I},get catchall(){return B._zod.def.catchall},checks:[]});return ZI(A,E)}function DP(A,B,E){let Q=B._zod.def.checks;if(Q&&Q.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let U=Gg(B._zod.def,{get shape(){let N=B._zod.def.shape,Y={...N};if(E)for(let v in E){if(!(v in N))throw Error(`Unrecognized key: "${v}"`);if(!E[v])continue;Y[v]=A?new A({type:"optional",innerType:N[v]}):N[v]}else for(let v in N)Y[v]=A?new A({type:"optional",innerType:N[v]}):N[v];return I0(this,"shape",Y),Y},checks:[]});return ZI(B,U)}function CP(A,B,E){let I=Gg(B._zod.def,{get shape(){let Q=B._zod.def.shape,g={...Q};if(E)for(let U in E){if(!(U in g))throw Error(`Unrecognized key: "${U}"`);if(!E[U])continue;g[U]=new A({type:"nonoptional",innerType:Q[U]})}else for(let U in Q)g[U]=new A({type:"nonoptional",innerType:Q[U]});return I0(this,"shape",g),g}});return ZI(B,I)}function C0(A,B=0){if(A.aborted===!0)return!0;for(let E=B;E<A.issues.length;E++)if(A.issues[E]?.continue!==!0)return!0;return!1}function ED(A,B){return B.map((E)=>{var I;return(I=E).path??(I.path=[]),E.path.unshift(A),E})}function UF(A){return typeof A==="string"?A:A?.message}function mI(A,B,E){let I={...A,path:A.path??[]};if(!A.message){let Q=UF(A.inst?._zod.def?.error?.(A))??UF(B?.error?.(A))??UF(E.customError?.(A))??UF(E.localeError?.(A))??"Invalid input";I.message=Q}if(delete I.inst,delete I.continue,!B?.reportInput)delete I.input;return I}function NF(A){if(A instanceof Set)return"set";if(A instanceof Map)return"map";if(A instanceof File)return"file";return"unknown"}function HF(A){if(Array.isArray(A))return"array";if(typeof A==="string")return"string";return"unknown"}function kA(A){let B=typeof A;switch(B){case"number":return Number.isNaN(A)?"nan":"number";case"object":{if(A===null)return"null";if(Array.isArray(A))return"array";let E=A;if(E&&Object.getPrototypeOf(E)!==Object.prototype&&"constructor"in E&&E.constructor)return E.constructor.name}}return B}function O8(...A){let[B,E,I]=A;if(typeof B==="string")return{message:B,code:"custom",input:E,inst:I};return{...B}}function gP(A){return Object.entries(A).filter(([B,E])=>{return Number.isNaN(Number.parseInt(B,10))}).map((B)=>B[1])}function Jq(A){let B=atob(A),E=new Uint8Array(B.length);for(let I=0;I<B.length;I++)E[I]=B.charCodeAt(I);return E}function Nq(A){let B="";for(let E=0;E<A.length;E++)B+=String.fromCharCode(A[E]);return btoa(B)}function UP(A){let B=A.replace(/-/g,"+").replace(/_/g,"/"),E="=".repeat((4-B.length%4)%4);return Jq(B+E)}function GP(A){return Nq(A).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function FP(A){let B=A.replace(/^0x/,"");if(B.length%2!==0)throw Error("Invalid hex string length");let E=new Uint8Array(B.length/2);for(let I=0;I<B.length;I+=2)E[I/2]=Number.parseInt(B.slice(I,I+2),16);return E}function JP(A){return Array.from(A).map((B)=>B.toString(16).padStart(2,"0")).join("")}class Hq{constructor(...A){}}var Fq,b3,L9,sf=(A)=>{let B=typeof A;switch(B){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(A)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(A))return"array";if(A===null)return"null";if(A.then&&typeof A.then==="function"&&A.catch&&typeof A.catch==="function")return"promise";if(typeof Map<"u"&&A instanceof Map)return"map";if(typeof Set<"u"&&A instanceof Set)return"set";if(typeof Date<"u"&&A instanceof Date)return"date";if(typeof File<"u"&&A instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${B}`)}},JF,T9,y9,W9;var VB=P(()=>{Fq=Symbol("evaluating");b3="captureStackTrace"in Error?Error.captureStackTrace:(...A)=>{};L9=v8(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(A){return!1}});JF=new Set(["string","number","symbol"]),T9=new Set(["string","number","bigint","boolean","symbol","undefined"]);y9={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},W9={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function $F(A,B=(E)=>E.message){let E={},I=[];for(let Q of A.issues)if(Q.path.length>0)E[Q.path[0]]=E[Q.path[0]]||[],E[Q.path[0]].push(B(Q));else I.push(B(Q));return{formErrors:I,fieldErrors:E}}function MF(A,B=(E)=>E.message){let E={_errors:[]},I=(Q)=>{for(let g of Q.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map((U)=>I({issues:U}));else if(g.code==="invalid_key")I({issues:g.issues});else if(g.code==="invalid_element")I({issues:g.issues});else if(g.path.length===0)E._errors.push(B(g));else{let U=E,N=0;while(N<g.path.length){let Y=g.path[N];if(N!==g.path.length-1)U[Y]=U[Y]||{_errors:[]};else U[Y]=U[Y]||{_errors:[]},U[Y]._errors.push(B(g));U=U[Y],N++}}};return I(A),E}function u9(A,B=(E)=>E.message){let E={errors:[]},I=(Q,g=[])=>{var U,N;for(let Y of Q.issues)if(Y.code==="invalid_union"&&Y.errors.length)Y.errors.map((v)=>I({issues:v},Y.path));else if(Y.code==="invalid_key")I({issues:Y.issues},Y.path);else if(Y.code==="invalid_element")I({issues:Y.issues},Y.path);else{let v=[...g,...Y.path];if(v.length===0){E.errors.push(B(Y));continue}let Z=E,j=0;while(j<v.length){let O=v[j],z=j===v.length-1;if(typeof O==="string")Z.properties??(Z.properties={}),(U=Z.properties)[O]??(U[O]={errors:[]}),Z=Z.properties[O];else Z.items??(Z.items=[]),(N=Z.items)[O]??(N[O]={errors:[]}),Z=Z.items[O];if(z)Z.errors.push(B(Y));j++}}};return I(A),E}function $q(A){let B=[],E=A.map((I)=>typeof I==="object"?I.key:I);for(let I of E)if(typeof I==="number")B.push(`[${I}]`);else if(typeof I==="symbol")B.push(`[${JSON.stringify(String(I))}]`);else if(/[^\w$]/.test(I))B.push(`[${JSON.stringify(I)}]`);else{if(B.length)B.push(".");B.push(I)}return B.join("")}function x9(A){let B=[],E=[...A.issues].sort((I,Q)=>(I.path??[]).length-(Q.path??[]).length);for(let I of E)if(B.push(`✖ ${I.message}`),I.path?.length)B.push(` → at ${$q(I.path)}`);return B.join(`
|
|
6
|
+
`);process.exit(1)}}var z2,Tf,T3=(A,B=39)=>(E)=>Tf?E:`\x1B[${A}m${E}\x1B[${B}m`,L3,$C,wf,S3,uf;var SE=P(()=>{Eq();z2=class extends Error{code;constructor(A,B){super(A);this.name="CLIError",this.code=B}};Tf=(()=>{let A=globalThis.process?.env??{};return A.NO_COLOR==="1"||A.TERM==="dumb"||A.TEST||A.CI})(),L3=T3(1,22),$C=T3(36),wf=T3(90),S3=T3(4,24);uf=/^no[-A-Z]/});var M8="0.6.4";var O9=()=>{};var R9=tQ((Rr,z9)=>{var y3=process||{},Uq=y3.argv||[],w3=y3.env||{},ff=!(!!w3.NO_COLOR||Uq.includes("--no-color"))&&(!!w3.FORCE_COLOR||Uq.includes("--color")||y3.platform==="win32"||(y3.stdout||{}).isTTY&&w3.TERM!=="dumb"||!!w3.CI),Pf=(A,B,E=A)=>(I)=>{let Q=""+I,g=Q.indexOf(B,A.length);return~g?A+hf(Q,B,E,g)+B:A+Q+B},hf=(A,B,E,I)=>{let Q="",g=0;do Q+=A.substring(g,I)+E,g=I+B.length,I=A.indexOf(B,g);while(~I);return Q+A.substring(g)},Gq=(A=ff)=>{let B=A?Pf:()=>String;return{isColorSupported:A,reset:B("\x1B[0m","\x1B[0m"),bold:B("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:B("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:B("\x1B[3m","\x1B[23m"),underline:B("\x1B[4m","\x1B[24m"),inverse:B("\x1B[7m","\x1B[27m"),hidden:B("\x1B[8m","\x1B[28m"),strikethrough:B("\x1B[9m","\x1B[29m"),black:B("\x1B[30m","\x1B[39m"),red:B("\x1B[31m","\x1B[39m"),green:B("\x1B[32m","\x1B[39m"),yellow:B("\x1B[33m","\x1B[39m"),blue:B("\x1B[34m","\x1B[39m"),magenta:B("\x1B[35m","\x1B[39m"),cyan:B("\x1B[36m","\x1B[39m"),white:B("\x1B[37m","\x1B[39m"),gray:B("\x1B[90m","\x1B[39m"),bgBlack:B("\x1B[40m","\x1B[49m"),bgRed:B("\x1B[41m","\x1B[49m"),bgGreen:B("\x1B[42m","\x1B[49m"),bgYellow:B("\x1B[43m","\x1B[49m"),bgBlue:B("\x1B[44m","\x1B[49m"),bgMagenta:B("\x1B[45m","\x1B[49m"),bgCyan:B("\x1B[46m","\x1B[49m"),bgWhite:B("\x1B[47m","\x1B[49m"),blackBright:B("\x1B[90m","\x1B[39m"),redBright:B("\x1B[91m","\x1B[39m"),greenBright:B("\x1B[92m","\x1B[39m"),yellowBright:B("\x1B[93m","\x1B[39m"),blueBright:B("\x1B[94m","\x1B[39m"),magentaBright:B("\x1B[95m","\x1B[39m"),cyanBright:B("\x1B[96m","\x1B[39m"),whiteBright:B("\x1B[97m","\x1B[39m"),bgBlackBright:B("\x1B[100m","\x1B[49m"),bgRedBright:B("\x1B[101m","\x1B[49m"),bgGreenBright:B("\x1B[102m","\x1B[49m"),bgYellowBright:B("\x1B[103m","\x1B[49m"),bgBlueBright:B("\x1B[104m","\x1B[49m"),bgMagentaBright:B("\x1B[105m","\x1B[49m"),bgCyanBright:B("\x1B[106m","\x1B[49m"),bgWhiteBright:B("\x1B[107m","\x1B[49m")}};z9.exports=Gq();z9.exports.createColors=Gq});var W3,lE=(A)=>console.log(W3.default.green(A)),uQ=(A)=>console.error(W3.default.red(`error: ${A}`)),u3=(A)=>console.log(W3.default.cyan(A));var UE=P(()=>{W3=kB(R9(),1)});function s(A,B,E){function I(N,Y){if(!N._zod)Object.defineProperty(N,"_zod",{value:{def:Y,constr:U,traits:new Set},enumerable:!1});if(N._zod.traits.has(A))return;N._zod.traits.add(A),B(N,Y);let v=U.prototype,Z=Object.keys(v);for(let j=0;j<Z.length;j++){let O=Z[j];if(!(O in N))N[O]=v[O].bind(N)}}let Q=E?.Parent??Object;class g extends Q{}Object.defineProperty(g,"name",{value:A});function U(N){var Y;let v=E?.Parent?new g:this;I(v,N),(Y=v._zod).deferred??(Y.deferred=[]);for(let Z of v._zod.deferred)Z();return v}return Object.defineProperty(U,"init",{value:I}),Object.defineProperty(U,Symbol.hasInstance,{value:(N)=>{if(E?.Parent&&N instanceof E.Parent)return!0;return N?._zod?.traits?.has(A)}}),Object.defineProperty(U,"name",{value:A}),U}function TE(A){if(A)Object.assign(gF,A);return gF}var Z9,q9,MC,R2,gF;var Y8=P(()=>{Z9=Object.freeze({status:"aborted"});q9=Symbol("zod_brand");MC=class MC extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};R2=class R2 extends Error{constructor(A){super(`Encountered unidirectional transform during encode: ${A}`);this.name="ZodEncodeError"}};gF={}});var mA={};jQ(mA,{unwrapMessage:()=>UF,uint8ArrayToHex:()=>JP,uint8ArrayToBase64url:()=>GP,uint8ArrayToBase64:()=>Nq,stringifyPrimitive:()=>PA,slugify:()=>j9,shallowClone:()=>S9,safeExtend:()=>EP,required:()=>CP,randomString:()=>of,propertyKeyTypes:()=>JF,promiseAllObject:()=>tf,primitiveTypes:()=>T9,prefixIssues:()=>ED,pick:()=>AP,partial:()=>DP,parsedType:()=>kA,optionalKeys:()=>w9,omit:()=>BP,objectClone:()=>df,numKeys:()=>rf,nullish:()=>E0,normalizeParams:()=>cA,mergeDefs:()=>Gg,merge:()=>IP,jsonStringifyReplacer:()=>X8,joinValues:()=>NA,issue:()=>O8,isPlainObject:()=>D0,isObject:()=>Z2,hexToUint8Array:()=>FP,getSizableOrigin:()=>NF,getParsedType:()=>sf,getLengthableOrigin:()=>HF,getEnumValues:()=>GF,getElementAtPath:()=>nf,floatSafeRemainder:()=>V9,finalizeIssue:()=>mI,extend:()=>QP,escapeRegex:()=>LD,esc:()=>x3,defineLazy:()=>QQ,createTransparentProxy:()=>ef,cloneDef:()=>af,clone:()=>ZI,cleanRegex:()=>FF,cleanEnum:()=>gP,captureStackTrace:()=>b3,cached:()=>v8,base64urlToUint8Array:()=>UP,base64ToUint8Array:()=>Jq,assignProp:()=>I0,assertNotEqual:()=>mf,assertNever:()=>cf,assertIs:()=>lf,assertEqual:()=>kf,assert:()=>pf,allowsEval:()=>L9,aborted:()=>C0,NUMBER_FORMAT_RANGES:()=>y9,Class:()=>Hq,BIGINT_FORMAT_RANGES:()=>W9});function kf(A){return A}function mf(A){return A}function lf(A){}function cf(A){throw Error("Unexpected value in exhaustive check")}function pf(A){}function GF(A){let B=Object.values(A).filter((I)=>typeof I==="number");return Object.entries(A).filter(([I,Q])=>B.indexOf(+I)===-1).map(([I,Q])=>Q)}function NA(A,B="|"){return A.map((E)=>PA(E)).join(B)}function X8(A,B){if(typeof B==="bigint")return B.toString();return B}function v8(A){return{get value(){{let E=A();return Object.defineProperty(this,"value",{value:E}),E}throw Error("cached value already set")}}}function E0(A){return A===null||A===void 0}function FF(A){let B=A.startsWith("^")?1:0,E=A.endsWith("$")?A.length-1:A.length;return A.slice(B,E)}function V9(A,B){let E=(A.toString().split(".")[1]||"").length,I=B.toString(),Q=(I.split(".")[1]||"").length;if(Q===0&&/\d?e-\d?/.test(I)){let Y=I.match(/\d?e-(\d?)/);if(Y?.[1])Q=Number.parseInt(Y[1])}let g=E>Q?E:Q,U=Number.parseInt(A.toFixed(g).replace(".","")),N=Number.parseInt(B.toFixed(g).replace(".",""));return U%N/10**g}function QQ(A,B,E){let I=void 0;Object.defineProperty(A,B,{get(){if(I===Fq)return;if(I===void 0)I=Fq,I=E();return I},set(Q){Object.defineProperty(A,B,{value:Q})},configurable:!0})}function df(A){return Object.create(Object.getPrototypeOf(A),Object.getOwnPropertyDescriptors(A))}function I0(A,B,E){Object.defineProperty(A,B,{value:E,writable:!0,enumerable:!0,configurable:!0})}function Gg(...A){let B={};for(let E of A){let I=Object.getOwnPropertyDescriptors(E);Object.assign(B,I)}return Object.defineProperties({},B)}function af(A){return Gg(A._zod.def)}function nf(A,B){if(!B)return A;return B.reduce((E,I)=>E?.[I],A)}function tf(A){let B=Object.keys(A),E=B.map((I)=>A[I]);return Promise.all(E).then((I)=>{let Q={};for(let g=0;g<B.length;g++)Q[B[g]]=I[g];return Q})}function of(A=10){let E="";for(let I=0;I<A;I++)E+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return E}function x3(A){return JSON.stringify(A)}function j9(A){return A.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Z2(A){return typeof A==="object"&&A!==null&&!Array.isArray(A)}function D0(A){if(Z2(A)===!1)return!1;let B=A.constructor;if(B===void 0)return!0;if(typeof B!=="function")return!0;let E=B.prototype;if(Z2(E)===!1)return!1;if(Object.prototype.hasOwnProperty.call(E,"isPrototypeOf")===!1)return!1;return!0}function S9(A){if(D0(A))return{...A};if(Array.isArray(A))return[...A];return A}function rf(A){let B=0;for(let E in A)if(Object.prototype.hasOwnProperty.call(A,E))B++;return B}function LD(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ZI(A,B,E){let I=new A._zod.constr(B??A._zod.def);if(!B||E?.parent)I._zod.parent=A;return I}function cA(A){let B=A;if(!B)return{};if(typeof B==="string")return{error:()=>B};if(B?.message!==void 0){if(B?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");B.error=B.message}if(delete B.message,typeof B.error==="string")return{...B,error:()=>B.error};return B}function ef(A){let B;return new Proxy({},{get(E,I,Q){return B??(B=A()),Reflect.get(B,I,Q)},set(E,I,Q,g){return B??(B=A()),Reflect.set(B,I,Q,g)},has(E,I){return B??(B=A()),Reflect.has(B,I)},deleteProperty(E,I){return B??(B=A()),Reflect.deleteProperty(B,I)},ownKeys(E){return B??(B=A()),Reflect.ownKeys(B)},getOwnPropertyDescriptor(E,I){return B??(B=A()),Reflect.getOwnPropertyDescriptor(B,I)},defineProperty(E,I,Q){return B??(B=A()),Reflect.defineProperty(B,I,Q)}})}function PA(A){if(typeof A==="bigint")return A.toString()+"n";if(typeof A==="string")return`"${A}"`;return`${A}`}function w9(A){return Object.keys(A).filter((B)=>{return A[B]._zod.optin==="optional"&&A[B]._zod.optout==="optional"})}function AP(A,B){let E=A._zod.def,I=E.checks;if(I&&I.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let g=Gg(A._zod.def,{get shape(){let U={};for(let N in B){if(!(N in E.shape))throw Error(`Unrecognized key: "${N}"`);if(!B[N])continue;U[N]=E.shape[N]}return I0(this,"shape",U),U},checks:[]});return ZI(A,g)}function BP(A,B){let E=A._zod.def,I=E.checks;if(I&&I.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let g=Gg(A._zod.def,{get shape(){let U={...A._zod.def.shape};for(let N in B){if(!(N in E.shape))throw Error(`Unrecognized key: "${N}"`);if(!B[N])continue;delete U[N]}return I0(this,"shape",U),U},checks:[]});return ZI(A,g)}function QP(A,B){if(!D0(B))throw Error("Invalid input to extend: expected a plain object");let E=A._zod.def.checks;if(E&&E.length>0){let g=A._zod.def.shape;for(let U in B)if(Object.getOwnPropertyDescriptor(g,U)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let Q=Gg(A._zod.def,{get shape(){let g={...A._zod.def.shape,...B};return I0(this,"shape",g),g}});return ZI(A,Q)}function EP(A,B){if(!D0(B))throw Error("Invalid input to safeExtend: expected a plain object");let E=Gg(A._zod.def,{get shape(){let I={...A._zod.def.shape,...B};return I0(this,"shape",I),I}});return ZI(A,E)}function IP(A,B){let E=Gg(A._zod.def,{get shape(){let I={...A._zod.def.shape,...B._zod.def.shape};return I0(this,"shape",I),I},get catchall(){return B._zod.def.catchall},checks:[]});return ZI(A,E)}function DP(A,B,E){let Q=B._zod.def.checks;if(Q&&Q.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let U=Gg(B._zod.def,{get shape(){let N=B._zod.def.shape,Y={...N};if(E)for(let v in E){if(!(v in N))throw Error(`Unrecognized key: "${v}"`);if(!E[v])continue;Y[v]=A?new A({type:"optional",innerType:N[v]}):N[v]}else for(let v in N)Y[v]=A?new A({type:"optional",innerType:N[v]}):N[v];return I0(this,"shape",Y),Y},checks:[]});return ZI(B,U)}function CP(A,B,E){let I=Gg(B._zod.def,{get shape(){let Q=B._zod.def.shape,g={...Q};if(E)for(let U in E){if(!(U in g))throw Error(`Unrecognized key: "${U}"`);if(!E[U])continue;g[U]=new A({type:"nonoptional",innerType:Q[U]})}else for(let U in Q)g[U]=new A({type:"nonoptional",innerType:Q[U]});return I0(this,"shape",g),g}});return ZI(B,I)}function C0(A,B=0){if(A.aborted===!0)return!0;for(let E=B;E<A.issues.length;E++)if(A.issues[E]?.continue!==!0)return!0;return!1}function ED(A,B){return B.map((E)=>{var I;return(I=E).path??(I.path=[]),E.path.unshift(A),E})}function UF(A){return typeof A==="string"?A:A?.message}function mI(A,B,E){let I={...A,path:A.path??[]};if(!A.message){let Q=UF(A.inst?._zod.def?.error?.(A))??UF(B?.error?.(A))??UF(E.customError?.(A))??UF(E.localeError?.(A))??"Invalid input";I.message=Q}if(delete I.inst,delete I.continue,!B?.reportInput)delete I.input;return I}function NF(A){if(A instanceof Set)return"set";if(A instanceof Map)return"map";if(A instanceof File)return"file";return"unknown"}function HF(A){if(Array.isArray(A))return"array";if(typeof A==="string")return"string";return"unknown"}function kA(A){let B=typeof A;switch(B){case"number":return Number.isNaN(A)?"nan":"number";case"object":{if(A===null)return"null";if(Array.isArray(A))return"array";let E=A;if(E&&Object.getPrototypeOf(E)!==Object.prototype&&"constructor"in E&&E.constructor)return E.constructor.name}}return B}function O8(...A){let[B,E,I]=A;if(typeof B==="string")return{message:B,code:"custom",input:E,inst:I};return{...B}}function gP(A){return Object.entries(A).filter(([B,E])=>{return Number.isNaN(Number.parseInt(B,10))}).map((B)=>B[1])}function Jq(A){let B=atob(A),E=new Uint8Array(B.length);for(let I=0;I<B.length;I++)E[I]=B.charCodeAt(I);return E}function Nq(A){let B="";for(let E=0;E<A.length;E++)B+=String.fromCharCode(A[E]);return btoa(B)}function UP(A){let B=A.replace(/-/g,"+").replace(/_/g,"/"),E="=".repeat((4-B.length%4)%4);return Jq(B+E)}function GP(A){return Nq(A).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function FP(A){let B=A.replace(/^0x/,"");if(B.length%2!==0)throw Error("Invalid hex string length");let E=new Uint8Array(B.length/2);for(let I=0;I<B.length;I+=2)E[I/2]=Number.parseInt(B.slice(I,I+2),16);return E}function JP(A){return Array.from(A).map((B)=>B.toString(16).padStart(2,"0")).join("")}class Hq{constructor(...A){}}var Fq,b3,L9,sf=(A)=>{let B=typeof A;switch(B){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(A)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(A))return"array";if(A===null)return"null";if(A.then&&typeof A.then==="function"&&A.catch&&typeof A.catch==="function")return"promise";if(typeof Map<"u"&&A instanceof Map)return"map";if(typeof Set<"u"&&A instanceof Set)return"set";if(typeof Date<"u"&&A instanceof Date)return"date";if(typeof File<"u"&&A instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${B}`)}},JF,T9,y9,W9;var VB=P(()=>{Fq=Symbol("evaluating");b3="captureStackTrace"in Error?Error.captureStackTrace:(...A)=>{};L9=v8(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(A){return!1}});JF=new Set(["string","number","symbol"]),T9=new Set(["string","number","bigint","boolean","symbol","undefined"]);y9={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},W9={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function $F(A,B=(E)=>E.message){let E={},I=[];for(let Q of A.issues)if(Q.path.length>0)E[Q.path[0]]=E[Q.path[0]]||[],E[Q.path[0]].push(B(Q));else I.push(B(Q));return{formErrors:I,fieldErrors:E}}function MF(A,B=(E)=>E.message){let E={_errors:[]},I=(Q)=>{for(let g of Q.issues)if(g.code==="invalid_union"&&g.errors.length)g.errors.map((U)=>I({issues:U}));else if(g.code==="invalid_key")I({issues:g.issues});else if(g.code==="invalid_element")I({issues:g.issues});else if(g.path.length===0)E._errors.push(B(g));else{let U=E,N=0;while(N<g.path.length){let Y=g.path[N];if(N!==g.path.length-1)U[Y]=U[Y]||{_errors:[]};else U[Y]=U[Y]||{_errors:[]},U[Y]._errors.push(B(g));U=U[Y],N++}}};return I(A),E}function u9(A,B=(E)=>E.message){let E={errors:[]},I=(Q,g=[])=>{var U,N;for(let Y of Q.issues)if(Y.code==="invalid_union"&&Y.errors.length)Y.errors.map((v)=>I({issues:v},Y.path));else if(Y.code==="invalid_key")I({issues:Y.issues},Y.path);else if(Y.code==="invalid_element")I({issues:Y.issues},Y.path);else{let v=[...g,...Y.path];if(v.length===0){E.errors.push(B(Y));continue}let Z=E,j=0;while(j<v.length){let O=v[j],z=j===v.length-1;if(typeof O==="string")Z.properties??(Z.properties={}),(U=Z.properties)[O]??(U[O]={errors:[]}),Z=Z.properties[O];else Z.items??(Z.items=[]),(N=Z.items)[O]??(N[O]={errors:[]}),Z=Z.items[O];if(z)Z.errors.push(B(Y));j++}}};return I(A),E}function $q(A){let B=[],E=A.map((I)=>typeof I==="object"?I.key:I);for(let I of E)if(typeof I==="number")B.push(`[${I}]`);else if(typeof I==="symbol")B.push(`[${JSON.stringify(String(I))}]`);else if(/[^\w$]/.test(I))B.push(`[${JSON.stringify(I)}]`);else{if(B.length)B.push(".");B.push(I)}return B.join("")}function x9(A){let B=[],E=[...A.issues].sort((I,Q)=>(I.path??[]).length-(Q.path??[]).length);for(let I of E)if(B.push(`✖ ${I.message}`),I.path?.length)B.push(` → at ${$q(I.path)}`);return B.join(`
|
|
7
7
|
`)}var Kq=(A,B)=>{A.name="$ZodError",Object.defineProperty(A,"_zod",{value:A._zod,enumerable:!1}),Object.defineProperty(A,"issues",{value:B,enumerable:!1}),A.message=JSON.stringify(B,X8,2),Object.defineProperty(A,"toString",{value:()=>A.message,enumerable:!1})},KF,lI;var b9=P(()=>{Y8();VB();KF=s("$ZodError",Kq),lI=s("$ZodError",Kq,{Parent:Error})});var z8=(A)=>(B,E,I,Q)=>{let g=I?Object.assign(I,{async:!1}):{async:!1},U=B._zod.run({value:E,issues:[]},g);if(U instanceof Promise)throw new MC;if(U.issues.length){let N=new(Q?.Err??A)(U.issues.map((Y)=>mI(Y,g,TE())));throw b3(N,Q?.callee),N}return U.value},f3,R8=(A)=>async(B,E,I,Q)=>{let g=I?Object.assign(I,{async:!0}):{async:!0},U=B._zod.run({value:E,issues:[]},g);if(U instanceof Promise)U=await U;if(U.issues.length){let N=new(Q?.Err??A)(U.issues.map((Y)=>mI(Y,g,TE())));throw b3(N,Q?.callee),N}return U.value},P3,Z8=(A)=>(B,E,I)=>{let Q=I?{...I,async:!1}:{async:!1},g=B._zod.run({value:E,issues:[]},Q);if(g instanceof Promise)throw new MC;return g.issues.length?{success:!1,error:new(A??KF)(g.issues.map((U)=>mI(U,Q,TE())))}:{success:!0,data:g.value}},f9,q8=(A)=>async(B,E,I)=>{let Q=I?Object.assign(I,{async:!0}):{async:!0},g=B._zod.run({value:E,issues:[]},Q);if(g instanceof Promise)g=await g;return g.issues.length?{success:!1,error:new A(g.issues.map((U)=>mI(U,Q,TE())))}:{success:!0,data:g.value}},P9,h3=(A)=>(B,E,I)=>{let Q=I?Object.assign(I,{direction:"backward"}):{direction:"backward"};return z8(A)(B,E,Q)},HP,k3=(A)=>(B,E,I)=>{return z8(A)(B,E,I)},KP,m3=(A)=>async(B,E,I)=>{let Q=I?Object.assign(I,{direction:"backward"}):{direction:"backward"};return R8(A)(B,E,Q)},$P,l3=(A)=>async(B,E,I)=>{return R8(A)(B,E,I)},MP,c3=(A)=>(B,E,I)=>{let Q=I?Object.assign(I,{direction:"backward"}):{direction:"backward"};return Z8(A)(B,E,Q)},YP,p3=(A)=>(B,E,I)=>{return Z8(A)(B,E,I)},XP,i3=(A)=>async(B,E,I)=>{let Q=I?Object.assign(I,{direction:"backward"}):{direction:"backward"};return q8(A)(B,E,Q)},vP,d3=(A)=>async(B,E,I)=>{return q8(A)(B,E,I)},OP;var h9=P(()=>{Y8();b9();VB();f3=z8(lI),P3=R8(lI),f9=Z8(lI),P9=q8(lI),HP=h3(lI),KP=k3(lI),$P=m3(lI),MP=l3(lI),YP=c3(lI),XP=p3(lI),vP=i3(lI),OP=d3(lI)});var SD={};jQ(SD,{xid:()=>c9,uuid7:()=>qP,uuid6:()=>ZP,uuid4:()=>RP,uuid:()=>q2,uppercase:()=>HM,unicodeEmail:()=>Mq,undefined:()=>JM,ulid:()=>l9,time:()=>IM,string:()=>CM,sha512_hex:()=>iP,sha512_base64url:()=>aP,sha512_base64:()=>dP,sha384_hex:()=>lP,sha384_base64url:()=>pP,sha384_base64:()=>cP,sha256_hex:()=>hP,sha256_base64url:()=>mP,sha256_base64:()=>kP,sha1_hex:()=>bP,sha1_base64url:()=>PP,sha1_base64:()=>fP,rfc5322Email:()=>VP,number:()=>YF,null:()=>FM,nanoid:()=>i9,md5_hex:()=>WP,md5_base64url:()=>xP,md5_base64:()=>uP,mac:()=>s9,lowercase:()=>NM,ksuid:()=>p9,ipv6:()=>r9,ipv4:()=>o9,integer:()=>UM,idnEmail:()=>jP,html5Email:()=>_P,hostname:()=>TP,hex:()=>yP,guid:()=>a9,extendedDuration:()=>zP,emoji:()=>t9,email:()=>n9,e164:()=>QM,duration:()=>d9,domain:()=>wP,datetime:()=>DM,date:()=>EM,cuid2:()=>m9,cuid:()=>k9,cidrv6:()=>AM,cidrv4:()=>e9,browserEmail:()=>LP,boolean:()=>GM,bigint:()=>gM,base64url:()=>a3,base64:()=>BM});function t9(){return new RegExp(SP,"u")}function Xq(A){return typeof A.precision==="number"?A.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":A.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${A.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function IM(A){return new RegExp(`^${Xq(A)}$`)}function DM(A){let B=Xq({precision:A.precision}),E=["Z"];if(A.local)E.push("");if(A.offset)E.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let I=`${B}(?:${E.join("|")})`;return new RegExp(`^${Yq}T(?:${I})$`)}function XF(A,B){return new RegExp(`^[A-Za-z0-9+/]{${A}}${B}$`)}function vF(A){return new RegExp(`^[A-Za-z0-9_-]{${A}}$`)}var k9,m9,l9,c9,p9,i9,d9,zP,a9,q2=(A)=>{if(!A)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${A}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},RP,ZP,qP,n9,_P,VP,Mq,jP,LP,SP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",o9,r9,s9=(A)=>{let B=LD(A??":");return new RegExp(`^(?:[0-9A-F]{2}${B}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${B}){5}[0-9a-f]{2}$`)},e9,AM,BM,a3,TP,wP,QM,Yq="(?:(?:\\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])))",EM,CM=(A)=>{let B=A?`[\\s\\S]{${A?.minimum??0},${A?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${B}$`)},gM,UM,YF,GM,FM,JM,NM,HM,yP,WP,uP,xP,bP,fP,PP,hP,kP,mP,lP,cP,pP,iP,dP,aP;var n3=P(()=>{VB();k9=/^[cC][^\s-]{8,}$/,m9=/^[0-9a-z]+$/,l9=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,c9=/^[0-9a-vA-V]{20}$/,p9=/^[A-Za-z0-9]{27}$/,i9=/^[a-zA-Z0-9_-]{21}$/,d9=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zP=/^[-+]?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)?)??$/,a9=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,RP=q2(4),ZP=q2(6),qP=q2(7),n9=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_P=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,VP=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Mq=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,jP=Mq,LP=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;o9=/^(?:(?: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])$/,r9=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,e9=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,AM=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,BM=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,a3=/^[A-Za-z0-9_-]*$/,TP=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,wP=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,QM=/^\+[1-9]\d{6,14}$/,EM=new RegExp(`^${Yq}$`);gM=/^-?\d+n?$/,UM=/^-?\d+$/,YF=/^-?\d+(?:\.\d+)?$/,GM=/^(?:true|false)$/i,FM=/^null$/i,JM=/^undefined$/i,NM=/^[^A-Z]*$/,HM=/^[^a-z]*$/,yP=/^[0-9a-fA-F]*$/;WP=/^[0-9a-fA-F]{32}$/,uP=XF(22,"=="),xP=vF(22),bP=/^[0-9a-fA-F]{40}$/,fP=XF(27,"="),PP=vF(27),hP=/^[0-9a-fA-F]{64}$/,kP=XF(43,"="),mP=vF(43),lP=/^[0-9a-fA-F]{96}$/,cP=XF(64,""),pP=vF(64),iP=/^[0-9a-fA-F]{128}$/,dP=XF(86,"=="),aP=vF(86)});function vq(A,B,E){if(A.issues.length)B.issues.push(...ED(E,A.issues))}var mQ,Oq,t3,o3,KM,$M,MM,YM,XM,vM,OM,zM,RM,_8,ZM,qM,_M,VM,jM,LM,SM,TM,wM;var r3=P(()=>{Y8();n3();VB();mQ=s("$ZodCheck",(A,B)=>{var E;A._zod??(A._zod={}),A._zod.def=B,(E=A._zod).onattach??(E.onattach=[])}),Oq={number:"number",bigint:"bigint",object:"date"},t3=s("$ZodCheckLessThan",(A,B)=>{mQ.init(A,B);let E=Oq[typeof B.value];A._zod.onattach.push((I)=>{let Q=I._zod.bag,g=(B.inclusive?Q.maximum:Q.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(B.value<g)if(B.inclusive)Q.maximum=B.value;else Q.exclusiveMaximum=B.value}),A._zod.check=(I)=>{if(B.inclusive?I.value<=B.value:I.value<B.value)return;I.issues.push({origin:E,code:"too_big",maximum:typeof B.value==="object"?B.value.getTime():B.value,input:I.value,inclusive:B.inclusive,inst:A,continue:!B.abort})}}),o3=s("$ZodCheckGreaterThan",(A,B)=>{mQ.init(A,B);let E=Oq[typeof B.value];A._zod.onattach.push((I)=>{let Q=I._zod.bag,g=(B.inclusive?Q.minimum:Q.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(B.value>g)if(B.inclusive)Q.minimum=B.value;else Q.exclusiveMinimum=B.value}),A._zod.check=(I)=>{if(B.inclusive?I.value>=B.value:I.value>B.value)return;I.issues.push({origin:E,code:"too_small",minimum:typeof B.value==="object"?B.value.getTime():B.value,input:I.value,inclusive:B.inclusive,inst:A,continue:!B.abort})}}),KM=s("$ZodCheckMultipleOf",(A,B)=>{mQ.init(A,B),A._zod.onattach.push((E)=>{var I;(I=E._zod.bag).multipleOf??(I.multipleOf=B.value)}),A._zod.check=(E)=>{if(typeof E.value!==typeof B.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof E.value==="bigint"?E.value%B.value===BigInt(0):V9(E.value,B.value)===0)return;E.issues.push({origin:typeof E.value,code:"not_multiple_of",divisor:B.value,input:E.value,inst:A,continue:!B.abort})}}),$M=s("$ZodCheckNumberFormat",(A,B)=>{mQ.init(A,B),B.format=B.format||"float64";let E=B.format?.includes("int"),I=E?"int":"number",[Q,g]=y9[B.format];A._zod.onattach.push((U)=>{let N=U._zod.bag;if(N.format=B.format,N.minimum=Q,N.maximum=g,E)N.pattern=UM}),A._zod.check=(U)=>{let N=U.value;if(E){if(!Number.isInteger(N)){U.issues.push({expected:I,format:B.format,code:"invalid_type",continue:!1,input:N,inst:A});return}if(!Number.isSafeInteger(N)){if(N>0)U.issues.push({input:N,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:A,origin:I,inclusive:!0,continue:!B.abort});else U.issues.push({input:N,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:A,origin:I,inclusive:!0,continue:!B.abort});return}}if(N<Q)U.issues.push({origin:"number",input:N,code:"too_small",minimum:Q,inclusive:!0,inst:A,continue:!B.abort});if(N>g)U.issues.push({origin:"number",input:N,code:"too_big",maximum:g,inclusive:!0,inst:A,continue:!B.abort})}}),MM=s("$ZodCheckBigIntFormat",(A,B)=>{mQ.init(A,B);let[E,I]=W9[B.format];A._zod.onattach.push((Q)=>{let g=Q._zod.bag;g.format=B.format,g.minimum=E,g.maximum=I}),A._zod.check=(Q)=>{let g=Q.value;if(g<E)Q.issues.push({origin:"bigint",input:g,code:"too_small",minimum:E,inclusive:!0,inst:A,continue:!B.abort});if(g>I)Q.issues.push({origin:"bigint",input:g,code:"too_big",maximum:I,inclusive:!0,inst:A,continue:!B.abort})}}),YM=s("$ZodCheckMaxSize",(A,B)=>{var E;mQ.init(A,B),(E=A._zod.def).when??(E.when=(I)=>{let Q=I.value;return!E0(Q)&&Q.size!==void 0}),A._zod.onattach.push((I)=>{let Q=I._zod.bag.maximum??Number.POSITIVE_INFINITY;if(B.maximum<Q)I._zod.bag.maximum=B.maximum}),A._zod.check=(I)=>{let Q=I.value;if(Q.size<=B.maximum)return;I.issues.push({origin:NF(Q),code:"too_big",maximum:B.maximum,inclusive:!0,input:Q,inst:A,continue:!B.abort})}}),XM=s("$ZodCheckMinSize",(A,B)=>{var E;mQ.init(A,B),(E=A._zod.def).when??(E.when=(I)=>{let Q=I.value;return!E0(Q)&&Q.size!==void 0}),A._zod.onattach.push((I)=>{let Q=I._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(B.minimum>Q)I._zod.bag.minimum=B.minimum}),A._zod.check=(I)=>{let Q=I.value;if(Q.size>=B.minimum)return;I.issues.push({origin:NF(Q),code:"too_small",minimum:B.minimum,inclusive:!0,input:Q,inst:A,continue:!B.abort})}}),vM=s("$ZodCheckSizeEquals",(A,B)=>{var E;mQ.init(A,B),(E=A._zod.def).when??(E.when=(I)=>{let Q=I.value;return!E0(Q)&&Q.size!==void 0}),A._zod.onattach.push((I)=>{let Q=I._zod.bag;Q.minimum=B.size,Q.maximum=B.size,Q.size=B.size}),A._zod.check=(I)=>{let Q=I.value,g=Q.size;if(g===B.size)return;let U=g>B.size;I.issues.push({origin:NF(Q),...U?{code:"too_big",maximum:B.size}:{code:"too_small",minimum:B.size},inclusive:!0,exact:!0,input:I.value,inst:A,continue:!B.abort})}}),OM=s("$ZodCheckMaxLength",(A,B)=>{var E;mQ.init(A,B),(E=A._zod.def).when??(E.when=(I)=>{let Q=I.value;return!E0(Q)&&Q.length!==void 0}),A._zod.onattach.push((I)=>{let Q=I._zod.bag.maximum??Number.POSITIVE_INFINITY;if(B.maximum<Q)I._zod.bag.maximum=B.maximum}),A._zod.check=(I)=>{let Q=I.value;if(Q.length<=B.maximum)return;let U=HF(Q);I.issues.push({origin:U,code:"too_big",maximum:B.maximum,inclusive:!0,input:Q,inst:A,continue:!B.abort})}}),zM=s("$ZodCheckMinLength",(A,B)=>{var E;mQ.init(A,B),(E=A._zod.def).when??(E.when=(I)=>{let Q=I.value;return!E0(Q)&&Q.length!==void 0}),A._zod.onattach.push((I)=>{let Q=I._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(B.minimum>Q)I._zod.bag.minimum=B.minimum}),A._zod.check=(I)=>{let Q=I.value;if(Q.length>=B.minimum)return;let U=HF(Q);I.issues.push({origin:U,code:"too_small",minimum:B.minimum,inclusive:!0,input:Q,inst:A,continue:!B.abort})}}),RM=s("$ZodCheckLengthEquals",(A,B)=>{var E;mQ.init(A,B),(E=A._zod.def).when??(E.when=(I)=>{let Q=I.value;return!E0(Q)&&Q.length!==void 0}),A._zod.onattach.push((I)=>{let Q=I._zod.bag;Q.minimum=B.length,Q.maximum=B.length,Q.length=B.length}),A._zod.check=(I)=>{let Q=I.value,g=Q.length;if(g===B.length)return;let U=HF(Q),N=g>B.length;I.issues.push({origin:U,...N?{code:"too_big",maximum:B.length}:{code:"too_small",minimum:B.length},inclusive:!0,exact:!0,input:I.value,inst:A,continue:!B.abort})}}),_8=s("$ZodCheckStringFormat",(A,B)=>{var E,I;if(mQ.init(A,B),A._zod.onattach.push((Q)=>{let g=Q._zod.bag;if(g.format=B.format,B.pattern)g.patterns??(g.patterns=new Set),g.patterns.add(B.pattern)}),B.pattern)(E=A._zod).check??(E.check=(Q)=>{if(B.pattern.lastIndex=0,B.pattern.test(Q.value))return;Q.issues.push({origin:"string",code:"invalid_format",format:B.format,input:Q.value,...B.pattern?{pattern:B.pattern.toString()}:{},inst:A,continue:!B.abort})});else(I=A._zod).check??(I.check=()=>{})}),ZM=s("$ZodCheckRegex",(A,B)=>{_8.init(A,B),A._zod.check=(E)=>{if(B.pattern.lastIndex=0,B.pattern.test(E.value))return;E.issues.push({origin:"string",code:"invalid_format",format:"regex",input:E.value,pattern:B.pattern.toString(),inst:A,continue:!B.abort})}}),qM=s("$ZodCheckLowerCase",(A,B)=>{B.pattern??(B.pattern=NM),_8.init(A,B)}),_M=s("$ZodCheckUpperCase",(A,B)=>{B.pattern??(B.pattern=HM),_8.init(A,B)}),VM=s("$ZodCheckIncludes",(A,B)=>{mQ.init(A,B);let E=LD(B.includes),I=new RegExp(typeof B.position==="number"?`^.{${B.position}}${E}`:E);B.pattern=I,A._zod.onattach.push((Q)=>{let g=Q._zod.bag;g.patterns??(g.patterns=new Set),g.patterns.add(I)}),A._zod.check=(Q)=>{if(Q.value.includes(B.includes,B.position))return;Q.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:B.includes,input:Q.value,inst:A,continue:!B.abort})}}),jM=s("$ZodCheckStartsWith",(A,B)=>{mQ.init(A,B);let E=new RegExp(`^${LD(B.prefix)}.*`);B.pattern??(B.pattern=E),A._zod.onattach.push((I)=>{let Q=I._zod.bag;Q.patterns??(Q.patterns=new Set),Q.patterns.add(E)}),A._zod.check=(I)=>{if(I.value.startsWith(B.prefix))return;I.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:B.prefix,input:I.value,inst:A,continue:!B.abort})}}),LM=s("$ZodCheckEndsWith",(A,B)=>{mQ.init(A,B);let E=new RegExp(`.*${LD(B.suffix)}$`);B.pattern??(B.pattern=E),A._zod.onattach.push((I)=>{let Q=I._zod.bag;Q.patterns??(Q.patterns=new Set),Q.patterns.add(E)}),A._zod.check=(I)=>{if(I.value.endsWith(B.suffix))return;I.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:B.suffix,input:I.value,inst:A,continue:!B.abort})}});SM=s("$ZodCheckProperty",(A,B)=>{mQ.init(A,B),A._zod.check=(E)=>{let I=B.schema._zod.run({value:E.value[B.property],issues:[]},{});if(I instanceof Promise)return I.then((Q)=>vq(Q,E,B.property));vq(I,E,B.property);return}}),TM=s("$ZodCheckMimeType",(A,B)=>{mQ.init(A,B);let E=new Set(B.mime);A._zod.onattach.push((I)=>{I._zod.bag.mime=B.mime}),A._zod.check=(I)=>{if(E.has(I.value.type))return;I.issues.push({code:"invalid_value",values:B.mime,input:I.value.type,inst:A,continue:!B.abort})}}),wM=s("$ZodCheckOverwrite",(A,B)=>{mQ.init(A,B),A._zod.check=(E)=>{E.value=B.tx(E.value)}})});class s3{constructor(A=[]){if(this.content=[],this.indent=0,this)this.args=A}indented(A){this.indent+=1,A(this),this.indent-=1}write(A){if(typeof A==="function"){A(this,{execution:"sync"}),A(this,{execution:"async"});return}let E=A.split(`
|
|
8
8
|
`).filter((g)=>g),I=Math.min(...E.map((g)=>g.length-g.trimStart().length)),Q=E.map((g)=>g.slice(I)).map((g)=>" ".repeat(this.indent*2)+g);for(let g of Q)this.content.push(g)}compile(){let A=Function,B=this?.args,I=[...(this?.content??[""]).map((Q)=>` ${Q}`)];return new A(...B,I.join(`
|
|
9
9
|
`))}}var yM;var WM=P(()=>{yM={major:4,minor:3,patch:6}});function BY(A){if(A==="")return!0;if(A.length%4!==0)return!1;try{return atob(A),!0}catch{return!1}}function Wq(A){if(!a3.test(A))return!1;let B=A.replace(/[-_]/g,(I)=>I==="-"?"+":"/"),E=B.padEnd(Math.ceil(B.length/4)*4,"=");return BY(E)}function uq(A,B=null){try{let E=A.split(".");if(E.length!==3)return!1;let[I]=E;if(!I)return!1;let Q=JSON.parse(atob(I));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(B&&(!("alg"in Q)||Q.alg!==B))return!1;return!0}catch{return!1}}function Rq(A,B,E){if(A.issues.length)B.issues.push(...ED(E,A.issues));B.value[E]=A.value}function EJ(A,B,E,I,Q){if(A.issues.length){if(Q&&!(E in I))return;B.issues.push(...ED(E,A.issues))}if(A.value===void 0){if(E in I)B.value[E]=void 0}else B.value[E]=A.value}function xq(A){let B=Object.keys(A.shape);for(let I of B)if(!A.shape?.[I]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${I}": expected a Zod schema`);let E=w9(A.shape);return{...A,keys:B,keySet:new Set(B),numKeys:B.length,optionalKeys:new Set(E)}}function bq(A,B,E,I,Q,g){let U=[],N=Q.keySet,Y=Q.catchall._zod,v=Y.def.type,Z=Y.optout==="optional";for(let j in B){if(N.has(j))continue;if(v==="never"){U.push(j);continue}let O=Y.run({value:B[j],issues:[]},I);if(O instanceof Promise)A.push(O.then((z)=>EJ(z,E,j,B,Z)));else EJ(O,E,j,B,Z)}if(U.length)E.issues.push({code:"unrecognized_keys",keys:U,input:B,inst:g});if(!A.length)return E;return Promise.all(A).then(()=>{return E})}function Zq(A,B,E,I){for(let g of A)if(g.issues.length===0)return B.value=g.value,B;let Q=A.filter((g)=>!C0(g));if(Q.length===1)return B.value=Q[0].value,Q[0];return B.issues.push({code:"invalid_union",input:B.value,inst:E,errors:A.map((g)=>g.issues.map((U)=>mI(U,I,TE())))}),B}function qq(A,B,E,I){let Q=A.filter((g)=>g.issues.length===0);if(Q.length===1)return B.value=Q[0].value,B;if(Q.length===0)B.issues.push({code:"invalid_union",input:B.value,inst:E,errors:A.map((g)=>g.issues.map((U)=>mI(U,I,TE())))});else B.issues.push({code:"invalid_union",input:B.value,inst:E,errors:[],inclusive:!1});return B}function uM(A,B){if(A===B)return{valid:!0,data:A};if(A instanceof Date&&B instanceof Date&&+A===+B)return{valid:!0,data:A};if(D0(A)&&D0(B)){let E=Object.keys(B),I=Object.keys(A).filter((g)=>E.indexOf(g)!==-1),Q={...A,...B};for(let g of I){let U=uM(A[g],B[g]);if(!U.valid)return{valid:!1,mergeErrorPath:[g,...U.mergeErrorPath]};Q[g]=U.data}return{valid:!0,data:Q}}if(Array.isArray(A)&&Array.isArray(B)){if(A.length!==B.length)return{valid:!1,mergeErrorPath:[]};let E=[];for(let I=0;I<A.length;I++){let Q=A[I],g=B[I],U=uM(Q,g);if(!U.valid)return{valid:!1,mergeErrorPath:[I,...U.mergeErrorPath]};E.push(U.data)}return{valid:!0,data:E}}return{valid:!1,mergeErrorPath:[]}}function _q(A,B,E){let I=new Map,Q;for(let N of B.issues)if(N.code==="unrecognized_keys"){Q??(Q=N);for(let Y of N.keys){if(!I.has(Y))I.set(Y,{});I.get(Y).l=!0}}else A.issues.push(N);for(let N of E.issues)if(N.code==="unrecognized_keys")for(let Y of N.keys){if(!I.has(Y))I.set(Y,{});I.get(Y).r=!0}else A.issues.push(N);let g=[...I].filter(([,N])=>N.l&&N.r).map(([N])=>N);if(g.length&&Q)A.issues.push({...Q,keys:g});if(C0(A))return A;let U=uM(B.value,E.value);if(!U.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(U.mergeErrorPath)}`);return A.value=U.data,A}function e3(A,B,E){if(A.issues.length)B.issues.push(...ED(E,A.issues));B.value[E]=A.value}function Vq(A,B,E,I,Q,g,U){if(A.issues.length)if(JF.has(typeof I))E.issues.push(...ED(I,A.issues));else E.issues.push({code:"invalid_key",origin:"map",input:Q,inst:g,issues:A.issues.map((N)=>mI(N,U,TE()))});if(B.issues.length)if(JF.has(typeof I))E.issues.push(...ED(I,B.issues));else E.issues.push({origin:"map",code:"invalid_element",input:Q,inst:g,key:I,issues:B.issues.map((N)=>mI(N,U,TE()))});E.value.set(A.value,B.value)}function jq(A,B){if(A.issues.length)B.issues.push(...A.issues);B.value.add(A.value)}function Lq(A,B){if(A.issues.length&&B===void 0)return{issues:[],value:void 0};return A}function Sq(A,B){if(A.value===void 0)A.value=B.defaultValue;return A}function Tq(A,B){if(!A.issues.length&&A.value===void 0)A.issues.push({code:"invalid_type",expected:"nonoptional",input:A.value,inst:B});return A}function AJ(A,B,E){if(A.issues.length)return A.aborted=!0,A;return B._zod.run({value:A.value,issues:A.issues},E)}function BJ(A,B,E){if(A.issues.length)return A.aborted=!0,A;if((E.direction||"forward")==="forward"){let Q=B.transform(A.value,A);if(Q instanceof Promise)return Q.then((g)=>QJ(A,g,B.out,E));return QJ(A,Q,B.out,E)}else{let Q=B.reverseTransform(A.value,A);if(Q instanceof Promise)return Q.then((g)=>QJ(A,g,B.in,E));return QJ(A,Q,B.in,E)}}function QJ(A,B,E,I){if(A.issues.length)return A.aborted=!0,A;return E._zod.run({value:B,issues:A.issues},I)}function wq(A){return A.value=Object.freeze(A.value),A}function yq(A,B,E,I){if(!A){let Q={code:"custom",input:E,inst:I,path:[...I._zod.def.path??[]],continue:!I._zod.def.abort};if(I._zod.def.params)Q.params=I._zod.def.params;B.issues.push(O8(Q))}}var iB,_2,xQ,xM,bM,fM,PM,hM,kM,mM,lM,cM,pM,iM,dM,aM,nM,tM,oM,rM,sM,eM,AY,QY,EY,IY,DY,CY,IJ,gY,OF,DJ,UY,GY,FY,JY,NY,HY,KY,$Y,MY,YY,fq,XY,zF,vY,OY,zY,CJ,RY,ZY,qY,_Y,VY,jY,LY,gJ,SY,TY,wY,yY,WY,uY,xY,bY,fY,RF,PY,hY,kY,mY,lY,cY;var pY=P(()=>{r3();Y8();h9();n3();VB();WM();VB();iB=s("$ZodType",(A,B)=>{var E;A??(A={}),A._zod.def=B,A._zod.bag=A._zod.bag||{},A._zod.version=yM;let I=[...A._zod.def.checks??[]];if(A._zod.traits.has("$ZodCheck"))I.unshift(A);for(let Q of I)for(let g of Q._zod.onattach)g(A);if(I.length===0)(E=A._zod).deferred??(E.deferred=[]),A._zod.deferred?.push(()=>{A._zod.run=A._zod.parse});else{let Q=(U,N,Y)=>{let v=C0(U),Z;for(let j of N){if(j._zod.def.when){if(!j._zod.def.when(U))continue}else if(v)continue;let O=U.issues.length,z=j._zod.check(U);if(z instanceof Promise&&Y?.async===!1)throw new MC;if(Z||z instanceof Promise)Z=(Z??Promise.resolve()).then(async()=>{if(await z,U.issues.length===O)return;if(!v)v=C0(U,O)});else{if(U.issues.length===O)continue;if(!v)v=C0(U,O)}}if(Z)return Z.then(()=>{return U});return U},g=(U,N,Y)=>{if(C0(U))return U.aborted=!0,U;let v=Q(N,I,Y);if(v instanceof Promise){if(Y.async===!1)throw new MC;return v.then((Z)=>A._zod.parse(Z,Y))}return A._zod.parse(v,Y)};A._zod.run=(U,N)=>{if(N.skipChecks)return A._zod.parse(U,N);if(N.direction==="backward"){let v=A._zod.parse({value:U.value,issues:[]},{...N,skipChecks:!0});if(v instanceof Promise)return v.then((Z)=>{return g(Z,U,N)});return g(v,U,N)}let Y=A._zod.parse(U,N);if(Y instanceof Promise){if(N.async===!1)throw new MC;return Y.then((v)=>Q(v,I,N))}return Q(Y,I,N)}}QQ(A,"~standard",()=>({validate:(Q)=>{try{let g=f9(A,Q);return g.success?{value:g.data}:{issues:g.error?.issues}}catch(g){return P9(A,Q).then((U)=>U.success?{value:U.data}:{issues:U.error?.issues})}},vendor:"zod",version:1}))}),_2=s("$ZodString",(A,B)=>{iB.init(A,B),A._zod.pattern=[...A?._zod.bag?.patterns??[]].pop()??CM(A._zod.bag),A._zod.parse=(E,I)=>{if(B.coerce)try{E.value=String(E.value)}catch(Q){}if(typeof E.value==="string")return E;return E.issues.push({expected:"string",code:"invalid_type",input:E.value,inst:A}),E}}),xQ=s("$ZodStringFormat",(A,B)=>{_8.init(A,B),_2.init(A,B)}),xM=s("$ZodGUID",(A,B)=>{B.pattern??(B.pattern=a9),xQ.init(A,B)}),bM=s("$ZodUUID",(A,B)=>{if(B.version){let I={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[B.version];if(I===void 0)throw Error(`Invalid UUID version: "${B.version}"`);B.pattern??(B.pattern=q2(I))}else B.pattern??(B.pattern=q2());xQ.init(A,B)}),fM=s("$ZodEmail",(A,B)=>{B.pattern??(B.pattern=n9),xQ.init(A,B)}),PM=s("$ZodURL",(A,B)=>{xQ.init(A,B),A._zod.check=(E)=>{try{let I=E.value.trim(),Q=new URL(I);if(B.hostname){if(B.hostname.lastIndex=0,!B.hostname.test(Q.hostname))E.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:B.hostname.source,input:E.value,inst:A,continue:!B.abort})}if(B.protocol){if(B.protocol.lastIndex=0,!B.protocol.test(Q.protocol.endsWith(":")?Q.protocol.slice(0,-1):Q.protocol))E.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:B.protocol.source,input:E.value,inst:A,continue:!B.abort})}if(B.normalize)E.value=Q.href;else E.value=I;return}catch(I){E.issues.push({code:"invalid_format",format:"url",input:E.value,inst:A,continue:!B.abort})}}}),hM=s("$ZodEmoji",(A,B)=>{B.pattern??(B.pattern=t9()),xQ.init(A,B)}),kM=s("$ZodNanoID",(A,B)=>{B.pattern??(B.pattern=i9),xQ.init(A,B)}),mM=s("$ZodCUID",(A,B)=>{B.pattern??(B.pattern=k9),xQ.init(A,B)}),lM=s("$ZodCUID2",(A,B)=>{B.pattern??(B.pattern=m9),xQ.init(A,B)}),cM=s("$ZodULID",(A,B)=>{B.pattern??(B.pattern=l9),xQ.init(A,B)}),pM=s("$ZodXID",(A,B)=>{B.pattern??(B.pattern=c9),xQ.init(A,B)}),iM=s("$ZodKSUID",(A,B)=>{B.pattern??(B.pattern=p9),xQ.init(A,B)}),dM=s("$ZodISODateTime",(A,B)=>{B.pattern??(B.pattern=DM(B)),xQ.init(A,B)}),aM=s("$ZodISODate",(A,B)=>{B.pattern??(B.pattern=EM),xQ.init(A,B)}),nM=s("$ZodISOTime",(A,B)=>{B.pattern??(B.pattern=IM(B)),xQ.init(A,B)}),tM=s("$ZodISODuration",(A,B)=>{B.pattern??(B.pattern=d9),xQ.init(A,B)}),oM=s("$ZodIPv4",(A,B)=>{B.pattern??(B.pattern=o9),xQ.init(A,B),A._zod.bag.format="ipv4"}),rM=s("$ZodIPv6",(A,B)=>{B.pattern??(B.pattern=r9),xQ.init(A,B),A._zod.bag.format="ipv6",A._zod.check=(E)=>{try{new URL(`http://[${E.value}]`)}catch{E.issues.push({code:"invalid_format",format:"ipv6",input:E.value,inst:A,continue:!B.abort})}}}),sM=s("$ZodMAC",(A,B)=>{B.pattern??(B.pattern=s9(B.delimiter)),xQ.init(A,B),A._zod.bag.format="mac"}),eM=s("$ZodCIDRv4",(A,B)=>{B.pattern??(B.pattern=e9),xQ.init(A,B)}),AY=s("$ZodCIDRv6",(A,B)=>{B.pattern??(B.pattern=AM),xQ.init(A,B),A._zod.check=(E)=>{let I=E.value.split("/");try{if(I.length!==2)throw Error();let[Q,g]=I;if(!g)throw Error();let U=Number(g);if(`${U}`!==g)throw Error();if(U<0||U>128)throw Error();new URL(`http://[${Q}]`)}catch{E.issues.push({code:"invalid_format",format:"cidrv6",input:E.value,inst:A,continue:!B.abort})}}});QY=s("$ZodBase64",(A,B)=>{B.pattern??(B.pattern=BM),xQ.init(A,B),A._zod.bag.contentEncoding="base64",A._zod.check=(E)=>{if(BY(E.value))return;E.issues.push({code:"invalid_format",format:"base64",input:E.value,inst:A,continue:!B.abort})}});EY=s("$ZodBase64URL",(A,B)=>{B.pattern??(B.pattern=a3),xQ.init(A,B),A._zod.bag.contentEncoding="base64url",A._zod.check=(E)=>{if(Wq(E.value))return;E.issues.push({code:"invalid_format",format:"base64url",input:E.value,inst:A,continue:!B.abort})}}),IY=s("$ZodE164",(A,B)=>{B.pattern??(B.pattern=QM),xQ.init(A,B)});DY=s("$ZodJWT",(A,B)=>{xQ.init(A,B),A._zod.check=(E)=>{if(uq(E.value,B.alg))return;E.issues.push({code:"invalid_format",format:"jwt",input:E.value,inst:A,continue:!B.abort})}}),CY=s("$ZodCustomStringFormat",(A,B)=>{xQ.init(A,B),A._zod.check=(E)=>{if(B.fn(E.value))return;E.issues.push({code:"invalid_format",format:B.format,input:E.value,inst:A,continue:!B.abort})}}),IJ=s("$ZodNumber",(A,B)=>{iB.init(A,B),A._zod.pattern=A._zod.bag.pattern??YF,A._zod.parse=(E,I)=>{if(B.coerce)try{E.value=Number(E.value)}catch(U){}let Q=E.value;if(typeof Q==="number"&&!Number.isNaN(Q)&&Number.isFinite(Q))return E;let g=typeof Q==="number"?Number.isNaN(Q)?"NaN":!Number.isFinite(Q)?"Infinity":void 0:void 0;return E.issues.push({expected:"number",code:"invalid_type",input:Q,inst:A,...g?{received:g}:{}}),E}}),gY=s("$ZodNumberFormat",(A,B)=>{$M.init(A,B),IJ.init(A,B)}),OF=s("$ZodBoolean",(A,B)=>{iB.init(A,B),A._zod.pattern=GM,A._zod.parse=(E,I)=>{if(B.coerce)try{E.value=Boolean(E.value)}catch(g){}let Q=E.value;if(typeof Q==="boolean")return E;return E.issues.push({expected:"boolean",code:"invalid_type",input:Q,inst:A}),E}}),DJ=s("$ZodBigInt",(A,B)=>{iB.init(A,B),A._zod.pattern=gM,A._zod.parse=(E,I)=>{if(B.coerce)try{E.value=BigInt(E.value)}catch(Q){}if(typeof E.value==="bigint")return E;return E.issues.push({expected:"bigint",code:"invalid_type",input:E.value,inst:A}),E}}),UY=s("$ZodBigIntFormat",(A,B)=>{MM.init(A,B),DJ.init(A,B)}),GY=s("$ZodSymbol",(A,B)=>{iB.init(A,B),A._zod.parse=(E,I)=>{let Q=E.value;if(typeof Q==="symbol")return E;return E.issues.push({expected:"symbol",code:"invalid_type",input:Q,inst:A}),E}}),FY=s("$ZodUndefined",(A,B)=>{iB.init(A,B),A._zod.pattern=JM,A._zod.values=new Set([void 0]),A._zod.optin="optional",A._zod.optout="optional",A._zod.parse=(E,I)=>{let Q=E.value;if(typeof Q>"u")return E;return E.issues.push({expected:"undefined",code:"invalid_type",input:Q,inst:A}),E}}),JY=s("$ZodNull",(A,B)=>{iB.init(A,B),A._zod.pattern=FM,A._zod.values=new Set([null]),A._zod.parse=(E,I)=>{let Q=E.value;if(Q===null)return E;return E.issues.push({expected:"null",code:"invalid_type",input:Q,inst:A}),E}}),NY=s("$ZodAny",(A,B)=>{iB.init(A,B),A._zod.parse=(E)=>E}),HY=s("$ZodUnknown",(A,B)=>{iB.init(A,B),A._zod.parse=(E)=>E}),KY=s("$ZodNever",(A,B)=>{iB.init(A,B),A._zod.parse=(E,I)=>{return E.issues.push({expected:"never",code:"invalid_type",input:E.value,inst:A}),E}}),$Y=s("$ZodVoid",(A,B)=>{iB.init(A,B),A._zod.parse=(E,I)=>{let Q=E.value;if(typeof Q>"u")return E;return E.issues.push({expected:"void",code:"invalid_type",input:Q,inst:A}),E}}),MY=s("$ZodDate",(A,B)=>{iB.init(A,B),A._zod.parse=(E,I)=>{if(B.coerce)try{E.value=new Date(E.value)}catch(N){}let Q=E.value,g=Q instanceof Date;if(g&&!Number.isNaN(Q.getTime()))return E;return E.issues.push({expected:"date",code:"invalid_type",input:Q,...g?{received:"Invalid Date"}:{},inst:A}),E}});YY=s("$ZodArray",(A,B)=>{iB.init(A,B),A._zod.parse=(E,I)=>{let Q=E.value;if(!Array.isArray(Q))return E.issues.push({expected:"array",code:"invalid_type",input:Q,inst:A}),E;E.value=Array(Q.length);let g=[];for(let U=0;U<Q.length;U++){let N=Q[U],Y=B.element._zod.run({value:N,issues:[]},I);if(Y instanceof Promise)g.push(Y.then((v)=>Rq(v,E,U)));else Rq(Y,E,U)}if(g.length)return Promise.all(g).then(()=>E);return E}});fq=s("$ZodObject",(A,B)=>{if(iB.init(A,B),!Object.getOwnPropertyDescriptor(B,"shape")?.get){let N=B.shape;Object.defineProperty(B,"shape",{get:()=>{let Y={...N};return Object.defineProperty(B,"shape",{value:Y}),Y}})}let I=v8(()=>xq(B));QQ(A._zod,"propValues",()=>{let N=B.shape,Y={};for(let v in N){let Z=N[v]._zod;if(Z.values){Y[v]??(Y[v]=new Set);for(let j of Z.values)Y[v].add(j)}}return Y});let Q=Z2,g=B.catchall,U;A._zod.parse=(N,Y)=>{U??(U=I.value);let v=N.value;if(!Q(v))return N.issues.push({expected:"object",code:"invalid_type",input:v,inst:A}),N;N.value={};let Z=[],j=U.shape;for(let O of U.keys){let z=j[O],L=z._zod.optout==="optional",T=z._zod.run({value:v[O],issues:[]},Y);if(T instanceof Promise)Z.push(T.then((u)=>EJ(u,N,O,v,L)));else EJ(T,N,O,v,L)}if(!g)return Z.length?Promise.all(Z).then(()=>N):N;return bq(Z,v,N,Y,I.value,A)}}),XY=s("$ZodObjectJIT",(A,B)=>{fq.init(A,B);let E=A._zod.parse,I=v8(()=>xq(B)),Q=(O)=>{let z=new s3(["shape","payload","ctx"]),L=I.value,T=(gA)=>{let DA=x3(gA);return`shape[${DA}]._zod.run({ value: input[${DA}], issues: [] }, ctx)`};z.write("const input = payload.value;");let u=Object.create(null),EA=0;for(let gA of L.keys)u[gA]=`key_${EA++}`;z.write("const newResult = {};");for(let gA of L.keys){let DA=u[gA],OA=x3(gA),SA=O[gA]?._zod?.optout==="optional";if(z.write(`const ${DA} = ${T(gA)};`),SA)z.write(`
|
|
@@ -121,7 +121,7 @@ ${g}`}var HO=P(()=>{e8();XS();u2()});import{readFileSync as wl,writeFileSync as
|
|
|
121
121
|
`)}process.exit(0)}})});var bS,Cc,gc,fS;var PS=P(()=>{pI();bS=uA.object({session_id:uA.string(),transcript_path:uA.string().optional(),tool_use_id:uA.string()}),Cc=bS.extend({tool_name:uA.literal("TaskCreate"),tool_input:uA.object({subject:uA.string(),description:uA.string().optional()}),tool_response:uA.object({task:uA.object({id:uA.string(),subject:uA.string()})})}),gc=bS.extend({tool_name:uA.literal("TaskUpdate"),tool_input:uA.object({taskId:uA.string(),status:uA.string().optional(),owner:uA.string().optional(),subject:uA.string().optional(),description:uA.string().optional()}),tool_response:uA.object({success:uA.boolean(),taskId:uA.string(),updatedFields:uA.array(uA.string()).optional(),statusChange:uA.object({from:uA.string(),to:uA.string()}).optional()})}),fS=uA.discriminatedUnion("tool_name",[Cc,gc])});function Gc(A){if(typeof A!=="string")return;let B=Uc[A];if(B)return B;if(["pending","in_progress","completed"].includes(A))return A;return}async function hS(A,B){let E;try{E=JSON.parse(A)}catch{return"skip"}let I=fS.safeParse(E);if(!I.success)return"skip";let Q=I.data,g=await H0(Q.session_id,B,Q.transcript_path);if(!g)return"skip";let{roomId:U}=g,N=process.env.MEET_AI_URL,Y=process.env.MEET_AI_KEY;if(!N||!Y)return"skip";let v=VI(N,Y),Z={source:"claude",updated_by:"claude"};if(Q.tool_name==="TaskCreate"){if(Z.source_id=Q.tool_response.task.id,Z.subject=Q.tool_input.subject,Z.status="pending",Q.tool_input.description)Z.description=Q.tool_input.description}else{if(Z.source_id=Q.tool_response.taskId,Q.tool_input.subject)Z.subject=Q.tool_input.subject;if(Q.tool_input.description)Z.description=Q.tool_input.description;if(Q.tool_input.status)Z.status=Gc(Q.tool_input.status);if(Q.tool_input.owner!==void 0)Z.assignee=Q.tool_input.owner}let j=await v.api.rooms[":id"].tasks.upsert.$post({param:{id:U},json:Z});if(!j.ok)return console.error(`[task-sync] upsert failed: ${j.status} ${j.statusText}`),"skip";return"sent"}var Uc;var kS=P(()=>{HO();PS();Uc={open:"pending",in_progress:"in_progress",completed:"completed",done:"completed"}});var mS={};jQ(mS,{default:()=>Fc});var Fc;var lS=P(()=>{SE();kS();Fc=BQ({meta:{name:"task-sync",description:"Hook: sync Claude task events to the kanban board"},async run(){try{let A="";for await(let B of process.stdin)A+=B;await hS(A)}catch{}process.exit(0)}})});var cS={};jQ(cS,{default:()=>Jc});var Jc;var pS=P(()=>{SE();Jc=BQ({meta:{name:"hook",description:"Claude Code hook subcommands"},subCommands:{"log-tool-use":()=>Promise.resolve().then(() => (ZS(),RS)).then((A)=>A.default),"plan-review":()=>Promise.resolve().then(() => (jS(),VS)).then((A)=>A.default),"question-review":()=>Promise.resolve().then(() => (wS(),TS)).then((A)=>A.default),"permission-review":()=>Promise.resolve().then(() => (xS(),uS)).then((A)=>A.default),"task-sync":()=>Promise.resolve().then(() => (lS(),mS)).then((A)=>A.default)}})});import{existsSync as Nc}from"node:fs";import{readFile as Hc,writeFile as iS,mkdir as dS}from"node:fs/promises";import{homedir as Kc}from"node:os";import{resolve as aS,dirname as nS}from"node:path";function MO(A){return A.hooks?.some((B)=>typeof B.command==="string"&&B.command.startsWith("meet-ai hook "))??!1}function $c(A){if(A)return aS(process.cwd(),".claude","settings.json");return aS(Kc(),".claude","settings.json")}async function Mc(A){if(!Nc(A))return{};let E=(await Hc(A,"utf-8")).trim();if(!E)return{};try{return JSON.parse(E)}catch{return{}}}function Yc(A){let B={...A},E=[];for(let[I,Q]of Object.entries(tS)){if(!B[I])B[I]=[];for(let g of Q){let U=B[I].findIndex((N)=>N.matcher===g.matcher&&MO(N));if(U!==-1)B[I][U]=g,E.push(`updated ${I} [${g.matcher}]`);else B[I].push(g),E.push(`added ${I} [${g.matcher}]`)}}for(let I of Object.keys(B)){let Q=tS[I]??[];if(B[I]=B[I].filter((g)=>{if(!MO(g))return!0;return Q.some((U)=>U.matcher===g.matcher)}),B[I].length===0)Reflect.deleteProperty(B,I)}return{merged:B,added:E}}function Xc(A){let B={},E=[];for(let[I,Q]of Object.entries(A)){let g=Q.filter((U)=>{if(MO(U))return E.push(`removed ${I} [${U.matcher}]`),!1;return!0});if(g.length>0)B[I]=g}return{cleaned:B,removed:E}}async function oS(A){let B=A._settingsPath??$c(A.project),E=await Mc(B),I=E.hooks??{};if(A.remove){let{cleaned:Q,removed:g}=Xc(I);if(g.length===0){u3("No meet-ai hooks found to remove.");return}if(A.dryRun){u3(`Dry run — would modify ${B}:`);for(let N of g)console.log(rF.default.yellow(` ${N}`));return}let U={...E,hooks:Q};if(Object.keys(Q).length===0)delete U.hooks;await dS(nS(B),{recursive:!0}),await iS(B,`${JSON.stringify(U,null,2)}
|
|
122
122
|
`);for(let N of g)console.log(rF.default.yellow(` ${N}`));lE(`Removed meet-ai hooks from ${B}`)}else{let{merged:Q,added:g}=Yc(I);if(A.dryRun){u3(`Dry run — would modify ${B}:`);for(let N of g)console.log(rF.default.green(` ${N}`));return}let U={...E,hooks:Q};await dS(nS(B),{recursive:!0}),await iS(B,`${JSON.stringify(U,null,2)}
|
|
123
123
|
`);for(let N of g)console.log(rF.default.green(` ${N}`));lE(`Hooks written to ${B}`)}}var rF,tS;var rS=P(()=>{UE();rF=kB(R9(),1),tS={PostToolUse:[{matcher:".*",hooks:[{type:"command",command:"meet-ai hook log-tool-use",timeout:10}]},{matcher:"TaskCreate|TaskUpdate",hooks:[{type:"command",command:"meet-ai hook task-sync",timeout:10}]}],PermissionRequest:[{matcher:"ExitPlanMode",hooks:[{type:"command",command:"meet-ai hook plan-review",timeout:2147483}]},{matcher:"AskUserQuestion",hooks:[{type:"command",command:"meet-ai hook question-review",timeout:1800}]},{matcher:"^(?!ExitPlanMode$|AskUserQuestion$).*",hooks:[{type:"command",command:"meet-ai hook permission-review",timeout:1800}]}]}});var sS={};jQ(sS,{default:()=>vc});var vc;var eS=P(()=>{SE();rS();UE();vc=BQ({meta:{name:"setup-hooks",description:"Configure Claude Code hooks for meet-ai in ~/.claude/settings.json"},args:{project:{type:"boolean",description:"Write to ./.claude/settings.json instead of ~/.claude/settings.json",default:!1},"dry-run":{type:"boolean",description:"Print what would be written without actually writing",default:!1},remove:{type:"boolean",description:"Remove meet-ai hooks from settings instead of adding them",default:!1}},async run({args:A}){try{await oS({project:A.project,dryRun:A["dry-run"],remove:A.remove})}catch(B){uQ(B instanceof Error?B.message:String(B)),process.exit(1)}}})});import{existsSync as sF}from"node:fs";import{readFile as UH,readdir as QT}from"node:fs/promises";import{homedir as AT}from"node:os";import{join as Hg,resolve as Oc}from"node:path";function ET(A){let B=A.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!B)return null;let E=B[1],I=E.match(/^name:\s*(.+)$/m),Q=E.match(/^description:\s*(.+)$/m),g=E.match(/^disable-model-invocation:\s*(.+)$/m);return{name:I?.[1]?.trim(),description:Q?.[1]?.trim(),disableModelInvocation:g?.[1]?.trim()==="true"}}async function YO(A,B,E){let I=Hg(A,"skills");if(!sF(I))return[];let Q;try{Q=await QT(I)}catch{return[]}let g=[];for(let U of Q){let N=Hg(I,U,"SKILL.md");if(!sF(N))continue;try{let Y=await UH(N,"utf-8"),v=ET(Y);if(!v)continue;if(!v.description)continue;if(v.disableModelInvocation)continue;g.push({name:v.name??U,description:v.description,type:"skill",source:B,scope:E})}catch{}}return g}async function zc(A,B,E){if(!sF(A))return[];let I=[];async function Q(g){let U;try{U=await QT(g,{withFileTypes:!0})}catch{return}for(let N of U){let Y=Hg(g,N.name);if(N.isDirectory())await Q(Y);else if(N.isFile()&&N.name.endsWith(".md"))try{let v=await UH(Y,"utf-8"),Z=ET(v);if(!Z||!Z.description)continue;if(Z.disableModelInvocation)continue;let j=N.name.slice(0,-3);I.push({name:Z.name??j,description:Z.description,type:"command",source:B,scope:E})}catch{}}}return await Q(A),I}async function BT(A){if(!sF(A))return{};try{let B=await UH(A,"utf-8");return JSON.parse(B.trim()||"{}")}catch{return{}}}async function Rc(A){if(!sF(A))return{};try{let B=await UH(A,"utf-8");return JSON.parse(B).plugins??{}}catch{return{}}}async function GH(A){let B=Oc(A.projectPath??process.cwd()),E=A._userClaudeDir??Hg(AT(),".claude"),I=A._pluginsFile??Hg(AT(),".claude","plugins","installed_plugins.json"),Q=[],g=await YO(E,"standalone","user");Q.push(...g);let U=Hg(B,".claude"),N=await YO(U,"standalone","project");Q.push(...N);let Y=await BT(Hg(E,"settings.json")),v=await BT(Hg(U,"settings.json")),Z=Y.enabledPlugins??{},j=v.enabledPlugins??{},O=new Map;for(let z of Object.keys(Z))O.set(z,"user");for(let z of Object.keys(j))O.set(z,"project");if(O.size>0){let z=await Rc(I);for(let[L,T]of O){let u=z[L];if(!u||u.length===0)continue;let{installPath:EA}=u[0],GA=`plugin:${L}`,gA=await zc(Hg(EA,"commands"),GA,T);Q.push(...gA);let DA=await YO(EA,GA,T);Q.push(...DA)}}return Q}var XO=()=>{};var IT={};jQ(IT,{default:()=>Zc});var Zc;var DT=P(()=>{SE();XO();UE();Zc=BQ({meta:{name:"list-commands",description:"List all available Claude Code slash commands and skills as JSON"},args:{"project-path":{type:"string",description:"Path to the project root (defaults to cwd)"}},async run({args:A}){try{let B=await GH({projectPath:A["project-path"]});console.log(JSON.stringify(B,null,2))}catch(B){uQ(B instanceof Error?B.message:String(B)),process.exit(1)}}})});async function CT(A,B){let E=await GH({projectPath:B.projectPath}),I=JSON.stringify({commands:E});await A.sendCommands(B.roomId,I),lE("Commands sent")}var gT=P(()=>{XO();UE()});var UT={};jQ(UT,{default:()=>qc});var qc;var GT=P(()=>{SE();CD();gT();UE();qc=BQ({meta:{name:"send-commands",description:"Send commands list to a room"},args:{roomId:{type:"positional",description:"Room ID to send commands to",required:!0},"project-path":{type:"string",description:"Path to the project (defaults to cwd)",required:!1}},async run({args:A}){try{let B=KE();await CT(B,{roomId:A.roomId,projectPath:A["project-path"]})}catch(B){uQ(B instanceof Error?B.message:String(B)),process.exit(1)}}})});import{existsSync as FT,lstatSync as _c,mkdirSync as Vc,readFileSync as jc,renameSync as Lc,writeFileSync as Sc}from"node:fs";import{homedir as Tc}from"node:os";import{fileURLToPath as JT}from"node:url";import{join as vO}from"node:path";function NT(){return vO(process.env.HOME??Tc(),".meet-ai")}function HT(){return vO(NT(),"sessions.json")}function OO(){try{let A=jc(HT(),"utf8"),B=uA.array(wc).safeParse(JSON.parse(A));return B.success?B.data:[]}catch{return[]}}function KT(A){let B=NT();Vc(B,{recursive:!0,mode:448});try{if(!_c(B).isDirectory())return}catch{return}let E=vO(B,`sessions.${process.pid}.${Date.now()}.tmp`);Sc(E,JSON.stringify(A,null,2),{mode:384}),Lc(E,HT())}function yc(A){let B=OO(),E=B.findIndex((I)=>I.sessionName===A.sessionName);if(E!==-1)B[E]=A;else B.push(A);KT(B)}function Wc(A){let B=OO().filter((E)=>E.sessionName!==A);KT(B)}function xc(){let A=JT(new URL("../index.ts",import.meta.url));if(FT(A)&&typeof Bun<"u")return[process.execPath,"run",A];let B=JT(new URL("../index.js",import.meta.url));if(FT(B))return[process.execPath,B];return["meet-ai"]}class zO{teams=new Map;tmux;opts;spawned=0;constructor(A){this.opts=A,this.tmux=A.tmux??new x2({server:"meet-ai",scrollback:1e4})}sessionName(A){return`mai-${A}`}nextTeamId(A){if(!this.teams.has(A))return A;let B=2;while(this.teams.has(`${A}-${B}`))B++;return`${A}-${B}`}spawn(A,B,E="claude"){let I=this.nextTeamId(A),Q=this.sessionName(I),g={teamId:I,roomId:A,roomName:B,codingAgent:E,sessionName:Q,status:"starting",exitCode:null,lines:[],panes:[]};if(this.teams.set(I,g),this.spawned++,this.opts.dryRun)return g;let U=[`ROOM_ID: ${A}`,"",...this.buildPromptLines(E)].join(`
|
|
124
|
-
`),N=this.opts.agentBinaries[E];if(!N)return g.status="error",g.lines.push(`[error] No CLI binary configured for coding agent: ${E}`),this.opts.onStatusChange?.(A,"error"),g;let Y={DISABLE_AUTOUPDATER:"1",MEET_AI_RUNTIME:E};if(E==="codex")Y.MEET_AI_CODEX_PATH=N,Y.MEET_AI_CODEX_BOOTSTRAP_PROMPT=U,Y.MEET_AI_AGENT_NAME="codex";for(let j of uc){let O=process.env[j];if(O)Y[j]=O}if(this.opts.env)Object.assign(Y,this.opts.env);let v=E==="codex"?this.buildCodexListenCommandArgs(A,Y.MEET_AI_AGENT_NAME??"codex"):[N,...this.buildClaudeCommandArgs(U)];if(this.opts.debug)g.lines.push(`[debug] AGENT: ${E}`),g.lines.push(`[debug] CMD: ${v.join(" ").slice(0,200)}`),g.lines.push(`[debug] ENV: ${Object.keys(Y).join(", ")}`);let Z=this.tmux.newSession(Q,v,Y);if(Z.ok)g.status="running",this.opts.onStatusChange?.(A,"running"),yc({sessionName:Q,roomId:A,roomName:B,codingAgent:E,createdAt:new Date().toISOString()});else g.status="error",g.lines.push(`[error] tmux: ${Z.error}`),this.opts.onStatusChange?.(A,"error");return g}addError(A,B,E){let I=this.nextTeamId(A);this.teams.set(I,{teamId:I,roomId:A,roomName:B,codingAgent:"claude",sessionName:this.sessionName(I),status:"error",exitCode:null,lines:[`[error] ${E}`],panes:[]})}async capture(A,B){let E=this.teams.get(A);if(!E)return[];let I=this.tmux.listPanes(E.sessionName);if(I.length<=1){let U=await this.tmux.capturePane(E.sessionName,B);if(U.length===0)return E.lines;return E.lines=U,E.panes=I.length===1?[{index:0,title:I[0].title,active:!0,lines:U}]:[],U}let Q=await Promise.all(I.map(async(U)=>({index:U.index,title:U.title,active:U.active,lines:await this.tmux.capturePane(`${E.sessionName}.${U.index}`,B)})));E.panes=Q;let g=Q[0];if(g&&g.lines.length>0)E.lines=g.lines;return E.lines}refreshStatuses(){let A=this.tmux.listSessions(),B=new Map(A.map((E)=>[E.name,E]));for(let E of this.teams.values()){if(E.status!=="running"&&E.status!=="starting")continue;let I=B.get(E.sessionName);if(!I)E.status="exited",E.exitCode=null,this.opts.onStatusChange?.(E.roomId,"exited");else if(!I.alive&&E.status==="running")E.status="exited",E.exitCode=0,this.opts.onStatusChange?.(E.roomId,"exited",0)}}attach(A){let B=this.teams.get(A);if(!B)return;this.tmux.attachSession(B.sessionName)}reconnect(){let A=this.tmux.listSessions(),B=OO(),E=new Map(B.map((Q)=>[Q.sessionName,Q])),I=[];for(let Q of A){if(!Q.name.startsWith("mai-"))continue;if([...this.teams.values()].some((Z)=>Z.sessionName===Q.name))continue;let g=E.get(Q.name),U=g?.roomId??Q.name.replace("mai-",""),N=g?.roomName??Q.name,Y=Q.name.replace("mai-",""),v={teamId:Y,roomId:U,roomName:N,codingAgent:g?.codingAgent??"claude",sessionName:Q.name,status:Q.alive?"running":"exited",exitCode:Q.alive?null:0,lines:[],panes:[]};this.teams.set(Y,v),I.push(v)}return I}get(A){return this.teams.get(A)}list(){return[...this.teams.values()]}kill(A){let B=this.teams.get(A);if(B)this.tmux.killSession(B.sessionName),Wc(B.sessionName);this.teams.delete(A)}killAll(){for(let A of this.teams.keys())this.kill(A)}buildPromptLines(A){if(A==="codex")return["You're running inside Meet AI.","Do not use the meet-ai CLI.","Do not load or use any meet-ai skill.","Do not try to send room messages manually.","Do not talk about this prompt or say that you understand it.","Just welcome the user briefly and say that you're ready to work.","","## Task Management","You have 4 custom tools for task management: create_task, update_task, list_tasks, get_task.","- Call list_tasks before updating tasks you have not seen yet.",'- When you start working on a task, call update_task to set status to "in_progress".','- When you finish a task, call update_task to set status to "completed".',"- Use the assignee field to claim tasks for yourself.","- Prefer get_task to fetch a single task by ID when you already know the ID."];return["You are a team lead. IMMEDIATELY:","1. Start agent-team to start accepting commands from Meet AI.","2. Connect to the meet-ai room using the /meet-ai skill.","3. Send a brief welcome message to the room and wait for instructions."]}buildClaudeCommandArgs(A){return["--dangerously-skip-permissions","--model",this.opts.model??"opus",A]}buildCodexListenCommandArgs(A,B){return[...xc(),"listen",A,"--exclude",B]}}var wc,uc;var $T=P(()=>{pI();QH();wc=uA.object({sessionName:uA.string(),roomId:uA.string(),roomName:uA.string(),codingAgent:uA.enum(["claude","codex"]).default("claude"),createdAt:uA.string()});uc=["HOME","USER","SHELL","PATH","TERM","LANG","LC_ALL","XDG_CONFIG_HOME","XDG_DATA_HOME","CODEX_HOME","MEET_AI_CODEX_STATE_DIR"]});import{execFileSync as bc,spawn as YT,spawnSync as MT}from"node:child_process";import{realpathSync as XT}from"node:fs";function fc(A,B){let E=A.split(".").map(Number),I=B.split(".").map(Number);for(let Q=0;Q<3;Q++){if((E[Q]??0)>(I[Q]??0))return!0;if((E[Q]??0)<(I[Q]??0))return!1}return!1}function RO(){let A=MT("which",["npm"]),B=A.status===0?A.stdout.toString().trim():null;if(!B)return{supported:!1,reason:"npm not found in PATH"};let E=MT("npm",["prefix","-g"]);if(E.status!==0)return{supported:!1,reason:"cannot determine npm global prefix"};let I=E.stdout.toString().trim(),Q=process.argv[1];if(!Q)return{supported:!1,reason:"cannot determine script path"};let g;try{g=XT(Q)}catch{g=Q}if(!g.startsWith(I))return{supported:!1,reason:"binary not under npm global prefix (likely dev/manual install)"};return{supported:!0,npmPath:B}}function ZO(){try{let A=bc("npm",["ls","-g","@meet-ai/cli","--json"],{encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","ignore"]});return JSON.parse(A)?.dependencies?.["@meet-ai/cli"]?.version??null}catch{return null}}async function vT(){try{let A=await fetch("https://registry.npmjs.org/@meet-ai/cli/latest",{signal:AbortSignal.timeout(3000)});if(!A.ok)return{available:!1,reason:`registry returned ${A.status}`};let B=await A.json();if(!B.version)return{available:!1,reason:"no version in registry response"};if(!fc(B.version,M8))return{available:!1,reason:"up to date"};return{available:!0,version:B.version}}catch(A){let B=A instanceof Error?A.message:String(A);if(B.includes("abort")||B.includes("timeout")||B.includes("ENOTFOUND")||B.includes("EAI_AGAIN"))return{available:!1,reason:"offline"};return{available:!1,reason:B}}}async function OT(A){let B=RO();if(!B.supported)return{ok:!1,error:B.reason};return new Promise((E)=>{try{let I=YT("npm",["i","-g",`@meet-ai/cli@${A}`],{stdio:["ignore","ignore","pipe"]}),Q="";I.stderr?.on("data",(g)=>{Q+=g.toString()}),I.on("error",(g)=>{E({ok:!1,error:g.message})}),I.on("close",(g)=>{if(g===0)E({ok:!0});else E({ok:!1,error:Q.trim()||`npm exited with code ${g}`})})}catch(I){E({ok:!1,error:I instanceof Error?I.message:String(I)})}})}function zT(A={}){let B=A.argv??process.argv.slice(1),E=A.spawn??YT,I=A.spawnOptions??{stdio:"inherit"},Q=A.exit??process.exit,g=A.kill??process.kill,U=A.execPath;if(!U)try{U=XT(process.argv[0])}catch{U=process.argv[0]}let N=E(U,B,I);if(!N.pid)throw Error("Failed to spawn replacement process");return new Promise((Y,v)=>{N.once("error",(Z)=>{v(Z)}),N.once("exit",(Z,j)=>{if(j){g(process.pid,j);return}Q(Z??0)})})}var FH=P(()=>{O9()});import{execSync as Pc}from"node:child_process";import{existsSync as qO}from"node:fs";import{homedir as RT,platform as hc}from"node:os";import{join as JH}from"node:path";function ZT(A,B,E){try{let Q=hc()==="win32"?`where ${A}`:`which ${A}`,U=Pc(Q,{encoding:"utf8",stdio:["pipe","pipe","ignore"]}).trim().split(`
|
|
124
|
+
`),N=this.opts.agentBinaries[E];if(!N)return g.status="error",g.lines.push(`[error] No CLI binary configured for coding agent: ${E}`),this.opts.onStatusChange?.(A,"error"),g;let Y={DISABLE_AUTOUPDATER:"1",MEET_AI_RUNTIME:E};if(E==="codex")Y.MEET_AI_CODEX_PATH=N,Y.MEET_AI_CODEX_BOOTSTRAP_PROMPT=U,Y.MEET_AI_AGENT_NAME="codex";for(let j of uc){let O=process.env[j];if(O)Y[j]=O}if(this.opts.env)Object.assign(Y,this.opts.env);let v=E==="codex"?this.buildCodexListenCommandArgs(A,Y.MEET_AI_AGENT_NAME??"codex"):[N,...this.buildClaudeCommandArgs(U)];if(this.opts.debug)g.lines.push(`[debug] AGENT: ${E}`),g.lines.push(`[debug] CMD: ${v.join(" ").slice(0,200)}`),g.lines.push(`[debug] ENV: ${Object.keys(Y).join(", ")}`);let Z=this.tmux.newSession(Q,v,Y);if(Z.ok)g.status="running",this.opts.onStatusChange?.(A,"running"),yc({sessionName:Q,roomId:A,roomName:B,codingAgent:E,createdAt:new Date().toISOString()});else g.status="error",g.lines.push(`[error] tmux: ${Z.error}`),this.opts.onStatusChange?.(A,"error");return g}addError(A,B,E){let I=this.nextTeamId(A);this.teams.set(I,{teamId:I,roomId:A,roomName:B,codingAgent:"claude",sessionName:this.sessionName(I),status:"error",exitCode:null,lines:[`[error] ${E}`],panes:[]})}async capture(A,B){let E=this.teams.get(A);if(!E)return[];let I=this.tmux.listPanes(E.sessionName);if(I.length<=1){let U=await this.tmux.capturePane(E.sessionName,B);if(U.length===0)return E.lines;return E.lines=U,E.panes=I.length===1?[{index:0,title:I[0].title,active:!0,lines:U}]:[],U}let Q=await Promise.all(I.map(async(U)=>({index:U.index,title:U.title,active:U.active,lines:await this.tmux.capturePane(`${E.sessionName}.${U.index}`,B)})));E.panes=Q;let g=Q[0];if(g&&g.lines.length>0)E.lines=g.lines;return E.lines}refreshStatuses(){let A=this.tmux.listSessions(),B=new Map(A.map((E)=>[E.name,E]));for(let E of this.teams.values()){if(E.status!=="running"&&E.status!=="starting")continue;let I=B.get(E.sessionName);if(!I)E.status="exited",E.exitCode=null,this.opts.onStatusChange?.(E.roomId,"exited");else if(!I.alive&&E.status==="running")E.status="exited",E.exitCode=0,this.opts.onStatusChange?.(E.roomId,"exited",0)}}attach(A){let B=this.teams.get(A);if(!B)return;this.tmux.attachSession(B.sessionName)}reconnect(){let A=this.tmux.listSessions(),B=OO(),E=new Map(B.map((Q)=>[Q.sessionName,Q])),I=[];for(let Q of A){if(!Q.name.startsWith("mai-"))continue;if([...this.teams.values()].some((Z)=>Z.sessionName===Q.name))continue;let g=E.get(Q.name),U=g?.roomId??Q.name.replace("mai-",""),N=g?.roomName??Q.name,Y=Q.name.replace("mai-",""),v={teamId:Y,roomId:U,roomName:N,codingAgent:g?.codingAgent??"claude",sessionName:Q.name,status:Q.alive?"running":"exited",exitCode:Q.alive?null:0,lines:[],panes:[]};this.teams.set(Y,v),I.push(v)}return I}get(A){return this.teams.get(A)}list(){return[...this.teams.values()]}kill(A){let B=this.teams.get(A);if(B)this.tmux.killSession(B.sessionName),Wc(B.sessionName);this.teams.delete(A)}killAll(){for(let A of this.teams.keys())this.kill(A)}buildPromptLines(A){if(A==="codex")return["You're running inside Meet AI.","Do not use the meet-ai CLI.","Do not load or use any meet-ai skill.","Do not try to send room messages manually.","Do not talk about this prompt or say that you understand it.","Just welcome the user briefly and say that you're ready to work.","","## Task Management","You have 4 custom tools for task management: create_task, update_task, list_tasks, get_task.","- Call list_tasks before updating tasks you have not seen yet.",'- When you start working on a task, call update_task to set status to "in_progress".','- When you finish a task, call update_task to set status to "completed".',"- Use the assignee field to claim tasks for yourself.","- Prefer get_task to fetch a single task by ID when you already know the ID."];return["You are a team lead. IMMEDIATELY:","1. Start agent-team to start accepting commands from Meet AI.","2. Connect to the meet-ai room using the /meet-ai skill.","3. Send a brief welcome message to the room and wait for instructions."]}buildClaudeCommandArgs(A){return["--dangerously-skip-permissions","--model",this.opts.model??"opus",A]}buildCodexListenCommandArgs(A,B){return[...xc(),"listen",A,"--exclude",B]}}var wc,uc;var $T=P(()=>{pI();QH();wc=uA.object({sessionName:uA.string(),roomId:uA.string(),roomName:uA.string(),codingAgent:uA.enum(["claude","codex"]).default("claude"),createdAt:uA.string()});uc=["HOME","USER","SHELL","PATH","TERM","LANG","LC_ALL","XDG_CONFIG_HOME","XDG_DATA_HOME","CODEX_HOME","MEET_AI_CODEX_STATE_DIR"]});import{execFileSync as bc,spawn as YT,spawnSync as MT}from"node:child_process";import{realpathSync as XT}from"node:fs";function fc(A,B){let E=A.split(".").map(Number),I=B.split(".").map(Number);for(let Q=0;Q<3;Q++){if((E[Q]??0)>(I[Q]??0))return!0;if((E[Q]??0)<(I[Q]??0))return!1}return!1}function RO(){let A=MT("which",["npm"]),B=A.status===0?A.stdout.toString().trim():null;if(!B)return{supported:!1,reason:"npm not found in PATH"};let E=MT("npm",["prefix","-g"]);if(E.status!==0)return{supported:!1,reason:"cannot determine npm global prefix"};let I=E.stdout.toString().trim(),Q=process.argv[1];if(!Q)return{supported:!1,reason:"cannot determine script path"};let g;try{g=XT(Q)}catch{g=Q}if(!g.startsWith(I))return{supported:!1,reason:"binary not under npm global prefix (likely dev/manual install)"};return{supported:!0,npmPath:B}}function ZO(){try{let A=bc("npm",["ls","-g","@meet-ai/cli","--json"],{encoding:"utf-8",timeout:5000,stdio:["ignore","pipe","ignore"]});return JSON.parse(A)?.dependencies?.["@meet-ai/cli"]?.version??null}catch{return null}}async function vT(){try{let A=await fetch("https://registry.npmjs.org/@meet-ai/cli/latest",{signal:AbortSignal.timeout(3000)});if(!A.ok)return{available:!1,reason:`registry returned ${A.status}`};let B=await A.json();if(!B.version)return{available:!1,reason:"no version in registry response"};if(!fc(B.version,M8))return{available:!1,reason:"up to date"};return{available:!0,version:B.version}}catch(A){let B=A instanceof Error?A.message:String(A);if(B.includes("abort")||B.includes("timeout")||B.includes("ENOTFOUND")||B.includes("EAI_AGAIN"))return{available:!1,reason:"offline"};return{available:!1,reason:B}}}async function OT(A){let B=RO();if(!B.supported)return{ok:!1,error:B.reason};return new Promise((E)=>{try{let I=YT("npm",["i","-g",`@meet-ai/cli@${A}`],{stdio:["ignore","ignore","pipe"]}),Q="";I.stderr?.on("data",(g)=>{Q+=g.toString()}),I.on("error",(g)=>{E({ok:!1,error:g.message})}),I.on("close",(g)=>{if(g===0)E({ok:!0});else E({ok:!1,error:Q.trim()||`npm exited with code ${g}`})})}catch(I){E({ok:!1,error:I instanceof Error?I.message:String(I)})}})}function zT(A={}){let B=A.argv??process.argv.slice(1),E=A.spawn??YT,I=A.spawnOptions??{stdio:"inherit"},Q=A.exit??process.exit,g=A.kill??process.kill,U=A.execPath;if(!U)try{U=XT(process.argv[0])}catch{U=process.argv[0]}if(process.stdin.isTTY)try{process.stdin.setRawMode(!1),process.stdin.pause()}catch{}let N=E(U,B,I);if(!N.pid)throw Error("Failed to spawn replacement process");return new Promise((Y,v)=>{N.once("error",(Z)=>{v(Z)}),N.once("exit",(Z,j)=>{if(j){g(process.pid,j);return}Q(Z??0)})})}var FH=P(()=>{O9()});import{execSync as Pc}from"node:child_process";import{existsSync as qO}from"node:fs";import{homedir as RT,platform as hc}from"node:os";import{join as JH}from"node:path";function ZT(A,B,E){try{let Q=hc()==="win32"?`where ${A}`:`which ${A}`,U=Pc(Q,{encoding:"utf8",stdio:["pipe","pipe","ignore"]}).trim().split(`
|
|
125
125
|
`)[0].trim();if(U&&qO(U))return U}catch{}let I=process.env[B];if(I&&qO(I))return I;for(let Q of E)if(qO(Q))return Q;throw Error(`${A} is not installed`)}function qT(){let A=RT();try{return ZT("claude","MEET_AI_CLAUDE_PATH",[JH(A,".bun","bin","claude"),"/opt/homebrew/bin/claude","/usr/local/bin/claude",JH(A,".local","bin","claude")])}catch{throw Error(`
|
|
126
126
|
Claude Code is not installed
|
|
127
127
|
|
|
@@ -279,4 +279,4 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
|
|
|
279
279
|
`);else if(!this.options.debug)this.log.done()}if(this.kittyProtocolEnabled=!1,this.options.concurrent)uD.updateContainer(null,this.container,null,xK);else uD.updateContainerSync(null,this.container,null,xK),uD.flushSyncWork();LU.delete(this.options.stdout);let{exitResult:g}=this,U=()=>{if(cR(A))this.rejectExitPromise(A);else this.resolveExitPromise(g)},N=A!==void 0&&!cR(A),Y=B._writableState!==void 0||B.writableLength!==void 0;if(N)U();else if(E&&Y)this.options.stdout.write("",U);else setImmediate(U)}async waitUntilExit(){if(this.exitPromise||=new Promise((A,B)=>{this.resolveExitPromise=A,this.rejectExitPromise=B}),!this.beforeExitHandler)this.beforeExitHandler=()=>{this.unmount()},TU.once("beforeExit",this.beforeExitHandler);return this.exitPromise}clear(){if(!zC&&!this.options.debug)this.log.clear(),this.log.sync(this.lastOutputToRender||this.lastOutput+`
|
|
280
280
|
`)}patchConsole(){if(this.options.debug)return;this.restoreConsole=Qw((A,B)=>{if(A==="stdout")this.writeToStdout(B);if(A==="stderr"){if(!B.startsWith("The above error occurred"))this.writeToStderr(B)}})}initKittyKeyboard(){if(!this.options.kittyKeyboard)return;let A=this.options.kittyKeyboard,B=A.mode??"auto";if(B==="disabled"||!this.options.stdin.isTTY||!this.options.stdout.isTTY)return;let E=A.flags??["disambiguateEscapeCodes"];if(B==="enabled"){this.enableKittyProtocol(E);return}let I=TU.env.TERM??"",Q=TU.env.TERM_PROGRAM??"",g="KITTY_WINDOW_ID"in TU.env||I==="xterm-kitty"||Q==="WezTerm"||Q==="ghostty";if(!zC&&g)this.confirmKittySupport(E)}confirmKittySupport(A){let{stdin:B,stdout:E}=this.options,I=[],Q=()=>{this.cancelKittyDetection=void 0,clearTimeout(U),B.removeListener("data",g);let N=Wo(I);if(I=[],N.length>0)B.unshift(Buffer.from(N))},g=(N)=>{let Y=typeof N==="string"?Buffer.from(N):N;for(let v of Y)I.push(v);if(yo(I)){if(Q(),!this.isUnmounted)this.enableKittyProtocol(A)}};B.on("data",g);let U=setTimeout(Q,200);this.cancelKittyDetection=Q,E.write("\x1B[?u")}enableKittyProtocol(A){this.options.stdout.write(`\x1B[>${gx(A)}u`),this.kittyProtocolEnabled=!0}}var pR,Ux,xK=()=>{},_o=27,Vo=91,jo=63,Lo=117,So=48,To=57,wo=(A)=>A>=So&&A<=To,Gx=(A,B)=>{if(A[B]!==_o||A[B+1]!==Vo||A[B+2]!==jo)return;let E=B+3,I=E;while(E<A.length&&wo(A[E]))E++;if(E===I)return;if(E===A.length)return{state:"partial"};if(A[E]===Lo)return{state:"complete",endIndex:E};return},yo=(A)=>{for(let B=0;B<A.length;B++)if(Gx(A,B)?.state==="complete")return!0;return!1},Wo=(A)=>{let B=[],E=0;while(E<A.length){let I=Gx(A,E);if(I?.state==="complete"){E=I.endIndex+1;continue}if(I?.state==="partial")break;B.push(A[E]),E++}return B},cR=(A)=>{return A instanceof Error||Object.prototype.toString.call(A)==="[object Error]"};var Fx=P(async()=>{lT();$H();xO();Ew();zH();Iz();Sw();Uz();Zu();qu();SR();Dx();SU();uK();await Q0([$0(),GK(),_R(),aH()]);pR=kB(RQ(),1),Ux=kB(mO(),1)});import{Stream as uo}from"node:stream";import fK from"node:process";var xo=(A,B)=>{let E={stdout:fK.stdout,stdin:fK.stdin,stderr:fK.stderr,debug:!1,exitOnCtrlC:!0,patchConsole:!0,maxFps:30,incrementalRendering:!1,concurrent:!1,...bo(B)},I=fo(E.stdout,()=>new bK(E),E.concurrent??!1);return I.render(A),{rerender:I.render,unmount(){I.unmount()},waitUntilExit:I.waitUntilExit,cleanup:()=>LU.delete(E.stdout),clear:I.clear}},iR,bo=(A={})=>{if(A instanceof uo)return{stdout:A,stdin:fK.stdin};return A},fo=(A,B,E)=>{let I=LU.get(A);if(!I)I=B(),LU.set(A,I);else if(I.isConcurrent!==E)console.warn(`Warning: render() was called with concurrent: ${E}, but the existing instance for this stdout uses concurrent: ${I.isConcurrent}. The concurrent option only takes effect on the first render. Call unmount() first if you need to change the rendering mode.`);return I};var Jx=P(async()=>{SR();await Fx();iR=xo});var Nx=P(async()=>{zH();await Q0([$0(),GK(),_R(),aH()])});var PK;var Hx=P(()=>{PK=kB(RQ(),1)});var Kx;var $x=P(()=>{SU();Kx=kB(RQ(),1)});var Po;var Mx=P(()=>{Po=kB(RQ(),1)});var ho;var Yx=P(()=>{TK();ho=kB(RQ(),1)});import{Buffer as ko}from"node:buffer";function Zx(A){if(A===3)return"release";if(A===2)return"repeat";return"press"}function qx(A){return{ctrl:!!(A&VC.ctrl),shift:!!(A&VC.shift),meta:!!(A&VC.meta),option:!!(A&VC.alt),super:!!(A&VC.super),hyper:!!(A&VC.hyper),capsLock:!!(A&VC.capsLock),numLock:!!(A&VC.numLock)}}var mo,lo,vx,Ox,co=(A)=>{return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(A)},po=(A)=>{return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(A)},zx,io,ao,no,Xx,Rx=(A)=>A>=0&&A<=1114111&&!(A>=55296&&A<=57343),dR=(A)=>Rx(A)?String.fromCodePoint(A):"?",to=(A)=>{let B=zx.exec(A);if(!B)return null;let E=parseInt(B[1],10),I=B[2]?Math.max(0,parseInt(B[2],10)-1):0,Q=B[3]?parseInt(B[3],10):1,g=B[4];if(!Rx(E))return null;let U;if(g)U=g.split(":").map((v)=>dR(parseInt(v,10))).join("");let N,Y;if(E===32)N="space",Y=!0;else if(E===13)N="return",Y=!0;else if(Xx[E])N=Xx[E],Y=!1;else if(E>=1&&E<=26)N=String.fromCodePoint(E+96),Y=!1;else N=dR(E).toLowerCase(),Y=!0;if(Y&&!U)U=dR(E);return{name:N,...qx(I),eventType:Zx(Q),sequence:A,raw:A,isKittyProtocol:!0,isPrintable:Y,text:U}},oo=(A)=>{let B=io.exec(A);if(!B)return null;let E=parseInt(B[1],10),I=Math.max(0,parseInt(B[2],10)-1),Q=parseInt(B[3],10),g=B[4],U=g==="~"?no[E]:ao[g];if(!U)return null;return{name:U,...qx(I),eventType:Zx(Q),sequence:A,raw:A,isKittyProtocol:!0,isPrintable:!1}},ro=(A="")=>{let B;if(ko.isBuffer(A))if(A[0]>127&&A[1]===void 0)A[0]-=128,A="\x1B"+String(A);else A=String(A);else if(A!==void 0&&typeof A!=="string")A=String(A);else if(!A)A="";let E=to(A);if(E)return E;let I=oo(A);if(I)return I;if(zx.test(A))return{name:"",ctrl:!1,meta:!1,shift:!1,option:!1,sequence:A,raw:A,isKittyProtocol:!0,isPrintable:!1};let Q={name:"",ctrl:!1,meta:!1,shift:!1,option:!1,sequence:A,raw:A};if(Q.sequence=Q.sequence||A||Q.name,A==="\r"||A==="\x1B\r")Q.raw=void 0,Q.name="return",Q.option=A.length===2;else if(A===`
|
|
281
281
|
`)Q.name="enter";else if(A==="\t")Q.name="tab";else if(A==="\b"||A==="\x1B\b")Q.name="backspace",Q.meta=A.charAt(0)==="\x1B";else if(A===""||A==="\x1B")Q.name="delete",Q.meta=A.charAt(0)==="\x1B";else if(A==="\x1B"||A==="\x1B\x1B")Q.name="escape",Q.meta=A.length===2;else if(A===" "||A==="\x1B ")Q.name="space",Q.meta=A.length===2;else if(A.length===1&&A<="\x1A")Q.name=String.fromCharCode(A.charCodeAt(0)+97-1),Q.ctrl=!0;else if(A.length===1&&A>="0"&&A<="9")Q.name="number";else if(A.length===1&&A>="a"&&A<="z")Q.name=A;else if(A.length===1&&A>="A"&&A<="Z")Q.name=A.toLowerCase(),Q.shift=!0;else if(B=mo.exec(A))Q.meta=!0,Q.shift=/^[A-Z]$/.test(B[1]);else if(B=lo.exec(A)){let g=[...A];if(g[0]==="\x1B"&&g[1]==="\x1B")Q.option=!0;let U=[B[1],B[2],B[4],B[6]].filter(Boolean).join(""),N=(B[3]||B[5]||1)-1;Q.ctrl=!!(N&4),Q.meta=!!(N&10),Q.shift=!!(N&1),Q.code=U,Q.name=vx[U],Q.shift=co(U)||Q.shift,Q.ctrl=po(U)||Q.ctrl}return Q},_x;var Vx=P(()=>{uK();mo=/^(?:\x1b)([a-zA-Z0-9])$/,lo=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,vx={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"},Ox=[...Object.values(vx),"backspace"],zx=/^\x1b\[(\d+)(?:;(\d+)(?::(\d+))?(?:;([\d:]+))?)?u$/,io=/^\x1b\[(\d+);(\d+):(\d+)([A-Za-z~])$/,ao={A:"up",B:"down",C:"right",D:"left",E:"clear",F:"end",H:"home",P:"f1",Q:"f2",R:"f3",S:"f4"},no={2:"insert",3:"delete",5:"pageup",6:"pagedown",7:"home",8:"end",11:"f1",12:"f2",13:"f3",14:"f4",15:"f5",17:"f6",18:"f7",19:"f8",20:"f9",21:"f10",23:"f11",24:"f12"},Xx={27:"escape",9:"tab",127:"delete",8:"backspace",57358:"capslock",57359:"scrolllock",57360:"numlock",57361:"printscreen",57362:"pause",57363:"menu",57376:"f13",57377:"f14",57378:"f15",57379:"f16",57380:"f17",57381:"f18",57382:"f19",57383:"f20",57384:"f21",57385:"f22",57386:"f23",57387:"f24",57388:"f25",57389:"f26",57390:"f27",57391:"f28",57392:"f29",57393:"f30",57394:"f31",57395:"f32",57396:"f33",57397:"f34",57398:"f35",57399:"kp0",57400:"kp1",57401:"kp2",57402:"kp3",57403:"kp4",57404:"kp5",57405:"kp6",57406:"kp7",57407:"kp8",57408:"kp9",57409:"kpdecimal",57410:"kpdivide",57411:"kpmultiply",57412:"kpsubtract",57413:"kpadd",57414:"kpenter",57415:"kpequal",57416:"kpseparator",57417:"kpleft",57418:"kpright",57419:"kpup",57420:"kpdown",57421:"kppageup",57422:"kppagedown",57423:"kphome",57424:"kpend",57425:"kpinsert",57426:"kpdelete",57427:"kpbegin",57428:"mediaplay",57429:"mediapause",57430:"mediaplaypause",57431:"mediareverse",57432:"mediastop",57433:"mediafastforward",57434:"mediarewind",57435:"mediatracknext",57436:"mediatrackprevious",57437:"mediarecord",57438:"lowervolume",57439:"raisevolume",57440:"mutevolume",57441:"leftshift",57442:"leftcontrol",57443:"leftalt",57444:"leftsuper",57445:"lefthyper",57446:"leftmeta",57447:"rightshift",57448:"rightcontrol",57449:"rightalt",57450:"rightsuper",57451:"righthyper",57452:"rightmeta",57453:"isoLevel3Shift",57454:"isoLevel5Shift"};_x=ro});var jx,so=()=>jx.useContext(_K),wU;var hK=P(()=>{wR();jx=kB(RQ(),1),wU=so});var aR,eo=(A,B={})=>{let{stdin:E,setRawMode:I,internal_exitOnCtrlC:Q,internal_eventEmitter:g}=wU();aR.useEffect(()=>{if(B.isActive===!1)return;return I(!0),()=>{I(!1)}},[B.isActive,I]),aR.useEffect(()=>{if(B.isActive===!1)return;let U=(N)=>{let Y=_x(N),v={upArrow:Y.name==="up",downArrow:Y.name==="down",leftArrow:Y.name==="left",rightArrow:Y.name==="right",pageDown:Y.name==="pagedown",pageUp:Y.name==="pageup",home:Y.name==="home",end:Y.name==="end",return:Y.name==="return",escape:Y.name==="escape",ctrl:Y.ctrl,shift:Y.shift,tab:Y.name==="tab",backspace:Y.name==="backspace",delete:Y.name==="delete",meta:Y.meta||Y.name==="escape"||Y.option,super:Y.super??!1,hyper:Y.hyper??!1,capsLock:Y.capsLock??!1,numLock:Y.numLock??!1,eventType:Y.eventType},Z;if(Y.isKittyProtocol)if(Y.isPrintable)Z=Y.text??Y.name;else if(Y.ctrl&&Y.name.length===1)Z=Y.name;else Z="";else if(Y.ctrl)Z=Y.name;else Z=Y.sequence;if(!Y.isKittyProtocol&&Ox.includes(Y.name))Z="";if(Z.startsWith("\x1B"))Z=Z.slice(1);if(Z.length===1&&typeof Z[0]==="string"&&/[A-Z]/.test(Z[0]))v.shift=!0;if(!(Z==="c"&&v.ctrl)||!Q)uD.batchedUpdates(()=>{A(Z,v)})};return g?.on("input",U),()=>{g?.removeListener("input",U)}},[B.isActive,E,Q,A])},i1;var Lx=P(async()=>{Vx();hK();await GK();aR=kB(RQ(),1),i1=eo});var Sx,Ar=()=>Sx.useContext(qK),nR;var Tx=P(()=>{TR();Sx=kB(RQ(),1),nR=Ar});var wx,Br=()=>wx.useContext(VK),tR;var yx=P(()=>{yR();wx=kB(RQ(),1),tR=Br});var Qr;var Wx=P(()=>{uR();Qr=kB(RQ(),1)});var oR;var ux=P(()=>{LK();hK();oR=kB(RQ(),1)});var Er;var xx=P(()=>{LK();Er=kB(RQ(),1)});var Ir;var bx=P(()=>{SU();Ir=kB(RQ(),1)});var kK;var fx=P(()=>{bR();kK=kB(RQ(),1)});var Px=()=>{};var q0=P(async()=>{TK();hR();Hx();$x();Mx();Yx();Tx();hK();yx();Wx();ux();xx();bx();fx();Px();uK();await Q0([Jx(),Nx(),Lx()])});function kx(A){let B=new Map;for(let E of A){let I=B.get(E.roomId);if(!I)I={roomId:E.roomId,roomName:E.roomName,teams:[]},B.set(E.roomId,I);I.teams.push(E)}return[...B.values()]}function mx(A){let B="exited";for(let E of A)if(hx[E.status]<hx[B])B=E.status;return B}var hx;var rR=P(()=>{hx={error:0,starting:1,running:2,exited:3}});function lx(A,B,E){var I=null;if(E!==void 0&&(I=""+E),B.key!==void 0&&(I=""+B.key),"key"in B){E={};for(var Q in B)Q!=="key"&&(E[Q]=B[Q])}else E=B;return B=E.ref,{$$typeof:Dr,type:A,key:I,ref:B!==void 0?B:null,props:E}}var Dr,_A,HB;var UD=P(()=>{Dr=Symbol.for("react.transitional.element");_A=lx,HB=lx});function mK({roomGroups:A,focusedIndex:B,width:E,height:I}){if(A.length===0)return HB(zB,{flexDirection:"column",width:E,borderStyle:"single",borderColor:"gray",children:[_A(zB,{paddingX:1,children:_A(RA,{bold:!0,children:"Rooms"})}),_A(zB,{paddingX:1,children:_A(RA,{dimColor:!0,children:"No rooms"})})]});let Q=Math.max(1,I-3),g=Math.max(0,Math.min(B-Math.floor(Q/2),A.length-Q)),U=A.slice(g,g+Q);return HB(zB,{flexDirection:"column",width:E,borderStyle:"single",borderColor:"gray",height:I,children:[_A(zB,{paddingX:1,children:_A(RA,{bold:!0,children:"Rooms"})}),U.map((N,Y)=>{let Z=g+Y===B,j=mx(N.teams),{icon:O,color:z}=Cr[j],L=E-4,T=O.length+1,u=N.teams.length>1?` ${N.teams.length}×`:"",EA=L-2-T-u.length,GA=N.roomName.length>EA?`${N.roomName.slice(0,EA-1)}~`:N.roomName.padEnd(EA);return _A(zB,{paddingX:1,overflowX:"hidden",children:HB(RA,{bold:Z,color:Z?"cyan":void 0,backgroundColor:Z?"gray":void 0,wrap:"truncate",children:[Z?">":" "," ",GA,u," ",_A(RA,{color:z,dimColor:!Z,children:O})]})},N.roomId)})]})}var Cr;var cx=P(async()=>{rR();UD();await q0();Cr={starting:{icon:"...",color:"yellow"},running:{icon:">>>",color:"green"},exited:{icon:"[done]",color:"gray"},error:{icon:"[err]",color:"red"}}});var px=P(async()=>{await cx()});function iI({pane:A,height:B,width:E}){let I=Math.max(1,B-3),Q=A.lines.slice(-I),g=A.title||`Pane ${A.index}`;return HB(zB,{flexDirection:"column",flexGrow:E?void 0:1,flexBasis:E?void 0:0,width:E,borderStyle:"single",borderColor:A.active?"cyan":"gray",height:B,children:[_A(zB,{paddingX:1,children:_A(RA,{bold:A.active,color:A.active?"cyan":void 0,dimColor:!A.active,children:g})}),_A(zB,{flexDirection:"column",flexGrow:1,paddingX:1,children:Q.length===0?_A(RA,{dimColor:!0,children:"[no output]"}):Q.map((U,N)=>_A(RA,{wrap:"truncate",children:U},N))})]})}function lK({roomName:A,status:B,totalPanes:E,visibleCount:I}){let{label:Q,color:g}=ix[B];return HB(zB,{paddingX:1,gap:1,children:[_A(RA,{bold:!0,color:"cyan",children:A}),HB(RA,{color:g,children:["[",Q,"]"]}),E>1&&_A(RA,{dimColor:!0,children:E>I?`${I} of ${E} panes`:`${E} panes`})]})}function cK({roomName:A,status:B,lines:E,panes:I,height:Q}){let g=I.length,U=I.slice(0,gr),N=U.length,Y=1,v=Q-1;if(N<=1){let{label:j,color:O}=ix[B],z=Math.max(1,Q-3),L=E.slice(-z);return HB(zB,{flexDirection:"column",flexGrow:1,borderStyle:"single",borderColor:"cyan",height:Q,children:[HB(zB,{paddingX:1,gap:1,children:[_A(RA,{bold:!0,color:"cyan",children:A}),HB(RA,{color:O,children:["[",j,"]"]})]}),_A(zB,{flexDirection:"column",flexGrow:1,paddingX:1,children:L.length===0?_A(RA,{dimColor:!0,children:"[no output yet]"}):L.map((T,u)=>_A(RA,{wrap:"truncate",children:T},u))})]})}if(N===2)return HB(zB,{flexDirection:"column",flexGrow:1,height:Q,children:[_A(lK,{roomName:A,status:B,totalPanes:g,visibleCount:N}),HB(zB,{flexDirection:"row",flexGrow:1,height:v,children:[_A(iI,{pane:U[0],height:v}),_A(iI,{pane:U[1],height:v})]})]});if(N===3){let j=Math.floor(v/2);return HB(zB,{flexDirection:"column",flexGrow:1,height:Q,children:[_A(lK,{roomName:A,status:B,totalPanes:g,visibleCount:N}),HB(zB,{flexDirection:"row",flexGrow:1,height:v,children:[_A(iI,{pane:U[0],height:v,width:"50%"}),HB(zB,{flexDirection:"column",flexGrow:1,children:[_A(iI,{pane:U[1],height:j}),_A(iI,{pane:U[2],height:v-j})]})]})]})}if(N===4){let j=Math.floor(v/2);return HB(zB,{flexDirection:"column",flexGrow:1,height:Q,children:[_A(lK,{roomName:A,status:B,totalPanes:g,visibleCount:N}),HB(zB,{flexDirection:"row",flexGrow:1,height:v,children:[_A(iI,{pane:U[0],height:v,width:"50%"}),HB(zB,{flexDirection:"column",flexGrow:1,children:[_A(iI,{pane:U[1],height:j}),HB(zB,{flexDirection:"row",height:v-j,children:[_A(iI,{pane:U[2],height:v-j}),_A(iI,{pane:U[3],height:v-j})]})]})]})]})}let Z=Math.floor(v/2);return HB(zB,{flexDirection:"column",flexGrow:1,height:Q,children:[_A(lK,{roomName:A,status:B,totalPanes:g,visibleCount:N}),HB(zB,{flexDirection:"row",flexGrow:1,height:v,children:[_A(iI,{pane:U[0],height:v,width:"30%"}),HB(zB,{flexDirection:"column",flexGrow:1,children:[HB(zB,{flexDirection:"row",height:Z,children:[_A(iI,{pane:U[1],height:Z}),_A(iI,{pane:U[2],height:Z})]}),HB(zB,{flexDirection:"row",height:v-Z,children:[_A(iI,{pane:U[3],height:v-Z}),_A(iI,{pane:U[4],height:v-Z})]})]})]})]})}var gr=5,ix;var dx=P(async()=>{UD();await q0();ix={starting:{label:"starting...",color:"yellow"},running:{label:"running",color:"green"},exited:{label:"exited",color:"gray"},error:{label:"error",color:"red"}}});var ax=P(async()=>{await dx()});function nx({roomGroups:A,focusedRoomIndex:B,focusedTeamIndex:E,height:I}){if(A.length===0)return HB(zB,{flexGrow:1,alignItems:"center",justifyContent:"center",children:[_A(RA,{dimColor:!0,children:"No teams running. Press "}),_A(RA,{bold:!0,color:"green",children:"n"}),_A(RA,{dimColor:!0,children:" to create or connect a team."})]});let Q=A[B];if(!Q)return null;let g=Q.teams[E];if(!g)return null;let U=Q.teams.length>1,Y=I-(U?1:0);return HB(zB,{flexGrow:1,flexDirection:"row",children:[_A(mK,{roomGroups:A,focusedIndex:B,width:Ur,height:I}),HB(zB,{flexDirection:"column",flexGrow:1,children:[U&&_A(zB,{paddingX:1,gap:1,children:Q.teams.map((v,Z)=>{let j=Z===E,O=v.codingAgent==="codex"?"Codex":"Claude",{icon:z,color:L}=Gr[v.status];return HB(RA,{children:[HB(RA,{bold:j,color:j?"cyan":void 0,dimColor:!j,children:[j?"▸":" ",O]}),HB(RA,{color:L,dimColor:!j,children:[" ",z]})]},v.teamId)})}),_A(cK,{roomName:g.roomName,status:g.status,lines:g.lines,panes:g.panes,height:Y})]})]})}var Ur=32,Gr;var tx=P(async()=>{UD();await Q0([q0(),px(),ax()]);Gr={starting:{icon:"...",color:"yellow"},running:{icon:">>>",color:"green"},exited:{icon:"[done]",color:"gray"},error:{icon:"[err]",color:"red"}}});function ox(A,B){return A.map((E)=>({...E,connected:B.has(E.id)}))}function e2(A,B){if(B.length===0)return 0;return Math.min(Math.max(A,0),B.length-1)}function rx(A,B,E){if(B.length<=E)return B;let I=e2(A,B),Q=Math.floor(E/2),g=Math.max(0,I-Q),U=Math.max(0,B.length-E);if(g>U)g=U;return B.slice(g,g+E)}function sx(A){let B=A.roomName.trim(),E=A.rooms[e2(A.selectedRoomIndex,A.rooms)];if(A.focus==="list"&&E)return{type:"existing",room:{id:E.id,name:E.name,created_at:E.created_at},codingAgent:A.codingAgent};if(B)return{type:"new",roomName:B,codingAgent:A.codingAgent};if(E)return{type:"existing",room:{id:E.id,name:E.name,created_at:E.created_at},codingAgent:A.codingAgent};return null}function ex({codingAgents:A,rooms:B,connectedRoomIds:E,roomsLoading:I=!1,roomsError:Q=null,maxVisibleRooms:g=6,onSubmit:U,onCancel:N}){let[Y,v]=jC.useState(""),[Z,j]=jC.useState(0),[O,z]=jC.useState(0),[L,T]=jC.useState(0),[u,EA]=jC.useState("agent"),GA=jC.useMemo(()=>ox(B,E),[B,E]);jC.useEffect(()=>{if(T((lA)=>e2(lA,GA)),u==="list"&&GA.length===0)EA("input")},[u,GA]),i1((lA,_B)=>{if(_B.escape){N();return}if(_B.tab){EA((TB)=>{if(TB==="agent")return"input";if(TB==="input")return GA.length>0?"list":"agent";return"agent"});return}if(_B.return){let TB=sx({focus:u,roomName:Y,selectedRoomIndex:L,rooms:GA,codingAgent:A[O]?.id??"claude"});if(TB)U(TB);return}if(u==="agent"){if(_B.upArrow||_B.leftArrow){z((TB)=>Math.max(0,TB-1));return}if(_B.downArrow||_B.rightArrow){z((TB)=>Math.min(A.length-1,TB+1));return}}if(u==="list"){if(_B.upArrow){T((TB)=>e2(TB-1,GA));return}if(_B.downArrow){T((TB)=>e2(TB+1,GA));return}}if(u==="input"){if(_B.leftArrow){j((TB)=>Math.max(0,TB-1));return}if(_B.rightArrow){j((TB)=>Math.min(Y.length,TB+1));return}}if(_B.backspace||_B.delete){if(Z>0)EA("input"),v((TB)=>TB.slice(0,Z-1)+TB.slice(Z)),j((TB)=>TB-1);return}if(lA&&!_B.ctrl&&!_B.meta)EA("input"),v((TB)=>TB.slice(0,Z)+lA+TB.slice(Z)),j((TB)=>TB+lA.length)});let gA=Y.slice(0,Z),DA=Y[Z]??" ",OA=Y.slice(Z+1),zA=A[O]?.id??"claude",SA=rx(L,GA,g),ZB=SA.length>0?GA.indexOf(SA[0]):0;return HB(zB,{flexDirection:"column",borderStyle:"round",borderColor:"green",paddingX:1,minHeight:Math.max(9,g+8),children:[_A(RA,{bold:!0,color:"green",children:"New Team"}),HB(zB,{marginTop:1,children:[_A(RA,{color:u==="agent"?"green":void 0,children:"Agent: "}),A.map((lA,_B)=>HB(RA,{children:[HB(RA,{color:zA===lA.id?"yellow":void 0,children:[_B===O?">":" ",lA.label]}),_A(RA,{children:_B<A.length-1?" ":""})]},lA.id))]}),HB(zB,{marginTop:1,children:[_A(RA,{color:u==="input"?"green":void 0,children:"Create room: "}),_A(RA,{color:"cyan",children:gA}),_A(RA,{backgroundColor:u==="input"?"cyan":void 0,color:u==="input"?"black":"cyan",children:DA}),_A(RA,{color:"cyan",children:OA})]}),HB(zB,{marginTop:1,flexDirection:"column",children:[_A(RA,{color:u==="list"?"green":void 0,children:"Existing rooms:"}),I?_A(RA,{dimColor:!0,children:"Loading rooms..."}):Q?_A(RA,{color:"red",children:Q}):SA.length===0?_A(RA,{dimColor:!0,children:"No existing rooms."}):SA.map((lA,_B)=>{let EQ=ZB+_B===e2(L,GA),LB=EQ?">":" ";return HB(zB,{children:[HB(RA,{color:EQ&&u==="list"?"yellow":void 0,dimColor:lA.connected,children:[LB," ",lA.name]}),lA.connected?_A(RA,{dimColor:!0,children:" (connected)"}):null]},lA.id)})]}),_A(RA,{dimColor:!0,children:"Tab focus, arrows navigate, Enter selects room or creates a new one, Esc cancels."})]})}var jC;var Ab=P(async()=>{UD();await q0();jC=kB(RQ(),1)});function Fr({state:A}){switch(A.status){case"checking":return HB(RA,{dimColor:!0,children:[_A(RA,{children:"["}),_A(RA,{bold:!0,children:"u"}),_A(RA,{children:"]pdate checking..."})]});case"downloading":return HB(RA,{dimColor:!0,children:[_A(RA,{children:"["}),_A(RA,{bold:!0,children:"u"}),_A(RA,{children:"]pdate downloading..."})]});case"ready_to_restart":return HB(RA,{color:"green",children:[_A(RA,{children:"["}),_A(RA,{bold:!0,children:"u"}),HB(RA,{children:["]pdate ready: v",A.version]})]});case"failed":return HB(RA,{color:"red",dimColor:!0,children:[_A(RA,{children:"["}),_A(RA,{bold:!0,children:"u"}),_A(RA,{children:"]pdate failed"})]});case"update_unavailable":return HB(RA,{dimColor:!0,children:[_A(RA,{children:"["}),_A(RA,{bold:!0,children:"u"}),_A(RA,{children:"]pdate unavailable"})]});default:return HB(RA,{children:[_A(RA,{dimColor:!0,children:"["}),_A(RA,{bold:!0,children:"u"}),_A(RA,{dimColor:!0,children:"]pdate"})]})}}function Bb({teamCount:A,roomCount:B,focusedRoom:E,version:I,updateState:Q}){return HB(zB,{justifyContent:"space-between",children:[HB(zB,{gap:2,children:[HB(RA,{children:[_A(RA,{dimColor:!0,children:"["}),_A(RA,{bold:!0,color:"green",children:"n"}),_A(RA,{dimColor:!0,children:"]ew/connect"})]}),HB(RA,{children:[_A(RA,{dimColor:!0,children:"["}),_A(RA,{bold:!0,color:"red",children:"x"}),_A(RA,{dimColor:!0,children:"]kill"})]}),HB(RA,{children:[_A(RA,{dimColor:!0,children:"["}),_A(RA,{bold:!0,children:"a"}),_A(RA,{dimColor:!0,children:"]ttach"})]}),HB(RA,{children:[_A(RA,{dimColor:!0,children:"["}),_A(RA,{bold:!0,children:"j/k"}),_A(RA,{dimColor:!0,children:"]room"})]}),HB(RA,{children:[_A(RA,{dimColor:!0,children:"["}),_A(RA,{bold:!0,children:"h/l"}),_A(RA,{dimColor:!0,children:"]tab"})]}),HB(RA,{children:[_A(RA,{dimColor:!0,children:"["}),_A(RA,{bold:!0,color:"yellow",children:"q"}),_A(RA,{dimColor:!0,children:"]uit"})]}),HB(RA,{children:[_A(RA,{dimColor:!0,children:"["}),_A(RA,{bold:!0,color:"red",children:"Q"}),_A(RA,{dimColor:!0,children:"]uit+kill"})]})]}),HB(zB,{gap:2,children:[E&&_A(RA,{color:"cyan",children:E}),HB(RA,{dimColor:!0,children:[B," room",B!==1?"s":"",", ",A," team",A!==1?"s":""]}),HB(RA,{dimColor:!0,children:["v",I]}),_A(Fr,{state:Q})]})]})}var Qb=P(async()=>{UD();await q0()});function Eb(){let[A,B]=LC.useState({status:"idle"}),E=LC.useRef(!1),I=LC.useCallback(async()=>{if(E.current)return;E.current=!0,B({status:"checking"});try{let U=await vT();if(!U.available){if(U.reason==="offline")B({status:"offline"});else if(U.reason==="up to date")B({status:"up_to_date"});else B({status:"failed",error:U.reason});E.current=!1;return}if(!RO().supported){B({status:"update_unavailable",version:U.version}),E.current=!1;return}if(ZO()===U.version){B({status:"ready_to_restart",version:U.version}),E.current=!1;return}B({status:"downloading",version:U.version});let Y=await OT(U.version);if(Y.ok)B({status:"ready_to_restart",version:U.version});else if(ZO()===U.version)B({status:"ready_to_restart",version:U.version});else B({status:"failed",error:Y.error})}catch(U){B({status:"failed",error:U instanceof Error?U.message:String(U)})}finally{E.current=!1}},[]),Q=LC.useCallback(()=>{if(E.current)return;if(A.status==="update_unavailable")return;I()},[A.status,I]),g=LC.useCallback(()=>{},[]);return LC.useEffect(()=>{I()},[I]),{state:A,triggerCheck:Q,triggerRestart:g}}var LC;var Ib=P(()=>{FH();LC=kB(RQ(),1)});function Jr({processManager:A,client:B,codingAgents:E,onAttach:I,onDetach:Q,onRequestRestart:g}){let{exit:U}=nR(),{stdout:N}=tR(),{setRawMode:Y}=wU(),[v,Z]=lQ.useState(A.list()),[j,O]=lQ.useState(0),[z,L]=lQ.useState(0),[T,u]=lQ.useState(!1),[EA,GA]=lQ.useState([]),[gA,DA]=lQ.useState(!1),[OA,zA]=lQ.useState(null),[SA,ZB]=lQ.useState(null),[lA,_B]=lQ.useState(!1),[,TB]=lQ.useState(0),{state:EQ,triggerCheck:LB}=Eb(),jA=N?.rows??24,VA=Math.max(10,Math.min(16,jA-4)),$B=jA-(T?VA:SA?1:1),JB=lQ.useMemo(()=>kx(v),[v]),JA=JB.length>0?Math.min(j,JB.length-1):0,BB=JB[JA],CA=BB?Math.min(z,BB.teams.length-1):0,n=BB?.teams[CA],e=lQ.useRef(null);e.current=n?.teamId??null;let gB=lQ.useRef(!1),pA=lQ.useCallback(()=>{let KA=A.list();Z((AB)=>{if(AB.length===KA.length&&AB.every((sA,l)=>sA===KA[l]))return AB;return[...KA]})},[A]),cB=lQ.useCallback(async()=>{if(!B.listRooms){GA([]),zA(null);return}DA(!0),zA(null);try{let KA=await B.listRooms();GA(KA)}catch(KA){zA(KA instanceof Error?KA.message:String(KA))}finally{DA(!1)}},[B]),mB=lQ.useCallback(()=>{u(!0),cB()},[cB]),FQ=lQ.useCallback(async(KA)=>{try{if(KA.type==="existing"){A.spawn(KA.room.id,KA.room.name,KA.codingAgent),pA();return}let AB=await t8(B,{name:KA.roomName,silent:!0});GA((sA)=>sA.some((l)=>l.id===AB.id)?sA:[...sA,AB]),A.spawn(AB.id,AB.name,KA.codingAgent),pA()}catch(AB){let sA=AB instanceof Error?AB.message:String(AB),l=`error-${Date.now()}`,vA=KA.type==="existing"?KA.room.name:KA.roomName;A.addError(l,vA,sA),pA()}},[B,A,pA]),YB=lQ.useRef(0);lQ.useEffect(()=>{let KA=setInterval(async()=>{if(gB.current)return;let AB=e.current;if(!AB)return;if(await A.capture(AB,$B),YB.current++,YB.current%10===0)A.refreshStatuses(),pA();TB((sA)=>sA+1)},200);return()=>clearInterval(KA)},[A,$B,pA]),lQ.useEffect(()=>{let KA=e.current;if(!KA)return;A.capture(KA,$B).then(()=>{TB((AB)=>AB+1)})},[j,z,A,$B]),i1((KA,AB)=>{if(T||gB.current)return;if(lA){if(KA==="y"||KA==="Y"){_B(!1),g?.(),U();return}_B(!1);return}if(SA){if(KA==="y"||KA==="Y")A.kill(SA),pA();ZB(null);return}if(KA==="u"){if(EQ.status==="ready_to_restart")_B(!0);else LB();return}if(KA==="q"){U();return}if(KA==="Q"){A.killAll(),U();return}if(KA==="n"){mB();return}if(KA==="x"&&n){ZB(n.teamId);return}if((KA==="a"||AB.return)&&n){gB.current=!0,I?.();try{Y(!1),process.stdout.write("\x1B[?1049l"),A.attach(n.teamId)}finally{process.stdout.write("\x1B[?1049h"),Y(!0),Q?.(),pA(),gB.current=!1}return}if(KA==="j"||AB.downArrow)O((sA)=>Math.min(JB.length-1,sA+1)),L(0);if(KA==="k"||AB.upArrow)O((sA)=>Math.max(0,sA-1)),L(0);if((KA==="l"||AB.rightArrow)&&BB)L((sA)=>Math.min(BB.teams.length-1,sA+1));if((KA==="h"||AB.leftArrow)&&BB)L((sA)=>Math.max(0,sA-1))});let rB=SA?v.find((KA)=>KA.teamId===SA):null,hA=rB?`${rB.codingAgent==="codex"?"Codex":"Claude"} in ${rB.roomName}`:SA;return HB(zB,{flexDirection:"column",height:jA,children:[_A(nx,{roomGroups:JB,focusedRoomIndex:JA,focusedTeamIndex:CA,height:$B}),lA&&EQ.status==="ready_to_restart"?HB(zB,{children:[HB(RA,{color:"green",children:["Apply update v",EQ.version,"? "]}),_A(RA,{dimColor:!0,children:"[y/n]"})]}):SA?HB(zB,{children:[_A(RA,{color:"red",children:"Kill "}),_A(RA,{bold:!0,children:hA}),_A(RA,{color:"red",children:"? "}),_A(RA,{dimColor:!0,children:"[y/n]"})]}):T?_A(ex,{codingAgents:[...E],rooms:EA,connectedRoomIds:new Set(v.map((KA)=>KA.roomId)),roomsLoading:gA,roomsError:OA,maxVisibleRooms:Math.max(3,VA-10),onSubmit:(KA)=>{u(!1),FQ(KA)},onCancel:()=>u(!1)}):_A(Bb,{teamCount:v.length,roomCount:JB.length,focusedRoom:n?.roomName??null,version:M8,updateState:EQ})]})}function Cb(A){return _A(Db,{children:_A(Jr,{...A})})}var lQ,Db;var gb=P(async()=>{rR();Ib();FH();oN();UD();await Q0([q0(),tx(),Ab(),Qb()]);lQ=kB(RQ(),1);Db=class Db extends lQ.Component{state={error:null};static getDerivedStateFromError(A){return{error:A}}render(){if(this.state.error)return HB(zB,{flexDirection:"column",paddingX:1,children:[HB(RA,{color:"red",bold:!0,children:["TUI crashed: ",this.state.error.message]}),_A(RA,{dimColor:!0,children:"Press Ctrl+C to exit"})]});return this.props.children}}});var Gb={};jQ(Gb,{startDashboard:()=>Nr});async function Nr(A,B,E){let I=new x2({server:"meet-ai",scrollback:1e4}),Q=I.checkAvailability();if(!Q.available)console.error("tmux is required but not found."),console.error("Install: brew install tmux (macOS) or apt install tmux (Linux)"),process.exit(1);let[g,U]=ML(Q.version);if(g<3||g===3&&U<2)console.error(`tmux >= 3.2 required, found ${Q.version}`),process.exit(1);let N={};try{N.claude=qT()}catch{}try{N.codex=_T()}catch{}let Y=jv.filter((DA)=>Boolean(N[DA.id]));if(Y.length===0)console.error("No supported coding agent CLI was found."),console.error("Install Claude Code or Codex, or set MEET_AI_CLAUDE_PATH / MEET_AI_CODEX_PATH."),process.exit(1);let v=new zO({agentBinaries:N,debug:E?.debug,tmux:I,env:{...B.url?{MEET_AI_URL:B.url}:{},...B.key?{MEET_AI_KEY:B.key}:{}}}),Z=v.reconnect();if(Z.length>0){console.log(`Found ${Z.length} orphaned session(s) from a previous run:`);for(let DA of Z){let OA=DA.status==="running"?"running":"exited";console.log(` ${DA.roomName} (${OA})`)}console.log(`Reconnected all sessions. Press x to kill any you no longer need.
|
|
282
|
-
`)}let j=null,O=new Set;function z(){try{j=A.listenLobby({silent:!0,onSpawnRequest:async({roomName:DA,codingAgent:OA})=>{let zA=`${DA}:${OA}`;if(O.has(zA))return;O.add(zA);try{if(!N[OA]){v.addError(`spawn-failed-${Date.now()}`,DA,`Coding agent "${OA}" is not installed. Install it or set the corresponding env var.`);return}let SA=await t8(A,{name:DA,silent:!0}),ZB=v.spawn(SA.id,DA,OA);if(ZB.status==="error")console.error(`[dashboard] spawn failed for room "${DA}": ${ZB.lines.join("; ")}`)}finally{O.delete(zA)}}})}catch{}}z();function L(){j?.close(),j=null}function T(){L(),process.exit(0)}function u(){process.off("SIGINT",T),process.off("SIGTERM",T)}let EA=!1;process.on("SIGINT",T),process.on("SIGTERM",T);let GA=Ub.default.createElement(Cb,{processManager:v,client:A,codingAgents:Y,onAttach:()=>{j?.close(),j=null},onDetach:()=>{z()},onRequestRestart:()=>{EA=!0,L(),u()}});if(await iR(GA).waitUntilExit(),L(),u(),EA){await zT();return}process.exit(0)}var Ub;var Fb=P(async()=>{Lv();oN();$T();FH();QH();VT();await Q0([gb(),q0()]);Ub=kB(RQ(),1)});SE();O9();UE();var Hr=BQ({meta:{name:"meet-ai",version:M8,description:"CLI for meet-ai chat rooms — create rooms, send messages, and stream via WebSocket"},args:{debug:{type:"boolean",description:"Show debug output in panes (spawn commands, raw chunks, exit codes)",default:!1}},subCommands:{"create-room":()=>Promise.resolve().then(() => (Lj(),jj)).then((A)=>A.default),"delete-room":()=>Promise.resolve().then(() => (uj(),Wj)).then((A)=>A.default),"send-message":()=>Promise.resolve().then(() => (kj(),hj)).then((A)=>A.default),"send-log":()=>Promise.resolve().then(() => (dj(),ij)).then((A)=>A.default),poll:()=>Promise.resolve().then(() => (sj(),rj)).then((A)=>A.default),listen:()=>Promise.resolve().then(() => (tL(),nL)).then((A)=>A.default),"send-team-info":()=>Promise.resolve().then(() => (BS(),AS)).then((A)=>A.default),"send-tasks":()=>Promise.resolve().then(() => (gS(),CS)).then((A)=>A.default),"download-attachment":()=>Promise.resolve().then(() => (HS(),NS)).then((A)=>A.default),"generate-key":()=>Promise.resolve().then(() => (MS(),$S)).then((A)=>A.default),hook:()=>Promise.resolve().then(() => (pS(),cS)).then((A)=>A.default),"setup-hooks":()=>Promise.resolve().then(() => (eS(),sS)).then((A)=>A.default),"list-commands":()=>Promise.resolve().then(() => (DT(),IT)).then((A)=>A.default),"send-commands":()=>Promise.resolve().then(() => (GT(),UT)).then((A)=>A.default)},async run({args:A}){if(process.argv.length>2)return;try{let{getClient:E}=await Promise.resolve().then(() => (CD(),Rj)),{getMeetAiConfig:I}=await Promise.resolve().then(() => (zN(),Kj)),{startDashboard:Q}=await Fb().then(() => Gb),g=E(),U=I();await Q(g,U,{debug:A.debug})}catch(E){uQ(E instanceof Error?E.message:String(E)),process.exit(1)}}});gq(Hr);
|
|
282
|
+
`)}let j=null,O=new Set;function z(){try{j=A.listenLobby({silent:!0,onSpawnRequest:async({roomName:DA,codingAgent:OA})=>{let zA=`${DA}:${OA}`;if(O.has(zA))return;O.add(zA);try{if(!N[OA]){v.addError(`spawn-failed-${Date.now()}`,DA,`Coding agent "${OA}" is not installed. Install it or set the corresponding env var.`);return}let SA=await t8(A,{name:DA,silent:!0}),ZB=v.spawn(SA.id,DA,OA);if(ZB.status==="error")console.error(`[dashboard] spawn failed for room "${DA}": ${ZB.lines.join("; ")}`)}finally{O.delete(zA)}}})}catch{}}z();function L(){j?.close(),j=null}function T(){L(),process.exit(0)}function u(){process.off("SIGINT",T),process.off("SIGTERM",T)}let EA=!1;process.on("SIGINT",T),process.on("SIGTERM",T);let GA=Ub.default.createElement(Cb,{processManager:v,client:A,codingAgents:Y,onAttach:()=>{j?.close(),j=null},onDetach:()=>{z()},onRequestRestart:()=>{EA=!0,L(),u()}});if(process.stdin.isTTY)try{process.stdin.setRawMode(!1),process.stdin.setRawMode(!0),process.stdin.resume()}catch{}if(await iR(GA).waitUntilExit(),L(),u(),EA){await zT();return}process.exit(0)}var Ub;var Fb=P(async()=>{Lv();oN();$T();FH();QH();VT();await Q0([gb(),q0()]);Ub=kB(RQ(),1)});SE();O9();UE();var Hr=BQ({meta:{name:"meet-ai",version:M8,description:"CLI for meet-ai chat rooms — create rooms, send messages, and stream via WebSocket"},args:{debug:{type:"boolean",description:"Show debug output in panes (spawn commands, raw chunks, exit codes)",default:!1}},subCommands:{"create-room":()=>Promise.resolve().then(() => (Lj(),jj)).then((A)=>A.default),"delete-room":()=>Promise.resolve().then(() => (uj(),Wj)).then((A)=>A.default),"send-message":()=>Promise.resolve().then(() => (kj(),hj)).then((A)=>A.default),"send-log":()=>Promise.resolve().then(() => (dj(),ij)).then((A)=>A.default),poll:()=>Promise.resolve().then(() => (sj(),rj)).then((A)=>A.default),listen:()=>Promise.resolve().then(() => (tL(),nL)).then((A)=>A.default),"send-team-info":()=>Promise.resolve().then(() => (BS(),AS)).then((A)=>A.default),"send-tasks":()=>Promise.resolve().then(() => (gS(),CS)).then((A)=>A.default),"download-attachment":()=>Promise.resolve().then(() => (HS(),NS)).then((A)=>A.default),"generate-key":()=>Promise.resolve().then(() => (MS(),$S)).then((A)=>A.default),hook:()=>Promise.resolve().then(() => (pS(),cS)).then((A)=>A.default),"setup-hooks":()=>Promise.resolve().then(() => (eS(),sS)).then((A)=>A.default),"list-commands":()=>Promise.resolve().then(() => (DT(),IT)).then((A)=>A.default),"send-commands":()=>Promise.resolve().then(() => (GT(),UT)).then((A)=>A.default)},async run({args:A}){if(process.argv.length>2)return;try{let{getClient:E}=await Promise.resolve().then(() => (CD(),Rj)),{getMeetAiConfig:I}=await Promise.resolve().then(() => (zN(),Kj)),{startDashboard:Q}=await Fb().then(() => Gb),g=E(),U=I();await Q(g,U,{debug:A.debug})}catch(E){uQ(E instanceof Error?E.message:String(E)),process.exit(1)}}});gq(Hr);
|