@builder.io/dev-tools 1.40.0 → 1.40.1-beta.202604062051.216bab5
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/cli/index.cjs +34 -34
- package/cli/index.cjs.map +3 -3
- package/core/index.cjs +1 -1
- package/core/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +1 -1
- package/server/index.cjs +3 -3
- package/server/index.mjs +3 -3
- package/types/tsconfig.tsbuildinfo +1 -1
package/cli/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var DLe=Object.create;var BD=Object.defineProperty;var wLe=Object.getOwnPropertyDescriptor;var bLe=Object.getOwnPropertyNames;var vLe=Object.getPrototypeOf,SLe=Object.prototype.hasOwnProperty;var N=(t,e)=>()=>(t&&(e=t(t=0)),e);var k=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lA=(t,e)=>{for(var r in e)BD(t,r,{get:e[r],enumerable:!0})},F5=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bLe(e))!SLe.call(t,i)&&i!==r&&BD(t,i,{get:()=>e[i],enumerable:!(n=wLe(e,i))||n.enumerable});return t};var z=(t,e,r)=>(r=t!=null?DLe(vLe(t)):{},F5(e||!t||!t.__esModule?BD(r,"default",{value:t,enumerable:!0}):r,t)),mn=t=>F5(BD({},"__esModule",{value:!0}),t);var m=N(()=>{(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"
|
|
1
|
+
var DLe=Object.create;var BD=Object.defineProperty;var wLe=Object.getOwnPropertyDescriptor;var bLe=Object.getOwnPropertyNames;var vLe=Object.getPrototypeOf,SLe=Object.prototype.hasOwnProperty;var N=(t,e)=>()=>(t&&(e=t(t=0)),e);var k=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lA=(t,e)=>{for(var r in e)BD(t,r,{get:e[r],enumerable:!0})},F5=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bLe(e))!SLe.call(t,i)&&i!==r&&BD(t,i,{get:()=>e[i],enumerable:!(n=wLe(e,i))||n.enumerable});return t};var z=(t,e,r)=>(r=t!=null?DLe(vLe(t)):{},F5(e||!t||!t.__esModule?BD(r,"default",{value:t,enumerable:!0}):r,t)),mn=t=>F5(BD({},"__esModule",{value:!0}),t);var m=N(()=>{(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"216bab54978df439c9dfc74333bff017c86172a1"}}catch{}})()});var R5=k((kRt,k5)=>{m();function YN(t){return t==null?[]:Array.isArray(t)?t:[t]}function xLe(t,e,r,n){var i,o=t[e],s=~n.string.indexOf(e)?r==null||r===!0?"":String(r):typeof r=="boolean"?r:~n.boolean.indexOf(e)?r==="false"?!1:r==="true"||(t._.push((i=+r,i*0===0?i:r)),!!r):(i=+r,i*0===0?i:r);t[e]=o==null?s:Array.isArray(o)?o.concat(s):[o,s]}k5.exports=function(t,e){t=t||[],e=e||{};var r,n,i,o,s,a={_:[]},A=0,c=0,u=0,l=t.length;let p=e.alias!==void 0,g=e.unknown!==void 0,d=e.default!==void 0;if(e.alias=e.alias||{},e.string=YN(e.string),e.boolean=YN(e.boolean),p)for(r in e.alias)for(n=e.alias[r]=YN(e.alias[r]),A=0;A<n.length;A++)(e.alias[n[A]]=n.concat(r)).splice(A,1);for(A=e.boolean.length;A-- >0;)for(n=e.alias[e.boolean[A]]||[],c=n.length;c-- >0;)e.boolean.push(n[c]);for(A=e.string.length;A-- >0;)for(n=e.alias[e.string[A]]||[],c=n.length;c-- >0;)e.string.push(n[c]);if(d){for(r in e.default)if(o=typeof e.default[r],n=e.alias[r]=e.alias[r]||[],e[o]!==void 0)for(e[o].push(r),A=0;A<n.length;A++)e[o].push(n[A])}let f=g?Object.keys(e.alias):[];for(A=0;A<l;A++){if(i=t[A],i==="--"){a._=a._.concat(t.slice(++A));break}for(c=0;c<i.length&&i.charCodeAt(c)===45;c++);if(c===0)a._.push(i);else if(i.substring(c,c+3)==="no-"){if(o=i.substring(c+3),g&&!~f.indexOf(o))return e.unknown(i);a[o]=!1}else{for(u=c+1;u<i.length&&i.charCodeAt(u)!==61;u++);for(o=i.substring(c,u),s=i.substring(++u)||A+1===l||(""+t[A+1]).charCodeAt(0)===45||t[++A],n=c===2?[o]:o,u=0;u<n.length;u++){if(o=n[u],g&&!~f.indexOf(o))return e.unknown("-".repeat(c)+o);xLe(a,o,u+1<n.length||s,e)}}}if(d)for(r in e.default)a[r]===void 0&&(a[r]=e.default[r]);if(p)for(r in a)for(n=e.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a}});function FLe(){if(MC!==void 0)return MC;try{return MC=require("prettier"),MC}catch{return MC=null,null}}function kLe(t){let e=[],r=bg.default.dirname(t);for(;r!==bg.default.dirname(r);){let n=bg.default.join(r,".prettierignore");qN.default.existsSync(n)&&e.push(n);let i=bg.default.join(r,".git");if(qN.default.existsSync(i))break;r=bg.default.dirname(r)}return e}function RLe(t){if(t)try{let r=(0,N5.createRequire)(t)("prettier");if(r)return r}catch{}return FLe()}async function bc(t,e,r,n){try{let i=bg.default.resolve(t,n??"file.tsx"),o=RLe(i);if(!o)return e;if(n){let A=kLe(i);if((await o.getFileInfo(i,{ignorePath:A.length>0?A:void 0})).ignored)return e}let s=await o.resolveConfig(i);return await o.format(e,{...s,filepath:n,parser:r})}catch{return e}}var N5,bg,qN,MC,VN=N(()=>{"use strict";m();N5=require("node:module"),bg=z(require("node:path"),1),qN=z(require("node:fs"),1)});var zN,Rd,yD,QD,T5,vg,WN,ZN,Sg,M5,Nd=N(()=>{"use strict";m();zN="preview-url",Rd="framework",yD="platform",QD="node",T5="/~builder-connect",vg="/~builder-connected",WN="/~builder-dev-tools",ZN="/~builder-dev-tools.js",Sg="/~builder-dev-tools-close",M5="/mappings"});var DD=k((_Rt,P5)=>{"use strict";m();var XN={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},NLe={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},TLe={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?XN.up():"");return t&&(e+=XN.left),e}};P5.exports={cursor:XN,scroll:NLe,erase:TLe,beep:"\x07"}});var Hr=k((URt,eT)=>{m();var bD=process||{},_5=bD.argv||[],wD=bD.env||{},MLe=!(wD.NO_COLOR||_5.includes("--no-color"))&&(!!wD.FORCE_COLOR||_5.includes("--color")||bD.platform==="win32"||(bD.stdout||{}).isTTY&&wD.TERM!=="dumb"||!!wD.CI),PLe=(t,e,r=t)=>n=>{let i=""+n,o=i.indexOf(e,t.length);return~o?t+_Le(i,e,r,o)+e:t+i+e},_Le=(t,e,r,n)=>{let i="",o=0;do i+=t.substring(o,n)+r,o=n+e.length,n=t.indexOf(e,o);while(~n);return i+t.substring(o)},L5=(t=MLe)=>{let e=t?PLe:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};eT.exports=L5();eT.exports.createColors=L5});function LLe({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}function V5(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(ULe,"")}function z5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function PC(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=V5(t),t.length===0))return 0;t=t.replace(HLe()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let o=i.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(GLe.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function jLe(){let t=new Map;for(let[e,r]of Object.entries(Xr)){for(let[n,i]of Object.entries(r))Xr[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=Xr[n],t.set(i[0],i[1]);Object.defineProperty(Xr,e,{value:r,enumerable:!1})}return Object.defineProperty(Xr,"codes",{value:t,enumerable:!1}),Xr.color.close="\x1B[39m",Xr.bgColor.close="\x1B[49m",Xr.color.ansi=U5(),Xr.color.ansi256=O5(),Xr.color.ansi16m=G5(),Xr.bgColor.ansi=U5(tT),Xr.bgColor.ansi256=O5(tT),Xr.bgColor.ansi16m=G5(tT),Object.defineProperties(Xr,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>Xr.rgbToAnsi256(...Xr.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>Xr.ansi256ToAnsi(Xr.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Xr.ansi256ToAnsi(Xr.hexToAnsi256(e)),enumerable:!1}}),Xr}function $5(t,e,r){return String(t).normalize().replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`).map(n=>ZLe(n,e,r)).join(`
|
|
4
4
|
`)}function aT(t,e){if(typeof t=="string")return SD.aliases.get(t)===e;for(let r of t)if(r!==void 0&&aT(r,e))return!0;return!1}function eUe(t,e){if(t===e)return;let r=t.split(`
|
|
@@ -73,7 +73,7 @@ ${iV}${n.trimStart()}`),r=3+(0,xg.stripVTControlCharacters)(n.trimStart()).lengt
|
|
|
73
73
|
`),d(),i()};return{start:I,stop:B,message:(E="")=>{a=h(E??a)}}}});function sr(t,e=""){return t.ts.createSourceFile("module.tsx",typeof e=="string"?e:"",t.ts.ScriptTarget.Latest,void 0)}function MD(t,e=""){let r=sr(t,e?.trim());if(r.statements.length===0)throw new Error(`No statements found in code: ${e}`);return r.statements[0]}function ii(t,e,r){if(e){let n=t.ts.createPrinter({newLine:t.ts.NewLineKind.LineFeed,removeComments:r});return t.ts.isSourceFile(e)?n.printFile(e).trim()+`
|
|
74
74
|
`:n.printNode(t.ts.EmitHint.Unspecified,e,t.ts.createSourceFile("module.tsx","",t.ts.ScriptTarget.Latest)).trim()+`
|
|
75
75
|
`}return""}var ln=N(()=>{"use strict";m()});var gV=k((tNt,lV)=>{"use strict";m();lV.exports=function(){if(process.env.npm_config_user_agent)return hUe(process.env.npm_config_user_agent)};function hUe(t){let e=t.split(" ")[0],r=e.lastIndexOf("/"),n=e.substring(0,r);return{name:n==="npminstall"?"cnpm":n,version:e.substring(r+1)}}});function Ds(t){return t.endsWith(".mapper.tsx")||t.endsWith(".mapper.jsx")||t.endsWith(".mapper.ts")||t.endsWith(".mapper.js")||t.endsWith(".mapper.mjs")}function ar(t,e,r){e=Ia(e),r=Ia(r),e=t.dirname(e);let n=t.basename(r,t.extname(r));r=t.dirname(r);let i;return n==="index"?i=t.relative(e,r):i=t.relative(e,t.join(r,n)),i=Ia(t.normalize(i)),i.startsWith(".")||(i="./"+i),i}function Ia(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}function kg(t,e){let r=t.extname(e),n=t.basename(e,r).split(/[\/\\]/),i=n[n.length-1];return pV(i==="index"?t.basename(t.dirname(e)):i)}function pV(t){return _r(t).replace(/ /g,"")}function ws(t,e){let r=t.extname(e),n=Ia(t.basename(e,r)).split("/").pop();return _r(n==="index"?t.basename(t.dirname(e)):n)}function Lr(t,e){let r=Ia(t.relative(t.getAppRootDir(),e));r=r.split("/").filter(i=>i!=="."&&i!==".."&&i!=="").join("/"),r.endsWith(".tsx")||r.endsWith(".jsx")?r=r.slice(0,-4):(r.endsWith(".ts")||r.endsWith(".js"))&&(r=r.slice(0,-3));let n=t.getFrameworks();return r.startsWith("src/")&&(r=r.slice(4)),n.some(i=>i.name.includes("next"))?"@/"+r:"~/"+r}function hr(t,e){let r=e,n=[];for(let i=0;i<2;i++){let o=t.basename(r);if(!o||o==="components")break;n.unshift(o),r=t.dirname(r)}return n.join("/")}function _r(t){for(t=t.replace(/([A-Z])/g," $1").replace(/\./g," ").replace(/_/g," ").replace(/-/g," ").replace(/\s/g," ").trim();t.includes(" ");)t=t.replace(/ /g," ");return t.split(" ").map(e=>e.length>2?e[0].toUpperCase()+e.slice(1):e).join("").trim()}function xo(t){return t.sort((e,r)=>e.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function Fr(t,e,r,n){if(typeof r!="string"||r==="")throw new Error(`getComponentId(), exportName must be a non-empty string, received: ${r}, ${e}`);return n&&(e=n),e=t.normalize(e),(await t.hash(e+"#"+r)).substring(0,8)}async function fV(t){return(await t.hash(t.getAppRootDir())).substring(0,8)}function LC(t){return typeof t=="number"}function _d(t){return typeof t=="boolean"}function io(t){return typeof t=="string"}function Ld(t){return typeof t=="string"?/^[A-Z][A-Za-z0-9]*$/.test(t):!1}function Xo(t){return JSON.parse(JSON.stringify(t))}function PD(t,e,r){for(let n of e)if(t.dirname(r).includes(n))return!0;return!1}function mV(){try{let t=(0,dV.default)();if(t?.name)return t.name}catch{}return"npm"}function CUe(){return process.platform.startsWith("win")}function Cr(){return process.pkg?"@builder.io/agent":CUe()?'"@builder.io/dev-tools"':"builder.io"}function pT(t){return t.replace(/[^a-zA-Z0-9-_]/g,"_")}var dV,tr=N(()=>{"use strict";m();dV=z(gV(),1)});function oo(t){let e=t.join(t.getAppRootDir(),"tsconfig.json");return t.exists(e)}async function Fo(t,e){async function r(i,o){if(o>10)return;let s=await t.readdir(i);for(let a of s){if(IUe.includes(a))continue;let A=t.join(i,a),c=await t.stat(A);if(c){if(c.isFile()&&a.startsWith("builder-registry."))return A;if(c.isDirectory()){let u=await r(A,o+1);if(u)return u}}}}let n=await r(t.getAppRootDir(),0);if(!n){let o=`builder-registry.${await oo(t)?"ts":"js"}`;return t.join(e,o)}return n}async function Ea(t,e){let r=t.resolve("/");for(let n=0;n<20;n++){let i=t.join(e,"package.json"),o=await t.readFile(i);if(o)return JSON.parse(o);if(e===r)break;e=t.dirname(e)}return null}async function hV(t,e){for(let r=0;r<20;r++){let n=t.dirname(e),i=t.join(n,"node_modules");if(await t.exists(i))return i;if(e===t.getAppRootDir())break;e=t.dirname(e)}return t.join(t.getAppRootDir(),"node_modules")}async function UC(t,e,r){let n=await t.readdir(e);return n.includes(r)?t.join(e,r):(await Promise.all(n.map(async o=>{if(o.startsWith(".")||o==="node_modules")return;let s=t.join(e,o);if((await t.stat(s)).isDirectory()){let A=await UC(t,s,r);if(A)return A}}))).find(o=>typeof o=="string")}var IUe,Ki=N(()=>{"use strict";m();IUe=["node_modules","dist","build","public"]});async function Hn(t,e,r){if(!Array.isArray(e)||e.length===0)throw new Error(`createTsProgram() Invalid filePaths: ${e}`);let n=await hV(t,e[0]),i=t.join(n,"typescript","lib"),o=new Map,s={fileExists:a=>{if(a=t.normalize(a),a.includes("node_modules")){let A=OC.get(a);if(!A){try{t.statSync(a).isFile()?A={exists:!0,content:t.readFileSync(a)}:A={exists:!1}}catch{A={exists:!1}}OC.set(a,A)}return A.exists}if(!o.has(a))if(t.existsSync(a)){let c=t.statSync(a);o.set(a,c.isFile())}else o.set(a,!1);return o.get(a)},getCanonicalFileName:a=>t.normalize(a),getCurrentDirectory:()=>t.cwd(),getDefaultLibFileName:()=>t.join(i,"lib.d.ts"),getDefaultLibLocation:()=>i,getNewLine:()=>`
|
|
76
|
-
`,getSourceFile:a=>{if(a=t.normalize(a),a.includes("node_modules")){let c=OC.get(a);if(c)return sr(t,c.content)}let A;try{A=t.readFileSync(a)}catch{console.error(`Could not read: ${a}`),A==null}if(A==null){let c=t.basename(a),u=t.extname(c).toLowerCase();if(a.startsWith(i)&&u===".ts"&&(A=IV.get(c),A==null&&typeof self<"u"&&typeof fetch=="function"))throw new LD(c)}return a.includes("node_modules")&&(A?OC.set(a,{exists:!0,content:A}):OC.set(a,{exists:!1})),sr(t,A)},readFile:a=>{let A=t.readFileSync(a);return typeof A=="string"?A:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return EUe(t,s,e,r)}catch(a){if(a instanceof LD){await BUe(t,a.libName);continue}throw t.Sentry?.captureException(a),new Error(`createTsProgram() Could not create program for: ${e[0]}`,{cause:a})}}function EUe(t,e,r,n){let i={rootNames:[...r],host:e,options:{}},o=t.ts.findConfigFile(t.dirname(r[0]),s=>t.existsSync(s));if(o){let s=CV.get(o);if(!s){let a=t.ts.readConfigFile(o,A=>{let c=t.readFileSync(A);return typeof c=="string"?c:void 0});a.error?t.Sentry?.captureException(new Error("Error reading tsconfig for createTsProgram"),{extra:{error:a.error,tsConfigPath:o}}):(s=t.ts.parseJsonConfigFileContent(a.config,t.ts.sys||{useCaseSensitiveFileNames:!1,readDirectory:(c,u)=>t.readdirSync(c),fileExists:c=>t.existsSync(c),readFile:c=>t.readFileSync(c)||void 0},t.dirname(o),void 0,o).options,CV.set(o,s))}s&&(i.options=Xo(s))}return i.options.noEmit=!0,i.options.isolatedModules=!1,i.options.strict=!1,i.options.jsx=t.ts.JsxEmit.Preserve,i.options.allowJs=!0,Object.assign(i.options,n),t.ts.createProgram(i)}async function Ud(t,e,r){r||(r=await Hn(t,[e]));let n=r.getSourceFile(e);if(!n)throw new Error(`getTypeChecker() Could not find source file: ${e}`);return{typeChecker:r.getTypeChecker(),sourceFile:n}}async function BUe(t,e){let r=`https://cdn.jsdelivr.net/npm/typescript@${t.ts.version}/lib/${e}`;_D.has(e)||_D.set(e,fetch(r).then(n=>n.text()).then(n=>{IV.set(e,n)})),await _D.get(e),_D.delete(e)}async function EV(t,e){let r=await t.readFile(e.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${e.filePath}`}],code:null,output:null}:dT(t,{code:r,filePath:e.filePath,compilerOptions:e.compilerOptions})}function dT(t,e){let r={diagnostics:[],code:e.code,output:null};try{let n=t.ts.transpileModule(e.code,{compilerOptions:e.compilerOptions,fileName:e.filePath??"module.tsx",reportDiagnostics:!0});n.diagnostics?.forEach(i=>{r.diagnostics.push({messageText:String(i.messageText)})}),r.output=n.outputText}catch(n){console.error("transpileModule",n),r.diagnostics.push({messageText:String(n)})}return r}var LD,IV,_D,OC,CV,bs=N(()=>{"use strict";m();ln();tr();Ki();LD=class{libName;constructor(e){this.libName=e}};IV=new Map,_D=new Map,OC=new Map,CV=new Map});var yUe,vt,Pn=N(()=>{"use strict";m();yUe="1.40.
|
|
76
|
+
`,getSourceFile:a=>{if(a=t.normalize(a),a.includes("node_modules")){let c=OC.get(a);if(c)return sr(t,c.content)}let A;try{A=t.readFileSync(a)}catch{console.error(`Could not read: ${a}`),A==null}if(A==null){let c=t.basename(a),u=t.extname(c).toLowerCase();if(a.startsWith(i)&&u===".ts"&&(A=IV.get(c),A==null&&typeof self<"u"&&typeof fetch=="function"))throw new LD(c)}return a.includes("node_modules")&&(A?OC.set(a,{exists:!0,content:A}):OC.set(a,{exists:!1})),sr(t,A)},readFile:a=>{let A=t.readFileSync(a);return typeof A=="string"?A:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return EUe(t,s,e,r)}catch(a){if(a instanceof LD){await BUe(t,a.libName);continue}throw t.Sentry?.captureException(a),new Error(`createTsProgram() Could not create program for: ${e[0]}`,{cause:a})}}function EUe(t,e,r,n){let i={rootNames:[...r],host:e,options:{}},o=t.ts.findConfigFile(t.dirname(r[0]),s=>t.existsSync(s));if(o){let s=CV.get(o);if(!s){let a=t.ts.readConfigFile(o,A=>{let c=t.readFileSync(A);return typeof c=="string"?c:void 0});a.error?t.Sentry?.captureException(new Error("Error reading tsconfig for createTsProgram"),{extra:{error:a.error,tsConfigPath:o}}):(s=t.ts.parseJsonConfigFileContent(a.config,t.ts.sys||{useCaseSensitiveFileNames:!1,readDirectory:(c,u)=>t.readdirSync(c),fileExists:c=>t.existsSync(c),readFile:c=>t.readFileSync(c)||void 0},t.dirname(o),void 0,o).options,CV.set(o,s))}s&&(i.options=Xo(s))}return i.options.noEmit=!0,i.options.isolatedModules=!1,i.options.strict=!1,i.options.jsx=t.ts.JsxEmit.Preserve,i.options.allowJs=!0,Object.assign(i.options,n),t.ts.createProgram(i)}async function Ud(t,e,r){r||(r=await Hn(t,[e]));let n=r.getSourceFile(e);if(!n)throw new Error(`getTypeChecker() Could not find source file: ${e}`);return{typeChecker:r.getTypeChecker(),sourceFile:n}}async function BUe(t,e){let r=`https://cdn.jsdelivr.net/npm/typescript@${t.ts.version}/lib/${e}`;_D.has(e)||_D.set(e,fetch(r).then(n=>n.text()).then(n=>{IV.set(e,n)})),await _D.get(e),_D.delete(e)}async function EV(t,e){let r=await t.readFile(e.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${e.filePath}`}],code:null,output:null}:dT(t,{code:r,filePath:e.filePath,compilerOptions:e.compilerOptions})}function dT(t,e){let r={diagnostics:[],code:e.code,output:null};try{let n=t.ts.transpileModule(e.code,{compilerOptions:e.compilerOptions,fileName:e.filePath??"module.tsx",reportDiagnostics:!0});n.diagnostics?.forEach(i=>{r.diagnostics.push({messageText:String(i.messageText)})}),r.output=n.outputText}catch(n){console.error("transpileModule",n),r.diagnostics.push({messageText:String(n)})}return r}var LD,IV,_D,OC,CV,bs=N(()=>{"use strict";m();ln();tr();Ki();LD=class{libName;constructor(e){this.libName=e}};IV=new Map,_D=new Map,OC=new Map,CV=new Map});var yUe,vt,Pn=N(()=>{"use strict";m();yUe="1.40.1-beta.202604062051.216bab5",vt=process.env.OVERRIDE_VERSION??yUe});async function Rg(t){let e=[],r=await Ea(t,t.getRepoRootDir());if(r){let n=await yV(r,t);e.push(...n)}return e}async function yV(t,e){let r=[];if(t&&typeof t=="object"){let n=new Set(Object.keys({...t.dependencies,...t.devDependencies}));for(let i of QUe)if(n.has(i)&&!r.some(o=>o.name===i)){let o={name:i};BV.has(i)&&(o.version=await BV.get(i)(e)),r.push(o)}}return r}function fT(t){let e=parseInt(t);return Number.isNaN(e)?void 0:e}var BV,QUe,Ng=N(()=>{"use strict";m();Ki();tr();BV=new Map([["next",async t=>{if(!t.spawnSync)return;let e=mV(),r=e==="npm"?"npx":e,{stdout:n}=t.spawnSync(r,["next","-v"],{encoding:"utf8"});if(!n)return;let i=n.match(/(Next.js v)([\d.]+)/g);if(!i)return;let o=i[0].split("Next.js v")[1],[s,a,A]=o.split(".");return{major:fT(s),minor:fT(a),patch:fT(A)}}]]),QUe=["@shopify/remix-oxygen","@shopify/hydrogen","@builder.io/qwik-city","@remix-run/react","@sveltejs/kit","astro","gatsby","next","nuxt","@builder.io/qwik","@angular/core","react","solid-js","svelte","vue"]});async function vs(t){let e=QV(t),r=await t.readFile(e);return typeof r=="string"?JSON.parse(r):{}}async function Ss(t,e){e=typeof e=="object"&&e!=null?e:{};let r=QV(t);await t.writeFile(r,JSON.stringify(e??{},null,2))}function QV(t){let e=t.getAppRootDir();return t.join(e,"node_modules",".builder","builder-cache.json")}var Tg=N(()=>{"use strict";m()});async function gA(t,e,r){let n={envKey:r,envValue:null,file:""};for(let i of e){let o=t.join(t.getAppRootDir(),i),s=await DUe(t,o);if(s){let a=s[r];if(typeof a=="string"&&a.length>0&&a!=="YOUR_API_KEY")return n.envValue=a,n.file=o,n}}return n.file=t.join(t.getAppRootDir(),e[e.length-1]),n}async function DUe(t,e){let r=await t.readFile(e);return typeof r=="string"?DV(r):null}function DV(t){let e={},r=t.replace(/\r\n?/gm,`
|
|
77
77
|
`),n;for(;(n=wUe.exec(r))!=null;){let i=n[1],o=n[2]||"";o=o.trim();let s=o[0];o=o.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),s==='"'&&(o=o.replace(/\\n/g,`
|
|
78
78
|
`),o=o.replace(/\\r/g,"\r")),e[i]=o}return e}async function pA(t,e,r,n){let i="# https://www.builder.io/c/docs/using-your-api-key",o=await t.readFile(e);try{if(o)if(o.includes(r))if(o.includes(n))t.debug(`"${r}" with "${n}" already set in ${e}`);else return t.debug(`Replace "${r}" in ${e}`),o=o.replace(new RegExp(`${r}=.*`),`${r}=${n}`),await t.writeFile(e,o),"update";else return t.debug(`Append "${r}" to ${e}`),o+=`
|
|
79
79
|
|
|
@@ -1107,7 +1107,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),O=Y,J=W),K===void 0&&(
|
|
|
1107
1107
|
`:`
|
|
1108
1108
|
`)+r,i=n+1,n=t.indexOf(`
|
|
1109
1109
|
`,i)}while(n!==-1);return o+=t.slice(i),o}var GX=N(()=>{m()});function pI(t){return JX(t)}var KX,HX,NM,sf,gI,$X,af,Q4e,Dw,JX,TM,D4e,w4e,MM,ww,b4e,_8t,L8t,jX=N(()=>{m();TX();LX();GX();({stdout:KX,stderr:HX}=_X),NM=Symbol("GENERATOR"),sf=Symbol("STYLER"),gI=Symbol("IS_EMPTY"),$X=["ansi","ansi","ansi256","ansi16m"],af=Object.create(null),Q4e=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=KX?KX.level:0;t.level=e.level===void 0?r:e.level},Dw=class{constructor(e){return JX(e)}},JX=t=>{let e=(...r)=>r.join(" ");return Q4e(e,t),Object.setPrototypeOf(e,pI.prototype),e};Object.setPrototypeOf(pI.prototype,Function.prototype);for(let[t,e]of Object.entries(wa))af[t]={get(){let r=ww(this,MM(e.open,e.close,this[sf]),this[gI]);return Object.defineProperty(this,t,{value:r}),r}};af.visible={get(){let t=ww(this,this[sf],!0);return Object.defineProperty(this,"visible",{value:t}),t}};TM=(t,e,r,...n)=>t==="rgb"?e==="ansi16m"?wa[r].ansi16m(...n):e==="ansi256"?wa[r].ansi256(wa.rgbToAnsi256(...n)):wa[r].ansi(wa.rgbToAnsi(...n)):t==="hex"?TM("rgb",e,r,...wa.hexToRgb(...n)):wa[r][t](...n),D4e=["rgb","hex","ansi256"];for(let t of D4e){af[t]={get(){let{level:r}=this;return function(...n){let i=MM(TM(t,$X[r],"color",...n),wa.color.close,this[sf]);return ww(this,i,this[gI])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);af[e]={get(){let{level:r}=this;return function(...n){let i=MM(TM(t,$X[r],"bgColor",...n),wa.bgColor.close,this[sf]);return ww(this,i,this[gI])}}}}w4e=Object.defineProperties(()=>{},{...af,level:{enumerable:!0,get(){return this[NM].level},set(t){this[NM].level=t}}}),MM=(t,e,r)=>{let n,i;return r===void 0?(n=t,i=e):(n=r.openAll+t,i=e+r.closeAll),{open:t,close:e,openAll:n,closeAll:i,parent:r}},ww=(t,e,r)=>{let n=(...i)=>b4e(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,w4e),n[NM]=t,n[sf]=e,n[gI]=r,n},b4e=(t,e)=>{if(t.level<=0||!e)return t[gI]?"":e;let r=t[sf];if(r===void 0)return e;let{openAll:n,closeAll:i}=r;if(e.includes("\x1B"))for(;r!==void 0;)e=UX(e,r.close,r.open),r=r.parent;let o=e.indexOf(`
|
|
1110
|
-
`);return o!==-1&&(e=OX(e,i,n,o)),n+e+i};Object.defineProperties(pI.prototype,af);_8t=pI(),L8t=pI({level:HX?HX.level:0})});function _M(t){let e=FM(t);return{highlight:r,highlightAuto:n,listLanguages:e.listLanguages,register:e.register,registerAlias:e.registerAlias,registered:e.registered};function r(i,o,s){let a=e.highlight(i,o),A=a.data;return{language:A.language,relevance:A.relevance,value:PM(s||YX,a)}}function n(i,o){let s,a;if(o&&("subset"in o||"sheet"in o)){let u=o;a={subset:u.subset},s=u.sheet}else s=o;let A=e.highlightAuto(i,a),c=A.data;return{language:c.language,relevance:c.relevance,value:PM(s||YX,A)}}}function PM(t,e){let r=new Set(e.type==="element"&&Array.isArray(e.properties.className)?e.properties.className.map(function(a){return String(a).replace(/^hljs-/,"")}):[]),n={},i,o="",s;for(s in t)if(Object.hasOwn(t,s)){let a=s.split(" "),A=t[s];r.has(a[0])?a.length===1?i=A:n[a.slice(1).join(" ")]=A:n[s]=A}return"value"in e?o=e.value:"children"in e&&(o=v4e(n,e.children)),i&&(o=i(o)),o}function v4e(t,e){let r=[],n=-1;for(;++n<e.length;)r.push(PM(t,e[n]));return r.join("")}var rr,YX,qX=N(()=>{m();jX();kM();rr=new Dw({level:2}),YX={comment:rr.gray,quote:rr.gray,keyword:rr.green,"selector-tag":rr.green,addition:rr.green,number:rr.cyan,string:rr.cyan,"meta meta-string":rr.cyan,literal:rr.cyan,doctag:rr.cyan,regexp:rr.cyan,title:rr.blue,section:rr.blue,name:rr.blue,"selector-id":rr.blue,"selector-class":rr.blue,attribute:rr.yellow,attr:rr.yellow,variable:rr.yellow,"template-variable":rr.yellow,"class title":rr.yellow,type:rr.yellow,symbol:rr.magenta,bullet:rr.magenta,subst:rr.magenta,meta:rr.magenta,"meta keyword":rr.magenta,"selector-attr":rr.magenta,"selector-pseudo":rr.magenta,link:rr.magenta,built_in:rr.red,deletion:rr.red,emphasis:rr.italic,strong:rr.bold,formula:rr.inverse}});var VX=N(()=>{m();kM();qX()});async function Le(t){if(process.env.NODE_ENV!=="test")try{let e=process.env.BUILDER_DISABLE_AMPLITUDE==="true",r=[zX.flush(2e3)];e||r.push(WX.flush().promise),await Promise.allSettled(r)}catch(e){S4e.error(e)}process.exit(t)}var zX,WX,S4e,ba=N(()=>{"use strict";m();zX=z(require("@sentry/node"),1),WX=z(require("@amplitude/analytics-node"),1);Pt();S4e=ke("Exit")});var Oe,gn=N(()=>{"use strict";m();Oe=process.env.AIR_HOST||process.env.BUILDER_HOST||"https://api.builder.io"});var XX,ZX=N(()=>{XX="1.40.
|
|
1110
|
+
`);return o!==-1&&(e=OX(e,i,n,o)),n+e+i};Object.defineProperties(pI.prototype,af);_8t=pI(),L8t=pI({level:HX?HX.level:0})});function _M(t){let e=FM(t);return{highlight:r,highlightAuto:n,listLanguages:e.listLanguages,register:e.register,registerAlias:e.registerAlias,registered:e.registered};function r(i,o,s){let a=e.highlight(i,o),A=a.data;return{language:A.language,relevance:A.relevance,value:PM(s||YX,a)}}function n(i,o){let s,a;if(o&&("subset"in o||"sheet"in o)){let u=o;a={subset:u.subset},s=u.sheet}else s=o;let A=e.highlightAuto(i,a),c=A.data;return{language:c.language,relevance:c.relevance,value:PM(s||YX,A)}}}function PM(t,e){let r=new Set(e.type==="element"&&Array.isArray(e.properties.className)?e.properties.className.map(function(a){return String(a).replace(/^hljs-/,"")}):[]),n={},i,o="",s;for(s in t)if(Object.hasOwn(t,s)){let a=s.split(" "),A=t[s];r.has(a[0])?a.length===1?i=A:n[a.slice(1).join(" ")]=A:n[s]=A}return"value"in e?o=e.value:"children"in e&&(o=v4e(n,e.children)),i&&(o=i(o)),o}function v4e(t,e){let r=[],n=-1;for(;++n<e.length;)r.push(PM(t,e[n]));return r.join("")}var rr,YX,qX=N(()=>{m();jX();kM();rr=new Dw({level:2}),YX={comment:rr.gray,quote:rr.gray,keyword:rr.green,"selector-tag":rr.green,addition:rr.green,number:rr.cyan,string:rr.cyan,"meta meta-string":rr.cyan,literal:rr.cyan,doctag:rr.cyan,regexp:rr.cyan,title:rr.blue,section:rr.blue,name:rr.blue,"selector-id":rr.blue,"selector-class":rr.blue,attribute:rr.yellow,attr:rr.yellow,variable:rr.yellow,"template-variable":rr.yellow,"class title":rr.yellow,type:rr.yellow,symbol:rr.magenta,bullet:rr.magenta,subst:rr.magenta,meta:rr.magenta,"meta keyword":rr.magenta,"selector-attr":rr.magenta,"selector-pseudo":rr.magenta,link:rr.magenta,built_in:rr.red,deletion:rr.red,emphasis:rr.italic,strong:rr.bold,formula:rr.inverse}});var VX=N(()=>{m();kM();qX()});async function Le(t){if(process.env.NODE_ENV!=="test")try{let e=process.env.BUILDER_DISABLE_AMPLITUDE==="true",r=[zX.flush(2e3)];e||r.push(WX.flush().promise),await Promise.allSettled(r)}catch(e){S4e.error(e)}process.exit(t)}var zX,WX,S4e,ba=N(()=>{"use strict";m();zX=z(require("@sentry/node"),1),WX=z(require("@amplitude/analytics-node"),1);Pt();S4e=ke("Exit")});var Oe,gn=N(()=>{"use strict";m();Oe=process.env.AIR_HOST||process.env.BUILDER_HOST||"https://api.builder.io"});var XX,ZX=N(()=>{XX="1.40.1"});var xee=k(QI=>{"use strict";m();Object.defineProperty(QI,"__esModule",{value:!0});function F4e(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}var kA=class{constructor(e,r,n){this.line=void 0,this.column=void 0,this.index=void 0,this.line=e,this.column=r,this.index=n}},lf=class{constructor(e,r){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=e,this.end=r}};function co(t,e){let{line:r,column:n,index:i}=t;return new kA(r,n+e,i+e)}var eee="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",k4e={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:eee},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:eee}},tee={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},Sw=t=>t.type==="UpdateExpression"?tee.UpdateExpression[`${t.prefix}`]:tee[t.type],R4e={AccessorIsGenerator:({kind:t})=>`A ${t}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:t})=>`Missing initializer in ${t} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:t})=>`\`${t}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:t,exportName:e})=>`A string literal cannot be used as an exported binding without \`from\`.
|
|
1111
1111
|
- Did you mean \`export { '${t}' as '${e}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:t})=>`'${t==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:t})=>`Unsyntactic ${t==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:t})=>`A string literal cannot be used as an imported binding.
|
|
1112
1112
|
- Did you mean \`import { "${t}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:t})=>`Expected number in radix ${t}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:t})=>`Escape sequence in keyword ${t}.`,InvalidIdentifier:({identifierName:t})=>`Invalid identifier ${t}.`,InvalidLhs:({ancestor:t})=>`Invalid left-hand side in ${Sw(t)}.`,InvalidLhsBinding:({ancestor:t})=>`Binding invalid left-hand side in ${Sw(t)}.`,InvalidLhsOptionalChaining:({ancestor:t})=>`Invalid optional chaining in the left-hand side of ${Sw(t)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:t})=>`Unexpected character '${t}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:t})=>`Private name #${t} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:t})=>`Label '${t}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:t})=>`This experimental syntax requires enabling the parser plugin: ${t.map(e=>JSON.stringify(e)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:t})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${t.map(e=>JSON.stringify(e)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:t})=>`Duplicate key "${t}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:t})=>`An export name cannot include a lone surrogate, found '\\u${t.toString(16)}'.`,ModuleExportUndefined:({localName:t})=>`Export '${t}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:t})=>`Private names are only allowed in property accesses (\`obj.#${t}\`) or in \`in\` expressions (\`#${t} in obj\`).`,PrivateNameRedeclaration:({identifierName:t})=>`Duplicate private name #${t}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:t})=>`Unexpected keyword '${t}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:t})=>`Unexpected reserved word '${t}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:t,unexpected:e})=>`Unexpected token${e?` '${e}'.`:""}${t?`, expected "${t}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:t,onlyValidPropertyName:e})=>`The only valid meta property for ${t} is ${t}.${e}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:t})=>`Identifier '${t}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},N4e={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:t})=>`Assigning to '${t}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:t})=>`Binding '${t}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},T4e={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:t})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(t)}\`.`},M4e=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),P4e=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:t})=>`Invalid topic token ${t}. In order to use ${t} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${t}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:t})=>`Hack-style pipe body cannot be an unparenthesized ${Sw({type:t})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'}),_4e=["message"];function ree(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!0,value:r})}function L4e({toMessage:t,code:e,reasonCode:r,syntaxPlugin:n}){let i=r==="MissingPlugin"||r==="MissingOneOfPlugins",o={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};return o[r]&&(r=o[r]),function s(a,A){let c=new SyntaxError;return c.code=e,c.reasonCode=r,c.loc=a,c.pos=a.index,c.syntaxPlugin=n,i&&(c.missingPlugin=A.missingPlugin),ree(c,"clone",function(l={}){var p;let{line:g,column:d,index:f}=(p=l.loc)!=null?p:a;return s(new kA(g,d,f),Object.assign({},A,l.details))}),ree(c,"details",A),Object.defineProperty(c,"message",{configurable:!0,get(){let u=`${t(A)} (${a.line}:${a.column})`;return this.message=u,u},set(u){Object.defineProperty(this,"message",{value:u,writable:!0})}}),c}}function xA(t,e){if(Array.isArray(t))return n=>xA(n,t[0]);let r={};for(let n of Object.keys(t)){let i=t[n],o=typeof i=="string"?{message:()=>i}:typeof i=="function"?{message:i}:i,{message:s}=o,a=F4e(o,_4e),A=typeof s=="string"?()=>s:s;r[n]=L4e(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:n,toMessage:A},e?{syntaxPlugin:e}:{},a))}return r}var q=Object.assign({},xA(k4e),xA(R4e),xA(N4e),xA(T4e),xA`pipelineOperator`(P4e));function U4e(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function O4e(t){let e=U4e();if(t==null)return e;if(t.annexB!=null&&t.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(let r of Object.keys(e))t[r]!=null&&(e[r]=t[r]);if(e.startLine===1)t.startIndex==null&&e.startColumn>0?e.startIndex=e.startColumn:t.startColumn==null&&e.startIndex>0&&(e.startColumn=e.startIndex);else if((t.startColumn==null||t.startIndex==null)&&t.startIndex!=null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(e.sourceType==="commonjs"){if(t.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(t.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(t.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return e}var{defineProperty:G4e}=Object,nee=(t,e)=>{t&&G4e(t,e,{enumerable:!1,value:t[e]})};function dI(t){return nee(t.loc.start,"index"),nee(t.loc.end,"index"),t}var K4e=t=>class extends t{parse(){let r=dI(super.parse());return this.optionFlags&256&&(r.tokens=r.tokens.map(dI)),r}parseRegExpLiteral({pattern:r,flags:n}){let i=null;try{i=new RegExp(r,n)}catch{}let o=this.estreeParseLiteral(i);return o.regex={pattern:r,flags:n},o}parseBigIntLiteral(r){let n;try{n=BigInt(r)}catch{n=null}let i=this.estreeParseLiteral(n);return i.bigint=String(i.value||r),i}parseDecimalLiteral(r){let i=this.estreeParseLiteral(null);return i.decimal=String(i.value||r),i}estreeParseLiteral(r){return this.parseLiteral(r,"Literal")}parseStringLiteral(r){return this.estreeParseLiteral(r)}parseNumericLiteral(r){return this.estreeParseLiteral(r)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(r){return this.estreeParseLiteral(r)}estreeParseChainExpression(r,n){let i=this.startNodeAtNode(r);return i.expression=r,this.finishNodeAt(i,"ChainExpression",n)}directiveToStmt(r){let n=r.value;delete r.value,this.castNodeTo(n,"Literal"),n.raw=n.extra.raw,n.value=n.extra.expressionValue;let i=this.castNodeTo(r,"ExpressionStatement");return i.expression=n,i.directive=n.extra.rawValue,delete n.extra,i}fillOptionalPropertiesForTSESLint(r){}cloneEstreeStringLiteral(r){let{start:n,end:i,loc:o,range:s,raw:a,value:A}=r,c=Object.create(r.constructor.prototype);return c.type="Literal",c.start=n,c.end=i,c.loc=o,c.range=s,c.raw=a,c.value=A,c}initFunction(r,n){super.initFunction(r,n),r.expression=!1}checkDeclaration(r){r!=null&&this.isObjectProperty(r)?this.checkDeclaration(r.value):super.checkDeclaration(r)}getObjectOrClassMethodParams(r){return r.value.params}isValidDirective(r){var n;return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&typeof r.expression.value=="string"&&!((n=r.expression.extra)!=null&&n.parenthesized)}parseBlockBody(r,n,i,o,s){super.parseBlockBody(r,n,i,o,s);let a=r.directives.map(A=>this.directiveToStmt(A));r.body=a.concat(r.body),delete r.directives}parsePrivateName(){let r=super.parsePrivateName();return this.getPluginOption("estree","classFeatures")?this.convertPrivateNameToPrivateIdentifier(r):r}convertPrivateNameToPrivateIdentifier(r){let n=super.getPrivateNameSV(r);return delete r.id,r.name=n,this.castNodeTo(r,"PrivateIdentifier")}isPrivateName(r){return this.getPluginOption("estree","classFeatures")?r.type==="PrivateIdentifier":super.isPrivateName(r)}getPrivateNameSV(r){return this.getPluginOption("estree","classFeatures")?r.name:super.getPrivateNameSV(r)}parseLiteral(r,n){let i=super.parseLiteral(r,n);return i.raw=i.extra.raw,delete i.extra,i}parseFunctionBody(r,n,i=!1){super.parseFunctionBody(r,n,i),r.expression=r.body.type!=="BlockStatement"}parseMethod(r,n,i,o,s,a,A=!1){let c=this.startNode();c.kind=r.kind,c=super.parseMethod(c,n,i,o,s,a,A),delete c.kind;let{typeParameters:u}=r;u&&(delete r.typeParameters,c.typeParameters=u,this.resetStartLocationFromNode(c,u));let l=this.castNodeTo(c,"FunctionExpression");return r.value=l,a==="ClassPrivateMethod"&&(r.computed=!1),a==="ObjectMethod"?(r.kind==="method"&&(r.kind="init"),r.shorthand=!1,this.finishNode(r,"Property")):this.finishNode(r,"MethodDefinition")}nameIsConstructor(r){return r.type==="Literal"?r.value==="constructor":super.nameIsConstructor(r)}parseClassProperty(...r){let n=super.parseClassProperty(...r);return this.getPluginOption("estree","classFeatures")&&this.castNodeTo(n,"PropertyDefinition"),n}parseClassPrivateProperty(...r){let n=super.parseClassPrivateProperty(...r);return this.getPluginOption("estree","classFeatures")&&(this.castNodeTo(n,"PropertyDefinition"),n.computed=!1),n}parseClassAccessorProperty(r){let n=super.parseClassAccessorProperty(r);return this.getPluginOption("estree","classFeatures")&&(n.abstract&&this.hasPlugin("typescript")?(delete n.abstract,this.castNodeTo(n,"TSAbstractAccessorProperty")):this.castNodeTo(n,"AccessorProperty")),n}parseObjectProperty(r,n,i,o){let s=super.parseObjectProperty(r,n,i,o);return s&&(s.kind="init",this.castNodeTo(s,"Property")),s}finishObjectProperty(r){return r.kind="init",this.finishNode(r,"Property")}isValidLVal(r,n,i,o){return r==="Property"?"value":super.isValidLVal(r,n,i,o)}isAssignable(r,n){return r!=null&&this.isObjectProperty(r)?this.isAssignable(r.value,n):super.isAssignable(r,n)}toAssignable(r,n=!1){if(r!=null&&this.isObjectProperty(r)){let{key:i,value:o}=r;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.loc.start),this.toAssignable(o,n)}else super.toAssignable(r,n)}toAssignableObjectExpressionProp(r,n,i){r.type==="Property"&&(r.kind==="get"||r.kind==="set")?this.raise(q.PatternHasAccessor,r.key):r.type==="Property"&&r.method?this.raise(q.PatternHasMethod,r.key):super.toAssignableObjectExpressionProp(r,n,i)}finishCallExpression(r,n){let i=super.finishCallExpression(r,n);if(i.callee.type==="Import"){var o,s;this.castNodeTo(i,"ImportExpression"),i.source=i.arguments[0],i.options=(o=i.arguments[1])!=null?o:null,i.attributes=(s=i.arguments[1])!=null?s:null,delete i.arguments,delete i.callee}else i.type==="OptionalCallExpression"?this.castNodeTo(i,"CallExpression"):i.optional=!1;return i}toReferencedArguments(r){r.type!=="ImportExpression"&&super.toReferencedArguments(r)}parseExport(r,n){let i=this.state.lastTokStartLoc,o=super.parseExport(r,n);switch(o.type){case"ExportAllDeclaration":o.exported=null;break;case"ExportNamedDeclaration":o.specifiers.length===1&&o.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(o,"ExportAllDeclaration"),o.exported=o.specifiers[0].exported,delete o.specifiers);case"ExportDefaultDeclaration":{var s;let{declaration:a}=o;a?.type==="ClassDeclaration"&&((s=a.decorators)==null?void 0:s.length)>0&&a.start===o.start&&this.resetStartLocation(o,i)}break}return o}stopParseSubscript(r,n){let i=super.stopParseSubscript(r,n);return n.optionalChainMember?this.estreeParseChainExpression(i,r.loc.end):i}parseMember(r,n,i,o,s){let a=super.parseMember(r,n,i,o,s);return a.type==="OptionalMemberExpression"?this.castNodeTo(a,"MemberExpression"):a.optional=!1,a}isOptionalMemberExpression(r){return r.type==="ChainExpression"?r.expression.type==="MemberExpression":super.isOptionalMemberExpression(r)}hasPropertyAsPrivateName(r){return r.type==="ChainExpression"&&(r=r.expression),super.hasPropertyAsPrivateName(r)}isObjectProperty(r){return r.type==="Property"&&r.kind==="init"&&!r.method}isObjectMethod(r){return r.type==="Property"&&(r.method||r.kind==="get"||r.kind==="set")}castNodeTo(r,n){let i=super.castNodeTo(r,n);return this.fillOptionalPropertiesForTSESLint(i),i}cloneIdentifier(r){let n=super.cloneIdentifier(r);return this.fillOptionalPropertiesForTSESLint(n),n}cloneStringLiteral(r){return r.type==="Literal"?this.cloneEstreeStringLiteral(r):super.cloneStringLiteral(r)}finishNodeAt(r,n,i){return dI(super.finishNodeAt(r,n,i))}finishNode(r,n){let i=super.finishNode(r,n);return this.fillOptionalPropertiesForTSESLint(i),i}resetStartLocation(r,n){super.resetStartLocation(r,n),dI(r)}resetEndLocation(r,n=this.state.lastTokEndLoc){super.resetEndLocation(r,n),dI(r)}},qg=class{constructor(e,r){this.token=void 0,this.preserveSpace=void 0,this.token=e,this.preserveSpace=!!r}},pr={brace:new qg("{"),j_oTag:new qg("<tag"),j_cTag:new qg("</tag"),j_expr:new qg("<tag>...</tag>",!0)};pr.template=new qg("`",!0);var Tt=!0,xe=!0,LM=!0,fI=!0,Zu=!0,H4e=!0,kw=class{constructor(e,r={}){this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,this.label=e,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.rightAssociative=!!r.rightAssociative,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop!=null?r.binop:null,this.updateContext=null}},lP=new Map;function nr(t,e={}){e.keyword=t;let r=Ve(t,e);return lP.set(t,r),r}function Ao(t,e){return Ve(t,{beforeExpr:Tt,binop:e})}var II=-1,Pc=[],gP=[],pP=[],dP=[],fP=[],mP=[];function Ve(t,e={}){var r,n,i,o;return++II,gP.push(t),pP.push((r=e.binop)!=null?r:-1),dP.push((n=e.beforeExpr)!=null?n:!1),fP.push((i=e.startsExpr)!=null?i:!1),mP.push((o=e.prefix)!=null?o:!1),Pc.push(new kw(t,e)),II}function _t(t,e={}){var r,n,i,o;return++II,lP.set(t,II),gP.push(t),pP.push((r=e.binop)!=null?r:-1),dP.push((n=e.beforeExpr)!=null?n:!1),fP.push((i=e.startsExpr)!=null?i:!1),mP.push((o=e.prefix)!=null?o:!1),Pc.push(new kw("name",e)),II}var $4e={bracketL:Ve("[",{beforeExpr:Tt,startsExpr:xe}),bracketHashL:Ve("#[",{beforeExpr:Tt,startsExpr:xe}),bracketBarL:Ve("[|",{beforeExpr:Tt,startsExpr:xe}),bracketR:Ve("]"),bracketBarR:Ve("|]"),braceL:Ve("{",{beforeExpr:Tt,startsExpr:xe}),braceBarL:Ve("{|",{beforeExpr:Tt,startsExpr:xe}),braceHashL:Ve("#{",{beforeExpr:Tt,startsExpr:xe}),braceR:Ve("}"),braceBarR:Ve("|}"),parenL:Ve("(",{beforeExpr:Tt,startsExpr:xe}),parenR:Ve(")"),comma:Ve(",",{beforeExpr:Tt}),semi:Ve(";",{beforeExpr:Tt}),colon:Ve(":",{beforeExpr:Tt}),doubleColon:Ve("::",{beforeExpr:Tt}),dot:Ve("."),question:Ve("?",{beforeExpr:Tt}),questionDot:Ve("?."),arrow:Ve("=>",{beforeExpr:Tt}),template:Ve("template"),ellipsis:Ve("...",{beforeExpr:Tt}),backQuote:Ve("`",{startsExpr:xe}),dollarBraceL:Ve("${",{beforeExpr:Tt,startsExpr:xe}),templateTail:Ve("...`",{startsExpr:xe}),templateNonTail:Ve("...${",{beforeExpr:Tt,startsExpr:xe}),at:Ve("@"),hash:Ve("#",{startsExpr:xe}),interpreterDirective:Ve("#!..."),eq:Ve("=",{beforeExpr:Tt,isAssign:fI}),assign:Ve("_=",{beforeExpr:Tt,isAssign:fI}),slashAssign:Ve("_=",{beforeExpr:Tt,isAssign:fI}),xorAssign:Ve("_=",{beforeExpr:Tt,isAssign:fI}),moduloAssign:Ve("_=",{beforeExpr:Tt,isAssign:fI}),incDec:Ve("++/--",{prefix:Zu,postfix:H4e,startsExpr:xe}),bang:Ve("!",{beforeExpr:Tt,prefix:Zu,startsExpr:xe}),tilde:Ve("~",{beforeExpr:Tt,prefix:Zu,startsExpr:xe}),doubleCaret:Ve("^^",{startsExpr:xe}),doubleAt:Ve("@@",{startsExpr:xe}),pipeline:Ao("|>",0),nullishCoalescing:Ao("??",1),logicalOR:Ao("||",1),logicalAND:Ao("&&",2),bitwiseOR:Ao("|",3),bitwiseXOR:Ao("^",4),bitwiseAND:Ao("&",5),equality:Ao("==/!=/===/!==",6),lt:Ao("</>/<=/>=",7),gt:Ao("</>/<=/>=",7),relational:Ao("</>/<=/>=",7),bitShift:Ao("<</>>/>>>",8),bitShiftL:Ao("<</>>/>>>",8),bitShiftR:Ao("<</>>/>>>",8),plusMin:Ve("+/-",{beforeExpr:Tt,binop:9,prefix:Zu,startsExpr:xe}),modulo:Ve("%",{binop:10,startsExpr:xe}),star:Ve("*",{binop:10}),slash:Ao("/",10),exponent:Ve("**",{beforeExpr:Tt,binop:11,rightAssociative:!0}),_in:nr("in",{beforeExpr:Tt,binop:7}),_instanceof:nr("instanceof",{beforeExpr:Tt,binop:7}),_break:nr("break"),_case:nr("case",{beforeExpr:Tt}),_catch:nr("catch"),_continue:nr("continue"),_debugger:nr("debugger"),_default:nr("default",{beforeExpr:Tt}),_else:nr("else",{beforeExpr:Tt}),_finally:nr("finally"),_function:nr("function",{startsExpr:xe}),_if:nr("if"),_return:nr("return",{beforeExpr:Tt}),_switch:nr("switch"),_throw:nr("throw",{beforeExpr:Tt,prefix:Zu,startsExpr:xe}),_try:nr("try"),_var:nr("var"),_const:nr("const"),_with:nr("with"),_new:nr("new",{beforeExpr:Tt,startsExpr:xe}),_this:nr("this",{startsExpr:xe}),_super:nr("super",{startsExpr:xe}),_class:nr("class",{startsExpr:xe}),_extends:nr("extends",{beforeExpr:Tt}),_export:nr("export"),_import:nr("import",{startsExpr:xe}),_null:nr("null",{startsExpr:xe}),_true:nr("true",{startsExpr:xe}),_false:nr("false",{startsExpr:xe}),_typeof:nr("typeof",{beforeExpr:Tt,prefix:Zu,startsExpr:xe}),_void:nr("void",{beforeExpr:Tt,prefix:Zu,startsExpr:xe}),_delete:nr("delete",{beforeExpr:Tt,prefix:Zu,startsExpr:xe}),_do:nr("do",{isLoop:LM,beforeExpr:Tt}),_for:nr("for",{isLoop:LM}),_while:nr("while",{isLoop:LM}),_as:_t("as",{startsExpr:xe}),_assert:_t("assert",{startsExpr:xe}),_async:_t("async",{startsExpr:xe}),_await:_t("await",{startsExpr:xe}),_defer:_t("defer",{startsExpr:xe}),_from:_t("from",{startsExpr:xe}),_get:_t("get",{startsExpr:xe}),_let:_t("let",{startsExpr:xe}),_meta:_t("meta",{startsExpr:xe}),_of:_t("of",{startsExpr:xe}),_sent:_t("sent",{startsExpr:xe}),_set:_t("set",{startsExpr:xe}),_source:_t("source",{startsExpr:xe}),_static:_t("static",{startsExpr:xe}),_using:_t("using",{startsExpr:xe}),_yield:_t("yield",{startsExpr:xe}),_asserts:_t("asserts",{startsExpr:xe}),_checks:_t("checks",{startsExpr:xe}),_exports:_t("exports",{startsExpr:xe}),_global:_t("global",{startsExpr:xe}),_implements:_t("implements",{startsExpr:xe}),_intrinsic:_t("intrinsic",{startsExpr:xe}),_infer:_t("infer",{startsExpr:xe}),_is:_t("is",{startsExpr:xe}),_mixins:_t("mixins",{startsExpr:xe}),_proto:_t("proto",{startsExpr:xe}),_require:_t("require",{startsExpr:xe}),_satisfies:_t("satisfies",{startsExpr:xe}),_keyof:_t("keyof",{startsExpr:xe}),_readonly:_t("readonly",{startsExpr:xe}),_unique:_t("unique",{startsExpr:xe}),_abstract:_t("abstract",{startsExpr:xe}),_declare:_t("declare",{startsExpr:xe}),_enum:_t("enum",{startsExpr:xe}),_module:_t("module",{startsExpr:xe}),_namespace:_t("namespace",{startsExpr:xe}),_interface:_t("interface",{startsExpr:xe}),_type:_t("type",{startsExpr:xe}),_opaque:_t("opaque",{startsExpr:xe}),name:Ve("name",{startsExpr:xe}),placeholder:Ve("%%",{startsExpr:xe}),string:Ve("string",{startsExpr:xe}),num:Ve("num",{startsExpr:xe}),bigint:Ve("bigint",{startsExpr:xe}),decimal:Ve("decimal",{startsExpr:xe}),regexp:Ve("regexp",{startsExpr:xe}),privateName:Ve("#name",{startsExpr:xe}),eof:Ve("eof"),jsxName:Ve("jsxName"),jsxText:Ve("jsxText",{beforeExpr:Tt}),jsxTagStart:Ve("jsxTagStart",{startsExpr:xe}),jsxTagEnd:Ve("jsxTagEnd")};function Ir(t){return t>=93&&t<=133}function J4e(t){return t<=92}function va(t){return t>=58&&t<=133}function fee(t){return t>=58&&t<=137}function j4e(t){return dP[t]}function hI(t){return fP[t]}function Y4e(t){return t>=29&&t<=33}function iee(t){return t>=129&&t<=131}function q4e(t){return t>=90&&t<=92}function hP(t){return t>=58&&t<=92}function V4e(t){return t>=39&&t<=59}function z4e(t){return t===34}function W4e(t){return mP[t]}function Z4e(t){return t>=121&&t<=123}function X4e(t){return t>=124&&t<=130}function el(t){return gP[t]}function xw(t){return pP[t]}function e3e(t){return t===57}function Rw(t){return t>=24&&t<=25}function Mc(t){return Pc[t]}Pc[8].updateContext=t=>{t.pop()};Pc[5].updateContext=Pc[7].updateContext=Pc[23].updateContext=t=>{t.push(pr.brace)};Pc[22].updateContext=t=>{t[t.length-1]===pr.template?t.pop():t.push(pr.template)};Pc[143].updateContext=t=>{t.push(pr.j_expr,pr.j_oTag)};var CP="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",mee="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",t3e=new RegExp("["+CP+"]"),r3e=new RegExp("["+CP+mee+"]");CP=mee=null;var hee=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],n3e=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function $M(t,e){let r=65536;for(let n=0,i=e.length;n<i;n+=2){if(r+=e[n],r>t)return!1;if(r+=e[n+1],r>=t)return!0}return!1}function FA(t){return t<65?t===36:t<=90?!0:t<97?t===95:t<=122?!0:t<=65535?t>=170&&t3e.test(String.fromCharCode(t)):$M(t,hee)}function Vg(t){return t<48?t===36:t<58?!0:t<65?!1:t<=90?!0:t<97?t===95:t<=122?!0:t<=65535?t>=170&&r3e.test(String.fromCharCode(t)):$M(t,hee)||$M(t,n3e)}var IP={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},i3e=new Set(IP.keyword),o3e=new Set(IP.strict),s3e=new Set(IP.strictBind);function Cee(t,e){return e&&t==="await"||t==="enum"}function Iee(t,e){return Cee(t,e)||o3e.has(t)}function Eee(t){return s3e.has(t)}function Bee(t,e){return Iee(t,e)||Eee(t)}function a3e(t){return i3e.has(t)}function A3e(t,e,r){return t===64&&e===64&&FA(r)}var c3e=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function u3e(t){return c3e.has(t)}var EI=class{constructor(e){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=e}},BI=class{constructor(e,r){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=e,this.inModule=r}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){let e=this.currentThisScopeFlags();return(e&64)>0&&(e&2)===0}get inStaticBlock(){for(let e=this.scopeStack.length-1;;e--){let{flags:r}=this.scopeStack[e];if(r&128)return!0;if(r&1731)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(e){return new EI(e)}enter(e){this.scopeStack.push(this.createScope(e))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(e){return!!(e.flags&130||!this.parser.inModule&&e.flags&1)}declareName(e,r,n){let i=this.currentScope();if(r&8||r&16){this.checkRedeclarationInScope(i,e,r,n);let o=i.names.get(e)||0;r&16?o=o|4:(i.firstLexicalName||(i.firstLexicalName=e),o=o|2),i.names.set(e,o),r&8&&this.maybeExportDefined(i,e)}else if(r&4)for(let o=this.scopeStack.length-1;o>=0&&(i=this.scopeStack[o],this.checkRedeclarationInScope(i,e,r,n),i.names.set(e,(i.names.get(e)||0)|1),this.maybeExportDefined(i,e),!(i.flags&1667));--o);this.parser.inModule&&i.flags&1&&this.undefinedExports.delete(e)}maybeExportDefined(e,r){this.parser.inModule&&e.flags&1&&this.undefinedExports.delete(r)}checkRedeclarationInScope(e,r,n,i){this.isRedeclaredInScope(e,r,n)&&this.parser.raise(q.VarRedeclaration,i,{identifierName:r})}isRedeclaredInScope(e,r,n){if(!(n&1))return!1;if(n&8)return e.names.has(r);let i=e.names.get(r)||0;return n&16?(i&2)>0||!this.treatFunctionsAsVarInScope(e)&&(i&1)>0:(i&2)>0&&!(e.flags&8&&e.firstLexicalName===r)||!this.treatFunctionsAsVarInScope(e)&&(i&4)>0}checkLocalExport(e){let{name:r}=e;this.scopeStack[0].names.has(r)||this.undefinedExports.set(r,e.loc.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:r}=this.scopeStack[e];if(r&1667)return r}}currentThisScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:r}=this.scopeStack[e];if(r&1731&&!(r&4))return r}}},JM=class extends EI{constructor(...e){super(...e),this.declareFunctions=new Set}},jM=class extends BI{createScope(e){return new JM(e)}declareName(e,r,n){let i=this.currentScope();if(r&2048){this.checkRedeclarationInScope(i,e,r,n),this.maybeExportDefined(i,e),i.declareFunctions.add(e);return}super.declareName(e,r,n)}isRedeclaredInScope(e,r,n){if(super.isRedeclaredInScope(e,r,n))return!0;if(n&2048&&!e.declareFunctions.has(r)){let i=e.names.get(r);return(i&4)>0||(i&2)>0}return!1}checkLocalExport(e){this.scopeStack[0].declareFunctions.has(e.name)||super.checkLocalExport(e)}},l3e=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),tt=xA`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:t})=>`Cannot overwrite reserved type ${t}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:t,enumName:e})=>`Boolean enum members need to be initialized. Use either \`${t} = true,\` or \`${t} = false,\` in enum \`${e}\`.`,EnumDuplicateMemberName:({memberName:t,enumName:e})=>`Enum member names need to be unique, but the name \`${t}\` has already been used before in enum \`${e}\`.`,EnumInconsistentMemberValues:({enumName:t})=>`Enum \`${t}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:t,enumName:e})=>`Enum type \`${t}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:t})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:t,memberName:e,explicitType:r})=>`Enum \`${t}\` has type \`${r}\`, so the initializer of \`${e}\` needs to be a ${r} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:t,memberName:e})=>`Symbol enum members cannot be initialized. Use \`${e},\` in enum \`${t}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:t,memberName:e})=>`The enum member initializer for \`${e}\` needs to be a literal (either a boolean, number, or string) in enum \`${t}\`.`,EnumInvalidMemberName:({enumName:t,memberName:e,suggestion:r})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${e}\`, consider using \`${r}\`, in enum \`${t}\`.`,EnumNumberMemberNotInitialized:({enumName:t,memberName:e})=>`Number enum members need to be initialized, e.g. \`${e} = 1\` in enum \`${t}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:t})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${t}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:t})=>`Unexpected reserved type ${t}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:t,suggestion:e})=>`\`declare export ${t}\` is not supported. Use \`${e}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function g3e(t){return t.type==="DeclareExportAllDeclaration"||t.type==="DeclareExportDeclaration"&&(!t.declaration||t.declaration.type!=="TypeAlias"&&t.declaration.type!=="InterfaceDeclaration")}function oee(t){return t.importKind==="type"||t.importKind==="typeof"}var p3e={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function d3e(t,e){let r=[],n=[];for(let i=0;i<t.length;i++)(e(t[i],i,t)?r:n).push(t[i]);return[r,n]}var f3e=/\*?\s*@((?:no)?flow)\b/,m3e=t=>class extends t{constructor(...r){super(...r),this.flowPragma=void 0}getScopeHandler(){return jM}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(r,n){r!==134&&r!==13&&r!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(r,n)}addComment(r){if(this.flowPragma===void 0){let n=f3e.exec(r.value);if(n)if(n[1]==="flow")this.flowPragma="flow";else if(n[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(r)}flowParseTypeInitialiser(r){let n=this.state.inType;this.state.inType=!0,this.expect(r||14);let i=this.flowParseType();return this.state.inType=n,i}flowParsePredicate(){let r=this.startNode(),n=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStartLoc.index>n.index+1&&this.raise(tt.UnexpectedSpaceBetweenModuloChecks,n),this.eat(10)?(r.value=super.parseExpression(),this.expect(11),this.finishNode(r,"DeclaredPredicate")):this.finishNode(r,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){let r=this.state.inType;this.state.inType=!0,this.expect(14);let n=null,i=null;return this.match(54)?(this.state.inType=r,i=this.flowParsePredicate()):(n=this.flowParseType(),this.state.inType=r,this.match(54)&&(i=this.flowParsePredicate())),[n,i]}flowParseDeclareClass(r){return this.next(),this.flowParseInterfaceish(r,!0),this.finishNode(r,"DeclareClass")}flowParseDeclareFunction(r){this.next();let n=r.id=this.parseIdentifier(),i=this.startNode(),o=this.startNode();this.match(47)?i.typeParameters=this.flowParseTypeParameterDeclaration():i.typeParameters=null,this.expect(10);let s=this.flowParseFunctionTypeParams();return i.params=s.params,i.rest=s.rest,i.this=s._this,this.expect(11),[i.returnType,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),o.typeAnnotation=this.finishNode(i,"FunctionTypeAnnotation"),n.typeAnnotation=this.finishNode(o,"TypeAnnotation"),this.resetEndLocation(n),this.semicolon(),this.scope.declareName(r.id.name,2048,r.id.loc.start),this.finishNode(r,"DeclareFunction")}flowParseDeclare(r,n){if(this.match(80))return this.flowParseDeclareClass(r);if(this.match(68))return this.flowParseDeclareFunction(r);if(this.match(74))return this.flowParseDeclareVariable(r);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(r):(n&&this.raise(tt.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(r));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(r);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(r);if(this.isContextual(129))return this.flowParseDeclareInterface(r);if(this.match(82))return this.flowParseDeclareExportDeclaration(r,n);throw this.unexpected()}flowParseDeclareVariable(r){return this.next(),r.id=this.flowParseTypeAnnotatableIdentifier(!0),this.scope.declareName(r.id.name,5,r.id.loc.start),this.semicolon(),this.finishNode(r,"DeclareVariable")}flowParseDeclareModule(r){this.scope.enter(0),this.match(134)?r.id=super.parseExprAtom():r.id=this.parseIdentifier();let n=r.body=this.startNode(),i=n.body=[];for(this.expect(5);!this.match(8);){let a=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(tt.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),i.push(super.parseImport(a))):(this.expectContextual(125,tt.UnsupportedStatementInDeclareModule),i.push(this.flowParseDeclare(a,!0)))}this.scope.exit(),this.expect(8),this.finishNode(n,"BlockStatement");let o=null,s=!1;return i.forEach(a=>{g3e(a)?(o==="CommonJS"&&this.raise(tt.AmbiguousDeclareModuleKind,a),o="ES"):a.type==="DeclareModuleExports"&&(s&&this.raise(tt.DuplicateDeclareModuleExports,a),o==="ES"&&this.raise(tt.AmbiguousDeclareModuleKind,a),o="CommonJS",s=!0)}),r.kind=o||"CommonJS",this.finishNode(r,"DeclareModule")}flowParseDeclareExportDeclaration(r,n){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?r.declaration=this.flowParseDeclare(this.startNode()):(r.declaration=this.flowParseType(),this.semicolon()),r.default=!0,this.finishNode(r,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!n){let i=this.state.value;throw this.raise(tt.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:i,suggestion:p3e[i]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return r.declaration=this.flowParseDeclare(this.startNode()),r.default=!1,this.finishNode(r,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return r=this.parseExport(r,null),r.type==="ExportNamedDeclaration"?(r.default=!1,delete r.exportKind,this.castNodeTo(r,"DeclareExportDeclaration")):this.castNodeTo(r,"DeclareExportAllDeclaration");throw this.unexpected()}flowParseDeclareModuleExports(r){return this.next(),this.expectContextual(111),r.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(r,"DeclareModuleExports")}flowParseDeclareTypeAlias(r){this.next();let n=this.flowParseTypeAlias(r);return this.castNodeTo(n,"DeclareTypeAlias"),n}flowParseDeclareOpaqueType(r){this.next();let n=this.flowParseOpaqueType(r,!0);return this.castNodeTo(n,"DeclareOpaqueType"),n}flowParseDeclareInterface(r){return this.next(),this.flowParseInterfaceish(r,!1),this.finishNode(r,"DeclareInterface")}flowParseInterfaceish(r,n){if(r.id=this.flowParseRestrictedIdentifier(!n,!0),this.scope.declareName(r.id.name,n?17:8201,r.id.loc.start),this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,r.extends=[],this.eat(81))do r.extends.push(this.flowParseInterfaceExtends());while(!n&&this.eat(12));if(n){if(r.implements=[],r.mixins=[],this.eatContextual(117))do r.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do r.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}r.body=this.flowParseObjectType({allowStatic:n,allowExact:!1,allowSpread:!1,allowProto:n,allowInexact:!1})}flowParseInterfaceExtends(){let r=this.startNode();return r.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?r.typeParameters=this.flowParseTypeParameterInstantiation():r.typeParameters=null,this.finishNode(r,"InterfaceExtends")}flowParseInterface(r){return this.flowParseInterfaceish(r,!1),this.finishNode(r,"InterfaceDeclaration")}checkNotUnderscore(r){r==="_"&&this.raise(tt.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(r,n,i){l3e.has(r)&&this.raise(i?tt.AssignReservedType:tt.UnexpectedReservedType,n,{reservedType:r})}flowParseRestrictedIdentifier(r,n){return this.checkReservedType(this.state.value,this.state.startLoc,n),this.parseIdentifier(r)}flowParseTypeAlias(r){return r.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(r.id.name,8201,r.id.loc.start),this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,r.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(r,"TypeAlias")}flowParseOpaqueType(r,n){return this.expectContextual(130),r.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(r.id.name,8201,r.id.loc.start),this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,r.supertype=null,this.match(14)&&(r.supertype=this.flowParseTypeInitialiser(14)),r.impltype=null,n||(r.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(r,"OpaqueType")}flowParseTypeParameter(r=!1){let n=this.state.startLoc,i=this.startNode(),o=this.flowParseVariance(),s=this.flowParseTypeAnnotatableIdentifier();return i.name=s.name,i.variance=o,i.bound=s.typeAnnotation,this.match(29)?(this.eat(29),i.default=this.flowParseType()):r&&this.raise(tt.MissingTypeParamDefault,n),this.finishNode(i,"TypeParameter")}flowParseTypeParameterDeclaration(){let r=this.state.inType,n=this.startNode();n.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();let i=!1;do{let o=this.flowParseTypeParameter(i);n.params.push(o),o.default&&(i=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=r,this.finishNode(n,"TypeParameterDeclaration")}flowInTopLevelContext(r){if(this.curContext()!==pr.brace){let n=this.state.context;this.state.context=[n[0]];try{return r()}finally{this.state.context=n}}else return r()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===47)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){let r=this.startNode(),n=this.state.inType;return this.state.inType=!0,r.params=[],this.flowInTopLevelContext(()=>{this.expect(47);let i=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)r.params.push(this.flowParseType()),this.match(48)||this.expect(12);this.state.noAnonFunctionType=i}),this.state.inType=n,!this.state.inType&&this.curContext()===pr.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(r,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return null;let r=this.startNode(),n=this.state.inType;for(r.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)r.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=n,this.finishNode(r,"TypeParameterInstantiation")}flowParseInterfaceType(){let r=this.startNode();if(this.expectContextual(129),r.extends=[],this.eat(81))do r.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return r.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(r,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(r,n,i){return r.static=n,this.lookahead().type===14?(r.id=this.flowParseObjectPropertyKey(),r.key=this.flowParseTypeInitialiser()):(r.id=null,r.key=this.flowParseType()),this.expect(3),r.value=this.flowParseTypeInitialiser(),r.variance=i,this.finishNode(r,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(r,n){return r.static=n,r.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(r.method=!0,r.optional=!1,r.value=this.flowParseObjectTypeMethodish(this.startNodeAt(r.loc.start))):(r.method=!1,this.eat(17)&&(r.optional=!0),r.value=this.flowParseTypeInitialiser()),this.finishNode(r,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(r){for(r.params=[],r.rest=null,r.typeParameters=null,r.this=null,this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(r.this=this.flowParseFunctionTypeParam(!0),r.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)r.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(r.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),r.returnType=this.flowParseTypeInitialiser(),this.finishNode(r,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(r,n){let i=this.startNode();return r.static=n,r.value=this.flowParseObjectTypeMethodish(i),this.finishNode(r,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:r,allowExact:n,allowSpread:i,allowProto:o,allowInexact:s}){let a=this.state.inType;this.state.inType=!0;let A=this.startNode();A.callProperties=[],A.properties=[],A.indexers=[],A.internalSlots=[];let c,u,l=!1;for(n&&this.match(6)?(this.expect(6),c=9,u=!0):(this.expect(5),c=8,u=!1),A.exact=u;!this.match(c);){let g=!1,d=null,f=null,h=this.startNode();if(o&&this.isContextual(118)){let I=this.lookahead();I.type!==14&&I.type!==17&&(this.next(),d=this.state.startLoc,r=!1)}if(r&&this.isContextual(106)){let I=this.lookahead();I.type!==14&&I.type!==17&&(this.next(),g=!0)}let C=this.flowParseVariance();if(this.eat(0))d!=null&&this.unexpected(d),this.eat(0)?(C&&this.unexpected(C.loc.start),A.internalSlots.push(this.flowParseObjectTypeInternalSlot(h,g))):A.indexers.push(this.flowParseObjectTypeIndexer(h,g,C));else if(this.match(10)||this.match(47))d!=null&&this.unexpected(d),C&&this.unexpected(C.loc.start),A.callProperties.push(this.flowParseObjectTypeCallProperty(h,g));else{let I="init";if(this.isContextual(99)||this.isContextual(104)){let E=this.lookahead();fee(E.type)&&(I=this.state.value,this.next())}let B=this.flowParseObjectTypeProperty(h,g,d,C,I,i,s??!u);B===null?(l=!0,f=this.state.lastTokStartLoc):A.properties.push(B)}this.flowObjectTypeSemicolon(),f&&!this.match(8)&&!this.match(9)&&this.raise(tt.UnexpectedExplicitInexactInObject,f)}this.expect(c),i&&(A.inexact=l);let p=this.finishNode(A,"ObjectTypeAnnotation");return this.state.inType=a,p}flowParseObjectTypeProperty(r,n,i,o,s,a,A){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(a?A||this.raise(tt.InexactInsideExact,this.state.lastTokStartLoc):this.raise(tt.InexactInsideNonObject,this.state.lastTokStartLoc),o&&this.raise(tt.InexactVariance,o),null):(a||this.raise(tt.UnexpectedSpreadType,this.state.lastTokStartLoc),i!=null&&this.unexpected(i),o&&this.raise(tt.SpreadVariance,o),r.argument=this.flowParseType(),this.finishNode(r,"ObjectTypeSpreadProperty"));{r.key=this.flowParseObjectPropertyKey(),r.static=n,r.proto=i!=null,r.kind=s;let c=!1;return this.match(47)||this.match(10)?(r.method=!0,i!=null&&this.unexpected(i),o&&this.unexpected(o.loc.start),r.value=this.flowParseObjectTypeMethodish(this.startNodeAt(r.loc.start)),(s==="get"||s==="set")&&this.flowCheckGetterSetterParams(r),!a&&r.key.name==="constructor"&&r.value.this&&this.raise(tt.ThisParamBannedInConstructor,r.value.this)):(s!=="init"&&this.unexpected(),r.method=!1,this.eat(17)&&(c=!0),r.value=this.flowParseTypeInitialiser(),r.variance=o),r.optional=c,this.finishNode(r,"ObjectTypeProperty")}}flowCheckGetterSetterParams(r){let n=r.kind==="get"?0:1,i=r.value.params.length+(r.value.rest?1:0);r.value.this&&this.raise(r.kind==="get"?tt.GetterMayNotHaveThisParam:tt.SetterMayNotHaveThisParam,r.value.this),i!==n&&this.raise(r.kind==="get"?q.BadGetterArity:q.BadSetterArity,r),r.kind==="set"&&r.value.rest&&this.raise(q.BadSetterRestParameter,r)}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(r,n){r??(r=this.state.startLoc);let i=n||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){let o=this.startNodeAt(r);o.qualification=i,o.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(o,"QualifiedTypeIdentifier")}return i}flowParseGenericType(r,n){let i=this.startNodeAt(r);return i.typeParameters=null,i.id=this.flowParseQualifiedTypeIdentifier(r,n),this.match(47)&&(i.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){let r=this.startNode();return this.expect(87),r.argument=this.flowParsePrimaryType(),this.finishNode(r,"TypeofTypeAnnotation")}flowParseTupleType(){let r=this.startNode();for(r.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(r.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(r,"TupleTypeAnnotation")}flowParseFunctionTypeParam(r){let n=null,i=!1,o=null,s=this.startNode(),a=this.lookahead(),A=this.state.type===78;return a.type===14||a.type===17?(A&&!r&&this.raise(tt.ThisParamMustBeFirst,s),n=this.parseIdentifier(A),this.eat(17)&&(i=!0,A&&this.raise(tt.ThisParamMayNotBeOptional,s)),o=this.flowParseTypeInitialiser()):o=this.flowParseType(),s.name=n,s.optional=i,s.typeAnnotation=o,this.finishNode(s,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(r){let n=this.startNodeAt(r.loc.start);return n.name=null,n.optional=!1,n.typeAnnotation=r,this.finishNode(n,"FunctionTypeParam")}flowParseFunctionTypeParams(r=[]){let n=null,i=null;for(this.match(78)&&(i=this.flowParseFunctionTypeParam(!0),i.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)r.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(n=this.flowParseFunctionTypeParam(!1)),{params:r,rest:n,_this:i}}flowIdentToTypeAnnotation(r,n,i){switch(i.name){case"any":return this.finishNode(n,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(n,"BooleanTypeAnnotation");case"mixed":return this.finishNode(n,"MixedTypeAnnotation");case"empty":return this.finishNode(n,"EmptyTypeAnnotation");case"number":return this.finishNode(n,"NumberTypeAnnotation");case"string":return this.finishNode(n,"StringTypeAnnotation");case"symbol":return this.finishNode(n,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(i.name),this.flowParseGenericType(r,i)}}flowParsePrimaryType(){let r=this.state.startLoc,n=this.startNode(),i,o,s=!1,a=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,o=this.flowParseTupleType(),this.state.noAnonFunctionType=a,o;case 47:{let A=this.startNode();return A.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),i=this.flowParseFunctionTypeParams(),A.params=i.params,A.rest=i.rest,A.this=i._this,this.expect(11),this.expect(19),A.returnType=this.flowParseType(),this.finishNode(A,"FunctionTypeAnnotation")}case 10:{let A=this.startNode();if(this.next(),!this.match(11)&&!this.match(21))if(Ir(this.state.type)||this.match(78)){let c=this.lookahead().type;s=c!==17&&c!==14}else s=!0;if(s){if(this.state.noAnonFunctionType=!1,o=this.flowParseType(),this.state.noAnonFunctionType=a,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),o;this.eat(12)}return o?i=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(o)]):i=this.flowParseFunctionTypeParams(),A.params=i.params,A.rest=i.rest,A.this=i._this,this.expect(11),this.expect(19),A.returnType=this.flowParseType(),A.typeParameters=null,this.finishNode(A,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:return n.value=this.match(85),this.next(),this.finishNode(n,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){if(this.next(),this.match(135))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",n);if(this.match(136))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",n);throw this.raise(tt.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:return this.next(),this.finishNode(n,"VoidTypeAnnotation");case 84:return this.next(),this.finishNode(n,"NullLiteralTypeAnnotation");case 78:return this.next(),this.finishNode(n,"ThisTypeAnnotation");case 55:return this.next(),this.finishNode(n,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(hP(this.state.type)){let A=el(this.state.type);return this.next(),super.createIdentifier(n,A)}else if(Ir(this.state.type))return this.isContextual(129)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(r,n,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){let r=this.state.startLoc,n=this.flowParsePrimaryType(),i=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){let o=this.startNodeAt(r),s=this.eat(18);i=i||s,this.expect(0),!s&&this.match(3)?(o.elementType=n,this.next(),n=this.finishNode(o,"ArrayTypeAnnotation")):(o.objectType=n,o.indexType=this.flowParseType(),this.expect(3),i?(o.optional=s,n=this.finishNode(o,"OptionalIndexedAccessType")):n=this.finishNode(o,"IndexedAccessType"))}return n}flowParsePrefixType(){let r=this.startNode();return this.eat(17)?(r.typeAnnotation=this.flowParsePrefixType(),this.finishNode(r,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){let r=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){let n=this.startNodeAt(r.loc.start);return n.params=[this.reinterpretTypeAsFunctionTypeParam(r)],n.rest=null,n.this=null,n.returnType=this.flowParseType(),n.typeParameters=null,this.finishNode(n,"FunctionTypeAnnotation")}return r}flowParseIntersectionType(){let r=this.startNode();this.eat(45);let n=this.flowParseAnonFunctionWithoutParens();for(r.types=[n];this.eat(45);)r.types.push(this.flowParseAnonFunctionWithoutParens());return r.types.length===1?n:this.finishNode(r,"IntersectionTypeAnnotation")}flowParseUnionType(){let r=this.startNode();this.eat(43);let n=this.flowParseIntersectionType();for(r.types=[n];this.eat(43);)r.types.push(this.flowParseIntersectionType());return r.types.length===1?n:this.finishNode(r,"UnionTypeAnnotation")}flowParseType(){let r=this.state.inType;this.state.inType=!0;let n=this.flowParseUnionType();return this.state.inType=r,n}flowParseTypeOrImplicitInstantiation(){if(this.state.type===132&&this.state.value==="_"){let r=this.state.startLoc,n=this.parseIdentifier();return this.flowParseGenericType(r,n)}else return this.flowParseType()}flowParseTypeAnnotation(){let r=this.startNode();return r.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(r,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(r){let n=r?this.parseIdentifier():this.flowParseRestrictedIdentifier();return this.match(14)&&(n.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(n)),n}typeCastToParameter(r){return r.expression.typeAnnotation=r.typeAnnotation,this.resetEndLocation(r.expression,r.typeAnnotation.loc.end),r.expression}flowParseVariance(){let r=null;return this.match(53)?(r=this.startNode(),this.state.value==="+"?r.kind="plus":r.kind="minus",this.next(),this.finishNode(r,"Variance")):r}parseFunctionBody(r,n,i=!1){if(n){this.forwardNoArrowParamsConversionAt(r,()=>super.parseFunctionBody(r,!0,i));return}super.parseFunctionBody(r,!1,i)}parseFunctionBodyAndFinish(r,n,i=!1){if(this.match(14)){let o=this.startNode();[o.typeAnnotation,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),r.returnType=o.typeAnnotation?this.finishNode(o,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(r,n,i)}parseStatementLike(r){if(this.state.strict&&this.isContextual(129)){let i=this.lookahead();if(va(i.type)){let o=this.startNode();return this.next(),this.flowParseInterface(o)}}else if(this.isContextual(126)){let i=this.startNode();return this.next(),this.flowParseEnumDeclaration(i)}let n=super.parseStatementLike(r);return this.flowPragma===void 0&&!this.isValidDirective(n)&&(this.flowPragma=null),n}parseExpressionStatement(r,n,i){if(n.type==="Identifier"){if(n.name==="declare"){if(this.match(80)||Ir(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(r)}else if(Ir(this.state.type)){if(n.name==="interface")return this.flowParseInterface(r);if(n.name==="type")return this.flowParseTypeAlias(r);if(n.name==="opaque")return this.flowParseOpaqueType(r,!1)}}return super.parseExpressionStatement(r,n,i)}shouldParseExportDeclaration(){let{type:r}=this.state;return r===126||iee(r)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:r}=this.state;return r===126||iee(r)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){let r=this.startNode();return this.next(),this.flowParseEnumDeclaration(r)}return super.parseExportDefaultExpression()}parseConditional(r,n,i){if(!this.match(17))return r;if(this.state.maybeInArrowParameters){let p=this.lookaheadCharCode();if(p===44||p===61||p===58||p===41)return this.setOptionalParametersError(i),r}this.expect(17);let o=this.state.clone(),s=this.state.noArrowAt,a=this.startNodeAt(n),{consequent:A,failed:c}=this.tryParseConditionalConsequent(),[u,l]=this.getArrowLikeExpressions(A);if(c||l.length>0){let p=[...s];if(l.length>0){this.state=o,this.state.noArrowAt=p;for(let g=0;g<l.length;g++)p.push(l[g].start);({consequent:A,failed:c}=this.tryParseConditionalConsequent()),[u,l]=this.getArrowLikeExpressions(A)}c&&u.length>1&&this.raise(tt.AmbiguousConditionalArrow,o.startLoc),c&&u.length===1&&(this.state=o,p.push(u[0].start),this.state.noArrowAt=p,{consequent:A,failed:c}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(A,!0),this.state.noArrowAt=s,this.expect(14),a.test=r,a.consequent=A,a.alternate=this.forwardNoArrowParamsConversionAt(a,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(a,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let r=this.parseMaybeAssignAllowIn(),n=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:r,failed:n}}getArrowLikeExpressions(r,n){let i=[r],o=[];for(;i.length!==0;){let s=i.pop();s.type==="ArrowFunctionExpression"&&s.body.type!=="BlockStatement"?(s.typeParameters||!s.returnType?this.finishArrowValidation(s):o.push(s),i.push(s.body)):s.type==="ConditionalExpression"&&(i.push(s.consequent),i.push(s.alternate))}return n?(o.forEach(s=>this.finishArrowValidation(s)),[o,[]]):d3e(o,s=>s.params.every(a=>this.isAssignable(a,!0)))}finishArrowValidation(r){var n;this.toAssignableList(r.params,(n=r.extra)==null?void 0:n.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(r,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(r,n){let i;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),i=n(),this.state.noArrowParamsConversionAt.pop()):i=n(),i}parseParenItem(r,n){let i=super.parseParenItem(r,n);if(this.eat(17)&&(i.optional=!0,this.resetEndLocation(r)),this.match(14)){let o=this.startNodeAt(n);return o.expression=i,o.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(o,"TypeCastExpression")}return i}assertModuleNodeAllowed(r){r.type==="ImportDeclaration"&&(r.importKind==="type"||r.importKind==="typeof")||r.type==="ExportNamedDeclaration"&&r.exportKind==="type"||r.type==="ExportAllDeclaration"&&r.exportKind==="type"||super.assertModuleNodeAllowed(r)}parseExportDeclaration(r){if(this.isContextual(130)){r.exportKind="type";let n=this.startNode();return this.next(),this.match(5)?(r.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(r),null):this.flowParseTypeAlias(n)}else if(this.isContextual(131)){r.exportKind="type";let n=this.startNode();return this.next(),this.flowParseOpaqueType(n,!1)}else if(this.isContextual(129)){r.exportKind="type";let n=this.startNode();return this.next(),this.flowParseInterface(n)}else if(this.isContextual(126)){r.exportKind="value";let n=this.startNode();return this.next(),this.flowParseEnumDeclaration(n)}else return super.parseExportDeclaration(r)}eatExportStar(r){return super.eatExportStar(r)?!0:this.isContextual(130)&&this.lookahead().type===55?(r.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(r){let{startLoc:n}=this.state,i=super.maybeParseExportNamespaceSpecifier(r);return i&&r.exportKind==="type"&&this.unexpected(n),i}parseClassId(r,n,i){super.parseClassId(r,n,i),this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(r,n,i){let{startLoc:o}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(r,n))return;n.declare=!0}super.parseClassMember(r,n,i),n.declare&&(n.type!=="ClassProperty"&&n.type!=="ClassPrivateProperty"&&n.type!=="PropertyDefinition"?this.raise(tt.DeclareClassElement,o):n.value&&this.raise(tt.DeclareClassFieldInitializer,n.value))}isIterator(r){return r==="iterator"||r==="asyncIterator"}readIterator(){let r=super.readWord1(),n="@@"+r;(!this.isIterator(r)||!this.state.inType)&&this.raise(q.InvalidIdentifier,this.state.curPosition(),{identifierName:n}),this.finishToken(132,n)}getTokenFromCode(r){let n=this.input.charCodeAt(this.state.pos+1);r===123&&n===124?this.finishOp(6,2):this.state.inType&&(r===62||r===60)?this.finishOp(r===62?48:47,1):this.state.inType&&r===63?n===46?this.finishOp(18,2):this.finishOp(17,1):A3e(r,n,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(r)}isAssignable(r,n){return r.type==="TypeCastExpression"?this.isAssignable(r.expression,n):super.isAssignable(r,n)}toAssignable(r,n=!1){!n&&r.type==="AssignmentExpression"&&r.left.type==="TypeCastExpression"&&(r.left=this.typeCastToParameter(r.left)),super.toAssignable(r,n)}toAssignableList(r,n,i){for(let o=0;o<r.length;o++){let s=r[o];s?.type==="TypeCastExpression"&&(r[o]=this.typeCastToParameter(s))}super.toAssignableList(r,n,i)}toReferencedList(r,n){for(let o=0;o<r.length;o++){var i;let s=r[o];s&&s.type==="TypeCastExpression"&&!((i=s.extra)!=null&&i.parenthesized)&&(r.length>1||!n)&&this.raise(tt.TypeCastInPattern,s.typeAnnotation)}return r}parseArrayLike(r,n,i){let o=super.parseArrayLike(r,n,i);return i!=null&&!this.state.maybeInArrowParameters&&this.toReferencedList(o.elements),o}isValidLVal(r,n,i,o){return r==="TypeCastExpression"||super.isValidLVal(r,n,i,o)}parseClassProperty(r){return this.match(14)&&(r.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(r)}parseClassPrivateProperty(r){return this.match(14)&&(r.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(r)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(r){return!this.match(14)&&super.isNonstaticConstructor(r)}pushClassMethod(r,n,i,o,s,a){if(n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(r,n,i,o,s,a),n.params&&s){let A=n.params;A.length>0&&this.isThisParam(A[0])&&this.raise(tt.ThisParamBannedInConstructor,n)}else if(n.type==="MethodDefinition"&&s&&n.value.params){let A=n.value.params;A.length>0&&this.isThisParam(A[0])&&this.raise(tt.ThisParamBannedInConstructor,n)}}pushClassPrivateMethod(r,n,i,o){n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(r,n,i,o)}parseClassSuper(r){if(super.parseClassSuper(r),r.superClass&&(this.match(47)||this.match(51))&&(r.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();let n=r.implements=[];do{let i=this.startNode();i.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?i.typeParameters=this.flowParseTypeParameterInstantiation():i.typeParameters=null,n.push(this.finishNode(i,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(r){super.checkGetterSetterParams(r);let n=this.getObjectOrClassMethodParams(r);if(n.length>0){let i=n[0];this.isThisParam(i)&&r.kind==="get"?this.raise(tt.GetterMayNotHaveThisParam,i):this.isThisParam(i)&&this.raise(tt.SetterMayNotHaveThisParam,i)}}parsePropertyNamePrefixOperator(r){r.variance=this.flowParseVariance()}parseObjPropValue(r,n,i,o,s,a,A){r.variance&&this.unexpected(r.variance.loc.start),delete r.variance;let c;this.match(47)&&!a&&(c=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());let u=super.parseObjPropValue(r,n,i,o,s,a,A);return c&&((u.value||u).typeParameters=c),u}parseFunctionParamType(r){return this.eat(17)&&(r.type!=="Identifier"&&this.raise(tt.PatternIsOptional,r),this.isThisParam(r)&&this.raise(tt.ThisParamMayNotBeOptional,r),r.optional=!0),this.match(14)?r.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(r)&&this.raise(tt.ThisParamAnnotationRequired,r),this.match(29)&&this.isThisParam(r)&&this.raise(tt.ThisParamNoDefault,r),this.resetEndLocation(r),r}parseMaybeDefault(r,n){let i=super.parseMaybeDefault(r,n);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(tt.TypeBeforeInitializer,i.typeAnnotation),i}checkImportReflection(r){super.checkImportReflection(r),r.module&&r.importKind!=="value"&&this.raise(tt.ImportReflectionHasImportType,r.specifiers[0].loc.start)}parseImportSpecifierLocal(r,n,i){n.local=oee(r)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),r.specifiers.push(this.finishImportSpecifier(n,i))}isPotentialImportPhase(r){if(super.isPotentialImportPhase(r))return!0;if(this.isContextual(130)){if(!r)return!0;let n=this.lookaheadCharCode();return n===123||n===42}return!r&&this.isContextual(87)}applyImportPhase(r,n,i,o){if(super.applyImportPhase(r,n,i,o),n){if(!i&&this.match(65))return;r.exportKind=i==="type"?i:"value"}else i==="type"&&this.match(55)&&this.unexpected(),r.importKind=i==="type"||i==="typeof"?i:"value"}parseImportSpecifier(r,n,i,o,s){let a=r.imported,A=null;a.type==="Identifier"&&(a.name==="type"?A="type":a.name==="typeof"&&(A="typeof"));let c=!1;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){let l=this.parseIdentifier(!0);A!==null&&!va(this.state.type)?(r.imported=l,r.importKind=A,r.local=this.cloneIdentifier(l)):(r.imported=a,r.importKind=null,r.local=this.parseIdentifier())}else{if(A!==null&&va(this.state.type))r.imported=this.parseIdentifier(!0),r.importKind=A;else{if(n)throw this.raise(q.ImportBindingIsString,r,{importName:a.value});r.imported=a,r.importKind=null}this.eatContextual(93)?r.local=this.parseIdentifier():(c=!0,r.local=this.cloneIdentifier(r.imported))}let u=oee(r);return i&&u&&this.raise(tt.ImportTypeShorthandOnlyInPureImport,r),(i||u)&&this.checkReservedType(r.local.name,r.local.loc.start,!0),c&&!i&&!u&&this.checkReservedWord(r.local.name,r.loc.start,!0,!0),this.finishImportSpecifier(r,"ImportSpecifier")}parseBindingAtom(){return this.state.type===78?this.parseIdentifier(!0):super.parseBindingAtom()}parseFunctionParams(r,n){let i=r.kind;i!=="get"&&i!=="set"&&this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(r,n)}parseVarId(r,n){super.parseVarId(r,n),this.match(14)&&(r.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(r.id))}parseAsyncArrowFromCallExpression(r,n){if(this.match(14)){let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,r.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=i}return super.parseAsyncArrowFromCallExpression(r,n)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(r,n){var i;let o=null,s;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(o=this.state.clone(),s=this.tryParse(()=>super.parseMaybeAssign(r,n),o),!s.error)return s.node;let{context:c}=this.state,u=c[c.length-1];(u===pr.j_oTag||u===pr.j_expr)&&c.pop()}if((i=s)!=null&&i.error||this.match(47)){var a,A;o=o||this.state.clone();let c,u=this.tryParse(p=>{var g;c=this.flowParseTypeParameterDeclaration();let d=this.forwardNoArrowParamsConversionAt(c,()=>{let h=super.parseMaybeAssign(r,n);return this.resetStartLocationFromNode(h,c),h});(g=d.extra)!=null&&g.parenthesized&&p();let f=this.maybeUnwrapTypeCastExpression(d);return f.type!=="ArrowFunctionExpression"&&p(),f.typeParameters=c,this.resetStartLocationFromNode(f,c),d},o),l=null;if(u.node&&this.maybeUnwrapTypeCastExpression(u.node).type==="ArrowFunctionExpression"){if(!u.error&&!u.aborted)return u.node.async&&this.raise(tt.UnexpectedTypeParameterBeforeAsyncArrowFunction,c),u.node;l=u.node}if((a=s)!=null&&a.node)return this.state=s.failState,s.node;if(l)return this.state=u.failState,l;throw(A=s)!=null&&A.thrown?s.error:u.thrown?u.error:this.raise(tt.UnexpectedTokenAfterTypeParameter,c)}return super.parseMaybeAssign(r,n)}parseArrow(r){if(this.match(14)){let n=this.tryParse(()=>{let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let o=this.startNode();return[o.typeAnnotation,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=i,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),o});if(n.thrown)return null;n.error&&(this.state=n.failState),r.returnType=n.node.typeAnnotation?this.finishNode(n.node,"TypeAnnotation"):null}return super.parseArrow(r)}shouldParseArrow(r){return this.match(14)||super.shouldParseArrow(r)}setArrowFunctionParameters(r,n){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start))?r.params=n:super.setArrowFunctionParameters(r,n)}checkParams(r,n,i,o=!0){if(!(i&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start)))){for(let s=0;s<r.params.length;s++)this.isThisParam(r.params[s])&&s>0&&this.raise(tt.ThisParamMustBeFirst,r.params[s]);super.checkParams(r,n,i,o)}}parseParenAndDistinguishExpression(r){return super.parseParenAndDistinguishExpression(r&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(r,n,i){if(r.type==="Identifier"&&r.name==="async"&&this.state.noArrowAt.includes(n.index)){this.next();let o=this.startNodeAt(n);o.callee=r,o.arguments=super.parseCallExpressionArguments(),r=this.finishNode(o,"CallExpression")}else if(r.type==="Identifier"&&r.name==="async"&&this.match(47)){let o=this.state.clone(),s=this.tryParse(A=>this.parseAsyncArrowWithTypeParameters(n)||A(),o);if(!s.error&&!s.aborted)return s.node;let a=this.tryParse(()=>super.parseSubscripts(r,n,i),o);if(a.node&&!a.error)return a.node;if(s.node)return this.state=s.failState,s.node;if(a.node)return this.state=a.failState,a.node;throw s.error||a.error}return super.parseSubscripts(r,n,i)}parseSubscript(r,n,i,o){if(this.match(18)&&this.isLookaheadToken_lt()){if(o.optionalChainMember=!0,i)return o.stop=!0,r;this.next();let s=this.startNodeAt(n);return s.callee=r,s.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),s.arguments=this.parseCallExpressionArguments(),s.optional=!0,this.finishCallExpression(s,!0)}else if(!i&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){let s=this.startNodeAt(n);s.callee=r;let a=this.tryParse(()=>(s.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),s.arguments=super.parseCallExpressionArguments(),o.optionalChainMember&&(s.optional=!1),this.finishCallExpression(s,o.optionalChainMember)));if(a.node)return a.error&&(this.state=a.failState),a.node}return super.parseSubscript(r,n,i,o)}parseNewCallee(r){super.parseNewCallee(r);let n=null;this.shouldParseTypes()&&this.match(47)&&(n=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),r.typeArguments=n}parseAsyncArrowWithTypeParameters(r){let n=this.startNodeAt(r);if(this.parseFunctionParams(n,!1),!!this.parseArrow(n))return super.parseArrowExpression(n,void 0,!0)}readToken_mult_modulo(r){let n=this.input.charCodeAt(this.state.pos+1);if(r===42&&n===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(r)}readToken_pipe_amp(r){let n=this.input.charCodeAt(this.state.pos+1);if(r===124&&n===125){this.finishOp(9,2);return}super.readToken_pipe_amp(r)}parseTopLevel(r,n){let i=super.parseTopLevel(r,n);return this.state.hasFlowComment&&this.raise(tt.UnterminatedFlowComment,this.state.curPosition()),i}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(tt.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();let r=this.skipFlowComment();r&&(this.state.pos+=r,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){let{pos:r}=this.state,n=2;for(;[32,9].includes(this.input.charCodeAt(r+n));)n++;let i=this.input.charCodeAt(n+r),o=this.input.charCodeAt(n+r+1);return i===58&&o===58?n+2:this.input.slice(n+r,n+r+12)==="flow-include"?n+12:i===58&&o!==58?n:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(q.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(r,{enumName:n,memberName:i}){this.raise(tt.EnumBooleanMemberNotInitialized,r,{memberName:i,enumName:n})}flowEnumErrorInvalidMemberInitializer(r,n){return this.raise(n.explicitType?n.explicitType==="symbol"?tt.EnumInvalidMemberInitializerSymbolType:tt.EnumInvalidMemberInitializerPrimaryType:tt.EnumInvalidMemberInitializerUnknownType,r,n)}flowEnumErrorNumberMemberNotInitialized(r,n){this.raise(tt.EnumNumberMemberNotInitialized,r,n)}flowEnumErrorStringMemberInconsistentlyInitialized(r,n){this.raise(tt.EnumStringMemberInconsistentlyInitialized,r,n)}flowEnumMemberInit(){let r=this.state.startLoc,n=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{let i=this.parseNumericLiteral(this.state.value);return n()?{type:"number",loc:i.loc.start,value:i}:{type:"invalid",loc:r}}case 134:{let i=this.parseStringLiteral(this.state.value);return n()?{type:"string",loc:i.loc.start,value:i}:{type:"invalid",loc:r}}case 85:case 86:{let i=this.parseBooleanLiteral(this.match(85));return n()?{type:"boolean",loc:i.loc.start,value:i}:{type:"invalid",loc:r}}default:return{type:"invalid",loc:r}}}flowEnumMemberRaw(){let r=this.state.startLoc,n=this.parseIdentifier(!0),i=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:r};return{id:n,init:i}}flowEnumCheckExplicitTypeMismatch(r,n,i){let{explicitType:o}=n;o!==null&&o!==i&&this.flowEnumErrorInvalidMemberInitializer(r,n)}flowEnumMembers({enumName:r,explicitType:n}){let i=new Set,o={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},s=!1;for(;!this.match(8);){if(this.eat(21)){s=!0;break}let a=this.startNode(),{id:A,init:c}=this.flowEnumMemberRaw(),u=A.name;if(u==="")continue;/^[a-z]/.test(u)&&this.raise(tt.EnumInvalidMemberName,A,{memberName:u,suggestion:u[0].toUpperCase()+u.slice(1),enumName:r}),i.has(u)&&this.raise(tt.EnumDuplicateMemberName,A,{memberName:u,enumName:r}),i.add(u);let l={enumName:r,explicitType:n,memberName:u};switch(a.id=A,c.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(c.loc,l,"boolean"),a.init=c.value,o.booleanMembers.push(this.finishNode(a,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(c.loc,l,"number"),a.init=c.value,o.numberMembers.push(this.finishNode(a,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(c.loc,l,"string"),a.init=c.value,o.stringMembers.push(this.finishNode(a,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(c.loc,l);case"none":switch(n){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(c.loc,l);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(c.loc,l);break;default:o.defaultedMembers.push(this.finishNode(a,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:o,hasUnknownMembers:s}}flowEnumStringMembers(r,n,{enumName:i}){if(r.length===0)return n;if(n.length===0)return r;if(n.length>r.length){for(let o of r)this.flowEnumErrorStringMemberInconsistentlyInitialized(o,{enumName:i});return n}else{for(let o of n)this.flowEnumErrorStringMemberInconsistentlyInitialized(o,{enumName:i});return r}}flowEnumParseExplicitType({enumName:r}){if(!this.eatContextual(102))return null;if(!Ir(this.state.type))throw this.raise(tt.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:r});let{value:n}=this.state;return this.next(),n!=="boolean"&&n!=="number"&&n!=="string"&&n!=="symbol"&&this.raise(tt.EnumInvalidExplicitType,this.state.startLoc,{enumName:r,invalidEnumType:n}),n}flowEnumBody(r,n){let i=n.name,o=n.loc.start,s=this.flowEnumParseExplicitType({enumName:i});this.expect(5);let{members:a,hasUnknownMembers:A}=this.flowEnumMembers({enumName:i,explicitType:s});switch(r.hasUnknownMembers=A,s){case"boolean":return r.explicitType=!0,r.members=a.booleanMembers,this.expect(8),this.finishNode(r,"EnumBooleanBody");case"number":return r.explicitType=!0,r.members=a.numberMembers,this.expect(8),this.finishNode(r,"EnumNumberBody");case"string":return r.explicitType=!0,r.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(r,"EnumStringBody");case"symbol":return r.members=a.defaultedMembers,this.expect(8),this.finishNode(r,"EnumSymbolBody");default:{let c=()=>(r.members=[],this.expect(8),this.finishNode(r,"EnumStringBody"));r.explicitType=!1;let u=a.booleanMembers.length,l=a.numberMembers.length,p=a.stringMembers.length,g=a.defaultedMembers.length;if(!u&&!l&&!p&&!g)return c();if(!u&&!l)return r.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(r,"EnumStringBody");if(!l&&!p&&u>=g){for(let d of a.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(d.loc.start,{enumName:i,memberName:d.id.name});return r.members=a.booleanMembers,this.expect(8),this.finishNode(r,"EnumBooleanBody")}else if(!u&&!p&&l>=g){for(let d of a.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(d.loc.start,{enumName:i,memberName:d.id.name});return r.members=a.numberMembers,this.expect(8),this.finishNode(r,"EnumNumberBody")}else return this.raise(tt.EnumInconsistentMemberValues,o,{enumName:i}),c()}}}flowParseEnumDeclaration(r){let n=this.parseIdentifier();return r.id=n,r.body=this.flowEnumBody(this.startNode(),n),this.finishNode(r,"EnumDeclaration")}jsxParseOpeningElementAfterName(r){return this.shouldParseTypes()&&(this.match(47)||this.match(51))&&(r.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(r)}isLookaheadToken_lt(){let r=this.nextTokenStart();if(this.input.charCodeAt(r)===60){let n=this.input.charCodeAt(r+1);return n!==60&&n!==61}return!1}reScan_lt_gt(){let{type:r}=this.state;r===47?(this.state.pos-=1,this.readToken_lt()):r===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:r}=this.state;return r===51?(this.state.pos-=2,this.finishOp(47,1),47):r}maybeUnwrapTypeCastExpression(r){return r.type==="TypeCastExpression"?r.expression:r}},h3e={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},C3e=/\r\n|[\r\n\u2028\u2029]/,bw=new RegExp(C3e.source,"g");function cf(t){switch(t){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function see(t,e,r){for(let n=e;n<r;n++)if(cf(t.charCodeAt(n)))return!0;return!1}var UM=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,OM=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function I3e(t){switch(t){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}var Yg=xA`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:t})=>`Expected corresponding JSX closing tag for <${t}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:t,HTMLEntity:e})=>`Unexpected token \`${t}\`. Did you mean \`${e}\` or \`{'${t}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"});function Xu(t){return t?t.type==="JSXOpeningFragment"||t.type==="JSXClosingFragment":!1}function Af(t){if(t.type==="JSXIdentifier")return t.name;if(t.type==="JSXNamespacedName")return t.namespace.name+":"+t.name.name;if(t.type==="JSXMemberExpression")return Af(t.object)+"."+Af(t.property);throw new Error("Node had unexpected type: "+t.type)}var E3e=t=>class extends t{jsxReadToken(){let r="",n=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Yg.UnterminatedJsxContent,this.state.startLoc);let i=this.input.charCodeAt(this.state.pos);switch(i){case 60:case 123:if(this.state.pos===this.state.start){i===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):super.getTokenFromCode(i);return}r+=this.input.slice(n,this.state.pos),this.finishToken(142,r);return;case 38:r+=this.input.slice(n,this.state.pos),r+=this.jsxReadEntity(),n=this.state.pos;break;default:cf(i)?(r+=this.input.slice(n,this.state.pos),r+=this.jsxReadNewLine(!0),n=this.state.pos):++this.state.pos}}}jsxReadNewLine(r){let n=this.input.charCodeAt(this.state.pos),i;return++this.state.pos,n===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,i=r?`
|
|
1113
1113
|
`:`\r
|
|
@@ -1256,7 +1256,7 @@ The "grep_search" tool can be used to find the relevant part lines of a file.`)}
|
|
|
1256
1256
|
`);for(let l=0;l<u.length-1;l++)yield u[l];r=u[u.length-1]}}catch(c){throw c}finally{a&&clearTimeout(a);try{n.releaseLock()}catch(c){console.error("Error releasing lock",c)}}}var sb=N(()=>{"use strict";m()});function Xie(t){if(!t||typeof t!="string")return!1;let e=t.trim();return e.startsWith("---")&&e.indexOf("---",3)>3}function Wie(t){if(t.length>=2&&t.startsWith('"')){let r=1;for(;r<t.length;)if(t[r]==="\\")r+=2;else{if(t[r]==='"')break;r++}if(r<t.length){let n=t.substring(0,r+1);try{return JSON.parse(n)}catch{return n.slice(1,-1)}}return t.slice(1)}if(t.length>=2&&t.startsWith("'")){let r=1;for(;r<t.length;)if(t[r]==="'"&&r+1<t.length&&t[r+1]==="'")r+=2;else{if(t[r]==="'")break;r++}return r<t.length?t.substring(1,r).replace(/''/g,"'"):t.slice(1)}let e=t.indexOf("#");return e!==-1?t.substring(0,e).trim():t}function Zie(t,e){if(e==="|")return t.join(`
|
|
1257
1257
|
`).trimEnd();let r=[],n=[];for(let i of t)i===""?n.length>0&&(r.push(n.join(" ")),n=[]):n.push(i);return n.length>0&&r.push(n.join(" ")),r.join(`
|
|
1258
1258
|
`).trim()}function l9e(t){let e={},r=null,n=[],i=null,o=null,s=[];for(let a of t.split(`
|
|
1259
|
-
`)){let A=a.trim();if(i!==null){if(a.startsWith(" ")||a.startsWith(" ")||A===""){s.push(A);continue}e[i]=Zie(s,o),i=null,o=null,s=[]}if(!A||A.startsWith("#"))continue;if(A.startsWith("-")){let u=A.substring(1).trim();r&&n.push(Wie(u));continue}let c=a.indexOf(":");if(c!==-1){r&&n.length>0&&(e[r]=n,n=[]);let u=a.substring(0,c).trim(),l=a.substring(c+1).trim();if(/^[>|][+-]?$/.test(l)){i=u,o=l[0],s=[],r=null;continue}let p=l?Wie(l):"";r=u,p&&(e[u]=p,r=null)}}return i!==null&&(e[i]=Zie(s,o)),r&&n.length>0&&(e[r]=n),e}function g9e(t){if(!Xie(t))return null;let e=t.split(/^---$/m);if(e.length<3)return null;let r=e[1].trim(),n=e.slice(2).join("---").trim();return{frontmatterContent:r,body:n}}function Gf(t){let e=g9e(t);return e?{frontmatter:l9e(e.frontmatterContent),body:e.body}:{frontmatter:{},body:t.trim()}}var ab=N(()=>{"use strict";m()});function eoe(t){let e=t.replace(/"/g,"");return e=e.trim(),e}function toe(t,e,r){try{if(!t||!t.trim())return null;let n;e.startsWith("https://")||e.startsWith("http://")?n=tE.default.basename(new URL(e).pathname):n=tE.default.basename(e);let i,o=n.toUpperCase();if(o==="SKILL.MD"||o==="RULE.MD"){let C=tE.default.dirname(e);i=tE.default.basename(C)}else i=n.split(".")[0];let s=i,a=Gf(t);if(!a.frontmatter||Object.keys(a.frontmatter).length===0)return{id:r?`hash-${r(t)}`:`hash-${Date.now()}`,name:eoe(s),content:t.trim(),filePath:e};let A=a.body;if(!A)return null;let c=eoe(a.frontmatter.name||s),u="agent-mode";if(a.frontmatter.type)u=a.frontmatter.type;else if(a.frontmatter.alwaysApply!==void 0){let C=a.frontmatter.alwaysApply;u=C===!0||C==="true"?"always":"agent-mode"}let l=a.frontmatter.glob||a.frontmatter.globs||a.frontmatter.paths,p=Array.isArray(l)?l.join(","):l,g;if(a.frontmatter["allowed-tools"]){let C=a.frontmatter["allowed-tools"].trim();C&&(g=C.split(",").map(I=>I.trim()).filter(I=>I.length>0))}let d=r?`hash-${r(t)}`:`hash-${Date.now()}`,f=a.frontmatter["disable-model-invocation"]==="true"?!0:void 0,h=a.frontmatter["user-invocable"]==="false"?!1:void 0;return{id:d,name:c,content:A,description:a.frontmatter.description,filePath:e,glob:p,type:u,allowedTools:g,disableModelInvocation:f,userInvocable:h}}catch{return null}}var tE,roe=N(()=>{"use strict";m();tE=z(require("node:path"),1);ab()});function T1(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)k1(i);let e=t.some(({readableObjectMode:i})=>i),r=p9e(t,e),n=new F1({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return t.length===0&&Aoe(n),n}var cb,ooe,N1,p9e,F1,d9e,f9e,m9e,k1,h9e,soe,C9e,I9e,E9e,aoe,Aoe,R1,coe,B9e,Ab,noe,ioe,uoe=N(()=>{m();cb=require("node:events"),ooe=require("node:stream"),N1=require("node:stream/promises");p9e=(t,e)=>{if(t.length===0)return 16384;let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},F1=class extends ooe.PassThrough{#r=new Set([]);#c=new Set([]);#o=new Set([]);#t;add(e){k1(e),!this.#r.has(e)&&(this.#r.add(e),this.#t??=d9e(this,this.#r),h9e({passThroughStream:this,stream:e,streams:this.#r,ended:this.#c,aborted:this.#o,onFinished:this.#t}),e.pipe(this,{end:!1}))}remove(e){return k1(e),this.#r.has(e)?(e.unpipe(this),!0):!1}},d9e=async(t,e)=>{Ab(t,noe);let r=new AbortController;try{await Promise.race([f9e(t,r),m9e(t,e,r)])}finally{r.abort(),Ab(t,-noe)}},f9e=async(t,{signal:e})=>{await(0,N1.finished)(t,{signal:e,cleanup:!0})},m9e=async(t,e,{signal:r})=>{for await(let[n]of(0,cb.on)(t,"unpipe",{signal:r}))e.has(n)&&n.emit(aoe)},k1=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},h9e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o})=>{Ab(t,ioe);let s=new AbortController;try{await Promise.race([C9e(o,e),I9e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:s}),E9e({stream:e,streams:r,ended:n,aborted:i,controller:s})])}finally{s.abort(),Ab(t,-ioe)}r.size===n.size+i.size&&(n.size===0&&i.size>0?R1(t):Aoe(t))},soe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",C9e=async(t,e)=>{try{await t,R1(e)}catch(r){soe(r)?R1(e):coe(e,r)}},I9e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await(0,N1.finished)(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;soe(s)?i.add(e):coe(t,s)}},E9e=async({stream:t,streams:e,ended:r,aborted:n,controller:{signal:i}})=>{await(0,cb.once)(t,aoe,{signal:i}),e.delete(t),r.delete(t),n.delete(t)},aoe=Symbol("unpipe"),Aoe=t=>{t.writable&&t.end()},R1=t=>{(t.readable||t.writable)&&t.destroy()},coe=(t,e)=>{t.destroyed||(t.once("error",B9e),t.destroy(e))},B9e=()=>{},Ab=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},noe=2,ioe=1});var loe=k(Kf=>{"use strict";m();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.splitWhen=Kf.flatten=void 0;function y9e(t){return t.reduce((e,r)=>[].concat(e,r),[])}Kf.flatten=y9e;function Q9e(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}Kf.splitWhen=Q9e});var goe=k(ub=>{"use strict";m();Object.defineProperty(ub,"__esModule",{value:!0});ub.isEnoentCodeError=void 0;function D9e(t){return t.code==="ENOENT"}ub.isEnoentCodeError=D9e});var poe=k(lb=>{"use strict";m();Object.defineProperty(lb,"__esModule",{value:!0});lb.createDirentFromStats=void 0;var M1=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function w9e(t,e){return new M1(t,e)}lb.createDirentFromStats=w9e});var hoe=k(On=>{"use strict";m();Object.defineProperty(On,"__esModule",{value:!0});On.convertPosixPathToPattern=On.convertWindowsPathToPattern=On.convertPathToPattern=On.escapePosixPath=On.escapeWindowsPath=On.escape=On.removeLeadingDotSegment=On.makeAbsolute=On.unixify=void 0;var b9e=require("os"),v9e=require("path"),doe=b9e.platform()==="win32",S9e=2,x9e=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,F9e=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,k9e=/^\\\\([.?])/,R9e=/\\(?![!()+@[\]{}])/g;function N9e(t){return t.replace(/\\/g,"/")}On.unixify=N9e;function T9e(t,e){return v9e.resolve(t,e)}On.makeAbsolute=T9e;function M9e(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(S9e)}return t}On.removeLeadingDotSegment=M9e;On.escape=doe?P1:_1;function P1(t){return t.replace(F9e,"\\$2")}On.escapeWindowsPath=P1;function _1(t){return t.replace(x9e,"\\$2")}On.escapePosixPath=_1;On.convertPathToPattern=doe?foe:moe;function foe(t){return P1(t).replace(k9e,"//$1").replace(R9e,"/")}On.convertWindowsPathToPattern=foe;function moe(t){return _1(t)}On.convertPosixPathToPattern=moe});var Ioe=k((l$t,Coe)=>{m();Coe.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var yoe=k((p$t,Boe)=>{m();var P9e=Ioe(),Eoe={"{":"}","(":")","[":"]"},_9e=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,o=-2,s=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(s===-1||s>n||(s=t.indexOf("\\",e),s===-1||s>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(s=t.indexOf("\\",e),s===-1||s>i))||o!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(o=t.indexOf(")",e),o>e&&(s=t.indexOf("\\",e),s===-1||s>o))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(o=t.indexOf(")",r),o>r&&(s=t.indexOf("\\",r),s===-1||s>o))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var A=Eoe[a];if(A){var c=t.indexOf(A,e);c!==-1&&(e=c+1)}if(t[e]==="!")return!0}else e++}return!1},L9e=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=Eoe[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};Boe.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(P9e(e))return!0;var n=_9e;return r&&r.strict===!1&&(n=L9e),n(e)}});var Doe=k((f$t,Qoe)=>{"use strict";m();var U9e=yoe(),O9e=require("path").posix.dirname,G9e=require("os").platform()==="win32",L1="/",K9e=/\\/g,H9e=/[\{\[].*[\}\]]$/,$9e=/(^|[^\\])([\{\[]|\([^\)]+$)/,J9e=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Qoe.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&G9e&&e.indexOf(L1)<0&&(e=e.replace(K9e,L1)),H9e.test(e)&&(e+=L1),e+="a";do e=O9e(e);while(U9e(e)||$9e.test(e));return e.replace(J9e,"$1")}});var gb=k(Ps=>{"use strict";m();Ps.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Ps.find=(t,e)=>t.nodes.find(r=>r.type===e);Ps.exceedsLimit=(t,e,r=1,n)=>n===!1||!Ps.isInteger(t)||!Ps.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Ps.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};Ps.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Ps.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Ps.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Ps.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Ps.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let o=n[i];if(Array.isArray(o)){r(o);continue}o!==void 0&&e.push(o)}return e};return r(t),e}});var pb=k((I$t,boe)=>{"use strict";m();var woe=gb();boe.exports=(t,e={})=>{let r=(n,i={})=>{let o=e.escapeInvalid&&woe.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(o||s)&&woe.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let A of n.nodes)a+=r(A);return a};return r(t)}});var Soe=k((B$t,voe)=>{"use strict";m();voe.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var _oe=k((Q$t,Poe)=>{"use strict";m();var xoe=Soe(),cp=(t,e,r)=>{if(xoe(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(xoe(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),o=String(n.shorthand),s=String(n.capture),a=String(n.wrap),A=t+":"+e+"="+i+o+s+a;if(cp.cache.hasOwnProperty(A))return cp.cache[A].result;let c=Math.min(t,e),u=Math.max(t,e);if(Math.abs(c-u)===1){let f=t+"|"+e;return n.capture?`(${f})`:n.wrap===!1?f:`(?:${f})`}let l=Moe(t)||Moe(e),p={min:t,max:e,a:c,b:u},g=[],d=[];if(l&&(p.isPadded=l,p.maxLen=String(p.max).length),c<0){let f=u<0?Math.abs(u):1;d=Foe(f,Math.abs(c),p,n),c=p.a=0}return u>=0&&(g=Foe(c,u,p,n)),p.negatives=d,p.positives=g,p.result=j9e(d,g,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&g.length+d.length>1&&(p.result=`(?:${p.result})`),cp.cache[A]=p,p.result};function j9e(t,e,r){let n=U1(t,e,"-",!1,r)||[],i=U1(e,t,"",!1,r)||[],o=U1(t,e,"-?",!0,r)||[];return n.concat(o).concat(i).join("|")}function Y9e(t,e){let r=1,n=1,i=Roe(t,r),o=new Set([e]);for(;t<=i&&i<=e;)o.add(i),r+=1,i=Roe(t,r);for(i=Noe(e+1,n)-1;t<i&&i<=e;)o.add(i),n+=1,i=Noe(e+1,n)-1;return o=[...o],o.sort(z9e),o}function q9e(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=V9e(t,e),i=n.length,o="",s=0;for(let a=0;a<i;a++){let[A,c]=n[a];A===c?o+=A:A!=="0"||c!=="9"?o+=W9e(A,c,r):s++}return s&&(o+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[s],digits:i}}function Foe(t,e,r,n){let i=Y9e(t,e),o=[],s=t,a;for(let A=0;A<i.length;A++){let c=i[A],u=q9e(String(s),String(c),n),l="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+Toe(a.count),s=c+1;continue}r.isPadded&&(l=Z9e(c,r,n)),u.string=l+u.pattern+Toe(u.count),o.push(u),s=c+1,a=u}return o}function U1(t,e,r,n,i){let o=[];for(let s of t){let{string:a}=s;!n&&!koe(e,"string",a)&&o.push(r+a),n&&koe(e,"string",a)&&o.push(r+a)}return o}function V9e(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function z9e(t,e){return t>e?1:e>t?-1:0}function koe(t,e,r){return t.some(n=>n[e]===r)}function Roe(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function Noe(t,e){return t-t%Math.pow(10,e)}function Toe(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function W9e(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function Moe(t){return/^-?(0+)\d/.test(t)}function Z9e(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}cp.cache={};cp.clearCache=()=>cp.cache={};Poe.exports=cp});var K1=k((w$t,$oe)=>{"use strict";m();var X9e=require("util"),Uoe=_oe(),Loe=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),eYe=t=>e=>t===!0?Number(e):String(e),O1=t=>typeof t=="number"||typeof t=="string"&&t!=="",rE=t=>Number.isInteger(+t),G1=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},tYe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,rYe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},fb=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},nYe=(t,e,r)=>{t.negatives.sort((a,A)=>a<A?-1:a>A?1:0),t.positives.sort((a,A)=>a<A?-1:a>A?1:0);let n=e.capture?"":"?:",i="",o="",s;return t.positives.length&&(i=t.positives.map(a=>fb(String(a),r)).join("|")),t.negatives.length&&(o=`-(${n}${t.negatives.map(a=>fb(String(a),r)).join("|")})`),i&&o?s=`${i}|${o}`:s=i||o,e.wrap?`(${n}${s})`:s},Ooe=(t,e,r,n)=>{if(r)return Uoe(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let o=String.fromCharCode(e);return`[${i}-${o}]`},Goe=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return Uoe(t,e,r)},Koe=(...t)=>new RangeError("Invalid range arguments: "+X9e.inspect(...t)),Hoe=(t,e,r)=>{if(r.strictRanges===!0)throw Koe([t,e]);return[]},iYe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},oYe=(t,e,r=1,n={})=>{let i=Number(t),o=Number(e);if(!Number.isInteger(i)||!Number.isInteger(o)){if(n.strictRanges===!0)throw Koe([t,e]);return[]}i===0&&(i=0),o===0&&(o=0);let s=i>o,a=String(t),A=String(e),c=String(r);r=Math.max(Math.abs(r),1);let u=G1(a)||G1(A)||G1(c),l=u?Math.max(a.length,A.length,c.length):0,p=u===!1&&tYe(t,e,n)===!1,g=n.transform||eYe(p);if(n.toRegex&&r===1)return Ooe(fb(t,l),fb(e,l),!0,n);let d={negatives:[],positives:[]},f=I=>d[I<0?"negatives":"positives"].push(Math.abs(I)),h=[],C=0;for(;s?i>=o:i<=o;)n.toRegex===!0&&r>1?f(i):h.push(rYe(g(i,C),l,p)),i=s?i-r:i+r,C++;return n.toRegex===!0?r>1?nYe(d,n,l):Goe(h,null,{wrap:!1,...n}):h},sYe=(t,e,r=1,n={})=>{if(!rE(t)&&t.length>1||!rE(e)&&e.length>1)return Hoe(t,e,n);let i=n.transform||(p=>String.fromCharCode(p)),o=`${t}`.charCodeAt(0),s=`${e}`.charCodeAt(0),a=o>s,A=Math.min(o,s),c=Math.max(o,s);if(n.toRegex&&r===1)return Ooe(A,c,!1,n);let u=[],l=0;for(;a?o>=s:o<=s;)u.push(i(o,l)),o=a?o-r:o+r,l++;return n.toRegex===!0?Goe(u,null,{wrap:!1,options:n}):u},db=(t,e,r,n={})=>{if(e==null&&O1(t))return[t];if(!O1(t)||!O1(e))return Hoe(t,e,n);if(typeof r=="function")return db(t,e,1,{transform:r});if(Loe(r))return db(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,rE(r)?rE(t)&&rE(e)?oYe(t,e,r,i):sYe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!Loe(r)?iYe(r,i):db(t,e,1,r)};$oe.exports=db});var Yoe=k((v$t,joe)=>{"use strict";m();var aYe=K1(),Joe=gb(),AYe=(t,e={})=>{let r=(n,i={})=>{let o=Joe.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a=o===!0||s===!0,A=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return A+n.value;if(n.isClose===!0)return console.log("node.isClose",A,n.value),A+n.value;if(n.type==="open")return a?A+n.value:"(";if(n.type==="close")return a?A+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=Joe.reduce(n.nodes),l=aYe(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(l.length!==0)return u.length>1&&l.length>1?`(${l})`:l}if(n.nodes)for(let u of n.nodes)c+=r(u,n);return c};return r(t)};joe.exports=AYe});var zoe=k((x$t,Voe)=>{"use strict";m();var cYe=K1(),qoe=pb(),Hf=gb(),up=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?Hf.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let o of i)n.push(up(o,e,r));else for(let o of e)r===!0&&typeof o=="string"&&(o=`{${o}}`),n.push(Array.isArray(o)?up(i,o,r):i+o);return Hf.flatten(n)},uYe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,o={})=>{i.queue=[];let s=o,a=o.queue;for(;s.type!=="brace"&&s.type!=="root"&&s.parent;)s=s.parent,a=s.queue;if(i.invalid||i.dollar){a.push(up(a.pop(),qoe(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(up(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let l=Hf.reduce(i.nodes);if(Hf.exceedsLimit(...l,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=cYe(...l,e);p.length===0&&(p=qoe(i,e)),a.push(up(a.pop(),p)),i.nodes=[];return}let A=Hf.encloseBrace(i),c=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,c=u.queue;for(let l=0;l<i.nodes.length;l++){let p=i.nodes[l];if(p.type==="comma"&&i.type==="brace"){l===1&&c.push(""),c.push("");continue}if(p.type==="close"){a.push(up(a.pop(),c,A));continue}if(p.value&&p.type!=="open"){c.push(up(c.pop(),p.value));continue}p.nodes&&n(p,i)}return c};return Hf.flatten(n(t))};Voe.exports=uYe});var Zoe=k((k$t,Woe)=>{"use strict";m();Woe.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
1259
|
+
`)){let A=a.trim();if(i!==null){if(a.startsWith(" ")||a.startsWith(" ")||A===""){s.push(A);continue}e[i]=Zie(s,o),i=null,o=null,s=[]}if(!A||A.startsWith("#"))continue;if(A.startsWith("-")){let u=A.substring(1).trim();r&&n.push(Wie(u));continue}let c=a.indexOf(":");if(c!==-1){r&&n.length>0&&(e[r]=n,n=[]);let u=a.substring(0,c).trim(),l=a.substring(c+1).trim();if(/^[>|][+-]?$/.test(l)){i=u,o=l[0],s=[],r=null;continue}let p=l?Wie(l):"";r=u,p&&(e[u]=p,r=null)}}return i!==null&&(e[i]=Zie(s,o)),r&&n.length>0&&(e[r]=n),e}function g9e(t){if(!Xie(t))return null;let e=t.split(/^---$/m);if(e.length<3)return null;let r=e[1].trim(),n=e.slice(2).join("---").trim();return{frontmatterContent:r,body:n}}function Gf(t){let e=g9e(t);return e?{frontmatter:l9e(e.frontmatterContent),body:e.body}:{frontmatter:{},body:t.trim()}}var ab=N(()=>{"use strict";m()});function eoe(t){let e=t.replace(/"/g,"");return e=e.trim(),e}function toe(t,e,r){try{if(!t||!t.trim())return null;let n;e.startsWith("https://")||e.startsWith("http://")?n=tE.default.basename(new URL(e).pathname):n=tE.default.basename(e);let i,o=n.toUpperCase();if(o==="SKILL.MD"||o==="RULE.MD"){let C=tE.default.dirname(e);i=tE.default.basename(C)}else i=n.split(".")[0];let s=i,a=Gf(t);if(!a.frontmatter||Object.keys(a.frontmatter).length===0)return{id:r?`hash-${r(t)}`:`hash-${Date.now()}`,name:eoe(s),content:t.trim(),filePath:e};let A=a.body;if(!A)return null;let c=eoe(a.frontmatter.name||s),u="agent-mode";if(a.frontmatter.type)u=a.frontmatter.type;else if(a.frontmatter.alwaysApply!==void 0){let C=a.frontmatter.alwaysApply;u=C===!0||C==="true"?"always":"agent-mode"}let l=a.frontmatter.glob||a.frontmatter.globs||a.frontmatter.paths,p=Array.isArray(l)?l.join(","):l,g;if(a.frontmatter["allowed-tools"]){let C=a.frontmatter["allowed-tools"].trim();C&&(g=C.split(",").map(I=>I.trim()).filter(I=>I.length>0))}let d=r?`hash-${r(t)}`:`hash-${Date.now()}`,f=a.frontmatter["disable-model-invocation"]==="true"?!0:void 0,h=a.frontmatter["user-invocable"]==="false"?!1:void 0;return{id:d,name:c,content:A,description:a.frontmatter.description,filePath:e,glob:p,type:u,allowedTools:g,disableModelInvocation:f,userInvocable:h}}catch{return null}}var tE,roe=N(()=>{"use strict";m();tE=z(require("node:path"),1);ab()});function T1(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)k1(i);let e=t.some(({readableObjectMode:i})=>i),r=p9e(t,e),n=new F1({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return t.length===0&&Aoe(n),n}var cb,ooe,N1,p9e,F1,d9e,f9e,m9e,k1,h9e,soe,C9e,I9e,E9e,aoe,Aoe,R1,coe,B9e,Ab,noe,ioe,uoe=N(()=>{m();cb=require("node:events"),ooe=require("node:stream"),N1=require("node:stream/promises");p9e=(t,e)=>{if(t.length===0)return 16384;let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},F1=class extends ooe.PassThrough{#n=new Set([]);#c=new Set([]);#o=new Set([]);#t;add(e){k1(e),!this.#n.has(e)&&(this.#n.add(e),this.#t??=d9e(this,this.#n),h9e({passThroughStream:this,stream:e,streams:this.#n,ended:this.#c,aborted:this.#o,onFinished:this.#t}),e.pipe(this,{end:!1}))}remove(e){return k1(e),this.#n.has(e)?(e.unpipe(this),!0):!1}},d9e=async(t,e)=>{Ab(t,noe);let r=new AbortController;try{await Promise.race([f9e(t,r),m9e(t,e,r)])}finally{r.abort(),Ab(t,-noe)}},f9e=async(t,{signal:e})=>{await(0,N1.finished)(t,{signal:e,cleanup:!0})},m9e=async(t,e,{signal:r})=>{for await(let[n]of(0,cb.on)(t,"unpipe",{signal:r}))e.has(n)&&n.emit(aoe)},k1=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},h9e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o})=>{Ab(t,ioe);let s=new AbortController;try{await Promise.race([C9e(o,e),I9e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:s}),E9e({stream:e,streams:r,ended:n,aborted:i,controller:s})])}finally{s.abort(),Ab(t,-ioe)}r.size===n.size+i.size&&(n.size===0&&i.size>0?R1(t):Aoe(t))},soe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",C9e=async(t,e)=>{try{await t,R1(e)}catch(r){soe(r)?R1(e):coe(e,r)}},I9e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await(0,N1.finished)(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;soe(s)?i.add(e):coe(t,s)}},E9e=async({stream:t,streams:e,ended:r,aborted:n,controller:{signal:i}})=>{await(0,cb.once)(t,aoe,{signal:i}),e.delete(t),r.delete(t),n.delete(t)},aoe=Symbol("unpipe"),Aoe=t=>{t.writable&&t.end()},R1=t=>{(t.readable||t.writable)&&t.destroy()},coe=(t,e)=>{t.destroyed||(t.once("error",B9e),t.destroy(e))},B9e=()=>{},Ab=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},noe=2,ioe=1});var loe=k(Kf=>{"use strict";m();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.splitWhen=Kf.flatten=void 0;function y9e(t){return t.reduce((e,r)=>[].concat(e,r),[])}Kf.flatten=y9e;function Q9e(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}Kf.splitWhen=Q9e});var goe=k(ub=>{"use strict";m();Object.defineProperty(ub,"__esModule",{value:!0});ub.isEnoentCodeError=void 0;function D9e(t){return t.code==="ENOENT"}ub.isEnoentCodeError=D9e});var poe=k(lb=>{"use strict";m();Object.defineProperty(lb,"__esModule",{value:!0});lb.createDirentFromStats=void 0;var M1=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function w9e(t,e){return new M1(t,e)}lb.createDirentFromStats=w9e});var hoe=k(On=>{"use strict";m();Object.defineProperty(On,"__esModule",{value:!0});On.convertPosixPathToPattern=On.convertWindowsPathToPattern=On.convertPathToPattern=On.escapePosixPath=On.escapeWindowsPath=On.escape=On.removeLeadingDotSegment=On.makeAbsolute=On.unixify=void 0;var b9e=require("os"),v9e=require("path"),doe=b9e.platform()==="win32",S9e=2,x9e=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,F9e=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,k9e=/^\\\\([.?])/,R9e=/\\(?![!()+@[\]{}])/g;function N9e(t){return t.replace(/\\/g,"/")}On.unixify=N9e;function T9e(t,e){return v9e.resolve(t,e)}On.makeAbsolute=T9e;function M9e(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(S9e)}return t}On.removeLeadingDotSegment=M9e;On.escape=doe?P1:_1;function P1(t){return t.replace(F9e,"\\$2")}On.escapeWindowsPath=P1;function _1(t){return t.replace(x9e,"\\$2")}On.escapePosixPath=_1;On.convertPathToPattern=doe?foe:moe;function foe(t){return P1(t).replace(k9e,"//$1").replace(R9e,"/")}On.convertWindowsPathToPattern=foe;function moe(t){return _1(t)}On.convertPosixPathToPattern=moe});var Ioe=k((l$t,Coe)=>{m();Coe.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var yoe=k((p$t,Boe)=>{m();var P9e=Ioe(),Eoe={"{":"}","(":")","[":"]"},_9e=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,o=-2,s=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(s===-1||s>n||(s=t.indexOf("\\",e),s===-1||s>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(s=t.indexOf("\\",e),s===-1||s>i))||o!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(o=t.indexOf(")",e),o>e&&(s=t.indexOf("\\",e),s===-1||s>o))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(o=t.indexOf(")",r),o>r&&(s=t.indexOf("\\",r),s===-1||s>o))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var A=Eoe[a];if(A){var c=t.indexOf(A,e);c!==-1&&(e=c+1)}if(t[e]==="!")return!0}else e++}return!1},L9e=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=Eoe[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};Boe.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(P9e(e))return!0;var n=_9e;return r&&r.strict===!1&&(n=L9e),n(e)}});var Doe=k((f$t,Qoe)=>{"use strict";m();var U9e=yoe(),O9e=require("path").posix.dirname,G9e=require("os").platform()==="win32",L1="/",K9e=/\\/g,H9e=/[\{\[].*[\}\]]$/,$9e=/(^|[^\\])([\{\[]|\([^\)]+$)/,J9e=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Qoe.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&G9e&&e.indexOf(L1)<0&&(e=e.replace(K9e,L1)),H9e.test(e)&&(e+=L1),e+="a";do e=O9e(e);while(U9e(e)||$9e.test(e));return e.replace(J9e,"$1")}});var gb=k(Ps=>{"use strict";m();Ps.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Ps.find=(t,e)=>t.nodes.find(r=>r.type===e);Ps.exceedsLimit=(t,e,r=1,n)=>n===!1||!Ps.isInteger(t)||!Ps.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Ps.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};Ps.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Ps.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Ps.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Ps.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Ps.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let o=n[i];if(Array.isArray(o)){r(o);continue}o!==void 0&&e.push(o)}return e};return r(t),e}});var pb=k((I$t,boe)=>{"use strict";m();var woe=gb();boe.exports=(t,e={})=>{let r=(n,i={})=>{let o=e.escapeInvalid&&woe.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(o||s)&&woe.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let A of n.nodes)a+=r(A);return a};return r(t)}});var Soe=k((B$t,voe)=>{"use strict";m();voe.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var _oe=k((Q$t,Poe)=>{"use strict";m();var xoe=Soe(),cp=(t,e,r)=>{if(xoe(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(xoe(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),o=String(n.shorthand),s=String(n.capture),a=String(n.wrap),A=t+":"+e+"="+i+o+s+a;if(cp.cache.hasOwnProperty(A))return cp.cache[A].result;let c=Math.min(t,e),u=Math.max(t,e);if(Math.abs(c-u)===1){let f=t+"|"+e;return n.capture?`(${f})`:n.wrap===!1?f:`(?:${f})`}let l=Moe(t)||Moe(e),p={min:t,max:e,a:c,b:u},g=[],d=[];if(l&&(p.isPadded=l,p.maxLen=String(p.max).length),c<0){let f=u<0?Math.abs(u):1;d=Foe(f,Math.abs(c),p,n),c=p.a=0}return u>=0&&(g=Foe(c,u,p,n)),p.negatives=d,p.positives=g,p.result=j9e(d,g,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&g.length+d.length>1&&(p.result=`(?:${p.result})`),cp.cache[A]=p,p.result};function j9e(t,e,r){let n=U1(t,e,"-",!1,r)||[],i=U1(e,t,"",!1,r)||[],o=U1(t,e,"-?",!0,r)||[];return n.concat(o).concat(i).join("|")}function Y9e(t,e){let r=1,n=1,i=Roe(t,r),o=new Set([e]);for(;t<=i&&i<=e;)o.add(i),r+=1,i=Roe(t,r);for(i=Noe(e+1,n)-1;t<i&&i<=e;)o.add(i),n+=1,i=Noe(e+1,n)-1;return o=[...o],o.sort(z9e),o}function q9e(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=V9e(t,e),i=n.length,o="",s=0;for(let a=0;a<i;a++){let[A,c]=n[a];A===c?o+=A:A!=="0"||c!=="9"?o+=W9e(A,c,r):s++}return s&&(o+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[s],digits:i}}function Foe(t,e,r,n){let i=Y9e(t,e),o=[],s=t,a;for(let A=0;A<i.length;A++){let c=i[A],u=q9e(String(s),String(c),n),l="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+Toe(a.count),s=c+1;continue}r.isPadded&&(l=Z9e(c,r,n)),u.string=l+u.pattern+Toe(u.count),o.push(u),s=c+1,a=u}return o}function U1(t,e,r,n,i){let o=[];for(let s of t){let{string:a}=s;!n&&!koe(e,"string",a)&&o.push(r+a),n&&koe(e,"string",a)&&o.push(r+a)}return o}function V9e(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function z9e(t,e){return t>e?1:e>t?-1:0}function koe(t,e,r){return t.some(n=>n[e]===r)}function Roe(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function Noe(t,e){return t-t%Math.pow(10,e)}function Toe(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function W9e(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function Moe(t){return/^-?(0+)\d/.test(t)}function Z9e(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}cp.cache={};cp.clearCache=()=>cp.cache={};Poe.exports=cp});var K1=k((w$t,$oe)=>{"use strict";m();var X9e=require("util"),Uoe=_oe(),Loe=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),eYe=t=>e=>t===!0?Number(e):String(e),O1=t=>typeof t=="number"||typeof t=="string"&&t!=="",rE=t=>Number.isInteger(+t),G1=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},tYe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,rYe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},fb=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},nYe=(t,e,r)=>{t.negatives.sort((a,A)=>a<A?-1:a>A?1:0),t.positives.sort((a,A)=>a<A?-1:a>A?1:0);let n=e.capture?"":"?:",i="",o="",s;return t.positives.length&&(i=t.positives.map(a=>fb(String(a),r)).join("|")),t.negatives.length&&(o=`-(${n}${t.negatives.map(a=>fb(String(a),r)).join("|")})`),i&&o?s=`${i}|${o}`:s=i||o,e.wrap?`(${n}${s})`:s},Ooe=(t,e,r,n)=>{if(r)return Uoe(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let o=String.fromCharCode(e);return`[${i}-${o}]`},Goe=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return Uoe(t,e,r)},Koe=(...t)=>new RangeError("Invalid range arguments: "+X9e.inspect(...t)),Hoe=(t,e,r)=>{if(r.strictRanges===!0)throw Koe([t,e]);return[]},iYe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},oYe=(t,e,r=1,n={})=>{let i=Number(t),o=Number(e);if(!Number.isInteger(i)||!Number.isInteger(o)){if(n.strictRanges===!0)throw Koe([t,e]);return[]}i===0&&(i=0),o===0&&(o=0);let s=i>o,a=String(t),A=String(e),c=String(r);r=Math.max(Math.abs(r),1);let u=G1(a)||G1(A)||G1(c),l=u?Math.max(a.length,A.length,c.length):0,p=u===!1&&tYe(t,e,n)===!1,g=n.transform||eYe(p);if(n.toRegex&&r===1)return Ooe(fb(t,l),fb(e,l),!0,n);let d={negatives:[],positives:[]},f=I=>d[I<0?"negatives":"positives"].push(Math.abs(I)),h=[],C=0;for(;s?i>=o:i<=o;)n.toRegex===!0&&r>1?f(i):h.push(rYe(g(i,C),l,p)),i=s?i-r:i+r,C++;return n.toRegex===!0?r>1?nYe(d,n,l):Goe(h,null,{wrap:!1,...n}):h},sYe=(t,e,r=1,n={})=>{if(!rE(t)&&t.length>1||!rE(e)&&e.length>1)return Hoe(t,e,n);let i=n.transform||(p=>String.fromCharCode(p)),o=`${t}`.charCodeAt(0),s=`${e}`.charCodeAt(0),a=o>s,A=Math.min(o,s),c=Math.max(o,s);if(n.toRegex&&r===1)return Ooe(A,c,!1,n);let u=[],l=0;for(;a?o>=s:o<=s;)u.push(i(o,l)),o=a?o-r:o+r,l++;return n.toRegex===!0?Goe(u,null,{wrap:!1,options:n}):u},db=(t,e,r,n={})=>{if(e==null&&O1(t))return[t];if(!O1(t)||!O1(e))return Hoe(t,e,n);if(typeof r=="function")return db(t,e,1,{transform:r});if(Loe(r))return db(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,rE(r)?rE(t)&&rE(e)?oYe(t,e,r,i):sYe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!Loe(r)?iYe(r,i):db(t,e,1,r)};$oe.exports=db});var Yoe=k((v$t,joe)=>{"use strict";m();var aYe=K1(),Joe=gb(),AYe=(t,e={})=>{let r=(n,i={})=>{let o=Joe.isInvalidBrace(i),s=n.invalid===!0&&e.escapeInvalid===!0,a=o===!0||s===!0,A=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return A+n.value;if(n.isClose===!0)return console.log("node.isClose",A,n.value),A+n.value;if(n.type==="open")return a?A+n.value:"(";if(n.type==="close")return a?A+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=Joe.reduce(n.nodes),l=aYe(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(l.length!==0)return u.length>1&&l.length>1?`(${l})`:l}if(n.nodes)for(let u of n.nodes)c+=r(u,n);return c};return r(t)};joe.exports=AYe});var zoe=k((x$t,Voe)=>{"use strict";m();var cYe=K1(),qoe=pb(),Hf=gb(),up=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?Hf.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let o of i)n.push(up(o,e,r));else for(let o of e)r===!0&&typeof o=="string"&&(o=`{${o}}`),n.push(Array.isArray(o)?up(i,o,r):i+o);return Hf.flatten(n)},uYe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,o={})=>{i.queue=[];let s=o,a=o.queue;for(;s.type!=="brace"&&s.type!=="root"&&s.parent;)s=s.parent,a=s.queue;if(i.invalid||i.dollar){a.push(up(a.pop(),qoe(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(up(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let l=Hf.reduce(i.nodes);if(Hf.exceedsLimit(...l,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=cYe(...l,e);p.length===0&&(p=qoe(i,e)),a.push(up(a.pop(),p)),i.nodes=[];return}let A=Hf.encloseBrace(i),c=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,c=u.queue;for(let l=0;l<i.nodes.length;l++){let p=i.nodes[l];if(p.type==="comma"&&i.type==="brace"){l===1&&c.push(""),c.push("");continue}if(p.type==="close"){a.push(up(a.pop(),c,A));continue}if(p.value&&p.type!=="open"){c.push(up(c.pop(),p.value));continue}p.nodes&&n(p,i)}return c};return Hf.flatten(n(t))};Voe.exports=uYe});var Zoe=k((k$t,Woe)=>{"use strict";m();Woe.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
1260
1260
|
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var nse=k((N$t,rse)=>{"use strict";m();var lYe=pb(),{MAX_LENGTH:Xoe,CHAR_BACKSLASH:H1,CHAR_BACKTICK:gYe,CHAR_COMMA:pYe,CHAR_DOT:dYe,CHAR_LEFT_PARENTHESES:fYe,CHAR_RIGHT_PARENTHESES:mYe,CHAR_LEFT_CURLY_BRACE:hYe,CHAR_RIGHT_CURLY_BRACE:CYe,CHAR_LEFT_SQUARE_BRACKET:ese,CHAR_RIGHT_SQUARE_BRACKET:tse,CHAR_DOUBLE_QUOTE:IYe,CHAR_SINGLE_QUOTE:EYe,CHAR_NO_BREAK_SPACE:BYe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:yYe}=Zoe(),QYe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(Xoe,r.maxLength):Xoe;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},o=[i],s=i,a=i,A=0,c=t.length,u=0,l=0,p,g=()=>t[u++],d=f=>{if(f.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&f.type==="text"){a.value+=f.value;return}return s.nodes.push(f),f.parent=s,f.prev=a,a=f,f};for(d({type:"bos"});u<c;)if(s=o[o.length-1],p=g(),!(p===yYe||p===BYe)){if(p===H1){d({type:"text",value:(e.keepEscaping?p:"")+g()});continue}if(p===tse){d({type:"text",value:"\\"+p});continue}if(p===ese){A++;let f;for(;u<c&&(f=g());){if(p+=f,f===ese){A++;continue}if(f===H1){p+=g();continue}if(f===tse&&(A--,A===0))break}d({type:"text",value:p});continue}if(p===fYe){s=d({type:"paren",nodes:[]}),o.push(s),d({type:"text",value:p});continue}if(p===mYe){if(s.type!=="paren"){d({type:"text",value:p});continue}s=o.pop(),d({type:"text",value:p}),s=o[o.length-1];continue}if(p===IYe||p===EYe||p===gYe){let f=p,h;for(e.keepQuotes!==!0&&(p="");u<c&&(h=g());){if(h===H1){p+=h+g();continue}if(h===f){e.keepQuotes===!0&&(p+=h);break}p+=h}d({type:"text",value:p});continue}if(p===hYe){l++;let h={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||s.dollar===!0,depth:l,commas:0,ranges:0,nodes:[]};s=d(h),o.push(s),d({type:"open",value:p});continue}if(p===CYe){if(s.type!=="brace"){d({type:"text",value:p});continue}let f="close";s=o.pop(),s.close=!0,d({type:f,value:p}),l--,s=o[o.length-1];continue}if(p===pYe&&l>0){if(s.ranges>0){s.ranges=0;let f=s.nodes.shift();s.nodes=[f,{type:"text",value:lYe(s)}]}d({type:"comma",value:p}),s.commas++;continue}if(p===dYe&&l>0&&s.commas===0){let f=s.nodes;if(l===0||f.length===0){d({type:"text",value:p});continue}if(a.type==="dot"){if(s.range=[],a.value+=p,a.type="range",s.nodes.length!==3&&s.nodes.length!==5){s.invalid=!0,s.ranges=0,a.type="text";continue}s.ranges++,s.args=[];continue}if(a.type==="range"){f.pop();let h=f[f.length-1];h.value+=a.value+p,a=h,s.ranges--;continue}d({type:"dot",value:p});continue}d({type:"text",value:p})}do if(s=o.pop(),s.type!=="root"){s.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let f=o[o.length-1],h=f.nodes.indexOf(s);f.nodes.splice(h,1,...s.nodes)}while(o.length>0);return d({type:"eos"}),i};rse.exports=QYe});var sse=k((M$t,ose)=>{"use strict";m();var ise=pb(),DYe=Yoe(),wYe=zoe(),bYe=nse(),os=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=os.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(os.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};os.parse=(t,e={})=>bYe(t,e);os.stringify=(t,e={})=>ise(typeof t=="string"?os.parse(t,e):t,e);os.compile=(t,e={})=>(typeof t=="string"&&(t=os.parse(t,e)),DYe(t,e));os.expand=(t,e={})=>{typeof t=="string"&&(t=os.parse(t,e));let r=wYe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};os.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?os.compile(t,e):os.expand(t,e);ose.exports=os});var nE=k((_$t,lse)=>{"use strict";m();var vYe=require("path"),_A="\\\\/",ase=`[^${_A}]`,Kc="\\.",SYe="\\+",xYe="\\?",mb="\\/",FYe="(?=.)",Ase="[^/]",$1=`(?:${mb}|$)`,cse=`(?:^|${mb})`,J1=`${Kc}{1,2}${$1}`,kYe=`(?!${Kc})`,RYe=`(?!${cse}${J1})`,NYe=`(?!${Kc}{0,1}${$1})`,TYe=`(?!${J1})`,MYe=`[^.${mb}]`,PYe=`${Ase}*?`,use={DOT_LITERAL:Kc,PLUS_LITERAL:SYe,QMARK_LITERAL:xYe,SLASH_LITERAL:mb,ONE_CHAR:FYe,QMARK:Ase,END_ANCHOR:$1,DOTS_SLASH:J1,NO_DOT:kYe,NO_DOTS:RYe,NO_DOT_SLASH:NYe,NO_DOTS_SLASH:TYe,QMARK_NO_DOT:MYe,STAR:PYe,START_ANCHOR:cse},_Ye={...use,SLASH_LITERAL:`[${_A}]`,QMARK:ase,STAR:`${ase}*?`,DOTS_SLASH:`${Kc}{1,2}(?:[${_A}]|$)`,NO_DOT:`(?!${Kc})`,NO_DOTS:`(?!(?:^|[${_A}])${Kc}{1,2}(?:[${_A}]|$))`,NO_DOT_SLASH:`(?!${Kc}{0,1}(?:[${_A}]|$))`,NO_DOTS_SLASH:`(?!${Kc}{1,2}(?:[${_A}]|$))`,QMARK_NO_DOT:`[^.${_A}]`,START_ANCHOR:`(?:^|[${_A}])`,END_ANCHOR:`(?:[${_A}]|$)`},LYe={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};lse.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:LYe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:vYe.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?_Ye:use}}});var iE=k(Mo=>{"use strict";m();var UYe=require("path"),OYe=process.platform==="win32",{REGEX_BACKSLASH:GYe,REGEX_REMOVE_BACKSLASH:KYe,REGEX_SPECIAL_CHARS:HYe,REGEX_SPECIAL_CHARS_GLOBAL:$Ye}=nE();Mo.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Mo.hasRegexChars=t=>HYe.test(t);Mo.isRegexChar=t=>t.length===1&&Mo.hasRegexChars(t);Mo.escapeRegex=t=>t.replace($Ye,"\\$1");Mo.toPosixSlashes=t=>t.replace(GYe,"/");Mo.removeBackslashes=t=>t.replace(KYe,e=>e==="\\"?"":e);Mo.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Mo.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:OYe===!0||UYe.sep==="\\";Mo.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Mo.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Mo.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Mo.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o}});var Ise=k((G$t,Cse)=>{"use strict";m();var gse=iE(),{CHAR_ASTERISK:j1,CHAR_AT:JYe,CHAR_BACKWARD_SLASH:oE,CHAR_COMMA:jYe,CHAR_DOT:Y1,CHAR_EXCLAMATION_MARK:q1,CHAR_FORWARD_SLASH:hse,CHAR_LEFT_CURLY_BRACE:V1,CHAR_LEFT_PARENTHESES:z1,CHAR_LEFT_SQUARE_BRACKET:YYe,CHAR_PLUS:qYe,CHAR_QUESTION_MARK:pse,CHAR_RIGHT_CURLY_BRACE:VYe,CHAR_RIGHT_PARENTHESES:dse,CHAR_RIGHT_SQUARE_BRACKET:zYe}=nE(),fse=t=>t===hse||t===oE,mse=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},WYe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],A=t,c=-1,u=0,l=0,p=!1,g=!1,d=!1,f=!1,h=!1,C=!1,I=!1,B=!1,E=!1,y=!1,D=0,b,Q,v={value:"",depth:0,isGlob:!1},S=()=>c>=n,x=()=>A.charCodeAt(c+1),U=()=>(b=Q,A.charCodeAt(++c));for(;c<n;){Q=U();let Y;if(Q===oE){I=v.backslashes=!0,Q=U(),Q===V1&&(C=!0);continue}if(C===!0||Q===V1){for(D++;S()!==!0&&(Q=U());){if(Q===oE){I=v.backslashes=!0,U();continue}if(Q===V1){D++;continue}if(C!==!0&&Q===Y1&&(Q=U())===Y1){if(p=v.isBrace=!0,d=v.isGlob=!0,y=!0,i===!0)continue;break}if(C!==!0&&Q===jYe){if(p=v.isBrace=!0,d=v.isGlob=!0,y=!0,i===!0)continue;break}if(Q===VYe&&(D--,D===0)){C=!1,p=v.isBrace=!0,y=!0;break}}if(i===!0)continue;break}if(Q===hse){if(o.push(c),s.push(v),v={value:"",depth:0,isGlob:!1},y===!0)continue;if(b===Y1&&c===u+1){u+=2;continue}l=c+1;continue}if(r.noext!==!0&&(Q===qYe||Q===JYe||Q===j1||Q===pse||Q===q1)===!0&&x()===z1){if(d=v.isGlob=!0,f=v.isExtglob=!0,y=!0,Q===q1&&c===u&&(E=!0),i===!0){for(;S()!==!0&&(Q=U());){if(Q===oE){I=v.backslashes=!0,Q=U();continue}if(Q===dse){d=v.isGlob=!0,y=!0;break}}continue}break}if(Q===j1){if(b===j1&&(h=v.isGlobstar=!0),d=v.isGlob=!0,y=!0,i===!0)continue;break}if(Q===pse){if(d=v.isGlob=!0,y=!0,i===!0)continue;break}if(Q===YYe){for(;S()!==!0&&(Y=U());){if(Y===oE){I=v.backslashes=!0,U();continue}if(Y===zYe){g=v.isBracket=!0,d=v.isGlob=!0,y=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&Q===q1&&c===u){B=v.negated=!0,u++;continue}if(r.noparen!==!0&&Q===z1){if(d=v.isGlob=!0,i===!0){for(;S()!==!0&&(Q=U());){if(Q===z1){I=v.backslashes=!0,Q=U();continue}if(Q===dse){y=!0;break}}continue}break}if(d===!0){if(y=!0,i===!0)continue;break}}r.noext===!0&&(f=!1,d=!1);let H=A,L="",M="";u>0&&(L=A.slice(0,u),A=A.slice(u),l-=u),H&&d===!0&&l>0?(H=A.slice(0,l),M=A.slice(l)):d===!0?(H="",M=A):H=A,H&&H!==""&&H!=="/"&&H!==A&&fse(H.charCodeAt(H.length-1))&&(H=H.slice(0,-1)),r.unescape===!0&&(M&&(M=gse.removeBackslashes(M)),H&&I===!0&&(H=gse.removeBackslashes(H)));let _={prefix:L,input:t,start:u,base:H,glob:M,isBrace:p,isBracket:g,isGlob:d,isExtglob:f,isGlobstar:h,negated:B,negatedExtglob:E};if(r.tokens===!0&&(_.maxDepth=0,fse(Q)||s.push(v),_.tokens=s),r.parts===!0||r.tokens===!0){let Y;for(let W=0;W<o.length;W++){let K=Y?Y+1:u,J=o[W],O=t.slice(K,J);r.tokens&&(W===0&&u!==0?(s[W].isPrefix=!0,s[W].value=L):s[W].value=O,mse(s[W]),_.maxDepth+=s[W].depth),(W!==0||O!=="")&&a.push(O),Y=J}if(Y&&Y+1<t.length){let W=t.slice(Y+1);a.push(W),r.tokens&&(s[s.length-1].value=W,mse(s[s.length-1]),_.maxDepth+=s[s.length-1].depth)}_.slashes=o,_.parts=a}return _};Cse.exports=WYe});var yse=k((H$t,Bse)=>{"use strict";m();var hb=nE(),ss=iE(),{MAX_LENGTH:Cb,POSIX_REGEX_SOURCE:ZYe,REGEX_NON_SPECIAL_CHARS:XYe,REGEX_SPECIAL_CHARS_BACKREF:eqe,REPLACEMENTS:Ese}=hb,tqe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>ss.escapeRegex(i)).join("..")}return r},$f=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,W1=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Ese[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Cb,r.maxLength):Cb,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let o={type:"bos",value:"",output:r.prepend||""},s=[o],a=r.capture?"":"?:",A=ss.isWindows(e),c=hb.globChars(A),u=hb.extglobChars(c),{DOT_LITERAL:l,PLUS_LITERAL:p,SLASH_LITERAL:g,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:h,NO_DOT_SLASH:C,NO_DOTS_SLASH:I,QMARK:B,QMARK_NO_DOT:E,STAR:y,START_ANCHOR:D}=c,b=Be=>`(${a}(?:(?!${D}${Be.dot?f:l}).)*?)`,Q=r.dot?"":h,v=r.dot?B:E,S=r.bash===!0?b(r):y;r.capture&&(S=`(${S})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let x={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=ss.removePrefix(t,x),i=t.length;let U=[],H=[],L=[],M=o,_,Y=()=>x.index===i-1,W=x.peek=(Be=1)=>t[x.index+Be],K=x.advance=()=>t[++x.index]||"",J=()=>t.slice(x.index+1),O=(Be="",$e=0)=>{x.consumed+=Be,x.index+=$e},ie=Be=>{x.output+=Be.output!=null?Be.output:Be.value,O(Be.value)},de=()=>{let Be=1;for(;W()==="!"&&(W(2)!=="("||W(3)==="?");)K(),x.start++,Be++;return Be%2===0?!1:(x.negated=!0,x.start++,!0)},me=Be=>{x[Be]++,L.push(Be)},fe=Be=>{x[Be]--,L.pop()},X=Be=>{if(M.type==="globstar"){let $e=x.braces>0&&(Be.type==="comma"||Be.type==="brace"),he=Be.extglob===!0||U.length&&(Be.type==="pipe"||Be.type==="paren");Be.type!=="slash"&&Be.type!=="paren"&&!$e&&!he&&(x.output=x.output.slice(0,-M.output.length),M.type="star",M.value="*",M.output=S,x.output+=M.output)}if(U.length&&Be.type!=="paren"&&(U[U.length-1].inner+=Be.value),(Be.value||Be.output)&&ie(Be),M&&M.type==="text"&&Be.type==="text"){M.value+=Be.value,M.output=(M.output||"")+Be.value;return}Be.prev=M,s.push(Be),M=Be},ve=(Be,$e)=>{let he={...u[$e],conditions:1,inner:""};he.prev=M,he.parens=x.parens,he.output=x.output;let _e=(r.capture?"(":"")+he.open;me("parens"),X({type:Be,value:$e,output:x.output?"":d}),X({type:"paren",extglob:!0,value:K(),output:_e}),U.push(he)},rt=Be=>{let $e=Be.close+(r.capture?")":""),he;if(Be.type==="negate"){let _e=S;if(Be.inner&&Be.inner.length>1&&Be.inner.includes("/")&&(_e=b(r)),(_e!==S||Y()||/^\)+$/.test(J()))&&($e=Be.close=`)$))${_e}`),Be.inner.includes("*")&&(he=J())&&/^\.[^\\/.]+$/.test(he)){let we=W1(he,{...e,fastpaths:!1}).output;$e=Be.close=`)${we})${_e})`}Be.prev.type==="bos"&&(x.negatedExtglob=!0)}X({type:"paren",extglob:!0,value:_,output:$e}),fe("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let Be=!1,$e=t.replace(eqe,(he,_e,we,pt,ht,qt)=>pt==="\\"?(Be=!0,he):pt==="?"?_e?_e+pt+(ht?B.repeat(ht.length):""):qt===0?v+(ht?B.repeat(ht.length):""):B.repeat(we.length):pt==="."?l.repeat(we.length):pt==="*"?_e?_e+pt+(ht?S:""):S:_e?he:`\\${he}`);return Be===!0&&(r.unescape===!0?$e=$e.replace(/\\/g,""):$e=$e.replace(/\\+/g,he=>he.length%2===0?"\\\\":he?"\\":"")),$e===t&&r.contains===!0?(x.output=t,x):(x.output=ss.wrapOutput($e,x,e),x)}for(;!Y();){if(_=K(),_==="\0")continue;if(_==="\\"){let he=W();if(he==="/"&&r.bash!==!0||he==="."||he===";")continue;if(!he){_+="\\",X({type:"text",value:_});continue}let _e=/^\\+/.exec(J()),we=0;if(_e&&_e[0].length>2&&(we=_e[0].length,x.index+=we,we%2!==0&&(_+="\\")),r.unescape===!0?_=K():_+=K(),x.brackets===0){X({type:"text",value:_});continue}}if(x.brackets>0&&(_!=="]"||M.value==="["||M.value==="[^")){if(r.posix!==!1&&_===":"){let he=M.value.slice(1);if(he.includes("[")&&(M.posix=!0,he.includes(":"))){let _e=M.value.lastIndexOf("["),we=M.value.slice(0,_e),pt=M.value.slice(_e+2),ht=ZYe[pt];if(ht){M.value=we+ht,x.backtrack=!0,K(),!o.output&&s.indexOf(M)===1&&(o.output=d);continue}}}(_==="["&&W()!==":"||_==="-"&&W()==="]")&&(_=`\\${_}`),_==="]"&&(M.value==="["||M.value==="[^")&&(_=`\\${_}`),r.posix===!0&&_==="!"&&M.value==="["&&(_="^"),M.value+=_,ie({value:_});continue}if(x.quotes===1&&_!=='"'){_=ss.escapeRegex(_),M.value+=_,ie({value:_});continue}if(_==='"'){x.quotes=x.quotes===1?0:1,r.keepQuotes===!0&&X({type:"text",value:_});continue}if(_==="("){me("parens"),X({type:"paren",value:_});continue}if(_===")"){if(x.parens===0&&r.strictBrackets===!0)throw new SyntaxError($f("opening","("));let he=U[U.length-1];if(he&&x.parens===he.parens+1){rt(U.pop());continue}X({type:"paren",value:_,output:x.parens?")":"\\)"}),fe("parens");continue}if(_==="["){if(r.nobracket===!0||!J().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError($f("closing","]"));_=`\\${_}`}else me("brackets");X({type:"bracket",value:_});continue}if(_==="]"){if(r.nobracket===!0||M&&M.type==="bracket"&&M.value.length===1){X({type:"text",value:_,output:`\\${_}`});continue}if(x.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError($f("opening","["));X({type:"text",value:_,output:`\\${_}`});continue}fe("brackets");let he=M.value.slice(1);if(M.posix!==!0&&he[0]==="^"&&!he.includes("/")&&(_=`/${_}`),M.value+=_,ie({value:_}),r.literalBrackets===!1||ss.hasRegexChars(he))continue;let _e=ss.escapeRegex(M.value);if(x.output=x.output.slice(0,-M.value.length),r.literalBrackets===!0){x.output+=_e,M.value=_e;continue}M.value=`(${a}${_e}|${M.value})`,x.output+=M.value;continue}if(_==="{"&&r.nobrace!==!0){me("braces");let he={type:"brace",value:_,output:"(",outputIndex:x.output.length,tokensIndex:x.tokens.length};H.push(he),X(he);continue}if(_==="}"){let he=H[H.length-1];if(r.nobrace===!0||!he){X({type:"text",value:_,output:_});continue}let _e=")";if(he.dots===!0){let we=s.slice(),pt=[];for(let ht=we.length-1;ht>=0&&(s.pop(),we[ht].type!=="brace");ht--)we[ht].type!=="dots"&&pt.unshift(we[ht].value);_e=tqe(pt,r),x.backtrack=!0}if(he.comma!==!0&&he.dots!==!0){let we=x.output.slice(0,he.outputIndex),pt=x.tokens.slice(he.tokensIndex);he.value=he.output="\\{",_=_e="\\}",x.output=we;for(let ht of pt)x.output+=ht.output||ht.value}X({type:"brace",value:_,output:_e}),fe("braces"),H.pop();continue}if(_==="|"){U.length>0&&U[U.length-1].conditions++,X({type:"text",value:_});continue}if(_===","){let he=_,_e=H[H.length-1];_e&&L[L.length-1]==="braces"&&(_e.comma=!0,he="|"),X({type:"comma",value:_,output:he});continue}if(_==="/"){if(M.type==="dot"&&x.index===x.start+1){x.start=x.index+1,x.consumed="",x.output="",s.pop(),M=o;continue}X({type:"slash",value:_,output:g});continue}if(_==="."){if(x.braces>0&&M.type==="dot"){M.value==="."&&(M.output=l);let he=H[H.length-1];M.type="dots",M.output+=_,M.value+=_,he.dots=!0;continue}if(x.braces+x.parens===0&&M.type!=="bos"&&M.type!=="slash"){X({type:"text",value:_,output:l});continue}X({type:"dot",value:_,output:l});continue}if(_==="?"){if(!(M&&M.value==="(")&&r.noextglob!==!0&&W()==="("&&W(2)!=="?"){ve("qmark",_);continue}if(M&&M.type==="paren"){let _e=W(),we=_;if(_e==="<"&&!ss.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(M.value==="("&&!/[!=<:]/.test(_e)||_e==="<"&&!/<([!=]|\w+>)/.test(J()))&&(we=`\\${_}`),X({type:"text",value:_,output:we});continue}if(r.dot!==!0&&(M.type==="slash"||M.type==="bos")){X({type:"qmark",value:_,output:E});continue}X({type:"qmark",value:_,output:B});continue}if(_==="!"){if(r.noextglob!==!0&&W()==="("&&(W(2)!=="?"||!/[!=<:]/.test(W(3)))){ve("negate",_);continue}if(r.nonegate!==!0&&x.index===0){de();continue}}if(_==="+"){if(r.noextglob!==!0&&W()==="("&&W(2)!=="?"){ve("plus",_);continue}if(M&&M.value==="("||r.regex===!1){X({type:"plus",value:_,output:p});continue}if(M&&(M.type==="bracket"||M.type==="paren"||M.type==="brace")||x.parens>0){X({type:"plus",value:_});continue}X({type:"plus",value:p});continue}if(_==="@"){if(r.noextglob!==!0&&W()==="("&&W(2)!=="?"){X({type:"at",extglob:!0,value:_,output:""});continue}X({type:"text",value:_});continue}if(_!=="*"){(_==="$"||_==="^")&&(_=`\\${_}`);let he=XYe.exec(J());he&&(_+=he[0],x.index+=he[0].length),X({type:"text",value:_});continue}if(M&&(M.type==="globstar"||M.star===!0)){M.type="star",M.star=!0,M.value+=_,M.output=S,x.backtrack=!0,x.globstar=!0,O(_);continue}let Be=J();if(r.noextglob!==!0&&/^\([^?]/.test(Be)){ve("star",_);continue}if(M.type==="star"){if(r.noglobstar===!0){O(_);continue}let he=M.prev,_e=he.prev,we=he.type==="slash"||he.type==="bos",pt=_e&&(_e.type==="star"||_e.type==="globstar");if(r.bash===!0&&(!we||Be[0]&&Be[0]!=="/")){X({type:"star",value:_,output:""});continue}let ht=x.braces>0&&(he.type==="comma"||he.type==="brace"),qt=U.length&&(he.type==="pipe"||he.type==="paren");if(!we&&he.type!=="paren"&&!ht&&!qt){X({type:"star",value:_,output:""});continue}for(;Be.slice(0,3)==="/**";){let Kr=t[x.index+4];if(Kr&&Kr!=="/")break;Be=Be.slice(3),O("/**",3)}if(he.type==="bos"&&Y()){M.type="globstar",M.value+=_,M.output=b(r),x.output=M.output,x.globstar=!0,O(_);continue}if(he.type==="slash"&&he.prev.type!=="bos"&&!pt&&Y()){x.output=x.output.slice(0,-(he.output+M.output).length),he.output=`(?:${he.output}`,M.type="globstar",M.output=b(r)+(r.strictSlashes?")":"|$)"),M.value+=_,x.globstar=!0,x.output+=he.output+M.output,O(_);continue}if(he.type==="slash"&&he.prev.type!=="bos"&&Be[0]==="/"){let Kr=Be[1]!==void 0?"|$":"";x.output=x.output.slice(0,-(he.output+M.output).length),he.output=`(?:${he.output}`,M.type="globstar",M.output=`${b(r)}${g}|${g}${Kr})`,M.value+=_,x.output+=he.output+M.output,x.globstar=!0,O(_+K()),X({type:"slash",value:"/",output:""});continue}if(he.type==="bos"&&Be[0]==="/"){M.type="globstar",M.value+=_,M.output=`(?:^|${g}|${b(r)}${g})`,x.output=M.output,x.globstar=!0,O(_+K()),X({type:"slash",value:"/",output:""});continue}x.output=x.output.slice(0,-M.output.length),M.type="globstar",M.output=b(r),M.value+=_,x.output+=M.output,x.globstar=!0,O(_);continue}let $e={type:"star",value:_,output:S};if(r.bash===!0){$e.output=".*?",(M.type==="bos"||M.type==="slash")&&($e.output=Q+$e.output),X($e);continue}if(M&&(M.type==="bracket"||M.type==="paren")&&r.regex===!0){$e.output=_,X($e);continue}(x.index===x.start||M.type==="slash"||M.type==="dot")&&(M.type==="dot"?(x.output+=C,M.output+=C):r.dot===!0?(x.output+=I,M.output+=I):(x.output+=Q,M.output+=Q),W()!=="*"&&(x.output+=d,M.output+=d)),X($e)}for(;x.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError($f("closing","]"));x.output=ss.escapeLast(x.output,"["),fe("brackets")}for(;x.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError($f("closing",")"));x.output=ss.escapeLast(x.output,"("),fe("parens")}for(;x.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError($f("closing","}"));x.output=ss.escapeLast(x.output,"{"),fe("braces")}if(r.strictSlashes!==!0&&(M.type==="star"||M.type==="bracket")&&X({type:"maybe_slash",value:"",output:`${g}?`}),x.backtrack===!0){x.output="";for(let Be of x.tokens)x.output+=Be.output!=null?Be.output:Be.value,Be.suffix&&(x.output+=Be.suffix)}return x};W1.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Cb,r.maxLength):Cb,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=Ese[t]||t;let o=ss.isWindows(e),{DOT_LITERAL:s,SLASH_LITERAL:a,ONE_CHAR:A,DOTS_SLASH:c,NO_DOT:u,NO_DOTS:l,NO_DOTS_SLASH:p,STAR:g,START_ANCHOR:d}=hb.globChars(o),f=r.dot?l:u,h=r.dot?p:u,C=r.capture?"":"?:",I={negated:!1,prefix:""},B=r.bash===!0?".*?":g;r.capture&&(B=`(${B})`);let E=Q=>Q.noglobstar===!0?B:`(${C}(?:(?!${d}${Q.dot?c:s}).)*?)`,y=Q=>{switch(Q){case"*":return`${f}${A}${B}`;case".*":return`${s}${A}${B}`;case"*.*":return`${f}${B}${s}${A}${B}`;case"*/*":return`${f}${B}${a}${A}${h}${B}`;case"**":return f+E(r);case"**/*":return`(?:${f}${E(r)}${a})?${h}${A}${B}`;case"**/*.*":return`(?:${f}${E(r)}${a})?${h}${B}${s}${A}${B}`;case"**/.*":return`(?:${f}${E(r)}${a})?${s}${A}${B}`;default:{let v=/^(.*?)\.(\w+)$/.exec(Q);if(!v)return;let S=y(v[1]);return S?S+s+v[2]:void 0}}},D=ss.removePrefix(t,I),b=y(D);return b&&r.strictSlashes!==!0&&(b+=`${a}?`),b};Bse.exports=W1});var Dse=k((J$t,Qse)=>{"use strict";m();var rqe=require("path"),nqe=Ise(),Z1=yse(),X1=iE(),iqe=nE(),oqe=t=>t&&typeof t=="object"&&!Array.isArray(t),bn=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(p=>bn(p,e,r));return p=>{for(let g of u){let d=g(p);if(d)return d}return!1}}let n=oqe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},o=X1.isWindows(e),s=n?bn.compileRe(t,e):bn.makeRe(t,e,!1,!0),a=s.state;delete s.state;let A=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};A=bn(i.ignore,u,r)}let c=(u,l=!1)=>{let{isMatch:p,match:g,output:d}=bn.test(u,s,e,{glob:t,posix:o}),f={glob:t,state:a,regex:s,posix:o,input:u,output:d,match:g,isMatch:p};return typeof i.onResult=="function"&&i.onResult(f),p===!1?(f.isMatch=!1,l?f:!1):A(u)?(typeof i.onIgnore=="function"&&i.onIgnore(f),f.isMatch=!1,l?f:!1):(typeof i.onMatch=="function"&&i.onMatch(f),l?f:!0)};return r&&(c.state=a),c};bn.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=r||{},s=o.format||(i?X1.toPosixSlashes:null),a=t===n,A=a&&s?s(t):t;return a===!1&&(A=s?s(t):t,a=A===n),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=bn.matchBase(t,e,r,i):a=e.exec(A)),{isMatch:!!a,match:a,output:A}};bn.matchBase=(t,e,r,n=X1.isWindows(r))=>(e instanceof RegExp?e:bn.makeRe(e,r)).test(rqe.basename(t));bn.isMatch=(t,e,r)=>bn(e,r)(t);bn.parse=(t,e)=>Array.isArray(t)?t.map(r=>bn.parse(r,e)):Z1(t,{...e,fastpaths:!1});bn.scan=(t,e)=>nqe(t,e);bn.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},o=i.contains?"":"^",s=i.contains?"":"$",a=`${o}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let A=bn.toRegex(a,e);return n===!0&&(A.state=t),A};bn.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=Z1.fastpaths(t,e)),i.output||(i=Z1(t,e)),bn.compileRe(i,e,r,n)};bn.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};bn.constants=iqe;Qse.exports=bn});var bse=k((Y$t,wse)=>{"use strict";m();wse.exports=Dse()});var Ib=k((V$t,kse)=>{"use strict";m();var Sse=require("util"),xse=sse(),LA=bse(),eL=iE(),vse=t=>t===""||t==="./",Fse=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},qr=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,o=new Set,s=0,a=u=>{o.add(u.output),r&&r.onResult&&r.onResult(u)};for(let u=0;u<e.length;u++){let l=LA(String(e[u]),{...r,onResult:a},!0),p=l.state.negated||l.state.negatedExtglob;p&&s++;for(let g of t){let d=l(g,!0);(p?!d.isMatch:d.isMatch)&&(p?n.add(d.output):(n.delete(d.output),i.add(d.output)))}}let c=(s===e.length?[...o]:[...i]).filter(u=>!n.has(u));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(u=>u.replace(/\\/g,"")):e}return c};qr.match=qr;qr.matcher=(t,e)=>LA(t,e);qr.isMatch=(t,e,r)=>LA(e,r)(t);qr.any=qr.isMatch;qr.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],o=a=>{r.onResult&&r.onResult(a),i.push(a.output)},s=new Set(qr(t,e,{...r,onResult:o}));for(let a of i)s.has(a)||n.add(a);return[...n]};qr.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Sse.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>qr.contains(t,n,r));if(typeof e=="string"){if(vse(t)||vse(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return qr.isMatch(t,e,{...r,contains:!0})};qr.matchKeys=(t,e,r)=>{if(!eL.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=qr(Object.keys(t),e,r),i={};for(let o of n)i[o]=t[o];return i};qr.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=LA(String(i),r);if(n.some(s=>o(s)))return!0}return!1};qr.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let o=LA(String(i),r);if(!n.every(s=>o(s)))return!1}return!0};qr.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Sse.inspect(t)}"`);return[].concat(e).every(n=>LA(n,r)(t))};qr.capture=(t,e,r)=>{let n=eL.isWindows(r),o=LA.makeRe(String(t),{...r,capture:!0}).exec(n?eL.toPosixSlashes(e):e);if(o)return o.slice(1).map(s=>s===void 0?"":s)};qr.makeRe=(...t)=>LA.makeRe(...t);qr.scan=(...t)=>LA.scan(...t);qr.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of xse(String(n),e))r.push(LA.parse(i,e));return r};qr.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!Fse(t)?[t]:xse(t,e)};qr.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return qr.braces(t,{...e,expand:!0})};qr.hasBraces=Fse;kse.exports=qr});var Gse=k(ot=>{"use strict";m();Object.defineProperty(ot,"__esModule",{value:!0});ot.isAbsolute=ot.partitionAbsoluteAndRelative=ot.removeDuplicateSlashes=ot.matchAny=ot.convertPatternsToRe=ot.makeRe=ot.getPatternParts=ot.expandBraceExpansion=ot.expandPatternsWithBraceExpansion=ot.isAffectDepthOfReadingPattern=ot.endsWithSlashGlobStar=ot.hasGlobStar=ot.getBaseDirectory=ot.isPatternRelatedToParentDirectory=ot.getPatternsOutsideCurrentDirectory=ot.getPatternsInsideCurrentDirectory=ot.getPositivePatterns=ot.getNegativePatterns=ot.isPositivePattern=ot.isNegativePattern=ot.convertToNegativePattern=ot.convertToPositivePattern=ot.isDynamicPattern=ot.isStaticPattern=void 0;var Rse=require("path"),sqe=Doe(),tL=Ib(),Nse="**",aqe="\\",Aqe=/[*?]|^!/,cqe=/\[[^[]*]/,uqe=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,lqe=/[!*+?@]\([^(]*\)/,gqe=/,|\.\./,pqe=/(?!^)\/{2,}/g;function Tse(t,e={}){return!Mse(t,e)}ot.isStaticPattern=Tse;function Mse(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(aqe)||Aqe.test(t)||cqe.test(t)||uqe.test(t)||e.extglob!==!1&&lqe.test(t)||e.braceExpansion!==!1&&dqe(t))}ot.isDynamicPattern=Mse;function dqe(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return gqe.test(n)}function fqe(t){return Eb(t)?t.slice(1):t}ot.convertToPositivePattern=fqe;function mqe(t){return"!"+t}ot.convertToNegativePattern=mqe;function Eb(t){return t.startsWith("!")&&t[1]!=="("}ot.isNegativePattern=Eb;function Pse(t){return!Eb(t)}ot.isPositivePattern=Pse;function hqe(t){return t.filter(Eb)}ot.getNegativePatterns=hqe;function Cqe(t){return t.filter(Pse)}ot.getPositivePatterns=Cqe;function Iqe(t){return t.filter(e=>!rL(e))}ot.getPatternsInsideCurrentDirectory=Iqe;function Eqe(t){return t.filter(rL)}ot.getPatternsOutsideCurrentDirectory=Eqe;function rL(t){return t.startsWith("..")||t.startsWith("./..")}ot.isPatternRelatedToParentDirectory=rL;function Bqe(t){return sqe(t,{flipBackslashes:!1})}ot.getBaseDirectory=Bqe;function yqe(t){return t.includes(Nse)}ot.hasGlobStar=yqe;function _se(t){return t.endsWith("/"+Nse)}ot.endsWithSlashGlobStar=_se;function Qqe(t){let e=Rse.basename(t);return _se(t)||Tse(e)}ot.isAffectDepthOfReadingPattern=Qqe;function Dqe(t){return t.reduce((e,r)=>e.concat(Lse(r)),[])}ot.expandPatternsWithBraceExpansion=Dqe;function Lse(t){let e=tL.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}ot.expandBraceExpansion=Lse;function wqe(t,e){let{parts:r}=tL.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}ot.getPatternParts=wqe;function Use(t,e){return tL.makeRe(t,e)}ot.makeRe=Use;function bqe(t,e){return t.map(r=>Use(r,e))}ot.convertPatternsToRe=bqe;function vqe(t,e){return e.some(r=>r.test(t))}ot.matchAny=vqe;function Sqe(t){return t.replace(pqe,"/")}ot.removeDuplicateSlashes=Sqe;function xqe(t){let e=[],r=[];for(let n of t)Ose(n)?e.push(n):r.push(n);return[e,r]}ot.partitionAbsoluteAndRelative=xqe;function Ose(t){return Rse.isAbsolute(t)}ot.isAbsolute=Ose});var Jse=k((X$t,$se)=>{"use strict";m();var Fqe=require("stream"),Kse=Fqe.PassThrough,kqe=Array.prototype.slice;$se.exports=Rqe;function Rqe(){let t=[],e=kqe.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let i=n.end!==!1,o=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let s=Kse(n);function a(){for(let u=0,l=arguments.length;u<l;u++)t.push(Hse(arguments[u],n));return A(),this}function A(){if(r)return;r=!0;let u=t.shift();if(!u){process.nextTick(c);return}Array.isArray(u)||(u=[u]);let l=u.length+1;function p(){--l>0||(r=!1,A())}function g(d){function f(){d.removeListener("merge2UnpipeEnd",f),d.removeListener("end",f),o&&d.removeListener("error",h),p()}function h(C){s.emit("error",C)}if(d._readableState.endEmitted)return p();d.on("merge2UnpipeEnd",f),d.on("end",f),o&&d.on("error",h),d.pipe(s,{end:!1}),d.resume()}for(let d=0;d<u.length;d++)g(u[d]);p()}function c(){r=!1,s.emit("queueDrain"),i&&s.end()}return s.setMaxListeners(0),s.add=a,s.on("unpipe",function(u){u.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),s}function Hse(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=Hse(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(Kse(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var Yse=k(Bb=>{"use strict";m();Object.defineProperty(Bb,"__esModule",{value:!0});Bb.merge=void 0;var Nqe=Jse();function Tqe(t){let e=Nqe(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>jse(t)),e.once("end",()=>jse(t)),e}Bb.merge=Tqe;function jse(t){t.forEach(e=>e.emit("close"))}});var qse=k(Jf=>{"use strict";m();Object.defineProperty(Jf,"__esModule",{value:!0});Jf.isEmpty=Jf.isString=void 0;function Mqe(t){return typeof t=="string"}Jf.isString=Mqe;function Pqe(t){return t===""}Jf.isEmpty=Pqe});var Hc=k(qi=>{"use strict";m();Object.defineProperty(qi,"__esModule",{value:!0});qi.string=qi.stream=qi.pattern=qi.path=qi.fs=qi.errno=qi.array=void 0;var _qe=loe();qi.array=_qe;var Lqe=goe();qi.errno=Lqe;var Uqe=poe();qi.fs=Uqe;var Oqe=hoe();qi.path=Oqe;var Gqe=Gse();qi.pattern=Gqe;var Kqe=Yse();qi.stream=Kqe;var Hqe=qse();qi.string=Hqe});var Zse=k(Vi=>{"use strict";m();Object.defineProperty(Vi,"__esModule",{value:!0});Vi.convertPatternGroupToTask=Vi.convertPatternGroupsToTasks=Vi.groupPatternsByBaseDirectory=Vi.getNegativePatternsAsPositive=Vi.getPositivePatterns=Vi.convertPatternsToTasks=Vi.generate=void 0;var Ma=Hc();function $qe(t,e){let r=Vse(t,e),n=Vse(e.ignore,e),i=zse(r),o=Wse(r,n),s=i.filter(u=>Ma.pattern.isStaticPattern(u,e)),a=i.filter(u=>Ma.pattern.isDynamicPattern(u,e)),A=nL(s,o,!1),c=nL(a,o,!0);return A.concat(c)}Vi.generate=$qe;function Vse(t,e){let r=t;return e.braceExpansion&&(r=Ma.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>Ma.pattern.removeDuplicateSlashes(n))}function nL(t,e,r){let n=[],i=Ma.pattern.getPatternsOutsideCurrentDirectory(t),o=Ma.pattern.getPatternsInsideCurrentDirectory(t),s=iL(i),a=iL(o);return n.push(...oL(s,e,r)),"."in a?n.push(sL(".",o,e,r)):n.push(...oL(a,e,r)),n}Vi.convertPatternsToTasks=nL;function zse(t){return Ma.pattern.getPositivePatterns(t)}Vi.getPositivePatterns=zse;function Wse(t,e){return Ma.pattern.getNegativePatterns(t).concat(e).map(Ma.pattern.convertToPositivePattern)}Vi.getNegativePatternsAsPositive=Wse;function iL(t){let e={};return t.reduce((r,n)=>{let i=Ma.pattern.getBaseDirectory(n);return i in r?r[i].push(n):r[i]=[n],r},e)}Vi.groupPatternsByBaseDirectory=iL;function oL(t,e,r){return Object.keys(t).map(n=>sL(n,t[n],e,r))}Vi.convertPatternGroupsToTasks=oL;function sL(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(Ma.pattern.convertToNegativePattern))}}Vi.convertPatternGroupToTask=sL});var eae=k(yb=>{"use strict";m();Object.defineProperty(yb,"__esModule",{value:!0});yb.read=void 0;function Jqe(t,e,r){e.fs.lstat(t,(n,i)=>{if(n!==null){Xse(r,n);return}if(!i.isSymbolicLink()||!e.followSymbolicLink){aL(r,i);return}e.fs.stat(t,(o,s)=>{if(o!==null){if(e.throwErrorOnBrokenSymbolicLink){Xse(r,o);return}aL(r,i);return}e.markSymbolicLink&&(s.isSymbolicLink=()=>!0),aL(r,s)})})}yb.read=Jqe;function Xse(t,e){t(e)}function aL(t,e){t(null,e)}});var tae=k(Qb=>{"use strict";m();Object.defineProperty(Qb,"__esModule",{value:!0});Qb.read=void 0;function jqe(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}Qb.read=jqe});var rae=k(ul=>{"use strict";m();Object.defineProperty(ul,"__esModule",{value:!0});ul.createFileSystemAdapter=ul.FILE_SYSTEM_ADAPTER=void 0;var Db=require("fs");ul.FILE_SYSTEM_ADAPTER={lstat:Db.lstat,stat:Db.stat,lstatSync:Db.lstatSync,statSync:Db.statSync};function Yqe(t){return t===void 0?ul.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},ul.FILE_SYSTEM_ADAPTER),t)}ul.createFileSystemAdapter=Yqe});var nae=k(cL=>{"use strict";m();Object.defineProperty(cL,"__esModule",{value:!0});var qqe=rae(),AL=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=qqe.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};cL.default=AL});var lp=k(ll=>{"use strict";m();Object.defineProperty(ll,"__esModule",{value:!0});ll.statSync=ll.stat=ll.Settings=void 0;var iae=eae(),Vqe=tae(),uL=nae();ll.Settings=uL.default;function zqe(t,e,r){if(typeof e=="function"){iae.read(t,lL(),e);return}iae.read(t,lL(e),r)}ll.stat=zqe;function Wqe(t,e){let r=lL(e);return Vqe.read(t,r)}ll.statSync=Wqe;function lL(t={}){return t instanceof uL.default?t:new uL.default(t)}});var aae=k((IJt,sae)=>{m();var oae;sae.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(oae||(oae=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var cae=k((BJt,Aae)=>{m();Aae.exports=Xqe;var Zqe=aae();function Xqe(t,e){let r,n,i,o=!0;Array.isArray(t)?(r=[],n=t.length):(i=Object.keys(t),r={},n=i.length);function s(A){function c(){e&&e(A,r),e=null}o?Zqe(c):c()}function a(A,c,u){r[A]=u,(--n===0||c)&&s(c)}n?i?i.forEach(function(A){t[A](function(c,u){a(A,c,u)})}):t.forEach(function(A,c){A(function(u,l){a(c,u,l)})}):s(null),o=!1}});var gL=k(bb=>{"use strict";m();Object.defineProperty(bb,"__esModule",{value:!0});bb.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var wb=process.versions.node.split(".");if(wb[0]===void 0||wb[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var uae=Number.parseInt(wb[0],10),e5e=Number.parseInt(wb[1],10),lae=10,t5e=10,r5e=uae>lae,n5e=uae===lae&&e5e>=t5e;bb.IS_SUPPORT_READDIR_WITH_FILE_TYPES=r5e||n5e});var gae=k(vb=>{"use strict";m();Object.defineProperty(vb,"__esModule",{value:!0});vb.createDirentFromStats=void 0;var pL=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function i5e(t,e){return new pL(t,e)}vb.createDirentFromStats=i5e});var dL=k(Sb=>{"use strict";m();Object.defineProperty(Sb,"__esModule",{value:!0});Sb.fs=void 0;var o5e=gae();Sb.fs=o5e});var fL=k(xb=>{"use strict";m();Object.defineProperty(xb,"__esModule",{value:!0});xb.joinPathSegments=void 0;function s5e(t,e,r){return t.endsWith(r)?t+e:t+r+e}xb.joinPathSegments=s5e});var Cae=k(gl=>{"use strict";m();Object.defineProperty(gl,"__esModule",{value:!0});gl.readdir=gl.readdirWithFileTypes=gl.read=void 0;var a5e=lp(),pae=cae(),A5e=gL(),dae=dL(),fae=fL();function c5e(t,e,r){if(!e.stats&&A5e.IS_SUPPORT_READDIR_WITH_FILE_TYPES){mae(t,e,r);return}hae(t,e,r)}gl.read=c5e;function mae(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,i)=>{if(n!==null){Fb(r,n);return}let o=i.map(a=>({dirent:a,name:a.name,path:fae.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){mL(r,o);return}let s=o.map(a=>u5e(a,e));pae(s,(a,A)=>{if(a!==null){Fb(r,a);return}mL(r,A)})})}gl.readdirWithFileTypes=mae;function u5e(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,i)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=dae.fs.createDirentFromStats(t.name,i),r(null,t)})}}function hae(t,e,r){e.fs.readdir(t,(n,i)=>{if(n!==null){Fb(r,n);return}let o=i.map(s=>{let a=fae.joinPathSegments(t,s,e.pathSegmentSeparator);return A=>{a5e.stat(a,e.fsStatSettings,(c,u)=>{if(c!==null){A(c);return}let l={name:s,path:a,dirent:dae.fs.createDirentFromStats(s,u)};e.stats&&(l.stats=u),A(null,l)})}});pae(o,(s,a)=>{if(s!==null){Fb(r,s);return}mL(r,a)})})}gl.readdir=hae;function Fb(t,e){t(e)}function mL(t,e){t(null,e)}});var Qae=k(pl=>{"use strict";m();Object.defineProperty(pl,"__esModule",{value:!0});pl.readdir=pl.readdirWithFileTypes=pl.read=void 0;var l5e=lp(),g5e=gL(),Iae=dL(),Eae=fL();function p5e(t,e){return!e.stats&&g5e.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Bae(t,e):yae(t,e)}pl.read=p5e;function Bae(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let i={dirent:n,name:n.name,path:Eae.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let o=e.fs.statSync(i.path);i.dirent=Iae.fs.createDirentFromStats(i.name,o)}catch(o){if(e.throwErrorOnBrokenSymbolicLink)throw o}return i})}pl.readdirWithFileTypes=Bae;function yae(t,e){return e.fs.readdirSync(t).map(n=>{let i=Eae.joinPathSegments(t,n,e.pathSegmentSeparator),o=l5e.statSync(i,e.fsStatSettings),s={name:n,path:i,dirent:Iae.fs.createDirentFromStats(n,o)};return e.stats&&(s.stats=o),s})}pl.readdir=yae});var Dae=k(dl=>{"use strict";m();Object.defineProperty(dl,"__esModule",{value:!0});dl.createFileSystemAdapter=dl.FILE_SYSTEM_ADAPTER=void 0;var jf=require("fs");dl.FILE_SYSTEM_ADAPTER={lstat:jf.lstat,stat:jf.stat,lstatSync:jf.lstatSync,statSync:jf.statSync,readdir:jf.readdir,readdirSync:jf.readdirSync};function d5e(t){return t===void 0?dl.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},dl.FILE_SYSTEM_ADAPTER),t)}dl.createFileSystemAdapter=d5e});var wae=k(CL=>{"use strict";m();Object.defineProperty(CL,"__esModule",{value:!0});var f5e=require("path"),m5e=lp(),h5e=Dae(),hL=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=h5e.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,f5e.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new m5e.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};CL.default=hL});var kb=k(fl=>{"use strict";m();Object.defineProperty(fl,"__esModule",{value:!0});fl.Settings=fl.scandirSync=fl.scandir=void 0;var bae=Cae(),C5e=Qae(),IL=wae();fl.Settings=IL.default;function I5e(t,e,r){if(typeof e=="function"){bae.read(t,EL(),e);return}bae.read(t,EL(e),r)}fl.scandir=I5e;function E5e(t,e){let r=EL(e);return C5e.read(t,r)}fl.scandirSync=E5e;function EL(t={}){return t instanceof IL.default?t:new IL.default(t)}});var Sae=k((GJt,vae)=>{"use strict";m();function B5e(t){var e=new t,r=e;function n(){var o=e;return o.next?e=o.next:(e=new t,r=e),o.next=null,o}function i(o){r.next=o,r=o}return{get:n,release:i}}vae.exports=B5e});var Fae=k((HJt,BL)=>{"use strict";m();var y5e=Sae();function xae(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var n=y5e(Q5e),i=null,o=null,s=0,a=null,A={push:f,drain:Po,saturated:Po,pause:u,paused:!1,get concurrency(){return r},set concurrency(D){if(!(D>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=D,!A.paused)for(;i&&s<r;)s++,C()},running:c,resume:g,idle:d,length:l,getQueue:p,unshift:h,empty:Po,kill:I,killAndDrain:B,error:y,abort:E};return A;function c(){return s}function u(){A.paused=!0}function l(){for(var D=i,b=0;D;)D=D.next,b++;return b}function p(){for(var D=i,b=[];D;)b.push(D.value),D=D.next;return b}function g(){if(A.paused){if(A.paused=!1,i===null){s++,C();return}for(;i&&s<r;)s++,C()}}function d(){return s===0&&A.length()===0}function f(D,b){var Q=n.get();Q.context=t,Q.release=C,Q.value=D,Q.callback=b||Po,Q.errorHandler=a,s>=r||A.paused?o?(o.next=Q,o=Q):(i=Q,o=Q,A.saturated()):(s++,e.call(t,Q.value,Q.worked))}function h(D,b){var Q=n.get();Q.context=t,Q.release=C,Q.value=D,Q.callback=b||Po,Q.errorHandler=a,s>=r||A.paused?i?(Q.next=i,i=Q):(i=Q,o=Q,A.saturated()):(s++,e.call(t,Q.value,Q.worked))}function C(D){D&&n.release(D);var b=i;b&&s<=r?A.paused?s--:(o===i&&(o=null),i=b.next,b.next=null,e.call(t,b.value,b.worked),o===null&&A.empty()):--s===0&&A.drain()}function I(){i=null,o=null,A.drain=Po}function B(){i=null,o=null,A.drain(),A.drain=Po}function E(){var D=i;for(i=null,o=null;D;){var b=D.next,Q=D.callback,v=D.errorHandler,S=D.value,x=D.context;D.value=null,D.callback=Po,D.errorHandler=null,v&&v(new Error("abort"),S),Q.call(x,new Error("abort")),D.release(D),D=b}A.drain=Po}function y(D){a=D}}function Po(){}function Q5e(){this.value=null,this.callback=Po,this.next=null,this.release=Po,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,n){var i=t.callback,o=t.errorHandler,s=t.value;t.value=null,t.callback=Po,t.errorHandler&&o(r,s),i.call(t.context,r,n),t.release(t)}}function D5e(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function n(u,l){e.call(this,u).then(function(p){l(null,p)},l)}var i=xae(t,n,r),o=i.push,s=i.unshift;return i.push=a,i.unshift=A,i.drained=c,i;function a(u){var l=new Promise(function(p,g){o(u,function(d,f){if(d){g(d);return}p(f)})});return l.catch(Po),l}function A(u){var l=new Promise(function(p,g){s(u,function(d,f){if(d){g(d);return}p(f)})});return l.catch(Po),l}function c(){var u=new Promise(function(l){process.nextTick(function(){if(i.idle())l();else{var p=i.drain;i.drain=function(){typeof p=="function"&&p(),l(),i.drain=p}}})});return u}}BL.exports=xae;BL.exports.promise=D5e});var Rb=k(UA=>{"use strict";m();Object.defineProperty(UA,"__esModule",{value:!0});UA.joinPathSegments=UA.replacePathSegmentSeparator=UA.isAppliedFilter=UA.isFatalError=void 0;function w5e(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}UA.isFatalError=w5e;function b5e(t,e){return t===null||t(e)}UA.isAppliedFilter=b5e;function v5e(t,e){return t.split(/[/\\]/).join(e)}UA.replacePathSegmentSeparator=v5e;function S5e(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}UA.joinPathSegments=S5e});var DL=k(QL=>{"use strict";m();Object.defineProperty(QL,"__esModule",{value:!0});var x5e=Rb(),yL=class{constructor(e,r){this._root=e,this._settings=r,this._root=x5e.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};QL.default=yL});var vL=k(bL=>{"use strict";m();Object.defineProperty(bL,"__esModule",{value:!0});var F5e=require("events"),k5e=kb(),R5e=Fae(),Nb=Rb(),N5e=DL(),wL=class extends N5e.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=k5e.scandir,this._emitter=new F5e.EventEmitter,this._queue=R5e(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,i=>{i!==null&&this._handleError(i)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,i)=>{if(n!==null){r(n,void 0);return}for(let o of i)this._handleEntry(o,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!Nb.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=Nb.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),Nb.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&Nb.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};bL.default=wL});var kae=k(xL=>{"use strict";m();Object.defineProperty(xL,"__esModule",{value:!0});var T5e=vL(),SL=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new T5e.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{M5e(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{P5e(e,this._storage)}),this._reader.read()}};xL.default=SL;function M5e(t,e){t(e)}function P5e(t,e){t(null,e)}});var Rae=k(kL=>{"use strict";m();Object.defineProperty(kL,"__esModule",{value:!0});var _5e=require("stream"),L5e=vL(),FL=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new L5e.default(this._root,this._settings),this._stream=new _5e.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};kL.default=FL});var Nae=k(NL=>{"use strict";m();Object.defineProperty(NL,"__esModule",{value:!0});var U5e=kb(),Tb=Rb(),O5e=DL(),RL=class extends O5e.default{constructor(){super(...arguments),this._scandir=U5e.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let i of n)this._handleEntry(i,r)}catch(n){this._handleError(n)}}_handleError(e){if(Tb.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=Tb.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),Tb.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&Tb.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};NL.default=RL});var Tae=k(ML=>{"use strict";m();Object.defineProperty(ML,"__esModule",{value:!0});var G5e=Nae(),TL=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new G5e.default(this._root,this._settings)}read(){return this._reader.read()}};ML.default=TL});var Mae=k(_L=>{"use strict";m();Object.defineProperty(_L,"__esModule",{value:!0});var K5e=require("path"),H5e=kb(),PL=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,K5e.sep),this.fsScandirSettings=new H5e.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};_L.default=PL});var Pb=k(OA=>{"use strict";m();Object.defineProperty(OA,"__esModule",{value:!0});OA.Settings=OA.walkStream=OA.walkSync=OA.walk=void 0;var Pae=kae(),$5e=Rae(),J5e=Tae(),LL=Mae();OA.Settings=LL.default;function j5e(t,e,r){if(typeof e=="function"){new Pae.default(t,Mb()).read(e);return}new Pae.default(t,Mb(e)).read(r)}OA.walk=j5e;function Y5e(t,e){let r=Mb(e);return new J5e.default(t,r).read()}OA.walkSync=Y5e;function q5e(t,e){let r=Mb(e);return new $5e.default(t,r).read()}OA.walkStream=q5e;function Mb(t={}){return t instanceof LL.default?t:new LL.default(t)}});var _b=k(OL=>{"use strict";m();Object.defineProperty(OL,"__esModule",{value:!0});var V5e=require("path"),z5e=lp(),_ae=Hc(),UL=class{constructor(e){this._settings=e,this._fsStatSettings=new z5e.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return V5e.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:_ae.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!_ae.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};OL.default=UL});var HL=k(KL=>{"use strict";m();Object.defineProperty(KL,"__esModule",{value:!0});var W5e=require("stream"),Z5e=lp(),X5e=Pb(),eVe=_b(),GL=class extends eVe.default{constructor(){super(...arguments),this._walkStream=X5e.walkStream,this._stat=Z5e.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),i=new W5e.PassThrough({objectMode:!0});i._write=(o,s,a)=>this._getEntry(n[o],e[o],r).then(A=>{A!==null&&r.entryFilter(A)&&i.push(A),o===n.length-1&&i.end(),a()}).catch(a);for(let o=0;o<n.length;o++)i.write(o);return i}_getEntry(e,r,n){return this._getStat(e).then(i=>this._makeEntry(i,r)).catch(i=>{if(n.errorFilter(i))return null;throw i})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(i,o)=>i===null?r(o):n(i))})}};KL.default=GL});var Lae=k(JL=>{"use strict";m();Object.defineProperty(JL,"__esModule",{value:!0});var tVe=Pb(),rVe=_b(),nVe=HL(),$L=class extends rVe.default{constructor(){super(...arguments),this._walkAsync=tVe.walk,this._readerStream=new nVe.default(this._settings)}dynamic(e,r){return new Promise((n,i)=>{this._walkAsync(e,r,(o,s)=>{o===null?n(s):i(o)})})}async static(e,r){let n=[],i=this._readerStream.static(e,r);return new Promise((o,s)=>{i.once("error",s),i.on("data",a=>n.push(a)),i.once("end",()=>o(n))})}};JL.default=$L});var Uae=k(YL=>{"use strict";m();Object.defineProperty(YL,"__esModule",{value:!0});var sE=Hc(),jL=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return sE.pattern.getPatternParts(e,this._micromatchOptions).map(n=>sE.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:sE.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return sE.array.splitWhen(e,r=>r.dynamic&&sE.pattern.hasGlobStar(r.pattern))}};YL.default=jL});var Oae=k(VL=>{"use strict";m();Object.defineProperty(VL,"__esModule",{value:!0});var iVe=Uae(),qL=class extends iVe.default{match(e){let r=e.split("/"),n=r.length,i=this._storage.filter(o=>!o.complete||o.segments.length>n);for(let o of i){let s=o.sections[0];if(!o.complete&&n>s.length||r.every((A,c)=>{let u=o.segments[c];return!!(u.dynamic&&u.patternRe.test(A)||!u.dynamic&&u.pattern===A)}))return!0}return!1}};VL.default=qL});var Gae=k(WL=>{"use strict";m();Object.defineProperty(WL,"__esModule",{value:!0});var Lb=Hc(),oVe=Oae(),zL=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let i=this._getMatcher(r),o=this._getNegativePatternsRe(n);return s=>this._filter(e,s,i,o)}_getMatcher(e){return new oVe.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(Lb.pattern.isAffectDepthOfReadingPattern);return Lb.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,i){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let o=Lb.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(o,n)?!1:this._isSkippedByNegativePatterns(o,i)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let i=e.split("/").length;return n-i}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!Lb.pattern.matchAny(e,r)}};WL.default=zL});var Kae=k(XL=>{"use strict";m();Object.defineProperty(XL,"__esModule",{value:!0});var ml=Hc(),ZL=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,i]=ml.pattern.partitionAbsoluteAndRelative(r),o={positive:{all:ml.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:ml.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:ml.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return s=>this._filter(s,o)}_filter(e,r){let n=ml.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(n),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let i=ml.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let i=ml.pattern.matchAny(e,r);return!i&&n?ml.pattern.matchAny(e+"/",r):i}};XL.default=ZL});var Hae=k(tU=>{"use strict";m();Object.defineProperty(tU,"__esModule",{value:!0});var sVe=Hc(),eU=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return sVe.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};tU.default=eU});var Jae=k(nU=>{"use strict";m();Object.defineProperty(nU,"__esModule",{value:!0});var $ae=Hc(),rU=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=$ae.path.makeAbsolute(this._settings.cwd,r),r=$ae.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};nU.default=rU});var Ub=k(oU=>{"use strict";m();Object.defineProperty(oU,"__esModule",{value:!0});var aVe=require("path"),AVe=Gae(),cVe=Kae(),uVe=Hae(),lVe=Jae(),iU=class{constructor(e){this._settings=e,this.errorFilter=new uVe.default(this._settings),this.entryFilter=new cVe.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new AVe.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new lVe.default(this._settings)}_getRootDirectory(e){return aVe.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};oU.default=iU});var jae=k(aU=>{"use strict";m();Object.defineProperty(aU,"__esModule",{value:!0});var gVe=Lae(),pVe=Ub(),sU=class extends pVe.default{constructor(){super(...arguments),this._reader=new gVe.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(o=>n.transform(o))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};aU.default=sU});var Yae=k(cU=>{"use strict";m();Object.defineProperty(cU,"__esModule",{value:!0});var dVe=require("stream"),fVe=HL(),mVe=Ub(),AU=class extends mVe.default{constructor(){super(...arguments),this._reader=new fVe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(r,e,n),o=new dVe.Readable({objectMode:!0,read:()=>{}});return i.once("error",s=>o.emit("error",s)).on("data",s=>o.emit("data",n.transform(s))).once("end",()=>o.emit("end")),o.once("close",()=>i.destroy()),o}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};cU.default=AU});var qae=k(lU=>{"use strict";m();Object.defineProperty(lU,"__esModule",{value:!0});var hVe=lp(),CVe=Pb(),IVe=_b(),uU=class extends IVe.default{constructor(){super(...arguments),this._walkSync=CVe.walkSync,this._statSync=hVe.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let i of e){let o=this._getFullEntryPath(i),s=this._getEntry(o,i,r);s===null||!r.entryFilter(s)||n.push(s)}return n}_getEntry(e,r,n){try{let i=this._getStat(e);return this._makeEntry(i,r)}catch(i){if(n.errorFilter(i))return null;throw i}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};lU.default=uU});var Vae=k(pU=>{"use strict";m();Object.defineProperty(pU,"__esModule",{value:!0});var EVe=qae(),BVe=Ub(),gU=class extends BVe.default{constructor(){super(...arguments),this._reader=new EVe.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};pU.default=gU});var zae=k(qf=>{"use strict";m();Object.defineProperty(qf,"__esModule",{value:!0});qf.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var Yf=require("fs"),yVe=require("os"),QVe=Math.max(yVe.cpus().length,1);qf.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:Yf.lstat,lstatSync:Yf.lstatSync,stat:Yf.stat,statSync:Yf.statSync,readdir:Yf.readdir,readdirSync:Yf.readdirSync};var dU=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,QVe),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},qf.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};qf.default=dU});var CU=k((Ujt,Zae)=>{"use strict";m();var Wae=Zse(),DVe=jae(),wVe=Yae(),bVe=Vae(),fU=zae(),_s=Hc();async function mU(t,e){Pa(t);let r=hU(t,DVe.default,e),n=await Promise.all(r);return _s.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(c,u){Pa(c);let l=hU(c,bVe.default,u);return _s.array.flatten(l)}t.sync=e;function r(c,u){Pa(c);let l=hU(c,wVe.default,u);return _s.stream.merge(l)}t.stream=r;function n(c,u){Pa(c);let l=[].concat(c),p=new fU.default(u);return Wae.generate(l,p)}t.generateTasks=n;function i(c,u){Pa(c);let l=new fU.default(u);return _s.pattern.isDynamicPattern(c,l)}t.isDynamicPattern=i;function o(c){return Pa(c),_s.path.escape(c)}t.escapePath=o;function s(c){return Pa(c),_s.path.convertPathToPattern(c)}t.convertPathToPattern=s;let a;(function(c){function u(p){return Pa(p),_s.path.escapePosixPath(p)}c.escapePath=u;function l(p){return Pa(p),_s.path.convertPosixPathToPattern(p)}c.convertPathToPattern=l})(a=t.posix||(t.posix={}));let A;(function(c){function u(p){return Pa(p),_s.path.escapeWindowsPath(p)}c.escapePath=u;function l(p){return Pa(p),_s.path.convertWindowsPathToPattern(p)}c.convertPathToPattern=l})(A=t.win32||(t.win32={}))})(mU||(mU={}));function hU(t,e,r){let n=[].concat(t),i=new fU.default(r),o=Wae.generate(n,i),s=new e(i);return o.map(s.read,s)}function Pa(t){if(![].concat(t).every(n=>_s.string.isString(n)&&!_s.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}Zae.exports=mU});async function IU(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return(await eAe.default[t](r))[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}function EU(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return Xae.default[t](r)[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}var Xae,eAe,Gjt,tAe,Kjt,Hjt,rAe,$jt,nAe=N(()=>{m();Xae=z(require("node:fs"),1),eAe=z(require("node:fs/promises"),1);Gjt=IU.bind(void 0,"stat","isFile"),tAe=IU.bind(void 0,"stat","isDirectory"),Kjt=IU.bind(void 0,"lstat","isSymbolicLink"),Hjt=EU.bind(void 0,"statSync","isFile"),rAe=EU.bind(void 0,"statSync","isDirectory"),$jt=EU.bind(void 0,"lstatSync","isSymbolicLink")});var iAe=N(()=>{m()});function $c(t){return t instanceof URL?(0,sAe.fileURLToPath)(t):t}function aAe(t){return{*[Symbol.iterator](){let e=BU.default.resolve($c(t)),r;for(;r!==e;)yield e,r=e,e=BU.default.resolve(e,"..")}}}var oAe,yU,BU,sAe,Vjt,zjt,Ob=N(()=>{m();oAe=require("node:util"),yU=require("node:child_process"),BU=z(require("node:path"),1),sAe=require("node:url");iAe();Vjt=(0,oAe.promisify)(yU.execFile);zjt=10*1024*1024});function Vf(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}var AAe=N(()=>{m()});var aE,QU=N(()=>{m();aE=t=>t[0]==="!"});var cAe,uAe,lAe,gp,DU,gAe,vVe,pAe,dAe,SVe,xVe,FVe,fAe,mAe,hAe,CAe,IAe=N(()=>{m();cAe=z(require("node:process"),1),uAe=z(require("node:fs"),1),lAe=z(require("node:fs/promises"),1),gp=z(require("node:path"),1),DU=z(CU(),1),gAe=z(require("ignore"),1);AAe();Ob();QU();vVe=["**/node_modules","**/flow-typed","**/coverage","**/.git"],pAe={absolute:!0,dot:!0},dAe="**/.gitignore",SVe=(t,e)=>aE(t)?"!"+gp.default.posix.join(e,t.slice(1)):gp.default.posix.join(e,t),xVe=(t,e)=>{let r=Vf(gp.default.relative(e,gp.default.dirname(t.filePath)));return t.content.split(/\r?\n/).filter(n=>n&&!n.startsWith("#")).map(n=>SVe(n,r))},FVe=(t,e)=>{if(e=Vf(e),gp.default.isAbsolute(t)){if(Vf(t).startsWith(e))return gp.default.relative(e,t);throw new Error(`Path ${t} is not in cwd ${e}`)}return t},fAe=(t,e)=>{let r=t.flatMap(i=>xVe(i,e)),n=(0,gAe.default)().add(r);return i=>(i=$c(i),i=FVe(i,e),i?n.ignores(Vf(i)):!1)},mAe=(t={})=>({cwd:$c(t.cwd)??cAe.default.cwd(),suppressErrors:!!t.suppressErrors,deep:typeof t.deep=="number"?t.deep:Number.POSITIVE_INFINITY,ignore:[...t.ignore??[],...vVe]}),hAe=async(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=mAe(e),s=await(0,DU.default)(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...pAe}),a=await Promise.all(s.map(async A=>({filePath:A,content:await lAe.default.readFile(A,"utf8")})));return fAe(a,r)},CAe=(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:o}=mAe(e),a=DU.default.sync(t,{cwd:r,suppressErrors:n,deep:i,ignore:o,...pAe}).map(A=>({filePath:A,content:uAe.default.readFileSync(A,"utf8")}));return fAe(a,r)}});var wU,yAe,pp,zf,kVe,QAe,DAe,EAe,BAe,bU,RVe,wAe,bAe,Gb,vAe,NVe,SAe,xAe,FAe,kAe,RAe,NAe,vU,Kb,d6t,f6t,m6t,h6t,C6t,I6t,TAe=N(()=>{m();wU=z(require("node:process"),1),yAe=z(require("node:fs"),1),pp=z(require("node:path"),1);uoe();zf=z(CU(),1);nAe();Ob();IAe();QU();kVe=t=>{if(t.some(e=>typeof e!="string"))throw new TypeError("Patterns must be a string or an array of strings")},QAe=(t,e)=>{let r=aE(t)?t.slice(1):t;return pp.default.isAbsolute(r)?r:pp.default.join(e,r)},DAe=({directoryPath:t,files:e,extensions:r})=>{let n=r?.length>0?`.${r.length>1?`{${r.join(",")}}`:r[0]}`:"";return e?e.map(i=>pp.default.posix.join(t,`**/${pp.default.extname(i)?i:`${i}${n}`}`)):[pp.default.posix.join(t,`**${n?`/*${n}`:""}`)]},EAe=async(t,{cwd:e=wU.default.cwd(),files:r,extensions:n}={})=>(await Promise.all(t.map(async o=>await tAe(QAe(o,e))?DAe({directoryPath:o,files:r,extensions:n}):o))).flat(),BAe=(t,{cwd:e=wU.default.cwd(),files:r,extensions:n}={})=>t.flatMap(i=>rAe(QAe(i,e))?DAe({directoryPath:i,files:r,extensions:n}):i),bU=t=>(t=[...new Set([t].flat())],kVe(t),t),RVe=t=>{if(!t)return;let e;try{e=yAe.default.statSync(t)}catch{return}if(!e.isDirectory())throw new Error("The `cwd` option must be a path to a directory")},wAe=(t={})=>(t={...t,ignore:t.ignore??[],expandDirectories:t.expandDirectories??!0,cwd:$c(t.cwd)},RVe(t.cwd),t),bAe=t=>async(e,r)=>t(bU(e),wAe(r)),Gb=t=>(e,r)=>t(bU(e),wAe(r)),vAe=t=>{let{ignoreFiles:e,gitignore:r}=t,n=e?bU(e):[];return r&&n.push(dAe),n},NVe=async t=>{let e=vAe(t);return xAe(e.length>0&&await hAe(e,t))},SAe=t=>{let e=vAe(t);return xAe(e.length>0&&CAe(e,t))},xAe=t=>{let e=new Set;return r=>{let n=pp.default.normalize(r.path??r);return e.has(n)||t&&t(n)?!1:(e.add(n),!0)}},FAe=(t,e)=>t.flat().filter(r=>e(r)),kAe=(t,e)=>{let r=[];for(;t.length>0;){let n=t.findIndex(o=>aE(o));if(n===-1){r.push({patterns:t,options:e});break}let i=t[n].slice(1);for(let o of r)o.options.ignore.push(i);n!==0&&r.push({patterns:t.slice(0,n),options:{...e,ignore:[...e.ignore,i]}}),t=t.slice(n+1)}return r},RAe=(t,e)=>({...e?{cwd:e}:{},...Array.isArray(t)?{files:t}:t}),NAe=async(t,e)=>{let r=kAe(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=RAe(i,n);return Promise.all(r.map(async s=>{let{patterns:a,options:A}=s;return[a,A.ignore]=await Promise.all([EAe(a,o),EAe(A.ignore,{cwd:n})]),{patterns:a,options:A}}))},vU=(t,e)=>{let r=kAe(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let o=RAe(i,n);return r.map(s=>{let{patterns:a,options:A}=s;return a=BAe(a,o),A.ignore=BAe(A.ignore,{cwd:n}),{patterns:a,options:A}})},Kb=bAe(async(t,e)=>{let[r,n]=await Promise.all([NAe(t,e),NVe(e)]),i=await Promise.all(r.map(o=>(0,zf.default)(o.patterns,o.options)));return FAe(i,n)}),d6t=Gb((t,e)=>{let r=vU(t,e),n=SAe(e),i=r.map(o=>zf.default.sync(o.patterns,o.options));return FAe(i,n)}),f6t=Gb((t,e)=>{let r=vU(t,e),n=SAe(e),i=r.map(s=>zf.default.stream(s.patterns,s.options));return T1(i).filter(s=>n(s))}),m6t=Gb((t,e)=>t.some(r=>zf.default.isDynamicPattern(r,e))),h6t=bAe(NAe),C6t=Gb(vU),{convertPathToPattern:I6t}=zf.default});function Wf(t){let e=Date.now();return new Promise((r,n)=>{let o=TVe(t.url)({protocol:t.url.protocol,host:t.url.host,port:t.url.port,path:t.url.pathname+t.url.search,method:t.method,headers:t.headers},s=>{let a="";s.on("data",A=>{a+=A}),s.on("end",()=>{if((0,MAe.debug)(`${t.method} ${t.url.href}, duration: ${Date.now()-e}ms`),typeof s.statusCode=="number"&&s.statusCode>=200&&s.statusCode<300)if(typeof s.headers["content-type"]!="string"||!s.headers["content-type"].includes("application/json"))n(`Response from ${t.url.href} content-type is ${s.headers["content-type"]}`);else try{r(JSON.parse(a))}catch(A){n(`Response from ${t.url.href} is not valid JSON: ${a}
|
|
1261
1261
|
${A}`)}else n(`Request to ${t.url.href} failed with status ${s.statusCode}: ${a}`)})}).on("error",s=>{n(`Error fetching ${t.url.href}, ${s}`)});t.body&&(o.setHeader("Content-Type","application/json"),o.write(t.body)),o.end()})}function TVe(t){if(t.protocol==="https:")return _Ae.request;if(t.protocol==="http:")return PAe.request;throw new Error(`Unsupported protocol ${t.protocol}`)}var MAe,PAe,_Ae,LAe=N(()=>{"use strict";m();MAe=require("node:console"),PAe=require("node:http"),_Ae=require("node:https")});async function UAe(t){let e=new URL(`https://cdn.builder.io/api/v3/query/${t.publicApiKey}/${t.model}`);return e.searchParams.set("omit","meta.componentsUsed"),e.searchParams.set("apiKey",t.publicApiKey),e.searchParams.set("userAttributes.urlPath",t.pageUrl),e.searchParams.set("options.page.model",`"${t.model}"`),e.searchParams.set("cachebust","true"),(await Wf({url:e,method:"GET"}))[t.model]}async function OAe(t,e){if(e.kind===HC.VCP)return!0;let r=new URL("https://cdn.builder.io/api/v2/admin"),n={query:`query {
|
|
1262
1262
|
models {
|
|
@@ -1276,7 +1276,7 @@ Restarting server after Builder Devtools update...
|
|
|
1276
1276
|
<h3>How's Devtools working for you?</h3>
|
|
1277
1277
|
<p>We'd love your feedback!</p>
|
|
1278
1278
|
</div>
|
|
1279
|
-
\`,t.appendChild(e),setTimeout(()=>{e.classList.add("menu-toggle-tooltip-show"),e.addEventListener("click",()=>{e.classList.remove("menu-toggle-tooltip-show")})},1e3)};function ui(t){t.getElementById("go-to-builder").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open(Ur(),"builder")}),t.getElementById("components-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let c=t.querySelector(".nav-cmp-list .section-content");c.scrollTop=0,oe(t,"nav-cmp-list"),ai(t)}),t.getElementById("settings-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),oe(t,"nav-settings")}),t.getElementById("add-page-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open(je(),"builder")}),t.getElementById("import-from-figma").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open("https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more")})}function ci(t){let e=t.getElementById("enable-edit");e.addEventListener("change",r=>{r.stopPropagation(),Ht(e.checked)}),e.checked=it(),Ht(e.checked)}var Dt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=\`<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}.menu-toggle{position:absolute;right:0;bottom:0;pointer-events:auto;padding:8px;background:transparent;border:none;appearance:none}.menu-toggle div{position:relative;width:64px;height:64px;pointer-events:none;border-radius:50%;background:#000;border:1px solid white;box-shadow:#00000054 0 0 8px}.menu-toggle:hover div{background-color:var(--background-color);border:1px solid rgb(220,220,220)}.menu-toggle svg{position:absolute;top:15px;left:15px;width:33px;height:32px}div.highlight-bg{position:absolute;top:-1px;left:-1px;background-color:#1a1a1a;pointer-events:none;transition:all .4s ease-out;opacity:0}.menu-toggle-highlight-no-transition div.highlight-bg{transition:none}.menu-toggle-highlight div.highlight-bg{opacity:1}.menu-toggle-tooltip{position:absolute;bottom:0;right:0;width:382px;height:72px;padding:0;text-align:left;appearance:none;background-color:transparent;border:none;pointer-events:none;transform:translate3d(320px,0,0);opacity:0;transition:all .15s ease-in-out;color:#fff}.menu-toggle-tooltip.menu-toggle-tooltip-show{pointer-events:auto;opacity:1;transform:translateZ(0)}.menu-toggle-tooltip-content{position:absolute;inset:0 95px 10px 0;padding:8px 12px;background-color:var(--primary-color);box-shadow:#00000054 0 0 20px;border-radius:2px}.menu-toggle-tooltip-content:before{content:"";position:absolute;bottom:15px;right:-6px;width:30px;height:30px;background-color:var(--primary-color);transform:rotate(45deg)}.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,.menu-toggle-tooltip:hover .menu-toggle-tooltip-content:before{background-color:var(--primary-color-highlight)}.menu-toggle-tooltip-content h3{margin:0;font-size:16px}.menu-toggle-tooltip-content p{margin:0;font-size:12px}section{position:absolute;display:grid;grid-template-rows:64px auto 64px;top:0;left:0;width:100%;height:100%;padding:0;pointer-events:none}.section-content{margin:0;padding:0 0 10px;font-weight:300;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;overflow-y:auto}.section-content .error{color:var(--error-color);font-weight:700}section a{text-decoration:none;color:var(--text-color)}section h3,section p{margin-left:16px;margin-right:16px}.info{font-size:12px}ul.list{list-style:none;padding:0;margin:0}ul.list li{display:block;padding:0;margin:0}ul.list a,ul.list button{display:grid;grid-template-columns:24px auto;grid-gap:16px;padding:12px;margin:8px 0;border:none;background:transparent;appearance:none;width:100%;font-weight:300;text-align:left;text-decoration:none;color:var(--text-color)}ul.list a:hover,ul.list button:hover{text-decoration:none;color:var(--text-color);background-color:var(--button-background-color-hover)}ul.list a span,ul.list button span{display:block;font-size:16px;font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}header{position:relative;display:grid;grid-template-columns:44px 1fr;gap:8px;padding-left:8px;border-bottom:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}header>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nav-home header>div{margin-right:56px}header h2{margin:7px 0 0;font-size:18px;font-weight:500;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p{margin:2px 0 0;font-size:12px;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button{display:block;margin:0;padding:0;width:100%;font-size:12px;font-weight:300;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button:hover{text-decoration:underline;color:var(--primary-color)}.builder-logo{margin:12px 0 0 8px}#close{display:block;position:absolute;appearance:none;background:transparent;border:none;border-radius:50%;margin:0;padding:0;right:4px;top:8px;width:48px;height:48px;z-index:1;opacity:.7}#close:hover{opacity:1;background-color:var(--button-background-color-hover)}#close svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}.back-button{position:relative;display:block;margin:7px 0 0 -2px;width:48px;height:48px;background:transparent;border:none;appearance:none;border-radius:50%}.back-button:hover{background-color:var(--button-background-color-hover)}.back-button svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}footer{border-top:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}section.nav-cmp-list{grid-template-rows:64px auto 120px}footer a{text-decoration:underline;color:var(--primary-color)}footer a:hover{color:var(--primary-color);text-decoration:none}.nav-list{padding:2px 0}.nav-loading{pointer-events:none}.nav-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.nav-loading .nav-loading-icon{opacity:.5}.nav-list h4{margin:8px 8px 8px 10px;font-size:14px;font-weight:600}.nav-list .nav-list-item+h4{margin-top:30px}.nav-list-item{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:relative;margin:2px 0;padding:8px 28px 8px 46px;width:100%;font-size:14px;font-weight:300;text-align:left;border:none;background:transparent;appearance:none}.nav-list-item:hover{background-color:var(--button-background-color-hover)}.nav-list-item-icon{position:absolute;top:4px;left:10px;width:24px;height:24px;object-fit:contain;filter:invert(100%);background-size:24px 24px;background-repeat:no-repeat;background-position:center center}.nav-list-item span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}.nav-list-item:after{display:block;position:absolute;content:"";background-image:url('data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');background-repeat:no-repeat;background-position:12px 9px;top:0;right:0;width:32px;height:32px;pointer-events:none}.nav-list-item-note{opacity:0;font-size:12px;padding-top:1px;text-align:right}.nav-list-item:hover .nav-list-item-note{opacity:.5}.ui-select{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-select h3{margin:0;font-size:14px;font-weight:500}.ui-select p{margin:8px 0;font-size:12px;font-weight:300}.ui-select .select{position:relative;margin:8px 0;border-radius:4px;padding:0;line-height:1.1;overflow:hidden;border:1px solid var(--border-color)}.ui-select select{appearance:none;background-color:transparent;border:none;outline:none;padding:8px 32px 8px 8px;margin:0;width:100%;font-size:14px;cursor:pointer;text-overflow:ellipsis;opacity:.6;color:var(--text-color)}.ui-select .select:after{content:"";top:6px;right:5px;width:24px;height:24px;position:absolute;background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>');background-repeat:no-repeat;background-position:center;pointer-events:none;opacity:.6}.ui-select .select:hover{border-color:var(--primary-color-subdued)}.ui-text-input .select:focus-within{border-color:var(--primary-color)}.ui-text-input .select:focus-within select{opacity:1}.spinner:after{content:" ";display:block;width:32px;height:32px;margin:0 auto;pointer-events:auto;border-radius:50%;border:3px solid var(--text-color);border-color:var(--text-color) transparent var(--text-color) transparent;animation:spinner .75s linear infinite}@keyframes spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ui-switch{display:grid;grid-template-columns:auto 48px;grid-gap:20px;margin:8px 0 16px;padding:8px 0 8px 16px;cursor:pointer}.ui-switch>*{pointer-events:none}.ui-switch input{display:none;visibility:hidden}.ui-switch .switcher{display:inline-block;border-radius:100px;width:35px;height:14px;background-color:#ccc;position:relative;top:6px;vertical-align:middle;cursor:pointer}.ui-switch input[type=checkbox]:checked+.switcher{background-color:var(--primary-color-subdued)}.ui-switch .switcher:before{content:"";display:block;width:20px;height:20px;background-color:var(--text-color);box-shadow:0 1px 3px #0009;border-radius:50%;position:absolute;top:-3px;left:0;margin-right:0;transition:all .15s}.ui-switch input[type=checkbox]:checked+.switcher:before{left:100%;margin-left:-20px;background-color:var(--primary-color)}.ui-switch h3{margin:0;font-size:14px;font-weight:500}.ui-switch p{margin:4px 0 0;font-size:12px;font-weight:300}.ui-text-input{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-text-input h3{margin:0;font-size:14px;font-weight:500}.ui-text-input p{margin:8px 0;font-size:12px;font-weight:300}.ui-text-input .input{position:relative;margin:8px 0;border:1px solid var(--border-color);border-radius:4px;background:transparent;padding:2px;overflow:hidden}.ui-text-input input{display:block;width:235px;font-size:14px;border:none;background:transparent;padding:6px;appearance:none;color:var(--text-color);opacity:.6;outline:none}.ui-text-input .input:hover{border-color:var(--primary-color-subdued)}.ui-text-input .input:focus-within{border-color:var(--primary-color)}.ui-text-input .input:focus-within input{opacity:1}.ui-text-input .input:after{content:"";position:absolute;top:5px;right:14px;width:8px;height:17px;border:2px solid rgba(51,181,51,1);border-top:none;border-left:none;transform:rotate(45deg);opacity:0;transition:opacity 80ms ease-in-out;pointer-events:none}.ui-text-input.saved .input:after{opacity:1}.ui-toast{position:fixed;bottom:8px;left:8px;right:8px;padding:6px 12px;font-size:14px;border-radius:4px;transform:translate3d(0,150%,0);opacity:0;transition:all var(--transition-time) ease-in-out;background-color:var(--primary-color-subdued);color:var(--text-color);pointer-events:none}.ui-toast.ui-toast-show{transform:translateZ(0);opacity:1;pointer-events:auto}[data-view=nav-home] .nav-home .section-content,[data-view=nav-cmp-list] .nav-cmp-list .section-content,[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,[data-view=nav-cmp-input] .nav-cmp-input .section-content,[data-view=nav-settings] .nav-settings .section-content{transform:translateZ(0);pointer-events:auto}[data-view=nav-home] .nav-home header,[data-view=nav-home] .nav-home footer,[data-view=nav-cmp-list] .nav-cmp-list header,[data-view=nav-cmp-list] .nav-cmp-list footer,[data-view=nav-cmp-detail] .nav-cmp-detail header,[data-view=nav-cmp-detail] .nav-cmp-detail footer,[data-view=nav-cmp-input] .nav-cmp-input header,[data-view=nav-cmp-input] .nav-cmp-input footer,[data-view=nav-settings] .nav-settings header,[data-view=nav-settings] .nav-settings footer{opacity:1;pointer-events:auto}[data-view=nav-cmp-list] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-home .section-content,[data-view=nav-cmp-input] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-cmp-detail .section-content,[data-view=nav-settings] .nav-home .section-content{transform:translate3d(-105%,0,0)}.cmp-item .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');opacity:.3}.cmp-item.registered .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>');opacity:.8}.search-highlight{background-color:var(--primary-color-alpha);padding:0 2px;border-radius:2px;font-weight:500}.search-container{position:sticky;top:0;z-index:10;padding:12px 16px;background:var(--background-color);border-bottom:1px solid var(--border-color)}.search-input-wrapper{position:relative;display:flex;align-items:center}.search-icon{position:absolute;left:12px;color:var(--text-color-secondary);pointer-events:none}.component-search-input{width:100%;height:36px;padding:8px 36px;border:1px solid var(--border-color);border-radius:6px;background:var(--input-background);color:var(--text-color);font-size:14px;transition:border-color .2s,box-shadow .2s}.component-search-input:focus{outline:none;border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color-alpha)}.component-search-input::placeholder{color:var(--text-color-tertiary)}.clear-search-button{position:absolute;right:8px;padding:4px;color:var(--text-color-secondary);border:none;background:transparent;border-radius:4px;cursor:pointer;opacity:0;transition:opacity .2s,background-color .2s;display:flex;align-items:center;justify-content:center}.clear-search-button:hover{background-color:var(--hover-color)}.component-search-input:not(:placeholder-shown)+.clear-search-button{opacity:1}.no-results{padding:32px 16px;text-align:center;color:var(--text-color-secondary);font-size:14px}#cmp-detail{position:relative}.cmp-loading{pointer-events:none!important}.cmp-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.cmp-loading .cmp-loading-icon{opacity:.5}.cmp-cover{position:absolute;top:160px;left:0;width:100%;height:100vh;background:var(--background-color);transform:translateZ(0);pointer-events:none;display:none}[data-view=nav-cmp-detail] .cmp-cover{display:block;pointer-events:auto}.cmp-enabled .cmp-cover{transform:translate3d(0,105%,0);pointer-events:none}.section-ready .cmp-cover{transition:all var(--transition-time) ease-in-out}.cmp-detail-inputs-container{margin:8px 0 16px;padding:0}.cmp-detail-inputs-container h3{margin:0 0 6px;padding-left:16px;padding-right:8px;font-size:14px;font-weight:500;display:flex;justify-content:space-between;align-items:center}.cmp-detail-inputs-reload{font-weight:300;font-size:.9em;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cmp-detail-inputs-reload:hover{text-decoration:underline;color:var(--primary-color)}.cmp-detail-inputs-container .cmp-inputs-empty{padding:0;margin-top:12px;font-size:12px;font-weight:300;opacity:.5;font-style:italic}.cmp-detail-inputs-container .nav-list-item-icon{opacity:.8;background-size:20px 20px;background-position:4px center}.input-icon{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>')}.input-icon-array{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>')}.input-icon-boolean{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>')}.input-icon-number{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>')}.input-icon-object{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>')}.input-icon-string{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>')}.cmp-input-item-unregistered{opacity:.4}.cmp-input-item-unregistered .input-icon:after{content:"";position:absolute;top:11px;left:4px;width:20px;height:2px;background-color:#000;transform:rotate(-45deg)}.cmp-prop-info{border-bottom:1px solid var(--border-color)}.cmp-input-readonly{margin:16px 0;padding:0 16px;display:grid;grid-template-columns:50% 50%;gap:12px}.cmp-input-readonly h3{margin:0;font-size:14px;font-weight:500}.cmp-input-readonly span{margin-top:2px;font-size:12px;font-weight:300;opacity:.8}.cmp-input-detail{margin:16px 0}.cmp-input-detail a{color:var(--primary-color);text-decoration:none}.cmp-input-detail a:hover{text-decoration:underline}.input-cover{position:absolute;top:175px;left:0;width:100%;height:100%;background:var(--background-color);transform:translateZ(0);transition:all var(--transition-time) ease-in-out;pointer-events:auto}.input-enabled .input-cover{transform:translate3d(0,105%,0);pointer-events:none}.input-loading-icon{position:absolute;display:inline-block;top:190px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.input-loading .input-loading-icon{opacity:.5}:host{position:fixed;inset:0;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}aside{position:absolute;top:0;right:0;width:var(--menu-width);height:100%;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;background:var(--background-color);box-shadow:#000000c9 5px 0 20px;overflow:hidden;z-index:1}:host(.show-builder-menu) aside{pointer-events:auto;transform:translateZ(0)}#hit{position:absolute;inset:0;display:none}:host(.show-builder-menu) #hit{display:block;pointer-events:auto}#version{position:absolute;bottom:6px;right:6px;font-size:8px;color:#9b9b9b}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder's selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder's Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder's Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>\`,si(e),ui(e),oi(e),ri(e),ti(e),ci(e),this.setAttribute("aria-hidden","true"),e.getElementById("version").textContent="v1.40.0"}highlightOpener(){let e=this.shadowRoot.querySelector(".menu-toggle");e.classList.add("menu-toggle-highlight"),e.classList.add("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight")},20)},20)}};var lo=\`<style>*,*:before,*:after{box-sizing:border-box}html,body,:host{position:fixed;top:0;left:0;width:100%;height:100vh;z-index:2147483646;margin:0;padding:0;line-height:1.8;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#252525;color:#fff;transition:opacity .25s ease-in-out}:host([aria-hidden="true"]){opacity:0;pointer-events:none}main{position:absolute;top:0;left:0;width:100%;height:100vh}h1{margin-top:0;font-size:24px;font-weight:300;line-height:1.4}p{margin:20px 0;font-weight:300}button{cursor:pointer}aside{position:absolute;top:0;left:0;width:350px;height:100vh;padding:60px 0 0 50px;background-color:#121212}aside ul{margin:30px 0 0;padding:0;list-style:none}aside li{position:relative;margin:0;padding:20px 10px;font-weight:300}aside li.highlight{color:#48a1ff}aside li.active{font-weight:700}aside li .circle{position:absolute;top:20px;left:10px;width:24px;height:24px;border:3px solid white;border-radius:50%;font-size:14px}aside li.highlight .circle{border-color:#48a1ff}aside li.active .circle:after{content:"";position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background-color:#48a1ff}aside li.completed .circle{background-color:#48a1ff}aside li.completed .circle:after{content:"";position:absolute;top:2px;left:6px;width:6px;height:13px;border:3px solid black;border-top:none;border-left:none;transform:rotate(45deg)}aside li .line{position:absolute;top:44px;left:21px;width:3px;height:45px;background-color:#fff}aside li.completed .line{background-color:#48a1ff}aside li span{display:block;margin-left:44px}nav{margin-top:30px}section{position:absolute;top:135px;left:350px;padding:0 80px 0 140px;transition:opacity .15s ease-in-out}section[aria-hidden=true]{pointer-events:none;opacity:0}section h1,section p{min-width:300px;max-width:600px}.button{position:relative;display:inline-block;color:#fff;background-color:#48a1ff;border-radius:4px;text-decoration:none;padding:10px 40px 10px 20px;white-space:nowrap}.button:hover{background-color:#48a1ffd9}#button-icon{position:absolute;top:1px;right:5px;bottom:0;width:30px;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>');background-repeat:no-repeat;background-position:center;background-size:24px 24px}.button[aria-disabled=true]{opacity:.9;background-color:#ffffff4d;pointer-events:none;padding-right:60px}.button[aria-disabled=true] #button-icon{top:21px;right:29px;width:8px;height:8px;border-radius:4px;background:#fff;color:#fff;animation:dot-flashing .5s infinite linear alternate;animation-delay:.25s}.button[aria-disabled=true] #button-icon:before,.button[aria-disabled=true] #button-icon:after{content:"";display:inline-block;position:absolute;top:0}.button[aria-disabled=true] #button-icon:before{left:-12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:0s}.button[aria-disabled=true] #button-icon:after{left:12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:.5s}@keyframes dot-flashing{0%{background-color:#fff}50%,to{background-color:#ffffff4d}}.logo{margin-left:9px;background:url('data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>');background-repeat:no-repeat;width:150px;height:32px}@media(max-width:840px){aside{width:250px;padding:60px 0 0 20px}section{left:250px;padding:0 80px}}@media(max-width:590px){aside{width:230px;padding:60px 0 0 10px}section{left:230px;padding:0 40px}}#modified-files-message a{color:#cbcbcb;font-weight:300;text-decoration:underline}#modified-files-message a:hover{color:#fff;text-decoration:none}#restart-warning{border-radius:4px;padding:8px 16px;border:1px solid #fd6b3c;background:#fd6b3c1a}#react-router-steps{margin:0 0 5px;padding:0 20px}#need-help{color:#48a1ff;text-decoration:none}#router-message{border-radius:4px;padding:16px;border:1px solid #48a1ff}#router-finish-button{margin-top:12px}#router-checkbox-div{display:flex;align-items:center}#router-checkbox{margin-right:10px;width:15px;height:15px}#success-title{display:flex;align-items:center;gap:10px}#success-title .check-icon{display:inline-block;width:24px;height:24px;border:2px solid #28a745;border-radius:50%;position:relative}#success-title .check-icon:before{content:"";position:absolute;top:50%;left:50%;width:6px;height:12px;border:solid #28a745;border-width:0 2px 2px 0;transform:translate(-50%,-60%) rotate(45deg)}
|
|
1279
|
+
\`,t.appendChild(e),setTimeout(()=>{e.classList.add("menu-toggle-tooltip-show"),e.addEventListener("click",()=>{e.classList.remove("menu-toggle-tooltip-show")})},1e3)};function ui(t){t.getElementById("go-to-builder").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open(Ur(),"builder")}),t.getElementById("components-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let c=t.querySelector(".nav-cmp-list .section-content");c.scrollTop=0,oe(t,"nav-cmp-list"),ai(t)}),t.getElementById("settings-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),oe(t,"nav-settings")}),t.getElementById("add-page-link").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open(je(),"builder")}),t.getElementById("import-from-figma").addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Ee(t,!1),window.open("https://www.figma.com/community/plugin/747985167520967365/builder-io-ai-powered-figma-to-code-react-vue-tailwind-more")})}function ci(t){let e=t.getElementById("enable-edit");e.addEventListener("change",r=>{r.stopPropagation(),Ht(e.checked)}),e.checked=it(),Ht(e.checked)}var Dt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=\`<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}.menu-toggle{position:absolute;right:0;bottom:0;pointer-events:auto;padding:8px;background:transparent;border:none;appearance:none}.menu-toggle div{position:relative;width:64px;height:64px;pointer-events:none;border-radius:50%;background:#000;border:1px solid white;box-shadow:#00000054 0 0 8px}.menu-toggle:hover div{background-color:var(--background-color);border:1px solid rgb(220,220,220)}.menu-toggle svg{position:absolute;top:15px;left:15px;width:33px;height:32px}div.highlight-bg{position:absolute;top:-1px;left:-1px;background-color:#1a1a1a;pointer-events:none;transition:all .4s ease-out;opacity:0}.menu-toggle-highlight-no-transition div.highlight-bg{transition:none}.menu-toggle-highlight div.highlight-bg{opacity:1}.menu-toggle-tooltip{position:absolute;bottom:0;right:0;width:382px;height:72px;padding:0;text-align:left;appearance:none;background-color:transparent;border:none;pointer-events:none;transform:translate3d(320px,0,0);opacity:0;transition:all .15s ease-in-out;color:#fff}.menu-toggle-tooltip.menu-toggle-tooltip-show{pointer-events:auto;opacity:1;transform:translateZ(0)}.menu-toggle-tooltip-content{position:absolute;inset:0 95px 10px 0;padding:8px 12px;background-color:var(--primary-color);box-shadow:#00000054 0 0 20px;border-radius:2px}.menu-toggle-tooltip-content:before{content:"";position:absolute;bottom:15px;right:-6px;width:30px;height:30px;background-color:var(--primary-color);transform:rotate(45deg)}.menu-toggle-tooltip:hover .menu-toggle-tooltip-content,.menu-toggle-tooltip:hover .menu-toggle-tooltip-content:before{background-color:var(--primary-color-highlight)}.menu-toggle-tooltip-content h3{margin:0;font-size:16px}.menu-toggle-tooltip-content p{margin:0;font-size:12px}section{position:absolute;display:grid;grid-template-rows:64px auto 64px;top:0;left:0;width:100%;height:100%;padding:0;pointer-events:none}.section-content{margin:0;padding:0 0 10px;font-weight:300;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;overflow-y:auto}.section-content .error{color:var(--error-color);font-weight:700}section a{text-decoration:none;color:var(--text-color)}section h3,section p{margin-left:16px;margin-right:16px}.info{font-size:12px}ul.list{list-style:none;padding:0;margin:0}ul.list li{display:block;padding:0;margin:0}ul.list a,ul.list button{display:grid;grid-template-columns:24px auto;grid-gap:16px;padding:12px;margin:8px 0;border:none;background:transparent;appearance:none;width:100%;font-weight:300;text-align:left;text-decoration:none;color:var(--text-color)}ul.list a:hover,ul.list button:hover{text-decoration:none;color:var(--text-color);background-color:var(--button-background-color-hover)}ul.list a span,ul.list button span{display:block;font-size:16px;font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}header{position:relative;display:grid;grid-template-columns:44px 1fr;gap:8px;padding-left:8px;border-bottom:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}header>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nav-home header>div{margin-right:56px}header h2{margin:7px 0 0;font-size:18px;font-weight:500;line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p{margin:2px 0 0;font-size:12px;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button{display:block;margin:0;padding:0;width:100%;font-size:12px;font-weight:300;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}header p button:hover{text-decoration:underline;color:var(--primary-color)}.builder-logo{margin:12px 0 0 8px}#close{display:block;position:absolute;appearance:none;background:transparent;border:none;border-radius:50%;margin:0;padding:0;right:4px;top:8px;width:48px;height:48px;z-index:1;opacity:.7}#close:hover{opacity:1;background-color:var(--button-background-color-hover)}#close svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}.back-button{position:relative;display:block;margin:7px 0 0 -2px;width:48px;height:48px;background:transparent;border:none;appearance:none;border-radius:50%}.back-button:hover{background-color:var(--button-background-color-hover)}.back-button svg{position:absolute;top:12px;left:12px;width:24px;height:24px;fill:currentColor;pointer-events:none}footer{border-top:1px solid var(--border-color);transition:opacity var(--transition-time) ease-in-out;opacity:0;pointer-events:none}section.nav-cmp-list{grid-template-rows:64px auto 120px}footer a{text-decoration:underline;color:var(--primary-color)}footer a:hover{color:var(--primary-color);text-decoration:none}.nav-list{padding:2px 0}.nav-loading{pointer-events:none}.nav-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.nav-loading .nav-loading-icon{opacity:.5}.nav-list h4{margin:8px 8px 8px 10px;font-size:14px;font-weight:600}.nav-list .nav-list-item+h4{margin-top:30px}.nav-list-item{display:grid;grid-template-columns:1fr 1fr;gap:8px;position:relative;margin:2px 0;padding:8px 28px 8px 46px;width:100%;font-size:14px;font-weight:300;text-align:left;border:none;background:transparent;appearance:none}.nav-list-item:hover{background-color:var(--button-background-color-hover)}.nav-list-item-icon{position:absolute;top:4px;left:10px;width:24px;height:24px;object-fit:contain;filter:invert(100%);background-size:24px 24px;background-repeat:no-repeat;background-position:center center}.nav-list-item span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}.nav-list-item:after{display:block;position:absolute;content:"";background-image:url('data:image/svg+xml,<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L1 13" stroke="%23F2F2F2" stroke-opacity="0.5" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');background-repeat:no-repeat;background-position:12px 9px;top:0;right:0;width:32px;height:32px;pointer-events:none}.nav-list-item-note{opacity:0;font-size:12px;padding-top:1px;text-align:right}.nav-list-item:hover .nav-list-item-note{opacity:.5}.ui-select{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-select h3{margin:0;font-size:14px;font-weight:500}.ui-select p{margin:8px 0;font-size:12px;font-weight:300}.ui-select .select{position:relative;margin:8px 0;border-radius:4px;padding:0;line-height:1.1;overflow:hidden;border:1px solid var(--border-color)}.ui-select select{appearance:none;background-color:transparent;border:none;outline:none;padding:8px 32px 8px 8px;margin:0;width:100%;font-size:14px;cursor:pointer;text-overflow:ellipsis;opacity:.6;color:var(--text-color)}.ui-select .select:after{content:"";top:6px;right:5px;width:24px;height:24px;position:absolute;background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23F2F2F2" d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/></svg>');background-repeat:no-repeat;background-position:center;pointer-events:none;opacity:.6}.ui-select .select:hover{border-color:var(--primary-color-subdued)}.ui-text-input .select:focus-within{border-color:var(--primary-color)}.ui-text-input .select:focus-within select{opacity:1}.spinner:after{content:" ";display:block;width:32px;height:32px;margin:0 auto;pointer-events:auto;border-radius:50%;border:3px solid var(--text-color);border-color:var(--text-color) transparent var(--text-color) transparent;animation:spinner .75s linear infinite}@keyframes spinner{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ui-switch{display:grid;grid-template-columns:auto 48px;grid-gap:20px;margin:8px 0 16px;padding:8px 0 8px 16px;cursor:pointer}.ui-switch>*{pointer-events:none}.ui-switch input{display:none;visibility:hidden}.ui-switch .switcher{display:inline-block;border-radius:100px;width:35px;height:14px;background-color:#ccc;position:relative;top:6px;vertical-align:middle;cursor:pointer}.ui-switch input[type=checkbox]:checked+.switcher{background-color:var(--primary-color-subdued)}.ui-switch .switcher:before{content:"";display:block;width:20px;height:20px;background-color:var(--text-color);box-shadow:0 1px 3px #0009;border-radius:50%;position:absolute;top:-3px;left:0;margin-right:0;transition:all .15s}.ui-switch input[type=checkbox]:checked+.switcher:before{left:100%;margin-left:-20px;background-color:var(--primary-color)}.ui-switch h3{margin:0;font-size:14px;font-weight:500}.ui-switch p{margin:4px 0 0;font-size:12px;font-weight:300}.ui-text-input{display:block;margin:8px 0 16px;padding:8px 16px;cursor:pointer}.ui-text-input h3{margin:0;font-size:14px;font-weight:500}.ui-text-input p{margin:8px 0;font-size:12px;font-weight:300}.ui-text-input .input{position:relative;margin:8px 0;border:1px solid var(--border-color);border-radius:4px;background:transparent;padding:2px;overflow:hidden}.ui-text-input input{display:block;width:235px;font-size:14px;border:none;background:transparent;padding:6px;appearance:none;color:var(--text-color);opacity:.6;outline:none}.ui-text-input .input:hover{border-color:var(--primary-color-subdued)}.ui-text-input .input:focus-within{border-color:var(--primary-color)}.ui-text-input .input:focus-within input{opacity:1}.ui-text-input .input:after{content:"";position:absolute;top:5px;right:14px;width:8px;height:17px;border:2px solid rgba(51,181,51,1);border-top:none;border-left:none;transform:rotate(45deg);opacity:0;transition:opacity 80ms ease-in-out;pointer-events:none}.ui-text-input.saved .input:after{opacity:1}.ui-toast{position:fixed;bottom:8px;left:8px;right:8px;padding:6px 12px;font-size:14px;border-radius:4px;transform:translate3d(0,150%,0);opacity:0;transition:all var(--transition-time) ease-in-out;background-color:var(--primary-color-subdued);color:var(--text-color);pointer-events:none}.ui-toast.ui-toast-show{transform:translateZ(0);opacity:1;pointer-events:auto}[data-view=nav-home] .nav-home .section-content,[data-view=nav-cmp-list] .nav-cmp-list .section-content,[data-view=nav-cmp-detail] .nav-cmp-detail .section-content,[data-view=nav-cmp-input] .nav-cmp-input .section-content,[data-view=nav-settings] .nav-settings .section-content{transform:translateZ(0);pointer-events:auto}[data-view=nav-home] .nav-home header,[data-view=nav-home] .nav-home footer,[data-view=nav-cmp-list] .nav-cmp-list header,[data-view=nav-cmp-list] .nav-cmp-list footer,[data-view=nav-cmp-detail] .nav-cmp-detail header,[data-view=nav-cmp-detail] .nav-cmp-detail footer,[data-view=nav-cmp-input] .nav-cmp-input header,[data-view=nav-cmp-input] .nav-cmp-input footer,[data-view=nav-settings] .nav-settings header,[data-view=nav-settings] .nav-settings footer{opacity:1;pointer-events:auto}[data-view=nav-cmp-list] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-home .section-content,[data-view=nav-cmp-detail] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-home .section-content,[data-view=nav-cmp-input] .nav-cmp-list .section-content,[data-view=nav-cmp-input] .nav-cmp-detail .section-content,[data-view=nav-settings] .nav-home .section-content{transform:translate3d(-105%,0,0)}.cmp-item .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20.83 16.809C20.94 16.561 21 16.289 21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L7.988 3.99001M5.441 5.44801L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L18.544 18.56" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M14.532 10.538L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.27002 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/><path d="M3 3L21 21" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/></svg>');opacity:.3}.cmp-item.registered .nav-list-item-icon{background-image:url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /></svg>');opacity:.8}.search-highlight{background-color:var(--primary-color-alpha);padding:0 2px;border-radius:2px;font-weight:500}.search-container{position:sticky;top:0;z-index:10;padding:12px 16px;background:var(--background-color);border-bottom:1px solid var(--border-color)}.search-input-wrapper{position:relative;display:flex;align-items:center}.search-icon{position:absolute;left:12px;color:var(--text-color-secondary);pointer-events:none}.component-search-input{width:100%;height:36px;padding:8px 36px;border:1px solid var(--border-color);border-radius:6px;background:var(--input-background);color:var(--text-color);font-size:14px;transition:border-color .2s,box-shadow .2s}.component-search-input:focus{outline:none;border-color:var(--primary-color);box-shadow:0 0 0 2px var(--primary-color-alpha)}.component-search-input::placeholder{color:var(--text-color-tertiary)}.clear-search-button{position:absolute;right:8px;padding:4px;color:var(--text-color-secondary);border:none;background:transparent;border-radius:4px;cursor:pointer;opacity:0;transition:opacity .2s,background-color .2s;display:flex;align-items:center;justify-content:center}.clear-search-button:hover{background-color:var(--hover-color)}.component-search-input:not(:placeholder-shown)+.clear-search-button{opacity:1}.no-results{padding:32px 16px;text-align:center;color:var(--text-color-secondary);font-size:14px}#cmp-detail{position:relative}.cmp-loading{pointer-events:none!important}.cmp-loading-icon{position:absolute;display:inline-block;top:170px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.cmp-loading .cmp-loading-icon{opacity:.5}.cmp-cover{position:absolute;top:160px;left:0;width:100%;height:100vh;background:var(--background-color);transform:translateZ(0);pointer-events:none;display:none}[data-view=nav-cmp-detail] .cmp-cover{display:block;pointer-events:auto}.cmp-enabled .cmp-cover{transform:translate3d(0,105%,0);pointer-events:none}.section-ready .cmp-cover{transition:all var(--transition-time) ease-in-out}.cmp-detail-inputs-container{margin:8px 0 16px;padding:0}.cmp-detail-inputs-container h3{margin:0 0 6px;padding-left:16px;padding-right:8px;font-size:14px;font-weight:500;display:flex;justify-content:space-between;align-items:center}.cmp-detail-inputs-reload{font-weight:300;font-size:.9em;text-decoration:none;appearance:none;text-align:left;background-color:transparent;border:none;color:var(--primary-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cmp-detail-inputs-reload:hover{text-decoration:underline;color:var(--primary-color)}.cmp-detail-inputs-container .cmp-inputs-empty{padding:0;margin-top:12px;font-size:12px;font-weight:300;opacity:.5;font-style:italic}.cmp-detail-inputs-container .nav-list-item-icon{opacity:.8;background-size:20px 20px;background-position:4px center}.input-icon{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path></svg>')}.input-icon-array{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-6a2 2 0 1 1 4 0v6"></path> <path d="M10 13h4"></path></svg>')}.input-icon-boolean{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16h2a2 2 0 1 0 0 -4h-2h2a2 2 0 1 0 0 -4h-2v8z"></path></svg>')}.input-icon-number{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 16v-8l4 8v-8"></path></svg>')}.input-icon-object{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M12 8a2 2 0 0 1 2 2v4a2 2 0 1 1 -4 0v-4a2 2 0 0 1 2 -2z"></path></svg>')}.input-icon-string{background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"></path> <path d="M10 15a1 1 0 0 0 1 1h2a1 1 0 0 0 1 -1v-2a1 1 0 0 0 -1 -1h-2a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1"></path></svg>')}.cmp-input-item-unregistered{opacity:.4}.cmp-input-item-unregistered .input-icon:after{content:"";position:absolute;top:11px;left:4px;width:20px;height:2px;background-color:#000;transform:rotate(-45deg)}.cmp-prop-info{border-bottom:1px solid var(--border-color)}.cmp-input-readonly{margin:16px 0;padding:0 16px;display:grid;grid-template-columns:50% 50%;gap:12px}.cmp-input-readonly h3{margin:0;font-size:14px;font-weight:500}.cmp-input-readonly span{margin-top:2px;font-size:12px;font-weight:300;opacity:.8}.cmp-input-detail{margin:16px 0}.cmp-input-detail a{color:var(--primary-color);text-decoration:none}.cmp-input-detail a:hover{text-decoration:underline}.input-cover{position:absolute;top:175px;left:0;width:100%;height:100%;background:var(--background-color);transform:translateZ(0);transition:all var(--transition-time) ease-in-out;pointer-events:auto}.input-enabled .input-cover{transform:translate3d(0,105%,0);pointer-events:none}.input-loading-icon{position:absolute;display:inline-block;top:190px;left:0;width:100%;transform:translateZ(0);pointer-events:auto;opacity:0;transition:all 50ms ease-in-out;transition-delay:50ms;pointer-events:none}.input-loading .input-loading-icon{opacity:.5}:host{position:fixed;inset:0;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}aside{position:absolute;top:0;right:0;width:var(--menu-width);height:100%;transform:translate3d(105%,0,0);transition:transform var(--transition-time) ease-in-out;background:var(--background-color);box-shadow:#000000c9 5px 0 20px;overflow:hidden;z-index:1}:host(.show-builder-menu) aside{pointer-events:auto;transform:translateZ(0)}#hit{position:absolute;inset:0;display:none}:host(.show-builder-menu) #hit{display:block;pointer-events:auto}#version{position:absolute;bottom:6px;right:6px;font-size:8px;color:#9b9b9b}</style><div id="hit"></div> <aside data-view="nav-home"> <section class="nav-home"> <header> <svg class="builder-logo" viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> <div> <h2 class="builder-home-title">Builder Devtools</h2> <p><button id="go-to-builder">Go to Builder</button></p> </div> <button id="close" aria-label="Close Menu"> <svg viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M18 6l-12 12" /> <path d="M6 6l12 12" /> </svg> </button> </header> <div class="section-content"> <ul class="list"> <li> <button id="components-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M21 16.008V7.99001C20.9994 7.64108 20.9066 7.29851 20.731 6.99699C20.5554 6.69547 20.3032 6.44571 20 6.27301L13 2.26501C12.6954 2.09103 12.3508 1.99951 12 1.99951C11.6492 1.99951 11.3046 2.09103 11 2.26501L4 6.27301C3.381 6.62801 3 7.28301 3 7.99101V16.009C3 16.718 3.381 17.372 4 17.726L11 21.734C11.3046 21.908 11.6492 21.9995 12 21.9995C12.3508 21.9995 12.6954 21.908 13 21.734L20 17.726C20.619 17.371 21 16.716 21 16.008Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 22V12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M12 12L20.73 6.95996" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M3.26999 6.95996L12 12" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Components</span> </button> </li> <li> <button id="settings-link"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M10.325 4.317C10.751 2.561 13.249 2.561 13.675 4.317C13.7389 4.5808 13.8642 4.82578 14.0407 5.032C14.2172 5.23822 14.4399 5.39985 14.6907 5.50375C14.9414 5.60764 15.2132 5.65085 15.4838 5.62987C15.7544 5.60889 16.0162 5.5243 16.248 5.383C17.791 4.443 19.558 6.209 18.618 7.753C18.4769 7.98466 18.3924 8.24634 18.3715 8.51677C18.3506 8.78721 18.3938 9.05877 18.4975 9.30938C18.6013 9.55999 18.7627 9.78258 18.9687 9.95905C19.1747 10.1355 19.4194 10.2609 19.683 10.325C21.439 10.751 21.439 13.249 19.683 13.675C19.4192 13.7389 19.1742 13.8642 18.968 14.0407C18.7618 14.2172 18.6001 14.4399 18.4963 14.6907C18.3924 14.9414 18.3491 15.2132 18.3701 15.4838C18.3911 15.7544 18.4757 16.0162 18.617 16.248C19.557 17.791 17.791 19.558 16.247 18.618C16.0153 18.4769 15.7537 18.3924 15.4832 18.3715C15.2128 18.3506 14.9412 18.3938 14.6906 18.4975C14.44 18.6013 14.2174 18.7627 14.0409 18.9687C13.8645 19.1747 13.7391 19.4194 13.675 19.683C13.249 21.439 10.751 21.439 10.325 19.683C10.2611 19.4192 10.1358 19.1742 9.95929 18.968C9.7828 18.7618 9.56011 18.6001 9.30935 18.4963C9.05859 18.3924 8.78683 18.3491 8.51621 18.3701C8.24559 18.3911 7.98375 18.4757 7.752 18.617C6.209 19.557 4.442 17.791 5.382 16.247C5.5231 16.0153 5.60755 15.7537 5.62848 15.4832C5.64942 15.2128 5.60624 14.9412 5.50247 14.6906C5.3987 14.44 5.23726 14.2174 5.03127 14.0409C4.82529 13.8645 4.58056 13.7391 4.317 13.675C2.561 13.249 2.561 10.751 4.317 10.325C4.5808 10.2611 4.82578 10.1358 5.032 9.95929C5.23822 9.7828 5.39985 9.56011 5.50375 9.30935C5.60764 9.05859 5.65085 8.78683 5.62987 8.51621C5.60889 8.24559 5.5243 7.98375 5.383 7.752C4.443 6.209 6.209 4.442 7.753 5.382C8.753 5.99 10.049 5.452 10.325 4.317Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> <path d="M9 12C9 12.7956 9.31607 13.5587 9.87868 14.1213C10.4413 14.6839 11.2044 15 12 15C12.7956 15 13.5587 14.6839 14.1213 14.1213C14.6839 13.5587 15 12.7956 15 12C15 11.2044 14.6839 10.4413 14.1213 9.87868C13.5587 9.31607 12.7956 9 12 9C11.2044 9 10.4413 9.31607 9.87868 9.87868C9.31607 10.4413 9 11.2044 9 12Z" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Settings</span> </button> </li> <li> <button id="add-page-link"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M14 3v4a1 1 0 0 0 1 1h4" /> <path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z" /> <path d="M12 11l0 6" /> <path d="M9 14l6 0" /> </svg> <span>Add Builder Page</span> </button> </li> <li> <button id="import-from-figma"> <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-figma" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" > <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M15 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" /> <path d="M6 3m0 3a3 3 0 0 1 3 -3h6a3 3 0 0 1 3 3v0a3 3 0 0 1 -3 3h-6a3 3 0 0 1 -3 -3z" /> <path d="M9 9a3 3 0 0 0 0 6h3m-3 0a3 3 0 1 0 3 3v-15" /> </svg> <span>Import From Figma</span> </button> </li> </ul> </div> <footer> <ul class="list"> <li> <a href="https://docs.google.com/forms/d/e/1FAIpQLSdqZcJpRtm_Ia5DTHP6SDY9Xa6LID3KiTjRWkjMzWyJRUtSHw/viewform" target="_blank" > <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" > <path d="M11.013 17.0114L10.013 18.0114L2.513 10.5834C2.0183 10.102 1.62864 9.52342 1.36854 8.88404C1.10845 8.24466 0.983558 7.55836 1.00173 6.86834C1.01991 6.17832 1.18076 5.49954 1.47415 4.87474C1.76755 4.24994 2.18713 3.69266 2.70648 3.23799C3.22583 2.78331 3.8337 2.4411 4.49181 2.23289C5.14991 2.02468 5.844 1.95499 6.53036 2.02821C7.21673 2.10143 7.8805 2.31596 8.47987 2.65831C9.07925 3.00066 9.60124 3.46341 10.013 4.01741C10.8086 2.95654 11.9931 2.2552 13.3059 2.06766C14.6186 1.88012 15.9521 2.22176 17.013 3.01741C18.0739 3.81306 18.7752 4.99755 18.9627 6.3103C19.1503 7.62305 18.8086 8.95654 18.013 10.0174" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M18.2006 19.8175L16.0286 20.9555C15.9642 20.989 15.8917 21.004 15.8192 20.9987C15.7467 20.9934 15.6771 20.9681 15.6182 20.9256C15.5593 20.8831 15.5134 20.825 15.4855 20.7579C15.4577 20.6907 15.4491 20.6172 15.4606 20.5455L15.8756 18.1345L14.1186 16.4275C14.0662 16.3768 14.0291 16.3123 14.0115 16.2416C13.9939 16.1708 13.9966 16.0965 14.0192 16.0271C14.0418 15.9578 14.0835 15.8962 14.1394 15.8494C14.1954 15.8026 14.2634 15.7725 14.3356 15.7625L16.7636 15.4105L17.8496 13.2175C17.8821 13.1521 17.9322 13.0972 17.9942 13.0588C18.0562 13.0204 18.1277 13 18.2006 13C18.2736 13 18.3451 13.0204 18.4071 13.0588C18.4691 13.0972 18.5191 13.1521 18.5516 13.2175L19.6376 15.4105L22.0656 15.7625C22.1377 15.7728 22.2054 15.8031 22.2611 15.85C22.3168 15.8968 22.3583 15.9583 22.3809 16.0275C22.4034 16.0967 22.4062 16.1708 22.3888 16.2415C22.3715 16.3122 22.3347 16.3766 22.2826 16.4275L20.5256 18.1345L20.9396 20.5445C20.9521 20.6163 20.9441 20.6902 20.9166 20.7578C20.8891 20.8254 20.8433 20.8839 20.7842 20.9267C20.7252 20.9695 20.6553 20.9949 20.5825 21C20.5098 21.005 20.4371 20.9896 20.3726 20.9555L18.2006 19.8175Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> </svg> <span>Give Feedback</span> </a> </li> </ul> <div id="version"></div> </footer> </section> <section class="nav-cmp-list"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div class="search-container"> <div class="search-input-wrapper"> <svg class="search-icon" viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M15.5 15.5L20 20M10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10C17 13.866 13.866 17 10 17Z" /> </svg> <input type="text" id="component-search" class="component-search-input" placeholder="Search components..." autocomplete="off" spellcheck="false" /> <button id="clear-search" class="clear-search-button" type="button" aria-label="Clear search" > <svg viewBox="0 0 24 24" width="16" height="16"> <path fill="none" stroke="currentColor" stroke-width="2" d="M6 6l12 12M6 18L18 6" /> </svg> </button> </div> </div> <div> <h2>Custom Components</h2> <p> <button id="open-builder-registry"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-list" class="cmp-list nav-list"></div> </div> <div class="nav-loading-icon spinner"></div> <footer> <p class="info"> Expand on Builder's selection of built-in blocks by <a target="_blank" href="https://www.builder.io/c/docs/custom-components-intro" >registering components</a > from your codebase. This way, teammates can drag and drop your components within Builder's Visual Editor just like any other block. </p> </footer> </section> <section class="nav-cmp-detail"> <header> <button class="back-button" data-back="nav-cmp-list"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-detail-title"></h2> <p> <button id="cmp-open-source"></button> </p> </div> </header> <div class="section-content"> <div id="cmp-error"></div> <label class="ui-switch"> <div> <h3>Register Component</h3> <p> Registers this component so it can be used within Builder Visual CMS </p> </div> <input type="checkbox" role="switch" id="cmp-register" /> <span class="switcher"></span> </label> <div id="cmp-detail"> <label class="ui-text-input"> <h3>Component Name</h3> <div class="input"> <input type="text" id="cmp-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="2" maxlength="30" required placeholder="e.g. My Counter" /> </div> <p> Unique name to identify this custom component within Builder. Press ESC to cancel </p> </label> <div class="cmp-detail-inputs-container"> <h3> <span>Builder Inputs (Props)</span> <button class="cmp-detail-inputs-reload" id="btn-inputs-reload"> Reload </button> </h3> <div id="cmp-detail-inputs"></div> </div> </div> </div> <div class="cmp-cover"></div> <div class="cmp-loading-icon spinner"></div> </section> <section class="nav-cmp-input"> <header> <button class="back-button" data-back="nav-cmp-detail"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2 id="cmp-input-title"></h2> <p> <button id="input-open-source"></button> </p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable Input</h3> <p>Add this component prop as a Builder input</p> </div> <input type="checkbox" role="switch" id="input-register" /> <span class="switcher"></span> </label> <div class="cmp-prop-info"> <div class="cmp-input-readonly"> <h3>Prop Name</h3> <span id="cmp-prop-name"></span> </div> <div class="cmp-input-readonly"> <h3>Prop Type</h3> <span id="cmp-prop-type"></span> </div> </div> <div class="cmp-input-detail"> <label class="ui-text-input"> <h3>Builder Input Name</h3> <div class="input"> <input type="text" id="input-name" autocapitalize="off" autocorrect="off" spellcheck="false" autocomplete="off" minlength="1" maxlength="30" required placeholder="e.g. Text" /> </div> <p> Friendly name to identify this component prop as a Builder input. Press ESC to cancel </p> </label> <label class="ui-select"> <h3>Builder Input Type</h3> <div class="select"> <select id="input-type"></select> </div> <p> Correlate to what editing UI is appropriate for this Builder input. <a href="https://www.builder.io/c/docs/custom-components-input-types" target="_blank" >Read more about input types.</a > </p> </label> </div> <div class="input-cover"></div> <div class="input-loading-icon spinner"></div> </div> </section> <section class="nav-settings"> <header> <button class="back-button"> <svg viewBox="0 0 24 24"> <path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" /> </svg> </button> <div> <h2>Settings</h2> <p>Configure Builder's Devtools</p> </div> </header> <div class="section-content"> <label class="ui-switch"> <div> <h3>Enable edit button in UI</h3> <p>Enables the edit button so you can edit content in Builder</p> </div> <input type="checkbox" role="switch" id="enable-edit" /> <span class="switcher"></span> </label> </div> </section> <div class="ui-toast" id="toast"></div> </aside> <button class="menu-toggle" aria-label="Toggle Builder Devtools"> <div> <div class="highlight-bg"></div> <svg viewBox="0 0 31 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M31 9.96854C31.0016 11.4553 30.6701 12.9236 30.03 14.2654C29.3898 15.6072 28.4572 16.7884 27.3007 17.7221L0.702841 2.61812C0.601104 2.56012 0.506714 2.49008 0.421705 2.40951C0.288323 2.27871 0.182333 2.12263 0.109928 1.95039C0.0375215 1.77814 0.000151253 1.59319 0 1.40633C0 1.03335 0.148098 0.675643 0.411715 0.411905C0.675332 0.148167 1.03287 0 1.40568 0L21.036 0C23.6786 0 26.213 1.05025 28.0816 2.91972C29.9502 4.78918 31 7.32472 31 9.96854Z" fill="#18B4F4" /> <path d="M31 25.4757C31.0004 26.7849 30.7429 28.0815 30.2423 29.2912C29.7417 30.5009 29.0078 31.6001 28.0825 32.526C27.1572 33.4519 26.0587 34.1864 24.8497 34.6875C23.6406 35.1886 22.3448 35.4465 21.0361 35.4465H1.40573C1.12766 35.4436 0.856725 35.3581 0.627199 35.201C0.397672 35.044 0.219871 34.8223 0.116289 34.5641C0.0127078 34.3059 -0.011999 34.0228 0.0452946 33.7505C0.102588 33.4783 0.239308 33.2292 0.438156 33.0347C0.517415 32.9551 0.606358 32.8858 0.702893 32.8284L11.1705 26.8843L27.2984 17.7244C28.4548 18.6579 29.3874 19.8387 30.028 21.18C30.6685 22.5213 31.0007 23.9891 31 25.4757Z" fill="#FD6B3C" /> <path d="M27.3011 17.7221L11.1709 26.8843L0.703209 32.8284C0.602697 32.8843 0.509784 32.9528 0.426758 33.0323C4.41799 28.9369 6.6496 23.442 6.64456 17.7221C6.65208 12.0015 4.42111 6.50517 0.429101 2.40948C0.51411 2.49005 0.6085 2.56009 0.710237 2.61809L27.3011 17.7221Z" fill="#A97FF2" /> </svg> </div> </button>\`,si(e),ui(e),oi(e),ri(e),ti(e),ci(e),this.setAttribute("aria-hidden","true"),e.getElementById("version").textContent="v1.40.1-beta.202604062051.216bab5"}highlightOpener(){let e=this.shadowRoot.querySelector(".menu-toggle");e.classList.add("menu-toggle-highlight"),e.classList.add("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight-no-transition"),setTimeout(()=>{e.classList.remove("menu-toggle-highlight")},20)},20)}};var lo=\`<style>*,*:before,*:after{box-sizing:border-box}html,body,:host{position:fixed;top:0;left:0;width:100%;height:100vh;z-index:2147483646;margin:0;padding:0;line-height:1.8;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";background-color:#252525;color:#fff;transition:opacity .25s ease-in-out}:host([aria-hidden="true"]){opacity:0;pointer-events:none}main{position:absolute;top:0;left:0;width:100%;height:100vh}h1{margin-top:0;font-size:24px;font-weight:300;line-height:1.4}p{margin:20px 0;font-weight:300}button{cursor:pointer}aside{position:absolute;top:0;left:0;width:350px;height:100vh;padding:60px 0 0 50px;background-color:#121212}aside ul{margin:30px 0 0;padding:0;list-style:none}aside li{position:relative;margin:0;padding:20px 10px;font-weight:300}aside li.highlight{color:#48a1ff}aside li.active{font-weight:700}aside li .circle{position:absolute;top:20px;left:10px;width:24px;height:24px;border:3px solid white;border-radius:50%;font-size:14px}aside li.highlight .circle{border-color:#48a1ff}aside li.active .circle:after{content:"";position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background-color:#48a1ff}aside li.completed .circle{background-color:#48a1ff}aside li.completed .circle:after{content:"";position:absolute;top:2px;left:6px;width:6px;height:13px;border:3px solid black;border-top:none;border-left:none;transform:rotate(45deg)}aside li .line{position:absolute;top:44px;left:21px;width:3px;height:45px;background-color:#fff}aside li.completed .line{background-color:#48a1ff}aside li span{display:block;margin-left:44px}nav{margin-top:30px}section{position:absolute;top:135px;left:350px;padding:0 80px 0 140px;transition:opacity .15s ease-in-out}section[aria-hidden=true]{pointer-events:none;opacity:0}section h1,section p{min-width:300px;max-width:600px}.button{position:relative;display:inline-block;color:#fff;background-color:#48a1ff;border-radius:4px;text-decoration:none;padding:10px 40px 10px 20px;white-space:nowrap}.button:hover{background-color:#48a1ffd9}#button-icon{position:absolute;top:1px;right:5px;bottom:0;width:30px;background-image:url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="none" stroke="white" stroke-linecap="square" stroke-miterlimit="10" stroke-width="48" d="M184 112l144 144-144 144"/></svg>');background-repeat:no-repeat;background-position:center;background-size:24px 24px}.button[aria-disabled=true]{opacity:.9;background-color:#ffffff4d;pointer-events:none;padding-right:60px}.button[aria-disabled=true] #button-icon{top:21px;right:29px;width:8px;height:8px;border-radius:4px;background:#fff;color:#fff;animation:dot-flashing .5s infinite linear alternate;animation-delay:.25s}.button[aria-disabled=true] #button-icon:before,.button[aria-disabled=true] #button-icon:after{content:"";display:inline-block;position:absolute;top:0}.button[aria-disabled=true] #button-icon:before{left:-12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:0s}.button[aria-disabled=true] #button-icon:after{left:12px;width:8px;height:8px;border-radius:4px;background-color:#fff;color:#fff;animation:dot-flashing .5s infinite alternate;animation-delay:.5s}@keyframes dot-flashing{0%{background-color:#fff}50%,to{background-color:#ffffff4d}}.logo{margin-left:9px;background:url('data:image/svg+xml,<svg viewBox="0 0 150 32" fill="none" xmlns="http://www.w3.org/2000/svg" > <g clip-path="url(%23clip0_4_304)"> <path d="M27.9858 8.99927C27.9872 10.3415 27.688 11.667 27.1101 12.8783C26.5321 14.0896 25.6902 15.156 24.6462 15.9989V15.9989L0.634502 2.36355C0.542657 2.31119 0.457444 2.24796 0.380701 2.17523C0.260289 2.05715 0.164605 1.91624 0.0992389 1.76075C0.0338732 1.60525 0.000136546 1.43828 0 1.26959C0 0.932873 0.133698 0.609948 0.371683 0.371854C0.609667 0.13376 0.932443 0 1.269 0L18.9906 0C21.3763 0 23.6642 0.948135 25.3512 2.63583C27.0381 4.32352 27.9858 6.61252 27.9858 8.99927V8.99927Z" fill="%2318B4F4" /> <path d="M27.9858 22.9986C27.9861 24.1806 27.7536 25.351 27.3017 26.4431C26.8498 27.5352 26.1873 28.5275 25.352 29.3634C24.5167 30.1993 23.5249 30.8624 22.4335 31.3147C21.342 31.7671 20.1721 32 18.9907 32H1.26906C1.01802 31.9973 0.77343 31.9202 0.566221 31.7784C0.359012 31.6366 0.198499 31.4364 0.104989 31.2034C0.0114791 30.9703 -0.0108254 30.7147 0.0408974 30.4689C0.0926201 30.2231 0.216046 29.9982 0.395559 29.8226V29.8226C0.467112 29.7508 0.547407 29.6882 0.634555 29.6364L10.0844 24.2703L24.6441 16.001C25.688 16.8438 26.53 17.9097 27.1083 19.1206C27.6866 20.3315 27.9864 21.6566 27.9858 22.9986V22.9986Z" fill="%23FD6B3C" /> <path d="M24.6461 15.9989L10.0843 24.2703L0.634458 29.6365C0.54372 29.6868 0.459841 29.7487 0.384888 29.8205C3.98804 26.1233 6.00266 21.1627 5.99812 15.9989C6.0049 10.8346 3.99085 5.87268 0.387003 2.17523C0.463746 2.24796 0.548959 2.31119 0.640803 2.36355L24.6461 15.9989Z" fill="%23A97FF2" /> <path d="M47.6659 11.7352C51.8177 11.7352 54.1632 15.0531 54.1632 19.0714C54.1632 23.0896 51.8177 26.3821 47.6659 26.3821C45.5086 26.3821 43.8589 25.5188 42.9473 24.0545L42.5709 26.052H39.9736V6.77115H43.1884V13.8914C43.971 12.6959 45.5086 11.7352 47.6659 11.7352ZM47.0187 23.5488C49.4446 23.5488 50.9547 21.5809 50.9547 19.0714C50.9547 16.5089 49.4446 14.5664 47.0187 14.5664C44.5928 14.5664 43.0806 16.5047 43.0806 19.0714C43.0806 21.583 44.5653 23.5488 47.0187 23.5488V23.5488Z" fill="white" /> <path d="M65.4595 20.2859V12.0611H68.668V20.123C68.668 23.7202 67.0246 26.3821 62.4943 26.3821C57.9639 26.3821 56.3206 23.7117 56.3206 20.123V12.0611H59.529V20.2859C59.529 22.4696 60.5527 23.5488 62.49 23.5488C64.4274 23.5488 65.4595 22.4696 65.4595 20.2859Z" fill="white" /> <path d="M71.2355 7.74451C71.2247 7.46284 71.2724 7.18199 71.3755 6.91968C71.4787 6.65737 71.6351 6.41929 71.8348 6.22047C72.0345 6.02165 72.2732 5.8664 72.5359 5.76452C72.7986 5.66264 73.0796 5.61633 73.3611 5.62853C74.5793 5.62853 75.4571 6.50666 75.4571 7.75509C75.4571 9.00352 74.5793 9.8224 73.3611 9.8224C72.1428 9.8224 71.2355 8.9612 71.2355 7.74451Z" fill="white" /> <path d="M128.476 7.74451C128.465 7.46376 128.513 7.18383 128.615 6.92227C128.718 6.66071 128.873 6.42315 129.072 6.22449C129.27 6.02583 129.508 5.87035 129.769 5.7678C130.031 5.66524 130.31 5.61783 130.591 5.62852C131.809 5.62852 132.687 6.50666 132.687 7.75509C132.687 9.00352 131.809 9.8224 130.591 9.8224C129.373 9.8224 128.476 8.9612 128.476 7.74451Z" fill="white" /> <path d="M122.302 24.1031C122.291 23.8223 122.339 23.5422 122.441 23.2805C122.543 23.0188 122.699 22.7811 122.897 22.5824C123.096 22.3837 123.334 22.2282 123.595 22.1258C123.857 22.0233 124.137 21.9761 124.417 21.9872C125.636 21.9872 126.513 22.8653 126.513 24.1031C126.513 25.341 125.636 26.1726 124.417 26.1726C123.199 26.1726 122.302 25.3219 122.302 24.1031Z" fill="white" /> <path d="M74.9516 12.059H71.7432V26.0583H74.9516V12.059Z" fill="white" /> <path d="M78.16 26.0583V6.77115H81.3685V26.0626L78.16 26.0583Z" fill="white" /> <path d="M94.6063 6.77115H97.8148V26.0626H95.2239L94.8474 24.0651C93.9591 25.523 92.3094 26.3927 90.131 26.3927C86.0046 26.3927 83.6591 23.0748 83.6591 19.0819C83.6591 15.0891 86.0046 11.7458 90.131 11.7458C92.3137 11.7458 93.8238 12.7149 94.6063 13.902V6.77115ZM90.7993 14.5707C88.3734 14.5707 86.8633 16.5131 86.8633 19.0756C86.8633 21.5851 88.3734 23.553 90.7993 23.553C93.2252 23.553 94.7354 21.5851 94.7354 19.0756C94.7396 16.5047 93.257 14.5664 90.8036 14.5664L90.7993 14.5707Z" fill="white" /> <path d="M113.479 22.2284C112.482 24.7359 110.162 26.3821 107.117 26.3821C102.887 26.3821 100.137 23.225 100.137 19.0439C100.137 14.9706 102.942 11.7353 107.093 11.7353C111.245 11.7353 113.969 14.8902 113.969 18.991C113.982 19.3255 113.953 19.6604 113.883 19.9876H103.288C103.53 22.2009 104.959 23.6292 107.197 23.6292C108.735 23.6292 110.001 22.8738 110.594 21.473L113.479 22.2284ZM103.341 17.6156H110.784C110.513 15.6731 109.166 14.3506 107.089 14.3506C105.012 14.3506 103.665 15.7006 103.341 17.6156V17.6156Z" fill="white" /> <path d="M123.779 14.9452C123.538 14.9117 123.295 14.8933 123.051 14.8902C120.786 14.8902 119.439 16.0772 119.439 18.7751V26.0583H116.23V12.0611H118.821L119.195 14.0014C119.707 13.1127 120.887 11.9257 123.322 11.9257C123.455 11.9257 123.779 11.9532 123.779 11.9532V14.9452Z" fill="white" /> <path d="M132.192 12.059H128.984V26.0583H132.192V12.059Z" fill="white" /> <path d="M134.483 19.0714C134.483 15.1335 137.287 11.7353 141.735 11.7353C146.183 11.7353 149.015 15.1335 149.015 19.0714C149.015 23.0092 146.213 26.3821 141.735 26.3821C137.258 26.3821 134.483 23.0092 134.483 19.0714ZM141.735 23.5488C144.083 23.5488 145.806 21.7692 145.806 19.0714C145.806 16.3735 144.083 14.5664 141.735 14.5664C139.387 14.5664 137.687 16.346 137.687 19.0714C137.687 21.7968 139.417 23.5488 141.735 23.5488V23.5488Z" fill="white" /> </g> <defs> <clipPath id="clip0_4_304"> <rect width="149.015" height="32" fill="white" /> </clipPath> </defs> </svg>');background-repeat:no-repeat;width:150px;height:32px}@media(max-width:840px){aside{width:250px;padding:60px 0 0 20px}section{left:250px;padding:0 80px}}@media(max-width:590px){aside{width:230px;padding:60px 0 0 10px}section{left:230px;padding:0 40px}}#modified-files-message a{color:#cbcbcb;font-weight:300;text-decoration:underline}#modified-files-message a:hover{color:#fff;text-decoration:none}#restart-warning{border-radius:4px;padding:8px 16px;border:1px solid #fd6b3c;background:#fd6b3c1a}#react-router-steps{margin:0 0 5px;padding:0 20px}#need-help{color:#48a1ff;text-decoration:none}#router-message{border-radius:4px;padding:16px;border:1px solid #48a1ff}#router-finish-button{margin-top:12px}#router-checkbox-div{display:flex;align-items:center}#router-checkbox{margin-right:10px;width:15px;height:15px}#success-title{display:flex;align-items:center;gap:10px}#success-title .check-icon{display:inline-block;width:24px;height:24px;border:2px solid #28a745;border-radius:50%;position:relative}#success-title .check-icon:before{content:"";position:absolute;top:50%;left:50%;width:6px;height:12px;border:solid #28a745;border-width:0 2px 2px 0;transform:translate(-50%,-60%) rotate(45deg)}
|
|
1280
1280
|
</style>\`,Nt=class extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.attachShadow({mode:"open"});e.innerHTML=lo+\`<main>
|
|
1281
1281
|
<aside>
|
|
1282
1282
|
<div class="logo"></div>
|
|
@@ -1315,7 +1315,7 @@ Restarting server after Builder Devtools update...
|
|
|
1315
1315
|
</nav>
|
|
1316
1316
|
</section>
|
|
1317
1317
|
</main>
|
|
1318
|
-
\`,po();let r=new URL(Fr,ot);r.searchParams.set(Br,location.href);let n=e.querySelectorAll(".next-step");for(let i of n)i.setAttribute("href",r.href);ye("overview step viewed")}},po=()=>{let t=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");t?(t.href="https://cdn.builder.io/favicon.ico",t.removeAttribute("type")):(t=document.createElement("link"),t.rel="icon",t.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(t))};var li=async()=>{(await jr()).isValid||fo()},fo=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",Nt);let t=document.querySelector("builder-dev-tools-overview");t||(t=document.createElement("builder-dev-tools-overview"),t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),setTimeout(()=>{t.removeAttribute("aria-hidden")},32)};var mo=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",at),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",Dt);let t=document.querySelector("builder-dev-tools-menu");t||(t=document.createElement("builder-dev-tools-menu"),t.setAttribute("data-version","1.40.
|
|
1318
|
+
\`,po();let r=new URL(Fr,ot);r.searchParams.set(Br,location.href);let n=e.querySelectorAll(".next-step");for(let i of n)i.setAttribute("href",r.href);ye("overview step viewed")}},po=()=>{let t=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");t?(t.href="https://cdn.builder.io/favicon.ico",t.removeAttribute("type")):(t=document.createElement("link"),t.rel="icon",t.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(t))};var li=async()=>{(await jr()).isValid||fo()},fo=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",Nt);let t=document.querySelector("builder-dev-tools-overview");t||(t=document.createElement("builder-dev-tools-overview"),t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),setTimeout(()=>{t.removeAttribute("aria-hidden")},32)};var mo=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",at),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",Dt);let t=document.querySelector("builder-dev-tools-menu");t||(t=document.createElement("builder-dev-tools-menu"),t.setAttribute("data-version","1.40.1-beta.202604062051.216bab5"),document.body.appendChild(t));let e=document.querySelector("builder-dev-tools-edit");e||(e=document.createElement("builder-dev-tools-edit"),document.body.appendChild(e));let r=document.getElementById("builder-dev-tools-style");r||(r=document.createElement("style"),r.id="builder-dev-tools-style",r.innerHTML=".builder-no-scroll{overflow:hidden !important}",document.head.appendChild(r)),li(),Jn()}catch(t){console.error("Builder Devtools:",t)}};window.location===window.parent.location&&(console.debug("Builder.io Devtools v1.40.1-beta.202604062051.216bab5"),mo());})();`)}async function XAe(t){return ece(t,`<!doctype html>
|
|
1319
1319
|
<html lang="en" dir="ltr">
|
|
1320
1320
|
<head>
|
|
1321
1321
|
<meta charset="utf-8" />
|
|
@@ -1736,14 +1736,14 @@ exited with code ${hi}
|
|
|
1736
1736
|
' ',')" -iTCP -sTCP:LISTEN
|
|
1737
1737
|
`,{encoding:"utf8",timeout:5e3}),r=[],n=e.trim().split(`
|
|
1738
1738
|
`);for(let i of n)if(i.trim()){let o=i.trim().split(/\s+/);if(o.length>=9){let a=o[8].match(/:(\d+)$/);if(a){let A=parseInt(a[1],10);r.includes(A)||r.push(A)}}}return r}}catch{return[]}}});function qc(){}function v7e(t,e,r,n,i){for(var o=[],s;e;)o.push(e),s=e.previousComponent,delete e.previousComponent,e=s;o.reverse();for(var a=0,A=o.length,c=0,u=0;a<A;a++){var l=o[a];if(l.removed){if(l.value=t.join(n.slice(u,u+l.count)),u+=l.count,a&&o[a-1].added){var g=o[a-1];o[a-1]=o[a],o[a]=g}}else{if(!l.added&&i){var p=r.slice(c,c+l.count);p=p.map(function(f,h){var C=n[u+h];return C.length>f.length?C:f}),l.value=t.join(p)}else l.value=t.join(r.slice(c,c+l.count));c+=l.count,l.added||(u+=l.count)}}var d=o[A-1];return A>1&&typeof d.value=="string"&&(d.added||d.removed)&&t.equals("",d.value)&&(o[A-2].value+=d.value,o.pop()),o}function ege(t,e,r){return K2.diff(t,e,r)}function Iv(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Iv=function(e){return typeof e}:Iv=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Iv(t)}function O2(t,e,r,n,i){e=e||[],r=r||[],n&&(t=n(i,t));var o;for(o=0;o<e.length;o+=1)if(e[o]===t)return r[o];var s;if(F7e.call(t)==="[object Array]"){for(e.push(t),s=new Array(t.length),r.push(s),o=0;o<t.length;o+=1)s[o]=O2(t[o],e,r,n,i);return e.pop(),r.pop(),s}if(t&&t.toJSON&&(t=t.toJSON()),Iv(t)==="object"&&t!==null){e.push(t),s={},r.push(s);var a=[],A;for(A in t)t.hasOwnProperty(A)&&a.push(A);for(a.sort(),o=0;o<a.length;o+=1)A=a[o],s[A]=O2(t[A],e,r,n,A);e.pop(),r.pop()}else s=t;return s}var u5t,Wle,Zle,Xle,K2,S7e,x7e,F7e,xE,G2,tge=N(()=>{m();qc.prototype={diff:function(e,r){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i.callback;typeof i=="function"&&(o=i,i={}),this.options=i;var s=this;function a(E){return o?(setTimeout(function(){o(void 0,E)},0),!0):E}e=this.castInput(e),r=this.castInput(r),e=this.removeEmpty(this.tokenize(e)),r=this.removeEmpty(this.tokenize(r));var A=r.length,c=e.length,u=1,l=A+c;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));var p=(n=i.timeout)!==null&&n!==void 0?n:1/0,g=Date.now()+p,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],r,e,0);if(d[0].oldPos+1>=c&&f+1>=A)return a([{value:this.join(r),count:r.length}]);var h=-1/0,C=1/0;function I(){for(var E=Math.max(h,-u);E<=Math.min(C,u);E+=2){var y=void 0,D=d[E-1],b=d[E+1];D&&(d[E-1]=void 0);var Q=!1;if(b){var v=b.oldPos-E;Q=b&&0<=v&&v<A}var S=D&&D.oldPos+1<c;if(!Q&&!S){d[E]=void 0;continue}if(!S||Q&&D.oldPos+1<b.oldPos?y=s.addToPath(b,!0,void 0,0):y=s.addToPath(D,void 0,!0,1),f=s.extractCommon(y,r,e,E),y.oldPos+1>=c&&f+1>=A)return a(v7e(s,y.lastComponent,r,e,s.useLongestToken));d[E]=y,y.oldPos+1>=c&&(C=Math.min(C,E-1)),f+1>=A&&(h=Math.max(h,E+1))}u++}if(o)(function E(){setTimeout(function(){if(u>l||Date.now()>g)return o();I()||E()},0)})();else for(;u<=l&&Date.now()<=g;){var B=I();if(B)return B}},addToPath:function(e,r,n,i){var o=e.lastComponent;return o&&o.added===r&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}},extractCommon:function(e,r,n,i){for(var o=r.length,s=n.length,a=e.oldPos,A=a-i,c=0;A+1<o&&a+1<s&&this.equals(r[A+1],n[a+1]);)A++,a++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=a,A},equals:function(e,r){return this.options.comparator?this.options.comparator(e,r):e===r||this.options.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],n=0;n<e.length;n++)e[n]&&r.push(e[n]);return r},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};u5t=new qc,Wle=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Zle=/\S/,Xle=new qc;Xle.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Zle.test(t)&&!Zle.test(e)};Xle.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),r=0;r<e.length-1;r++)!e[r+1]&&e[r+2]&&Wle.test(e[r])&&Wle.test(e[r+2])&&(e[r]+=e[r+2],e.splice(r+1,2),r--);return e};K2=new qc;K2.tokenize=function(t){this.options.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
|
1739
|
-
`));var e=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var n=0;n<r.length;n++){var i=r[n];n%2&&!this.options.newlineIsToken?e[e.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),e.push(i))}return e};S7e=new qc;S7e.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};x7e=new qc;x7e.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};F7e=Object.prototype.toString,xE=new qc;xE.useLongestToken=!0;xE.tokenize=K2.tokenize;xE.castInput=function(t){var e=this.options,r=e.undefinedReplacement,n=e.stringifyReplacer,i=n===void 0?function(o,s){return typeof s>"u"?r:s}:n;return typeof t=="string"?t:JSON.stringify(O2(t,null,null,i),i," ")};xE.equals=function(t,e){return qc.prototype.equals.call(xE,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};G2=new qc;G2.tokenize=function(t){return t.slice()};G2.join=G2.removeEmpty=function(t){return t}});function Oa(t,e){return t.replace(/\$\{([^}:]+)(?::-([^}]*))?\}/g,(r,n,i)=>{let o=e[n];return o!==void 0?o:i!==void 0?i:r})}var H2=N(()=>{"use strict";m()});function Ev(t,e){let r=Zb(),n=t.replace(k7e,(i,o)=>{if(!e.skipCommandSecurity&&(hE(o,r)||e.allowedCommands&&!Wb(o,e.allowedCommands)))return i;try{return(0,rge.execSync)(o,{cwd:e.cwd,timeout:R7e,encoding:"utf-8",stdio:["ignore","pipe","pipe"],env:e.env}).trimEnd()}catch(s){return s.killed||s.signal==="SIGTERM"?`[command timed out: ${o}]`:`[command failed: ${o}, ${s}]`}});return Oa(n,e.env)}var rge,k7e,R7e,$2=N(()=>{"use strict";m();rge=require("node:child_process");H2();CE();k7e=/!`([^`]+)`/g,R7e=1e4});async function ige(t,e){let{sys:r}=e;try{if(t.length===0)return null;if(!await Qv.checkFfmpegAvailable(e.signal))return Qp.warn("ffmpeg is not available. Skipping GIF generation. Install ffmpeg to enable this feature."),null;let i=new Qv;return i.addImages(t),await i.generateGif(e)}catch(n){let i=`GIF generation failed (non-critical): ${n instanceof Error?n.message:String(n)}`;return Qp.warn(i),r?.Sentry&&n instanceof Error&&r.Sentry.captureException(n,{level:"warning",tags:{component:"gif-generator",operation:"generateGifFromImages"},extra:{imageCount:t.length,outputPath:e.outputPath,duration:e.duration,maxWidth:e.maxWidth}}),null}}var Bv,FE,nge,yv,Qp,Qv,oge=N(()=>{"use strict";m();Bv=require("node:child_process"),FE=require("node:fs"),nge=require("node:os"),yv=require("node:path");Pt();Qp=ke("GifGenerator"),Qv=class t{frames=[];tmpDir=null;static ffmpegAvailable=null;static async checkFfmpegAvailable(e){return t.ffmpegAvailable!==null?t.ffmpegAvailable:new Promise(r=>{let n=(0,Bv.spawn)("ffmpeg",["-version"],{signal:e}),i=!1;n.on("error",()=>{i||(i=!0,t.ffmpegAvailable=!1,r(!1))}),n.on("close",o=>{i||(i=!0,t.ffmpegAvailable=o===0,r(o===0))}),setTimeout(()=>{i||(i=!0,n.kill(),t.ffmpegAvailable=!1,r(!1))},5e3)})}addImage(e){e.source.type==="base64"?this.frames.push(e):Qp.error(`Only base64 image sources are supported: ${e.source.type}`)}addImages(e){for(let r of e)this.addImage(r)}getFrameCount(){return this.frames.length}clearFrames(){this.frames=[]}async generateGif(e){let{duration:r="2",frameDurations:n,outputPath:i,cleanup:o=!0,maxWidth:s,debug:a=!1,signal:A}=e;if(this.frames.length===0)throw new Error("No frames added to generate GIF");this.tmpDir=(0,yv.join)((0,nge.tmpdir)(),`gif-frames-${Date.now()}`),await FE.promises.mkdir(this.tmpDir,{recursive:!0});try{let{paths:c,maxWidth:u,maxHeight:l}=await this.#
|
|
1739
|
+
`));var e=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var n=0;n<r.length;n++){var i=r[n];n%2&&!this.options.newlineIsToken?e[e.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),e.push(i))}return e};S7e=new qc;S7e.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};x7e=new qc;x7e.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};F7e=Object.prototype.toString,xE=new qc;xE.useLongestToken=!0;xE.tokenize=K2.tokenize;xE.castInput=function(t){var e=this.options,r=e.undefinedReplacement,n=e.stringifyReplacer,i=n===void 0?function(o,s){return typeof s>"u"?r:s}:n;return typeof t=="string"?t:JSON.stringify(O2(t,null,null,i),i," ")};xE.equals=function(t,e){return qc.prototype.equals.call(xE,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};G2=new qc;G2.tokenize=function(t){return t.slice()};G2.join=G2.removeEmpty=function(t){return t}});function Oa(t,e){return t.replace(/\$\{([^}:]+)(?::-([^}]*))?\}/g,(r,n,i)=>{let o=e[n];return o!==void 0?o:i!==void 0?i:r})}var H2=N(()=>{"use strict";m()});function Ev(t,e){let r=Zb(),n=t.replace(k7e,(i,o)=>{if(!e.skipCommandSecurity&&(hE(o,r)||e.allowedCommands&&!Wb(o,e.allowedCommands)))return i;try{return(0,rge.execSync)(o,{cwd:e.cwd,timeout:R7e,encoding:"utf-8",stdio:["ignore","pipe","pipe"],env:e.env}).trimEnd()}catch(s){return s.killed||s.signal==="SIGTERM"?`[command timed out: ${o}]`:`[command failed: ${o}, ${s}]`}});return Oa(n,e.env)}var rge,k7e,R7e,$2=N(()=>{"use strict";m();rge=require("node:child_process");H2();CE();k7e=/!`([^`]+)`/g,R7e=1e4});async function ige(t,e){let{sys:r}=e;try{if(t.length===0)return null;if(!await Qv.checkFfmpegAvailable(e.signal))return Qp.warn("ffmpeg is not available. Skipping GIF generation. Install ffmpeg to enable this feature."),null;let i=new Qv;return i.addImages(t),await i.generateGif(e)}catch(n){let i=`GIF generation failed (non-critical): ${n instanceof Error?n.message:String(n)}`;return Qp.warn(i),r?.Sentry&&n instanceof Error&&r.Sentry.captureException(n,{level:"warning",tags:{component:"gif-generator",operation:"generateGifFromImages"},extra:{imageCount:t.length,outputPath:e.outputPath,duration:e.duration,maxWidth:e.maxWidth}}),null}}var Bv,FE,nge,yv,Qp,Qv,oge=N(()=>{"use strict";m();Bv=require("node:child_process"),FE=require("node:fs"),nge=require("node:os"),yv=require("node:path");Pt();Qp=ke("GifGenerator"),Qv=class t{frames=[];tmpDir=null;static ffmpegAvailable=null;static async checkFfmpegAvailable(e){return t.ffmpegAvailable!==null?t.ffmpegAvailable:new Promise(r=>{let n=(0,Bv.spawn)("ffmpeg",["-version"],{signal:e}),i=!1;n.on("error",()=>{i||(i=!0,t.ffmpegAvailable=!1,r(!1))}),n.on("close",o=>{i||(i=!0,t.ffmpegAvailable=o===0,r(o===0))}),setTimeout(()=>{i||(i=!0,n.kill(),t.ffmpegAvailable=!1,r(!1))},5e3)})}addImage(e){e.source.type==="base64"?this.frames.push(e):Qp.error(`Only base64 image sources are supported: ${e.source.type}`)}addImages(e){for(let r of e)this.addImage(r)}getFrameCount(){return this.frames.length}clearFrames(){this.frames=[]}async generateGif(e){let{duration:r="2",frameDurations:n,outputPath:i,cleanup:o=!0,maxWidth:s,debug:a=!1,signal:A}=e;if(this.frames.length===0)throw new Error("No frames added to generate GIF");this.tmpDir=(0,yv.join)((0,nge.tmpdir)(),`gif-frames-${Date.now()}`),await FE.promises.mkdir(this.tmpDir,{recursive:!0});try{let{paths:c,maxWidth:u,maxHeight:l}=await this.#n(a,A);return await this.#t(r,i,c,u,l,s,a,A,n),i}finally{o&&this.tmpDir&&await this.#i()}}async#n(e,r){if(!this.tmpDir)throw new Error("Temporary directory not initialized");let n=[];for(let c=0;c<this.frames.length;c++){let u=this.frames[c];u.source.type==="base64"?n.push({frame:u,frameNum:n.length,originalIndex:c}):Qp.error(`Skipping frame ${c}: Only base64 image sources are supported (got ${u.source.type})`,{loggerOptions:{debug:!0}})}let i=[],o=[],s=n.map(async({frame:c,frameNum:u})=>{if(c.source.type!=="base64")return;let l=this.#o(c.source.media_type),p=(0,yv.join)(this.tmpDir,`frame-${String(u).padStart(5,"0")}.${l}`),g=Buffer.from(c.source.data,"base64");await FE.promises.writeFile(p,g,{signal:r});let d=this.#c(g,c.source.media_type);o[u]=d,i[u]=p});await Promise.all(s);let a=Math.max(...o.map(c=>c.width)),A=Math.max(...o.map(c=>c.height));return{paths:i,maxWidth:a,maxHeight:A}}#c(e,r){if(r==="image/png"){let n=e.readUInt32BE(16),i=e.readUInt32BE(20);return{width:n,height:i}}if(r==="image/jpeg"){let n=2;for(;n<e.length-9&&e[n]===255;){let i=e[n+1];if(i>=192&&i<=207&&i!==196&&i!==200&&i!==204){let s=e.readUInt16BE(n+5);return{width:e.readUInt16BE(n+7),height:s}}let o=e.readUInt16BE(n+2);n+=2+o}}if(r==="image/webp"){let n=e.toString("ascii",12,16);if(n==="VP8 "){let i=e.readUInt16LE(26)&16383,o=e.readUInt16LE(28)&16383;return{width:i,height:o}}else if(n==="VP8L"){let i=e.readUInt32LE(21),o=(i&16383)+1>>>0,s=(i>>14&16383)+1>>>0;return{width:o,height:s}}else if(n==="VP8X"){let i=e.readUIntLE(24,3)+1>>>0,o=e.readUIntLE(27,3)+1>>>0;return{width:i,height:o}}}if(r==="image/gif"){let n=e.readUInt16LE(6),i=e.readUInt16LE(8);return{width:n,height:i}}return{width:1280,height:1280}}#o(e){switch(e){case"image/webp":return"webp";case"image/png":return"png";case"image/jpeg":return"jpg";case"image/gif":return"gif";default:return"png"}}async#t(e,r,n,i,o,s,a,A,c){if(!this.tmpDir)throw new Error("Temporary directory not initialized");if(n.length===1){await this.#A(n[0],r,i,o,s,a,A);return}let u=(0,yv.join)(this.tmpDir,"concat.txt"),l=n.map((p,g)=>{let d=c?.[g]||e,f=`file '${p}'
|
|
1740
1740
|
duration ${d}`;return g===n.length-1?`${f}
|
|
1741
1741
|
file '${p}'`:f}).join(`
|
|
1742
1742
|
`);return await FE.promises.writeFile(u,l,{signal:A}),new Promise((p,g)=>{let d=r.toLowerCase().endsWith(".webp"),f=["-f","concat","-safe","0","-i",u];a&&f.push("-loglevel","debug");let h=i,C=o;if(s&&(h>s||C>s)){let y=s/Math.max(h,C);h=Math.round(h*y),C=Math.round(C*y),h=h%2===0?h:h+1,C=C%2===0?C:C+1}if(d){f.push("-vcodec","libwebp");let y=[];y.push(`scale='min(${h},iw)':'min(${C},ih)':force_original_aspect_ratio=decrease`,`pad=${h}:${C}:(ow-iw)/2:(oh-ih)/2:color=black`),f.push("-filter:v",y.join(",")),f.push("-lossless","0","-compression_level","3","-q:v","80","-loop","0","-preset","picture","-an","-fps_mode","passthrough")}else{let y=[];y.push(`scale='min(${h},iw)':'min(${C},ih)':force_original_aspect_ratio=decrease`,`pad=${h}:${C}:(ow-iw)/2:(oh-ih)/2:color=black`),f.push("-vf",y.join(","))}f.push("-y",r);let I=(0,Bv.spawn)("ffmpeg",f,{signal:A}),B="",E="";a&&I.stdout.on("data",y=>{E+=y.toString()}),I.stderr.on("data",y=>{B+=y.toString(),E+=y.toString()}),I.on("error",y=>{g(new Error(`Failed to spawn ffmpeg: ${y.message}
|
|
1743
1743
|
${B}`))}),I.on("close",y=>{Qp.debug(`ffmpeg stdout:${E}`),y===0?p():g(new Error(`ffmpeg exited with code ${y}
|
|
1744
1744
|
Stderr: ${B}`))})})}async#A(e,r,n,i,o,s,a){return new Promise((A,c)=>{let u=r.toLowerCase().endsWith(".webp"),l=["-i",e];s&&l.push("-loglevel","debug");let p=n,g=i;if(o&&(p>o||g>o)){let I=o/Math.max(p,g);p=Math.round(p*I),g=Math.round(g*I),p=p%2===0?p:p+1,g=g%2===0?g:g+1}let d=`scale=${p}:${g}:force_original_aspect_ratio=decrease,pad=${p}:${g}:(ow-iw)/2:(oh-ih)/2:color=black`;l.push("-vf",d),u&&l.push("-vcodec","libwebp","-lossless","0","-compression_level","3","-q:v","80","-preset","picture"),l.push("-y",r);let f=(0,Bv.spawn)("ffmpeg",l,{signal:a}),h="",C="";s&&f.stdout.on("data",I=>{C+=I.toString()}),f.stderr.on("data",I=>{h+=I.toString(),C+=I.toString()}),f.on("error",I=>{c(new Error(`Failed to spawn ffmpeg: ${I.message}
|
|
1745
1745
|
${h}`))}),f.on("close",I=>{Qp.debug(`ffmpeg stdout:${C}`),I===0?A():c(new Error(`ffmpeg exited with code ${I}
|
|
1746
|
-
Stderr: ${h}`))})})}async#i(){if(this.tmpDir)try{await FE.promises.rm(this.tmpDir,{recursive:!0,force:!0}),this.tmpDir=null}catch(e){Qp.warn(`Failed to cleanup temporary directory: ${e}`)}}async cleanup(){await this.#i()}}});async function sge(t,e,r,n){try{if(!(await fetch(`${N7e}?imageId=${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:t,imageContentType:e}),signal:n})).ok)return null;let o=`assets/TEMP/${r}`;return`${T7e}/${encodeURIComponent(o)}`}catch{return null}}var N7e,T7e,age=N(()=>{"use strict";m();N7e="https://builder.io/api/v1/stage-image",T7e="https://cdn.builder.io/api/v1/image"});var kE,V2,J2,Age,j2,Y2,q2,RE,cge=N(()=>{"use strict";m();kE=require("node:fs"),V2=require("node:path");age();Pt();J2=ke("TimelineCollector"),Age={mcp__chrome__navigate_page:{labelFn:t=>`Navigating to ${t?.url||t?.path||"page"}`,category:"navigation"},mcp__chrome__take_screenshot:{labelFn:()=>"Checking page state",category:"observation"},mcp__chrome__click:{labelFn:t=>`Clicking '${t?.selector||t?.ref||"element"}'`,category:"interaction"},mcp__chrome__fill:{labelFn:t=>`Typing in '${t?.selector||t?.ref||"field"}'`,category:"interaction"},mcp__chrome__type:{labelFn:t=>`Typing '${(t?.text||"").substring(0,30)}'`,category:"interaction"},mcp__chrome__press_key:{labelFn:t=>`Pressing ${t?.key||"key"}`,category:"interaction"},mcp__chrome__evaluate_script:{labelFn:()=>"Running script on page",category:"interaction"},mcp__chrome__hover:{labelFn:t=>`Hovering over '${t?.selector||t?.ref||"element"}'`,category:"interaction"},mcp__chrome__scroll:{labelFn:()=>"Scrolling page",category:"interaction"},mcp__chrome__select_option:{labelFn:t=>`Selecting '${t?.value||"option"}' in '${t?.selector||"dropdown"}'`,category:"interaction"}},j2=500,Y2=5e3,q2=2e3,RE=class{#r;#c;#o;#t;#A=[];#i=[];#e=new Map;#s=null;#B=0;#h=0;#T=Date.now();#x="";#b="";#F=!1;constructor(e,r){this.#r=e,this.#c=r.framesDir,this.#o=r.debug??!1,this.#t=r.enableCdnUpload??!0}reset(){this.#A=[],this.#i=[],this.#e.clear(),this.#s=null,this.#B=0,this.#h=0,this.#T=Date.now(),this.#x="",this.#b=""}onToolCall(e,r,n){this.#e.set(r,{name:e,id:r,input:n,timestamp:Date.now()});let i=Age[e];if(i){let o={};try{o=JSON.parse(n||"{}")}catch{}let s=i.labelFn(o);this.#x=s,this.#a({label:s,category:i.category,toolName:e})}}onToolResult(e,r){let n=e.content;if(!Array.isArray(n))return;let i=n.filter(p=>p.type==="image"&&p.source.type==="base64");if(i.length===0)return;let o=i[i.length-1];this.#s=o;let s;if(e.tool_use_id){let p=this.#e.get(e.tool_use_id);p&&(s=Date.now()-p.timestamp,this.#e.delete(e.tool_use_id))}let a=e.tool_name||"",A=Age[a],c={};if(A)try{c=JSON.parse(e.tool_input||"{}")}catch{}let u=A?A.labelFn(c):a?a.replace(/^mcp__chrome__/,"").replace(/_/g," "):"Screenshot captured",l=A?.category??"observation";this.#f(o,u,l,!1,s,void 0,r)}onRecordFrame(e){let r=this.#s;if(!r)return;let n=e.title||"Untitled",i=e.category||"milestone";this.#x=n,this.#f(r,n,i,!0,void 0,e.description)}onThinking(e){!e||e.length===0||(this.#b=e.substring(0,300),this.#a({label:"AI thinking",category:"observation",thinking:e.substring(0,2e3)}))}getLastCapturedImage(){return this.#s}getExplicitFrames(){return this.#i.filter(e=>e.explicit).map(e=>({image:e.image,title:e.title}))}getExplicitImages(){return this.#i.filter(e=>e.explicit).map(e=>e.image)}getAllImages(){return this.#i.map(e=>e.image)}getLegacyMetadataFrames(){return this.#i.filter(e=>e.explicit).map(e=>({hasImage:!0,title:e.title}))}getExplicitFrameDurations(){let e=this.#i.filter(n=>n.explicit);if(e.length<=1)return[];let r=[];for(let n=0;n<e.length;n++)if(n<e.length-1){let i=e[n+1].timestamp-e[n].timestamp,o=Math.min(Y2,Math.max(j2,i));r.push((o/1e3).toFixed(2))}else r.push((q2/1e3).toFixed(2));return r}getProgressSnapshot(){let e=this.#i[this.#i.length-1];return{eventCount:this.#A.length,frameCount:this.#i.length,lastLabel:this.#x,lastFrameFileName:e?.fileName,lastThinking:this.#b||void 0}}getEventCount(){return this.#A.length}getFrameCount(){return this.#i.length}getLastLabel(){return this.#x}hasExplicitFrames(){return this.#i.some(e=>e.explicit)}hasAnyFrames(){return this.#i.length>0}getHighlightFrames(){if(this.#i.length===0)return[];let e=new Set;e.add(0),e.add(this.#i.length-1);for(let o=0;o<this.#i.length;o++)this.#i[o].explicit&&e.add(o);let r=new Set(this.#A.filter(o=>o.category==="navigation"&&o.frameIndex!=null).map(o=>o.frameIndex));for(let o=0;o<this.#i.length;o++)o>0&&r.has(o-1)&&e.add(o),r.has(o)&&e.add(o);for(let o of this.#A)o.frameIndex!=null&&(o.category==="milestone"||o.category==="assertion"||o.category==="error")&&e.add(o.frameIndex);let n=[...e].sort((o,s)=>o-s);n=n.filter((o,s)=>s===0||this.#i[o].title!==this.#i[n[s-1]].title);let i=15;if(n.length>i){let o=n[0],s=n[n.length-1],a=n.slice(1,-1),A=a.length/(i-2),c=[o];for(let u=0;u<i-2;u++)c.push(a[Math.round(u*A)]);c.push(s),n=c}return n.map(o=>this.#i[o])}getHighlightImages(){return this.getHighlightFrames().map(e=>e.image)}getHighlightMetadataFrames(){return this.getHighlightFrames().map(e=>({hasImage:!0,title:e.title}))}getHighlightFrameDurations(){let e=this.getHighlightFrames();if(e.length<=1)return[];let r=[];for(let n=0;n<e.length;n++)if(n<e.length-1){let i=e[n+1].timestamp-e[n].timestamp,o=Math.min(Y2,Math.max(j2,i));r.push((o/1e3).toFixed(2))}else r.push((q2/1e3).toFixed(2));return r}async cleanupSessionFiles(){let e=this.#c;try{let r=await kE.promises.readdir(e),n=`${this.#r}-frame-`,i=r.filter(s=>s.startsWith(n)),o=0;for(let s of i)try{await kE.promises.unlink((0,V2.join)(e,s)),o++}catch{}o>0&&J2.info(`Cleaned up ${o} local files for session ${this.#r}`)}catch{}}async finalize(){let e=this.#i.map(i=>i.uploadPromise).filter(Boolean);if(e.length>0){let i=new Promise(o=>setTimeout(o,3e4));await Promise.race([Promise.allSettled(e),i])}let r=Date.now(),n=this.#i.map((i,o)=>{let s=q2;if(o<this.#i.length-1){let a=this.#i[o+1].timestamp-i.timestamp;s=Math.min(Y2,Math.max(j2,a))}return{index:o,timestamp:i.timestamp,title:i.title,category:i.category,eventId:i.eventId,explicit:i.explicit,displayDurationMs:s,fileName:i.fileName,image_url:i.imageUrl,cursorX:i.cursorX,cursorY:i.cursorY,viewportWidth:i.viewportWidth,viewportHeight:i.viewportHeight}});return{version:1,sessionId:this.#r,startTime:this.#T,endTime:r,totalFrames:n.length,events:this.#A,frames:n}}#a(e){let r={id:this.#B++,timestamp:Date.now(),...e};return this.#A.push(r),r}#f(e,r,n,i,o,s,a){let A=this.#a({label:r,category:n,frameIndex:this.#h,durationMs:o,description:s}),c=this.#g(e),u=`${this.#r}-frame-${String(this.#h).padStart(5,"0")}.${c}`,l={image:e,title:r,category:n,eventId:A.id,explicit:i,timestamp:Date.now(),fileName:u,cursorX:a?.x,cursorY:a?.y,viewportWidth:a?.viewportWidth,viewportHeight:a?.viewportHeight};if(this.#i.push(l),this.#h++,this.#n(e,u).catch(()=>{}),this.#t&&e.source.type==="base64"){let p=`${this.#r}-frame-${String(this.#h-1).padStart(5,"0")}`;l.uploadPromise=sge(e.source.data,e.source.media_type,p).then(g=>{g&&(l.imageUrl=g)})}}async#n(e,r){try{this.#F||(await kE.promises.mkdir(this.#c,{recursive:!0}),this.#F=!0);let n=(0,V2.join)(this.#c,r);if(e.source.type==="base64"){let i=Buffer.from(e.source.data,"base64");await kE.promises.writeFile(n,new Uint8Array(i)),this.#o&&J2.info(`Saved frame: ${r}`)}}catch(n){this.#o&&J2.warn(`Failed to save frame: ${r}`,n)}}#g(e){if(e.source.type!=="base64")return"webp";switch(e.source.media_type){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/gif":return"gif";default:return"webp"}}}});function us(t){return t.replace(/\\/g,"/").replace(/^\.\//,"")}var z2=N(()=>{"use strict";m()});function uge(t,e){let r=t.toLowerCase(),n=e.toLowerCase(),i=e.lastIndexOf("/"),o=i>=0?i+1:0;if(t.includes("/")){let c=n.indexOf(r);return c>=0?Array.from({length:r.length},(u,l)=>c+l):NE(r,n,0,e.length)}let a=n.slice(o).indexOf(r);if(a>=0)return Array.from({length:r.length},(c,u)=>o+a+u);let A=NE(r,n,o,e.length);if(A.length===r.length)return A;if(A.length>0){let c=A.length,u=r.slice(0,r.length-c),l=NE(u,n,0,o);if(l.length+c===r.length){let p=r.slice(l.length),g=NE(p,n,o,e.length);return[...l,...g]}}return NE(r,n,0,e.length)}function NE(t,e,r,n){let i=[],o=0;for(let s=r;s<n&&o<t.length;s++){let a=t[o];e[s]===a?(i.push(s),o++):/[a-zA-Z0-9.\-_]/.test(a)||(o++,s--)}for(;o<t.length&&!/[a-zA-Z0-9.\-_]/.test(t[o]);)o++;return i}function lge(t,e,r){if(r.length===0)return 0;let n=0,i=t.toLowerCase(),o=e.toLowerCase(),s=e.lastIndexOf("/"),a=s>=0?s+1:0,c=o.slice(a).replace(/\.[^.]+$/,"");if(c===i)n+=200;else if(c.startsWith(i)){let g=i.length/c.length;g>=.9?n+=150:g>=.7?n+=120:n+=100}else c.includes(i)&&(n+=50);let u=r.filter(g=>g>=a);if(u.length===r.length&&(n+=30),u.length>0){let g=u.length/c.length;g>=.9?n+=60:g>=.7?n+=40:g>=.5&&(n+=20)}let l=0;for(let g=1;g<r.length;g++)r[g]===r[g-1]+1&&(l+=10);n+=l;let p=new Set(["/","-","_","."]);for(let g of r)(g===0||p.has(o[g-1]))&&(n+=5);if(n+=u.length*3,r[0]===a&&(n+=20),n-=Math.floor(e.length/20),r.length>1){let g=r[r.length-1]-r[0],d=r.length-1,f=g-d;n-=Math.floor(f/5)}return n}function gge(t){if(!t)return"";let e=t.lastIndexOf("/");if(e===-1)return"**/*"+W2(t,!0)+"*";let r=t.slice(0,e),n=t.slice(e+1),i="**/",o=r.split("/");for(let s=0;s<o.length;s++){let a=o[s];a&&(i+=W2(a,!1)),i+="/**/"}return n?i+="*"+W2(n,!0)+"*":i+="*",i}function W2(t,e){let r="";for(let n=0;n<t.length;n++){let i=t[n];/[a-zA-Z]/.test(i)?(r+=`[${i.toLowerCase()}${i.toUpperCase()}]`,e&&(r+="*")):/[0-9]/.test(i)||i==="."||i==="-"||i==="_"?(r+=i,e&&(r+="*")):["*","?","[","]","{","}"].includes(i)?r+=`[${i}]`:r+="*"}return r}var pge=N(()=>{"use strict";m()});function P7e(t){return(0,dge.createHash)("sha256").update(t).digest("hex").slice(0,16)}function _7e(t){return t.join(fge.default.homedir(),".builder","history")}function mge(t,e){return t.join(_7e(t),`${P7e(e)}.json`)}async function Z2(t,e){let r=mge(t,e);try{let n=await t.readFile(r);return n?JSON.parse(n):[]}catch{return[]}}async function hge(t,e,r){let n=mge(t,e);await t.writeFile(n,JSON.stringify(r,null,2))}async function Cge(t,e,r,n){let i=await Z2(t,e),o=i.findIndex(a=>a.sessionId===r),s=Date.now();o!==-1?i[o].lastActiveAt=s:i.unshift({sessionId:r,title:n,createdAt:s,lastActiveAt:s}),await hge(t,e,i.slice(0,M7e))}async function X2(t,e,r){let n=await Z2(t,e),i=n.find(o=>o.sessionId===r);i&&(i.lastActiveAt=Date.now(),await hge(t,e,n))}async function Dv(t,e){return Z2(t,e)}function Ige(t){let r=t.replace(/<[^>]*>/g,"").trim().split(`
|
|
1746
|
+
Stderr: ${h}`))})})}async#i(){if(this.tmpDir)try{await FE.promises.rm(this.tmpDir,{recursive:!0,force:!0}),this.tmpDir=null}catch(e){Qp.warn(`Failed to cleanup temporary directory: ${e}`)}}async cleanup(){await this.#i()}}});async function sge(t,e,r,n){try{if(!(await fetch(`${N7e}?imageId=${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:t,imageContentType:e}),signal:n})).ok)return null;let o=`assets/TEMP/${r}`;return`${T7e}/${encodeURIComponent(o)}`}catch{return null}}var N7e,T7e,age=N(()=>{"use strict";m();N7e="https://builder.io/api/v1/stage-image",T7e="https://cdn.builder.io/api/v1/image"});var kE,V2,J2,Age,j2,Y2,q2,RE,cge=N(()=>{"use strict";m();kE=require("node:fs"),V2=require("node:path");age();Pt();J2=ke("TimelineCollector"),Age={mcp__chrome__navigate_page:{labelFn:t=>`Navigating to ${t?.url||t?.path||"page"}`,category:"navigation"},mcp__chrome__take_screenshot:{labelFn:()=>"Checking page state",category:"observation"},mcp__chrome__click:{labelFn:t=>`Clicking '${t?.selector||t?.ref||"element"}'`,category:"interaction"},mcp__chrome__fill:{labelFn:t=>`Typing in '${t?.selector||t?.ref||"field"}'`,category:"interaction"},mcp__chrome__type:{labelFn:t=>`Typing '${(t?.text||"").substring(0,30)}'`,category:"interaction"},mcp__chrome__press_key:{labelFn:t=>`Pressing ${t?.key||"key"}`,category:"interaction"},mcp__chrome__evaluate_script:{labelFn:()=>"Running script on page",category:"interaction"},mcp__chrome__hover:{labelFn:t=>`Hovering over '${t?.selector||t?.ref||"element"}'`,category:"interaction"},mcp__chrome__scroll:{labelFn:()=>"Scrolling page",category:"interaction"},mcp__chrome__select_option:{labelFn:t=>`Selecting '${t?.value||"option"}' in '${t?.selector||"dropdown"}'`,category:"interaction"}},j2=500,Y2=5e3,q2=2e3,RE=class{#n;#c;#o;#t;#A=[];#i=[];#e=new Map;#s=null;#B=0;#C=0;#T=Date.now();#x="";#b="";#F=!1;constructor(e,r){this.#n=e,this.#c=r.framesDir,this.#o=r.debug??!1,this.#t=r.enableCdnUpload??!0}reset(){this.#A=[],this.#i=[],this.#e.clear(),this.#s=null,this.#B=0,this.#C=0,this.#T=Date.now(),this.#x="",this.#b=""}onToolCall(e,r,n){this.#e.set(r,{name:e,id:r,input:n,timestamp:Date.now()});let i=Age[e];if(i){let o={};try{o=JSON.parse(n||"{}")}catch{}let s=i.labelFn(o);this.#x=s,this.#a({label:s,category:i.category,toolName:e})}}onToolResult(e,r){let n=e.content;if(!Array.isArray(n))return;let i=n.filter(p=>p.type==="image"&&p.source.type==="base64");if(i.length===0)return;let o=i[i.length-1];this.#s=o;let s;if(e.tool_use_id){let p=this.#e.get(e.tool_use_id);p&&(s=Date.now()-p.timestamp,this.#e.delete(e.tool_use_id))}let a=e.tool_name||"",A=Age[a],c={};if(A)try{c=JSON.parse(e.tool_input||"{}")}catch{}let u=A?A.labelFn(c):a?a.replace(/^mcp__chrome__/,"").replace(/_/g," "):"Screenshot captured",l=A?.category??"observation";this.#f(o,u,l,!1,s,void 0,r)}onRecordFrame(e){let r=this.#s;if(!r)return;let n=e.title||"Untitled",i=e.category||"milestone";this.#x=n,this.#f(r,n,i,!0,void 0,e.description)}onThinking(e){!e||e.length===0||(this.#b=e.substring(0,300),this.#a({label:"AI thinking",category:"observation",thinking:e.substring(0,2e3)}))}getLastCapturedImage(){return this.#s}getExplicitFrames(){return this.#i.filter(e=>e.explicit).map(e=>({image:e.image,title:e.title}))}getExplicitImages(){return this.#i.filter(e=>e.explicit).map(e=>e.image)}getAllImages(){return this.#i.map(e=>e.image)}getLegacyMetadataFrames(){return this.#i.filter(e=>e.explicit).map(e=>({hasImage:!0,title:e.title}))}getExplicitFrameDurations(){let e=this.#i.filter(n=>n.explicit);if(e.length<=1)return[];let r=[];for(let n=0;n<e.length;n++)if(n<e.length-1){let i=e[n+1].timestamp-e[n].timestamp,o=Math.min(Y2,Math.max(j2,i));r.push((o/1e3).toFixed(2))}else r.push((q2/1e3).toFixed(2));return r}getProgressSnapshot(){let e=this.#i[this.#i.length-1];return{eventCount:this.#A.length,frameCount:this.#i.length,lastLabel:this.#x,lastFrameFileName:e?.fileName,lastThinking:this.#b||void 0}}getEventCount(){return this.#A.length}getFrameCount(){return this.#i.length}getLastLabel(){return this.#x}hasExplicitFrames(){return this.#i.some(e=>e.explicit)}hasAnyFrames(){return this.#i.length>0}getHighlightFrames(){if(this.#i.length===0)return[];let e=new Set;e.add(0),e.add(this.#i.length-1);for(let o=0;o<this.#i.length;o++)this.#i[o].explicit&&e.add(o);let r=new Set(this.#A.filter(o=>o.category==="navigation"&&o.frameIndex!=null).map(o=>o.frameIndex));for(let o=0;o<this.#i.length;o++)o>0&&r.has(o-1)&&e.add(o),r.has(o)&&e.add(o);for(let o of this.#A)o.frameIndex!=null&&(o.category==="milestone"||o.category==="assertion"||o.category==="error")&&e.add(o.frameIndex);let n=[...e].sort((o,s)=>o-s);n=n.filter((o,s)=>s===0||this.#i[o].title!==this.#i[n[s-1]].title);let i=15;if(n.length>i){let o=n[0],s=n[n.length-1],a=n.slice(1,-1),A=a.length/(i-2),c=[o];for(let u=0;u<i-2;u++)c.push(a[Math.round(u*A)]);c.push(s),n=c}return n.map(o=>this.#i[o])}getHighlightImages(){return this.getHighlightFrames().map(e=>e.image)}getHighlightMetadataFrames(){return this.getHighlightFrames().map(e=>({hasImage:!0,title:e.title}))}getHighlightFrameDurations(){let e=this.getHighlightFrames();if(e.length<=1)return[];let r=[];for(let n=0;n<e.length;n++)if(n<e.length-1){let i=e[n+1].timestamp-e[n].timestamp,o=Math.min(Y2,Math.max(j2,i));r.push((o/1e3).toFixed(2))}else r.push((q2/1e3).toFixed(2));return r}async cleanupSessionFiles(){let e=this.#c;try{let r=await kE.promises.readdir(e),n=`${this.#n}-frame-`,i=r.filter(s=>s.startsWith(n)),o=0;for(let s of i)try{await kE.promises.unlink((0,V2.join)(e,s)),o++}catch{}o>0&&J2.info(`Cleaned up ${o} local files for session ${this.#n}`)}catch{}}async finalize(){let e=this.#i.map(i=>i.uploadPromise).filter(Boolean);if(e.length>0){let i=new Promise(o=>setTimeout(o,3e4));await Promise.race([Promise.allSettled(e),i])}let r=Date.now(),n=this.#i.map((i,o)=>{let s=q2;if(o<this.#i.length-1){let a=this.#i[o+1].timestamp-i.timestamp;s=Math.min(Y2,Math.max(j2,a))}return{index:o,timestamp:i.timestamp,title:i.title,category:i.category,eventId:i.eventId,explicit:i.explicit,displayDurationMs:s,fileName:i.fileName,image_url:i.imageUrl,cursorX:i.cursorX,cursorY:i.cursorY,viewportWidth:i.viewportWidth,viewportHeight:i.viewportHeight}});return{version:1,sessionId:this.#n,startTime:this.#T,endTime:r,totalFrames:n.length,events:this.#A,frames:n}}#a(e){let r={id:this.#B++,timestamp:Date.now(),...e};return this.#A.push(r),r}#f(e,r,n,i,o,s,a){let A=this.#a({label:r,category:n,frameIndex:this.#C,durationMs:o,description:s}),c=this.#g(e),u=`${this.#n}-frame-${String(this.#C).padStart(5,"0")}.${c}`,l={image:e,title:r,category:n,eventId:A.id,explicit:i,timestamp:Date.now(),fileName:u,cursorX:a?.x,cursorY:a?.y,viewportWidth:a?.viewportWidth,viewportHeight:a?.viewportHeight};if(this.#i.push(l),this.#C++,this.#r(e,u).catch(()=>{}),this.#t&&e.source.type==="base64"){let p=`${this.#n}-frame-${String(this.#C-1).padStart(5,"0")}`;l.uploadPromise=sge(e.source.data,e.source.media_type,p).then(g=>{g&&(l.imageUrl=g)})}}async#r(e,r){try{this.#F||(await kE.promises.mkdir(this.#c,{recursive:!0}),this.#F=!0);let n=(0,V2.join)(this.#c,r);if(e.source.type==="base64"){let i=Buffer.from(e.source.data,"base64");await kE.promises.writeFile(n,new Uint8Array(i)),this.#o&&J2.info(`Saved frame: ${r}`)}}catch(n){this.#o&&J2.warn(`Failed to save frame: ${r}`,n)}}#g(e){if(e.source.type!=="base64")return"webp";switch(e.source.media_type){case"image/png":return"png";case"image/jpeg":return"jpg";case"image/gif":return"gif";default:return"webp"}}}});function us(t){return t.replace(/\\/g,"/").replace(/^\.\//,"")}var z2=N(()=>{"use strict";m()});function uge(t,e){let r=t.toLowerCase(),n=e.toLowerCase(),i=e.lastIndexOf("/"),o=i>=0?i+1:0;if(t.includes("/")){let c=n.indexOf(r);return c>=0?Array.from({length:r.length},(u,l)=>c+l):NE(r,n,0,e.length)}let a=n.slice(o).indexOf(r);if(a>=0)return Array.from({length:r.length},(c,u)=>o+a+u);let A=NE(r,n,o,e.length);if(A.length===r.length)return A;if(A.length>0){let c=A.length,u=r.slice(0,r.length-c),l=NE(u,n,0,o);if(l.length+c===r.length){let p=r.slice(l.length),g=NE(p,n,o,e.length);return[...l,...g]}}return NE(r,n,0,e.length)}function NE(t,e,r,n){let i=[],o=0;for(let s=r;s<n&&o<t.length;s++){let a=t[o];e[s]===a?(i.push(s),o++):/[a-zA-Z0-9.\-_]/.test(a)||(o++,s--)}for(;o<t.length&&!/[a-zA-Z0-9.\-_]/.test(t[o]);)o++;return i}function lge(t,e,r){if(r.length===0)return 0;let n=0,i=t.toLowerCase(),o=e.toLowerCase(),s=e.lastIndexOf("/"),a=s>=0?s+1:0,c=o.slice(a).replace(/\.[^.]+$/,"");if(c===i)n+=200;else if(c.startsWith(i)){let g=i.length/c.length;g>=.9?n+=150:g>=.7?n+=120:n+=100}else c.includes(i)&&(n+=50);let u=r.filter(g=>g>=a);if(u.length===r.length&&(n+=30),u.length>0){let g=u.length/c.length;g>=.9?n+=60:g>=.7?n+=40:g>=.5&&(n+=20)}let l=0;for(let g=1;g<r.length;g++)r[g]===r[g-1]+1&&(l+=10);n+=l;let p=new Set(["/","-","_","."]);for(let g of r)(g===0||p.has(o[g-1]))&&(n+=5);if(n+=u.length*3,r[0]===a&&(n+=20),n-=Math.floor(e.length/20),r.length>1){let g=r[r.length-1]-r[0],d=r.length-1,f=g-d;n-=Math.floor(f/5)}return n}function gge(t){if(!t)return"";let e=t.lastIndexOf("/");if(e===-1)return"**/*"+W2(t,!0)+"*";let r=t.slice(0,e),n=t.slice(e+1),i="**/",o=r.split("/");for(let s=0;s<o.length;s++){let a=o[s];a&&(i+=W2(a,!1)),i+="/**/"}return n?i+="*"+W2(n,!0)+"*":i+="*",i}function W2(t,e){let r="";for(let n=0;n<t.length;n++){let i=t[n];/[a-zA-Z]/.test(i)?(r+=`[${i.toLowerCase()}${i.toUpperCase()}]`,e&&(r+="*")):/[0-9]/.test(i)||i==="."||i==="-"||i==="_"?(r+=i,e&&(r+="*")):["*","?","[","]","{","}"].includes(i)?r+=`[${i}]`:r+="*"}return r}var pge=N(()=>{"use strict";m()});function P7e(t){return(0,dge.createHash)("sha256").update(t).digest("hex").slice(0,16)}function _7e(t){return t.join(fge.default.homedir(),".builder","history")}function mge(t,e){return t.join(_7e(t),`${P7e(e)}.json`)}async function Z2(t,e){let r=mge(t,e);try{let n=await t.readFile(r);return n?JSON.parse(n):[]}catch{return[]}}async function hge(t,e,r){let n=mge(t,e);await t.writeFile(n,JSON.stringify(r,null,2))}async function Cge(t,e,r,n){let i=await Z2(t,e),o=i.findIndex(a=>a.sessionId===r),s=Date.now();o!==-1?i[o].lastActiveAt=s:i.unshift({sessionId:r,title:n,createdAt:s,lastActiveAt:s}),await hge(t,e,i.slice(0,M7e))}async function X2(t,e,r){let n=await Z2(t,e),i=n.find(o=>o.sessionId===r);i&&(i.lastActiveAt=Date.now(),await hge(t,e,n))}async function Dv(t,e){return Z2(t,e)}function Ige(t){let r=t.replace(/<[^>]*>/g,"").trim().split(`
|
|
1747
1747
|
`)[0].trim();return r.length>80?r.slice(0,77)+"...":r}var dge,fge,M7e,eO=N(()=>{"use strict";m();dge=require("node:crypto"),fge=z(require("node:os"),1),M7e=50});function Ege(t,e){t||(t="http://localhost:3000");let r=L7e(e);return`
|
|
1748
1748
|
|
|
1749
1749
|
<browser_automation_instructions>
|
|
@@ -1769,9 +1769,9 @@ ${r}
|
|
|
1769
1769
|
Before scheduling browser tests, check whether the modified files are inside \`${t}\`. If all changes are outside this path, skip browser testing entirely.
|
|
1770
1770
|
`:""}function tO(t,e){return t.endsWith("/")?t+e:t+"/"+e}var Bge=N(()=>{"use strict";m()});function U7e(t){let e=t.replace(/\.git$/,"");return e.startsWith("git@")&&(e=e.replace(/^git@/,"").replace(/:([^/])/,"/$1")),e=e.replace(/^https?:\/\//,"").replace(/^[^@]+@/,""),e.toLowerCase()}async function rO(t){if(!t)return;let e=U7e(t),n=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(i)).map(a=>a.toString(16).padStart(2,"0")).join("").slice(0,8)}var nO=N(()=>{"use strict";m()});var TE,iO=N(()=>{"use strict";m();nO();TE="code"});function mm(t,e=TE){if(typeof t!="string"||!t.trim())return{};let r=t.trim();if(!r.includes(":"))return{[e]:r};let n={};for(let i of r.split(",")){let o=i.indexOf(":");if(o===-1)continue;let s;try{s=decodeURIComponent(i.substring(0,o))}catch{continue}let a=i.substring(o+1).trim();s&&a&&(n[s]=a)}return n}function Ks(t){return!t||Object.keys(t).length===0?"":Object.keys(t).sort().filter(r=>t[r]).map(r=>`${encodeURIComponent(r)}:${t[r]}`).join(",")}function yl(t,e,r=TE){return mm(t,r)[e]}var oO=N(()=>{"use strict";m();Ls();iO()});async function wv({sys:t,credentials:e,projectId:r,branchName:n,repoPath:i,aiBranch:o,featureBranch:s,workspace:a,isConnectedToProvider:A,debug:c,forcedFullBackup:u,canAbortMerge:l,folderName:p,repoUrl:g}){let d=performance.now();async function f(M){return Ga("git",M,{cwd:i,sys:t})}async function h(){return(await f(["branch","--show-current"])).trim()}async function C(M,_){try{return await f(["merge-base","--is-ancestor",M,_]),!0}catch{return!1}}async function I(){try{return await f(["rev-parse","-q","--verify","MERGE_HEAD"]),!0}catch{return!1}}async function B(M){if(M!=null)try{let _=await f(["--no-pager","show","-s","--format='%an%n%ad%n%B'",M]);return rm(_.trim(),1e3)}catch{return}}async function E(){try{return(await f(["rev-parse","HEAD"])).trim()}catch{return null}}async function y(M,_){try{let W=(await f(["rev-list",M,`--max-count=${_}`])).trim();return W?W.split(`
|
|
1771
1771
|
`):[]}catch{return[]}}let D=u;if(!a)throw new Error("Workspace is required for backup upload");if(await I())if(l)Vr.debug("There is an merge conflict, when attempting to backup, let's try to abort the merge"),await f(["merge","--abort"]);else throw new Error("Merge conflict detected, please resolve the conflict before continuing");await PE(i,t)||(Vr.debug("Uncommitted changes detected, staging and committing before backup"),await f(["add","-A","."]),await f(["commit","--quiet","--no-verify","-m","commit pending changes"]));let Q=(p?a.folders.find(M=>(M.name??M.path)===p):a.folders.find(M=>M.enableGit))?.originalRepoUrl??g;if(!Q)throw new Error("Original repo URL is required for backup upload");let v=await E();if(!v)throw new Error("Failed to get current commit hash");let S=await h();if(!D&&S!==o)throw new Error(`Current branch "${S}" is not the ai branch "${o}"`);let x=await O7e({sys:t,repoPath:i,featureBranch:s,debug:c,workspace:a,isConnectedToProvider:A,forcedFullBackup:u,credentials:e,projectId:r,folderName:p}),U=u?"offline-full":A?void 0:"offline",H=await y(x.initialBranch,10),L=await y(o,10);try{if(x.partial&&(x.initialCommitHash===v||await C(v,x.initialBranch))){Vr.debug(`No commits to backup. ${v}`);let X={projectId:r,branchName:n,size:0,partial:x.partial,initialBranch:x.initialBranch,initialCommitHash:x.initialCommitHash,lastCommitHash:v,gitBranchName:o,empty:!0,status:"completed",version:"v2",repoUrl:Q,forced:U,...p&&{folderName:p},metadata:{initialCommitMeta:await B(x.initialCommitHash),lastCommitMeta:await B(v),rangeInRemote:H,rangeInLocal:L}};return{success:!0,empty:!0,lastCommitHash:v,partial:x.partial,repoUrl:Q,backupRef:ME({version:"v2",originalRepoUrl:Q,commitHash:v}),backupEntry:X}}Vr.debug("Creating git bundle...");let M=Date.now(),_=Math.random().toString(36).substring(2,8),Y=`backup-${M}-${_}.bundle`,W="/tmp",K=t.join(W,Y);Ql.default.mkdirSync(W,{recursive:!0}),await f(["bundle","create","--quiet",K,...x.partial?[`${x.initialCommitHash}..${o}`]:["--branches","--tags"]]),Vr.debug("Computing MD5 hash of bundle file...");let{contentMd5:J,size:O}=await H7e(K);Vr.debug("Verify bundle file integrity"),await f(["bundle","verify","--quiet",K]),Vr.debug(`Requesting signed upload URL for size: ${O} bytes`);let ie=await G7e(e,{projectId:r,branchName:n,size:O,partial:x.partial,contentMd5:J,...p&&{folderName:p},...g&&{repoUrl:g}},c);if(!ie)return Vr.info("Project/branch was removed, it's okay to skip backup"),{success:!1,reason:"project_removed"};let{signedUrl:de}=ie;Vr.debug(`Uploading to URL: ${de}`),await K7e(K,de,O,J),Vr.debug("Uploaded successfully");let me={projectId:r,branchName:n,size:O,partial:x.partial,initialBranch:x.initialBranch,initialCommitHash:x.initialCommitHash,lastCommitHash:v,gitBranchName:o,empty:!1,status:"completed",contentMd5:J,version:"v2",repoUrl:Q,forced:U,...p&&{folderName:p},metadata:{initialCommitMeta:await B(x.initialCommitHash),lastCommitMeta:await B(v),rangeInRemote:H,rangeInLocal:L}};try{Ql.default.unlinkSync(K)}catch(fe){t.Sentry?.captureException(fe,{level:"warning",tags:{operation:"codegen-backup"}})}return Vr.debug("Everything is done"),{success:!0,empty:!1,lastCommitHash:v,partial:x.partial,repoUrl:Q,backupRef:ME({version:"v2",originalRepoUrl:Q,commitHash:v}),backupEntry:me}}catch(M){let _=performance.now()-d,Y=M instanceof Error?M.message:String(M);try{await Qge(e,{elapsedTime:_,error:Y,backups:[]},c)}catch(W){Vr.error("Failed to record backup failure",W)}throw M}}async function O7e({sys:t,repoPath:e,featureBranch:r,debug:n,workspace:i,isConnectedToProvider:o,forcedFullBackup:s,credentials:a,projectId:A,folderName:c}){async function u(D){return Ga("git",D,{cwd:e,sys:t})}async function l(D){try{return(await u(["rev-parse",D||"HEAD"])).trim()}catch{return null}}async function p(D){try{return await u(["remote","get-url",D]),!0}catch{return!1}}async function g(){try{let b=(await u(["remote","show","origin"])).match(/HEAD branch: (.+)/);if(b){let Q=b[1].trim();if(Q)return Q}return null}catch(D){let b=new Error("failed to get default remote branch",{cause:D});throw t.Sentry?.captureException(b,{tags:{operation:"codegen-backup"}}),b}}async function d(D){let b;try{b=(await u(["remote","get-url","origin"])).trim()}catch{}b!==D&&(b?await u(["remote","set-url","origin",D]):await u(["remote","add","origin",D]))}let f=async()=>{if(i?.folders.length){let b=c?i.folders.find(Q=>(Q.name??Q.path)===c):i.folders.find(Q=>Q.enableGit);if(!b?.repoName)throw new Error("Git workspace not found");return!pE.includes(b.repoName)}return!!await p("origin")};async function h(){let D=!1;try{if(i?.folders?.length){let b=c?i.folders.find(Q=>(Q.name??Q.path)===c):i.folders.find(Q=>Q.enableGit);if(b?.repoName&&A){let Q=await hm(a,A,n);if(Q.success){let v=Q.gitConfigs?.[b.repoName];v?.url?(Vr.info(`Refreshing origin remote URL to ${v.url}`),await d(v.url)):(Vr.warn("Config URL was not returned for repo",b.repoName),D=!0)}else Vr.warn("Failed to fetch git configs",Q.error instanceof Error?Q.error.message:String(Q.error)),D=!0}}}catch(b){Vr.warn("Failed to refresh remote origin URL",b instanceof Error?b.message:String(b)),D=!0}return D}if(s){let D=await l(r);return{initialBranch:r,initialCommitHash:D??void 0,partial:!1,forcedFullBackup:s}}let C=await f();if(C){if(!o){Vr.info("Performing offline backup. Not attempting to fetch origin remote.");let D=await l(r);if(!D)throw new Error("Failed to get initial commit hash");return{initialBranch:r,initialCommitHash:D,partial:C,forcedFullBackup:s}}}else{Vr.debug("No origin remote found. Partial backups are not supported.");let D=await l(r);if(!D)throw new Error("Failed to get initial commit hash");return{initialBranch:r,initialCommitHash:D,partial:!1,forcedFullBackup:s}}Vr.debug("Re-fetching all branches");let I=await h();await u(["fetch","origin"]);let B=await g();if(!B)throw new Error("Failed to get default remote branch");if(B==="(unknown)"){Vr.info("Origin default branch is (unknown); performing full backup.");let D=await l(r);if(!D)throw new Error("Failed to get initial commit hash");return{initialBranch:r,initialCommitHash:D,partial:!1,forcedFullBackup:s,tokenRefreshFailed:I}}let E=`refs/remotes/origin/${B}`,y=await l(E);if(!y)throw new Error("Failed to get initial commit hash");return{initialBranch:E,initialCommitHash:y,partial:C,forcedFullBackup:s,tokenRefreshFailed:I}}async function G7e(t,e,r){let n=new URL(`${Oe}/projects/git-backup-upload-url`);t.builderPublicKey&&n.searchParams.set("apiKey",t.builderPublicKey),t.userId&&n.searchParams.set("userId",t.userId);let i=await Ue(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},body:JSON.stringify(e),signal:AbortSignal.timeout(1e4)},r);if(i.status===404||i.status===410)return null;if(!i.ok)throw new Error(`Failed to get upload URL: ${i.statusText}`);return await i.json()}async function Qge(t,e,r){let n=new URL(`${Oe}/projects/git-backup-record`);t.builderPublicKey&&n.searchParams.set("apiKey",t.builderPublicKey),t.userId&&n.searchParams.set("userId",t.userId);let i=await Ue(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},signal:AbortSignal.timeout(1e4),body:JSON.stringify(e)},r);if(i.status===404||i.status===410)return{success:!0};if(!i.ok)throw new Error(`Failed to record backup: ${i.statusText}`);return await i.json()}async function bv(t,e,r,n){if(e.length===0)return;let i=e.map(a=>`${a.folderName||"code"} (${(a.size/1024/1024).toFixed(1)}MB, ${a.partial?"partial":"full"}${a.forced?", forced":""})`).join(", ");Vr.info(`Recording ${e.length} folder(s): ${i}`);let o=Date.now();if(!(await Qge(t,{backups:e,elapsedTime:r},n)).success)throw new Error("Commit(s) not found on remote when recording backup batch");Vr.info(`Recorded in ${Date.now()-o}ms \u2014 ${e.length} folder(s) committed`)}async function sO(t,e){try{if(e.check.backup.empty)return{success:!0,bundlePath:void 0,bundleSize:0,partial:e.check.backup.partial,gitBranchName:e.check.backup.gitBranchName,lastCommitHash:e.check.backup.lastCommitHash};if(!e.downloadUrl)throw new Error("No download URL found");let{signedUrl:r,partial:n}=e.downloadUrl,i=Date.now(),o=Math.random().toString(36).substring(2,8),s=`download-${i}-${o}.bundle`,a="/tmp",A=t.join(a,s);Ql.default.mkdirSync(a,{recursive:!0});let c=await fetch(r);if(!c.ok){let p=await c.text();throw new Error(`Failed to download bundle: ${c.statusText}: ${p}`)}let u=await c.arrayBuffer();Ql.default.writeFileSync(A,new Uint8Array(u));let l=await t.stat(A);return Vr.info(`Downloaded bundle: ${l.size} bytes`),{success:!0,bundlePath:A,bundleSize:l.size,partial:n,gitBranchName:e.check.backup.gitBranchName,lastCommitHash:e.check.backup.lastCommitHash}}catch(r){let n=new Error("Failed to download backup",{cause:r});return t.Sentry?.captureException(n,{tags:{operation:"codegen-backup"}}),{success:!1,error:n}}}async function K7e(t,e,r,n){let i=Ql.default.createReadStream(t),o=await fetch(e,{method:"PUT",body:i,headers:{"Content-Type":"application/octet-stream","Content-Length":r.toString(),"Content-MD5":n},duplex:"half"}),s=await o.text();if(!o.ok)throw new Error(`Failed to upload bundle: ${o.statusText}: ${s}`);return Vr.info(`Uploaded bundle: ${s}`),o}async function H7e(t){let e=await Ql.default.promises.stat(t);if(!e.isFile())throw new Error("Bundle file does not exist");let r=(0,yge.createHash)("md5"),n=Ql.default.createReadStream(t);return await new Promise((o,s)=>{n.on("error",s),n.on("data",a=>r.update(a)),n.on("end",o)}),{contentMd5:r.digest("base64"),size:e.size}}async function aO(t,e,r,n){try{let i=JSON.stringify(r),o=new URL(`${Oe}/projects/set-runtime-status`);e.builderPublicKey&&o.searchParams.set("apiKey",e.builderPublicKey),e.userId&&o.searchParams.set("userId",e.userId);let s={"Content-Type":"application/json"};e.builderPrivateKey&&(s.Authorization=`Bearer ${e.builderPrivateKey}`);let a=await Ue(o,{method:"POST",body:i,keepalive:!0,headers:s,signal:AbortSignal.timeout(1e4)},n);return a.ok?await a.json():!1}catch(i){return t.Sentry?.captureException(i,{level:"warning",tags:{operation:"codegen-backup"}}),!1}}async function vv(t,e,r,n){let i=Ks(r.commits);if(!i)return;let o=Object.keys(r.commits).length;Vr.info(`Syncing snapshot (${o} folder(s)): ${i}`),await aO(t,e,{projectId:r.projectId,branchName:r.branchName,lastCommitHash:i,clearSecondaryVolumeId:!1},n)}function ME(t){if(!(t.originalRepoUrl==null||t.commitHash==null))return`${t.version??"v1"}::${t.originalRepoUrl}::${t.commitHash}`}var Ql,yge,Vr,Sv=N(()=>{"use strict";m();Ql=z(require("node:fs"),1);gn();nn();Ls();yge=require("node:crypto");Vc();Pt();IE();oO();Vr=ke("Backup")});function zc(t){try{if((0,Cm.existsSync)(t)){let e=(0,Cm.readFileSync)(t,"utf-8");return JSON.parse(e)}}catch{}return null}function Hs(t){try{if((0,Cm.existsSync)(t))return(0,Cm.readFileSync)(t,"utf-8")}catch{}return null}function Im(t){let e=t.filter(r=>!r.includes("/"));return e.some(r=>r==="pnpm-lock.yaml")?{manager:"pnpm",setupCommand:"pnpm install"}:e.some(r=>r==="yarn.lock")?{manager:"yarn",setupCommand:"yarn"}:e.some(r=>r==="bun.lockb")?{manager:"bun",setupCommand:"bun install"}:e.some(r=>r==="package-lock.json")?{manager:"npm",setupCommand:"npm install"}:null}function Dge(t,e){return t.some(r=>r===e)}function _E(t,e){return t.filter(n=>!n.includes("/")).some(e)}function Em(t,e){return t.some(r=>r.startsWith(`${e}/`))}var Cm,LE=N(()=>{"use strict";m();Cm=require("node:fs")});async function bge(t,e){try{let r=Im(e);if(!r||!_E(e,A=>/^next\.config\.(js|ts|mjs)$/.test(A))||!Em(e,"app"))return null;let o=(0,wge.join)(t,"package.json"),s=zc(o);if(!s?.scripts?.dev)return null;let a=s.scripts.dev;return a.includes("next dev")?{id:"nextjs",setupCommand:r.setupCommand,devCommand:a,setupDependencies:[{tool:"node",version:"22",key:"node",type:"mise"}],autoDetectDevServer:!0}:null}catch{return null}}var wge,vge=N(()=>{"use strict";m();wge=require("node:path");LE()});async function Sge(t,e){try{let r=Im(e);if(!r)return null;let n=_E(e,p=>p==="vue.config.js"||p==="vue.config.ts"),i=_E(e,p=>/^vite\.config\.(js|ts|mjs)$/.test(p));if(!n&&!i)return null;if(i&&!n){let p=e.filter(g=>/^vite\.config\.(js|ts|mjs)$/.test(g));if(p.length>0){let g=(0,AO.join)(t,p[0]),d=Hs(g);if(!d||!d.includes("@vitejs/plugin-vue")&&!d.includes("vite-plugin-vue"))return null}}if(!Em(e,"src"))return null;let s=(0,AO.join)(t,"package.json"),a=zc(s);if(!a||!(a.dependencies?.vue||a.devDependencies?.vue)||!a.scripts?.dev)return null;let c=a.scripts.dev,u=c.includes("vite"),l=c.includes("vue-cli-service");return!u&&!l?null:{id:"vue-vite",setupCommand:r.setupCommand,devCommand:c,setupDependencies:[{tool:"node",version:"22",key:"node",type:"mise"}],autoDetectDevServer:!0}}catch{return null}}var AO,xge=N(()=>{"use strict";m();AO=require("node:path");LE()});async function Fge(t,e){try{let r=Im(e);if(!r||!Dge(e,"svelte.config.js")||!Em(e,"src"))return null;let o=(0,cO.join)(t,"package.json"),s=zc(o);if(!s||!(s.dependencies?.svelte||s.devDependencies?.svelte))return null;let A=s.dependencies?.["@sveltejs/kit"]||s.devDependencies?.["@sveltejs/kit"],c=s.dependencies?.["@sveltejs/vite-plugin-svelte"]||s.devDependencies?.["@sveltejs/vite-plugin-svelte"];if(!A&&!c||!s.scripts?.dev)return null;let u=s.scripts.dev,l=u.includes("vite"),p=u.includes("svelte-kit");if(!l&&!p)return null;if(l&&!A){let g=e.filter(d=>/^vite\.config\.(js|ts|mjs)$/.test(d));if(g.length>0){let d=(0,cO.join)(t,g[0]),f=Hs(d);if(!f||!f.includes("@sveltejs/vite-plugin-svelte"))return null}}return{id:"svelte-vite",setupCommand:r.setupCommand,devCommand:u,setupDependencies:[{tool:"node",version:"22",key:"node",type:"mise"}],autoDetectDevServer:!0}}catch{return null}}var cO,kge=N(()=>{"use strict";m();cO=require("node:path");LE()});function $7e(t){let e=[".ts",".tsx",".js",".jsx",".py",".rb",".go",".rs",".java",".c",".cpp",".cs",".php",".swift",".kt",".scala",".vue",".svelte",".astro",".qwik"],r=["package.json","Cargo.toml","go.mod","pyproject.toml","requirements.txt","Gemfile","pom.xml","build.gradle","next.config.js","next.config.ts","next.config.mjs","nuxt.config.js","nuxt.config.ts","gatsby-config.js","gatsby-config.ts","svelte.config.js","vite.config.js","vite.config.ts","webpack.config.js","webpack.config.ts","rollup.config.js","astro.config.mjs","remix.config.js","angular.json","stencil.config.ts","stencil.config.js","web-dev-server.config.js","web-dev-server.config.mjs","custom-elements.json","hugo.toml","hugo.yaml","config.toml","config.yaml","_config.yml","jekyll-config.yml","docusaurus.config.js","mkdocs.yml","nest-cli.json","tsconfig.json","jsconfig.json","ios/Podfile","android/build.gradle","pubspec.yaml"],n=["src/","app/","pages/","components/","public/","static/","assets/","lib/","pkg/","cmd/","internal/","views/","templates/","content/","layouts/","archetypes/"];return!(t.some(a=>e.some(A=>a.toLowerCase().endsWith(A)))||t.some(a=>{let A=a.replace(/\\/g,"/"),c=A.split("/").pop()||"";return r.includes(c)||r.includes(A)})||t.some(a=>{let A=a.replace(/\\/g,"/");return n.some(c=>A.includes(c))}))}function YA(t){if(!t)return!1;let e=t.trim();if(e==="")return!1;let r=[">","<",">=","<=","^","~","=","*"];for(let n of r)if(e.includes(n))return!1;return!(e.includes(" ")||/\.x$/i.test(e)||/\.\*$/.test(e)||e.toLowerCase()==="latest")}async function J7e(t,e){try{let r=e.filter(A=>A.endsWith("package.json")),n=zc((0,vn.join)(t,"package.json"));if(e.some(A=>A.includes("pnpm-workspace.yaml")))return{isMonorepo:!0,type:"pnpm-workspaces",possibleRoots:await qA(e)};if(n?.workspaces){let A=await qA(e);return e.some(l=>l.includes("yarn.lock"))?{isMonorepo:!0,type:"yarn-workspaces",possibleRoots:A}:e.some(l=>l.includes("bun.lock")||l.includes("bun.lockb"))?{isMonorepo:!0,type:"bun-workspaces",possibleRoots:A}:{isMonorepo:!0,type:"npm-workspaces",possibleRoots:A}}if(e.some(A=>A.includes("lerna.json")))return{isMonorepo:!0,type:"lerna",possibleRoots:await qA(e)};if(e.some(A=>A.includes("nx.json")))return{isMonorepo:!0,type:"nx",possibleRoots:await qA(e)};if(e.some(A=>A.includes("turbo.json")))return{isMonorepo:!0,type:"turborepo",possibleRoots:await qA(e)};if(e.some(A=>A.includes("rush.json")))return{isMonorepo:!0,type:"rush",possibleRoots:await qA(e)};if(e.some(A=>A.includes(".moon/workspace.yml")||A.includes(".moon/workspace.yaml")))return{isMonorepo:!0,type:"moon",possibleRoots:await qA(e)};if(Hs((0,vn.join)(t,"Cargo.toml"))?.includes("[workspace]"))return{isMonorepo:!0,type:"cargo-workspaces",possibleRoots:await qA(e)};if(e.some(A=>A.endsWith("go.work")))return{isMonorepo:!0,type:"go-workspaces",possibleRoots:await qA(e)};let s=await qA(e);return s.length>=3?{isMonorepo:!0,type:"other",possibleRoots:s}:r.length>3?{isMonorepo:!0,type:"other",possibleRoots:s}:e.filter(A=>A.endsWith("Cargo.toml")).length>3?{isMonorepo:!0,type:"other",possibleRoots:s}:{isMonorepo:!1,possibleRoots:s.length>0?s:void 0}}catch{return{isMonorepo:!1}}}async function j7e(t,e){try{let r=[],n=e.filter(l=>l.endsWith("package.json")),i={};for(let l of n){let p=(0,vn.join)(t,l),g=zc(p);g&&(Object.assign(i,g.dependencies||{}),Object.assign(i,g.devDependencies||{}))}let o={React:{deps:["react","react-dom"],files:["jsx","tsx"]},"Next.js":{deps:["next"],files:["pages/","app/"],configFiles:["next.config.js","next.config.mjs","next.config.ts"]},Vue:{deps:["vue"],files:["vue"]},Nuxt:{deps:["nuxt"],configFiles:["nuxt.config.js","nuxt.config.ts"]},Angular:{deps:["@angular/core"],configFiles:["angular.json"]},Svelte:{deps:["svelte"],files:["svelte"]},SvelteKit:{deps:["@sveltejs/kit"],configFiles:["svelte.config.js"]},Qwik:{deps:["@builder.io/qwik"],files:["qwik"]},Solid:{deps:["solid-js"]},Stencil:{deps:["@stencil/core"],configFiles:["stencil.config.ts","stencil.config.js"]},Lit:{deps:["lit","lit-element","lit-html"]},Polymer:{deps:["@polymer/polymer"]},"FAST (Microsoft)":{deps:["@microsoft/fast-element"]},Haunted:{deps:["haunted"]},Hybrids:{deps:["hybrids"]},Express:{deps:["express"]},Fastify:{deps:["fastify"]},NestJS:{deps:["@nestjs/core"],configFiles:["nest-cli.json"]},Remix:{deps:["@remix-run/react"],configFiles:["remix.config.js"]},Gatsby:{deps:["gatsby"],configFiles:["gatsby-config.js"]},Astro:{deps:["astro"],configFiles:["astro.config.mjs"]}};for(let[l,p]of Object.entries(o)){let g=[],d="low",f=p.deps.some(h=>i?.[h]);f&&(g.push(`dependency: ${p.deps.find(h=>i?.[h])}`),d="high"),p.configFiles&&p.configFiles.some(C=>e.some(I=>I.includes(C)))&&(g.push(`config: ${p.configFiles.find(C=>e.some(I=>I.includes(C)))}`),d="high"),p.files&&!f&&p.files.some(C=>e.some(I=>I.includes(C)))&&(g.push(`files: ${p.files.find(C=>e.some(I=>I.includes(C)))}`),d=d==="high"?"high":"medium"),g.length>0&&r.push({name:l,confidence:d,indicators:g})}let s={Django:{files:["manage.py","settings.py"],imports:["django"]},Flask:{files:["app.py"],imports:["flask"]},FastAPI:{files:[],imports:["fastapi"]}};for(let[l,p]of Object.entries(s)){let g=[],d="low";if(p.files.some(h=>e.some(C=>C.includes(h)))&&(g.push(`file: ${p.files.find(h=>e.some(C=>C.includes(h)))}`),d="high"),p.imports){let h=e.filter(I=>I.includes("requirements.txt")),C=e.filter(I=>I.includes("pyproject.toml"));for(let I of h){let B=Hs((0,vn.join)(t,I));if(B&&p.imports.some(y=>B.includes(y))){g.push("requirements.txt"),d="high";break}}for(let I of C){let B=Hs((0,vn.join)(t,I));if(B&&p.imports.some(y=>B.includes(y))){g.push("pyproject.toml"),d="high";break}}}g.length>0&&r.push({name:l,confidence:d,indicators:g})}let a=e.filter(l=>l.endsWith("Cargo.toml")),A=[{name:"Actix",dep:"actix-web"},{name:"Rocket",dep:"rocket"},{name:"Axum",dep:"axum"},{name:"Warp",dep:"warp"}];for(let l of a){let p=Hs((0,vn.join)(t,l));if(p)for(let{name:g,dep:d}of A)p.includes(d)&&!r.some(f=>f.name===g)&&r.push({name:g,confidence:"high",indicators:[`Cargo.toml: ${d}`]})}let c=e.filter(l=>l.endsWith("go.mod")),u=[{name:"Gin",dep:"github.com/gin-gonic/gin"},{name:"Echo",dep:"github.com/labstack/echo"},{name:"Fiber",dep:"github.com/gofiber/fiber"}];for(let l of c){let p=Hs((0,vn.join)(t,l));if(p)for(let{name:g,dep:d}of u)p.includes(d)&&!r.some(f=>f.name===g)&&r.push({name:g,confidence:"high",indicators:[`go.mod: ${d}`]})}return r}catch{return[]}}async function Y7e(t,e){let r=[];try{let n=(0,vn.join)(t,".npmrc");if((0,on.existsSync)(n)){r.push({tool:".npmrc"});let d=(0,on.readFileSync)(n,"utf-8");(d.includes("@")||d.includes("registry"))&&r.push({tool:"private-packages"})}e.some(d=>d.includes(".env")||d.includes(".env.example")||d.includes(".env.template"))&&r.push({tool:"env-file"});let o=(0,vn.join)(t,".nvmrc"),s=(0,vn.join)(t,".node-version");if((0,on.existsSync)(o)){let d=(0,on.readFileSync)(o,"utf-8").trim();YA(d)?r.push({tool:"node",version:d}):r.push({tool:"node"})}else if((0,on.existsSync)(s)){let d=(0,on.readFileSync)(s,"utf-8").trim();YA(d)?r.push({tool:"node",version:d}):r.push({tool:"node"})}else{let d=(0,vn.join)(t,"package.json");if((0,on.existsSync)(d))try{let f=JSON.parse((0,on.readFileSync)(d,"utf-8"));if(f.engines?.node){let h=f.engines.node;YA(h)?r.push({tool:"node",version:h}):r.push({tool:"node"})}}catch{}}let a=(0,vn.join)(t,"rust-toolchain"),A=(0,vn.join)(t,"rust-toolchain.toml");if((0,on.existsSync)(a)){let d=(0,on.readFileSync)(a,"utf-8").trim();YA(d)?r.push({tool:"rust",version:d}):r.push({tool:"rust"})}else if((0,on.existsSync)(A)){let h=(0,on.readFileSync)(A,"utf-8").match(/channel\s*=\s*"(.+?)"/)?.[1];YA(h)?r.push({tool:"rust",version:h}):r.push({tool:"rust"})}let c=(0,vn.join)(t,".python-version");if((0,on.existsSync)(c)){let d=(0,on.readFileSync)(c,"utf-8").trim();YA(d)?r.push({tool:"python",version:d}):r.push({tool:"python"})}else{let d=(0,vn.join)(t,"pyproject.toml");if((0,on.existsSync)(d)){let h=(0,on.readFileSync)(d,"utf-8").match(/requires-python\s*=\s*"(.+?)"/);if(h){let C=h[1];YA(C)?r.push({tool:"python",version:C}):r.push({tool:"python"})}}}let u=(0,vn.join)(t,".go-version");if((0,on.existsSync)(u)){let d=(0,on.readFileSync)(u,"utf-8").trim();YA(d)?r.push({tool:"go",version:d}):r.push({tool:"go"})}else{let d=(0,vn.join)(t,"go.mod");if((0,on.existsSync)(d)){let h=(0,on.readFileSync)(d,"utf-8").match(/go\s+(\d+\.\d+)/);if(h){let C=h[1];YA(C)?r.push({tool:"go",version:C}):r.push({tool:"go"})}}}let l=(0,vn.join)(t,".ruby-version");if((0,on.existsSync)(l)){let d=(0,on.readFileSync)(l,"utf-8").trim();YA(d)?r.push({tool:"ruby",version:d}):r.push({tool:"ruby"})}e.some(d=>d.includes("docker-compose.yml")||d.includes("docker-compose.yaml")||d.includes("compose.yml")||d.includes("compose.yaml"))&&r.push({tool:"docker-compose"});let g=[{type:"postgresql",indicators:["postgresql","postgres","psql"]},{type:"mysql",indicators:["mysql"]},{type:"mongodb",indicators:["mongodb","mongo"]},{type:"redis",indicators:["redis"]},{type:"sqlite",indicators:["sqlite"]}];for(let{type:d,indicators:f}of g)e.some(C=>f.some(I=>C.toLowerCase().includes(I)))&&r.push({tool:d});return r}catch{return[]}}async function q7e(t){try{let e=[];return t.some(r=>r.includes("package-lock.json"))&&e.push("npm"),t.some(r=>r.includes("yarn.lock"))&&e.push("yarn"),t.some(r=>r.includes("pnpm-lock.yaml"))&&e.push("pnpm"),t.some(r=>r.includes("bun.lockb"))&&e.push("bun"),t.some(r=>r.includes("Cargo.lock"))&&e.push("cargo"),t.some(r=>r.includes("go.sum"))&&e.push("go"),t.some(r=>r.includes("Gemfile.lock"))&&e.push("bundler"),t.some(r=>r.includes("requirements.txt")||r.includes("pyproject.toml"))&&e.push("pip/poetry"),e}catch{return[]}}async function V7e(t){try{let e=[],r=[{name:"Webpack",indicators:["webpack.config.js","webpack.config.ts"]},{name:"Vite",indicators:["vite.config.js","vite.config.ts"]},{name:"esbuild",indicators:["esbuild.config.js"]},{name:"Rollup",indicators:["rollup.config.js"]},{name:"Parcel",indicators:[".parcelrc"]},{name:"Turbopack",indicators:["turbo.json"]},{name:"Make",indicators:["Makefile"]},{name:"CMake",indicators:["CMakeLists.txt"]},{name:"Gradle",indicators:["build.gradle","build.gradle.kts"]},{name:"Maven",indicators:["pom.xml"]}];for(let{name:n,indicators:i}of r)i.some(s=>t.some(a=>a.includes(s)))&&e.push(n);return e}catch{return[]}}function z7e(t,e){let r=[],n=t.split(`
|
|
1772
|
-
`);for(let i of n){let o=i.trim();if(!o||o.startsWith("#"))continue;let s=o.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(s){let a=s[1],A=s[2].trim();(A.startsWith('"')&&A.endsWith('"')||A.startsWith("'")&&A.endsWith("'"))&&(A=A.slice(1,-1)),r.push({key:a,placeholderValue:A||void 0,source:e,type:"env"})}}return r}function W7e(t,e){let r=[],n=/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,i,o=new Set;for(;(i=n.exec(t))!==null;){let s=i[1];o.has(s)||(o.add(s),r.push({key:s,source:e,type:"npmrc"}))}return r}async function Z7e(t,e){try{let r=[],n=new Set,i=[".env.example",".env.template",".env.sample",".env.local.example",".env.development.example",".env.production.example",".env.test.example",".env.staging.example",".env",".env.local",".env.development",".env.production",".env.test",".env.staging"],o=[],s=new Set,a=[];for(let A of e){let c=A.replace(/\\/g,"/");(c===".npmrc"||c.endsWith("/.npmrc"))&&a.push(A)}for(let A of a){let c=(0,vn.join)(t,A),u=Hs(c);if(u){let l=W7e(u,A);for(let p of l)n.has(p.key)||(n.add(p.key),r.push(p))}}for(let A of i)for(let c of e){let u=c.replace(/\\/g,"/");(u===A||u.endsWith(`/${A}`))&&!s.has(c)&&(s.add(c),o.push(c))}for(let A of o){let c=(0,vn.join)(t,A),u=Hs(c);if(u){let l=z7e(u,A);for(let p of l)n.has(p.key)||(n.add(p.key),r.push(p))}}return r}catch{return[]}}async function X7e(t,e){try{let r=await bge(t,e);if(r)return r;let n=await Sge(t,e);if(n)return n;let i=await Fge(t,e);return i||null}catch{return null}}async function qA(t){try{let e=new Set,r=["__tests__","__test__","__examples__","__example__","__fixtures__","__mocks__","test","tests","testing","spec","specs","example","examples","sample","samples","demo","demos","fixture","fixtures","mock","mocks",".test",".spec"],n=["package.json","tsconfig.json","jsconfig.json","pyproject.toml","setup.py","setup.cfg","Pipfile","requirements.txt","poetry.lock","go.mod","Cargo.toml","Gemfile","Rakefile","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","composer.json","mix.exs","Package.swift","pubspec.yaml","stack.yaml","cabal.project","build.sbt","project.clj","deps.edn","CMakeLists.txt","Makefile","Dockerfile",".storybook"],i=a=>a.split("/").some(c=>r.some(u=>c===u||c.startsWith(u+".")));for(let a of t){let A=a.replace(/\\/g,"/"),c=A.split("/").pop()||"";if(n.includes(c)){let u=A.substring(0,A.lastIndexOf("/"));if(u&&i(u))continue;u?e.add(u):e.add(".")}if(c.endsWith(".csproj")||c.endsWith(".fsproj")||c.endsWith(".vbproj")||c.endsWith(".sln")){let u=A.substring(0,A.lastIndexOf("/"));if(u&&i(u))continue;u?e.add(u):e.add(".")}}let o=Array.from(e).sort(),s=o.filter(a=>a!==".");return s.length>0?s:o}catch{return[]}}async function Rge(t,e){let r=[];try{let n=await Dp({sys:t,basePath:e,globPattern:"**/*",dot:!0}),i=$7e(n),o=await J7e(e,n),s=await j7e(e,n),a=await Y7e(e,n),A=await q7e(n),c=await V7e(n),u=await Z7e(e,n),l=await X7e(e,n),p={languages:[],isEmpty:i,isMonorepo:o.isMonorepo,monorepoType:o.type,frameworks:s,setupRequirements:a,packageManagers:A,buildTools:c,environmentVariables:u.length>0?u:void 0,possibleMonorepoRoots:o.possibleRoots,guessedSettings:l||void 0};return r.length>0&&(p.errors=r),p}catch(n){return{languages:[],isEmpty:!1,isMonorepo:!1,frameworks:[],setupRequirements:[],packageManagers:[],buildTools:[],errors:[`Fatal error: ${n instanceof Error?n.message:String(n)}`]}}}var on,vn,Nge=N(()=>{"use strict";m();wp();LE();vge();xge();kge();on=require("node:fs"),vn=require("node:path")});var Mge,$s,xv,Tge,Fv,Pge=N(()=>{"use strict";m();Mge=require("node:child_process"),$s=z(require("node:path"),1),xv=z(require("node:fs"),1);La();Pt();Tge=ke("TsServer"),Fv=class t{#
|
|
1773
|
-
`);if(n===-1)break;let i=this.#t.substring(0,n).trim();this.#t=this.#t.substring(n+1),i.startsWith("{")&&this.#F(i)}}#F(e){let r;try{r=JSON.parse(e)}catch{return}if(r.type==="response"){let n=r,i=this.#o.get(n.request_seq);i&&(clearTimeout(i.timer),this.#o.delete(n.request_seq),i.resolve({success:n.success,body:n.body,message:n.message}))}else if(r.type==="event"){let n=r;this.#e?.(n)}}async#a(e,r){if(!this.#
|
|
1774
|
-
`;this.#r.stdin.write(A)})}setEventHandler(e){this.#e=e}async openFile(e,r,n){await this.start();let i=$s.default.isAbsolute(e)?e:$s.default.resolve(this.#A,e);if(this.#s.has(i)){await this.changeFile(e,r);return}await this.#a("open",{file:i,fileContent:r,scriptKindName:this.#n(i),projectRootPath:n||this.#A}),this.#s.add(i)}async changeFile(e,r){if(!this.#B)return;let n=$s.default.isAbsolute(e)?e:$s.default.resolve(this.#A,e);if(!this.#s.has(n)){await this.openFile(e,r);return}await this.#a("open",{file:n,fileContent:r,scriptKindName:this.#n(n),projectRootPath:this.#A})}async closeFile(e){if(!this.#B)return;let r=$s.default.isAbsolute(e)?e:$s.default.resolve(this.#A,e);this.#s.has(r)&&(await this.#a("close",{file:r}),this.#s.delete(r))}async getCompletions(e,r,n,i){let o=this.#f(e);return this.#a("completionInfo",{file:o,line:r,offset:n,includeExternalModuleExports:i?.includeExternalModuleExports??!0,includeInsertTextCompletions:!0,triggerCharacter:i?.triggerCharacter,triggerKind:i?.triggerCharacter?2:1})}async getCompletionDetails(e,r,n,i){let o=this.#f(e);return this.#a("completionEntryDetails",{file:o,line:r,offset:n,entryNames:i})}async getDefinition(e,r,n){let i=this.#f(e);return this.#a("definition",{file:i,line:r,offset:n})}async getTypeDefinition(e,r,n){let i=this.#f(e);return this.#a("typeDefinition",{file:i,line:r,offset:n})}async getQuickInfo(e,r,n){let i=this.#f(e);return this.#a("quickinfo",{file:i,line:r,offset:n})}async getReferences(e,r,n){let i=this.#f(e);return this.#a("references",{file:i,line:r,offset:n})}async getSignatureHelp(e,r,n){let i=this.#f(e);return this.#a("signatureHelp",{file:i,line:r,offset:n})}async requestDiagnostics(e){let r=e.map(n=>this.#f(n));await this.#a("geterr",{files:r,delay:0}).catch(()=>{})}async getRenameLocations(e,r,n){let i=this.#f(e);return this.#a("rename",{file:i,line:r,offset:n,findInComments:!1,findInStrings:!1})}async getNavTree(e){let r=this.#f(e);return this.#a("navtree",{file:r})}async organizeImports(e){let r=this.#f(e);return this.#a("organizeImports",{scope:{type:"file",args:{file:r}}})}async getInlayHints(e){let r=this.#f(e);return this.#a("provideInlayHints",{file:r,start:0,length:2147483647})}async getCodeFixes(e,r,n,i,o,s){let a=this.#f(e);return this.#a("getCodeFixes",{file:a,startLine:r,startOffset:n,endLine:i,endOffset:o,errorCodes:s})}async getApplicableRefactors(e,r,n,i,o){let s=this.#f(e);return this.#a("getApplicableRefactors",{file:s,startLine:r,startOffset:n,endLine:i,endOffset:o})}async getEditsForRefactor(e,r,n,i,o,s,a){let A=this.#f(e);return this.#a("getEditsForRefactor",{file:A,startLine:r,startOffset:n,endLine:i,endOffset:o,refactor:s,action:a})}async getImplementation(e,r,n){let i=this.#f(e);return this.#a("implementation",{file:i,line:r,offset:n})}async getSelectionRange(e,r){let n=this.#f(e);return this.#a("selectionRange",{file:n,locations:r})}async getLinkedEditingRange(e,r,n){let i=this.#f(e);return this.#a("linkedEditingRange",{file:i,line:r,offset:n})}async getFormatRange(e,r,n,i,o){let s=this.#f(e);return this.#a("format",{file:s,line:r,offset:n,endLine:i,endOffset:o})}getCwd(){return this.#A}isRunning(){return this.#B&&this.#r!==null}dispose(){if(this.#i=!0,this.#B=!1,this.#r){try{this.#r.kill("SIGTERM")}catch{}Yb.untrack(this.#r),this.#r=null}for(let[,e]of this.#o)clearTimeout(e.timer),e.reject(new Error("tsserver disposed"));this.#o.clear(),this.#s.clear(),this.#e=null}#f(e){return $s.default.isAbsolute(e)?e:$s.default.resolve(this.#A,e)}#n(e){switch($s.default.extname(e).toLowerCase()){case".tsx":return"TSX";case".ts":return"TS";case".jsx":return"JSX";case".js":case".mjs":case".cjs":return"JS";default:return"TS"}}}});function Bm(t){if(!t)return;let e=t.toLowerCase();if(e!=="inherit")return eZe[e]??t}var eZe,kv=N(()=>{"use strict";m();eZe={"sonnet-4":"acs4",sonnet:"acs",opus:"aco",haiku:"ach",gpt5:"opa5","gpt5-codex":"opa5c.acs4",codex:"opa5c.acs4","gpt5-codex-mini":"opa5c-mini","gpt5-mini":"opa5-mini","gpt5-nano":"opa5-nano",gemini:"g.acs","gemini-flash":"gf.ach"}});function _ge(t,e){try{if(!t||!t.trim())return null;let r=Gf(t);if(!r.frontmatter||Object.keys(r.frontmatter).length===0)return{name:UE.default.basename(e,UE.default.extname(e)),systemPrompt:r.body||t.trim(),filePath:e};let n=r.body;if(!n)return null;let i=r.frontmatter.name||UE.default.basename(e,UE.default.extname(e)),o;r.frontmatter.tools&&(Array.isArray(r.frontmatter.tools)?o=r.frontmatter.tools.map(d=>d.trim()):typeof r.frontmatter.tools=="string"&&(o=r.frontmatter.tools.split(",").map(d=>d.trim())));let s=r.frontmatter.model?Bm(r.frontmatter.model):void 0,a=r.frontmatter.mode,A=!!r.frontmatter.includeMemories,c=!!r.frontmatter.needDevServer,u=!!r.frontmatter.needValidation,l=!!r.frontmatter.resetAfterRun,p=["low","medium","high","minimal"],g=r.frontmatter.reasoning&&p.includes(r.frontmatter.reasoning)?r.frontmatter.reasoning:void 0;return{name:i,description:r.frontmatter.description,systemPrompt:n,tools:o,model:s,mode:a,filePath:e,includeMemories:A,needDevServer:c,needValidation:u,resetAfterRun:l,reasoning:g}}catch{return null}}var UE,Lge=N(()=>{"use strict";m();UE=z(require("node:path"),1);ab();kv()});async function Uge(t,e,r,n="",i,o){let s=[];try{if(!await t.exists(e))return s;let a=await t.readdir(e);for(let A of a){let c=t.join(e,A);if(i&&o){let l=t.relative(o,c);if(!l.startsWith("..")&&!l.startsWith("/")&&i(l))continue}let u=await t.stat(c).catch(()=>null);if(u)if(u.isDirectory()){let l=n?`${n}/${A}`:A,p=await Uge(t,c,r,l,i,o);s.push(...p)}else(A.endsWith(".mdc")||A.endsWith(".md")||A.endsWith(".yml")||A.endsWith(".yaml"))&&s.push(c)}}catch{}return s}async function rZe(t,e,r){try{if(!(await t.stat(e).catch(()=>null))?.isFile())return null;let i=await t.readFile(e);if(!i)return null;let o=t.relative(r,e);return _ge(i,o)}catch(n){return t.Sentry?.captureException(n),null}}async function Oge({sys:t,projectDir:e,currentDir:r,rootDir:n}){let i=[],o=[".claude/agents",".builder/agents",".cursor/agents",".agents/agents"],s=await Rv(e,t),a;do{try{for(let A of o){let c=t.resolve(r,A);if(await t.exists(c)){let u=await Uge(t,c,c,"",s,e);for(let l of u){let p=await rZe(t,l,e);p&&i.push(p)}}}}catch(A){tZe.debug(`Error reading ${r}:`,A)}if(a=r,r=t.dirname(r),r===a)break}while(a!==n);return i}var tZe,Gge=N(()=>{"use strict";m();Lge();wp();Pt();tZe=ke("AgentDiscovery")});function nZe(t){try{return JSON.stringify(t)}catch{return String(t)}}function Kge(t){let{filePath:e,forceWorkspace:r=!1,workspace:n,workingDirectory:i,sys:o,canCollapseWorkspace:s}=t;if(typeof e!="string")throw new TypeError(`resolveWorkspacePath: 'filePath' must be a string, received ${typeof e}: ${nZe(e)}`);let a=e;if(a.startsWith("/")?a=a.substring(1):a.startsWith("./")&&(a=a.substring(2)),!n?.folders?.length)return{resolvedPath:o.resolve(i,a)};if(n.folders.length===1&&n.folders[0].name==="."||s){let d=n.folders[0],f=o.resolve(i,d.path);return{resolvedPath:o.resolve(f,a),workspaceFolder:d}}let c=a.indexOf("/");if(c===-1){if(r){let d=n.folders[0],f=o.resolve(i,d.path);return{resolvedPath:o.resolve(f,a),workspaceFolder:d}}return{resolvedPath:o.resolve(i,a)}}let u=a.substring(0,c),l=a.substring(c+1),p=n.folders.find(d=>d.name?d.name===u:o.basename(d.path)===u);if(!p){if(!r)return{resolvedPath:o.resolve(i,a)};p=n.folders[0];let d=o.resolve(i,p.path);return{resolvedPath:o.resolve(d,a),workspaceFolder:p}}let g=o.resolve(i,p.path);return{resolvedPath:o.resolve(g,l),workspaceFolder:p}}function Hge(t){let{absolutePath:e,workspace:r,workingDirectory:n,sys:i,canCollapseWorkspace:o}=t;if(!r?.folders?.length)return;let s=us(i.resolve(e));if(r.folders.length===1&&r.folders[0].name==="."){let A=r.folders[0],c=us(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}if(o&&r.folders.length===1){let A=r.folders[0],c=us(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}for(let A of r.folders){let c=us(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);u.startsWith("/")&&(u=u.substring(1));let l=A.name||i.basename(A.path);if(l==="."&&r.folders.length>1)continue;return u?`${l}/${u}`:l}}if(o&&r.folders.length>0){let A=r.folders[0],c=us(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}}function $ge(t){let{resolvedPath:e,workingDirectory:r,workspace:n,sys:i}=t,o=i.normalize(e),s=i.normalize(r),a=s.includes("\\")?"\\":"/",A=c=>o.startsWith(c+a)||o===c;if(A(s))return!0;if(n?.folders)for(let c of n.folders){let u=i.normalize(i.resolve(r,c.path));if(A(u))return!0}return!1}var Jge=N(()=>{"use strict";m();z2()});var Xt,jge,Me,Wc,OE=N(()=>{m();(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xt||(Xt={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(jge||(jge={}));Me=Xt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wc=t=>{switch(typeof t){case"undefined":return Me.undefined;case"string":return Me.string;case"number":return Number.isNaN(t)?Me.nan:Me.number;case"boolean":return Me.boolean;case"function":return Me.function;case"bigint":return Me.bigint;case"symbol":return Me.symbol;case"object":return Array.isArray(t)?Me.array:t===null?Me.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Me.promise:typeof Map<"u"&&t instanceof Map?Me.map:typeof Set<"u"&&t instanceof Set?Me.set:typeof Date<"u"&&t instanceof Date?Me.date:Me.object;default:return Me.unknown}}});var Qe,ls,Nv=N(()=>{m();OE();Qe=Xt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ls=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,A=0;for(;A<s.path.length;){let c=s.path[A];A===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],A++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ls.create=t=>new ls(t)});var iZe,Dl,uO=N(()=>{m();Nv();OE();iZe=(t,e)=>{let r;switch(t.code){case Qe.invalid_type:t.received===Me.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Qe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Xt.jsonStringifyReplacer)}`;break;case Qe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Xt.joinValues(t.keys,", ")}`;break;case Qe.invalid_union:r="Invalid input";break;case Qe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Xt.joinValues(t.options)}`;break;case Qe.invalid_enum_value:r=`Invalid enum value. Expected ${Xt.joinValues(t.options)}, received '${t.received}'`;break;case Qe.invalid_arguments:r="Invalid function arguments";break;case Qe.invalid_return_type:r="Invalid function return type";break;case Qe.invalid_date:r="Invalid date";break;case Qe.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Xt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Qe.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Qe.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Qe.custom:r="Invalid input";break;case Qe.invalid_intersection_types:r="Intersection results could not be merged";break;case Qe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Qe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Xt.assertNever(t)}return{message:r}},Dl=iZe});function GE(){return oZe}var oZe,Tv=N(()=>{m();uO();oZe=Dl});function Ne(t,e){let r=GE(),n=Mv({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Dl?void 0:Dl].filter(i=>!!i)});t.common.issues.push(n)}var Mv,Wi,ut,ym,po,lO,gO,bp,KE,pO=N(()=>{m();Tv();uO();Mv=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",A=n.filter(c=>!!c).slice().reverse();for(let c of A)a=c(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};Wi=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return ut;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ut;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},ut=Object.freeze({status:"aborted"}),ym=t=>({status:"dirty",value:t}),po=t=>({status:"valid",value:t}),lO=t=>t.status==="aborted",gO=t=>t.status==="dirty",bp=t=>t.status==="valid",KE=t=>typeof Promise<"u"&&t instanceof Promise});var Yge=N(()=>{m()});var Je,qge=N(()=>{m();(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Je||(Je={}))});function wt(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:A}=t;return s.code==="invalid_enum_value"?{message:A??a.defaultError}:typeof a.data>"u"?{message:A??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:A??r??a.defaultError}},description:i}}function Wge(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function yZe(t){return new RegExp(`^${Wge(t)}$`)}function QZe(t){let e=`${zge}T${Wge(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function DZe(t,e){return!!((e==="v4"||!e)&&fZe.test(t)||(e==="v6"||!e)&&hZe.test(t))}function wZe(t,e){if(!lZe.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function bZe(t,e){return!!((e==="v4"||!e)&&mZe.test(t)||(e==="v6"||!e)&&CZe.test(t))}function vZe(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function Qm(t){if(t instanceof gs){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ka.create(Qm(n))}return new gs({...t._def,shape:()=>e})}else return t instanceof bl?new bl({...t._def,type:Qm(t.element)}):t instanceof Ka?Ka.create(Qm(t.unwrap())):t instanceof eu?eu.create(Qm(t.unwrap())):t instanceof Xc?Xc.create(t.items.map(e=>Qm(e))):t}function mO(t,e){let r=Wc(t),n=Wc(e);if(t===e)return{valid:!0,data:t};if(r===Me.object&&n===Me.object){let i=Xt.objectKeys(e),o=Xt.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let A=mO(t[a],e[a]);if(!A.valid)return{valid:!1};s[a]=A.data}return{valid:!0,data:s}}else if(r===Me.array&&n===Me.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],A=mO(s,a);if(!A.valid)return{valid:!1};i.push(A.data)}return{valid:!0,data:i}}else return r===Me.date&&n===Me.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function Zge(t,e){return new km({values:t,typeName:it.ZodEnum,...wt(e)})}var Js,Vge,Lt,sZe,aZe,AZe,cZe,uZe,lZe,gZe,pZe,dZe,dO,fZe,mZe,hZe,CZe,IZe,EZe,zge,BZe,Dm,HE,$E,JE,jE,YE,wm,bm,qE,wl,VA,VE,bl,gs,vm,Zc,fO,Sm,Xc,hO,zE,WE,CO,xm,Fm,km,Rm,vp,Ha,Ka,eu,Nm,Tm,ZE,Pv,_v,Mm,szt,it,azt,Azt,czt,uzt,lzt,gzt,pzt,dzt,fzt,mzt,hzt,Czt,Izt,Ezt,SZe,Bzt,yzt,Qzt,Dzt,wzt,bzt,vzt,Szt,xzt,Fzt,kzt,Rzt,Nzt,Tzt,Mzt,Pzt,_zt,Lzt,Uzt,Xge=N(()=>{m();Nv();Tv();qge();pO();OE();Js=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Vge=(t,e)=>{if(bp(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ls(t.common.issues);return this._error=r,this._error}}};Lt=class{get description(){return this._def.description}_getType(e){return Wc(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Wc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Wi,ctx:{common:e.parent.common,data:e.data,parsedType:Wc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(KE(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wc(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Vge(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wc(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return bp(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>bp(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wc(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(KE(i)?i:Promise.resolve(i));return Vge(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:Qe.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(A=>A?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Ha({schema:this,typeName:it.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ka.create(this,this._def)}nullable(){return eu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bl.create(this)}promise(){return vp.create(this,this._def)}or(e){return vm.create([this,e],this._def)}and(e){return Sm.create(this,e,this._def)}transform(e){return new Ha({...wt(this._def),schema:this,typeName:it.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Nm({...wt(this._def),innerType:this,defaultValue:r,typeName:it.ZodDefault})}brand(){return new Pv({typeName:it.ZodBranded,type:this,...wt(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Tm({...wt(this._def),innerType:this,catchValue:r,typeName:it.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return _v.create(this,e)}readonly(){return Mm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sZe=/^c[^\s-]{8,}$/i,aZe=/^[0-9a-z]+$/,AZe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cZe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,uZe=/^[a-z0-9_-]{21}$/i,lZe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gZe=/^[-+]?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)?)??$/,pZe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dZe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",fZe=/^(?:(?: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])$/,mZe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,hZe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,CZe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,IZe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,EZe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zge="((\\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])))",BZe=new RegExp(`^${zge}$`);Dm=class t extends Lt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Me.string){let o=this._getOrReturnCtx(e);return Ne(o,{code:Qe.invalid_type,expected:Me.string,received:o.parsedType}),ut}let n=new Wi,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?Ne(i,{code:Qe.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Ne(i,{code:Qe.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")pZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"email",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")dO||(dO=new RegExp(dZe,"u")),dO.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"emoji",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")cZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"uuid",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")uZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"nanoid",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")sZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"cuid",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")aZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"cuid2",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")AZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"ulid",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ne(i,{validation:"url",code:Qe.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"regex",code:Qe.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?QZe(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?BZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?yZe(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?gZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"duration",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?DZe(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"ip",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?wZe(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"jwt",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?bZe(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"cidr",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?IZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"base64",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?EZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"base64url",code:Qe.invalid_string,message:o.message}),n.dirty()):Xt.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:Qe.invalid_string,...Je.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Je.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Je.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Je.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Je.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Je.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Je.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Je.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Je.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Je.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Je.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Je.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Je.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Je.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Je.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Je.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Je.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Je.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Je.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Je.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Je.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Je.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Je.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Je.errToObj(r)})}nonempty(e){return this.min(1,Je.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Dm.create=t=>new Dm({checks:[],typeName:it.ZodString,coerce:t?.coerce??!1,...wt(t)});HE=class t extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Me.number){let o=this._getOrReturnCtx(e);return Ne(o,{code:Qe.invalid_type,expected:Me.number,received:o.parsedType}),ut}let n,i=new Wi;for(let o of this._def.checks)o.kind==="int"?Xt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?vZe(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.not_finite,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Je.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Je.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Je.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Je.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Je.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Je.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Je.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Je.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Je.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Je.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Xt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};HE.create=t=>new HE({checks:[],typeName:it.ZodNumber,coerce:t?.coerce||!1,...wt(t)});$E=class t extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Me.bigint)return this._getInvalidInput(e);let n,i=new Wi;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Ne(r,{code:Qe.invalid_type,expected:Me.bigint,received:r.parsedType}),ut}gte(e,r){return this.setLimit("min",e,!0,Je.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Je.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Je.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Je.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Je.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};$E.create=t=>new $E({checks:[],typeName:it.ZodBigInt,coerce:t?.coerce??!1,...wt(t)});JE=class extends Lt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Me.boolean){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.boolean,received:n.parsedType}),ut}return po(e.data)}};JE.create=t=>new JE({typeName:it.ZodBoolean,coerce:t?.coerce||!1,...wt(t)});jE=class t extends Lt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Me.date){let o=this._getOrReturnCtx(e);return Ne(o,{code:Qe.invalid_type,expected:Me.date,received:o.parsedType}),ut}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Ne(o,{code:Qe.invalid_date}),ut}let n=new Wi,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Xt.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Je.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Je.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};jE.create=t=>new jE({checks:[],coerce:t?.coerce||!1,typeName:it.ZodDate,...wt(t)});YE=class extends Lt{_parse(e){if(this._getType(e)!==Me.symbol){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.symbol,received:n.parsedType}),ut}return po(e.data)}};YE.create=t=>new YE({typeName:it.ZodSymbol,...wt(t)});wm=class extends Lt{_parse(e){if(this._getType(e)!==Me.undefined){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.undefined,received:n.parsedType}),ut}return po(e.data)}};wm.create=t=>new wm({typeName:it.ZodUndefined,...wt(t)});bm=class extends Lt{_parse(e){if(this._getType(e)!==Me.null){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.null,received:n.parsedType}),ut}return po(e.data)}};bm.create=t=>new bm({typeName:it.ZodNull,...wt(t)});qE=class extends Lt{constructor(){super(...arguments),this._any=!0}_parse(e){return po(e.data)}};qE.create=t=>new qE({typeName:it.ZodAny,...wt(t)});wl=class extends Lt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return po(e.data)}};wl.create=t=>new wl({typeName:it.ZodUnknown,...wt(t)});VA=class extends Lt{_parse(e){let r=this._getOrReturnCtx(e);return Ne(r,{code:Qe.invalid_type,expected:Me.never,received:r.parsedType}),ut}};VA.create=t=>new VA({typeName:it.ZodNever,...wt(t)});VE=class extends Lt{_parse(e){if(this._getType(e)!==Me.undefined){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.void,received:n.parsedType}),ut}return po(e.data)}};VE.create=t=>new VE({typeName:it.ZodVoid,...wt(t)});bl=class t extends Lt{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Me.array)return Ne(r,{code:Qe.invalid_type,expected:Me.array,received:r.parsedType}),ut;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Ne(r,{code:s?Qe.too_big:Qe.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Ne(r,{code:Qe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Ne(r,{code:Qe.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Js(r,s,r.path,a)))).then(s=>Wi.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Js(r,s,r.path,a)));return Wi.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Je.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Je.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Je.toString(r)}})}nonempty(e){return this.min(1,e)}};bl.create=(t,e)=>new bl({type:t,minLength:null,maxLength:null,exactLength:null,typeName:it.ZodArray,...wt(e)});gs=class t extends Lt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Xt.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Me.object){let c=this._getOrReturnCtx(e);return Ne(c,{code:Qe.invalid_type,expected:Me.object,received:c.parsedType}),ut}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof VA&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let A=[];for(let c of s){let u=o[c],l=i.data[c];A.push({key:{status:"valid",value:c},value:u._parse(new Js(i,l,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof VA){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)A.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(Ne(i,{code:Qe.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let l=i.data[u];A.push({key:{status:"valid",value:u},value:c._parse(new Js(i,l,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of A){let l=await u.key,p=await u.value;c.push({key:l,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>Wi.mergeObjectSync(n,c)):Wi.mergeObjectSync(n,A)}get shape(){return this._def.shape()}strict(e){return Je.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Je.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:it.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Xt.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Xt.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Qm(this)}partial(e){let r={};for(let n of Xt.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Xt.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Ka;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return Zge(Xt.objectKeys(this.shape))}};gs.create=(t,e)=>new gs({shape:()=>t,unknownKeys:"strip",catchall:VA.create(),typeName:it.ZodObject,...wt(e)});gs.strictCreate=(t,e)=>new gs({shape:()=>t,unknownKeys:"strict",catchall:VA.create(),typeName:it.ZodObject,...wt(e)});gs.lazycreate=(t,e)=>new gs({shape:t,unknownKeys:"strip",catchall:VA.create(),typeName:it.ZodObject,...wt(e)});vm=class extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new ls(a.ctx.common.issues));return Ne(r,{code:Qe.invalid_union,unionErrors:s}),ut}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let A of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=A._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(A=>new ls(A));return Ne(r,{code:Qe.invalid_union,unionErrors:a}),ut}}get options(){return this._def.options}};vm.create=(t,e)=>new vm({options:t,typeName:it.ZodUnion,...wt(e)});Zc=t=>t instanceof xm?Zc(t.schema):t instanceof Ha?Zc(t.innerType()):t instanceof Fm?[t.value]:t instanceof km?t.options:t instanceof Rm?Xt.objectValues(t.enum):t instanceof Nm?Zc(t._def.innerType):t instanceof wm?[void 0]:t instanceof bm?[null]:t instanceof Ka?[void 0,...Zc(t.unwrap())]:t instanceof eu?[null,...Zc(t.unwrap())]:t instanceof Pv||t instanceof Mm?Zc(t.unwrap()):t instanceof Tm?Zc(t._def.innerType):[],fO=class t extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Me.object)return Ne(r,{code:Qe.invalid_type,expected:Me.object,received:r.parsedType}),ut;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Ne(r,{code:Qe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ut)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=Zc(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:it.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...wt(n)})}};Sm=class extends Lt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(lO(o)||lO(s))return ut;let a=mO(o.value,s.value);return a.valid?((gO(o)||gO(s))&&r.dirty(),{status:r.value,value:a.data}):(Ne(n,{code:Qe.invalid_intersection_types}),ut)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Sm.create=(t,e,r)=>new Sm({left:t,right:e,typeName:it.ZodIntersection,...wt(r)});Xc=class t extends Lt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.array)return Ne(n,{code:Qe.invalid_type,expected:Me.array,received:n.parsedType}),ut;if(n.data.length<this._def.items.length)return Ne(n,{code:Qe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ut;!this._def.rest&&n.data.length>this._def.items.length&&(Ne(n,{code:Qe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let A=this._def.items[a]||this._def.rest;return A?A._parse(new Js(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Wi.mergeArray(r,s)):Wi.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Xc.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xc({items:t,typeName:it.ZodTuple,rest:null,...wt(e)})};hO=class t extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.object)return Ne(n,{code:Qe.invalid_type,expected:Me.object,received:n.parsedType}),ut;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Js(n,a,n.path,a)),value:s._parse(new Js(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Wi.mergeObjectAsync(r,i):Wi.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Lt?new t({keyType:e,valueType:r,typeName:it.ZodRecord,...wt(n)}):new t({keyType:Dm.create(),valueType:e,typeName:it.ZodRecord,...wt(r)})}},zE=class extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.map)return Ne(n,{code:Qe.invalid_type,expected:Me.map,received:n.parsedType}),ut;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,A],c)=>({key:i._parse(new Js(n,a,n.path,[c,"key"])),value:o._parse(new Js(n,A,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let A of s){let c=await A.key,u=await A.value;if(c.status==="aborted"||u.status==="aborted")return ut;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let A of s){let c=A.key,u=A.value;if(c.status==="aborted"||u.status==="aborted")return ut;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}}}};zE.create=(t,e,r)=>new zE({valueType:e,keyType:t,typeName:it.ZodMap,...wt(r)});WE=class t extends Lt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.set)return Ne(n,{code:Qe.invalid_type,expected:Me.set,received:n.parsedType}),ut;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Ne(n,{code:Qe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Ne(n,{code:Qe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(A){let c=new Set;for(let u of A){if(u.status==="aborted")return ut;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((A,c)=>o._parse(new Js(n,A,n.path,c)));return n.common.async?Promise.all(a).then(A=>s(A)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:Je.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Je.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};WE.create=(t,e)=>new WE({valueType:t,minSize:null,maxSize:null,typeName:it.ZodSet,...wt(e)});CO=class t extends Lt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Me.function)return Ne(r,{code:Qe.invalid_type,expected:Me.function,received:r.parsedType}),ut;function n(a,A){return Mv({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,GE(),Dl].filter(c=>!!c),issueData:{code:Qe.invalid_arguments,argumentsError:A}})}function i(a,A){return Mv({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,GE(),Dl].filter(c=>!!c),issueData:{code:Qe.invalid_return_type,returnTypeError:A}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof vp){let a=this;return po(async function(...A){let c=new ls([]),u=await a._def.args.parseAsync(A,o).catch(g=>{throw c.addIssue(n(A,g)),c}),l=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(l,o).catch(g=>{throw c.addIssue(i(l,g)),c})})}else{let a=this;return po(function(...A){let c=a._def.args.safeParse(A,o);if(!c.success)throw new ls([n(A,c.error)]);let u=Reflect.apply(s,this,c.data),l=a._def.returns.safeParse(u,o);if(!l.success)throw new ls([i(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Xc.create(e).rest(wl.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Xc.create([]).rest(wl.create()),returns:r||wl.create(),typeName:it.ZodFunction,...wt(n)})}},xm=class extends Lt{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};xm.create=(t,e)=>new xm({getter:t,typeName:it.ZodLazy,...wt(e)});Fm=class extends Lt{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Ne(r,{received:r.data,code:Qe.invalid_literal,expected:this._def.value}),ut}return{status:"valid",value:e.data}}get value(){return this._def.value}};Fm.create=(t,e)=>new Fm({value:t,typeName:it.ZodLiteral,...wt(e)});km=class t extends Lt{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Ne(r,{expected:Xt.joinValues(n),received:r.parsedType,code:Qe.invalid_type}),ut}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return Ne(r,{received:r.data,code:Qe.invalid_enum_value,options:n}),ut}return po(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};km.create=Zge;Rm=class extends Lt{_parse(e){let r=Xt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Me.string&&n.parsedType!==Me.number){let i=Xt.objectValues(r);return Ne(n,{expected:Xt.joinValues(i),received:n.parsedType,code:Qe.invalid_type}),ut}if(this._cache||(this._cache=new Set(Xt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Xt.objectValues(r);return Ne(n,{received:n.data,code:Qe.invalid_enum_value,options:i}),ut}return po(e.data)}get enum(){return this._def.values}};Rm.create=(t,e)=>new Rm({values:t,typeName:it.ZodNativeEnum,...wt(e)});vp=class extends Lt{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Me.promise&&r.common.async===!1)return Ne(r,{code:Qe.invalid_type,expected:Me.promise,received:r.parsedType}),ut;let n=r.parsedType===Me.promise?r.data:Promise.resolve(r.data);return po(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};vp.create=(t,e)=>new vp({type:t,typeName:it.ZodPromise,...wt(e)});Ha=class extends Lt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===it.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{Ne(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ut;let A=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return A.status==="aborted"?ut:A.status==="dirty"?ym(A.value):r.value==="dirty"?ym(A.value):A});{if(r.value==="aborted")return ut;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ut:a.status==="dirty"?ym(a.value):r.value==="dirty"?ym(a.value):a}}if(i.type==="refinement"){let s=a=>{let A=i.refinement(a,o);if(n.common.async)return Promise.resolve(A);if(A instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ut:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ut:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!bp(s))return ut;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>bp(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ut);Xt.assertNever(i)}};Ha.create=(t,e,r)=>new Ha({schema:t,typeName:it.ZodEffects,effect:e,...wt(r)});Ha.createWithPreprocess=(t,e,r)=>new Ha({schema:e,effect:{type:"preprocess",transform:t},typeName:it.ZodEffects,...wt(r)});Ka=class extends Lt{_parse(e){return this._getType(e)===Me.undefined?po(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ka.create=(t,e)=>new Ka({innerType:t,typeName:it.ZodOptional,...wt(e)});eu=class extends Lt{_parse(e){return this._getType(e)===Me.null?po(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};eu.create=(t,e)=>new eu({innerType:t,typeName:it.ZodNullable,...wt(e)});Nm=class extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Me.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Nm.create=(t,e)=>new Nm({innerType:t,typeName:it.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...wt(e)});Tm=class extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return KE(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ls(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ls(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Tm.create=(t,e)=>new Tm({innerType:t,typeName:it.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...wt(e)});ZE=class extends Lt{_parse(e){if(this._getType(e)!==Me.nan){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.nan,received:n.parsedType}),ut}return{status:"valid",value:e.data}}};ZE.create=t=>new ZE({typeName:it.ZodNaN,...wt(t)});Pv=class extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},_v=class t extends Lt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ut:o.status==="dirty"?(r.dirty(),ym(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ut:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:it.ZodPipeline})}},Mm=class extends Lt{_parse(e){let r=this._def.innerType._parse(e),n=i=>(bp(i)&&(i.value=Object.freeze(i.value)),i);return KE(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Mm.create=(t,e)=>new Mm({innerType:t,typeName:it.ZodReadonly,...wt(e)});szt={object:gs.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(it||(it={}));azt=Dm.create,Azt=HE.create,czt=ZE.create,uzt=$E.create,lzt=JE.create,gzt=jE.create,pzt=YE.create,dzt=wm.create,fzt=bm.create,mzt=qE.create,hzt=wl.create,Czt=VA.create,Izt=VE.create,Ezt=bl.create,SZe=gs.create,Bzt=gs.strictCreate,yzt=vm.create,Qzt=fO.create,Dzt=Sm.create,wzt=Xc.create,bzt=hO.create,vzt=zE.create,Szt=WE.create,xzt=CO.create,Fzt=xm.create,kzt=Fm.create,Rzt=km.create,Nzt=Rm.create,Tzt=vp.create,Mzt=Ha.create,Pzt=Ka.create,_zt=eu.create,Lzt=Ha.createWithPreprocess,Uzt=_v.create});var IO=N(()=>{m();Tv();pO();Yge();OE();Xge();Nv()});var XE=N(()=>{m();IO();IO()});function te(t,e,r){function n(a,A){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:A,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,A);let c=s.prototype,u=Object.keys(c);for(let l=0;l<u.length;l++){let p=u[l];p in a||(a[p]=c[p].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:t});function s(a){var A;let c=r?.Parent?new o:this;n(c,a),(A=c._zod).deferred??(A.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}function zn(t){return t&&Object.assign(Lv,t),Lv}var Uv,zA,Sp,Lv,Pm=N(()=>{m();Uv=Object.freeze({status:"aborted"});zA=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Sp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Lv={}});var De={};lA(De,{BIGINT_FORMAT_RANGES:()=>xO,Class:()=>BO,NUMBER_FORMAT_RANGES:()=>SO,aborted:()=>Fl,allowsEval:()=>DO,assert:()=>MZe,assertEqual:()=>kZe,assertIs:()=>NZe,assertNever:()=>TZe,assertNotEqual:()=>RZe,assignProp:()=>Sl,base64ToUint8Array:()=>ape,base64urlToUint8Array:()=>jZe,cached:()=>Lm,captureStackTrace:()=>Gv,cleanEnum:()=>JZe,cleanRegex:()=>rB,clone:()=>fo,cloneDef:()=>_Ze,createTransparentProxy:()=>HZe,defineLazy:()=>St,esc:()=>Ov,escapeRegex:()=>js,extend:()=>npe,finalizeIssue:()=>Ko,floatSafeRemainder:()=>yO,getElementAtPath:()=>LZe,getEnumValues:()=>tB,getLengthableOrigin:()=>oB,getParsedType:()=>KZe,getSizableOrigin:()=>iB,hexToUint8Array:()=>qZe,isObject:()=>xp,isPlainObject:()=>xl,issue:()=>Um,joinValues:()=>st,jsonStringifyReplacer:()=>_m,merge:()=>$Ze,mergeDefs:()=>tu,normalizeParams:()=>Fe,nullish:()=>vl,numKeys:()=>GZe,objectClone:()=>PZe,omit:()=>rpe,optionalKeys:()=>vO,parsedType:()=>lt,partial:()=>ope,pick:()=>tpe,prefixIssues:()=>ps,primitiveTypes:()=>bO,promiseAllObject:()=>UZe,propertyKeyTypes:()=>nB,randomString:()=>OZe,required:()=>spe,safeExtend:()=>ipe,shallowClone:()=>wO,slugify:()=>QO,stringifyPrimitive:()=>at,uint8ArrayToBase64:()=>Ape,uint8ArrayToBase64url:()=>YZe,uint8ArrayToHex:()=>VZe,unwrapMessage:()=>eB});function kZe(t){return t}function RZe(t){return t}function NZe(t){}function TZe(t){throw new Error("Unexpected value in exhaustive check")}function MZe(t){}function tB(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function st(t,e="|"){return t.map(r=>at(r)).join(e)}function _m(t,e){return typeof e=="bigint"?e.toString():e}function Lm(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function vl(t){return t==null}function rB(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function yO(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let A=n.match(/\d?e-(\d?)/);A?.[1]&&(i=Number.parseInt(A[1]))}let o=r>i?r:i,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function St(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==epe)return n===void 0&&(n=epe,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function PZe(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Sl(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tu(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function _Ze(t){return tu(t._zod.def)}function LZe(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function UZe(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<e.length;o++)i[e[o]]=n[o];return i})}function OZe(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Ov(t){return JSON.stringify(t)}function QO(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function xp(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function xl(t){if(xp(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(xp(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function wO(t){return xl(t)?{...t}:Array.isArray(t)?[...t]:t}function GZe(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function js(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fo(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Fe(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function HZe(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,o){return e??(e=t()),Reflect.set(e,n,i,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function at(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function vO(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function tpe(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=tu(t._zod.def,{get shape(){let s={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=r.shape[a])}return Sl(this,"shape",s),s},checks:[]});return fo(t,o)}function rpe(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=tu(t._zod.def,{get shape(){let s={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete s[a]}return Sl(this,"shape",s),s},checks:[]});return fo(t,o)}function npe(t,e){if(!xl(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let o=t._zod.def.shape;for(let s in e)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=tu(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return Sl(this,"shape",o),o}});return fo(t,i)}function ipe(t,e){if(!xl(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=tu(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return Sl(this,"shape",n),n}});return fo(t,r)}function $Ze(t,e){let r=tu(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Sl(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return fo(t,r)}function ope(t,e,r){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=tu(e._zod.def,{get shape(){let a=e._zod.def.shape,A={...a};if(r)for(let c in r){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);r[c]&&(A[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(let c in a)A[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return Sl(this,"shape",A),A},checks:[]});return fo(e,s)}function spe(t,e,r){let n=tu(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return Sl(this,"shape",o),o}});return fo(e,n)}function Fl(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function ps(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function eB(t){return typeof t=="string"?t:t?.message}function Ko(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=eB(t.inst?._zod.def?.error?.(t))??eB(e?.error?.(t))??eB(r.customError?.(t))??eB(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function iB(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function oB(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function lt(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Um(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function JZe(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function ape(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function Ape(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function jZe(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return ape(e+r)}function YZe(t){return Ape(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function qZe(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function VZe(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var epe,Gv,DO,KZe,nB,bO,SO,xO,BO,qe=N(()=>{m();epe=Symbol("evaluating");Gv="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};DO=Lm(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});KZe=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},nB=new Set(["string","number","symbol"]),bO=new Set(["string","number","bigint","boolean","symbol","undefined"]);SO={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},xO={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};BO=class{constructor(...e){}}});function Hv(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function $v(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(e(o));else{let s=r,a=0;for(;a<o.path.length;){let A=o.path[a];a===o.path.length-1?(s[A]=s[A]||{_errors:[]},s[A]._errors.push(e(o))):s[A]=s[A]||{_errors:[]},s=s[A],a++}}};return n(t),r}var cpe,Kv,sB,FO=N(()=>{m();Pm();qe();cpe=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,_m,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Kv=te("$ZodError",cpe),sB=te("$ZodError",cpe,{Parent:Error})});var aB,AB,cB,uB,lB,Om,gB,pB,upe,lpe,gpe,ppe,dpe,fpe,mpe,hpe,kO=N(()=>{m();Pm();FO();qe();aB=t=>(e,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new zA;if(s.issues.length){let a=new(i?.Err??t)(s.issues.map(A=>Ko(A,o,zn())));throw Gv(a,i?.callee),a}return s.value},AB=aB(sB),cB=t=>async(e,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??t)(s.issues.map(A=>Ko(A,o,zn())));throw Gv(a,i?.callee),a}return s.value},uB=cB(sB),lB=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new zA;return o.issues.length?{success:!1,error:new(t??Kv)(o.issues.map(s=>Ko(s,i,zn())))}:{success:!0,data:o.value}},Om=lB(sB),gB=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>Ko(s,i,zn())))}:{success:!0,data:o.value}},pB=gB(sB),upe=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return aB(t)(e,r,i)},lpe=t=>(e,r,n)=>aB(t)(e,r,n),gpe=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return cB(t)(e,r,i)},ppe=t=>async(e,r,n)=>cB(t)(e,r,n),dpe=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return lB(t)(e,r,i)},fpe=t=>(e,r,n)=>lB(t)(e,r,n),mpe=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return gB(t)(e,r,i)},hpe=t=>async(e,r,n)=>gB(t)(e,r,n)});var Ys={};lA(Ys,{base64:()=>YO,base64url:()=>Jv,bigint:()=>XO,boolean:()=>tG,browserEmail:()=>iXe,cidrv4:()=>JO,cidrv6:()=>jO,cuid:()=>RO,cuid2:()=>NO,date:()=>VO,datetime:()=>WO,domain:()=>aXe,duration:()=>LO,e164:()=>qO,email:()=>OO,emoji:()=>GO,extendedDuration:()=>WZe,guid:()=>UO,hex:()=>AXe,hostname:()=>sXe,html5Email:()=>tXe,idnEmail:()=>nXe,integer:()=>eG,ipv4:()=>KO,ipv6:()=>HO,ksuid:()=>PO,lowercase:()=>iG,mac:()=>$O,md5_base64:()=>uXe,md5_base64url:()=>lXe,md5_hex:()=>cXe,nanoid:()=>_O,null:()=>rG,number:()=>jv,rfc5322Email:()=>rXe,sha1_base64:()=>pXe,sha1_base64url:()=>dXe,sha1_hex:()=>gXe,sha256_base64:()=>mXe,sha256_base64url:()=>hXe,sha256_hex:()=>fXe,sha384_base64:()=>IXe,sha384_base64url:()=>EXe,sha384_hex:()=>CXe,sha512_base64:()=>yXe,sha512_base64url:()=>QXe,sha512_hex:()=>BXe,string:()=>ZO,time:()=>zO,ulid:()=>TO,undefined:()=>nG,unicodeEmail:()=>Cpe,uppercase:()=>oG,uuid:()=>Fp,uuid4:()=>ZZe,uuid6:()=>XZe,uuid7:()=>eXe,xid:()=>MO});function GO(){return new RegExp(oXe,"u")}function Epe(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function zO(t){return new RegExp(`^${Epe(t)}$`)}function WO(t){let e=Epe({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Ipe}T(?:${n})$`)}function dB(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function fB(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var RO,NO,TO,MO,PO,_O,LO,WZe,UO,Fp,ZZe,XZe,eXe,OO,tXe,rXe,Cpe,nXe,iXe,oXe,KO,HO,$O,JO,jO,YO,Jv,sXe,aXe,qO,Ipe,VO,ZO,XO,eG,jv,tG,rG,nG,iG,oG,AXe,cXe,uXe,lXe,gXe,pXe,dXe,fXe,mXe,hXe,CXe,IXe,EXe,BXe,yXe,QXe,Yv=N(()=>{m();qe();RO=/^[cC][^\s-]{8,}$/,NO=/^[0-9a-z]+$/,TO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,MO=/^[0-9a-vA-V]{20}$/,PO=/^[A-Za-z0-9]{27}$/,_O=/^[a-zA-Z0-9_-]{21}$/,LO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,WZe=/^[-+]?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)?)??$/,UO=/^([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})$/,Fp=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/,ZZe=Fp(4),XZe=Fp(6),eXe=Fp(7),OO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tXe=/^[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])?)*$/,rXe=/^(([^<>()\[\]\\.,;:\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,}))$/,Cpe=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,nXe=Cpe,iXe=/^[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])?)*$/,oXe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";KO=/^(?:(?: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])$/,HO=/^(([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}|:))$/,$O=t=>{let e=js(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},JO=/^((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])$/,jO=/^(([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])$/,YO=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jv=/^[A-Za-z0-9_-]*$/,sXe=/^(?=.{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])?)*\.?$/,aXe=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,qO=/^\+[1-9]\d{6,14}$/,Ipe="(?:(?:\\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])))",VO=new RegExp(`^${Ipe}$`);ZO=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},XO=/^-?\d+n?$/,eG=/^-?\d+$/,jv=/^-?\d+(?:\.\d+)?$/,tG=/^(?:true|false)$/i,rG=/^null$/i,nG=/^undefined$/i,iG=/^[^A-Z]*$/,oG=/^[^a-z]*$/,AXe=/^[0-9a-fA-F]*$/;cXe=/^[0-9a-fA-F]{32}$/,uXe=dB(22,"=="),lXe=fB(22),gXe=/^[0-9a-fA-F]{40}$/,pXe=dB(27,"="),dXe=fB(27),fXe=/^[0-9a-fA-F]{64}$/,mXe=dB(43,"="),hXe=fB(43),CXe=/^[0-9a-fA-F]{96}$/,IXe=dB(64,""),EXe=fB(64),BXe=/^[0-9a-fA-F]{128}$/,yXe=dB(86,"=="),QXe=fB(86)});function Bpe(t,e,r){t.issues.length&&e.issues.push(...ps(r,t.issues))}var kr,ype,sG,aG,Qpe,Dpe,wpe,bpe,vpe,Spe,xpe,Fpe,kpe,mB,Rpe,Npe,Tpe,Mpe,Ppe,_pe,Lpe,Upe,Ope,qv=N(()=>{m();Pm();Yv();qe();kr=te("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),ype={number:"number",bigint:"bigint",object:"date"},sG=te("$ZodCheckLessThan",(t,e)=>{kr.init(t,e);let r=ype[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),aG=te("$ZodCheckGreaterThan",(t,e)=>{kr.init(t,e);let r=ype[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Qpe=te("$ZodCheckMultipleOf",(t,e)=>{kr.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):yO(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Dpe=te("$ZodCheckNumberFormat",(t,e)=>{kr.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,o]=SO[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=i,a.maximum=o,r&&(a.pattern=eG)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),wpe=te("$ZodCheckBigIntFormat",(t,e)=>{kr.init(t,e);let[r,n]=xO[e.format];t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,o.minimum=r,o.maximum=n}),t._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),bpe=te("$ZodCheckMaxSize",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;i.size<=e.maximum||n.issues.push({origin:iB(i),code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),vpe=te("$ZodCheckMinSize",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;i.size>=e.minimum||n.issues.push({origin:iB(i),code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Spe=te("$ZodCheckSizeEquals",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=n=>{let i=n.value,o=i.size;if(o===e.size)return;let s=o>e.size;n.issues.push({origin:iB(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),xpe=te("$ZodCheckMaxLength",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let s=oB(i);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Fpe=te("$ZodCheckMinLength",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let s=oB(i);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),kpe=te("$ZodCheckLengthEquals",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,o=i.length;if(o===e.length)return;let s=oB(i),a=o>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),mB=te("$ZodCheckStringFormat",(t,e)=>{var r,n;kr.init(t,e),t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Rpe=te("$ZodCheckRegex",(t,e)=>{mB.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Npe=te("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=iG),mB.init(t,e)}),Tpe=te("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=oG),mB.init(t,e)}),Mpe=te("$ZodCheckIncludes",(t,e)=>{kr.init(t,e);let r=js(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),Ppe=te("$ZodCheckStartsWith",(t,e)=>{kr.init(t,e);let r=new RegExp(`^${js(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),_pe=te("$ZodCheckEndsWith",(t,e)=>{kr.init(t,e);let r=new RegExp(`.*${js(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});Lpe=te("$ZodCheckProperty",(t,e)=>{kr.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>Bpe(i,r,e.property));Bpe(n,r,e.property)}}),Upe=te("$ZodCheckMimeType",(t,e)=>{kr.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),Ope=te("$ZodCheckOverwrite",(t,e)=>{kr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var Vv,AG=N(()=>{m();Vv=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
1772
|
+
`);for(let i of n){let o=i.trim();if(!o||o.startsWith("#"))continue;let s=o.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);if(s){let a=s[1],A=s[2].trim();(A.startsWith('"')&&A.endsWith('"')||A.startsWith("'")&&A.endsWith("'"))&&(A=A.slice(1,-1)),r.push({key:a,placeholderValue:A||void 0,source:e,type:"env"})}}return r}function W7e(t,e){let r=[],n=/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,i,o=new Set;for(;(i=n.exec(t))!==null;){let s=i[1];o.has(s)||(o.add(s),r.push({key:s,source:e,type:"npmrc"}))}return r}async function Z7e(t,e){try{let r=[],n=new Set,i=[".env.example",".env.template",".env.sample",".env.local.example",".env.development.example",".env.production.example",".env.test.example",".env.staging.example",".env",".env.local",".env.development",".env.production",".env.test",".env.staging"],o=[],s=new Set,a=[];for(let A of e){let c=A.replace(/\\/g,"/");(c===".npmrc"||c.endsWith("/.npmrc"))&&a.push(A)}for(let A of a){let c=(0,vn.join)(t,A),u=Hs(c);if(u){let l=W7e(u,A);for(let p of l)n.has(p.key)||(n.add(p.key),r.push(p))}}for(let A of i)for(let c of e){let u=c.replace(/\\/g,"/");(u===A||u.endsWith(`/${A}`))&&!s.has(c)&&(s.add(c),o.push(c))}for(let A of o){let c=(0,vn.join)(t,A),u=Hs(c);if(u){let l=z7e(u,A);for(let p of l)n.has(p.key)||(n.add(p.key),r.push(p))}}return r}catch{return[]}}async function X7e(t,e){try{let r=await bge(t,e);if(r)return r;let n=await Sge(t,e);if(n)return n;let i=await Fge(t,e);return i||null}catch{return null}}async function qA(t){try{let e=new Set,r=["__tests__","__test__","__examples__","__example__","__fixtures__","__mocks__","test","tests","testing","spec","specs","example","examples","sample","samples","demo","demos","fixture","fixtures","mock","mocks",".test",".spec"],n=["package.json","tsconfig.json","jsconfig.json","pyproject.toml","setup.py","setup.cfg","Pipfile","requirements.txt","poetry.lock","go.mod","Cargo.toml","Gemfile","Rakefile","pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","composer.json","mix.exs","Package.swift","pubspec.yaml","stack.yaml","cabal.project","build.sbt","project.clj","deps.edn","CMakeLists.txt","Makefile","Dockerfile",".storybook"],i=a=>a.split("/").some(c=>r.some(u=>c===u||c.startsWith(u+".")));for(let a of t){let A=a.replace(/\\/g,"/"),c=A.split("/").pop()||"";if(n.includes(c)){let u=A.substring(0,A.lastIndexOf("/"));if(u&&i(u))continue;u?e.add(u):e.add(".")}if(c.endsWith(".csproj")||c.endsWith(".fsproj")||c.endsWith(".vbproj")||c.endsWith(".sln")){let u=A.substring(0,A.lastIndexOf("/"));if(u&&i(u))continue;u?e.add(u):e.add(".")}}let o=Array.from(e).sort(),s=o.filter(a=>a!==".");return s.length>0?s:o}catch{return[]}}async function Rge(t,e){let r=[];try{let n=await Dp({sys:t,basePath:e,globPattern:"**/*",dot:!0}),i=$7e(n),o=await J7e(e,n),s=await j7e(e,n),a=await Y7e(e,n),A=await q7e(n),c=await V7e(n),u=await Z7e(e,n),l=await X7e(e,n),p={languages:[],isEmpty:i,isMonorepo:o.isMonorepo,monorepoType:o.type,frameworks:s,setupRequirements:a,packageManagers:A,buildTools:c,environmentVariables:u.length>0?u:void 0,possibleMonorepoRoots:o.possibleRoots,guessedSettings:l||void 0};return r.length>0&&(p.errors=r),p}catch(n){return{languages:[],isEmpty:!1,isMonorepo:!1,frameworks:[],setupRequirements:[],packageManagers:[],buildTools:[],errors:[`Fatal error: ${n instanceof Error?n.message:String(n)}`]}}}var on,vn,Nge=N(()=>{"use strict";m();wp();LE();vge();xge();kge();on=require("node:fs"),vn=require("node:path")});var Mge,$s,xv,Tge,Fv,Pge=N(()=>{"use strict";m();Mge=require("node:child_process"),$s=z(require("node:path"),1),xv=z(require("node:fs"),1);La();Pt();Tge=ke("TsServer"),Fv=class t{#n=null;#c=0;#o=new Map;#t="";#A;#i=!1;#e=null;#s=new Set;#B=!1;#C=null;static REQUEST_TIMEOUT=3e4;constructor(e){this.#A=e}async start(){return this.#C?this.#C:(this.#C=this.#T(),this.#C)}async#T(){if(this.#n||this.#i)return;let e=this.#x();if(!e)throw new Error("Could not find tsserver. Ensure TypeScript is installed in the project.");this.#n=(0,Mge.spawn)("node",[e,"--useInferredProjectConfig"],{cwd:this.#A,stdio:["pipe","pipe","pipe"],env:{...process.env,TSS_LOG:void 0}}),Yb.track(this.#n),this.#n.stdout.on("data",r=>{this.#b(r.toString("utf-8"))}),this.#n.stderr.on("data",r=>{Tge.debug("stderr",r.toString("utf-8"),{loggerOptions:{stderr:!0}})}),this.#n.on("exit",r=>{this.#n=null,this.#B=!1;for(let[,n]of this.#o)clearTimeout(n.timer),n.reject(new Error(`tsserver exited with code ${r}`));this.#o.clear()}),this.#n.on("error",r=>{Tge.error("Process error:",r.message)}),this.#B=!0,await this.#a("configure",{hostInfo:"fusion-editor",preferences:{providePrefixAndSuffixTextForRename:!0,allowRenameOfImportPath:!0,includeCompletionsForModuleExports:!0,includeCompletionsWithSnippetText:!0,includeAutomaticOptionalChainCompletions:!0,includeCompletionsWithInsertText:!0,includeCompletionsWithClassMemberSnippets:!0,includeCompletionsWithObjectLiteralMethodSnippets:!0,importModuleSpecifierPreference:"shortest",importModuleSpecifierEnding:"minimal",includeInlayParameterNameHints:"all",includeInlayParameterNameHintsWhenArgumentMatchesName:!1,includeInlayFunctionParameterTypeHints:!0,includeInlayVariableTypeHints:!0,includeInlayVariableTypeHintsWhenTypeMatchesName:!1,includeInlayPropertyDeclarationTypeHints:!0,includeInlayFunctionLikeReturnTypeHints:!0,includeInlayEnumMemberValueHints:!0}})}#x(){let e=$s.default.join(this.#A,"node_modules","typescript","lib","tsserver.js");if(xv.default.existsSync(e))return e;let r=$s.default.join(this.#A,"..","node_modules","typescript","lib","tsserver.js");if(xv.default.existsSync(r))return r;try{let n=require.resolve("typescript/lib/tsserver.js",{paths:[this.#A]});if(xv.default.existsSync(n))return n}catch{}return null}#b(e){for(this.#t+=e;;){let r=this.#t.match(/^Content-Length:\s*(\d+)\r?\n\r?\n/);if(r){let o=parseInt(r[1],10),s=r[0].length,a=s+o;if(this.#t.length>=a){let A=this.#t.substring(s,a);this.#t=this.#t.substring(a),this.#F(A);continue}break}let n=this.#t.indexOf(`
|
|
1773
|
+
`);if(n===-1)break;let i=this.#t.substring(0,n).trim();this.#t=this.#t.substring(n+1),i.startsWith("{")&&this.#F(i)}}#F(e){let r;try{r=JSON.parse(e)}catch{return}if(r.type==="response"){let n=r,i=this.#o.get(n.request_seq);i&&(clearTimeout(i.timer),this.#o.delete(n.request_seq),i.resolve({success:n.success,body:n.body,message:n.message}))}else if(r.type==="event"){let n=r;this.#e?.(n)}}async#a(e,r){if(!this.#n||!this.#B)throw new Error("tsserver is not running");let n=++this.#c,i={seq:n,type:"request",command:e,arguments:r};return new Promise((o,s)=>{let a=setTimeout(()=>{this.#o.delete(n),s(new Error(`tsserver request "${e}" timed out`))},t.REQUEST_TIMEOUT);this.#o.set(n,{resolve:o,reject:s,timer:a});let A=JSON.stringify(i)+`
|
|
1774
|
+
`;this.#n.stdin.write(A)})}setEventHandler(e){this.#e=e}async openFile(e,r,n){await this.start();let i=$s.default.isAbsolute(e)?e:$s.default.resolve(this.#A,e);if(this.#s.has(i)){await this.changeFile(e,r);return}await this.#a("open",{file:i,fileContent:r,scriptKindName:this.#r(i),projectRootPath:n||this.#A}),this.#s.add(i)}async changeFile(e,r){if(!this.#B)return;let n=$s.default.isAbsolute(e)?e:$s.default.resolve(this.#A,e);if(!this.#s.has(n)){await this.openFile(e,r);return}await this.#a("open",{file:n,fileContent:r,scriptKindName:this.#r(n),projectRootPath:this.#A})}async closeFile(e){if(!this.#B)return;let r=$s.default.isAbsolute(e)?e:$s.default.resolve(this.#A,e);this.#s.has(r)&&(await this.#a("close",{file:r}),this.#s.delete(r))}async getCompletions(e,r,n,i){let o=this.#f(e);return this.#a("completionInfo",{file:o,line:r,offset:n,includeExternalModuleExports:i?.includeExternalModuleExports??!0,includeInsertTextCompletions:!0,triggerCharacter:i?.triggerCharacter,triggerKind:i?.triggerCharacter?2:1})}async getCompletionDetails(e,r,n,i){let o=this.#f(e);return this.#a("completionEntryDetails",{file:o,line:r,offset:n,entryNames:i})}async getDefinition(e,r,n){let i=this.#f(e);return this.#a("definition",{file:i,line:r,offset:n})}async getTypeDefinition(e,r,n){let i=this.#f(e);return this.#a("typeDefinition",{file:i,line:r,offset:n})}async getQuickInfo(e,r,n){let i=this.#f(e);return this.#a("quickinfo",{file:i,line:r,offset:n})}async getReferences(e,r,n){let i=this.#f(e);return this.#a("references",{file:i,line:r,offset:n})}async getSignatureHelp(e,r,n){let i=this.#f(e);return this.#a("signatureHelp",{file:i,line:r,offset:n})}async requestDiagnostics(e){let r=e.map(n=>this.#f(n));await this.#a("geterr",{files:r,delay:0}).catch(()=>{})}async getRenameLocations(e,r,n){let i=this.#f(e);return this.#a("rename",{file:i,line:r,offset:n,findInComments:!1,findInStrings:!1})}async getNavTree(e){let r=this.#f(e);return this.#a("navtree",{file:r})}async organizeImports(e){let r=this.#f(e);return this.#a("organizeImports",{scope:{type:"file",args:{file:r}}})}async getInlayHints(e){let r=this.#f(e);return this.#a("provideInlayHints",{file:r,start:0,length:2147483647})}async getCodeFixes(e,r,n,i,o,s){let a=this.#f(e);return this.#a("getCodeFixes",{file:a,startLine:r,startOffset:n,endLine:i,endOffset:o,errorCodes:s})}async getApplicableRefactors(e,r,n,i,o){let s=this.#f(e);return this.#a("getApplicableRefactors",{file:s,startLine:r,startOffset:n,endLine:i,endOffset:o})}async getEditsForRefactor(e,r,n,i,o,s,a){let A=this.#f(e);return this.#a("getEditsForRefactor",{file:A,startLine:r,startOffset:n,endLine:i,endOffset:o,refactor:s,action:a})}async getImplementation(e,r,n){let i=this.#f(e);return this.#a("implementation",{file:i,line:r,offset:n})}async getSelectionRange(e,r){let n=this.#f(e);return this.#a("selectionRange",{file:n,locations:r})}async getLinkedEditingRange(e,r,n){let i=this.#f(e);return this.#a("linkedEditingRange",{file:i,line:r,offset:n})}async getFormatRange(e,r,n,i,o){let s=this.#f(e);return this.#a("format",{file:s,line:r,offset:n,endLine:i,endOffset:o})}getCwd(){return this.#A}isRunning(){return this.#B&&this.#n!==null}dispose(){if(this.#i=!0,this.#B=!1,this.#n){try{this.#n.kill("SIGTERM")}catch{}Yb.untrack(this.#n),this.#n=null}for(let[,e]of this.#o)clearTimeout(e.timer),e.reject(new Error("tsserver disposed"));this.#o.clear(),this.#s.clear(),this.#e=null}#f(e){return $s.default.isAbsolute(e)?e:$s.default.resolve(this.#A,e)}#r(e){switch($s.default.extname(e).toLowerCase()){case".tsx":return"TSX";case".ts":return"TS";case".jsx":return"JSX";case".js":case".mjs":case".cjs":return"JS";default:return"TS"}}}});function Bm(t){if(!t)return;let e=t.toLowerCase();if(e!=="inherit")return eZe[e]??t}var eZe,kv=N(()=>{"use strict";m();eZe={"sonnet-4":"acs4",sonnet:"acs",opus:"aco",haiku:"ach",gpt5:"opa5","gpt5-codex":"opa5c.acs4",codex:"opa5c.acs4","gpt5-codex-mini":"opa5c-mini","gpt5-mini":"opa5-mini","gpt5-nano":"opa5-nano",gemini:"g.acs","gemini-flash":"gf.ach"}});function _ge(t,e){try{if(!t||!t.trim())return null;let r=Gf(t);if(!r.frontmatter||Object.keys(r.frontmatter).length===0)return{name:UE.default.basename(e,UE.default.extname(e)),systemPrompt:r.body||t.trim(),filePath:e};let n=r.body;if(!n)return null;let i=r.frontmatter.name||UE.default.basename(e,UE.default.extname(e)),o;r.frontmatter.tools&&(Array.isArray(r.frontmatter.tools)?o=r.frontmatter.tools.map(d=>d.trim()):typeof r.frontmatter.tools=="string"&&(o=r.frontmatter.tools.split(",").map(d=>d.trim())));let s=r.frontmatter.model?Bm(r.frontmatter.model):void 0,a=r.frontmatter.mode,A=!!r.frontmatter.includeMemories,c=!!r.frontmatter.needDevServer,u=!!r.frontmatter.needValidation,l=!!r.frontmatter.resetAfterRun,p=["low","medium","high","minimal"],g=r.frontmatter.reasoning&&p.includes(r.frontmatter.reasoning)?r.frontmatter.reasoning:void 0;return{name:i,description:r.frontmatter.description,systemPrompt:n,tools:o,model:s,mode:a,filePath:e,includeMemories:A,needDevServer:c,needValidation:u,resetAfterRun:l,reasoning:g}}catch{return null}}var UE,Lge=N(()=>{"use strict";m();UE=z(require("node:path"),1);ab();kv()});async function Uge(t,e,r,n="",i,o){let s=[];try{if(!await t.exists(e))return s;let a=await t.readdir(e);for(let A of a){let c=t.join(e,A);if(i&&o){let l=t.relative(o,c);if(!l.startsWith("..")&&!l.startsWith("/")&&i(l))continue}let u=await t.stat(c).catch(()=>null);if(u)if(u.isDirectory()){let l=n?`${n}/${A}`:A,p=await Uge(t,c,r,l,i,o);s.push(...p)}else(A.endsWith(".mdc")||A.endsWith(".md")||A.endsWith(".yml")||A.endsWith(".yaml"))&&s.push(c)}}catch{}return s}async function rZe(t,e,r){try{if(!(await t.stat(e).catch(()=>null))?.isFile())return null;let i=await t.readFile(e);if(!i)return null;let o=t.relative(r,e);return _ge(i,o)}catch(n){return t.Sentry?.captureException(n),null}}async function Oge({sys:t,projectDir:e,currentDir:r,rootDir:n}){let i=[],o=[".claude/agents",".builder/agents",".cursor/agents",".agents/agents"],s=await Rv(e,t),a;do{try{for(let A of o){let c=t.resolve(r,A);if(await t.exists(c)){let u=await Uge(t,c,c,"",s,e);for(let l of u){let p=await rZe(t,l,e);p&&i.push(p)}}}}catch(A){tZe.debug(`Error reading ${r}:`,A)}if(a=r,r=t.dirname(r),r===a)break}while(a!==n);return i}var tZe,Gge=N(()=>{"use strict";m();Lge();wp();Pt();tZe=ke("AgentDiscovery")});function nZe(t){try{return JSON.stringify(t)}catch{return String(t)}}function Kge(t){let{filePath:e,forceWorkspace:r=!1,workspace:n,workingDirectory:i,sys:o,canCollapseWorkspace:s}=t;if(typeof e!="string")throw new TypeError(`resolveWorkspacePath: 'filePath' must be a string, received ${typeof e}: ${nZe(e)}`);let a=e;if(a.startsWith("/")?a=a.substring(1):a.startsWith("./")&&(a=a.substring(2)),!n?.folders?.length)return{resolvedPath:o.resolve(i,a)};if(n.folders.length===1&&n.folders[0].name==="."||s){let d=n.folders[0],f=o.resolve(i,d.path);return{resolvedPath:o.resolve(f,a),workspaceFolder:d}}let c=a.indexOf("/");if(c===-1){if(r){let d=n.folders[0],f=o.resolve(i,d.path);return{resolvedPath:o.resolve(f,a),workspaceFolder:d}}return{resolvedPath:o.resolve(i,a)}}let u=a.substring(0,c),l=a.substring(c+1),p=n.folders.find(d=>d.name?d.name===u:o.basename(d.path)===u);if(!p){if(!r)return{resolvedPath:o.resolve(i,a)};p=n.folders[0];let d=o.resolve(i,p.path);return{resolvedPath:o.resolve(d,a),workspaceFolder:p}}let g=o.resolve(i,p.path);return{resolvedPath:o.resolve(g,l),workspaceFolder:p}}function Hge(t){let{absolutePath:e,workspace:r,workingDirectory:n,sys:i,canCollapseWorkspace:o}=t;if(!r?.folders?.length)return;let s=us(i.resolve(e));if(r.folders.length===1&&r.folders[0].name==="."){let A=r.folders[0],c=us(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}if(o&&r.folders.length===1){let A=r.folders[0],c=us(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}for(let A of r.folders){let c=us(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);u.startsWith("/")&&(u=u.substring(1));let l=A.name||i.basename(A.path);if(l==="."&&r.folders.length>1)continue;return u?`${l}/${u}`:l}}if(o&&r.folders.length>0){let A=r.folders[0],c=us(i.resolve(n,A.path));if(s.startsWith(c)){let u=s.substring(c.length);return u.startsWith("/")&&(u=u.substring(1)),u}}}function $ge(t){let{resolvedPath:e,workingDirectory:r,workspace:n,sys:i}=t,o=i.normalize(e),s=i.normalize(r),a=s.includes("\\")?"\\":"/",A=c=>o.startsWith(c+a)||o===c;if(A(s))return!0;if(n?.folders)for(let c of n.folders){let u=i.normalize(i.resolve(r,c.path));if(A(u))return!0}return!1}var Jge=N(()=>{"use strict";m();z2()});var Xt,jge,Me,Wc,OE=N(()=>{m();(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let o={};for(let s of i)o[s]=s;return o},t.getValidEnumValues=i=>{let o=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(let a of o)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(let s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(Xt||(Xt={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(jge||(jge={}));Me=Xt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wc=t=>{switch(typeof t){case"undefined":return Me.undefined;case"string":return Me.string;case"number":return Number.isNaN(t)?Me.nan:Me.number;case"boolean":return Me.boolean;case"function":return Me.function;case"bigint":return Me.bigint;case"symbol":return Me.symbol;case"object":return Array.isArray(t)?Me.array:t===null?Me.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Me.promise:typeof Map<"u"&&t instanceof Map?Me.map:typeof Set<"u"&&t instanceof Set?Me.set:typeof Date<"u"&&t instanceof Date?Me.date:Me.object;default:return Me.unknown}}});var Qe,ls,Nv=N(()=>{m();OE();Qe=Xt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ls=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},i=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,A=0;for(;A<s.path.length;){let c=s.path[A];A===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(s))):a[c]=a[c]||{_errors:[]},a=a[c],A++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Xt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ls.create=t=>new ls(t)});var iZe,Dl,uO=N(()=>{m();Nv();OE();iZe=(t,e)=>{let r;switch(t.code){case Qe.invalid_type:t.received===Me.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Qe.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Xt.jsonStringifyReplacer)}`;break;case Qe.unrecognized_keys:r=`Unrecognized key(s) in object: ${Xt.joinValues(t.keys,", ")}`;break;case Qe.invalid_union:r="Invalid input";break;case Qe.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Xt.joinValues(t.options)}`;break;case Qe.invalid_enum_value:r=`Invalid enum value. Expected ${Xt.joinValues(t.options)}, received '${t.received}'`;break;case Qe.invalid_arguments:r="Invalid function arguments";break;case Qe.invalid_return_type:r="Invalid function return type";break;case Qe.invalid_date:r="Invalid date";break;case Qe.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Xt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Qe.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Qe.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Qe.custom:r="Invalid input";break;case Qe.invalid_intersection_types:r="Intersection results could not be merged";break;case Qe.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Qe.not_finite:r="Number must be finite";break;default:r=e.defaultError,Xt.assertNever(t)}return{message:r}},Dl=iZe});function GE(){return oZe}var oZe,Tv=N(()=>{m();uO();oZe=Dl});function Ne(t,e){let r=GE(),n=Mv({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Dl?void 0:Dl].filter(i=>!!i)});t.common.issues.push(n)}var Mv,Wi,ut,ym,po,lO,gO,bp,KE,pO=N(()=>{m();Tv();uO();Mv=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,o=[...r,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="",A=n.filter(c=>!!c).slice().reverse();for(let c of A)a=c(s,{data:e,defaultError:a}).message;return{...i,path:o,message:a}};Wi=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return ut;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let o=await i.key,s=await i.value;n.push({key:o,value:s})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return ut;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(n[o.value]=s.value)}return{status:e.value,value:n}}},ut=Object.freeze({status:"aborted"}),ym=t=>({status:"dirty",value:t}),po=t=>({status:"valid",value:t}),lO=t=>t.status==="aborted",gO=t=>t.status==="dirty",bp=t=>t.status==="valid",KE=t=>typeof Promise<"u"&&t instanceof Promise});var Yge=N(()=>{m()});var Je,qge=N(()=>{m();(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Je||(Je={}))});function wt(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{let{message:A}=t;return s.code==="invalid_enum_value"?{message:A??a.defaultError}:typeof a.data>"u"?{message:A??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:A??r??a.defaultError}},description:i}}function Wge(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function yZe(t){return new RegExp(`^${Wge(t)}$`)}function QZe(t){let e=`${zge}T${Wge(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function DZe(t,e){return!!((e==="v4"||!e)&&fZe.test(t)||(e==="v6"||!e)&&hZe.test(t))}function wZe(t,e){if(!lZe.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function bZe(t,e){return!!((e==="v4"||!e)&&mZe.test(t)||(e==="v6"||!e)&&CZe.test(t))}function vZe(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return o%s/10**i}function Qm(t){if(t instanceof gs){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ka.create(Qm(n))}return new gs({...t._def,shape:()=>e})}else return t instanceof bl?new bl({...t._def,type:Qm(t.element)}):t instanceof Ka?Ka.create(Qm(t.unwrap())):t instanceof eu?eu.create(Qm(t.unwrap())):t instanceof Xc?Xc.create(t.items.map(e=>Qm(e))):t}function mO(t,e){let r=Wc(t),n=Wc(e);if(t===e)return{valid:!0,data:t};if(r===Me.object&&n===Me.object){let i=Xt.objectKeys(e),o=Xt.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(let a of o){let A=mO(t[a],e[a]);if(!A.valid)return{valid:!1};s[a]=A.data}return{valid:!0,data:s}}else if(r===Me.array&&n===Me.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],A=mO(s,a);if(!A.valid)return{valid:!1};i.push(A.data)}return{valid:!0,data:i}}else return r===Me.date&&n===Me.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function Zge(t,e){return new km({values:t,typeName:it.ZodEnum,...wt(e)})}var Js,Vge,Lt,sZe,aZe,AZe,cZe,uZe,lZe,gZe,pZe,dZe,dO,fZe,mZe,hZe,CZe,IZe,EZe,zge,BZe,Dm,HE,$E,JE,jE,YE,wm,bm,qE,wl,VA,VE,bl,gs,vm,Zc,fO,Sm,Xc,hO,zE,WE,CO,xm,Fm,km,Rm,vp,Ha,Ka,eu,Nm,Tm,ZE,Pv,_v,Mm,szt,it,azt,Azt,czt,uzt,lzt,gzt,pzt,dzt,fzt,mzt,hzt,Czt,Izt,Ezt,SZe,Bzt,yzt,Qzt,Dzt,wzt,bzt,vzt,Szt,xzt,Fzt,kzt,Rzt,Nzt,Tzt,Mzt,Pzt,_zt,Lzt,Uzt,Xge=N(()=>{m();Nv();Tv();qge();pO();OE();Js=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Vge=(t,e)=>{if(bp(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ls(t.common.issues);return this._error=r,this._error}}};Lt=class{get description(){return this._def.description}_getType(e){return Wc(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Wc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Wi,ctx:{common:e.parent.common,data:e.data,parsedType:Wc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(KE(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wc(e)},i=this._parseSync({data:e,path:n.path,parent:n});return Vge(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wc(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return bp(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>bp(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Wc(e)},i=this._parse({data:e,path:n.path,parent:n}),o=await(KE(i)?i:Promise.resolve(i));return Vge(n,o)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let s=e(i),a=()=>o.addIssue({code:Qe.custom,...n(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(A=>A?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new Ha({schema:this,typeName:it.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ka.create(this,this._def)}nullable(){return eu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bl.create(this)}promise(){return vp.create(this,this._def)}or(e){return vm.create([this,e],this._def)}and(e){return Sm.create(this,e,this._def)}transform(e){return new Ha({...wt(this._def),schema:this,typeName:it.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Nm({...wt(this._def),innerType:this,defaultValue:r,typeName:it.ZodDefault})}brand(){return new Pv({typeName:it.ZodBranded,type:this,...wt(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Tm({...wt(this._def),innerType:this,catchValue:r,typeName:it.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return _v.create(this,e)}readonly(){return Mm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sZe=/^c[^\s-]{8,}$/i,aZe=/^[0-9a-z]+$/,AZe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cZe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,uZe=/^[a-z0-9_-]{21}$/i,lZe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gZe=/^[-+]?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)?)??$/,pZe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,dZe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",fZe=/^(?:(?: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])$/,mZe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,hZe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,CZe=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,IZe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,EZe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,zge="((\\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])))",BZe=new RegExp(`^${zge}$`);Dm=class t extends Lt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Me.string){let o=this._getOrReturnCtx(e);return Ne(o,{code:Qe.invalid_type,expected:Me.string,received:o.parsedType}),ut}let n=new Wi,i;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?Ne(i,{code:Qe.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Ne(i,{code:Qe.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")pZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"email",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")dO||(dO=new RegExp(dZe,"u")),dO.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"emoji",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")cZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"uuid",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")uZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"nanoid",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")sZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"cuid",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")aZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"cuid2",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")AZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"ulid",code:Qe.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Ne(i,{validation:"url",code:Qe.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"regex",code:Qe.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?QZe(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?BZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?yZe(o).test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?gZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"duration",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?DZe(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"ip",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?wZe(e.data,o.alg)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"jwt",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?bZe(e.data,o.version)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"cidr",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?IZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"base64",code:Qe.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?EZe.test(e.data)||(i=this._getOrReturnCtx(e,i),Ne(i,{validation:"base64url",code:Qe.invalid_string,message:o.message}),n.dirty()):Xt.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:Qe.invalid_string,...Je.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Je.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Je.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Je.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Je.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Je.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Je.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Je.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Je.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Je.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Je.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Je.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Je.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Je.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Je.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Je.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Je.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Je.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Je.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Je.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Je.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Je.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Je.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Je.errToObj(r)})}nonempty(e){return this.min(1,Je.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Dm.create=t=>new Dm({checks:[],typeName:it.ZodString,coerce:t?.coerce??!1,...wt(t)});HE=class t extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Me.number){let o=this._getOrReturnCtx(e);return Ne(o,{code:Qe.invalid_type,expected:Me.number,received:o.parsedType}),ut}let n,i=new Wi;for(let o of this._def.checks)o.kind==="int"?Xt.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?vZe(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.not_finite,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Je.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Je.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Je.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Je.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Je.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Je.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Je.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Je.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Je.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Je.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Xt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};HE.create=t=>new HE({checks:[],typeName:it.ZodNumber,coerce:t?.coerce||!1,...wt(t)});$E=class t extends Lt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Me.bigint)return this._getInvalidInput(e);let n,i=new Wi;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Ne(n,{code:Qe.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):Xt.assertNever(o);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Ne(r,{code:Qe.invalid_type,expected:Me.bigint,received:r.parsedType}),ut}gte(e,r){return this.setLimit("min",e,!0,Je.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Je.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Je.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Je.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Je.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Je.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Je.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Je.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};$E.create=t=>new $E({checks:[],typeName:it.ZodBigInt,coerce:t?.coerce??!1,...wt(t)});JE=class extends Lt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Me.boolean){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.boolean,received:n.parsedType}),ut}return po(e.data)}};JE.create=t=>new JE({typeName:it.ZodBoolean,coerce:t?.coerce||!1,...wt(t)});jE=class t extends Lt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Me.date){let o=this._getOrReturnCtx(e);return Ne(o,{code:Qe.invalid_type,expected:Me.date,received:o.parsedType}),ut}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Ne(o,{code:Qe.invalid_date}),ut}let n=new Wi,i;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(i=this._getOrReturnCtx(e,i),Ne(i,{code:Qe.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):Xt.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Je.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Je.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};jE.create=t=>new jE({checks:[],coerce:t?.coerce||!1,typeName:it.ZodDate,...wt(t)});YE=class extends Lt{_parse(e){if(this._getType(e)!==Me.symbol){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.symbol,received:n.parsedType}),ut}return po(e.data)}};YE.create=t=>new YE({typeName:it.ZodSymbol,...wt(t)});wm=class extends Lt{_parse(e){if(this._getType(e)!==Me.undefined){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.undefined,received:n.parsedType}),ut}return po(e.data)}};wm.create=t=>new wm({typeName:it.ZodUndefined,...wt(t)});bm=class extends Lt{_parse(e){if(this._getType(e)!==Me.null){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.null,received:n.parsedType}),ut}return po(e.data)}};bm.create=t=>new bm({typeName:it.ZodNull,...wt(t)});qE=class extends Lt{constructor(){super(...arguments),this._any=!0}_parse(e){return po(e.data)}};qE.create=t=>new qE({typeName:it.ZodAny,...wt(t)});wl=class extends Lt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return po(e.data)}};wl.create=t=>new wl({typeName:it.ZodUnknown,...wt(t)});VA=class extends Lt{_parse(e){let r=this._getOrReturnCtx(e);return Ne(r,{code:Qe.invalid_type,expected:Me.never,received:r.parsedType}),ut}};VA.create=t=>new VA({typeName:it.ZodNever,...wt(t)});VE=class extends Lt{_parse(e){if(this._getType(e)!==Me.undefined){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.void,received:n.parsedType}),ut}return po(e.data)}};VE.create=t=>new VE({typeName:it.ZodVoid,...wt(t)});bl=class t extends Lt{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==Me.array)return Ne(r,{code:Qe.invalid_type,expected:Me.array,received:r.parsedType}),ut;if(i.exactLength!==null){let s=r.data.length>i.exactLength.value,a=r.data.length<i.exactLength.value;(s||a)&&(Ne(r,{code:s?Qe.too_big:Qe.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(Ne(r,{code:Qe.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(Ne(r,{code:Qe.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>i.type._parseAsync(new Js(r,s,r.path,a)))).then(s=>Wi.mergeArray(n,s));let o=[...r.data].map((s,a)=>i.type._parseSync(new Js(r,s,r.path,a)));return Wi.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Je.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Je.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Je.toString(r)}})}nonempty(e){return this.min(1,e)}};bl.create=(t,e)=>new bl({type:t,minLength:null,maxLength:null,exactLength:null,typeName:it.ZodArray,...wt(e)});gs=class t extends Lt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Xt.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==Me.object){let c=this._getOrReturnCtx(e);return Ne(c,{code:Qe.invalid_type,expected:Me.object,received:c.parsedType}),ut}let{status:n,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof VA&&this._def.unknownKeys==="strip"))for(let c in i.data)s.includes(c)||a.push(c);let A=[];for(let c of s){let u=o[c],l=i.data[c];A.push({key:{status:"valid",value:c},value:u._parse(new Js(i,l,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof VA){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)A.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(c==="strict")a.length>0&&(Ne(i,{code:Qe.unrecognized_keys,keys:a}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let l=i.data[u];A.push({key:{status:"valid",value:u},value:c._parse(new Js(i,l,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of A){let l=await u.key,p=await u.value;c.push({key:l,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>Wi.mergeObjectSync(n,c)):Wi.mergeObjectSync(n,A)}get shape(){return this._def.shape()}strict(e){return Je.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Je.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:it.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of Xt.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of Xt.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Qm(this)}partial(e){let r={};for(let n of Xt.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Xt.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Ka;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return Zge(Xt.objectKeys(this.shape))}};gs.create=(t,e)=>new gs({shape:()=>t,unknownKeys:"strip",catchall:VA.create(),typeName:it.ZodObject,...wt(e)});gs.strictCreate=(t,e)=>new gs({shape:()=>t,unknownKeys:"strict",catchall:VA.create(),typeName:it.ZodObject,...wt(e)});gs.lazycreate=(t,e)=>new gs({shape:t,unknownKeys:"strip",catchall:VA.create(),typeName:it.ZodObject,...wt(e)});vm=class extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new ls(a.ctx.common.issues));return Ne(r,{code:Qe.invalid_union,unionErrors:s}),ut}if(r.common.async)return Promise.all(n.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(i);{let o,s=[];for(let A of n){let c={...r,common:{...r.common,issues:[]},parent:null},u=A._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(A=>new ls(A));return Ne(r,{code:Qe.invalid_union,unionErrors:a}),ut}}get options(){return this._def.options}};vm.create=(t,e)=>new vm({options:t,typeName:it.ZodUnion,...wt(e)});Zc=t=>t instanceof xm?Zc(t.schema):t instanceof Ha?Zc(t.innerType()):t instanceof Fm?[t.value]:t instanceof km?t.options:t instanceof Rm?Xt.objectValues(t.enum):t instanceof Nm?Zc(t._def.innerType):t instanceof wm?[void 0]:t instanceof bm?[null]:t instanceof Ka?[void 0,...Zc(t.unwrap())]:t instanceof eu?[null,...Zc(t.unwrap())]:t instanceof Pv||t instanceof Mm?Zc(t.unwrap()):t instanceof Tm?Zc(t._def.innerType):[],fO=class t extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Me.object)return Ne(r,{code:Qe.invalid_type,expected:Me.object,received:r.parsedType}),ut;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Ne(r,{code:Qe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ut)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let o of r){let s=Zc(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,o)}}return new t({typeName:it.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...wt(n)})}};Sm=class extends Lt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(o,s)=>{if(lO(o)||lO(s))return ut;let a=mO(o.value,s.value);return a.valid?((gO(o)||gO(s))&&r.dirty(),{status:r.value,value:a.data}):(Ne(n,{code:Qe.invalid_intersection_types}),ut)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Sm.create=(t,e,r)=>new Sm({left:t,right:e,typeName:it.ZodIntersection,...wt(r)});Xc=class t extends Lt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.array)return Ne(n,{code:Qe.invalid_type,expected:Me.array,received:n.parsedType}),ut;if(n.data.length<this._def.items.length)return Ne(n,{code:Qe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ut;!this._def.rest&&n.data.length>this._def.items.length&&(Ne(n,{code:Qe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((s,a)=>{let A=this._def.items[a]||this._def.rest;return A?A._parse(new Js(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(o).then(s=>Wi.mergeArray(r,s)):Wi.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Xc.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Xc({items:t,typeName:it.ZodTuple,rest:null,...wt(e)})};hO=class t extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.object)return Ne(n,{code:Qe.invalid_type,expected:Me.object,received:n.parsedType}),ut;let i=[],o=this._def.keyType,s=this._def.valueType;for(let a in n.data)i.push({key:o._parse(new Js(n,a,n.path,a)),value:s._parse(new Js(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Wi.mergeObjectAsync(r,i):Wi.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof Lt?new t({keyType:e,valueType:r,typeName:it.ZodRecord,...wt(n)}):new t({keyType:Dm.create(),valueType:e,typeName:it.ZodRecord,...wt(r)})}},zE=class extends Lt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.map)return Ne(n,{code:Qe.invalid_type,expected:Me.map,received:n.parsedType}),ut;let i=this._def.keyType,o=this._def.valueType,s=[...n.data.entries()].map(([a,A],c)=>({key:i._parse(new Js(n,a,n.path,[c,"key"])),value:o._parse(new Js(n,A,n.path,[c,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let A of s){let c=await A.key,u=await A.value;if(c.status==="aborted"||u.status==="aborted")return ut;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let A of s){let c=A.key,u=A.value;if(c.status==="aborted"||u.status==="aborted")return ut;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),a.set(c.value,u.value)}return{status:r.value,value:a}}}};zE.create=(t,e,r)=>new zE({valueType:e,keyType:t,typeName:it.ZodMap,...wt(r)});WE=class t extends Lt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==Me.set)return Ne(n,{code:Qe.invalid_type,expected:Me.set,received:n.parsedType}),ut;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(Ne(n,{code:Qe.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(Ne(n,{code:Qe.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function s(A){let c=new Set;for(let u of A){if(u.status==="aborted")return ut;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let a=[...n.data.values()].map((A,c)=>o._parse(new Js(n,A,n.path,c)));return n.common.async?Promise.all(a).then(A=>s(A)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:Je.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Je.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};WE.create=(t,e)=>new WE({valueType:t,minSize:null,maxSize:null,typeName:it.ZodSet,...wt(e)});CO=class t extends Lt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Me.function)return Ne(r,{code:Qe.invalid_type,expected:Me.function,received:r.parsedType}),ut;function n(a,A){return Mv({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,GE(),Dl].filter(c=>!!c),issueData:{code:Qe.invalid_arguments,argumentsError:A}})}function i(a,A){return Mv({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,GE(),Dl].filter(c=>!!c),issueData:{code:Qe.invalid_return_type,returnTypeError:A}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof vp){let a=this;return po(async function(...A){let c=new ls([]),u=await a._def.args.parseAsync(A,o).catch(g=>{throw c.addIssue(n(A,g)),c}),l=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(l,o).catch(g=>{throw c.addIssue(i(l,g)),c})})}else{let a=this;return po(function(...A){let c=a._def.args.safeParse(A,o);if(!c.success)throw new ls([n(A,c.error)]);let u=Reflect.apply(s,this,c.data),l=a._def.returns.safeParse(u,o);if(!l.success)throw new ls([i(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Xc.create(e).rest(wl.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Xc.create([]).rest(wl.create()),returns:r||wl.create(),typeName:it.ZodFunction,...wt(n)})}},xm=class extends Lt{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};xm.create=(t,e)=>new xm({getter:t,typeName:it.ZodLazy,...wt(e)});Fm=class extends Lt{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Ne(r,{received:r.data,code:Qe.invalid_literal,expected:this._def.value}),ut}return{status:"valid",value:e.data}}get value(){return this._def.value}};Fm.create=(t,e)=>new Fm({value:t,typeName:it.ZodLiteral,...wt(e)});km=class t extends Lt{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return Ne(r,{expected:Xt.joinValues(n),received:r.parsedType,code:Qe.invalid_type}),ut}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return Ne(r,{received:r.data,code:Qe.invalid_enum_value,options:n}),ut}return po(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};km.create=Zge;Rm=class extends Lt{_parse(e){let r=Xt.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Me.string&&n.parsedType!==Me.number){let i=Xt.objectValues(r);return Ne(n,{expected:Xt.joinValues(i),received:n.parsedType,code:Qe.invalid_type}),ut}if(this._cache||(this._cache=new Set(Xt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Xt.objectValues(r);return Ne(n,{received:n.data,code:Qe.invalid_enum_value,options:i}),ut}return po(e.data)}get enum(){return this._def.values}};Rm.create=(t,e)=>new Rm({values:t,typeName:it.ZodNativeEnum,...wt(e)});vp=class extends Lt{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Me.promise&&r.common.async===!1)return Ne(r,{code:Qe.invalid_type,expected:Me.promise,received:r.parsedType}),ut;let n=r.parsedType===Me.promise?r.data:Promise.resolve(r.data);return po(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};vp.create=(t,e)=>new vp({type:t,typeName:it.ZodPromise,...wt(e)});Ha=class extends Lt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===it.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{Ne(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let s=i.transform(n.data,o);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ut;let A=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return A.status==="aborted"?ut:A.status==="dirty"?ym(A.value):r.value==="dirty"?ym(A.value):A});{if(r.value==="aborted")return ut;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?ut:a.status==="dirty"?ym(a.value):r.value==="dirty"?ym(a.value):a}}if(i.type==="refinement"){let s=a=>{let A=i.refinement(a,o);if(n.common.async)return Promise.resolve(A);if(A instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?ut:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?ut:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(i.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!bp(s))return ut;let a=i.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>bp(s)?Promise.resolve(i.transform(s.value,o)).then(a=>({status:r.value,value:a})):ut);Xt.assertNever(i)}};Ha.create=(t,e,r)=>new Ha({schema:t,typeName:it.ZodEffects,effect:e,...wt(r)});Ha.createWithPreprocess=(t,e,r)=>new Ha({schema:e,effect:{type:"preprocess",transform:t},typeName:it.ZodEffects,...wt(r)});Ka=class extends Lt{_parse(e){return this._getType(e)===Me.undefined?po(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ka.create=(t,e)=>new Ka({innerType:t,typeName:it.ZodOptional,...wt(e)});eu=class extends Lt{_parse(e){return this._getType(e)===Me.null?po(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};eu.create=(t,e)=>new eu({innerType:t,typeName:it.ZodNullable,...wt(e)});Nm=class extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===Me.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Nm.create=(t,e)=>new Nm({innerType:t,typeName:it.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...wt(e)});Tm=class extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return KE(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ls(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ls(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Tm.create=(t,e)=>new Tm({innerType:t,typeName:it.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...wt(e)});ZE=class extends Lt{_parse(e){if(this._getType(e)!==Me.nan){let n=this._getOrReturnCtx(e);return Ne(n,{code:Qe.invalid_type,expected:Me.nan,received:n.parsedType}),ut}return{status:"valid",value:e.data}}};ZE.create=t=>new ZE({typeName:it.ZodNaN,...wt(t)});Pv=class extends Lt{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},_v=class t extends Lt{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ut:o.status==="dirty"?(r.dirty(),ym(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ut:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:it.ZodPipeline})}},Mm=class extends Lt{_parse(e){let r=this._def.innerType._parse(e),n=i=>(bp(i)&&(i.value=Object.freeze(i.value)),i);return KE(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Mm.create=(t,e)=>new Mm({innerType:t,typeName:it.ZodReadonly,...wt(e)});szt={object:gs.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(it||(it={}));azt=Dm.create,Azt=HE.create,czt=ZE.create,uzt=$E.create,lzt=JE.create,gzt=jE.create,pzt=YE.create,dzt=wm.create,fzt=bm.create,mzt=qE.create,hzt=wl.create,Czt=VA.create,Izt=VE.create,Ezt=bl.create,SZe=gs.create,Bzt=gs.strictCreate,yzt=vm.create,Qzt=fO.create,Dzt=Sm.create,wzt=Xc.create,bzt=hO.create,vzt=zE.create,Szt=WE.create,xzt=CO.create,Fzt=xm.create,kzt=Fm.create,Rzt=km.create,Nzt=Rm.create,Tzt=vp.create,Mzt=Ha.create,Pzt=Ka.create,_zt=eu.create,Lzt=Ha.createWithPreprocess,Uzt=_v.create});var IO=N(()=>{m();Tv();pO();Yge();OE();Xge();Nv()});var XE=N(()=>{m();IO();IO()});function te(t,e,r){function n(a,A){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:A,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,A);let c=s.prototype,u=Object.keys(c);for(let l=0;l<u.length;l++){let p=u[l];p in a||(a[p]=c[p].bind(a))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:t});function s(a){var A;let c=r?.Parent?new o:this;n(c,a),(A=c._zod).deferred??(A.deferred=[]);for(let u of c._zod.deferred)u();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}function zn(t){return t&&Object.assign(Lv,t),Lv}var Uv,zA,Sp,Lv,Pm=N(()=>{m();Uv=Object.freeze({status:"aborted"});zA=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Sp=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Lv={}});var De={};lA(De,{BIGINT_FORMAT_RANGES:()=>xO,Class:()=>BO,NUMBER_FORMAT_RANGES:()=>SO,aborted:()=>Fl,allowsEval:()=>DO,assert:()=>MZe,assertEqual:()=>kZe,assertIs:()=>NZe,assertNever:()=>TZe,assertNotEqual:()=>RZe,assignProp:()=>Sl,base64ToUint8Array:()=>ape,base64urlToUint8Array:()=>jZe,cached:()=>Lm,captureStackTrace:()=>Gv,cleanEnum:()=>JZe,cleanRegex:()=>rB,clone:()=>fo,cloneDef:()=>_Ze,createTransparentProxy:()=>HZe,defineLazy:()=>St,esc:()=>Ov,escapeRegex:()=>js,extend:()=>npe,finalizeIssue:()=>Ko,floatSafeRemainder:()=>yO,getElementAtPath:()=>LZe,getEnumValues:()=>tB,getLengthableOrigin:()=>oB,getParsedType:()=>KZe,getSizableOrigin:()=>iB,hexToUint8Array:()=>qZe,isObject:()=>xp,isPlainObject:()=>xl,issue:()=>Um,joinValues:()=>st,jsonStringifyReplacer:()=>_m,merge:()=>$Ze,mergeDefs:()=>tu,normalizeParams:()=>Fe,nullish:()=>vl,numKeys:()=>GZe,objectClone:()=>PZe,omit:()=>rpe,optionalKeys:()=>vO,parsedType:()=>lt,partial:()=>ope,pick:()=>tpe,prefixIssues:()=>ps,primitiveTypes:()=>bO,promiseAllObject:()=>UZe,propertyKeyTypes:()=>nB,randomString:()=>OZe,required:()=>spe,safeExtend:()=>ipe,shallowClone:()=>wO,slugify:()=>QO,stringifyPrimitive:()=>at,uint8ArrayToBase64:()=>Ape,uint8ArrayToBase64url:()=>YZe,uint8ArrayToHex:()=>VZe,unwrapMessage:()=>eB});function kZe(t){return t}function RZe(t){return t}function NZe(t){}function TZe(t){throw new Error("Unexpected value in exhaustive check")}function MZe(t){}function tB(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function st(t,e="|"){return t.map(r=>at(r)).join(e)}function _m(t,e){return typeof e=="bigint"?e.toString():e}function Lm(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function vl(t){return t==null}function rB(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function yO(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let A=n.match(/\d?e-(\d?)/);A?.[1]&&(i=Number.parseInt(A[1]))}let o=r>i?r:i,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function St(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==epe)return n===void 0&&(n=epe,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function PZe(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Sl(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tu(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function _Ze(t){return tu(t._zod.def)}function LZe(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function UZe(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<e.length;o++)i[e[o]]=n[o];return i})}function OZe(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Ov(t){return JSON.stringify(t)}function QO(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function xp(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function xl(t){if(xp(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(xp(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function wO(t){return xl(t)?{...t}:Array.isArray(t)?[...t]:t}function GZe(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function js(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fo(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Fe(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function HZe(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,o){return e??(e=t()),Reflect.set(e,n,i,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function at(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function vO(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function tpe(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=tu(t._zod.def,{get shape(){let s={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=r.shape[a])}return Sl(this,"shape",s),s},checks:[]});return fo(t,o)}function rpe(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=tu(t._zod.def,{get shape(){let s={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete s[a]}return Sl(this,"shape",s),s},checks:[]});return fo(t,o)}function npe(t,e){if(!xl(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let o=t._zod.def.shape;for(let s in e)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=tu(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return Sl(this,"shape",o),o}});return fo(t,i)}function ipe(t,e){if(!xl(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=tu(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return Sl(this,"shape",n),n}});return fo(t,r)}function $Ze(t,e){let r=tu(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Sl(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return fo(t,r)}function ope(t,e,r){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=tu(e._zod.def,{get shape(){let a=e._zod.def.shape,A={...a};if(r)for(let c in r){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);r[c]&&(A[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(let c in a)A[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return Sl(this,"shape",A),A},checks:[]});return fo(e,s)}function spe(t,e,r){let n=tu(e._zod.def,{get shape(){let i=e._zod.def.shape,o={...i};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(let s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return Sl(this,"shape",o),o}});return fo(e,n)}function Fl(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function ps(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function eB(t){return typeof t=="string"?t:t?.message}function Ko(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let i=eB(t.inst?._zod.def?.error?.(t))??eB(e?.error?.(t))??eB(r.customError?.(t))??eB(r.localeError?.(t))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function iB(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function oB(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function lt(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Um(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function JZe(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function ape(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function Ape(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function jZe(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return ape(e+r)}function YZe(t){return Ape(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function qZe(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function VZe(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var epe,Gv,DO,KZe,nB,bO,SO,xO,BO,qe=N(()=>{m();epe=Symbol("evaluating");Gv="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};DO=Lm(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});KZe=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},nB=new Set(["string","number","symbol"]),bO=new Set(["string","number","bigint","boolean","symbol","undefined"]);SO={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},xO={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};BO=class{constructor(...e){}}});function Hv(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function $v(t,e=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(e(o));else{let s=r,a=0;for(;a<o.path.length;){let A=o.path[a];a===o.path.length-1?(s[A]=s[A]||{_errors:[]},s[A]._errors.push(e(o))):s[A]=s[A]||{_errors:[]},s=s[A],a++}}};return n(t),r}var cpe,Kv,sB,FO=N(()=>{m();Pm();qe();cpe=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,_m,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Kv=te("$ZodError",cpe),sB=te("$ZodError",cpe,{Parent:Error})});var aB,AB,cB,uB,lB,Om,gB,pB,upe,lpe,gpe,ppe,dpe,fpe,mpe,hpe,kO=N(()=>{m();Pm();FO();qe();aB=t=>(e,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new zA;if(s.issues.length){let a=new(i?.Err??t)(s.issues.map(A=>Ko(A,o,zn())));throw Gv(a,i?.callee),a}return s.value},AB=aB(sB),cB=t=>async(e,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(i?.Err??t)(s.issues.map(A=>Ko(A,o,zn())));throw Gv(a,i?.callee),a}return s.value},uB=cB(sB),lB=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new zA;return o.issues.length?{success:!1,error:new(t??Kv)(o.issues.map(s=>Ko(s,i,zn())))}:{success:!0,data:o.value}},Om=lB(sB),gB=t=>async(e,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>Ko(s,i,zn())))}:{success:!0,data:o.value}},pB=gB(sB),upe=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return aB(t)(e,r,i)},lpe=t=>(e,r,n)=>aB(t)(e,r,n),gpe=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return cB(t)(e,r,i)},ppe=t=>async(e,r,n)=>cB(t)(e,r,n),dpe=t=>(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return lB(t)(e,r,i)},fpe=t=>(e,r,n)=>lB(t)(e,r,n),mpe=t=>async(e,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return gB(t)(e,r,i)},hpe=t=>async(e,r,n)=>gB(t)(e,r,n)});var Ys={};lA(Ys,{base64:()=>YO,base64url:()=>Jv,bigint:()=>XO,boolean:()=>tG,browserEmail:()=>iXe,cidrv4:()=>JO,cidrv6:()=>jO,cuid:()=>RO,cuid2:()=>NO,date:()=>VO,datetime:()=>WO,domain:()=>aXe,duration:()=>LO,e164:()=>qO,email:()=>OO,emoji:()=>GO,extendedDuration:()=>WZe,guid:()=>UO,hex:()=>AXe,hostname:()=>sXe,html5Email:()=>tXe,idnEmail:()=>nXe,integer:()=>eG,ipv4:()=>KO,ipv6:()=>HO,ksuid:()=>PO,lowercase:()=>iG,mac:()=>$O,md5_base64:()=>uXe,md5_base64url:()=>lXe,md5_hex:()=>cXe,nanoid:()=>_O,null:()=>rG,number:()=>jv,rfc5322Email:()=>rXe,sha1_base64:()=>pXe,sha1_base64url:()=>dXe,sha1_hex:()=>gXe,sha256_base64:()=>mXe,sha256_base64url:()=>hXe,sha256_hex:()=>fXe,sha384_base64:()=>IXe,sha384_base64url:()=>EXe,sha384_hex:()=>CXe,sha512_base64:()=>yXe,sha512_base64url:()=>QXe,sha512_hex:()=>BXe,string:()=>ZO,time:()=>zO,ulid:()=>TO,undefined:()=>nG,unicodeEmail:()=>Cpe,uppercase:()=>oG,uuid:()=>Fp,uuid4:()=>ZZe,uuid6:()=>XZe,uuid7:()=>eXe,xid:()=>MO});function GO(){return new RegExp(oXe,"u")}function Epe(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function zO(t){return new RegExp(`^${Epe(t)}$`)}function WO(t){let e=Epe({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Ipe}T(?:${n})$`)}function dB(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function fB(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var RO,NO,TO,MO,PO,_O,LO,WZe,UO,Fp,ZZe,XZe,eXe,OO,tXe,rXe,Cpe,nXe,iXe,oXe,KO,HO,$O,JO,jO,YO,Jv,sXe,aXe,qO,Ipe,VO,ZO,XO,eG,jv,tG,rG,nG,iG,oG,AXe,cXe,uXe,lXe,gXe,pXe,dXe,fXe,mXe,hXe,CXe,IXe,EXe,BXe,yXe,QXe,Yv=N(()=>{m();qe();RO=/^[cC][^\s-]{8,}$/,NO=/^[0-9a-z]+$/,TO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,MO=/^[0-9a-vA-V]{20}$/,PO=/^[A-Za-z0-9]{27}$/,_O=/^[a-zA-Z0-9_-]{21}$/,LO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,WZe=/^[-+]?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)?)??$/,UO=/^([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})$/,Fp=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/,ZZe=Fp(4),XZe=Fp(6),eXe=Fp(7),OO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tXe=/^[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])?)*$/,rXe=/^(([^<>()\[\]\\.,;:\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,}))$/,Cpe=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,nXe=Cpe,iXe=/^[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])?)*$/,oXe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";KO=/^(?:(?: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])$/,HO=/^(([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}|:))$/,$O=t=>{let e=js(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},JO=/^((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])$/,jO=/^(([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])$/,YO=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jv=/^[A-Za-z0-9_-]*$/,sXe=/^(?=.{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])?)*\.?$/,aXe=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,qO=/^\+[1-9]\d{6,14}$/,Ipe="(?:(?:\\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])))",VO=new RegExp(`^${Ipe}$`);ZO=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},XO=/^-?\d+n?$/,eG=/^-?\d+$/,jv=/^-?\d+(?:\.\d+)?$/,tG=/^(?:true|false)$/i,rG=/^null$/i,nG=/^undefined$/i,iG=/^[^A-Z]*$/,oG=/^[^a-z]*$/,AXe=/^[0-9a-fA-F]*$/;cXe=/^[0-9a-fA-F]{32}$/,uXe=dB(22,"=="),lXe=fB(22),gXe=/^[0-9a-fA-F]{40}$/,pXe=dB(27,"="),dXe=fB(27),fXe=/^[0-9a-fA-F]{64}$/,mXe=dB(43,"="),hXe=fB(43),CXe=/^[0-9a-fA-F]{96}$/,IXe=dB(64,""),EXe=fB(64),BXe=/^[0-9a-fA-F]{128}$/,yXe=dB(86,"=="),QXe=fB(86)});function Bpe(t,e,r){t.issues.length&&e.issues.push(...ps(r,t.issues))}var kr,ype,sG,aG,Qpe,Dpe,wpe,bpe,vpe,Spe,xpe,Fpe,kpe,mB,Rpe,Npe,Tpe,Mpe,Ppe,_pe,Lpe,Upe,Ope,qv=N(()=>{m();Pm();Yv();qe();kr=te("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),ype={number:"number",bigint:"bigint",object:"date"},sG=te("$ZodCheckLessThan",(t,e)=>{kr.init(t,e);let r=ype[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),aG=te("$ZodCheckGreaterThan",(t,e)=>{kr.init(t,e);let r=ype[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Qpe=te("$ZodCheckMultipleOf",(t,e)=>{kr.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):yO(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Dpe=te("$ZodCheckNumberFormat",(t,e)=>{kr.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,o]=SO[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=i,a.maximum=o,r&&(a.pattern=eG)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}a<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),wpe=te("$ZodCheckBigIntFormat",(t,e)=>{kr.init(t,e);let[r,n]=xO[e.format];t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,o.minimum=r,o.maximum=n}),t._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),bpe=te("$ZodCheckMaxSize",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;i.size<=e.maximum||n.issues.push({origin:iB(i),code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),vpe=te("$ZodCheckMinSize",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;i.size>=e.minimum||n.issues.push({origin:iB(i),code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Spe=te("$ZodCheckSizeEquals",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=n=>{let i=n.value,o=i.size;if(o===e.size)return;let s=o>e.size;n.issues.push({origin:iB(i),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),xpe=te("$ZodCheckMaxLength",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let i=n.value;if(i.length<=e.maximum)return;let s=oB(i);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),Fpe=te("$ZodCheckMinLength",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let s=oB(i);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),kpe=te("$ZodCheckLengthEquals",(t,e)=>{var r;kr.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!vl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,o=i.length;if(o===e.length)return;let s=oB(i),a=o>e.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),mB=te("$ZodCheckStringFormat",(t,e)=>{var r,n;kr.init(t,e),t._zod.onattach.push(i=>{let o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Rpe=te("$ZodCheckRegex",(t,e)=>{mB.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Npe=te("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=iG),mB.init(t,e)}),Tpe=te("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=oG),mB.init(t,e)}),Mpe=te("$ZodCheckIncludes",(t,e)=>{kr.init(t,e);let r=js(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),Ppe=te("$ZodCheckStartsWith",(t,e)=>{kr.init(t,e);let r=new RegExp(`^${js(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),_pe=te("$ZodCheckEndsWith",(t,e)=>{kr.init(t,e);let r=new RegExp(`.*${js(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});Lpe=te("$ZodCheckProperty",(t,e)=>{kr.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>Bpe(i,r,e.property));Bpe(n,r,e.property)}}),Upe=te("$ZodCheckMimeType",(t,e)=>{kr.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),Ope=te("$ZodCheckOverwrite",(t,e)=>{kr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var Vv,AG=N(()=>{m();Vv=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
1775
1775
|
`).filter(s=>s),i=Math.min(...n.map(s=>s.length-s.trimStart().length)),o=n.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...r,i.join(`
|
|
1776
1776
|
`))}}});var Kpe,cG=N(()=>{m();Kpe={major:4,minor:3,patch:6}});function ede(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function DXe(t){if(!Jv.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return ede(r)}function wXe(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}function Hpe(t,e,r){t.issues.length&&e.issues.push(...ps(r,t.issues)),e.value[r]=t.value}function eS(t,e,r,n,i){if(t.issues.length){if(i&&!(r in n))return;e.issues.push(...ps(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function tde(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=vO(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function rde(t,e,r,n,i,o){let s=[],a=i.keySet,A=i.catchall._zod,c=A.def.type,u=A.optout==="optional";for(let l in e){if(a.has(l))continue;if(c==="never"){s.push(l);continue}let p=A.run({value:e[l],issues:[]},n);p instanceof Promise?t.push(p.then(g=>eS(g,r,l,e,u))):eS(p,r,l,e,u)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:o}),t.length?Promise.all(t).then(()=>r):r}function $pe(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;let i=t.filter(o=>!Fl(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>Ko(s,n,zn())))}),e)}function Jpe(t,e,r,n){let i=t.filter(o=>o.issues.length===0);return i.length===1?(e.value=i[0].value,e):(i.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>Ko(s,n,zn())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}function uG(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(xl(t)&&xl(e)){let r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(let o of n){let s=uG(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let i=t[n],o=e[n],s=uG(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function jpe(t,e,r){let n=new Map,i;for(let a of e.issues)if(a.code==="unrecognized_keys"){i??(i=a);for(let A of a.keys)n.has(A)||n.set(A,{}),n.get(A).l=!0}else t.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let A of a.keys)n.has(A)||n.set(A,{}),n.get(A).r=!0;else t.issues.push(a);let o=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&i&&t.issues.push({...i,keys:o}),Fl(t))return t;let s=uG(e.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return t.value=s.data,t}function zv(t,e,r){t.issues.length&&e.issues.push(...ps(r,t.issues)),e.value[r]=t.value}function Ype(t,e,r,n,i,o,s){t.issues.length&&(nB.has(typeof n)?r.issues.push(...ps(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:t.issues.map(a=>Ko(a,s,zn()))})),e.issues.length&&(nB.has(typeof n)?r.issues.push(...ps(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:e.issues.map(a=>Ko(a,s,zn()))})),r.value.set(t.value,e.value)}function qpe(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function Vpe(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}function zpe(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function Wpe(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function Wv(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}function Zv(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let i=e.transform(t.value,t);return i instanceof Promise?i.then(o=>Xv(t,o,e.out,r)):Xv(t,i,e.out,r)}else{let i=e.reverseTransform(t.value,t);return i instanceof Promise?i.then(o=>Xv(t,o,e.in,r)):Xv(t,i,e.in,r)}}function Xv(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}function Zpe(t){return t.value=Object.freeze(t.value),t}function Xpe(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Um(i))}}var It,kp,wr,lG,gG,pG,dG,fG,mG,hG,CG,IG,EG,BG,yG,QG,DG,wG,bG,vG,SG,xG,FG,kG,RG,NG,TG,MG,tS,PG,hB,rS,_G,LG,UG,OG,GG,KG,HG,$G,JG,jG,nde,ide,CB,YG,qG,VG,nS,zG,WG,ZG,XG,e8,t8,r8,iS,n8,i8,o8,s8,a8,A8,c8,u8,l8,IB,g8,p8,d8,f8,m8,h8,C8=N(()=>{m();qv();Pm();AG();kO();Yv();qe();cG();qe();It=te("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Kpe;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let o of i._zod.onattach)o(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=(s,a,A)=>{let c=Fl(s),u;for(let l of a){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(c)continue;let p=s.issues.length,g=l._zod.check(s);if(g instanceof Promise&&A?.async===!1)throw new zA;if(u||g instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await g,s.issues.length!==p&&(c||(c=Fl(s,p)))});else{if(s.issues.length===p)continue;c||(c=Fl(s,p))}}return u?u.then(()=>s):s},o=(s,a,A)=>{if(Fl(s))return s.aborted=!0,s;let c=i(a,n,A);if(c instanceof Promise){if(A.async===!1)throw new zA;return c.then(u=>t._zod.parse(u,A))}return t._zod.parse(c,A)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let c=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return c instanceof Promise?c.then(u=>o(u,s,a)):o(c,s,a)}let A=t._zod.parse(s,a);if(A instanceof Promise){if(a.async===!1)throw new zA;return A.then(c=>i(c,n,a))}return i(A,n,a)}}St(t,"~standard",()=>({validate:i=>{try{let o=Om(t,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return pB(t,i).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),kp=te("$ZodString",(t,e)=>{It.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??ZO(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),wr=te("$ZodStringFormat",(t,e)=>{mB.init(t,e),kp.init(t,e)}),lG=te("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=UO),wr.init(t,e)}),gG=te("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Fp(n))}else e.pattern??(e.pattern=Fp());wr.init(t,e)}),pG=te("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=OO),wr.init(t,e)}),dG=te("$ZodURL",(t,e)=>{wr.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),fG=te("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=GO()),wr.init(t,e)}),mG=te("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=_O),wr.init(t,e)}),hG=te("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=RO),wr.init(t,e)}),CG=te("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=NO),wr.init(t,e)}),IG=te("$ZodULID",(t,e)=>{e.pattern??(e.pattern=TO),wr.init(t,e)}),EG=te("$ZodXID",(t,e)=>{e.pattern??(e.pattern=MO),wr.init(t,e)}),BG=te("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=PO),wr.init(t,e)}),yG=te("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=WO(e)),wr.init(t,e)}),QG=te("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=VO),wr.init(t,e)}),DG=te("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=zO(e)),wr.init(t,e)}),wG=te("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=LO),wr.init(t,e)}),bG=te("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=KO),wr.init(t,e),t._zod.bag.format="ipv4"}),vG=te("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=HO),wr.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),SG=te("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=$O(e.delimiter)),wr.init(t,e),t._zod.bag.format="mac"}),xG=te("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=JO),wr.init(t,e)}),FG=te("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=jO),wr.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});kG=te("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=YO),wr.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{ede(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});RG=te("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Jv),wr.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{DXe(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),NG=te("$ZodE164",(t,e)=>{e.pattern??(e.pattern=qO),wr.init(t,e)});TG=te("$ZodJWT",(t,e)=>{wr.init(t,e),t._zod.check=r=>{wXe(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),MG=te("$ZodCustomStringFormat",(t,e)=>{wr.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),tS=te("$ZodNumber",(t,e)=>{It.init(t,e),t._zod.pattern=t._zod.bag.pattern??jv,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...o?{received:o}:{}}),r}}),PG=te("$ZodNumberFormat",(t,e)=>{Dpe.init(t,e),tS.init(t,e)}),hB=te("$ZodBoolean",(t,e)=>{It.init(t,e),t._zod.pattern=tG,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),rS=te("$ZodBigInt",(t,e)=>{It.init(t,e),t._zod.pattern=XO,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),_G=te("$ZodBigIntFormat",(t,e)=>{wpe.init(t,e),rS.init(t,e)}),LG=te("$ZodSymbol",(t,e)=>{It.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:t}),r}}),UG=te("$ZodUndefined",(t,e)=>{It.init(t,e),t._zod.pattern=nG,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:t}),r}}),OG=te("$ZodNull",(t,e)=>{It.init(t,e),t._zod.pattern=rG,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),GG=te("$ZodAny",(t,e)=>{It.init(t,e),t._zod.parse=r=>r}),KG=te("$ZodUnknown",(t,e)=>{It.init(t,e),t._zod.parse=r=>r}),HG=te("$ZodNever",(t,e)=>{It.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),$G=te("$ZodVoid",(t,e)=>{It.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:t}),r}}),JG=te("$ZodDate",(t,e)=>{It.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:t}),r}});jG=te("$ZodArray",(t,e)=>{It.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let o=[];for(let s=0;s<i.length;s++){let a=i[s],A=e.element._zod.run({value:a,issues:[]},n);A instanceof Promise?o.push(A.then(c=>Hpe(c,r,s))):Hpe(A,r,s)}return o.length?Promise.all(o).then(()=>r):r}});nde=te("$ZodObject",(t,e)=>{if(It.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let A={...a};return Object.defineProperty(e,"shape",{value:A}),A}})}let n=Lm(()=>tde(e));St(t._zod,"propValues",()=>{let a=e.shape,A={};for(let c in a){let u=a[c]._zod;if(u.values){A[c]??(A[c]=new Set);for(let l of u.values)A[c].add(l)}}return A});let i=xp,o=e.catchall,s;t._zod.parse=(a,A)=>{s??(s=n.value);let c=a.value;if(!i(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),a;a.value={};let u=[],l=s.shape;for(let p of s.keys){let g=l[p],d=g._zod.optout==="optional",f=g._zod.run({value:c[p],issues:[]},A);f instanceof Promise?u.push(f.then(h=>eS(h,a,p,c,d))):eS(f,a,p,c,d)}return o?rde(u,c,a,A,n.value,t):u.length?Promise.all(u).then(()=>a):a}}),ide=te("$ZodObjectJIT",(t,e)=>{nde.init(t,e);let r=t._zod.parse,n=Lm(()=>tde(e)),i=p=>{let g=new Vv(["shape","payload","ctx"]),d=n.value,f=B=>{let E=Ov(B);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};g.write("const input = payload.value;");let h=Object.create(null),C=0;for(let B of d.keys)h[B]=`key_${C++}`;g.write("const newResult = {};");for(let B of d.keys){let E=h[B],y=Ov(B),b=p[B]?._zod?.optout==="optional";g.write(`const ${E} = ${f(B)};`),b?g.write(`
|
|
1777
1777
|
if (${E}.issues.length) {
|
|
@@ -1844,10 +1844,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
1844
1844
|
`):void 0,oldContent:u.length>0?u.join(`
|
|
1845
1845
|
`):void 0})}let f=d.substring(4).split(" ")[0],h=eut(f);d.startsWith("--- ")?(o=h,i=h,a=0,A=0,c=[],u=[],s=null,l=f==="/dev/null",p=!1):d.startsWith("+++ ")&&(p=f==="/dev/null",f==="/dev/null"?i=o:i=h);continue}else{if(d.startsWith("@@"))continue;d.startsWith("+")?(a++,c.push(d.substring(1)),s===null&&(s="update")):d.startsWith("-")?(A++,u.push(d.substring(1)),s===null&&(s="update")):(d.startsWith(" ")||d==="")&&(c.push(d.substring(1)),u.push(d.substring(1)))}}if(i&&s){let g;l?g="create":p?g="delete":g="update";let d=g==="delete"&&o?o:i;r.push({filePath:d,addedLines:a,removedLines:A,action:g,content:c.length>0?c.join(`
|
|
1846
1846
|
`):void 0,oldContent:u.length>0?u.join(`
|
|
1847
|
-
`):void 0})}return r}var PBe=N(()=>{"use strict";m()});var zl,_Be=N(()=>{"use strict";m();zl=(...t)=>{typeof process<"u"&&process.env.DEBUG==="true"&&console.debug("[DEBUG] ",...t)}});var rut,bh,LBe,nut,iut,out,lF,V$=N(()=>{"use strict";m();_Be();rut=()=>{if(typeof globalThis<"u"&&globalThis.crypto)return globalThis.crypto;if(typeof require<"u")try{let t=require("crypto");if(t.webcrypto)return t.webcrypto}catch{}throw new Error("Web Crypto API is not available. Requires Node.js 15+ or a browser environment.")},bh=rut(),LBe=async()=>{let t=await bh.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),e=await bh.subtle.exportKey("jwk",t);return JSON.stringify(e)},nut=async()=>bh.getRandomValues(new Uint8Array(16)),iut=async(t,e,r)=>{let n=await bh.subtle.encrypt({name:"AES-GCM",iv:e,tagLength:128},t,typeof r=="string"?new TextEncoder().encode(r):r);return Buffer.from(n)},out=async(t,e,r)=>{let n=await bh.subtle.decrypt({name:"AES-GCM",iv:e,tagLength:128},t,r);return new TextDecoder().decode(n)},lF=async t=>{try{zl("validateEncryptionKey: Validating encryption key");let e=JSON.parse(t);zl("validateEncryptionKey: Parsed JWK");let r=await bh.subtle.importKey("jwk",e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);zl("validateEncryptionKey: Imported crypto key");let n="test",i=await nut();zl("validateEncryptionKey: Generated test IV",i);let o=await iut(r,i,n);zl("validateEncryptionKey: Encrypted test data",o);let s=new Uint8Array(o);zl("validateEncryptionKey: Encrypted test data array",s);let a=await out(r,i,s);return zl("validateEncryptionKey: Decrypted test data",a),a===n}catch(e){return console.error("Could not validate encryption key:",e),!1}}});var z$,UBe,sut,OBe=N(()=>{m();z$=(t,e,r)=>{let n=t instanceof RegExp?UBe(t,r):t,i=e instanceof RegExp?UBe(e,r):e,o=n!==null&&i!=null&&sut(n,i,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+i.length)}},UBe=(t,e)=>{let r=e.match(t);return r?r[0]:null},sut=(t,e,r)=>{let n,i,o,s,a,A=r.indexOf(t),c=r.indexOf(e,A+1),u=A;if(A>=0&&c>0){if(t===e)return[A,c];for(n=[],o=r.length;u>=0&&!a;){if(u===A)n.push(u),A=r.indexOf(t,u+1);else if(n.length===1){let l=n.pop();l!==void 0&&(a=[l,c])}else i=n.pop(),i!==void 0&&i<o&&(o=i,s=c),c=r.indexOf(e,u+1);u=A<c&&A>=0?A:c}n.length&&s!==void 0&&(a=[o,s])}return a}});function W$(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function Cut(t){return t.replace(gut,GBe).replace(put,KBe).replace(dut,Z$).replace(fut,HBe).replace(mut,$Be)}function Iut(t){return t.replace(aut,"\\").replace(Aut,"{").replace(cut,"}").replace(uut,",").replace(lut,".")}function JBe(t){if(!t)return[""];let e=[],r=z$("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:o}=r,s=n.split(",");s[s.length-1]+="{"+i+"}";let a=JBe(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function jBe(t,e={}){if(!t)return[];let{max:r=hut}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),eQ(Cut(t),r,!0).map(Iut)}function Eut(t){return"{"+t+"}"}function But(t){return/^-?0\d/.test(t)}function yut(t,e){return t<=e}function Qut(t,e){return t>=e}function eQ(t,e,r){let n=[],i=z$("{","}",t);if(!i)return[t];let o=i.pre,s=i.post.length?eQ(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<s.length&&a<e;a++){let A=o+"{"+i.body+"}"+s[a];n.push(A)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),A=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=a||A,u=i.body.indexOf(",")>=0;if(!c&&!u)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+Z$+i.post,eQ(t,e,!0)):[t];let l;if(c)l=i.body.split(/\.\./);else if(l=JBe(i.body),l.length===1&&l[0]!==void 0&&(l=eQ(l[0],e,!1).map(Eut),l.length===1))return s.map(g=>i.pre+l[0]+g);let p;if(c&&l[0]!==void 0&&l[1]!==void 0){let g=W$(l[0]),d=W$(l[1]),f=Math.max(l[0].length,l[1].length),h=l.length===3&&l[2]!==void 0?Math.abs(W$(l[2])):1,C=yut;d<g&&(h*=-1,C=Qut);let B=l.some(But);p=[];for(let E=g;C(E,d);E+=h){let y;if(A)y=String.fromCharCode(E),y==="\\"&&(y="");else if(y=String(E),B){let D=f-y.length;if(D>0){let b=new Array(D+1).join("0");E<0?y="-"+b+y.slice(1):y=b+y}}p.push(y)}}else{p=[];for(let g=0;g<l.length;g++)p.push.apply(p,eQ(l[g],e,!1))}for(let g=0;g<p.length;g++)for(let d=0;d<s.length&&n.length<e;d++){let f=o+p[g]+s[d];(!r||c||f)&&n.push(f)}}return n}var GBe,KBe,Z$,HBe,$Be,aut,Aut,cut,uut,lut,gut,put,dut,fut,mut,hut,YBe=N(()=>{m();OBe();GBe="\0SLASH"+Math.random()+"\0",KBe="\0OPEN"+Math.random()+"\0",Z$="\0CLOSE"+Math.random()+"\0",HBe="\0COMMA"+Math.random()+"\0",$Be="\0PERIOD"+Math.random()+"\0",aut=new RegExp(GBe,"g"),Aut=new RegExp(KBe,"g"),cut=new RegExp(Z$,"g"),uut=new RegExp(HBe,"g"),lut=new RegExp($Be,"g"),gut=/\\\\/g,put=/\\{/g,dut=/\\}/g,fut=/\\,/g,mut=/\\\./g,hut=1e5});var tQ,qBe=N(()=>{m();tQ=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var Dut,rQ,wut,VBe,zBe,WBe=N(()=>{m();Dut={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},rQ=t=>t.replace(/[[\]\\-]/g,"\\$&"),wut=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),VBe=t=>t.join(""),zBe=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],o=r+1,s=!1,a=!1,A=!1,c=!1,u=r,l="";e:for(;o<t.length;){let f=t.charAt(o);if((f==="!"||f==="^")&&o===r+1){c=!0,o++;continue}if(f==="]"&&s&&!A){u=o+1;break}if(s=!0,f==="\\"&&!A){A=!0,o++;continue}if(f==="["&&!A){for(let[h,[C,I,B]]of Object.entries(Dut))if(t.startsWith(h,o)){if(l)return["$.",!1,t.length-r,!0];o+=h.length,B?i.push(C):n.push(C),a=a||I;continue e}}if(A=!1,l){f>l?n.push(rQ(l)+"-"+rQ(f)):f===l&&n.push(rQ(f)),l="",o++;continue}if(t.startsWith("-]",o+1)){n.push(rQ(f+"-")),o+=2;continue}if(t.startsWith("-",o+1)){l=f,o+=2;continue}n.push(rQ(f)),o++}if(u<o)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,t.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!c){let f=n[0].length===2?n[0].slice(-1):n[0];return[wut(f),!1,u-r,!1]}let p="["+(c?"^":"")+VBe(n)+"]",g="["+(c?"":"^")+VBe(i)+"]";return[n.length&&i.length?"("+p+"|"+g+")":n.length?p:g,a,u-r,!0]}});var Wl,gF=N(()=>{m();Wl=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")});var qo,but,X$,ZBe,vut,Sut,xut,XBe,Fut,pF,kut,Rut,Nut,Tut,eJ,eye,tye,Mut,Xp,tJ=N(()=>{m();WBe();gF();but=new Set(["!","?","+","*","@"]),X$=t=>but.has(t),ZBe=t=>X$(t.type),vut=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Sut=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),xut=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),XBe=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Fut="(?!(?:^|/)\\.\\.?(?:$|/))",pF="(?!\\.)",kut=new Set(["[","."]),Rut=new Set(["..","."]),Nut=new Set("().*{}+?[]^$\\!"),Tut=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),eJ="[^/]",eye=eJ+"*?",tye=eJ+"+?",Mut=0,Xp=class{type;#r;#c;#o=!1;#t=[];#A;#i;#e;#s=!1;#B;#h;#T=!1;id=++Mut;get depth(){return(this.#A?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#r.id,parent:this.#A?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,r,n={}){this.type=e,e&&(this.#c=!0),this.#A=r,this.#r=this.#A?this.#A.#r:this,this.#B=this.#r===this?n:this.#r.#B,this.#e=this.#r===this?[]:this.#r.#e,e==="!"&&!this.#r.#s&&this.#e.push(this),this.#i=this.#A?this.#A.#t.length:0}get hasMagic(){if(this.#c!==void 0)return this.#c;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#c=!0;return this.#c}toString(){return this.#h!==void 0?this.#h:this.type?this.#h=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#h=this.#t.map(e=>String(e)).join("")}#x(){if(this!==this.#r)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#e.pop();){if(e.type!=="!")continue;let r=e,n=r.#A;for(;n;){for(let i=r.#i+1;!n.type&&i<n.#t.length;i++)for(let o of e.#t){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#t[i])}r=n,n=r.#A}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof qo&&r.#A===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let e=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#r||this.#r.#s&&this.#A?.type==="!")&&e.push({}),e}isStart(){if(this.#r===this)return!0;if(!this.#A?.isStart())return!1;if(this.#i===0)return!0;let e=this.#A;for(let r=0;r<this.#i;r++){let n=e.#t[r];if(!(n instanceof qo&&n.type==="!"))return!1}return!0}isEnd(){if(this.#r===this||this.#A?.type==="!")return!0;if(!this.#A?.isEnd())return!1;if(!this.type)return this.#A?.isEnd();let e=this.#A?this.#A.#t.length:0;return this.#i===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new qo(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#b(e,r,n,i,o){let s=i.maxExtglobRecursion??2,a=!1,A=!1,c=-1,u=!1;if(r.type===null){let f=n,h="";for(;f<e.length;){let C=e.charAt(f++);if(a||C==="\\"){a=!a,h+=C;continue}if(A){f===c+1?(C==="^"||C==="!")&&(u=!0):C==="]"&&!(f===c+2&&u)&&(A=!1),h+=C;continue}else if(C==="["){A=!0,c=f,u=!1,h+=C;continue}if(!i.noext&&X$(C)&&e.charAt(f)==="("&&o<=s){r.push(h),h="";let B=new qo(C,r);f=qo.#b(e,B,f,i,o+1),r.push(B);continue}h+=C}return r.push(h),f}let l=n+1,p=new qo(null,r),g=[],d="";for(;l<e.length;){let f=e.charAt(l++);if(a||f==="\\"){a=!a,d+=f;continue}if(A){l===c+1?(f==="^"||f==="!")&&(u=!0):f==="]"&&!(l===c+2&&u)&&(A=!1),d+=f;continue}else if(f==="["){A=!0,c=l,u=!1,d+=f;continue}if(!i.noext&&X$(f)&&e.charAt(l)==="("&&(o<=s||r&&r.#f(f))){let C=r&&r.#f(f)?0:1;p.push(d),d="";let I=new qo(f,p);p.push(I),l=qo.#b(e,I,l,i,o+C);continue}if(f==="|"){p.push(d),d="",g.push(p),p=new qo(null,r);continue}if(f===")")return d===""&&r.#t.length===0&&(r.#T=!0),p.push(d),d="",r.push(...g,p),l;d+=f}return r.type=null,r.#c=void 0,r.#t=[e.substring(n-1)],l}#F(e){return this.#a(e,Sut)}#a(e,r=vut){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#f(n.type,r)}#f(e,r=xut){return!!r.get(this.type)?.includes(e)}#n(e,r){let n=e.#t[0],i=new qo(null,n,this.options);i.#t.push(""),n.push(i),this.#g(e,r)}#g(e,r){let n=e.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#A=this);this.#h=void 0}#W(e){return!!XBe.get(this.type)?.has(e)}#M(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#W(r.type)}#me(e){let r=XBe.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let o of this.#t)typeof o=="object"&&(o.#A=this);this.type=i,this.#h=void 0,this.#T=!1}static fromGlob(e,r={}){let n=new qo(null,void 0,r);return qo.#b(e,n,0,r,0),n}toMMPattern(){if(this!==this.#r)return this.#r.toMMPattern();let e=this.toString(),[r,n,i,o]=this.toRegExpSource();if(!(i||this.#c||this.#B.nocase&&!this.#B.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#B.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#B}toRegExpSource(e){let r=e??!!this.#B.dot;if(this.#r===this&&(this.#L(),this.#x()),!ZBe(this)){let A=this.isStart()&&this.isEnd()&&!this.#t.some(g=>typeof g!="string"),c=this.#t.map(g=>{let[d,f,h,C]=typeof g=="string"?qo.#ie(g,this.#c,A):g.toRegExpSource(e);return this.#c=this.#c||h,this.#o=this.#o||C,d}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Rut.has(this.#t[0]))){let d=kut,f=r&&d.has(c.charAt(0))||c.startsWith("\\.")&&d.has(c.charAt(2))||c.startsWith("\\.\\.")&&d.has(c.charAt(4)),h=!r&&!e&&d.has(c.charAt(0));u=f?Fut:h?pF:""}let l="";return this.isEnd()&&this.#r.#s&&this.#A?.type==="!"&&(l="(?:$|\\/)"),[u+c+l,Wl(c),this.#c=!!this.#c,this.#o]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#H(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let A=this.toString(),c=this;return c.#t=[A],c.type=null,c.#c=void 0,[A,Wl(this.toString()),!1,!1]}let s=!n||e||r||!pF?"":this.#H(!0);s===o&&(s=""),s&&(o=`(?:${o})(?:${s})*?`);let a="";if(this.type==="!"&&this.#T)a=(this.isStart()&&!r?pF:"")+tye;else{let A=this.type==="!"?"))"+(this.isStart()&&!r&&!e?pF:"")+eye+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&s?")":this.type==="*"&&s?")?":`)${this.type}`;a=i+o+A}return[a,Wl(o),this.#c=!!this.#c,this.#o]}#L(){if(ZBe(this)){let e=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#L(),this.#a(i)?(r=!1,this.#g(i,n)):this.#F(i)?(r=!1,this.#n(i,n)):this.#M(i)&&(r=!1,this.#me(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#L();this.#h=void 0}#H(e){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,o,s]=r.toRegExpSource(e);return this.#o=this.#o||s,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#ie(e,r,n=!1){let i=!1,o="",s=!1,a=!1;for(let A=0;A<e.length;A++){let c=e.charAt(A);if(i){i=!1,o+=(Nut.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,o+=n&&/^[*]+$/.test(e)?tye:eye,r=!0;continue}else a=!1;if(c==="\\"){A===e.length-1?o+="\\\\":i=!0;continue}if(c==="["){let[u,l,p,g]=zBe(e,A);if(p){o+=u,s=s||l,A+=p-1,r=r||g;continue}}if(c==="?"){o+=eJ,r=!0;continue}o+=Tut(c)}return[o,Wl(e),!!r,s]}};qo=Xp});var rJ,nJ=N(()=>{m();rJ=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var Ri,Put,_ut,Lut,Uut,Out,Gut,Kut,Hut,$ut,Jut,jut,Yut,qut,Vut,zut,Wut,Zut,Xut,iye,oye,sye,rye,elt,ro,tlt,rlt,nlt,ilt,olt,ra,slt,aye,alt,Alt,nye,clt,vh,Aye=N(()=>{m();YBe();qBe();tJ();nJ();gF();tJ();nJ();gF();Ri=(t,e,r={})=>(tQ(e),!r.nocomment&&e.charAt(0)==="#"?!1:new vh(e,r).match(t)),Put=/^\*+([^+@!?\*\[\(]*)$/,_ut=t=>e=>!e.startsWith(".")&&e.endsWith(t),Lut=t=>e=>e.endsWith(t),Uut=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Out=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Gut=/^\*+\.\*+$/,Kut=t=>!t.startsWith(".")&&t.includes("."),Hut=t=>t!=="."&&t!==".."&&t.includes("."),$ut=/^\.\*+$/,Jut=t=>t!=="."&&t!==".."&&t.startsWith("."),jut=/^\*+$/,Yut=t=>t.length!==0&&!t.startsWith("."),qut=t=>t.length!==0&&t!=="."&&t!=="..",Vut=/^\?+([^+@!?\*\[\(]*)?$/,zut=([t,e=""])=>{let r=iye([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Wut=([t,e=""])=>{let r=oye([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Zut=([t,e=""])=>{let r=oye([t]);return e?n=>r(n)&&n.endsWith(e):r},Xut=([t,e=""])=>{let r=iye([t]);return e?n=>r(n)&&n.endsWith(e):r},iye=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},oye=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},sye=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",rye={win32:{sep:"\\"},posix:{sep:"/"}},elt=sye==="win32"?rye.win32.sep:rye.posix.sep;Ri.sep=elt;ro=Symbol("globstar **");Ri.GLOBSTAR=ro;tlt="[^/]",rlt=tlt+"*?",nlt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ilt="(?:(?!(?:\\/|^)\\.).)*?",olt=(t,e={})=>r=>Ri(r,t,e);Ri.filter=olt;ra=(t,e={})=>Object.assign({},t,e),slt=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Ri;let e=Ri;return Object.assign((n,i,o={})=>e(n,i,ra(t,o)),{Minimatch:class extends e.Minimatch{constructor(i,o={}){super(i,ra(t,o))}static defaults(i){return e.defaults(ra(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,o,s={}){super(i,o,ra(t,s))}static fromGlob(i,o={}){return e.AST.fromGlob(i,ra(t,o))}},unescape:(n,i={})=>e.unescape(n,ra(t,i)),escape:(n,i={})=>e.escape(n,ra(t,i)),filter:(n,i={})=>e.filter(n,ra(t,i)),defaults:n=>e.defaults(ra(t,n)),makeRe:(n,i={})=>e.makeRe(n,ra(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,ra(t,i)),match:(n,i,o={})=>e.match(n,i,ra(t,o)),sep:e.sep,GLOBSTAR:ro})};Ri.defaults=slt;aye=(t,e={})=>(tQ(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:jBe(t,{max:e.braceExpandMax}));Ri.braceExpand=aye;alt=(t,e={})=>new vh(t,e).makeRe();Ri.makeRe=alt;Alt=(t,e,r={})=>{let n=new vh(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};Ri.match=Alt;nye=/[?*]|[+@!]\(.*?\)|\[|\]/,clt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),vh=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){tQ(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||sye,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((o,s,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let A=o[0]===""&&o[1]===""&&(o[2]==="?"||!nye.test(o[2]))&&!nye.test(o[3]),c=/^[a-z]:/i.test(o[0]);if(A)return[...o.slice(0,4),...o.slice(4).map(u=>this.parse(u))];if(c)return[o[0],...o.slice(1).map(u=>this.parse(u))]}return o.map(A=>this.parse(A))});if(this.debug(this.pattern,i),this.set=i.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let s=this.set[o];s[0]===""&&s[1]===""&&this.globParts[o][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[n][i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let o=n[n.length-1];return i==="**"&&o==="**"?n:i===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let o=e[i];i===1&&o===""&&e[0]===""||(o==="."||o==="")&&(r=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(r=!0,e.splice(n-1,2),n-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let s=i;for(;n[s+1]==="**";)s++;s>i&&n.splice(i+1,s-i);let a=n[i+1],A=n[i+2],c=n[i+3];if(a!==".."||!A||A==="."||A===".."||!c||c==="."||c==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let s=1;s<n.length-1;s++){let a=n[s];s===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(s,1),s--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let s=n[o-1];if(s&&s!=="."&&s!==".."&&s!=="**"){r=!0;let A=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...A),n.length===0&&n.push(""),o-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let n=r+1;n<e.length;n++){let i=this.partsMatch(e[r],e[n],!this.preserveMultipleSlashes);if(i){e[r]=[],e[n]=i;break}}return e.filter(r=>r.length)}partsMatch(e,r,n=!1){let i=0,o=0,s=[],a="";for(;i<e.length&&o<r.length;)if(e[i]===r[o])s.push(a==="b"?r[o]:e[i]),i++,o++;else if(n&&e[i]==="**"&&r[o]===e[i+1])s.push(e[i]),i++;else if(n&&r[o]==="**"&&e[i]===r[o+1])s.push(r[o]),o++;else if(e[i]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(a==="b")return!1;a="a",s.push(e[i]),i++,o++}else if(r[o]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",s.push(r[o]),i++,o++}else return!1;return e.length===r.length&&s}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=e.slice(n)),this.negate=r}matchOne(e,r,n=!1){let i=0,o=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),A=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),c=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!c&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),l=A?3:a?0:void 0,p=u?3:c?0:void 0;if(typeof l=="number"&&typeof p=="number"){let[g,d]=[e[l],r[p]];g.toLowerCase()===d.toLowerCase()&&(r[p]=g,o=p,i=l)}}let{optimizationLevel:s=1}=this.options;return s>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(ro)?this.#r(e,r,n,i,o):this.#o(e,r,n,i,o)}#r(e,r,n,i,o){let s=r.indexOf(ro,o),a=r.lastIndexOf(ro),[A,c,u]=n?[r.slice(o,s),r.slice(s+1),[]]:[r.slice(o,s),r.slice(s+1,a),r.slice(a+1)];if(A.length){let I=e.slice(i,i+A.length);if(!this.#o(I,A,n,0,0))return!1;i+=A.length,o+=A.length}let l=0;if(u.length){if(u.length+i>e.length)return!1;let I=e.length-u.length;if(this.#o(e,u,n,I,0))l=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(I--,!this.#o(e,u,n,I,0)))return!1;l=u.length+1}}if(!c.length){let I=!!l;for(let B=i;B<e.length-l;B++){let E=String(e[B]);if(I=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return n||I}let p=[[[],0]],g=p[0],d=0,f=[0];for(let I of c)I===ro?(f.push(d),g=[[],0],p.push(g)):(g[0].push(I),d++);let h=p.length-1,C=e.length-l;for(let I of p)I[1]=C-(f[h--]+I[0].length);return!!this.#c(e,p,i,0,n,0,!!l)}#c(e,r,n,i,o,s,a){let A=r[i];if(!A){for(let l=n;l<e.length;l++){a=!0;let p=e[l];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return a}let[c,u]=A;for(;n<=u;){if(this.#o(e.slice(0,n+c.length),c,o,n,0)&&s<this.maxGlobstarRecursion){let g=this.#c(e,r,n+c.length,i+1,o,s+1,a);if(g!==!1)return g}let p=e[n];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;n++}return o||null}#o(e,r,n,i,o){let s,a,A,c;for(s=i,a=o,c=e.length,A=r.length;s<c&&a<A;s++,a++){this.debug("matchOne loop");let u=r[a],l=e[s];if(this.debug(r,u,l),u===!1||u===ro)return!1;let p;if(typeof u=="string"?(p=l===u,this.debug("string match",u,l,p)):(p=u.test(l),this.debug("pattern match",u,l,p)),!p)return!1}if(s===c&&a===A)return!0;if(s===c)return n;if(a===A)return s===c-1&&e[s]==="";throw new Error("wtf?")}braceExpand(){return aye(this.pattern,this.options)}parse(e){tQ(e);let r=this.options;if(e==="**")return ro;if(e==="")return"";let n,i=null;(n=e.match(jut))?i=r.dot?qut:Yut:(n=e.match(Put))?i=(r.nocase?r.dot?Out:Uut:r.dot?Lut:_ut)(n[1]):(n=e.match(Vut))?i=(r.nocase?r.dot?Wut:zut:r.dot?Zut:Xut)(n):(n=e.match(Gut))?i=r.dot?Hut:Kut:(n=e.match($ut))&&(i=Jut);let o=Xp.fromGlob(e,this.options).toMMPattern();return i&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:i}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?rlt:r.dot?nlt:ilt,i=new Set(r.nocase?["i"]:[]),o=e.map(A=>{let c=A.map(l=>{if(l instanceof RegExp)for(let p of l.flags.split(""))i.add(p);return typeof l=="string"?clt(l):l===ro?ro:l._src});c.forEach((l,p)=>{let g=c[p+1],d=c[p-1];l!==ro||d===ro||(d===void 0?g!==void 0&&g!==ro?c[p+1]="(?:\\/|"+n+"\\/)?"+g:c[p]=n:g===void 0?c[p-1]=d+"(?:\\/|\\/"+n+")?":g!==ro&&(c[p-1]=d+"(?:\\/|\\/"+n+"\\/)"+g,c[p+1]=ro))});let u=c.filter(l=>l!==ro);if(this.partial&&u.length>=1){let l=[];for(let p=1;p<=u.length;p++)l.push(u.slice(0,p).join("/"));return"(?:"+l.join("|")+")"}return u.join("/")}).join("|"),[s,a]=e.length>1?["(?:",")"]:["",""];o="^"+s+o+a+"$",this.partial&&(o="^(?:\\/|"+s+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let o=this.set;this.debug(this.pattern,"set",o);let s=i[i.length-1];if(!s)for(let a=i.length-2;!s&&a>=0;a--)s=i[a];for(let a=0;a<o.length;a++){let A=o[a],c=i;if(n.matchBase&&A.length===1&&(c=[s]),this.matchOne(c,A,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Ri.defaults(e).Minimatch}};Ri.AST=Xp;Ri.Minimatch=vh;Ri.escape=rJ;Ri.unescape=Wl});async function ult(t,e,r){let n=t.builderPublicKey;if(!n)return[];let i=new URL(`${Oe}/projects/memories`);i.searchParams.set("apiKey",n),i.searchParams.set("projectId",e),t.userId&&i.searchParams.set("userId",t.userId);let o={"Content-Type":"application/json"};t.builderPrivateKey&&(o.Authorization=`Bearer ${t.builderPrivateKey}`);let a=await(await Ue(i,{method:"GET",headers:o,keepalive:!0,signal:r})).json();return Array.isArray(a?.memories)?a.memories:[]}function llt(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function cye(t){return t.replace(/[*?{}[\]!]/g,"").replace(/\/+/g,"/").toLowerCase()}async function glt(t,e){let r=new Map;for(let i of t){let o=i.category||"general";r.has(o)||r.set(o,[]),r.get(o).push(i)}if(r.size===0)return;await dF.default.mkdir(e,{recursive:!0});let n=[];for(let[i,o]of r){let s=`${llt(i)}.md`,a=uye.default.join(e,s),A=o.filter(g=>g.glob),c=o.filter(g=>!g.glob),u=new Map;for(let g of A){let d=g.glob;u.has(d)||u.set(d,[]),u.get(d).push(g)}let l=[...u.keys()].sort((g,d)=>cye(g).localeCompare(cye(d))),p=[];if(p.push(`# ${i}`),p.push(""),l.length>0){p.push("## File-specific"),p.push("");for(let g of l){let d=u.get(g);p.push(`### \`${g}\``),p.push("");for(let f of d)p.push(`- **When**: ${f.when}`),p.push(` ${f.memory}`),p.push("")}}if(c.length>0){p.push("## General"),p.push("");for(let g of c)p.push(`- **When**: ${g.when}`),p.push(` ${g.memory}`),p.push("")}n.push(dF.default.writeFile(a,p.join(`
|
|
1848
|
-
`),"utf-8"))}await Promise.all(n)}function plt(t){let e=[],r=0,n=0;for(let i=0;i<t.length;i++){let o=t[i];o==="{"?r++:o==="}"&&r>0?r--:o===","&&r===0&&(e.push(t.slice(n,i)),n=i+1)}return e.push(t.slice(n)),e.map(i=>i.trim()).filter(Boolean)}function lye(t,e){if(!e)return[];let r=e.replace(/\\/g,"/");return t.filter(n=>n.glob?plt(n.glob).some(o=>{try{return Ri(r,o.replace(/\\/g,"/"),{matchBase:!0})}catch{return!1}}):!1)}async function gye(t,e,r,n){try{return await ult(e,r,n)}catch(i){return t.Sentry?.captureException(new Error("Failed to load memories",{cause:i})),[]}}async function fF(t,e,r){try{await dF.default.rm(r,{recursive:!0,force:!0}),e.length>0&&await glt(e,r)}catch(n){t.Sentry?.captureException(new Error("Failed to sync memories to disk",{cause:n}))}}var dF,uye,iJ=N(()=>{"use strict";m();dF=z(require("node:fs/promises"),1),uye=z(require("node:path"),1);Aye();gn();nn()});function dlt(){if(nQ!==void 0)return nQ;try{return nQ=require("prettier"),nQ}catch{return nQ=null,null}}function na(t){try{return JSON.stringify(t)}catch{return String(t)}}var Zl,oJ,hF,dye,EF,CF,fye,nQ,pye,flt,Xa,mF,xh=N(()=>{"use strict";m();wp();tge();Bn();ns();gn();nn();Zl=z(require("node:fs"),1),oJ=require("node:crypto");$2();oge();cge();z2();qU();dE();pge();hF=z(require("node:os"),1);eO();Ji();Pt();Bge();Sv();Nge();Pge();Ls();nO();dye=z(require("chokidar"),1);oO();gJ();Gge();fJ();mr();EF=z(require("node:events"),1);EE();CF=require("node:crypto");lm();Jge();ZU();CE();ap();MBe();Vc();PBe();fye=require("node:fs/promises");V$();IE();vE();HA();iJ();La();tv();ob();kv();iO();pye=["ask-to-continue","credits-limit-daily","credits-limit-monthly","credits-limit-other","invalid-last-message"],flt=["initial-with-url","initial-without-url","success"],Xa=class t{#
|
|
1847
|
+
`):void 0})}return r}var PBe=N(()=>{"use strict";m()});var zl,_Be=N(()=>{"use strict";m();zl=(...t)=>{typeof process<"u"&&process.env.DEBUG==="true"&&console.debug("[DEBUG] ",...t)}});var rut,bh,LBe,nut,iut,out,lF,V$=N(()=>{"use strict";m();_Be();rut=()=>{if(typeof globalThis<"u"&&globalThis.crypto)return globalThis.crypto;if(typeof require<"u")try{let t=require("crypto");if(t.webcrypto)return t.webcrypto}catch{}throw new Error("Web Crypto API is not available. Requires Node.js 15+ or a browser environment.")},bh=rut(),LBe=async()=>{let t=await bh.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),e=await bh.subtle.exportKey("jwk",t);return JSON.stringify(e)},nut=async()=>bh.getRandomValues(new Uint8Array(16)),iut=async(t,e,r)=>{let n=await bh.subtle.encrypt({name:"AES-GCM",iv:e,tagLength:128},t,typeof r=="string"?new TextEncoder().encode(r):r);return Buffer.from(n)},out=async(t,e,r)=>{let n=await bh.subtle.decrypt({name:"AES-GCM",iv:e,tagLength:128},t,r);return new TextDecoder().decode(n)},lF=async t=>{try{zl("validateEncryptionKey: Validating encryption key");let e=JSON.parse(t);zl("validateEncryptionKey: Parsed JWK");let r=await bh.subtle.importKey("jwk",e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);zl("validateEncryptionKey: Imported crypto key");let n="test",i=await nut();zl("validateEncryptionKey: Generated test IV",i);let o=await iut(r,i,n);zl("validateEncryptionKey: Encrypted test data",o);let s=new Uint8Array(o);zl("validateEncryptionKey: Encrypted test data array",s);let a=await out(r,i,s);return zl("validateEncryptionKey: Decrypted test data",a),a===n}catch(e){return console.error("Could not validate encryption key:",e),!1}}});var z$,UBe,sut,OBe=N(()=>{m();z$=(t,e,r)=>{let n=t instanceof RegExp?UBe(t,r):t,i=e instanceof RegExp?UBe(e,r):e,o=n!==null&&i!=null&&sut(n,i,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+i.length)}},UBe=(t,e)=>{let r=e.match(t);return r?r[0]:null},sut=(t,e,r)=>{let n,i,o,s,a,A=r.indexOf(t),c=r.indexOf(e,A+1),u=A;if(A>=0&&c>0){if(t===e)return[A,c];for(n=[],o=r.length;u>=0&&!a;){if(u===A)n.push(u),A=r.indexOf(t,u+1);else if(n.length===1){let l=n.pop();l!==void 0&&(a=[l,c])}else i=n.pop(),i!==void 0&&i<o&&(o=i,s=c),c=r.indexOf(e,u+1);u=A<c&&A>=0?A:c}n.length&&s!==void 0&&(a=[o,s])}return a}});function W$(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function Cut(t){return t.replace(gut,GBe).replace(put,KBe).replace(dut,Z$).replace(fut,HBe).replace(mut,$Be)}function Iut(t){return t.replace(aut,"\\").replace(Aut,"{").replace(cut,"}").replace(uut,",").replace(lut,".")}function JBe(t){if(!t)return[""];let e=[],r=z$("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:o}=r,s=n.split(",");s[s.length-1]+="{"+i+"}";let a=JBe(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function jBe(t,e={}){if(!t)return[];let{max:r=hut}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),eQ(Cut(t),r,!0).map(Iut)}function Eut(t){return"{"+t+"}"}function But(t){return/^-?0\d/.test(t)}function yut(t,e){return t<=e}function Qut(t,e){return t>=e}function eQ(t,e,r){let n=[],i=z$("{","}",t);if(!i)return[t];let o=i.pre,s=i.post.length?eQ(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<s.length&&a<e;a++){let A=o+"{"+i.body+"}"+s[a];n.push(A)}else{let a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),A=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=a||A,u=i.body.indexOf(",")>=0;if(!c&&!u)return i.post.match(/,(?!,).*\}/)?(t=i.pre+"{"+i.body+Z$+i.post,eQ(t,e,!0)):[t];let l;if(c)l=i.body.split(/\.\./);else if(l=JBe(i.body),l.length===1&&l[0]!==void 0&&(l=eQ(l[0],e,!1).map(Eut),l.length===1))return s.map(g=>i.pre+l[0]+g);let p;if(c&&l[0]!==void 0&&l[1]!==void 0){let g=W$(l[0]),d=W$(l[1]),f=Math.max(l[0].length,l[1].length),h=l.length===3&&l[2]!==void 0?Math.abs(W$(l[2])):1,C=yut;d<g&&(h*=-1,C=Qut);let B=l.some(But);p=[];for(let E=g;C(E,d);E+=h){let y;if(A)y=String.fromCharCode(E),y==="\\"&&(y="");else if(y=String(E),B){let D=f-y.length;if(D>0){let b=new Array(D+1).join("0");E<0?y="-"+b+y.slice(1):y=b+y}}p.push(y)}}else{p=[];for(let g=0;g<l.length;g++)p.push.apply(p,eQ(l[g],e,!1))}for(let g=0;g<p.length;g++)for(let d=0;d<s.length&&n.length<e;d++){let f=o+p[g]+s[d];(!r||c||f)&&n.push(f)}}return n}var GBe,KBe,Z$,HBe,$Be,aut,Aut,cut,uut,lut,gut,put,dut,fut,mut,hut,YBe=N(()=>{m();OBe();GBe="\0SLASH"+Math.random()+"\0",KBe="\0OPEN"+Math.random()+"\0",Z$="\0CLOSE"+Math.random()+"\0",HBe="\0COMMA"+Math.random()+"\0",$Be="\0PERIOD"+Math.random()+"\0",aut=new RegExp(GBe,"g"),Aut=new RegExp(KBe,"g"),cut=new RegExp(Z$,"g"),uut=new RegExp(HBe,"g"),lut=new RegExp($Be,"g"),gut=/\\\\/g,put=/\\{/g,dut=/\\}/g,fut=/\\,/g,mut=/\\\./g,hut=1e5});var tQ,qBe=N(()=>{m();tQ=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var Dut,rQ,wut,VBe,zBe,WBe=N(()=>{m();Dut={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},rQ=t=>t.replace(/[[\]\\-]/g,"\\$&"),wut=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),VBe=t=>t.join(""),zBe=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],o=r+1,s=!1,a=!1,A=!1,c=!1,u=r,l="";e:for(;o<t.length;){let f=t.charAt(o);if((f==="!"||f==="^")&&o===r+1){c=!0,o++;continue}if(f==="]"&&s&&!A){u=o+1;break}if(s=!0,f==="\\"&&!A){A=!0,o++;continue}if(f==="["&&!A){for(let[h,[C,I,B]]of Object.entries(Dut))if(t.startsWith(h,o)){if(l)return["$.",!1,t.length-r,!0];o+=h.length,B?i.push(C):n.push(C),a=a||I;continue e}}if(A=!1,l){f>l?n.push(rQ(l)+"-"+rQ(f)):f===l&&n.push(rQ(f)),l="",o++;continue}if(t.startsWith("-]",o+1)){n.push(rQ(f+"-")),o+=2;continue}if(t.startsWith("-",o+1)){l=f,o+=2;continue}n.push(rQ(f)),o++}if(u<o)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,t.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!c){let f=n[0].length===2?n[0].slice(-1):n[0];return[wut(f),!1,u-r,!1]}let p="["+(c?"^":"")+VBe(n)+"]",g="["+(c?"":"^")+VBe(i)+"]";return[n.length&&i.length?"("+p+"|"+g+")":n.length?p:g,a,u-r,!0]}});var Wl,gF=N(()=>{m();Wl=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")});var qo,but,X$,ZBe,vut,Sut,xut,XBe,Fut,pF,kut,Rut,Nut,Tut,eJ,eye,tye,Mut,Xp,tJ=N(()=>{m();WBe();gF();but=new Set(["!","?","+","*","@"]),X$=t=>but.has(t),ZBe=t=>X$(t.type),vut=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Sut=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),xut=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),XBe=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Fut="(?!(?:^|/)\\.\\.?(?:$|/))",pF="(?!\\.)",kut=new Set(["[","."]),Rut=new Set(["..","."]),Nut=new Set("().*{}+?[]^$\\!"),Tut=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),eJ="[^/]",eye=eJ+"*?",tye=eJ+"+?",Mut=0,Xp=class{type;#n;#c;#o=!1;#t=[];#A;#i;#e;#s=!1;#B;#C;#T=!1;id=++Mut;get depth(){return(this.#A?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#n.id,parent:this.#A?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(e,r,n={}){this.type=e,e&&(this.#c=!0),this.#A=r,this.#n=this.#A?this.#A.#n:this,this.#B=this.#n===this?n:this.#n.#B,this.#e=this.#n===this?[]:this.#n.#e,e==="!"&&!this.#n.#s&&this.#e.push(this),this.#i=this.#A?this.#A.#t.length:0}get hasMagic(){if(this.#c!==void 0)return this.#c;for(let e of this.#t)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#c=!0;return this.#c}toString(){return this.#C!==void 0?this.#C:this.type?this.#C=this.type+"("+this.#t.map(e=>String(e)).join("|")+")":this.#C=this.#t.map(e=>String(e)).join("")}#x(){if(this!==this.#n)throw new Error("should only call on root");if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#e.pop();){if(e.type!=="!")continue;let r=e,n=r.#A;for(;n;){for(let i=r.#i+1;!n.type&&i<n.#t.length;i++)for(let o of e.#t){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#t[i])}r=n,n=r.#A}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof qo&&r.#A===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let e=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#s&&this.#A?.type==="!")&&e.push({}),e}isStart(){if(this.#n===this)return!0;if(!this.#A?.isStart())return!1;if(this.#i===0)return!0;let e=this.#A;for(let r=0;r<this.#i;r++){let n=e.#t[r];if(!(n instanceof qo&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#A?.type==="!")return!0;if(!this.#A?.isEnd())return!1;if(!this.type)return this.#A?.isEnd();let e=this.#A?this.#A.#t.length:0;return this.#i===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new qo(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#b(e,r,n,i,o){let s=i.maxExtglobRecursion??2,a=!1,A=!1,c=-1,u=!1;if(r.type===null){let f=n,h="";for(;f<e.length;){let C=e.charAt(f++);if(a||C==="\\"){a=!a,h+=C;continue}if(A){f===c+1?(C==="^"||C==="!")&&(u=!0):C==="]"&&!(f===c+2&&u)&&(A=!1),h+=C;continue}else if(C==="["){A=!0,c=f,u=!1,h+=C;continue}if(!i.noext&&X$(C)&&e.charAt(f)==="("&&o<=s){r.push(h),h="";let B=new qo(C,r);f=qo.#b(e,B,f,i,o+1),r.push(B);continue}h+=C}return r.push(h),f}let l=n+1,p=new qo(null,r),g=[],d="";for(;l<e.length;){let f=e.charAt(l++);if(a||f==="\\"){a=!a,d+=f;continue}if(A){l===c+1?(f==="^"||f==="!")&&(u=!0):f==="]"&&!(l===c+2&&u)&&(A=!1),d+=f;continue}else if(f==="["){A=!0,c=l,u=!1,d+=f;continue}if(!i.noext&&X$(f)&&e.charAt(l)==="("&&(o<=s||r&&r.#f(f))){let C=r&&r.#f(f)?0:1;p.push(d),d="";let I=new qo(f,p);p.push(I),l=qo.#b(e,I,l,i,o+C);continue}if(f==="|"){p.push(d),d="",g.push(p),p=new qo(null,r);continue}if(f===")")return d===""&&r.#t.length===0&&(r.#T=!0),p.push(d),d="",r.push(...g,p),l;d+=f}return r.type=null,r.#c=void 0,r.#t=[e.substring(n-1)],l}#F(e){return this.#a(e,Sut)}#a(e,r=vut){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null)return!1;let n=e.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#f(n.type,r)}#f(e,r=xut){return!!r.get(this.type)?.includes(e)}#r(e,r){let n=e.#t[0],i=new qo(null,n,this.options);i.#t.push(""),n.push(i),this.#g(e,r)}#g(e,r){let n=e.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#A=this);this.#C=void 0}#W(e){return!!XBe.get(this.type)?.has(e)}#M(e){if(!e||typeof e!="object"||e.type!==null||e.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=e.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#W(r.type)}#me(e){let r=XBe.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let o of this.#t)typeof o=="object"&&(o.#A=this);this.type=i,this.#C=void 0,this.#T=!1}static fromGlob(e,r={}){let n=new qo(null,void 0,r);return qo.#b(e,n,0,r,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[r,n,i,o]=this.toRegExpSource();if(!(i||this.#c||this.#B.nocase&&!this.#B.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#B.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#B}toRegExpSource(e){let r=e??!!this.#B.dot;if(this.#n===this&&(this.#L(),this.#x()),!ZBe(this)){let A=this.isStart()&&this.isEnd()&&!this.#t.some(g=>typeof g!="string"),c=this.#t.map(g=>{let[d,f,h,C]=typeof g=="string"?qo.#ie(g,this.#c,A):g.toRegExpSource(e);return this.#c=this.#c||h,this.#o=this.#o||C,d}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&Rut.has(this.#t[0]))){let d=kut,f=r&&d.has(c.charAt(0))||c.startsWith("\\.")&&d.has(c.charAt(2))||c.startsWith("\\.\\.")&&d.has(c.charAt(4)),h=!r&&!e&&d.has(c.charAt(0));u=f?Fut:h?pF:""}let l="";return this.isEnd()&&this.#n.#s&&this.#A?.type==="!"&&(l="(?:$|\\/)"),[u+c+l,Wl(c),this.#c=!!this.#c,this.#o]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#H(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let A=this.toString(),c=this;return c.#t=[A],c.type=null,c.#c=void 0,[A,Wl(this.toString()),!1,!1]}let s=!n||e||r||!pF?"":this.#H(!0);s===o&&(s=""),s&&(o=`(?:${o})(?:${s})*?`);let a="";if(this.type==="!"&&this.#T)a=(this.isStart()&&!r?pF:"")+tye;else{let A=this.type==="!"?"))"+(this.isStart()&&!r&&!e?pF:"")+eye+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&s?")":this.type==="*"&&s?")?":`)${this.type}`;a=i+o+A}return[a,Wl(o),this.#c=!!this.#c,this.#o]}#L(){if(ZBe(this)){let e=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#L(),this.#a(i)?(r=!1,this.#g(i,n)):this.#F(i)?(r=!1,this.#r(i,n)):this.#M(i)&&(r=!1,this.#me(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#L();this.#C=void 0}#H(e){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,o,s]=r.toRegExpSource(e);return this.#o=this.#o||s,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#ie(e,r,n=!1){let i=!1,o="",s=!1,a=!1;for(let A=0;A<e.length;A++){let c=e.charAt(A);if(i){i=!1,o+=(Nut.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,o+=n&&/^[*]+$/.test(e)?tye:eye,r=!0;continue}else a=!1;if(c==="\\"){A===e.length-1?o+="\\\\":i=!0;continue}if(c==="["){let[u,l,p,g]=zBe(e,A);if(p){o+=u,s=s||l,A+=p-1,r=r||g;continue}}if(c==="?"){o+=eJ,r=!0;continue}o+=Tut(c)}return[o,Wl(e),!!r,s]}};qo=Xp});var rJ,nJ=N(()=>{m();rJ=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var Ri,Put,_ut,Lut,Uut,Out,Gut,Kut,Hut,$ut,Jut,jut,Yut,qut,Vut,zut,Wut,Zut,Xut,iye,oye,sye,rye,elt,ro,tlt,rlt,nlt,ilt,olt,ra,slt,aye,alt,Alt,nye,clt,vh,Aye=N(()=>{m();YBe();qBe();tJ();nJ();gF();tJ();nJ();gF();Ri=(t,e,r={})=>(tQ(e),!r.nocomment&&e.charAt(0)==="#"?!1:new vh(e,r).match(t)),Put=/^\*+([^+@!?\*\[\(]*)$/,_ut=t=>e=>!e.startsWith(".")&&e.endsWith(t),Lut=t=>e=>e.endsWith(t),Uut=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Out=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Gut=/^\*+\.\*+$/,Kut=t=>!t.startsWith(".")&&t.includes("."),Hut=t=>t!=="."&&t!==".."&&t.includes("."),$ut=/^\.\*+$/,Jut=t=>t!=="."&&t!==".."&&t.startsWith("."),jut=/^\*+$/,Yut=t=>t.length!==0&&!t.startsWith("."),qut=t=>t.length!==0&&t!=="."&&t!=="..",Vut=/^\?+([^+@!?\*\[\(]*)?$/,zut=([t,e=""])=>{let r=iye([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Wut=([t,e=""])=>{let r=oye([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Zut=([t,e=""])=>{let r=oye([t]);return e?n=>r(n)&&n.endsWith(e):r},Xut=([t,e=""])=>{let r=iye([t]);return e?n=>r(n)&&n.endsWith(e):r},iye=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},oye=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},sye=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",rye={win32:{sep:"\\"},posix:{sep:"/"}},elt=sye==="win32"?rye.win32.sep:rye.posix.sep;Ri.sep=elt;ro=Symbol("globstar **");Ri.GLOBSTAR=ro;tlt="[^/]",rlt=tlt+"*?",nlt="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",ilt="(?:(?!(?:\\/|^)\\.).)*?",olt=(t,e={})=>r=>Ri(r,t,e);Ri.filter=olt;ra=(t,e={})=>Object.assign({},t,e),slt=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return Ri;let e=Ri;return Object.assign((n,i,o={})=>e(n,i,ra(t,o)),{Minimatch:class extends e.Minimatch{constructor(i,o={}){super(i,ra(t,o))}static defaults(i){return e.defaults(ra(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,o,s={}){super(i,o,ra(t,s))}static fromGlob(i,o={}){return e.AST.fromGlob(i,ra(t,o))}},unescape:(n,i={})=>e.unescape(n,ra(t,i)),escape:(n,i={})=>e.escape(n,ra(t,i)),filter:(n,i={})=>e.filter(n,ra(t,i)),defaults:n=>e.defaults(ra(t,n)),makeRe:(n,i={})=>e.makeRe(n,ra(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,ra(t,i)),match:(n,i,o={})=>e.match(n,i,ra(t,o)),sep:e.sep,GLOBSTAR:ro})};Ri.defaults=slt;aye=(t,e={})=>(tQ(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:jBe(t,{max:e.braceExpandMax}));Ri.braceExpand=aye;alt=(t,e={})=>new vh(t,e).makeRe();Ri.makeRe=alt;Alt=(t,e,r={})=>{let n=new vh(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};Ri.match=Alt;nye=/[?*]|[+@!]\(.*?\)|\[|\]/,clt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),vh=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){tQ(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||sye,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((o,s,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let A=o[0]===""&&o[1]===""&&(o[2]==="?"||!nye.test(o[2]))&&!nye.test(o[3]),c=/^[a-z]:/i.test(o[0]);if(A)return[...o.slice(0,4),...o.slice(4).map(u=>this.parse(u))];if(c)return[o[0],...o.slice(1).map(u=>this.parse(u))]}return o.map(A=>this.parse(A))});if(this.debug(this.pattern,i),this.set=i.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let s=this.set[o];s[0]===""&&s[1]===""&&this.globParts[o][2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3])&&(s[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[n][i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let o=n[n.length-1];return i==="**"&&o==="**"?n:i===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let o=e[i];i===1&&o===""&&e[0]===""||(o==="."||o==="")&&(r=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(r=!0,e.splice(n-1,2),n-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let s=i;for(;n[s+1]==="**";)s++;s>i&&n.splice(i+1,s-i);let a=n[i+1],A=n[i+2],c=n[i+3];if(a!==".."||!A||A==="."||A===".."||!c||c==="."||c==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let s=1;s<n.length-1;s++){let a=n[s];s===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(s,1),s--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let s=n[o-1];if(s&&s!=="."&&s!==".."&&s!=="**"){r=!0;let A=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...A),n.length===0&&n.push(""),o-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let n=r+1;n<e.length;n++){let i=this.partsMatch(e[r],e[n],!this.preserveMultipleSlashes);if(i){e[r]=[],e[n]=i;break}}return e.filter(r=>r.length)}partsMatch(e,r,n=!1){let i=0,o=0,s=[],a="";for(;i<e.length&&o<r.length;)if(e[i]===r[o])s.push(a==="b"?r[o]:e[i]),i++,o++;else if(n&&e[i]==="**"&&r[o]===e[i+1])s.push(e[i]),i++;else if(n&&r[o]==="**"&&e[i]===r[o+1])s.push(r[o]),o++;else if(e[i]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(a==="b")return!1;a="a",s.push(e[i]),i++,o++}else if(r[o]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",s.push(r[o]),i++,o++}else return!1;return e.length===r.length&&s}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=e.slice(n)),this.negate=r}matchOne(e,r,n=!1){let i=0,o=0;if(this.isWindows){let a=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),A=!a&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),c=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),u=!c&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),l=A?3:a?0:void 0,p=u?3:c?0:void 0;if(typeof l=="number"&&typeof p=="number"){let[g,d]=[e[l],r[p]];g.toLowerCase()===d.toLowerCase()&&(r[p]=g,o=p,i=l)}}let{optimizationLevel:s=1}=this.options;return s>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(ro)?this.#n(e,r,n,i,o):this.#o(e,r,n,i,o)}#n(e,r,n,i,o){let s=r.indexOf(ro,o),a=r.lastIndexOf(ro),[A,c,u]=n?[r.slice(o,s),r.slice(s+1),[]]:[r.slice(o,s),r.slice(s+1,a),r.slice(a+1)];if(A.length){let I=e.slice(i,i+A.length);if(!this.#o(I,A,n,0,0))return!1;i+=A.length,o+=A.length}let l=0;if(u.length){if(u.length+i>e.length)return!1;let I=e.length-u.length;if(this.#o(e,u,n,I,0))l=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(I--,!this.#o(e,u,n,I,0)))return!1;l=u.length+1}}if(!c.length){let I=!!l;for(let B=i;B<e.length-l;B++){let E=String(e[B]);if(I=!0,E==="."||E===".."||!this.options.dot&&E.startsWith("."))return!1}return n||I}let p=[[[],0]],g=p[0],d=0,f=[0];for(let I of c)I===ro?(f.push(d),g=[[],0],p.push(g)):(g[0].push(I),d++);let h=p.length-1,C=e.length-l;for(let I of p)I[1]=C-(f[h--]+I[0].length);return!!this.#c(e,p,i,0,n,0,!!l)}#c(e,r,n,i,o,s,a){let A=r[i];if(!A){for(let l=n;l<e.length;l++){a=!0;let p=e[l];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return a}let[c,u]=A;for(;n<=u;){if(this.#o(e.slice(0,n+c.length),c,o,n,0)&&s<this.maxGlobstarRecursion){let g=this.#c(e,r,n+c.length,i+1,o,s+1,a);if(g!==!1)return g}let p=e[n];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;n++}return o||null}#o(e,r,n,i,o){let s,a,A,c;for(s=i,a=o,c=e.length,A=r.length;s<c&&a<A;s++,a++){this.debug("matchOne loop");let u=r[a],l=e[s];if(this.debug(r,u,l),u===!1||u===ro)return!1;let p;if(typeof u=="string"?(p=l===u,this.debug("string match",u,l,p)):(p=u.test(l),this.debug("pattern match",u,l,p)),!p)return!1}if(s===c&&a===A)return!0;if(s===c)return n;if(a===A)return s===c-1&&e[s]==="";throw new Error("wtf?")}braceExpand(){return aye(this.pattern,this.options)}parse(e){tQ(e);let r=this.options;if(e==="**")return ro;if(e==="")return"";let n,i=null;(n=e.match(jut))?i=r.dot?qut:Yut:(n=e.match(Put))?i=(r.nocase?r.dot?Out:Uut:r.dot?Lut:_ut)(n[1]):(n=e.match(Vut))?i=(r.nocase?r.dot?Wut:zut:r.dot?Zut:Xut)(n):(n=e.match(Gut))?i=r.dot?Hut:Kut:(n=e.match($ut))&&(i=Jut);let o=Xp.fromGlob(e,this.options).toMMPattern();return i&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:i}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?rlt:r.dot?nlt:ilt,i=new Set(r.nocase?["i"]:[]),o=e.map(A=>{let c=A.map(l=>{if(l instanceof RegExp)for(let p of l.flags.split(""))i.add(p);return typeof l=="string"?clt(l):l===ro?ro:l._src});c.forEach((l,p)=>{let g=c[p+1],d=c[p-1];l!==ro||d===ro||(d===void 0?g!==void 0&&g!==ro?c[p+1]="(?:\\/|"+n+"\\/)?"+g:c[p]=n:g===void 0?c[p-1]=d+"(?:\\/|\\/"+n+")?":g!==ro&&(c[p-1]=d+"(?:\\/|\\/"+n+"\\/)"+g,c[p+1]=ro))});let u=c.filter(l=>l!==ro);if(this.partial&&u.length>=1){let l=[];for(let p=1;p<=u.length;p++)l.push(u.slice(0,p).join("/"));return"(?:"+l.join("|")+")"}return u.join("/")}).join("|"),[s,a]=e.length>1?["(?:",")"]:["",""];o="^"+s+o+a+"$",this.partial&&(o="^(?:\\/|"+s+o.slice(1,-1)+a+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let o=this.set;this.debug(this.pattern,"set",o);let s=i[i.length-1];if(!s)for(let a=i.length-2;!s&&a>=0;a--)s=i[a];for(let a=0;a<o.length;a++){let A=o[a],c=i;if(n.matchBase&&A.length===1&&(c=[s]),this.matchOne(c,A,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return Ri.defaults(e).Minimatch}};Ri.AST=Xp;Ri.Minimatch=vh;Ri.escape=rJ;Ri.unescape=Wl});async function ult(t,e,r){let n=t.builderPublicKey;if(!n)return[];let i=new URL(`${Oe}/projects/memories`);i.searchParams.set("apiKey",n),i.searchParams.set("projectId",e),t.userId&&i.searchParams.set("userId",t.userId);let o={"Content-Type":"application/json"};t.builderPrivateKey&&(o.Authorization=`Bearer ${t.builderPrivateKey}`);let a=await(await Ue(i,{method:"GET",headers:o,keepalive:!0,signal:r})).json();return Array.isArray(a?.memories)?a.memories:[]}function llt(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function cye(t){return t.replace(/[*?{}[\]!]/g,"").replace(/\/+/g,"/").toLowerCase()}async function glt(t,e){let r=new Map;for(let i of t){let o=i.category||"general";r.has(o)||r.set(o,[]),r.get(o).push(i)}if(r.size===0)return;await dF.default.mkdir(e,{recursive:!0});let n=[];for(let[i,o]of r){let s=`${llt(i)}.md`,a=uye.default.join(e,s),A=o.filter(g=>g.glob),c=o.filter(g=>!g.glob),u=new Map;for(let g of A){let d=g.glob;u.has(d)||u.set(d,[]),u.get(d).push(g)}let l=[...u.keys()].sort((g,d)=>cye(g).localeCompare(cye(d))),p=[];if(p.push(`# ${i}`),p.push(""),l.length>0){p.push("## File-specific"),p.push("");for(let g of l){let d=u.get(g);p.push(`### \`${g}\``),p.push("");for(let f of d)p.push(`- **When**: ${f.when}`),p.push(` ${f.memory}`),p.push("")}}if(c.length>0){p.push("## General"),p.push("");for(let g of c)p.push(`- **When**: ${g.when}`),p.push(` ${g.memory}`),p.push("")}n.push(dF.default.writeFile(a,p.join(`
|
|
1848
|
+
`),"utf-8"))}await Promise.all(n)}function plt(t){let e=[],r=0,n=0;for(let i=0;i<t.length;i++){let o=t[i];o==="{"?r++:o==="}"&&r>0?r--:o===","&&r===0&&(e.push(t.slice(n,i)),n=i+1)}return e.push(t.slice(n)),e.map(i=>i.trim()).filter(Boolean)}function lye(t,e){if(!e)return[];let r=e.replace(/\\/g,"/");return t.filter(n=>n.glob?plt(n.glob).some(o=>{try{return Ri(r,o.replace(/\\/g,"/"),{matchBase:!0})}catch{return!1}}):!1)}async function gye(t,e,r,n){try{return await ult(e,r,n)}catch(i){return t.Sentry?.captureException(new Error("Failed to load memories",{cause:i})),[]}}async function fF(t,e,r){try{await dF.default.rm(r,{recursive:!0,force:!0}),e.length>0&&await glt(e,r)}catch(n){t.Sentry?.captureException(new Error("Failed to sync memories to disk",{cause:n}))}}var dF,uye,iJ=N(()=>{"use strict";m();dF=z(require("node:fs/promises"),1),uye=z(require("node:path"),1);Aye();gn();nn()});function dlt(){if(nQ!==void 0)return nQ;try{return nQ=require("prettier"),nQ}catch{return nQ=null,null}}function na(t){try{return JSON.stringify(t)}catch{return String(t)}}var Zl,oJ,hF,dye,EF,CF,fye,nQ,pye,flt,Xa,mF,xh=N(()=>{"use strict";m();wp();tge();Bn();ns();gn();nn();Zl=z(require("node:fs"),1),oJ=require("node:crypto");$2();oge();cge();z2();qU();dE();pge();hF=z(require("node:os"),1);eO();Ji();Pt();Bge();Sv();Nge();Pge();Ls();nO();dye=z(require("chokidar"),1);oO();gJ();Gge();fJ();mr();EF=z(require("node:events"),1);EE();CF=require("node:crypto");lm();Jge();ZU();CE();ap();MBe();Vc();PBe();fye=require("node:fs/promises");V$();IE();vE();HA();iJ();La();tv();ob();kv();iO();pye=["ask-to-continue","credits-limit-daily","credits-limit-monthly","credits-limit-other","invalid-last-message"],flt=["initial-with-url","initial-without-url","success"],Xa=class t{#n;#c;#o;#t=[];#A;#i;#e;#s;#B;#C;#T;#x;#b;#F;#a=!!(process.env.DEBUG||process.env.FUSION_DEBUG==="true");#f=!1;#r=ke("Agent",{debug:()=>this.#a});#g=new EF.default;#W=new Map;#M;#me;#L;#H;#ie=[];#He=void 0;#ut="";#Z;#lt=Promise.resolve(void 0);#Y=[];#P;#$=[];#he;#X=new Map;#Fe=[];#oe;#_t=0;#se;#q;#d;#m;#gt;#$e;#Je;#ke=!1;#Ce;#Ie=void 0;#je;#Ye;#Re;#ae;#I;#p=[];#v;#pt;#E;#qe;#Ee;#Be=0;#Ae;#D;#dt=[];#ft=new Set;#u;#h;#y;#mt;#_;#Ve;#Ne=!1;#ht=0;#ce=null;#ue=0;#ee=!1;#k=!1;#te;#Te;#Me;#re;#Ct;#Pe;#le=[];#_e=[];#ze=!1;#It=new Set;#Et=new Map;#Le=new Map;#ye={};#U={};#Bt=!1;#yt;#We=!1;#Lt=new Set;#Qe;#R={};#Ze;#Xe=[];#De=null;#Qt=void 0;#w=new Map;#Q={watcher:null,listeners:new Set,debounceMs:300,pendingEvents:[]};#Dt=!1;#l=null;#Ue=new Set;#Oe=new Map;#we=new Map;#be=new Map;static#wt=3e4;get primaryGitPath(){return this.#p[0]?.path||this.#I}#ve(e){if(!e)return this.primaryGitPath;let r=this.#p.find(n=>n.folderName===e);if(!r)throw new Error(`Folder "${e}" not found in git-enabled folders`);return r.path}#bt(e,r){if(typeof e!="string")throw new TypeError(`#parsePathWithFolder: 'path' must be a string, received ${typeof e}: ${na(e)}`);if(r)return{repoPath:this.#ve(r),relativePath:e};for(let n of this.#p){let i=`${n.folderName}/`;if(e.startsWith(i))return{repoPath:n.path,relativePath:e.slice(i.length)}}return{repoPath:this.primaryGitPath,relativePath:e}}constructor(e){if(this.#e=e.sys,this.#_=e.modelOverride,this.#s=e.credentials,"initialUrl"in e){let n=wye(e.initialUrl).id;n?this.#q=n:this.#B=e.initialUrl}typeof e.autoImportLocalMCPs=="boolean"&&(this.#Dt=e.autoImportLocalMCPs),"sessionOrCompletionId"in e?this.#q=e.sessionOrCompletionId:this.#q=e.fusionConfig?.sessionId;let r=e.workingDirectory??e.fusionConfig?.workingDirectory;if(this.#I=r?e.sys.resolve(e.sys.cwd(),r):e.sys.getCwdDir(),this.#T=e.skipFileDiff??!0,this.#C=e.position,this.#M=e.mode,this.#P=e.privacyMode??e.fusionConfig?.privacyMode,this.#d=e.devServerOrchestrator,this.#m=e.git??!1,this.#b=e.softContextWindow,this.#m&&(process.env.GIT_CEILING_DIRECTORIES=this.#I),this.#gt=e.gitAutoInit??!1,this.#u=e.fusionConfig,this.#ze=e.asyncSubAgents??!1,this.#A=e.queueMode??"next-turn",this.#me=e.fusionConfig?.autoPush,this.#h=e.fusionConfig?.projectId,this.#y=e.fusionConfig?.branchName,this.#L=e.fusionConfig?.featureBranch,this.#H=e.fusionConfig?.aiBranch,this.#Te=e.fusionConfig?.proxyOrigin,this.#Me=e.fusionConfig?.proxyDefaultOrigin,this.#$e=e.fusionStatusMonitor,process.env.FUSION_ENV_ORIGIN&&(this.#Ct=process.env.FUSION_ENV_ORIGIN),this.#re=e.agentType,this.#Bt=e.persistSessionLocally??!1,this.#yt=e.parentSessionId,e.enabledTools)this.#D=mF(this.#u,e.enabledTools);else if(this.#M==="quality-v3"){let n=["write_file","search_replace_file","view_path","get_rule","get_style_inspiration","grep_search","web_search","find_media",process.platform==="win32"?"powershell":"bash"];this.#d&&n.push("dev_server_control"),this.#D=mF(this.#u,n)}else if(this.#M==="quality-v4"){let n=["Write","Edit","Read","MultiEdit","Grep","Glob","ReadRule","TodoRead","TodoWrite","Agent","Media","WebFetch","AskUserQuestion","ExitPlanMode","EnterPlanMode",process.platform==="win32"?"PowerShell":"Bash"],i=!!(this.#P?.enabled||this.#P?.redactUserMessages||this.#P?.redactLLMMessages);i||n.push("WebSearch"),this.#h&&!i&&this.getCommitMode()!=="commits"&&n.push("SearchMemories"),i||n.push("GetScreenshot"),n.push("NavigatePreview"),this.#d&&(n.push("DevServerLogs"),n.push("DevServerRestart"),n.push("ProposeEnvVariable")),process.env.FUSION_IDE_PORT&&n.push("IDEDiagnostics"),this.#D=mF(this.#u,n)}if(this.#pt=e.maxTokens,this.#Ve=e.reasoning,this.#je=e.builtInCustomInstructions??[],this.#Ye=e.builtInCustomAgents??[],this.#Re=e.builtInMCPServerConfig??{},this.#ae=e.systemPromptOverride,this.#E=e.fusionConfig?.workspace,this.#qe=e.mcpServers??!1,this.#v=this.#I,this.#p=[],this.#E?.folders.length){let n=this.#E.folders.filter(i=>i.enableGit);this.#p=n.map(i=>({folderName:i.name??i.path,path:this.#e.resolve(this.#I,i.path),branchName:i.branchName||"main",repoUrl:i.repoUrl,originalRepoUrl:i.originalRepoUrl,repoName:i.repoName}));for(let i of n){let o=i.backupMetadata?.check.backup,s=i.name??i.path,a=ME({version:o?.version,originalRepoUrl:o?.repoUrl,commitHash:o?.lastCommitHash});a&&(this.#ye[s]=a)}}this.#p.length===0&&(this.#p=[{folderName:TE,path:this.#I,branchName:"main"}]),this.#Qe=Pye(this.#E),this.#E?.folders[0]&&this.#N()&&(this.#v=this.#e.resolve(this.#I,this.#E.folders[0].path)),this.#g.on("idle",()=>{this.#h==null&&this.#y==null||(this.#r.debug("emitting ClientDevtoolsSessionIdleEventV1",{projectId:this.#h,branchName:this.#y}),ia(this.#s,"/events/publish",{event:vce,extraData:{sessionId:this.getSessionId(),lastMessage:this.getLastMessage(),projectId:this.#h,branchName:this.#y,hasPlanToApply:this.#k,sessionMode:this.getSessionMode(),gifId:this.#U.gif_id,planContent:this.#te},extraAttributes:{projectId:this.#h,branchName:this.#y}}))})}get fusionConfig(){return this.#u}get gitEnabledFolder(){return this.#E?.folders.find(e=>e.enableGit)}get gitEnabledFolders(){return this.#E?.folders.filter(e=>e.enableGit)||[]}get gitRepoContexts(){return this.#p}get workingDirectory(){return this.#I}get bashWorkingDirectory(){return this.#v}getSessionMode(){return this.#n?.sessionMode??"normal"}async switchSessionMode(e){let r=this.getSessionContext();r.sessionMode!==e&&(r.sessionMode=e,this.#k=!1,this.#te=void 0,await this.#fe())}async switchModelOverride(e){this.#_=e||void 0,await this.#fe()}removeSystemReminder(e){let r=this.#$.findIndex(n=>n.tag===e);r!==-1&&this.#$.splice(r,1)}getMemoriesForFile(e){let r=lye(this.#dt,e).filter(n=>!this.#ft.has(n.id));for(let n of r)this.#ft.add(n.id);return r}queueSystemReminder(e){let r=e.tag?this.#$.findIndex(n=>n.tag===e.tag):-1;return r!==-1?e.text?(this.#$[r]=e,{operation:"update"}):(this.#$.splice(r,1),{operation:"delete"}):e.text?(this.#$.push(e),{operation:"add"}):{operation:"noop"}}setDefaultAutoPush(e){this.#me=e}async setPrivacyMode(e){if(e&&e.enabled){if(!e.encryptKey&&!this.#he)this.#he=await LBe();else if(e.encryptKey){if(!await lF(e.encryptKey))throw new Error("Invalid encryption key: key failed validation");this.#he=e.encryptKey}}else this.#he=void 0;this.#P=e}async initializeSession(e={}){return this.#Je||(this.#Je=this.#Gt(e)),await this.#Je}async loadHistory(){let e=this.getSessionContext(),r=await IF(this.#e,this.#s,e.sessionId,!1,this.#a),n=new Map,i=new Map;for(let a of r.turns)for(let A of[a.beforeCommit,a.afterCommit,a.lastCommit]){if(!A)continue;let c=mm(A,this.gitRepoContexts[0]?.folderName);n.set(A,c);for(let[u,l]of Object.entries(c))i.has(u)||i.set(u,new Set),i.get(u).add(l)}let o=new Map;for(let[a,A]of i.entries()){let c=this.gitRepoContexts.find(l=>l.folderName===a);if(!c||A.size===0)continue;let u=new Set;try{let p=(await this.git(["cat-file","--batch-check","--buffer"],{sys:this.#e,cwd:c.path,stdin:Array.from(A).map(d=>`${d}^{commit}`).join(`
|
|
1849
1849
|
`)})).trim().split(`
|
|
1850
|
-
`),g=new Set;for(let d of p)if(d.includes("missing")){let f=d.split(/\s+/)[0].replace("^{commit}","");g.add(f)}for(let d of A)g.has(d)||u.add(d)}catch(l){this.#e.Sentry?.captureException(l)}o.set(a,u)}let s=r.turns.filter(a=>{for(let A of[a.beforeCommit,a.afterCommit,a.lastCommit]){if(!A)continue;let c=n.get(A);if(c)for(let[u,l]of Object.entries(c)){if(!this.gitRepoContexts.find(d=>d.folderName===u))continue;let g=o.get(u);if(!g||!g.has(l))return!1}}return!0});return{sessionId:e.sessionId,title:e.title,beforeCommit:e.beforeCommit,createdUnixTime:e.createdUnixTime,updatedUnixTime:e.updatedUnixTime,turns:s}}async loadWholeSession(e={}){let{getAll:r=!0}=e,n=this.getSessionContext(),i=0;for(;n.canLoadMore&&n.canLoadMore;){let o=await this.loadMoreTurns();i+=o.length}return{sessionId:n.sessionId,title:n.title,beforeCommit:n.beforeCommit,createdUnixTime:n.createdUnixTime,updatedUnixTime:n.updatedUnixTime,addedTurns:i,turns:r?n.turns:n.turns.slice(0,i)}}async loadMoreTurns(){return this.#Ce||(this.#Ce=this.#Ut().then(e=>(this.#Ce=void 0,e))),this.#Ce}async#Ut(){let e=this.getSessionContext();if(e.canLoadMore){let r=e.turns[0]?.completionId,n=await IF(this.#e,this.#s,e.sessionId,!0,this.#a,r);return n.turns.length>0&&e.turns.unshift(...n.turns),e.canLoadMore=n.canLoadMore,n.turns}return[]}async#Ot(){try{let e=dlt();if(!e)return null;let r=this.#e.join(this.primaryGitPath,"file.tsx");return await e.resolveConfig(r)}catch{return null}}async setCustomInstructions(e){this.#je=e,this.#
|
|
1850
|
+
`),g=new Set;for(let d of p)if(d.includes("missing")){let f=d.split(/\s+/)[0].replace("^{commit}","");g.add(f)}for(let d of A)g.has(d)||u.add(d)}catch(l){this.#e.Sentry?.captureException(l)}o.set(a,u)}let s=r.turns.filter(a=>{for(let A of[a.beforeCommit,a.afterCommit,a.lastCommit]){if(!A)continue;let c=n.get(A);if(c)for(let[u,l]of Object.entries(c)){if(!this.gitRepoContexts.find(d=>d.folderName===u))continue;let g=o.get(u);if(!g||!g.has(l))return!1}}return!0});return{sessionId:e.sessionId,title:e.title,beforeCommit:e.beforeCommit,createdUnixTime:e.createdUnixTime,updatedUnixTime:e.updatedUnixTime,turns:s}}async loadWholeSession(e={}){let{getAll:r=!0}=e,n=this.getSessionContext(),i=0;for(;n.canLoadMore&&n.canLoadMore;){let o=await this.loadMoreTurns();i+=o.length}return{sessionId:n.sessionId,title:n.title,beforeCommit:n.beforeCommit,createdUnixTime:n.createdUnixTime,updatedUnixTime:n.updatedUnixTime,addedTurns:i,turns:r?n.turns:n.turns.slice(0,i)}}async loadMoreTurns(){return this.#Ce||(this.#Ce=this.#Ut().then(e=>(this.#Ce=void 0,e))),this.#Ce}async#Ut(){let e=this.getSessionContext();if(e.canLoadMore){let r=e.turns[0]?.completionId,n=await IF(this.#e,this.#s,e.sessionId,!0,this.#a,r);return n.turns.length>0&&e.turns.unshift(...n.turns),e.canLoadMore=n.canLoadMore,n.turns}return[]}async#Ot(){try{let e=dlt();if(!e)return null;let r=this.#e.join(this.primaryGitPath,"file.tsx");return await e.resolveConfig(r)}catch{return null}}async setCustomInstructions(e){this.#je=e,this.#n&&(this.#n.customInstructions=await this.#Se())}async setCustomAgents(e){this.#Ye=e,this.#n&&(this.#n.customAgents=await this.#Ge())}async#Se(){let r=(await Promise.all(this.#p.map(n=>dJ({sys:this.#e,projectDir:this.#I,currentDir:n.path,rootDir:"/",allowedCommands:Xb(this.#u?.allowedCommands??[]),skipCommandSecurity:this.#u?.skipCommandSecurity===!0})))).flat();return sJ(this.#je??[],r)}async#Ge(){if(!this.#D?.includes("Agent"))return[];let r=(await Promise.all(this.#p.map(n=>Oge({sys:this.#e,projectDir:this.#I,currentDir:n.path,rootDir:"/"})))).flat();return sJ(this.#Ye??[],r)}async#Gt(e){try{if(this.#Ne)throw new Error("Code session already closed");if(this.#n)throw new Error("Session context already initialized");this.#r.debug(`Current AI working directory: ${this.#I}`),await this.setPrivacyMode(this.#P);let r=await this.#Ht(),n=await this.#Ot();r&&(this.#R=await this.#O());let i=this.#p[0]?.repoUrl;this.#mt=await rO(i);let o,s;this.#q||(this.#q=r?.sessionId),this.#q?e.skipSessionLoading?o=this.#q:(s=await IF(this.#e,this.#s,this.#q,!0,this.#a,void 0,e.signal),o=s.sessionId,this.#r.debug(`Session recovered (sessionId=${o}, turnsCount=${s.turns.length})`)):o=(0,CF.randomUUID)(),this.#L||(this.#L=r?.featureBranch?.trim());let a={turns:s?.turns??[],sessionId:o,customInstructions:await this.#Se(),customAgents:await this.#Ge(),title:s?.title,beforeCommit:s?.beforeCommit,createdUnixTime:s?.createdUnixTime??Date.now(),updatedUnixTime:s?.updatedUnixTime??Date.now(),userContext:await bye(this.#e,this.primaryGitPath),prettierConfig:n,canLoadMore:s?.canLoadMore??!1,state:s?.turns.length?"success":this.#B?"initial-with-url":"initial-without-url",sessionMode:s?.sessionMode??"normal"};if(this.#U=s?.metadata??{},s?.hasPlanToApply&&(this.#k=!0),s){let c=oc(s.turns);c?.completionId!==s.lastCompletionId&&this.#e.Sentry?.captureException(new Error("Last completion id mismatch"),{tags:{operation:"codegen-initialize-session"},extra:{lastTurn:c,sessionMetadata:s}})}if(this.#a&&this.#g.on("step",c=>{c.type!=="delta"&&this.#r.debug(`(${c.type}): ${rm(JSON.stringify(c),400)}`)}),await this.#Jt(a),this.#n=a,this.#re){let c=await this.getNamedAgentConfig(this.#re,this.getSessionId(),e.signal);if(c.success){if(this.#x=c.options.includeMemories,this.#D=c.options.enabledTools,this.#_=c.options.modelOverride,this.#M=c.options.mode,this.#ae=c.options.systemPromptOverride,this.#C=c.options.position,this.#A=c.options.queueMode??"next-turn",this.#ze=c.options.asyncSubAgents??!1,this.#b=c.options.softContextWindow,this.#Re={...this.#Re,...c.options.builtInMCPServerConfig},c.options.builtInMCPServerConfig?.chrome&&!this.#it){let u=new RE(this.getSessionId(),{framesDir:this.#e.join(hF.default.homedir(),".builder","recordings"),debug:this.#a});this.setTimeline(u)}typeof c.options.mcpServers=="boolean"&&(this.#qe=c.options.mcpServers)}else this.#r.error(c.response)}try{let c=await TBe(this.#e,this.primaryGitPath,this.#Re,this.#Dt,e.signal);c.length>0?(this.#r.debug(`Initializing ${c.length} local MCP server(s)...`),this.#Ee=await NBe(c,this.#e,this.primaryGitPath,e.signal)):this.#r.debug(`No local MCP servers found in: ${this.primaryGitPath}`)}catch(c){this.#r.error("Failed to initialize local MCP servers:",c,{loggerOptions:{debug:!0}})}if(this.#m&&this.#h&&this.#D?.includes("SearchMemories")){let c=await gye(this.#e,this.#s,this.#h,e.signal);await fF(this.#e,c,this.#e.join(this.#v,".builder","memories")),this.#dt=c,this.#D&&c.length===0&&(this.#D=this.#D.filter(u=>u!=="SearchMemories"))}let A=this.#d;if(A){let c=()=>{this.#g.emit("step",lJ(A,this.#u))},u=()=>{this.#g.emit("step",lJ(A,this.#u)),this.#fe(),this.#pe()},l=p=>{p==="ok-2xx"&&(this.requestRefresh(),this.isIdle()&&this.#u?.branchType==="code-review"&&!this.#It.has("browser-testing")&&this.sendMessage({userPrompt:"The dev server is now ready. You have not run the browser-testing agent yet. Run Step 5 now \u2014 spawn the browser-testing agent with a complete test plan based on the PR changes and code review findings from your earlier analysis.",category:"background-subagent",user:{role:"agent",source:"builder.io"}}))};A.emitter.on("setupState",u),A.emitter.on("devState",u),A.emitter.on("httpServerData",u),A.emitter.on("httpServerState",l),A.emitter.on("validateState",c),this.#Fe.push(()=>{A.emitter.off("setupState",u),A.emitter.off("devState",u),A.emitter.off("httpServerData",u),A.emitter.off("httpServerState",l),A.emitter.off("validateState",c)})}}catch(r){throw this.#r.error(r),this.#e.Sentry?.captureException(r,{tags:{operation:"codegen-initialize-session"}}),r}}async#et(e,r){let n="reminder:health";this.removeSystemReminder(n);let i=this.#d;if(!i||!(this.#D?.includes("DevServerLogs")||this.#D?.includes("DevServerRestart")||this.#D?.includes("DevServerControl")||this.#D?.includes("ProposeEnvVariable")))return;let s=this.getSessionContext();if(s.sessionMode!=="normal")return;e&&await i.waitUntilIdle(500,500);let a=i.setupState,A=await this.#rt(),c=i.devCommand,u=i.devState,l=i.state,p=i.setupCommand,g=await i.getOpenPorts(),d=i.proxyTarget,f=i.httpServerState.state,h=i.lastServerStatus,C=f==="error-fetch",I=!1;this.#m&&(I=await this.getCurrentBranch()!==this.getAiBranch());let B=f==="error-5xx"||f==="error-4xx"&&h!==401&&h!==404,E="",y=!1,D=!1;l==="install-failed"||l==="install-aborted"?E=i.getSetupOutput():(E=i.getCheckpoints(1,u!=="running"?"err":"all"),y=xye(E??""));let b="",Q="",v="error",S="Try to fix",x="repair-unknown";if(l==="not-installed"||l==="install-failed"||l==="install-aborted"||l==="failed"||I||C||B||y||A.length>0){if(I&&(x="repair-bad-branch",Q+=`- The current git branch is not the AI branch (${this.getAiBranch()}).
|
|
1851
1851
|
`,Q+=`- Please switch to the AI branch using the 'git' tool.
|
|
1852
1852
|
`,b=`The current branch is not the AI branch (${this.getAiBranch()}).`),A.length>0){x="repair-merge-conflict",S="Resolve conflict",b="Merge conflict detected - changes from different sources need to be combined";let L=this.#Ze,M=L?`
|
|
1853
1853
|
ours (:2:) = ${L.ourBranch} (AI branch), theirs (:3:) = ${L.theirBranch} (${L.theirIsMain?"main \u2014 prefer preserving these changes":"AI remote"})`:"";Q+=`Merge conflict detected. Resolve ALL conflicted files:
|
|
@@ -1898,7 +1898,7 @@ ${i.getSetupOutput().slice(-8e3)}
|
|
|
1898
1898
|
`:E&&(Q+=`<dev_logs>
|
|
1899
1899
|
${E}
|
|
1900
1900
|
</dev_logs>
|
|
1901
|
-
`)}(r==="all"||r==="critical"&&!D)&&this.queueSystemReminder({text:rm(Q,2e3),tag:n});let U={devServerState:u,setupState:a,httpServerState:f,proxyServer:d,devCommand:c,setupCommand:p,hasMergeConflict:A.length>0,hasConfigurationIssue:D,logs:E,prompt:"Debug and fix the issue before continuing.",message:b},H=this.#t.length===0&&flt.includes(s.state);return{actionButtonText:S,type:"build-error",level:v,canAutoApply:H,healthStatus:U,message:U.message,userMessage:{userPrompt:U.prompt,repair:!0,category:x,displayPrompt:U.message}}}}async#Kt(){let e=await this.#et(!1,"critical"),r=!!(e&&!e.healthStatus.hasConfigurationIssue);return r&&this.#d?.addCheckpoint(),{hasHealthIssue:r}}async#Ht(){let e;if(this.#m)try{if(this.#n.debug("Initializing Fusion session for AI side-car branch workflow..."),e=await this.#e.getRepoInfo(this.primaryGitPath),!e.hasGit)if(this.#gt){this.#n.warn("No git repository detected. Initializing a new git repository...",{loggerOptions:{debug:!0}});try{await this.git(["init"]),await this.git(["add","."]),await this.git(["branch","-M","main"]),await this.git(["commit","--allow-empty","--quiet","--no-verify","--no-gpg-sign","-m","Initial commit for Fusion workflow"]),this.#n.debug("Successfully initialized a new git repository")}catch(r){this.#n.error("Failed to initialize git repository:",r);return}}else{this.#n.error("Not in a git repository. Fusion requires a git repository.");return}return await mv({sys:this.#e,gitWorkingDirectory:this.primaryGitPath,strict:!0})}catch(r){G.error(`\u274C Error initializing Fusion session: ${r}`);let n=new Error("Initialize Git failed",{cause:r});throw this.#e.Sentry?.captureException(n,{level:"fatal",tags:{operation:"codegen-initialize-session"},extra:{repoInfo:e}}),n}}async#$t(e,r){try{await this.git(["checkout",e],{cwd:r})}catch{await this.git(["checkout","-b",e],{cwd:r})}}async#Jt(e){if(!this.#m)return;if(!this.#H){let o=Lle(this.getFeatureBranch(),e.sessionId);this.#H=o}let r=this.getAiBranch();await this.#J(async o=>{await this.getCurrentBranch(o.path)!==r&&await this.#$t(r,o.path);try{await this.git(["branch","--set-upstream-to",`refs/remotes/origin/${this.#ge(o)}`],{cwd:o.path})}catch{}});let n=oc(e.turns),i=n?.afterCommit??n?.lastCommit;if(i)for(let o of this.gitRepoContexts){let s=this.gitRepoContexts[0]?.folderName,a=yl(i,o.folderName,s);if(a){let A=await this.getCurrentCommitHash("HEAD",o.path);A&&A!==a&&this.#e.Sentry?.captureException(new Error(`Init: After commit mismatch for ${o.folderName}`),{tags:{operation:"codegen-initialize-session",folderName:o.folderName},extra:{sessionId:e.sessionId,targetCommit:a,currentCommitHash:A,lastTurn:n}})}}if(e.beforeCommit)for(let o of this.gitRepoContexts){let s=this.gitRepoContexts[0]?.folderName,a=yl(e.beforeCommit,o.folderName,s);if(a)try{await this.git(["rev-parse","--quiet","--verify",a],{cwd:o.path})}catch(A){this.#e.Sentry?.captureException(new Error(`Init: Before commit not found for ${o.folderName}`,{cause:A}),{tags:{operation:"codegen-initialize-session",folderName:o.folderName},extra:{sessionId:e.sessionId,beforeCommit:a,turnStates:e.turns.length,lastCompletionId:oc(e.turns)?.completionId}})}}}async#jt(e,r,n){let i;try{i=(await this.git(["remote","get-url","origin"],r)).trim()}catch{}let{url:o,token:s,provider:a}=e;try{new URL(o)}catch{throw this.#e.Sentry?.captureException(new Error("Provided remote url is invalid"),{tags:{operation:"codegen-git"},extra:{url:o,currentOriginUrl:i}}),new Error("Provided remote url is invalid")}if(i!==o&&(this.#ye={},i?await this.git(["remote","set-url","origin",o],r):await this.git(["remote","add","origin",o],r),(a==="github"||a==="selfHostedGithub")&&s)){(!n||n===this.gitEnabledFolders[0]?.name)&&(process.env.GH_TOKEN=s);let c=this.gitEnabledFolders.length>1;n&&c&&(process.env[yF(n)]=s)}}async pushRepoV2(e){return await this.#K(this.#xe({pullFirst:!1,updateRepo:e,refreshRemote:!0}),"pushRepoV2",!0)}async ensureGitAuth(){return this.#m?this.#tt():{success:!0,message:"Git is not enabled, skipping auth"}}async#tt({force:e}={}){if(!this.#m)return{success:!0,message:"Git is not enabled"};let n=Date.now()-this.#ht,i=300*1e3;if(!e&&n<=i)return{success:!0,message:"Git auth still valid (within 5min)"};if(this.#ce){if(!e)return this.#ce;await this.#ce.catch(()=>{})}return this.#ce=this.#Yt().then(o=>(o.success&&(this.#ht=Date.now()),o)).finally(()=>{this.#ce=null}),this.#ce}async#Yt(){let e;try{let r=this.gitEnabledFolders;if(r.length===0)throw new Error("No git-enabled repos found");let n=r.filter(o=>!o.initializationCommand&&!o.repoUrl?.startsWith("ssh://"));if(n.length===0)return{success:!0,message:"Git remote URLs update not needed"};if(!this.#E)throw new Error("Project ID is required to update git URLs");let i=await hm(this.#s,this.#E,this.#a);if(!i.success)throw i.error;e=i.gitConfigs;for(let o of n){if(!o.repoName)continue;let s=e?.[o.repoName];if(s?.url){let a=this.#e.resolve(this.#C,o.path);await this.#jt(s,a,o.name)}}return{success:!0,message:"Git remote URLs updated"}}catch(r){let n=`Failed to update git remote URLs: ${ed(r)}`;return this.#n.error(n,{loggerOptions:{debug:!0}}),this.#g.emit("step",{type:"error",message:n,code:"git-update-error"}),this.#e.Sentry?.captureException(r,{tags:{operation:"codegen-git",endpoint:"updateGitUrls"},extra:{projectId:this.#E,workspaceFolders:this.#I?.folders,gitConfigs:e}}),{success:!1,message:n,error:r instanceof Error?r:new Error(n)}}}async zipFolder(e){if(typeof e!="string")throw new TypeError(`zipFolder: 'folderName' must be a string, received ${typeof e}: ${na(e)}`);let{resolvedPath:r}=this.resolveWorkspacePath(e,!1),n=Date.now(),i=Math.random().toString(36).substring(2,8),o=`zip-${n}-${i}.zip`,s="/tmp",a=this.#e.join(s,o);return Zl.default.mkdirSync(s,{recursive:!0}),await Ga("zip",["-r",a,".","-x","**/node_modules/**"],{cwd:r,sys:this.#e}),a}async archiveProject(){if(!this.#m)throw new Error("Can not archive project in non git mode");try{let e=Date.now(),r=Math.random().toString(36).substring(2,8),n=`project-${e}-${r}.zip`,i="/tmp",o=this.#e.join(i,n);return Zl.default.mkdirSync(i,{recursive:!0}),await this.git(["archive","--format=zip","-o",o,"HEAD"]),o}catch(e){throw new Error("Failed to archive project",{cause:e})}}isIdle(){let e=this.getSessionContext(),r=["generating","replay"];return!this.#Ae&&!r.includes(e.state)&&this.#le.length===0}async needsBackup(){if(!this.#m||!this.#E||!this.#D)return!1;for(let e of this.#p){let r=e.originalRepoUrl??e.repoUrl;if(!r)continue;let n=await this.getCurrentCommitHash("HEAD",e.path);if(!n)continue;let i=ME({version:"v2",originalRepoUrl:r,commitHash:n});if(this.#ye[e.folderName]!==i)return!0}return!1}async uploadBackup(e=!1){try{await this.waitUntilBlockingPendingPromises(),await this.#ne(!1);let r=this.#E,n=this.#D;if(!this.#m)throw new Error("Cannot upload backup in non-git mode");if(!r)throw new Error("Project ID is required for backup upload");if(!n)throw new Error("Branch ID is required for backup upload");let i=this.getAiBranch(),o=this.getFeatureBranch(),s=await this.#O();await vv(this.#e,this.#s,{commits:s,projectId:r,branchName:n},this.#a);let a=performance.now(),A=[];for(let l of this.#p){let p=l.originalRepoUrl??l.repoUrl;if(!p)continue;let g=await this.#Ft(()=>wv({sys:this.#e,credentials:this.#s,projectId:r,branchName:n,repoPath:l.path,aiBranch:i,featureBranch:l.branchName||o,workspace:this.#I,debug:this.#a,isConnectedToProvider:!0,forcedFullBackup:e,canAbortMerge:this.#Ne,folderName:l.folderName,repoUrl:p}));if(!g.success)return g;A.push({result:g,folderName:l.folderName})}if(A.length===0)return{success:!1,error:new Error("No repos to backup")};let c=A.map(l=>l.result.backupEntry),u=performance.now()-a;await bv(this.#s,c,u,this.#a);for(let{result:l,folderName:p}of A)l.backupRef&&(this.#ye[p]=l.backupRef);return A[0].result}catch(r){if(this.#n.error("Failed to upload backup",r),this.#ye={},this.#e.Sentry?.captureException(r,{tags:{operation:"codegen-backup",backupError:""}}),r instanceof Error&&r.message.includes("Commit(s) not found on remote"))throw r instanceof Error?r:new Error(String(r));return{success:!1,error:r instanceof Error?r:new Error(String(r))}}}getCommitMode(){return this.#u?.commitMode??"prs"}#ge(e){return this.getCommitMode()==="commits"?`${e?.branchName||this.getFeatureBranch()}`:`${this.getAiBranch()}`}async#vt(e,r){let n=this.getCommitMode(),i=this.#ge(r),o=await this.getCurrentBranch(r?.path);return n==="commits"?["push","--no-verify","--set-upstream",...e?["-f"]:[],"origin",`${o}:${i}`]:["push","--no-verify","--set-upstream",...e?["-f"]:[],"origin",i]}async pushChanges(e){let r=performance.now(),n=await this.#K(this.#xe(e),"pushChanges",!0);return this.#G("git_push_changes_total",performance.now()-r,{success:String(n.success!==!1)}),n}async#xe(e){let{pullFirst:r,updateRepo:n,actor:i,refreshRemote:o,forcePush:s,folderName:a,requireFastForward:A,abortOnMergeConflict:c}=Nye(e);try{if(!this.#m)throw new Error("Can not push changes in non-git mode");if(this.#u?.isFork)throw new Error("Cannot push changes to fork PRs. Fork PRs are read-only. You can only review and validate changes locally.");if(n){let h=this.#I?.folders.find(C=>C.enableGit);h&&(h.repoName=n.repoFullName,h.originalRepoUrl=n.repoUrl)}if(o||n){let h=performance.now(),C=await this.#tt({force:!!o});if(this.#G("git_push_ensure_auth",performance.now()-h),!C.success)throw C.error}let u=a?this.#p.find(h=>h.folderName===a):this.#p[0];if(!u)throw new Error(a?`Folder "${a}" not found in workspace`:"No git repos configured");if(A&&await this.#qt(u),r){let h=performance.now(),C=await this.#Vt({requestRefresh:!1,abortOnMergeConflict:c,ctx:u});if(this.#G("git_push_pull_latest",performance.now()-h,{success:String(C.success!==!1)}),!C.success)throw C.error??new Error(C.message)}if((await this.#V(u.path)).length>0)throw new Error(`Merge conflict detected in ${u.folderName}, please resolve before pushing`);let p=await this.#vt(s??!1,u),g=performance.now(),d=!0;try{await this.git(p,{cwd:u.path})}catch(h){throw d=!1,h}finally{this.#G("git_push_push",performance.now()-g,{success:String(d)})}await this.#S();let f=await this.#O();return await this.#de({lastCommit:Ks(f)}),this.queueGitStatusReminder({trigger:"push-success",pushedToRemote:!0}),{success:!0}}catch(u){this.#e.Sentry?.captureException(u,{tags:{operation:"codegen-git",endpoint:"pushChanges",actor:i},extra:{pullFirst:r,forcePush:s,requireFastForward:A,abortOnMergeConflict:c,commitMode:this.getCommitMode(),updateRepo:n,refreshRemote:o}});let l=ed(u);return{success:!1,message:l,error:u instanceof Error?u:new Error(l)}}}async#qt(e){let r=this.#ge(e);await this.git(["fetch","origin",r],{cwd:e.path});let i=this.getCommitMode()==="commits"?await this.getCurrentBranch(e.path):r;try{await this.git(["merge-base","--is-ancestor",`origin/${r}`,i],{cwd:e.path})}catch{throw new Error("[GIT_PUSH_ERROR] Cannot push: remote has diverged from local branch. Fast-forward push is not possible. Please pull the latest changes first or use a different push mode.")}}async#Vt(e){if(e?.abortOnMergeConflict){let n=e.ctx?[e.ctx]:this.#p;if(n.length===0)return{success:!1,message:"No git repos configured",error:new Error("No git repos configured")};try{for(let i of n){let o=this.#ge(i),s=performance.now();await this.git(["fetch","origin",o],{cwd:i.path}),this.#G("git_push_fetch",performance.now()-s,{folder:i.folderName,mode:"abort-on-conflict"});let a=performance.now(),A=!0;try{await this.git(["merge",`origin/${o}`],{cwd:i.path})}catch(c){if(A=!1,(await this.#V(i.path)).length>0){try{await this.git(["merge","--abort"],{cwd:i.path})}catch(l){this.#e.Sentry?.captureException(l,{tags:{operation:"codegen-git",endpoint:"pullLatestFromRemote-abort-merge-conflict",folderName:i.folderName}})}throw new Error(`[GIT_PUSH_ERROR] Cannot push: merge conflict detected in ${i.folderName} when pulling latest changes. The merge has been aborted. Please resolve conflicts manually.`)}throw c}finally{this.#G("git_push_merge",performance.now()-a,{folder:i.folderName,mode:"abort-on-conflict",success:String(A)})}}return{success:!0}}catch(i){this.#e.Sentry?.captureException(i,{tags:{operation:"codegen-git",endpoint:"pullLatestFromRemote"}});let o=ed(i);return{success:!1,message:o,error:i instanceof Error?i:new Error(o)}}}return await this.#K(this.#St({branches:[],allowUnrelatedHistory:!1,canPush:!1,uncommittedChanges:"commit",fastForward:"auto",requestRefresh:e?.requestRefresh??!0,syncRemoteBranch:!0}),"syncChangesFromBranches",!0)}async abortMerge(e=!0){try{let r=await this.#J(async n=>{try{return await this.git(["merge","--abort"],{cwd:n.path}),!0}catch{return!1}});return this.#Ze=void 0,e&&r.results.some(n=>n.result===!0)&&(await this.#S(),await this.#fe(),this.requestRefresh()),r.success?{success:!0,message:"Merge aborted"}:{success:!1,message:`Failed to abort merge in: ${r.results.filter(i=>!i.success).map(i=>i.folderName).join(", ")}`,error:new Error("Merge abort failed in some repositories")}}catch(r){await this.#S();let n=ed(r);return{success:!1,message:n,error:r instanceof Error?r:new Error(n)}}}async syncChangesFromRemote(e){let r=[],n=e?.remoteBranches??"both";return n==="both"?r.push(this.getAiBranch(),this.getFeatureBranch()):n==="main"?r.push(this.getFeatureBranch()):n==="ai"&&r.push(this.getAiBranch()),await this.#K(this.#St({branches:r,allowUnrelatedHistory:e?.allowUnrelatedHistory??!0,canPush:e?.canPush??!1,uncommittedChanges:e?.uncommittedChanges??"commit",requestRefresh:e?.requestRefresh,fastForward:e?.fastForward??"auto"}),"syncChangesFromRemote",!0)}async#V(e){try{return(await this.git(["--no-pager","diff","--name-only","--diff-filter=U"],{cwd:e})).trim().split(`
|
|
1901
|
+
`)}(r==="all"||r==="critical"&&!D)&&this.queueSystemReminder({text:rm(Q,2e3),tag:n});let U={devServerState:u,setupState:a,httpServerState:f,proxyServer:d,devCommand:c,setupCommand:p,hasMergeConflict:A.length>0,hasConfigurationIssue:D,logs:E,prompt:"Debug and fix the issue before continuing.",message:b},H=this.#t.length===0&&flt.includes(s.state);return{actionButtonText:S,type:"build-error",level:v,canAutoApply:H,healthStatus:U,message:U.message,userMessage:{userPrompt:U.prompt,repair:!0,category:x,displayPrompt:U.message}}}}async#Kt(){let e=await this.#et(!1,"critical"),r=!!(e&&!e.healthStatus.hasConfigurationIssue);return r&&this.#d?.addCheckpoint(),{hasHealthIssue:r}}async#Ht(){let e;if(this.#m)try{if(this.#r.debug("Initializing Fusion session for AI side-car branch workflow..."),e=await this.#e.getRepoInfo(this.primaryGitPath),!e.hasGit)if(this.#gt){this.#r.warn("No git repository detected. Initializing a new git repository...",{loggerOptions:{debug:!0}});try{await this.git(["init"]),await this.git(["add","."]),await this.git(["branch","-M","main"]),await this.git(["commit","--allow-empty","--quiet","--no-verify","--no-gpg-sign","-m","Initial commit for Fusion workflow"]),this.#r.debug("Successfully initialized a new git repository")}catch(r){this.#r.error("Failed to initialize git repository:",r);return}}else{this.#r.error("Not in a git repository. Fusion requires a git repository.");return}return await mv({sys:this.#e,gitWorkingDirectory:this.primaryGitPath,strict:!0})}catch(r){G.error(`\u274C Error initializing Fusion session: ${r}`);let n=new Error("Initialize Git failed",{cause:r});throw this.#e.Sentry?.captureException(n,{level:"fatal",tags:{operation:"codegen-initialize-session"},extra:{repoInfo:e}}),n}}async#$t(e,r){try{await this.git(["checkout",e],{cwd:r})}catch{await this.git(["checkout","-b",e],{cwd:r})}}async#Jt(e){if(!this.#m)return;if(!this.#H){let o=Lle(this.getFeatureBranch(),e.sessionId);this.#H=o}let r=this.getAiBranch();await this.#J(async o=>{await this.getCurrentBranch(o.path)!==r&&await this.#$t(r,o.path);try{await this.git(["branch","--set-upstream-to",`refs/remotes/origin/${this.#ge(o)}`],{cwd:o.path})}catch{}});let n=oc(e.turns),i=n?.afterCommit??n?.lastCommit;if(i)for(let o of this.gitRepoContexts){let s=this.gitRepoContexts[0]?.folderName,a=yl(i,o.folderName,s);if(a){let A=await this.getCurrentCommitHash("HEAD",o.path);A&&A!==a&&this.#e.Sentry?.captureException(new Error(`Init: After commit mismatch for ${o.folderName}`),{tags:{operation:"codegen-initialize-session",folderName:o.folderName},extra:{sessionId:e.sessionId,targetCommit:a,currentCommitHash:A,lastTurn:n}})}}if(e.beforeCommit)for(let o of this.gitRepoContexts){let s=this.gitRepoContexts[0]?.folderName,a=yl(e.beforeCommit,o.folderName,s);if(a)try{await this.git(["rev-parse","--quiet","--verify",a],{cwd:o.path})}catch(A){this.#e.Sentry?.captureException(new Error(`Init: Before commit not found for ${o.folderName}`,{cause:A}),{tags:{operation:"codegen-initialize-session",folderName:o.folderName},extra:{sessionId:e.sessionId,beforeCommit:a,turnStates:e.turns.length,lastCompletionId:oc(e.turns)?.completionId}})}}}async#jt(e,r,n){let i;try{i=(await this.git(["remote","get-url","origin"],r)).trim()}catch{}let{url:o,token:s,provider:a}=e;try{new URL(o)}catch{throw this.#e.Sentry?.captureException(new Error("Provided remote url is invalid"),{tags:{operation:"codegen-git"},extra:{url:o,currentOriginUrl:i}}),new Error("Provided remote url is invalid")}if(i!==o&&(this.#ye={},i?await this.git(["remote","set-url","origin",o],r):await this.git(["remote","add","origin",o],r),(a==="github"||a==="selfHostedGithub")&&s)){(!n||n===this.gitEnabledFolders[0]?.name)&&(process.env.GH_TOKEN=s);let c=this.gitEnabledFolders.length>1;n&&c&&(process.env[yF(n)]=s)}}async pushRepoV2(e){return await this.#K(this.#xe({pullFirst:!1,updateRepo:e,refreshRemote:!0}),"pushRepoV2",!0)}async ensureGitAuth(){return this.#m?this.#tt():{success:!0,message:"Git is not enabled, skipping auth"}}async#tt({force:e}={}){if(!this.#m)return{success:!0,message:"Git is not enabled"};let n=Date.now()-this.#ht,i=300*1e3;if(!e&&n<=i)return{success:!0,message:"Git auth still valid (within 5min)"};if(this.#ce){if(!e)return this.#ce;await this.#ce.catch(()=>{})}return this.#ce=this.#Yt().then(o=>(o.success&&(this.#ht=Date.now()),o)).finally(()=>{this.#ce=null}),this.#ce}async#Yt(){let e;try{let r=this.gitEnabledFolders;if(r.length===0)throw new Error("No git-enabled repos found");let n=r.filter(o=>!o.initializationCommand&&!o.repoUrl?.startsWith("ssh://"));if(n.length===0)return{success:!0,message:"Git remote URLs update not needed"};if(!this.#h)throw new Error("Project ID is required to update git URLs");let i=await hm(this.#s,this.#h,this.#a);if(!i.success)throw i.error;e=i.gitConfigs;for(let o of n){if(!o.repoName)continue;let s=e?.[o.repoName];if(s?.url){let a=this.#e.resolve(this.#I,o.path);await this.#jt(s,a,o.name)}}return{success:!0,message:"Git remote URLs updated"}}catch(r){let n=`Failed to update git remote URLs: ${ed(r)}`;return this.#r.error(n,{loggerOptions:{debug:!0}}),this.#g.emit("step",{type:"error",message:n,code:"git-update-error"}),this.#e.Sentry?.captureException(r,{tags:{operation:"codegen-git",endpoint:"updateGitUrls"},extra:{projectId:this.#h,workspaceFolders:this.#E?.folders,gitConfigs:e}}),{success:!1,message:n,error:r instanceof Error?r:new Error(n)}}}async zipFolder(e){if(typeof e!="string")throw new TypeError(`zipFolder: 'folderName' must be a string, received ${typeof e}: ${na(e)}`);let{resolvedPath:r}=this.resolveWorkspacePath(e,!1),n=Date.now(),i=Math.random().toString(36).substring(2,8),o=`zip-${n}-${i}.zip`,s="/tmp",a=this.#e.join(s,o);return Zl.default.mkdirSync(s,{recursive:!0}),await Ga("zip",["-r",a,".","-x","**/node_modules/**"],{cwd:r,sys:this.#e}),a}async archiveProject(){if(!this.#m)throw new Error("Can not archive project in non git mode");try{let e=Date.now(),r=Math.random().toString(36).substring(2,8),n=`project-${e}-${r}.zip`,i="/tmp",o=this.#e.join(i,n);return Zl.default.mkdirSync(i,{recursive:!0}),await this.git(["archive","--format=zip","-o",o,"HEAD"]),o}catch(e){throw new Error("Failed to archive project",{cause:e})}}isIdle(){let e=this.getSessionContext(),r=["generating","replay"];return!this.#Ae&&!r.includes(e.state)&&this.#le.length===0}async needsBackup(){if(!this.#m||!this.#h||!this.#y)return!1;for(let e of this.#p){let r=e.originalRepoUrl??e.repoUrl;if(!r)continue;let n=await this.getCurrentCommitHash("HEAD",e.path);if(!n)continue;let i=ME({version:"v2",originalRepoUrl:r,commitHash:n});if(this.#ye[e.folderName]!==i)return!0}return!1}async uploadBackup(e=!1){try{await this.waitUntilBlockingPendingPromises(),await this.#ne(!1);let r=this.#h,n=this.#y;if(!this.#m)throw new Error("Cannot upload backup in non-git mode");if(!r)throw new Error("Project ID is required for backup upload");if(!n)throw new Error("Branch ID is required for backup upload");let i=this.getAiBranch(),o=this.getFeatureBranch(),s=await this.#O();await vv(this.#e,this.#s,{commits:s,projectId:r,branchName:n},this.#a);let a=performance.now(),A=[];for(let l of this.#p){let p=l.originalRepoUrl??l.repoUrl;if(!p)continue;let g=await this.#Ft(()=>wv({sys:this.#e,credentials:this.#s,projectId:r,branchName:n,repoPath:l.path,aiBranch:i,featureBranch:l.branchName||o,workspace:this.#E,debug:this.#a,isConnectedToProvider:!0,forcedFullBackup:e,canAbortMerge:this.#Ne,folderName:l.folderName,repoUrl:p}));if(!g.success)return g;A.push({result:g,folderName:l.folderName})}if(A.length===0)return{success:!1,error:new Error("No repos to backup")};let c=A.map(l=>l.result.backupEntry),u=performance.now()-a;await bv(this.#s,c,u,this.#a);for(let{result:l,folderName:p}of A)l.backupRef&&(this.#ye[p]=l.backupRef);return A[0].result}catch(r){if(this.#r.error("Failed to upload backup",r),this.#ye={},this.#e.Sentry?.captureException(r,{tags:{operation:"codegen-backup",backupError:""}}),r instanceof Error&&r.message.includes("Commit(s) not found on remote"))throw r instanceof Error?r:new Error(String(r));return{success:!1,error:r instanceof Error?r:new Error(String(r))}}}getCommitMode(){return this.#u?.commitMode??"prs"}#ge(e){return this.getCommitMode()==="commits"?`${e?.branchName||this.getFeatureBranch()}`:`${this.getAiBranch()}`}async#vt(e,r){let n=this.getCommitMode(),i=this.#ge(r),o=await this.getCurrentBranch(r?.path);return n==="commits"?["push","--no-verify","--set-upstream",...e?["-f"]:[],"origin",`${o}:${i}`]:["push","--no-verify","--set-upstream",...e?["-f"]:[],"origin",i]}async pushChanges(e){let r=performance.now(),n=await this.#K(this.#xe(e),"pushChanges",!0);return this.#G("git_push_changes_total",performance.now()-r,{success:String(n.success!==!1)}),n}async#xe(e){let{pullFirst:r,updateRepo:n,actor:i,refreshRemote:o,forcePush:s,folderName:a,requireFastForward:A,abortOnMergeConflict:c}=Nye(e);try{if(!this.#m)throw new Error("Can not push changes in non-git mode");if(this.#u?.isFork)throw new Error("Cannot push changes to fork PRs. Fork PRs are read-only. You can only review and validate changes locally.");if(n){let h=this.#E?.folders.find(C=>C.enableGit);h&&(h.repoName=n.repoFullName,h.originalRepoUrl=n.repoUrl)}if(o||n){let h=performance.now(),C=await this.#tt({force:!!o});if(this.#G("git_push_ensure_auth",performance.now()-h),!C.success)throw C.error}let u=a?this.#p.find(h=>h.folderName===a):this.#p[0];if(!u)throw new Error(a?`Folder "${a}" not found in workspace`:"No git repos configured");if(A&&await this.#qt(u),r){let h=performance.now(),C=await this.#Vt({requestRefresh:!1,abortOnMergeConflict:c,ctx:u});if(this.#G("git_push_pull_latest",performance.now()-h,{success:String(C.success!==!1)}),!C.success)throw C.error??new Error(C.message)}if((await this.#V(u.path)).length>0)throw new Error(`Merge conflict detected in ${u.folderName}, please resolve before pushing`);let p=await this.#vt(s??!1,u),g=performance.now(),d=!0;try{await this.git(p,{cwd:u.path})}catch(h){throw d=!1,h}finally{this.#G("git_push_push",performance.now()-g,{success:String(d)})}await this.#S();let f=await this.#O();return await this.#de({lastCommit:Ks(f)}),this.queueGitStatusReminder({trigger:"push-success",pushedToRemote:!0}),{success:!0}}catch(u){this.#e.Sentry?.captureException(u,{tags:{operation:"codegen-git",endpoint:"pushChanges",actor:i},extra:{pullFirst:r,forcePush:s,requireFastForward:A,abortOnMergeConflict:c,commitMode:this.getCommitMode(),updateRepo:n,refreshRemote:o}});let l=ed(u);return{success:!1,message:l,error:u instanceof Error?u:new Error(l)}}}async#qt(e){let r=this.#ge(e);await this.git(["fetch","origin",r],{cwd:e.path});let i=this.getCommitMode()==="commits"?await this.getCurrentBranch(e.path):r;try{await this.git(["merge-base","--is-ancestor",`origin/${r}`,i],{cwd:e.path})}catch{throw new Error("[GIT_PUSH_ERROR] Cannot push: remote has diverged from local branch. Fast-forward push is not possible. Please pull the latest changes first or use a different push mode.")}}async#Vt(e){if(e?.abortOnMergeConflict){let n=e.ctx?[e.ctx]:this.#p;if(n.length===0)return{success:!1,message:"No git repos configured",error:new Error("No git repos configured")};try{for(let i of n){let o=this.#ge(i),s=performance.now();await this.git(["fetch","origin",o],{cwd:i.path}),this.#G("git_push_fetch",performance.now()-s,{folder:i.folderName,mode:"abort-on-conflict"});let a=performance.now(),A=!0;try{await this.git(["merge",`origin/${o}`],{cwd:i.path})}catch(c){if(A=!1,(await this.#V(i.path)).length>0){try{await this.git(["merge","--abort"],{cwd:i.path})}catch(l){this.#e.Sentry?.captureException(l,{tags:{operation:"codegen-git",endpoint:"pullLatestFromRemote-abort-merge-conflict",folderName:i.folderName}})}throw new Error(`[GIT_PUSH_ERROR] Cannot push: merge conflict detected in ${i.folderName} when pulling latest changes. The merge has been aborted. Please resolve conflicts manually.`)}throw c}finally{this.#G("git_push_merge",performance.now()-a,{folder:i.folderName,mode:"abort-on-conflict",success:String(A)})}}return{success:!0}}catch(i){this.#e.Sentry?.captureException(i,{tags:{operation:"codegen-git",endpoint:"pullLatestFromRemote"}});let o=ed(i);return{success:!1,message:o,error:i instanceof Error?i:new Error(o)}}}return await this.#K(this.#St({branches:[],allowUnrelatedHistory:!1,canPush:!1,uncommittedChanges:"commit",fastForward:"auto",requestRefresh:e?.requestRefresh??!0,syncRemoteBranch:!0}),"syncChangesFromBranches",!0)}async abortMerge(e=!0){try{let r=await this.#J(async n=>{try{return await this.git(["merge","--abort"],{cwd:n.path}),!0}catch{return!1}});return this.#Ze=void 0,e&&r.results.some(n=>n.result===!0)&&(await this.#S(),await this.#fe(),this.requestRefresh()),r.success?{success:!0,message:"Merge aborted"}:{success:!1,message:`Failed to abort merge in: ${r.results.filter(i=>!i.success).map(i=>i.folderName).join(", ")}`,error:new Error("Merge abort failed in some repositories")}}catch(r){await this.#S();let n=ed(r);return{success:!1,message:n,error:r instanceof Error?r:new Error(n)}}}async syncChangesFromRemote(e){let r=[],n=e?.remoteBranches??"both";return n==="both"?r.push(this.getAiBranch(),this.getFeatureBranch()):n==="main"?r.push(this.getFeatureBranch()):n==="ai"&&r.push(this.getAiBranch()),await this.#K(this.#St({branches:r,allowUnrelatedHistory:e?.allowUnrelatedHistory??!0,canPush:e?.canPush??!1,uncommittedChanges:e?.uncommittedChanges??"commit",requestRefresh:e?.requestRefresh,fastForward:e?.fastForward??"auto"}),"syncChangesFromRemote",!0)}async#V(e){try{return(await this.git(["--no-pager","diff","--name-only","--diff-filter=U"],{cwd:e})).trim().split(`
|
|
1902
1902
|
`).filter(i=>i.length>0)}catch{return[]}}async#rt(){return(await this.#J(async r=>{let n=await this.#V(r.path);return this.#N()?n:n.map(i=>this.#e.join(r.path,i))})).results.flatMap(r=>r.success?r.result??[]:[])}async#zt(e){let r=n=>n.split(`
|
|
1903
1903
|
`).map(i=>i.trim().slice(0,400)).filter(i=>i.length>0).slice(0,20);try{let n=this.#L||"main",i=await this.git(["log",n,"-n","20","--format=%s"],{cwd:e});return r(i)}catch{try{let n=await this.git(["log","-n","20","--format=%s"],{cwd:e});return r(n)}catch{return[]}}}async#St({branches:e,allowUnrelatedHistory:r,canPush:n,fastForward:i,uncommittedChanges:o,requestRefresh:s=!1,syncRemoteBranch:a=!1}){try{if(!this.#m)throw new Error("Can not pull changes in non-git mode");if(!a&&!e.length)throw new Error("At least one branch name is required");let A=this.getAiBranch(),c=this.getFeatureBranch(),u=[],l=performance.now();await this.#ne(!1),this.#G("git_sync_commit_accumulated",performance.now()-l);let g=(await this.#J(async d=>{let f=d.path,h;a?h=[this.#ge(d)]:h=e.map(Q=>Q===c?d.branchName:Q);let C=await this.getCurrentBranch(f);if(C!==A)throw new Error(`Repo ${d.folderName} not on AI branch: ${C} != ${A}`);let I=await this.#V(f);if(I.length>0)throw new Error(`Merge conflict in ${d.folderName}:
|
|
1904
1904
|
${I.join(`
|
|
@@ -1907,11 +1907,11 @@ ${I.join(`
|
|
|
1907
1907
|
- their branch (theirs): refs/remotes/origin/${Q} ${S?" -- this is main/feature branch (work here needs to be preserved)":"-- same branch pushed by remote"}
|
|
1908
1908
|
`),v}}if(n){let Q=await this.#vt(!0,d);await this.git(Q,{cwd:d.path})}if(B)try{await this.git(["stash","pop"],{cwd:f})}catch(Q){this.#e.Sentry?.captureException(Q,{tags:{operation:"codegen-git",endpoint:"syncChanges-stash-pop"}})}})).results.filter(d=>!d.success||d.error);if(g.length>0){let d=g.map(f=>f.error?.message||`${f.folderName} failed`).join("; ");throw new Error(`Sync failed: ${d}`)}if(n){let d=await this.#xe(!1);if(!d.success)throw d.error}else{await this.#S();let d=await this.#O();this.#R={...this.#R,...d},await this.#de({lastCommit:Ks(d)})}return u.length>0&&this.queueSystemReminder({text:u.join(`
|
|
1909
1909
|
|
|
1910
|
-
`)}),s&&this.requestRefresh(),{success:!0,message:`Successfully merged ${e.join(", ")} in all repos`}}catch(A){this.#
|
|
1910
|
+
`)}),s&&this.requestRefresh(),{success:!0,message:`Successfully merged ${e.join(", ")} in all repos`}}catch(A){this.#r.error(`Error syncing changes from branches: ${A}`,{loggerOptions:{debug:!0}}),await this.#S();let c=await this.#O();this.#R={...this.#R,...c},this.#e.Sentry?.captureException(A,{tags:{operation:"codegen-git",endpoint:"syncChangesFromBranches"},extra:{branches:e,allowUnrelatedHistory:r}});let u=ed(A);return{success:!1,message:u,error:A instanceof Error?A:new Error(u)}}}async getCurrentCommitHash(e="HEAD",r){if(this.#m)try{let n=["rev-parse",e];return(await this.git(n,{sys:this.#e,cwd:r})).trim()}catch{return}}async#O(e="HEAD"){let r={};for(let n of this.gitRepoContexts)try{let i=await this.getCurrentCommitHash(e,n.path);i&&(r[n.folderName]=i)}catch(i){this.#r.warn(`Failed to get commit for ${n.folderName}:`,i)}return r}async getCurrentBranch(e){return(await this.git(["branch","--show-current"],{cwd:e})).trim()}getFeatureBranch(){if(!this.#L)throw new Error("Feature branch is missing");return this.#L}getAiBranch(){if(!this.#H)throw new Error("AI branch is missing");return this.#H}async git(e,r){if(!this.#m)throw new Error("Can not execute git command in non-git mode.");let n=e[0];(n==="push"||n==="fetch"||n==="pull")&&await this.#tt();let o=typeof r=="object"?{sys:this.#e,...r}:r,s=await this.#Ft(()=>this.#er(e,o));return this.#Zt(n)&&(this.#be.clear(),this.#we.clear()),s}static#Wt=new Set(["commit","merge","rebase","checkout","switch","pull","fetch","reset","cherry-pick","revert","am","stash","push"]);#Zt(e){return!!e&&t.#Wt.has(e)}async#J(e){if(this.#p.length===0)return{success:!0,partialSuccess:!1,results:[]};let n=(await Promise.allSettled(this.#p.map(s=>e(s)))).map((s,a)=>({folderName:this.#p[a].folderName,success:s.status==="fulfilled",result:s.status==="fulfilled"?s.value:void 0,error:s.status==="rejected"?s.reason:void 0,message:s.status==="rejected"?s.reason?.message:void 0})),i=n.filter(s=>s.success),o=n.filter(s=>!s.success);return{success:o.length===0,partialSuccess:i.length>0&&o.length>0,results:n}}#xt(e){let r=us(e),n=this.#p.find(a=>{let A=us(a.folderName);return r.startsWith(A+"/")||r===A});if(n)return n;let i=e.startsWith("/")||e.includes(":")?e:this.#e.resolve(this.#I,e),o=us(i);return this.#p.find(a=>{let A=us(a.path);return o.startsWith(A+"/")||o===A})}#Xt(e){let r=new Map;for(let n of e){let i=this.#xt(n);if(i){let o=r.get(i.folderName)||[];o.push(n),r.set(i.folderName,o)}}return r}#Ft(e){let r=this.#lt.then(()=>e());return this.#lt=r.catch(()=>{}),r}async#er(e,r){if(!this.#m)throw new Error(`Can not execute git command in non-git mode: git ${e.join(" ")}`);let n=`git ${e.join(" ")}`;this.#Ae&&this.#e.Sentry?.captureException(new Error(`currentGitCommand is not finished yet. Current command: ${this.#Ae}, New command Received: ${n}`),{tags:{operation:"codegen-git"},extra:{oldCommand:this.#Ae,newCommand:n}});try{this.#Ae=n;let i=typeof r=="object"?r:void 0,o=typeof r=="string"?r:i?.cwd??this.primaryGitPath;return await Ga("git",e,{...i,cwd:o,sys:this.#e,timeout:60*1e3})}finally{this.#Ae=void 0}}setDebug(e){this.#a=e,e&&!process.env.DEBUG?(process.env.DEBUG="1",this.#f=!0):!e&&this.#f&&(delete process.env.DEBUG,this.#f=!1)}async createTerminal(e){let r=this.#d,n=e?.terminalId||`pty_${Date.now()}_${(0,CF.randomUUID)()}`,i=this.#nt().find(B=>B.terminalId===n),o=new Set,s=new Set;if(i&&e?.terminalId){if(!e?.force)return i;let B=this.#w.get(e.terminalId);if(!B)return i;B.onDataListeners.forEach(E=>{o.add(E)}),B.onExitListeners.forEach(E=>{s.add(E)}),this.disposeTerminal({terminalId:n,emitTerminals:!1})}let a=e?.shell||(process.platform==="win32"?"powershell.exe":process.env.SHELL||"/bin/bash"),A=e?.cols??120,c=e?.rows??30,u={...process.env,...r?.envVars,...e?.env};e?.inheritCredentials&&(u.BUILDER_USER_ID=e.createdBy??this.#s.userId,u.BUILDER_PUBLIC_KEY=this.#s.builderPublicKey,u.BUILDER_PRIVATE_KEY=this.#s.builderPrivateKey);let l=[],p=B=>{for(let E of o)E(B)},g=({exitCode:B,error:E})=>{let y=this.#w.get(n);y&&(y.state=E?"error":"exited",y.exitCode=B);for(let D of s)D(B);this.#w.delete(n),l.forEach(D=>D())},d=e?.cwd||this.#v,f,h;if(e?.readonly){f="starting";let B=!r?.hasSetupEnvVars,E=KA(a,e?.initialCommand??"true",{cwd:d,env:u,stdio:["ignore","pipe","pipe"]},B);E.on("spawn",()=>{let y=this.#w.get(n);y&&(y.state="running")}),E.stdout.on("data",y=>{p(y.toString())}),E.stderr.on("data",y=>{p(y.toString())}),E.on("error",y=>{g({exitCode:1,error:y})}),E.on("exit",y=>{g({exitCode:y??0})}),l.push(()=>{try{E.removeAllListeners()}catch{}E.kill()}),h=E}else{f="running";let B=L2(this.#e);if(!B)throw new Error("Could not import node-pty");let E=a.includes("bash")||a.includes("zsh"),y=a.includes("zsh")?"%~ $ ":"\\w $ ",D=B.spawn(a,[],{name:"xterm-color",cwd:d,cols:A,rows:c,env:E?{...u,PS1:y}:u}),b=D.onData(p);l.push(()=>{try{b?.dispose?.()}catch{}});let Q=D.onExit(g);l.push(()=>{try{Q?.dispose?.()}catch{}});let v=e?.initialCommand;v&&(v.endsWith(`
|
|
1911
1911
|
`)||(v+=`
|
|
1912
|
-
`),D.write(v)),h=D}let C=Date.now(),I={terminalId:n,title:e?.title||`Terminal ${this.#w.size+1}`,cwd:d,createdAt:C,lastWrittenAt:C,createdBy:e?.createdBy||"unknown",readonly:e?.readonly??!1,initialCommand:e?.initialCommand,builtIn:!1,state:f,stale:!1,exitCode:void 0,command:void 0};return this.#w.set(n,{...I,pty:h,onDataListeners:o,onExitListeners:s,disposeFns:l,env:e?.env,shell:a,inheritCredentials:e?.inheritCredentials}),(e?.emitTerminals??!0)&&this.#pe(),I}#nt(){let e=this.getSessionContext(),r=Array.from(this.#w.values()).map(o=>({terminalId:o.terminalId,title:o.title,cwd:o.cwd,createdAt:o.createdAt,lastWrittenAt:o.lastWrittenAt,createdBy:o.createdBy,readonly:o.readonly,builtIn:o.builtIn,exitCode:o.exitCode,state:o.state,stale:o.stale,command:o.command})),n=[];this.#
|
|
1912
|
+
`),D.write(v)),h=D}let C=Date.now(),I={terminalId:n,title:e?.title||`Terminal ${this.#w.size+1}`,cwd:d,createdAt:C,lastWrittenAt:C,createdBy:e?.createdBy||"unknown",readonly:e?.readonly??!1,initialCommand:e?.initialCommand,builtIn:!1,state:f,stale:!1,exitCode:void 0,command:void 0};return this.#w.set(n,{...I,pty:h,onDataListeners:o,onExitListeners:s,disposeFns:l,env:e?.env,shell:a,inheritCredentials:e?.inheritCredentials}),(e?.emitTerminals??!0)&&this.#pe(),I}#nt(){let e=this.getSessionContext(),r=Array.from(this.#w.values()).map(o=>({terminalId:o.terminalId,title:o.title,cwd:o.cwd,createdAt:o.createdAt,lastWrittenAt:o.lastWrittenAt,createdBy:o.createdBy,readonly:o.readonly,builtIn:o.builtIn,exitCode:o.exitCode,state:o.state,stale:o.stale,command:o.command})),n=[];this.#D?.includes("Bash")&&n.push({terminalId:"bash-tools",title:"Bash",cwd:this.#v,createdAt:e.createdUnixTime,lastWrittenAt:Date.now(),createdBy:"fusion",readonly:!0,builtIn:!0,exitCode:void 0,state:"running",command:void 0});let i=this.#d;if(i){let o=Date.now();if(i.devState!=="unset"&&n.push({terminalId:"dev-command",title:"Dev Command",cwd:this.#v,createdAt:e.createdUnixTime,lastWrittenAt:o,createdBy:"fusion",readonly:!i.devCommandProcess?.write,builtIn:!0,state:i.devState==="running"?"running":"exited",exitCode:void 0,command:i.devCommand}),i.setupCommand&&n.push({terminalId:"setup-command",title:"Setup Command",cwd:this.#v,createdAt:e.createdUnixTime,lastWrittenAt:o,createdBy:"fusion",readonly:!0,builtIn:!0,state:i.setupState==="installing"?"running":"exited",exitCode:void 0,command:i.setupCommand}),i.validateCommandState!=="unset"){let s;switch(i.validateCommandState){case"running":s="running";break;case"success":s="exited";break;case"failure":s="error";break;case"stopped":s="exited";break}n.unshift({terminalId:"validate-command",title:"Validate Command",cwd:this.#v,createdAt:e.createdUnixTime,lastWrittenAt:o,createdBy:"fusion",readonly:!0,builtIn:!0,state:s,exitCode:void 0,command:i.validateCommand})}}return n.push(...r),n}#pe(){this.#g.emit("step",{type:"terminals",terminals:this.#nt()})}updateTerminal({terminalId:e,cols:r,rows:n,title:i}){if(e==="dev-command"){if(r||n){let s=this.#d;if(s?.devCommandProcess?.resize)return s.devCommandProcess.resize(r,n),!0}return!1}let o=this.#w.get(e);return o?("resize"in o.pty&&(r||n)&&o.pty.resize(r??o.pty.cols,n??o.pty.rows),i&&(o.title=i,this.#pe()),!0):!1}writeTerminal({terminalId:e,data:r}){if(e==="dev-command"){let i=this.#d;return i?.devCommandProcess?.write?(i.devCommandProcess.write(r),!0):!1}let n=this.#w.get(e);return!n||n.readonly?!1:("write"in n.pty&&n.pty.write(r),n.lastWrittenAt=Date.now(),!0)}signalTerminal({terminalId:e,signal:r}){if(e==="dev-command"){let i=this.#d;return i?.devCommandProcess?.kill?(i.devCommandProcess.kill(r),!0):!1}let n=this.#w.get(e);if(!n||n.readonly)return!1;try{"write"in n.pty?process.platform==="win32"?n.pty.kill():(r==="SIGINT"&&n.pty.write(""),n.pty.kill(r)):n.pty.kill(r)}catch{}return!0}disposeTerminal({terminalId:e,emitTerminals:r=!0}){let n=this.#w.get(e);if(!n)return!1;try{n.pty.kill()}catch{}return n.disposeFns.forEach(i=>{try{i()}catch{}}),n.onDataListeners.clear(),n.onExitListeners.clear(),n.disposeFns=[],this.#w.delete(e),r&&this.#pe(),!0}async restartTerminal({terminalId:e}){if(e==="dev-command"){let i=this.#d;if(i)try{return await i.restart(),!0}catch(o){return this.#e.Sentry?.captureException(o),!1}return!1}if(e==="setup-command"){let i=this.#d;if(i)try{return await i.runSetupCommand(),!0}catch(o){return this.#e.Sentry?.captureException(o),!1}return!1}if(e==="validate-command"){if(this.#d)try{return await this.#Mt(),!0}catch(o){return this.#e.Sentry?.captureException(o),!1}return!1}if(e==="bash-tools")return!1;let r=this.#w.get(e);return r?(await this.createTerminal({terminalId:e,title:r.title,cwd:r.cwd,env:r.env,shell:r.shell,cols:"cols"in r.pty?r.pty.cols:void 0,rows:"rows"in r.pty?r.pty.rows:void 0,createdBy:r.createdBy,emitTerminals:!1,initialCommand:r.initialCommand,readonly:r.readonly,inheritCredentials:r.inheritCredentials,force:!0}),this.#w.get(e)?(this.#pe(),!0):!1):!1}subscribeTerminal({terminalId:e,onData:r,onExit:n}){if(e==="dev-command"){let i=this.#d;if(i){let o=i.getDevWrite();return o&&r(o),i.emitter.on("stdout",r),i.emitter.on("stderr",r),()=>{i.emitter.off("stdout",r),i.emitter.off("stderr",r)}}}else if(e==="setup-command"){let i=this.#d;if(i){let o=i.getSetupOutput();return o&&r(o),i.emitter.on("installStdout",r),i.emitter.on("installStderr",r),()=>{i.emitter.off("installStdout",r),i.emitter.off("installStderr",r)}}}else if(e==="validate-command"){let i=this.#d;if(i){let o=i.getValidateOutput();return o&&r(o),i.emitter.on("validateStdout",r),i.emitter.on("validateStderr",r),()=>{i.emitter.off("validateStdout",r),i.emitter.off("validateStderr",r)}}}else if(e==="bash-tools"){let i=o=>{o.type==="stdio"&&o.source==="tool-command"&&r(o.content)};return this.#g.on("step",i),()=>{this.#g.off("step",i)}}else{let i=this.#w.get(e);if(!i)throw new Error("Terminal not found");return i.onDataListeners.add(r),n&&i.onExitListeners.add(n),()=>{i.onDataListeners.delete(r),n&&i.onExitListeners.delete(n)}}}async getAllFiles(e={}){let{getDotFiles:r=!1,globbyPattern:n="**/*",includePattern:i,gitignore:o,deep:s,truncate:a,maxFiles:A=5e4,onlyFiles:c=!0}=e,u=this.#u?.accessControl,l=u?.entries?.filter(f=>f.action==="allow"&&f.permissions.includes("list")).map(f=>(f.resource.startsWith("/")?f.resource.slice(1):f.resource)||".")??[];if(!this.#E?.folders?.length){let f=await Dp({basePath:this.#I,globPattern:[i??n,...l],extraIgnorePatterns:ev(u).deny,dot:r,gitignore:o,sys:this.#e,deep:s,onlyFiles:c,maxFiles:A});return WU(f,a)}let p=[],g=await this.#e.readdir(this.#I);for(let f of g)mJ(f)&&p.push(f);!p.includes("AGENTS.md")&&this.#E.agentsMD&&p.push("AGENTS.md");for(let f of this.#E.folders){let h=this.#e.resolve(this.#I,f.path),C=await Dp({basePath:h,globPattern:[n,...l],dot:r,gitignore:o,sys:this.#e,deep:s,onlyFiles:c,maxFiles:A}),I=this.#N()?".":f.name||this.#e.basename(h);for(let B of C)I!=="."?p.push(this.#e.join(I,B)):p.push(B)}let d=nm({files:p,policy:u,filterPattern:i,getDotFiles:r});return WU(d,a)}async searchFiles(e){let{query:r,caseInsensitive:n=!0,includeGlob:i,excludeGlob:o,maxResults:s=1e3,contextBefore:a=0,contextAfter:A=0}=e,c=await Sh(this.#e),u=["--path-separator","/","--json","--line-number","--column","--hidden","--max-columns","500"];return n&&u.push("-i"),a>0&&u.push("-B",a.toString()),A>0&&u.push("-A",A.toString()),i&&u.push("--glob",i),o&&u.push("--glob",`!${o}`),u.push("--ignore-file",".builderignore"),u.push("--",r),new Promise(l=>{let p=GA({command:c,args:u,options:{env:process.env,cwd:this.#v,stdio:["ignore","pipe","pipe"]}}),g=new Di(5e4);p.stdout.on("data",d=>{g.write(d.toString())}),p.on("error",()=>{l({matches:[],totalMatches:0,filesWithMatches:0,truncated:!1})}),p.on("close",d=>{if(d!==0)l({matches:[],totalMatches:0,filesWithMatches:0,truncated:!1});else{let f=[],h=new Set,I=g.getContent().split(`
|
|
1913
1913
|
`),B=[],E=null;for(let D of I)if(D.trim())try{let b=JSON.parse(D);if(b.type==="match"){let Q=b.data.path.text,v=b.data.line_number,S=b.data.lines.text.trimEnd(),x=b.data.submatches||[],U,H;x.length>0&&(U=x[0].start,H=x[0].end),h.add(Q);let L={filePath:Q,lineNumber:v,lineContent:S,columnStart:U,columnEnd:H,contextBefore:B,contextAfter:[]};if(B=[],E=L,f.push(L),f.length>=s)break}else if(b.type==="context"){let Q=b.data.line_number,v=b.data.lines.text.trimEnd();E&&Q>E.lineNumber?E.contextAfter.push(v):B.push(v)}}catch{continue}let y=f.length>=s;l({matches:f,totalMatches:f.length,filesWithMatches:h.size,truncated:y})}})})}async searchFileTree(e){let{query:r,excludeGlob:n,maxResults:i=100}=e,o=await Sh(this.#e),s=["--files","--path-separator","/"],a=gge(r);a&&s.push("--glob",a),n&&s.push("--glob",`!${n}`);let A=this.#u?.accessControl,c=ev(A).deny;for(let l of c)s.push("--glob",`!${l}`);s.push("--ignore-file",".builderignore");let u=r.toLowerCase();return new Promise(l=>{let p=GA({command:o,args:s,options:{env:process.env,cwd:this.#v,stdio:["ignore","pipe","pipe"]}}),g=new Di(1e5);p.stdout.on("data",d=>{g.write(d.toString())}),p.on("error",()=>{l({matches:[],totalMatches:0,truncated:!1})}),p.on("close",d=>{if(d!==0&&d!==1){l({matches:[],totalMatches:0,truncated:!1});return}let f=g.getContent(),h=[...new Set(f.split(`
|
|
1914
|
-
`).filter(B=>B.trim()))];h=nm({files:h,policy:A,getDotFiles:!0});let C=[];for(let B of h){let E=B.lastIndexOf("/"),y=E>=0?B.slice(E+1):B,D=E>=0?B.slice(0,E):"",b=uge(u,B.toLowerCase()),Q=lge(u,B,b);C.push({filePath:B,fileName:y,parentPath:D,matchIndices:b,score:Q})}C.sort((B,E)=>E.score-B.score);let I=C.slice(0,i).map(({score:B,...E})=>E);l({matches:I,totalMatches:h.length,truncated:h.length>i})})})}async collectRepoMetrics(e={}){let r=this.#ve(e.folderName);return e.rootPath&&(r=this.#e.join(r,e.rootPath)),Rge(this.#e,r)}getSessionId(){return this.getSessionContext().sessionId}updateMetadata(e){this.#ot(e,!1)}getMetadata(){return this.#U}#it=null;setTimeline(e){this.#it=e}getTimeline(){return this.#it}getSpaceId(){return this.#s.builderPublicKey}async revertToCommitSnapshot(e){this.#k=!1,this.#te=void 0,await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let n=(await this.#J(async o=>{let s=yl(e,o.folderName,this.gitRepoContexts[0]?.folderName);return s?(await this.git(["revert","--no-commit",`${s}..HEAD`],{cwd:o.path}),await this.git(["commit","--allow-empty","--quiet","--no-verify","--no-gpg-sign","-m","Revert changes"],{cwd:o.path}),{commitHash:await this.getCurrentCommitHash("HEAD",o.path)}):(this.#n.warn(`No commit found for ${o.folderName}, skipping revert`),{skipped:!0})})).results.filter(o=>!o.success);if(n.length>0)throw new Error(`Failed to revert ${n.length} repos`);let i=await this.#O();this.#R={...this.#R,...i},await this.#S(),this.requestRefresh(),await this.#de({lastCommit:Ks(i)})}async revertToCommitHash(e){let r=mm(e,this.gitRepoContexts[0]?.folderName),n=Object.keys(r).length===0?e:Ks(r);return this.revertToCommitSnapshot(n)}async resetToCommitSnapshot(e,r=!0){this.#k=!1,this.#te=void 0,await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let i=(await this.#J(async s=>{let a=yl(e,s.folderName,this.gitRepoContexts[0]?.folderName);if(!a)return this.#n.warn(`No commit found for ${s.folderName}, skipping reset`),{skipped:!0};await this.git(["reset","--quiet","--hard",a],{cwd:s.path}),await this.git(["clean","-fd"],{cwd:s.path});let A=await this.getCurrentCommitHash("HEAD",s.path);if(A!==a)throw new Error(`Failed to reset commit hash for ${s.folderName}: expected ${a}, got ${A}`);return{commitHash:A}})).results.filter(s=>!s.success);if(i.length>0)throw new Error(`Failed to reset ${i.length} repos`);let o=mm(e,this.gitRepoContexts[0]?.folderName);this.#R={...this.#R,...o},await this.#S(),r&&this.requestRefresh()}async resetToCommitHash(e,r=!0){let n=mm(e,this.gitRepoContexts[0]?.folderName),i=Object.keys(n).length===0?e:Ks(n);return this.resetToCommitSnapshot(i,r)}async restore({location:e,predicate:r,revert:n=!1,dryRun:i=!1,forceReplay:o=!1,debug:s}){let a=this.getSessionContext(),A=a.turns.length,c=null;for(let d=A-1;d>=-1;d--)if(r(d>=0?a.turns[d]:null,d)){c=d;break}if(c===null)return{undone:null,message:"Could not find the target to restore to, the completion id could be wrong"};n||await this.abort({cleanCurrentMessage:!0});let u=new Map,l=!!this.#m,p=a.turns,g=Math.max(0,e==="before"?c:c+1);for(let d=p.length-1;d>=g;d--){let f=p[d];for(let h of f.applyResults)u.set(h.filePath,h.oldContent??"")}if(!i){let d;if(l){c===-1?a.beforeCommit?d=a.beforeCommit:p.length>0&&(d=p[0].beforeCommit):c<p.length&&(e==="after"?(d=p[c].afterCommit,!d&&c+1<p.length&&(d=p[c+1].beforeCommit)):d=p[c].beforeCommit);let I={commitSnapshot:d,sessionId:a.sessionId,sessionBeforeCommit:a.beforeCommit,turnsLength:p.length,targetIndex:c,currentTurn:p[p.length-1],targetTurn:p[c],targetTurnNext:p[c+1],location:e,forceReplay:o,dryRun:i,debug:s};if(!d)return this.#e.Sentry?.captureException(new Error("No commit snapshot found for restore"),{tags:{operation:"codegen-git",endpoint:"revertToCommitHash"},contexts:{restore:I}}),{undone:null,message:"Could not find the target to restore to, the git history is missing"};try{n?await this.revertToCommitSnapshot(d):await this.resetToCommitSnapshot(d)}catch(B){return this.#e.Sentry?.captureException(new Error("Error resetting git",{cause:B}),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},contexts:{restore:I}}),{undone:null,message:"Failed to reset/restore, the file history is missing"}}}else for(let[I,B]of u.entries())try{B?await this.writeFile(I,B):await this.deleteFile(I)}catch{}if(n)return{undone:[],message:"The revert operation was successful"};let f=p.splice(g,p.length-g),h=oc(p);h&&h?.afterCommit!==d&&(this.#e.Sentry?.captureException(new Error("Reset After commit snapshot mismatch"),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},extra:{lastTurn:h,commitSnapshot:d}}),h.lastCommit=d,await this.#de({completionId:h.completionId,lastCommit:d}));let C=h?.completionId;if(f.length>0&&(await cJ(this.#e,this.#s,{lastCompletionId:C,sessionId:a.sessionId},!!this.#a),a.updatedUnixTime=Date.now()),o){let I=a.state;this.#g.emit("step",{type:"batch",steps:[{type:"state",newState:"replay",abortable:!1,previousState:I},...this.#Tt(),{type:"restore",files:Array.from(u.keys()),lastCompletionId:C,location:e},{type:"state",newState:I,abortable:!1,previousState:"replay"}]})}else f.length>0&&this.#g.emit("step",{type:"restore",files:Array.from(u.keys()),lastCompletionId:C,location:e})}return await this.#kt(),{undone:Array.from(u.keys()),message:"The restore operation was successful"}}async#kt(e){return await this.#d?.ensureDevCommand(e)}async restoreFromCompletionId({location:e,completionId:r,forceReplay:n}){let i=this.getSessionContext();return i.turns.find(s=>s.completionId===r)?this.restore({location:e,predicate:s=>s?.completionId===r,forceReplay:n,debug:`restore to: ${r}`}):(await this.#Ce,i.turns=[],i.canLoadMore=!0,await cJ(this.#e,this.#s,{sessionId:i.sessionId,lastCompletionId:r},!!this.#a),await this.loadMoreTurns(),this.restore({location:e,predicate:()=>!0,forceReplay:!0,debug:"restore after history"}))}async restoreBeforeCompletionId(e){return this.restoreFromCompletionId({location:"before",completionId:e,forceReplay:!1})}async undoLastUserMessage(e=!1){return this.restore({location:"before",predicate:r=>r?.user.role==="user",dryRun:e})}getLastUserCompletionId(){let e=this.getSessionContext();return Eye(e)?.completionId}getLastCompletionId(){let e=this.getSessionContext();return aJ(e)?.completionId}getCurrentState(){return this.getSessionContext().state}getLastApplyResultsTurn(){let e=this.getSessionContext();return Bye(e)}getLastTurn(){let e=this.getSessionContext();return aJ(e)}getLastMessage(){return this.getLastTurn()?.actions.find(r=>r.type==="text")?.content}getNextUrl(){return this.getLastTurn()?.nextUrl}async sendFeedback(e){if(process.env.NODE_ENV==="test")return;if(e.feedbackSentiment){let n=e.feedbackSentiment==="positive"?`User provided positive feedback (thumbs up) on the previous completion.${e.feedbackText??""}`:`User provided negative feedback (thumbs down) on the previous completion.${e.feedbackText??""}`;this.queueSystemReminder({text:n,tag:"reminder:user-feedback"})}Jt("quality code feedback given",{spaceId:this.#s.builderPublicKey,sentiment:e.feedbackSentiment,mode:"cli"});let r=e.id??this.getLastCompletionId();r&&await this.#rr({...e,id:r})}#de(e){let r=e.completionId;if(!r){let i=this.getLastTurn();i&&e.lastCommit&&(i.lastCommit=e.lastCommit),r=i?.completionId}let n=AJ(this.#e,this.#s,"/codegen/finalize",{completionId:r,projectId:this.#u?.projectId,branchName:this.#u?.branchName,userCompletionId:this.getLastUserCompletionId(),sessionId:this.getSessionId(),metadata:this.#U,hasPlanToApply:this.#k,...e},this.#a);return this.#Bt&&this.#tr(),this.#K(n,"completionFinalize")}#tr(){try{let e=this.#e.getCwdDir(),r=this.getSessionId();if(this.#We){X2(this.#e,e,r).catch(()=>{});return}let n=Dv(this.#e,e).then(i=>{if(i.some(l=>l.sessionId===r)){this.#We=!0,X2(this.#e,e,r).catch(()=>{});return}let o=this.getSessionContext().turns,s=o[o.length-1],a=s?.title,A=a&&a!=="Untitled"&&!a.startsWith("completionId:"),c=s?.userMessage?.displayPrompt??s?.userMessage?.userPrompt??"",u=A?a:Ige(c);return Cge(this.#e,e,r,u).then(()=>{this.#We=!0})}).catch(()=>{});this.#K(n,"saveLocalHistory")}catch{}}#rr(e){let r=AJ(this.#e,this.#s,"/codegen/feedback",e,this.#a);return this.#K(r,"completionFeedback")}#G(e,r,n={}){this.#d?.emitter.emit("metrics",{durations:[{key:e,ms:r,attributes:n}]})}#K(e,r,n=!1){let i=Za();this.#n.debug(`(addToPendingPromises-${i}): adding ${r} (blocking: ${n})`),this.#le.push(e),n&&this.#_e.push(e);let o=new Error(`Deadlock detected in codegen (function: ${r})`),s=setTimeout(()=>{this.#e.Sentry?.captureException(o,{level:"fatal",tags:{operation:"codegen-stream",functionName:r,sessionId:this.getSessionId(),projectId:this.#E,branchName:this.#D}})},300*1e3);return e.finally(()=>{clearTimeout(s),this.#n.debug(`(addToPendingPromises-${i}): removing ${r} (blocking: ${n})`);let a=this.#_e.indexOf(e);a!==-1&&this.#_e.splice(a,1);let A=this.#le.indexOf(e);A!==-1&&this.#le.splice(A,1)})}async lastTurnHasChanges(){let e=await this.undoLastUserMessage(!0);return e.undone?e.undone.length>0:!1}#j(e){let r=this.getSessionContext(),n=r.state;return n!==e?(r.state=e,this.#g.emit("step",{type:"state",abortable:e==="generating",previousState:n,newState:e}),!0):!1}waitUntilState(e,r=1e4){return new Promise(n=>{if(this.getSessionContext().state===e){n();return}let o,s=a=>{a.type==="state"&&a.newState===e&&(clearTimeout(o),this.#g.removeListener("step",s),n())};o=setTimeout(()=>{this.#g.removeListener("step",s),n()},r),this.#g.on("step",s)})}getProxyConfig(){return iue({devServerUrl:this.#u?.serverUrl,proxyOrigin:this.#Te,proxyDefaultOrigin:this.#Me,proxyDestination:this.#Ct})}async clearSession(){this.#n.debug("(clearSession): clearing session"),await this.abort({cleanCurrentMessage:!0,flushMessageQueue:!1});let e=this.getSessionContext();e.turns=[],e.customInstructions=await this.#Se(),e.customAgents=await this.#Ge(),this.#$.length=0,this.#k=!1,this.#te=void 0,this.#U={},this.#Z=void 0,this.#ke=!1,this.clearMessageQueue(),this.queueGitStatusReminder({trigger:"session-start"}),this.#g.emit("step",this.#Nt())}async clearMessageQueue(e=!1){let r=[];if(e)for(let n of this.#t)n.user&&r.push({type:"user",displayPrompt:n.displayPrompt,user:n.user,role:n.user.role,compacting:!1,idempotencyKey:n.idempotencyKey});this.#t.length=0,this.#Ke(),r.length>0&&this.#g.emit("step",{type:"batch",steps:r})}updateMessage(e){if(e.type==="delete"){let r=this.#t.findIndex(n=>n.idempotencyKey===e.idempotencyKey);r>=0&&this.#t.splice(r,1)}else if(e.type==="move"){let r=this.#t.findIndex(n=>n.idempotencyKey===e.idempotencyKey);r>=0&&Mye(this.#t,r,r+e.delta)}this.#Ke()}async flushMessageQueue(){this.#n.debug("(flushMessageQueue): flushing message queue"),await this.abort({cleanCurrentMessage:!1,flushMessageQueue:!0}),this.#o&&this.#o()}#Rt(e){let r=e.idempotencyKey;if(r){let n=this.#t.findIndex(i=>i.idempotencyKey===r);if(n>=0)return this.#t[n]=e,!1}else e.idempotencyKey=(0,CF.randomUUID)();if(e.queue==null&&(e.queue=!0),e.user?e.user={...this.#Z,...e.user}:e.user=this.#Z,e.userPrompt==="___BROWSER_AUTOMATION_PROMPT___"){let n=this.getProxyConfig();e.userPrompt=Ege(n.proxyDefaultOrigin,this.#Qe||void 0)}return this.#t.push(e),!0}async sendMessage(e){this.#ke=!1;let r=0;if(Array.isArray(e))for(let i of e)this.#Rt(i)&&r++;else this.#Rt(e)&&r++;if(r===0)return null;this.#n.debug(`(sendMessage): added messages(${r}) to queue(${this.#t.length})`),this.#Ke();let n=this.#t[this.#t.length-1];return n?(this.#k=!1,this.#te=void 0,this.cancelAllPendingToolFulfilments(n.userPrompt),n.queue?this.#o&&this.#o():await this.flushMessageQueue(),await Bl(),n.idempotencyKey):null}#nr(){if(this.#A==="until-idle")return;let e=this.#t;if(e.length!==0){for(let r of e)if(r.systemReminders)for(let n of r.systemReminders)this.queueSystemReminder(n);return this.#i=uJ(e),this.#Z=this.#i.user,this.#i.softContextWindow&&(this.#b=Math.min(this.#b??3e4,this.#i.softContextWindow)),this.clearMessageQueue(!0),this.#i}}#ir(){let e=this.#t.length===0||this.#ke,r=new Promise(n=>{e?this.#o=n:n()}).then(()=>{let n=this.#t;if(n.length!==0)if(this.#A==="until-idle"){let i=this.#t.shift();if(i.user&&(this.#Z=i.user,this.#g.emit("step",{type:"user",displayPrompt:i.displayPrompt,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.idempotencyKey})),i.systemReminders)for(let o of i.systemReminders)this.queueSystemReminder(o);return this.#i=i,this.#Z=i.user,this.#i.softContextWindow&&(this.#b=Math.min(this.#b??3e4,this.#i.softContextWindow)),this.#Ke(),i}else{for(let o of n)if(o.systemReminders)for(let s of o.systemReminders)this.queueSystemReminder(s);let i=uJ(n);if(!i.dropAbortedPrompt&&this.#i){let o=i.idempotencyKey;i=hJ(this.#i,i),i.idempotencyKey=o}return this.clearMessageQueue(!0),this.#i=i,this.#Z=i.user,i}});return{shouldWait:e,promise:r}}#Ke(){this.#g.emit("step",{type:"message-queue",queue:this.#t.map(e=>({idempotencyKey:e.idempotencyKey,displayPrompt:e.displayPrompt,user:e.user}))})}#ot(e,r=!1){r&&(this.#U={}),Object.assign(this.#U,e),this.#g.emit("step",{type:"metadata",...this.#U})}async waitForSetupCommand(e){let r=this.#d;if(!r)return{state:"installed",shouldProceed:!0};if(r.setupState==="installing")try{await Yc(r.setupCommandPromise,e)}catch{}let n=r.setupState;return n==="not-installed"||n==="install-failed"||n==="install-aborted"?{state:n,shouldProceed:!0}:{state:"installed",shouldProceed:!0}}async waitForDevServer(e,r,n){if(!this.#d&&this.#u?.serverUrl)return{shouldProceed:!0,message:"Dev server is ready.",serverUrl:this.#u.serverUrl};let i=await this.waitForSetupCommand(e);if(!i.shouldProceed)return{shouldProceed:!1,message:`Project setup command did not completed. State: ${i.state}`};let o=this.#d;if(o){await o.ensureDevCommand(e);let s=await o.waitUntilServer(e,r,n);return s.ok?{shouldProceed:!0,message:"Dev server is ready.",serverUrl:o.serverUrl?.toString()}:{shouldProceed:!1,message:s.message,serverUrl:void 0}}return{shouldProceed:!1,message:"Dev server is not ready.",serverUrl:void 0}}async getNamedAgentConfig(e,r,n){let i=this.getSessionContext(),o=i.customAgents,s=e?o.find(H=>H.name.toLowerCase()===e.toLowerCase()):void 0,a=s?.name??"explorer",{mcpServers:A=!1,model:c,mode:u="quality-v4-agent",systemPrompt:l,subagent_type:p,includeMemories:g,needDevServer:d,needValidation:f,queueMode:h,asyncSubAgents:C,resetAfterRun:I=!1,reasoning:B,softContextWindow:E}={mcpServers:s?.mcpServers,subagent_type:a,systemPrompt:s?.systemPrompt,softContextWindow:s?.softContextWindow,model:(()=>{if(s?.roundRobinModels?.length){let H=s.name,L=this.#Et.get(H)??0;return this.#Et.set(H,L+1),s.roundRobinModels[L%s.roundRobinModels.length]}return s?.model})(),mode:s?.mode,includeMemories:s?.includeMemories??a==="explorer",needDevServer:s?.needDevServer,needValidation:s?.needValidation,resetAfterRun:s?.resetAfterRun,queueMode:s?.queueMode,asyncSubAgents:s?.asyncSubAgents,reasoning:s?.reasoning??this.#Ve},y=["Read","Glob","ReadRule","Grep","WebSearch","SearchMemories"];i.sessionMode==="deep-research"&&y.push("Bash","WebFetch"),y=y.filter(H=>this.#Q?this.#Q.includes(H):!0),y.push("ExplorationMetadata");let D=mF(this.#u,s?.tools??y),b=c===void 0?p==="explorer"?"opa5-mini":void 0:c,Q=this.#d;if(d&&n){if(!Q)return{success:!1,response:`The ${p} agent can not be used on this session. Do no try again.`};if(Q.httpServerState.state==="stopped"||Q.httpServerState.state==="connecting"||Q.httpServerState.state==="error-fetch")try{if(Q.state==="not-installed")throw new Error(`The ${p} agent can not be used until the setupCommand finish successfully. However, the dev server is not installed.`);if(Q.state==="install-failed")throw new Error(`The ${p} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it failed.`);if(Q.state==="install-aborted")throw new Error(`The ${p} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it was aborted.`);await this.waitForSetupCommand(n),await Q.ensureDevCommand(n)}catch(L){return{success:!1,response:L instanceof Error?L.message:String(L)}}if(f&&Q.validateCommand&&this.#ee){let L=await Q.runValidateCommand(void 0,n);if(L.status==="failure")return{success:!1,response:`The Agent could not start yet, because the validate command failed:
|
|
1914
|
+
`).filter(B=>B.trim()))];h=nm({files:h,policy:A,getDotFiles:!0});let C=[];for(let B of h){let E=B.lastIndexOf("/"),y=E>=0?B.slice(E+1):B,D=E>=0?B.slice(0,E):"",b=uge(u,B.toLowerCase()),Q=lge(u,B,b);C.push({filePath:B,fileName:y,parentPath:D,matchIndices:b,score:Q})}C.sort((B,E)=>E.score-B.score);let I=C.slice(0,i).map(({score:B,...E})=>E);l({matches:I,totalMatches:h.length,truncated:h.length>i})})})}async collectRepoMetrics(e={}){let r=this.#ve(e.folderName);return e.rootPath&&(r=this.#e.join(r,e.rootPath)),Rge(this.#e,r)}getSessionId(){return this.getSessionContext().sessionId}updateMetadata(e){this.#ot(e,!1)}getMetadata(){return this.#U}#it=null;setTimeline(e){this.#it=e}getTimeline(){return this.#it}getSpaceId(){return this.#s.builderPublicKey}async revertToCommitSnapshot(e){this.#k=!1,this.#te=void 0,await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let n=(await this.#J(async o=>{let s=yl(e,o.folderName,this.gitRepoContexts[0]?.folderName);return s?(await this.git(["revert","--no-commit",`${s}..HEAD`],{cwd:o.path}),await this.git(["commit","--allow-empty","--quiet","--no-verify","--no-gpg-sign","-m","Revert changes"],{cwd:o.path}),{commitHash:await this.getCurrentCommitHash("HEAD",o.path)}):(this.#r.warn(`No commit found for ${o.folderName}, skipping revert`),{skipped:!0})})).results.filter(o=>!o.success);if(n.length>0)throw new Error(`Failed to revert ${n.length} repos`);let i=await this.#O();this.#R={...this.#R,...i},await this.#S(),this.requestRefresh(),await this.#de({lastCommit:Ks(i)})}async revertToCommitHash(e){let r=mm(e,this.gitRepoContexts[0]?.folderName),n=Object.keys(r).length===0?e:Ks(r);return this.revertToCommitSnapshot(n)}async resetToCommitSnapshot(e,r=!0){this.#k=!1,this.#te=void 0,await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let i=(await this.#J(async s=>{let a=yl(e,s.folderName,this.gitRepoContexts[0]?.folderName);if(!a)return this.#r.warn(`No commit found for ${s.folderName}, skipping reset`),{skipped:!0};await this.git(["reset","--quiet","--hard",a],{cwd:s.path}),await this.git(["clean","-fd"],{cwd:s.path});let A=await this.getCurrentCommitHash("HEAD",s.path);if(A!==a)throw new Error(`Failed to reset commit hash for ${s.folderName}: expected ${a}, got ${A}`);return{commitHash:A}})).results.filter(s=>!s.success);if(i.length>0)throw new Error(`Failed to reset ${i.length} repos`);let o=mm(e,this.gitRepoContexts[0]?.folderName);this.#R={...this.#R,...o},await this.#S(),r&&this.requestRefresh()}async resetToCommitHash(e,r=!0){let n=mm(e,this.gitRepoContexts[0]?.folderName),i=Object.keys(n).length===0?e:Ks(n);return this.resetToCommitSnapshot(i,r)}async restore({location:e,predicate:r,revert:n=!1,dryRun:i=!1,forceReplay:o=!1,debug:s}){let a=this.getSessionContext(),A=a.turns.length,c=null;for(let d=A-1;d>=-1;d--)if(r(d>=0?a.turns[d]:null,d)){c=d;break}if(c===null)return{undone:null,message:"Could not find the target to restore to, the completion id could be wrong"};n||await this.abort({cleanCurrentMessage:!0});let u=new Map,l=!!this.#m,p=a.turns,g=Math.max(0,e==="before"?c:c+1);for(let d=p.length-1;d>=g;d--){let f=p[d];for(let h of f.applyResults)u.set(h.filePath,h.oldContent??"")}if(!i){let d;if(l){c===-1?a.beforeCommit?d=a.beforeCommit:p.length>0&&(d=p[0].beforeCommit):c<p.length&&(e==="after"?(d=p[c].afterCommit,!d&&c+1<p.length&&(d=p[c+1].beforeCommit)):d=p[c].beforeCommit);let I={commitSnapshot:d,sessionId:a.sessionId,sessionBeforeCommit:a.beforeCommit,turnsLength:p.length,targetIndex:c,currentTurn:p[p.length-1],targetTurn:p[c],targetTurnNext:p[c+1],location:e,forceReplay:o,dryRun:i,debug:s};if(!d)return this.#e.Sentry?.captureException(new Error("No commit snapshot found for restore"),{tags:{operation:"codegen-git",endpoint:"revertToCommitHash"},contexts:{restore:I}}),{undone:null,message:"Could not find the target to restore to, the git history is missing"};try{n?await this.revertToCommitSnapshot(d):await this.resetToCommitSnapshot(d)}catch(B){return this.#e.Sentry?.captureException(new Error("Error resetting git",{cause:B}),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},contexts:{restore:I}}),{undone:null,message:"Failed to reset/restore, the file history is missing"}}}else for(let[I,B]of u.entries())try{B?await this.writeFile(I,B):await this.deleteFile(I)}catch{}if(n)return{undone:[],message:"The revert operation was successful"};let f=p.splice(g,p.length-g),h=oc(p);h&&h?.afterCommit!==d&&(this.#e.Sentry?.captureException(new Error("Reset After commit snapshot mismatch"),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},extra:{lastTurn:h,commitSnapshot:d}}),h.lastCommit=d,await this.#de({completionId:h.completionId,lastCommit:d}));let C=h?.completionId;if(f.length>0&&(await cJ(this.#e,this.#s,{lastCompletionId:C,sessionId:a.sessionId},!!this.#a),a.updatedUnixTime=Date.now()),o){let I=a.state;this.#g.emit("step",{type:"batch",steps:[{type:"state",newState:"replay",abortable:!1,previousState:I},...this.#Tt(),{type:"restore",files:Array.from(u.keys()),lastCompletionId:C,location:e},{type:"state",newState:I,abortable:!1,previousState:"replay"}]})}else f.length>0&&this.#g.emit("step",{type:"restore",files:Array.from(u.keys()),lastCompletionId:C,location:e})}return await this.#kt(),{undone:Array.from(u.keys()),message:"The restore operation was successful"}}async#kt(e){return await this.#d?.ensureDevCommand(e)}async restoreFromCompletionId({location:e,completionId:r,forceReplay:n}){let i=this.getSessionContext();return i.turns.find(s=>s.completionId===r)?this.restore({location:e,predicate:s=>s?.completionId===r,forceReplay:n,debug:`restore to: ${r}`}):(await this.#Ce,i.turns=[],i.canLoadMore=!0,await cJ(this.#e,this.#s,{sessionId:i.sessionId,lastCompletionId:r},!!this.#a),await this.loadMoreTurns(),this.restore({location:e,predicate:()=>!0,forceReplay:!0,debug:"restore after history"}))}async restoreBeforeCompletionId(e){return this.restoreFromCompletionId({location:"before",completionId:e,forceReplay:!1})}async undoLastUserMessage(e=!1){return this.restore({location:"before",predicate:r=>r?.user.role==="user",dryRun:e})}getLastUserCompletionId(){let e=this.getSessionContext();return Eye(e)?.completionId}getLastCompletionId(){let e=this.getSessionContext();return aJ(e)?.completionId}getCurrentState(){return this.getSessionContext().state}getLastApplyResultsTurn(){let e=this.getSessionContext();return Bye(e)}getLastTurn(){let e=this.getSessionContext();return aJ(e)}getLastMessage(){return this.getLastTurn()?.actions.find(r=>r.type==="text")?.content}getNextUrl(){return this.getLastTurn()?.nextUrl}async sendFeedback(e){if(process.env.NODE_ENV==="test")return;if(e.feedbackSentiment){let n=e.feedbackSentiment==="positive"?`User provided positive feedback (thumbs up) on the previous completion.${e.feedbackText??""}`:`User provided negative feedback (thumbs down) on the previous completion.${e.feedbackText??""}`;this.queueSystemReminder({text:n,tag:"reminder:user-feedback"})}Jt("quality code feedback given",{spaceId:this.#s.builderPublicKey,sentiment:e.feedbackSentiment,mode:"cli"});let r=e.id??this.getLastCompletionId();r&&await this.#rr({...e,id:r})}#de(e){let r=e.completionId;if(!r){let i=this.getLastTurn();i&&e.lastCommit&&(i.lastCommit=e.lastCommit),r=i?.completionId}let n=AJ(this.#e,this.#s,"/codegen/finalize",{completionId:r,projectId:this.#u?.projectId,branchName:this.#u?.branchName,userCompletionId:this.getLastUserCompletionId(),sessionId:this.getSessionId(),metadata:this.#U,hasPlanToApply:this.#k,...e},this.#a);return this.#Bt&&this.#tr(),this.#K(n,"completionFinalize")}#tr(){try{let e=this.#e.getCwdDir(),r=this.getSessionId();if(this.#We){X2(this.#e,e,r).catch(()=>{});return}let n=Dv(this.#e,e).then(i=>{if(i.some(l=>l.sessionId===r)){this.#We=!0,X2(this.#e,e,r).catch(()=>{});return}let o=this.getSessionContext().turns,s=o[o.length-1],a=s?.title,A=a&&a!=="Untitled"&&!a.startsWith("completionId:"),c=s?.userMessage?.displayPrompt??s?.userMessage?.userPrompt??"",u=A?a:Ige(c);return Cge(this.#e,e,r,u).then(()=>{this.#We=!0})}).catch(()=>{});this.#K(n,"saveLocalHistory")}catch{}}#rr(e){let r=AJ(this.#e,this.#s,"/codegen/feedback",e,this.#a);return this.#K(r,"completionFeedback")}#G(e,r,n={}){this.#d?.emitter.emit("metrics",{durations:[{key:e,ms:r,attributes:n}]})}#K(e,r,n=!1){let i=Za();this.#r.debug(`(addToPendingPromises-${i}): adding ${r} (blocking: ${n})`),this.#le.push(e),n&&this.#_e.push(e);let o=new Error(`Deadlock detected in codegen (function: ${r})`),s=setTimeout(()=>{this.#e.Sentry?.captureException(o,{level:"fatal",tags:{operation:"codegen-stream",functionName:r,sessionId:this.getSessionId(),projectId:this.#h,branchName:this.#y}})},300*1e3);return e.finally(()=>{clearTimeout(s),this.#r.debug(`(addToPendingPromises-${i}): removing ${r} (blocking: ${n})`);let a=this.#_e.indexOf(e);a!==-1&&this.#_e.splice(a,1);let A=this.#le.indexOf(e);A!==-1&&this.#le.splice(A,1)})}async lastTurnHasChanges(){let e=await this.undoLastUserMessage(!0);return e.undone?e.undone.length>0:!1}#j(e){let r=this.getSessionContext(),n=r.state;return n!==e?(r.state=e,this.#g.emit("step",{type:"state",abortable:e==="generating",previousState:n,newState:e}),!0):!1}waitUntilState(e,r=1e4){return new Promise(n=>{if(this.getSessionContext().state===e){n();return}let o,s=a=>{a.type==="state"&&a.newState===e&&(clearTimeout(o),this.#g.removeListener("step",s),n())};o=setTimeout(()=>{this.#g.removeListener("step",s),n()},r),this.#g.on("step",s)})}getProxyConfig(){return iue({devServerUrl:this.#u?.serverUrl,proxyOrigin:this.#Te,proxyDefaultOrigin:this.#Me,proxyDestination:this.#Ct})}async clearSession(){this.#r.debug("(clearSession): clearing session"),await this.abort({cleanCurrentMessage:!0,flushMessageQueue:!1});let e=this.getSessionContext();e.turns=[],e.customInstructions=await this.#Se(),e.customAgents=await this.#Ge(),this.#$.length=0,this.#k=!1,this.#te=void 0,this.#U={},this.#Z=void 0,this.#ke=!1,this.clearMessageQueue(),this.queueGitStatusReminder({trigger:"session-start"}),this.#g.emit("step",this.#Nt())}async clearMessageQueue(e=!1){let r=[];if(e)for(let n of this.#t)n.user&&r.push({type:"user",displayPrompt:n.displayPrompt,user:n.user,role:n.user.role,compacting:!1,idempotencyKey:n.idempotencyKey});this.#t.length=0,this.#Ke(),r.length>0&&this.#g.emit("step",{type:"batch",steps:r})}updateMessage(e){if(e.type==="delete"){let r=this.#t.findIndex(n=>n.idempotencyKey===e.idempotencyKey);r>=0&&this.#t.splice(r,1)}else if(e.type==="move"){let r=this.#t.findIndex(n=>n.idempotencyKey===e.idempotencyKey);r>=0&&Mye(this.#t,r,r+e.delta)}this.#Ke()}async flushMessageQueue(){this.#r.debug("(flushMessageQueue): flushing message queue"),await this.abort({cleanCurrentMessage:!1,flushMessageQueue:!0}),this.#o&&this.#o()}#Rt(e){let r=e.idempotencyKey;if(r){let n=this.#t.findIndex(i=>i.idempotencyKey===r);if(n>=0)return this.#t[n]=e,!1}else e.idempotencyKey=(0,CF.randomUUID)();if(e.queue==null&&(e.queue=!0),e.user?e.user={...this.#Z,...e.user}:e.user=this.#Z,e.userPrompt==="___BROWSER_AUTOMATION_PROMPT___"){let n=this.getProxyConfig();e.userPrompt=Ege(n.proxyDefaultOrigin,this.#Qe||void 0)}return this.#t.push(e),!0}async sendMessage(e){this.#ke=!1;let r=0;if(Array.isArray(e))for(let i of e)this.#Rt(i)&&r++;else this.#Rt(e)&&r++;if(r===0)return null;this.#r.debug(`(sendMessage): added messages(${r}) to queue(${this.#t.length})`),this.#Ke();let n=this.#t[this.#t.length-1];return n?(this.#k=!1,this.#te=void 0,this.cancelAllPendingToolFulfilments(n.userPrompt),n.queue?this.#o&&this.#o():await this.flushMessageQueue(),await Bl(),n.idempotencyKey):null}#nr(){if(this.#A==="until-idle")return;let e=this.#t;if(e.length!==0){for(let r of e)if(r.systemReminders)for(let n of r.systemReminders)this.queueSystemReminder(n);return this.#i=uJ(e),this.#Z=this.#i.user,this.#i.softContextWindow&&(this.#b=Math.min(this.#b??3e4,this.#i.softContextWindow)),this.clearMessageQueue(!0),this.#i}}#ir(){let e=this.#t.length===0||this.#ke,r=new Promise(n=>{e?this.#o=n:n()}).then(()=>{let n=this.#t;if(n.length!==0)if(this.#A==="until-idle"){let i=this.#t.shift();if(i.user&&(this.#Z=i.user,this.#g.emit("step",{type:"user",displayPrompt:i.displayPrompt,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.idempotencyKey})),i.systemReminders)for(let o of i.systemReminders)this.queueSystemReminder(o);return this.#i=i,this.#Z=i.user,this.#i.softContextWindow&&(this.#b=Math.min(this.#b??3e4,this.#i.softContextWindow)),this.#Ke(),i}else{for(let o of n)if(o.systemReminders)for(let s of o.systemReminders)this.queueSystemReminder(s);let i=uJ(n);if(!i.dropAbortedPrompt&&this.#i){let o=i.idempotencyKey;i=hJ(this.#i,i),i.idempotencyKey=o}return this.clearMessageQueue(!0),this.#i=i,this.#Z=i.user,i}});return{shouldWait:e,promise:r}}#Ke(){this.#g.emit("step",{type:"message-queue",queue:this.#t.map(e=>({idempotencyKey:e.idempotencyKey,displayPrompt:e.displayPrompt,user:e.user}))})}#ot(e,r=!1){r&&(this.#U={}),Object.assign(this.#U,e),this.#g.emit("step",{type:"metadata",...this.#U})}async waitForSetupCommand(e){let r=this.#d;if(!r)return{state:"installed",shouldProceed:!0};if(r.setupState==="installing")try{await Yc(r.setupCommandPromise,e)}catch{}let n=r.setupState;return n==="not-installed"||n==="install-failed"||n==="install-aborted"?{state:n,shouldProceed:!0}:{state:"installed",shouldProceed:!0}}async waitForDevServer(e,r,n){if(!this.#d&&this.#u?.serverUrl)return{shouldProceed:!0,message:"Dev server is ready.",serverUrl:this.#u.serverUrl};let i=await this.waitForSetupCommand(e);if(!i.shouldProceed)return{shouldProceed:!1,message:`Project setup command did not completed. State: ${i.state}`};let o=this.#d;if(o){await o.ensureDevCommand(e);let s=await o.waitUntilServer(e,r,n);return s.ok?{shouldProceed:!0,message:"Dev server is ready.",serverUrl:o.serverUrl?.toString()}:{shouldProceed:!1,message:s.message,serverUrl:void 0}}return{shouldProceed:!1,message:"Dev server is not ready.",serverUrl:void 0}}async getNamedAgentConfig(e,r,n){let i=this.getSessionContext(),o=i.customAgents,s=e?o.find(H=>H.name.toLowerCase()===e.toLowerCase()):void 0,a=s?.name??"explorer",{mcpServers:A=!1,model:c,mode:u="quality-v4-agent",systemPrompt:l,subagent_type:p,includeMemories:g,needDevServer:d,needValidation:f,queueMode:h,asyncSubAgents:C,resetAfterRun:I=!1,reasoning:B,softContextWindow:E}={mcpServers:s?.mcpServers,subagent_type:a,systemPrompt:s?.systemPrompt,softContextWindow:s?.softContextWindow,model:(()=>{if(s?.roundRobinModels?.length){let H=s.name,L=this.#Et.get(H)??0;return this.#Et.set(H,L+1),s.roundRobinModels[L%s.roundRobinModels.length]}return s?.model})(),mode:s?.mode,includeMemories:s?.includeMemories??a==="explorer",needDevServer:s?.needDevServer,needValidation:s?.needValidation,resetAfterRun:s?.resetAfterRun,queueMode:s?.queueMode,asyncSubAgents:s?.asyncSubAgents,reasoning:s?.reasoning??this.#Ve},y=["Read","Glob","ReadRule","Grep","WebSearch","SearchMemories"];i.sessionMode==="deep-research"&&y.push("Bash","WebFetch"),y=y.filter(H=>this.#D?this.#D.includes(H):!0),y.push("ExplorationMetadata");let D=mF(this.#u,s?.tools??y),b=c===void 0?p==="explorer"?"opa5-mini":void 0:c,Q=this.#d;if(d&&n){if(!Q)return{success:!1,response:`The ${p} agent can not be used on this session. Do no try again.`};if(Q.httpServerState.state==="stopped"||Q.httpServerState.state==="connecting"||Q.httpServerState.state==="error-fetch")try{if(Q.state==="not-installed")throw new Error(`The ${p} agent can not be used until the setupCommand finish successfully. However, the dev server is not installed.`);if(Q.state==="install-failed")throw new Error(`The ${p} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it failed.`);if(Q.state==="install-aborted")throw new Error(`The ${p} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it was aborted.`);await this.waitForSetupCommand(n),await Q.ensureDevCommand(n)}catch(L){return{success:!1,response:L instanceof Error?L.message:String(L)}}if(f&&Q.validateCommand&&this.#ee){let L=await Q.runValidateCommand(void 0,n);if(L.status==="failure")return{success:!1,response:`The Agent could not start yet, because the validate command failed:
|
|
1915
1915
|
<command>
|
|
1916
1916
|
${L.command}
|
|
1917
1917
|
</command>
|
|
@@ -1919,20 +1919,20 @@ ${L.command}
|
|
|
1919
1919
|
${L.output}
|
|
1920
1920
|
</logs>
|
|
1921
1921
|
|
|
1922
|
-
Make the necessary changes and try again.`};if(L.status==="aborted")return{success:!1,response:"The Agent could not start yet, because the validate command was aborted by the user."};this.#ee=!1}let H=await this.waitForDevServer(n);if(!H.shouldProceed)return{success:!1,response:H.message}}let v=this.#
|
|
1923
|
-
`),U=l?Ev(l,{cwd:this.#v,env:{FUSION_CONTEXT:x,FUSION_TEST_PROMPT:this.#u?.browserAutomationInstructions??"",...Q?.envVars??process.env},allowedCommands:Xb(this.#u?.allowedCommands??[]),skipCommandSecurity:this.#u?.skipCommandSecurity===!0}):void 0;return{success:!0,subagent_type:p,resetAfterRun:I,options:{sys:this.#e,credentials:this.#s,position:s?.position??`${v}-${a}`,mode:u,softContextWindow:E,includeMemories:g,modelOverride:s?.inheritSessionModel&&(this.#Pe??this.#_)?this.#Pe??this.#_:Bm(b)??this.#Pe??this.#_,sessionOrCompletionId:r,workingDirectory:this.#
|
|
1922
|
+
Make the necessary changes and try again.`};if(L.status==="aborted")return{success:!1,response:"The Agent could not start yet, because the validate command was aborted by the user."};this.#ee=!1}let H=await this.waitForDevServer(n);if(!H.shouldProceed)return{success:!1,response:H.message}}let v=this.#C.replace(/-agent$/,""),S={};if(D.includes("mcp:chrome")){let H=await this.#or(r,n);if(H)S.chrome={command:"npx",args:["-y","chrome-devtools-mcp@latest","--wsEndpoint",H,"--categoryEmulation=false"],retries:5};else{let L=["mcp:chrome","RecordFrame","CompileRecording","DevServerLogs"];for(let M of L){let _=D.indexOf(M);_!==-1&&D.splice(_,1)}this.#r.debug("Chrome MCP not available \u2014 browser tools removed from agent")}}let x=["## Workspace Context","",`**Bash tool Working Directory:** ${this.#v}`,"","**Git Repositories:**",...this.#p.map(H=>`- repository: ${H.repoName} in folder: ${H.folderName}`)].join(`
|
|
1923
|
+
`),U=l?Ev(l,{cwd:this.#v,env:{FUSION_CONTEXT:x,FUSION_TEST_PROMPT:this.#u?.browserAutomationInstructions??"",...Q?.envVars??process.env},allowedCommands:Xb(this.#u?.allowedCommands??[]),skipCommandSecurity:this.#u?.skipCommandSecurity===!0}):void 0;return{success:!0,subagent_type:p,resetAfterRun:I,options:{sys:this.#e,credentials:this.#s,position:s?.position??`${v}-${a}`,mode:u,softContextWindow:E,includeMemories:g,modelOverride:s?.inheritSessionModel&&(this.#Pe??this.#_)?this.#Pe??this.#_:Bm(b)??this.#Pe??this.#_,sessionOrCompletionId:r,workingDirectory:this.#I,mcpServers:A,fusionStatusMonitor:this.#$e,autoImportLocalMCPs:!1,fusionConfig:this.#u,privacyMode:this.#P,enabledTools:D,builtInMCPServerConfig:S,systemPromptOverride:U,queueMode:h,asyncSubAgents:C,reasoning:B,devServerOrchestrator:D.includes("DevServerLogs")||D.includes("DevServerRestart")||D.includes("DevServerControl")||D.includes("ProposeEnvVariable")?this.#d:void 0}}}async spawnNamedAgent(e,r){let n=r.resume??r.sessionId,i=await this.getNamedAgentConfig(e,n,r.signal);if(!i.success)return{success:!1,response:i.response};await this.waitUntilBlockingPendingPromises(),await this.#ne(!0);let o;if(i.resetAfterRun){if(this.#m&&!await this.#At())return{success:!1,response:`Cannot run browser automation with uncommitted changes. The "${i.subagent_type}" agent modifies code during testing and automatically resets changes afterward. Your uncommitted changes would be permanently lost.
|
|
1924
1924
|
|
|
1925
1925
|
Please commit or stash your changes first, then try again.`};o=(await this.#S())?.currentCommit}let s=i.subagent_type,a=new t({...i.options,git:!1,parentSessionId:this.getSessionId()}),A=r.sessionId??r.resume??n,c=Promise.withResolvers();this.#Le.set(A,{description:r.prompt.substring(0,200),startedAt:Date.now(),promise:c.promise}),await a.initializeSession({skipSessionLoading:!r.resume,signal:r.signal}),r.resume&&i.options.builtInMCPServerConfig?.chrome&&a.queueSystemReminder({text:"The connected browser might have restarted. This means cookies and open pages might have been cleared."});let u=a.getSessionId(),l={important_files:[]},p=new RE(u,{framesDir:this.#e.join(hF.default.homedir(),".builder","recordings"),debug:this.#a}),g=[],d={value:null},f=[],h={value:null},C=[],I=r.maxCompletions,B=a.connectToEventLoop(!1,D=>{try{if(D.type==="tool_result"&&D.result.tool_name==="ExplorationMetadata"&&typeof D.result.content=="string")try{l=JSON.parse(D.result.content)}catch(b){this.#e.Sentry?.captureException(b,{extra:{contentPreview:D.result.content.substring(0,500),contentLength:D.result.content.length},tags:{operation:"exploration-metadata-parse"}})}else{if(D.type==="done"&&(I--,I<10)){let b="";if(h.value){let Q=new Set(C.map(S=>S.test_case_id)),v=h.value.test_cases.filter(S=>!Q.has(S.id));v.length>0&&(b=` You have ${v.length} unreported test cases: ${v.map(S=>S.id).join(", ")}. Report them as "couldnt_verify" with failure_category="timeout" if you cannot test them.`)}a.queueSystemReminder({text:`The agent has been working for a while. Please try to wrap up soon because soon it will be interrupted. T-minus ${I} turns.${b}`})}this.#g.emit("step",{type:"agent",id:u,step:D,subagent_type:s})}if(D.type==="tool"&&p.onToolCall(D.name,D.id,D.content),D.type==="thinking"&&p.onThinking(D.content),D.type==="tool_result"){let b=p.getFrameCount();if(p.onToolResult(D.result,hye()),D.result.tool_name==="RecordFrame")try{let Q=JSON.parse(D.result.tool_input||"{}");p.onRecordFrame(Q)}catch{p.onRecordFrame({title:"Untitled",frame:"last-image"})}if(p.getFrameCount()>b&&this.#ot({timeline_progress:p.getProgressSnapshot()},!1),D.result.tool_name==="ReportUIIssue")try{let Q=JSON.parse(D.result.tool_input||"{}");Q.title&&Q.description&&g.push({title:Q.title,description:Q.description,debugInfo:Q.debugInfo})}catch{}if(D.result.tool_name==="ReportTestOutcome")try{let Q=JSON.parse(D.result.tool_input||"{}");if(Q.test_case_id){let v=h.value&&!h.value.test_cases.some(x=>x.id===Q.test_case_id);v&&a.queueSystemReminder({text:`WARNING: "${Q.test_case_id}" is not in your registered test plan. Use one of: ${h.value.test_cases.map(x=>x.id).join(", ")}`,tag:"reminder:unknown-test-case"});let S=!!v;if(Q.outcome==="succeeded"&&(!Q.evidence_frame_count||Q.evidence_frame_count<1)&&(a.queueSystemReminder({text:`REJECTED: You reported "${Q.test_case_id}" as "succeeded" but evidence_frame_count is ${Q.evidence_frame_count??0}. A test case CANNOT be "succeeded" without visual evidence. Take a screenshot, call RecordFrame, then re-report this test case with evidence_frame_count >= 1. If you cannot get visual evidence, report as "couldnt_verify" instead.`,tag:"reminder:evidence-required"}),S=!0),Q.outcome!=="succeeded"&&Q.outcome!=="other"&&!Q.failure_category&&(a.queueSystemReminder({text:`WARNING: "${Q.test_case_id}" reported as "${Q.outcome}" without failure_category. Re-report with a failure_category (env_issue, creds_missing, needs_user_input, server_not_ready, feature_not_reachable, timeout, assertion_failed, unexpected_error, not_applicable).`,tag:"reminder:failure-category-required"}),S=!0),!S){let x=C.findIndex(H=>H.test_case_id===Q.test_case_id),U={...Q,timestamp:Date.now()};if(x!==-1?C[x]=U:C.push(U),h.value){let H=new Set(C.map(M=>M.test_case_id)),L=h.value.test_cases.filter(M=>!H.has(M.id));L.length>0&&a.queueSystemReminder({text:`Progress: ${C.length}/${h.value.test_cases.length} test cases reported. Remaining: ${L.map(M=>M.id).join(", ")}`,tag:"reminder:test-progress"})}}}else if(Q.outcome&&Q.summary&&(d.value={outcome:Q.outcome,summary:Q.summary,details:Q.details}),h.value){let v=new Set(C.map(x=>x.test_case_id)),S=h.value.test_cases.filter(x=>!v.has(x.id)).map(x=>x.id);S.length>0&&a.queueSystemReminder({text:`WARNING: ${S.length} test cases unreported: ${S.join(", ")}. Call ReportTestOutcome with test_case_id for each remaining case before the final summary.`,tag:"reminder:missing-test-cases"})}}catch{}if(D.result.tool_name==="RegisterTestPlan")try{let Q=JSON.parse(D.result.tool_input||"{}");Q.mode&&Q.test_cases?.length>0&&(h.value={mode:Q.mode,test_cases:Q.test_cases})}catch{}if(D.result.tool_name==="ReportIssue")try{let Q=JSON.parse(D.result.tool_input||"{}");Q.file_path&&Q.line&&Q.title&&Q.severity&&Q.body&&f.push({file_path:Q.file_path,line:Q.line,...Q.start_line?{start_line:Q.start_line}:{},title:Q.title,severity:Q.severity,body:Q.body})}catch{}}}catch{}}),E=async()=>{B(),await a.close(!1)};if(r.signal?.aborted){await E(),this.#Le.delete(A);let D={success:!1,response:"Agent task aborted"};return c.resolve(D),D}let y=async()=>{await E()};r.signal&&r.signal.addEventListener("abort",y);try{let D=r.attachmentUrls?.map(S=>({type:"url",value:S}));await a.sendMessage({userPrompt:r.prompt,user:r.user,maxCompletions:r.maxCompletions,category:"background-subagent",includeRelevantMemories:i.options.includeMemories,queue:!0,...D?.length&&{attachments:D}}),await a.waitUntilIdle(r.signal),this.#It.add(s);let b=a.getLastTurn();if(!b)return{success:!1,response:"Agent task failed"};let Q=b.actions.filter(S=>S.type==="text").map(S=>S.content).join(`
|
|
1926
1926
|
`);if(h.value&&(Q=`<browser_automation_test_plan>${JSON.stringify(h.value,null,2)}</browser_automation_test_plan>
|
|
1927
1927
|
${Q}`),C.length>0&&(Q=`<browser_automation_test_results>${JSON.stringify(C,null,2)}</browser_automation_test_results>
|
|
1928
|
-
${Q}`),g.length>0&&(Q=`<browser_automation_ui_issues>${JSON.stringify(g,null,2)}</browser_automation_ui_issues><browser_automation_summary>${Q}</browser_automation_summary>`),f.length>0&&(Q=`<code_review_issues>${JSON.stringify(f,null,2)}</code_review_issues><code_review_summary>${Q}</code_review_summary>`),p.hasAnyFrames())try{let S=a.getSessionId(),x=p.getHighlightImages(),U=x.length>0?p.getHighlightMetadataFrames():p.getLegacyMetadataFrames(),H=x.length>0?x:p.getExplicitImages(),L=`${S}.webp`,M=`${S}.json`,_=`${S}-timeline.json`,Y=this.#e.join(hF.default.homedir(),".builder","recordings"),W=this.#e.join(Y,L),K=this.#e.join(Y,M),J=this.#e.join(Y,_);await Zl.default.promises.mkdir(Y,{recursive:!0}),await Zl.default.promises.writeFile(K,JSON.stringify(U,null,2));let O=await p.finalize();await Zl.default.promises.writeFile(J,JSON.stringify(O,null,2)),l.timeline_id=_;let ie=this.getSessionContext().userContext,de=ie?.browserTestingShadowMode==="true",me=ie?.prNumber&&!de?{prNumber:Number(ie.prNumber),repoFullName:ie.repoFullName,hostname:ie.hostname,prHeadSha:ie.prHeadSha,checkRunId:ie.checkRunId?Number(ie.checkRunId):void 0,projectId:this.#
|
|
1928
|
+
${Q}`),g.length>0&&(Q=`<browser_automation_ui_issues>${JSON.stringify(g,null,2)}</browser_automation_ui_issues><browser_automation_summary>${Q}</browser_automation_summary>`),f.length>0&&(Q=`<code_review_issues>${JSON.stringify(f,null,2)}</code_review_issues><code_review_summary>${Q}</code_review_summary>`),p.hasAnyFrames())try{let S=a.getSessionId(),x=p.getHighlightImages(),U=x.length>0?p.getHighlightMetadataFrames():p.getLegacyMetadataFrames(),H=x.length>0?x:p.getExplicitImages(),L=`${S}.webp`,M=`${S}.json`,_=`${S}-timeline.json`,Y=this.#e.join(hF.default.homedir(),".builder","recordings"),W=this.#e.join(Y,L),K=this.#e.join(Y,M),J=this.#e.join(Y,_);await Zl.default.promises.mkdir(Y,{recursive:!0}),await Zl.default.promises.writeFile(K,JSON.stringify(U,null,2));let O=await p.finalize();await Zl.default.promises.writeFile(J,JSON.stringify(O,null,2)),l.timeline_id=_;let ie=this.getSessionContext().userContext,de=ie?.browserTestingShadowMode==="true",me=ie?.prNumber&&!de?{prNumber:Number(ie.prNumber),repoFullName:ie.repoFullName,hostname:ie.hostname,prHeadSha:ie.prHeadSha,checkRunId:ie.checkRunId?Number(ie.checkRunId):void 0,projectId:this.#h??void 0,branchName:this.#y??void 0,ownerId:this.#s.builderPublicKey,configId:this.getLastCompletionId(),containerUrl:ie.containerUrl,recordingCaption:(()=>{if(h.value&&C.length>0){let X=C.filter(rt=>rt.outcome==="succeeded").length,ve=h.value.test_cases.length;return`Browser testing: ${X}/${ve} passed`}return d.value?`Browser testing: ${d.value.outcome}`:"Browser testing"})(),summary:d.value?.summary??void 0}:null,fe=await ia(this.#s,"/codegen/timeline",{...O,projectId:this.#h??null,branchName:this.#y??null,testOutcome:d.value?.outcome??null,testSummary:d.value?.summary??null,testDetails:d.value?.details??null,uiIssues:g.length>0?g:null,testPlan:h.value??null,testCaseResults:C.length>0?C:null,submission:me});if(fe?.recording_id&&(l.recording_id=fe.recording_id),H.length>0){let X=x.length>0?p.getHighlightFrameDurations():p.getExplicitFrameDurations();if(await ige(H,{duration:"1",frameDurations:X.length>0?X:void 0,outputPath:W,cleanup:!1,sys:this.#e,debug:this.#a,signal:r.signal})&&(l.gif_id=L??void 0,this.#r.debug(`(subagent=${s}): Generated recording from ${H.length} frames: ${L}`),L)){let rt=U.map(Be=>Be.title);Q=`<browser_automation_gif_id>${L}</browser_automation_gif_id>
|
|
1929
1929
|
<browser_automation_timeline_id>${_}</browser_automation_timeline_id>
|
|
1930
1930
|
<browser_automation_recorded_frames>${JSON.stringify(rt)}</browser_automation_recorded_frames>
|
|
1931
1931
|
|
|
1932
|
-
${Q}`}}this.#ot({gif_id:l.gif_id,gif_frames:U,timeline_id:_,recording_id:l.recording_id},!1),l.recording_id&&p.cleanupSessionFiles().catch(X=>{this.#
|
|
1933
|
-
${_ye(r.environmentVariables)}`,tag:"reminder:environment-variables"})),e.proxyServer?i.push(r?.setProxyServer(e.proxyServer).then(o=>{n.proxyServer=o.updatedProxyServer,n.hosts=o.updatedHosts})):e.proxyPort&&i.push(r?.setPort(e.proxyPort).then(o=>n.proxyServer=o)),e.fileOverrides&&(n.fileOverrides=r.setFileOverrides(e.fileOverrides)),e.setupCommand!==void 0||e.setupDependencies!==void 0?i.push(r.setSetupCommand({setupDependencies:e.setupDependencies,setupCommand:e.setupCommand,forceRestart:e.forceSetupCommand}).then(o=>{n.setupCommand=!!o,n.setupResult=o??void 0})):(e.forceSetupCommand||n.fileOverrides||n.env&&r.setupState!=="installed")&&i.push(r?.runSetupCommand().then(o=>{n.setupCommand=!!o,n.setupResult=o??void 0})),e.devCommand!==void 0?i.push(r.setDevCommand(e.devCommand??void 0,e.forceDevCommand||n.env).then(o=>{n.devCommand=o.status==="success",n.devResult=o??void 0})):(e.forceDevCommand||n.env)&&i.push(r?.restart().then(o=>{n.devCommand=!0,n.devResult=o??void 0})),e.autoDetectDevServer!==void 0&&i.push(r.setAutoDetectSettings(e.autoDetectDevServer,e.autoDetectDevServerPatterns).then(o=>n.proxyServer=n.proxyServer||o)),e.validateCommand!==void 0&&i.push(r.runValidateCommand(e.validateCommand).then(o=>n.validateResult=o)),await Promise.allSettled(i),n.env){let o=!1;for(let s of this.#w.values())(s.state==="running"||s.state==="starting")&&(s.stale=!0,o=!0);o&&this.#pe()}}return n}#sr(){for(let e of Array.from(this.#w.keys()))try{this.disposeTerminal({terminalId:e})}catch{}this.#w.clear()}async#st(){if(this.#
|
|
1932
|
+
${Q}`}}this.#ot({gif_id:l.gif_id,gif_frames:U,timeline_id:_,recording_id:l.recording_id},!1),l.recording_id&&p.cleanupSessionFiles().catch(X=>{this.#r.warn(`[${s}] Failed to clean up local recording files: ${X instanceof Error?X.message:String(X)}`)})}catch(S){this.#r.warn(`[${s}] Failed to generate recording (non-critical): ${S instanceof Error?S.message:String(S)}`),this.#e.Sentry?.captureException(S,{level:"warning",tags:{component:"gif-generator",operation:"generateGifFromImages",subagent_type:s},extra:{sessionId:a.getSessionId(),frameCount:p.getFrameCount()}})}let v={success:!0,response:Q,metadata:l,sessionId:u,lastTurn:b};return c.resolve(v),v}catch(D){let b={success:!1,response:`Agent task failed: ${D instanceof Error?D.message:String(D)}`,metadata:{important_files:[]}};return c.resolve(b),b}finally{this.#Le.delete(A),r.signal?.removeEventListener("abort",y);try{await E()}catch(D){this.#r.warn(`[${s}] Cleanup failed: ${D instanceof Error?D.message:String(D)}`)}if(i.resetAfterRun&&o)try{await this.resetToCommitHash(o,!1)}catch(D){this.#r.warn(`[${s}] Failed to reset changes: ${D instanceof Error?D.message:String(D)}`)}}}getRunningSubAgents(){return Array.from(this.#Le.entries()).map(([e,r])=>({id:e,description:r.description,startedAt:r.startedAt}))}canHandleTool(e){return(this.#W.get(e)??0)>0}setProxyOrigin(e,r){if(e!==this.#Te||r!==this.#Me){this.#Te=e,this.#Me=r;let n=this.getProxyConfig();n.proxyDestination&&n.proxyDefaultOrigin&&this.queueSystemReminder({text:`The dev server is running at ${n.proxyDefaultOrigin}. e.g. for taking screenshots of a "/foo" route take a screenshot of ${n.proxyDefaultOrigin}/foo`,tag:"reminder:url"})}}async#or(e,r){let n=this.getProxyConfig();if(n.proxyOrigin&&!n.proxyDestination)return;let i=await ia(this.#s,"/codegen/get-browser-connection",{sessionId:e,projectId:this.#h,branchName:this.#y,proxyOrigin:n.proxyOrigin,proxyDefaultOrigin:n.proxyDefaultOrigin,proxyDst:n.proxyDestination},{signal:r,debug:this.#a});return typeof i?.wsUrl=="string"?i.wsUrl:void 0}getTurns(){let e=this.getSessionContext();return structuredClone(e.turns)}getSessionContext(){if(!this.#n)throw new Error("Session context not initialized");return this.#n}async runSetupCommand(){return await this.#d?.runSetupCommand()}abortSetupCommand(){return this.#d?.abortSetupCommand()}abortValidateCommand(){return this.#d?.abortValidateCommand()}toolsRunning(){return this.#Y.length>0}abortAllTools(){for(let e of this.#Y)e.abortController.abort()}toolFullfilment(e,r){return typeof r=="string"&&(r={toolResult:r,isError:!1}),this.fulfillToolCall(e,r)}cancelAllPendingToolFulfilments(e){for(let[r,n]of Array.from(this.#X.entries()))n.messageValid&&e?this.fulfillToolCall(r,{toolResult:"The user answered with a follow-up message (see the next user message in the conversation).",isError:!1,title:"Resolved by user message"}):this.fulfillToolCall(r,{toolResult:"Aborted by the user. So the task could not be completed.",isError:!0,title:"Aborted by the user."});this.#X.clear()}fulfillToolCall(e,r){let n=this.#X.get(e);return n?(n.resolve(r),this.#X.delete(e),!0):!1}abortToolCall(e,r){let n=this.#Y.find(o=>o.id===e),i=yn(r??"The user manually aborted the tool call.");if(n)return n.abortController.abort(i),!0;if(this.#Y.length===0){let o=new AbortController;return o.abort(i),this.#Y.push({id:e,abortController:o,input:{id:e},name:"bash"}),!0}return!1}async acceptCode(){if(this.#at()){let e=this.getLinesStats();await this.sendFeedback({position:this.#C,acceptedLines:e.net,linesOfCodeAdded:e.added,linesOfCodeRemoved:e.removed})}}async abort(e){this.#a&&this.#r.debug(`(abort): ${JSON.stringify(e)}`);let r=!1,n=!0;return typeof e=="boolean"?r=e:(r=e?.cleanCurrentMessage??!1,n=e?.flushMessageQueue??!0),r&&(this.#i=void 0,this.clearMessageQueue()),this.#ke=!n,this.cancelAllPendingToolFulfilments(),this.#ue=0,this.#c?(this.#c.abort(),this.#c=void 0,!0):!1}async stopEventLoop(){await this.abort({cleanCurrentMessage:!0}),this.#F?.abort(),this.#F=void 0,this.#o&&this.#o()}requestRefresh(){this.#g.emit("step",{type:"builder-action",action:"refresh",metadata:{}})}async configureDevOrchestrator(e){let r=this.#d,n={devCommand:!1,hosts:!1,setupCommand:!1,proxyServer:!1,validateCommand:!1,env:!1,fileOverrides:!1,setupResult:void 0,devResult:void 0,validateResult:void 0};if(r){let i=[];if(e.env&&(e.replaceEnvs&&(r.environmentVariables.length>0&&(n.env=!0),r.clearEnvVariables()),Object.entries(e.env).forEach(([o,s])=>{r.setEnvVariable(o,s??void 0)&&(n.env=!0)}),this.queueSystemReminder({text:`The system has the following environment variables:
|
|
1933
|
+
${_ye(r.environmentVariables)}`,tag:"reminder:environment-variables"})),e.proxyServer?i.push(r?.setProxyServer(e.proxyServer).then(o=>{n.proxyServer=o.updatedProxyServer,n.hosts=o.updatedHosts})):e.proxyPort&&i.push(r?.setPort(e.proxyPort).then(o=>n.proxyServer=o)),e.fileOverrides&&(n.fileOverrides=r.setFileOverrides(e.fileOverrides)),e.setupCommand!==void 0||e.setupDependencies!==void 0?i.push(r.setSetupCommand({setupDependencies:e.setupDependencies,setupCommand:e.setupCommand,forceRestart:e.forceSetupCommand}).then(o=>{n.setupCommand=!!o,n.setupResult=o??void 0})):(e.forceSetupCommand||n.fileOverrides||n.env&&r.setupState!=="installed")&&i.push(r?.runSetupCommand().then(o=>{n.setupCommand=!!o,n.setupResult=o??void 0})),e.devCommand!==void 0?i.push(r.setDevCommand(e.devCommand??void 0,e.forceDevCommand||n.env).then(o=>{n.devCommand=o.status==="success",n.devResult=o??void 0})):(e.forceDevCommand||n.env)&&i.push(r?.restart().then(o=>{n.devCommand=!0,n.devResult=o??void 0})),e.autoDetectDevServer!==void 0&&i.push(r.setAutoDetectSettings(e.autoDetectDevServer,e.autoDetectDevServerPatterns).then(o=>n.proxyServer=n.proxyServer||o)),e.validateCommand!==void 0&&i.push(r.runValidateCommand(e.validateCommand).then(o=>n.validateResult=o)),await Promise.allSettled(i),n.env){let o=!1;for(let s of this.#w.values())(s.state==="running"||s.state==="starting")&&(s.stale=!0,o=!0);o&&this.#pe()}}return n}#sr(){for(let e of Array.from(this.#w.keys()))try{this.disposeTerminal({terminalId:e})}catch{}this.#w.clear()}async#st(){if(this.#Q.debounceTimer&&clearTimeout(this.#Q.debounceTimer),this.#Q.pendingEvents=[],this.#Q.listeners.clear(),this.#Q.watcher){try{await this.#Q.watcher.close()}catch{}this.#Q.watcher=null}}#ar(){if(this.#Q.watcher)return;let e=this.#p.map(A=>A.path),r=new Map;for(let A of this.#p)r.set(A.path,pJ(A.path));let n=A=>{for(let c of this.#p)if(A.startsWith(c.path+"/")||A===c.path)return c.path;return null},i=A=>{let c=n(A);if(!c)return!1;let u=this.#e.relative(c,A).replace(/\\/g,"/");if(!u)return!1;if(this.#Pt(u))return!0;let l=r.get(c);return l?l(u):!1},o,s=!1;try{o=dye.default.watch(e,{ignored:i,ignoreInitial:!0,persistent:!0,awaitWriteFinish:{stabilityThreshold:200,pollInterval:100},ignorePermissionErrors:!0,followSymlinks:!1,usePolling:!0,interval:1e3,binaryInterval:3e5,atomic:!0})}catch(A){this.#e.Sentry?.captureException(A,{tags:{operation:"global-file-watch-init"}}),this.#r.error(`Failed to initialize file watcher: ${A instanceof Error?A.message:String(A)}`),this.#r.error("File watching will be disabled. Code generation will still work but may not detect all changes automatically.");return}let a=(A,c)=>{let u=n(c),l=u?this.#e.relative(u,c).replace(/\\/g,"/"):this.#e.relative(this.primaryGitPath,c).replace(/\\/g,"/");if(this.#p.length>1&&u){let g=this.#p.find(d=>d.path===u);g&&!this.#N()&&(l=`${g.folderName}/${l}`)}let p={type:"folder-watch",watchId:"global",event:A,path:l,timestamp:Date.now()};this.#Q.pendingEvents.push(p),this.#Q.debounceTimer&&clearTimeout(this.#Q.debounceTimer),this.#Q.debounceTimer=setTimeout(()=>{let g=this.#Q.pendingEvents;this.#Q.pendingEvents=[];for(let d of g)for(let f of this.#Q.listeners)try{f(d)}catch(h){this.#e.Sentry?.captureException(h)}},this.#Q.debounceMs)};o.on("add",A=>a("add",A)).on("change",A=>a("change",A)).on("unlink",A=>a("unlink",A)).on("addDir",A=>a("addDir",A)).on("unlinkDir",A=>a("unlinkDir",A)).on("error",A=>{s||(s=!0,this.#e.Sentry?.captureException(A,{tags:{operation:"global-file-watch"}}),this.#r.error(`File watcher error: ${A instanceof Error?A.message:String(A)}`),this.#r.error("Closing file watcher to prevent further errors. File watching will be disabled."),this.#st().catch(()=>{}))}),this.#Q.watcher=o,this.#r.debug(`Initialized global file watcher on: ${e.join(", ")}`)}subscribeToFileChanges(e){return this.#Q.listeners.size===0&&this.#ar(),this.#Q.listeners.add(e),this.#r.debug(`Subscribed to file changes(${this.#Q.listeners.size} active listeners)`),async()=>{this.#Q.listeners.delete(e),this.#r.debug(`Unsubscribed from file changes(${this.#Q.listeners.size} remaining listeners)`),this.#Q.listeners.size===0&&this.#Q.watcher&&(await this.#st(),this.#r.debug("Closed global file watcher (no more listeners)"))}}async tsServerInit(){try{return this.#l?{ok:!0,cwd:this.#I}:(this.#l=new Fv(this.#I),this.#l.setEventHandler(e=>{for(let r of this.#Ue)r(e)}),await this.#l.start(),{ok:!0,cwd:this.#I})}catch(e){return this.#l=null,{ok:!1,error:e?.message||"Failed to start tsserver"}}}async tsServerOpenFile(e,r){this.#l&&await this.#l.openFile(e,r)}async tsServerChangeFile(e,r){this.#l&&await this.#l.changeFile(e,r)}async tsServerCloseFile(e){this.#l&&await this.#l.closeFile(e)}async tsServerGetCompletions(e,r,n,i){return this.#l?this.#l.getCompletions(e,r,n,i):{success:!1,body:null}}async tsServerGetCompletionDetails(e,r,n,i){return this.#l?this.#l.getCompletionDetails(e,r,n,i):{success:!1,body:null}}async tsServerGetDefinition(e,r,n){return this.#l?this.#l.getDefinition(e,r,n):{success:!1,body:null}}async tsServerGetTypeDefinition(e,r,n){return this.#l?this.#l.getTypeDefinition(e,r,n):{success:!1,body:null}}async tsServerGetQuickInfo(e,r,n){return this.#l?this.#l.getQuickInfo(e,r,n):{success:!1,body:null}}async tsServerGetReferences(e,r,n){return this.#l?this.#l.getReferences(e,r,n):{success:!1,body:null}}async tsServerGetSignatureHelp(e,r,n){return this.#l?this.#l.getSignatureHelp(e,r,n):{success:!1,body:null}}async tsServerRequestDiagnostics(e){this.#l&&await this.#l.requestDiagnostics(e)}async tsServerGetRenameLocations(e,r,n){return this.#l?this.#l.getRenameLocations(e,r,n):{success:!1,body:null}}async tsServerGetNavTree(e){return this.#l?this.#l.getNavTree(e):{success:!1,body:null}}async tsServerOrganizeImports(e){return this.#l?this.#l.organizeImports(e):{success:!1,body:null}}async tsServerGetInlayHints(e){return this.#l?this.#l.getInlayHints(e):{success:!1,body:null}}async tsServerGetCodeFixes(e,r,n,i,o,s){return this.#l?this.#l.getCodeFixes(e,r,n,i,o,s):{success:!1,body:null}}async tsServerGetApplicableRefactors(e,r,n,i,o){return this.#l?this.#l.getApplicableRefactors(e,r,n,i,o):{success:!1,body:null}}async tsServerGetEditsForRefactor(e,r,n,i,o,s,a){return this.#l?this.#l.getEditsForRefactor(e,r,n,i,o,s,a):{success:!1,body:null}}async tsServerGetImplementation(e,r,n){return this.#l?this.#l.getImplementation(e,r,n):{success:!1,body:null}}async tsServerGetSelectionRange(e,r){return this.#l?this.#l.getSelectionRange(e,r):{success:!1,body:null}}async tsServerGetLinkedEditingRange(e,r,n){return this.#l?this.#l.getLinkedEditingRange(e,r,n):{success:!1,body:null}}async tsServerGetFormatRange(e,r,n,i,o){return this.#l?this.#l.getFormatRange(e,r,n,i,o):{success:!1,body:null}}subscribeToDiagnostics(e){return this.#Ue.add(e),()=>{this.#Ue.delete(e)}}async close(e=!1){if(!this.#Ne){if(this.#Ne=!0,this.#f&&(delete process.env.DEBUG,this.#f=!1),this.#Fe.forEach(r=>r()),this.#sr(),await this.#st(),this.#l&&(this.#l.dispose(),this.#l=null),this.#Ue.clear(),this.#Ee)try{this.#r.debug("Cleaning up local MCP servers"),await this.#Ee.cleanup()}catch(r){this.#e.Sentry?.captureException(r,{level:"warning",tags:{operation:"local-mcp-cleanup"}})}if(await this.stopEventLoop(),await this.waitUntilState("close",5e3),this.#g.removeAllListeners(),await Promise.allSettled(this.#le),e){let r=await this.needsBackup();this.#a&&this.#r.debug(`Closing code gen server: ${JSON.stringify({uploadGitBackup:e,needsBackup:r})}`),r&&await this.uploadBackup()}else this.#a&&this.#r.debug(`Closing code gen server: ${JSON.stringify({uploadGitBackup:e})}`)}}async#S(){if(!this.#m||this.#p.length===0)return null;let r=(await this.#J(async i=>this.#cr(i))).results.filter(i=>i.success&&i.result).map(i=>i.result);if(r.length===0)return null;for(let i of r)this.#g.emit("step",i);return this.#ie=r,this.#K(this.#Ar(r),"updateBranchUnpushedStatus",!1),r.some(i=>i.hasMergeConflict)&&await this.#fe(),r[0]}async#Ar(e){if(!this.#h||!this.#y||!this.#s.builderPublicKey||!this.#s.userId||!this.#s.builderPrivateKey)return;let r=e.some(n=>n.ahead>0||n.isSessionDirty);try{let n=new URL("/projects/branches",Oe);n.searchParams.set("apiKey",this.#s.builderPublicKey),n.searchParams.set("userId",this.#s.userId),n.searchParams.set("projectId",this.#h),n.searchParams.set("branchName",this.#y);let i=await Ue(n,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#s.builderPrivateKey}`},body:JSON.stringify({hasUnpushedChanges:r}),signal:AbortSignal.timeout(1e4)},this.#a);i.ok||this.#r.error(`Failed to update branch unpushed status: ${i.status} ${i.statusText}`,{loggerOptions:{debug:!0}})}catch(n){this.#r.error("Failed to update branch unpushed status:",n,{loggerOptions:{debug:!0}})}}async sendMessageToOrgAgent(e){try{let r=new URL("/projects/org-agent/send-message",Oe);this.#s.builderPublicKey&&r.searchParams.set("apiKey",this.#s.builderPublicKey),this.#s.userId&&r.searchParams.set("userId",this.#s.userId);let n=await Ue(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#s.builderPrivateKey}`},body:JSON.stringify(e),signal:AbortSignal.timeout(1e4)},this.#a),i=await n.json();return n.ok?{status:"success"}:{status:"error",error:i.error??`HTTP ${n.status}`}}catch(r){return{status:"error",error:r?.message??"Unknown error"}}}queueGitStatusReminder(e){if(this.#ie.length===0||this.#re||this.#M!=="quality-v4")return;let r=this.#ie.map(n=>Lye(n,this.gitEnabledFolders,e));this.queueSystemReminder({text:r.join(`
|
|
1934
1934
|
|
|
1935
|
-
`),tag:"reminder:git-status"})}async manualCommit(e){if(!this.#m)return!1;let r=this.getSessionContext();if(!r.beforeCommit){let n=await this.#O();Object.keys(n).length>0&&(r.beforeCommit=Ks(n))}return await this.commitWorkInProgress(e.commitMessage,[e.add]),await this.#ne(!0),!0}getLastSuggestedAction(){return this.#se}async#fe(){let e=this.getSessionContext();if(e.state==="generating"||e.state==="close")return this.#se=void 0,!1;let r=await this.#et(!0,"all");return e=this.getSessionContext(),e.state!=="generating"&&e.state!=="close"?(this.#se=r,this.#g.emit("step",{type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:e.state,suggestion:r,sessionMode:e.sessionMode,hasPlanToApply:this.#k,modelOverride:this.#_}),!0):!1}async#cr(e){if(!this.#m)return null;this.#Be++;try{let r=this.getCommitMode(),n=this.getFeatureBranch(),i=this.#ge(e),o=e.path,s=e.folderName===this.#p[0]?.folderName,a=this.getSessionContext(),A=!1,c=!1,u="",l=null;try{let E=await this.git(["rev-parse","--absolute-git-dir"],{cwd:o});l=this.#e.join(E.trim(),"FETCH_HEAD"),Zl.default.existsSync(l)&&Zl.default.unlinkSync(l)}catch(E){this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchHeadFilePath:l,isCheckingGitStatus:this.#Be,folderName:e.folderName}}),l=null}try{u=await this.git(["fetch","--no-tags","origin",i],{cwd:o}),A=!0}catch{A=!1}let p=await this.#e.getRepoInfo(o),g=yl(a.beforeCommit,e.folderName,this.gitRepoContexts[0]?.folderName);!s&&!e.initialCommit&&p.commit&&(e.initialCommit=p.commit),!g&&e.initialCommit&&(g=e.initialCommit);let d=this.#at(e.folderName),f=d?1:0,h=0;if(A){if(n!==i)try{await this.git(["--no-pager","diff","--quiet",`refs/remotes/origin/${n}...refs/remotes/origin/${i}`],{cwd:o}),c=!1}catch{c=!0}else c=!0;try{let E=kye(await this.git(["rev-list","--left-right","--count","HEAD...FETCH_HEAD"],{cwd:o}));f=E.ahead,h=E.behind}catch(E){let y=null;if(l)try{y=await this.#e.readFile(this.#e.join(o,".git/FETCH_HEAD")),y=`FETCH_HEAD: ${y} `}catch(D){y=`FETCH_HEAD FAILED: ${String(D)} `}else y="FETCH_HEAD MISSING";this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchOutput:u,fetchHead:y,remoteBranch:i,currentBranch:p.currentBranch,currentCommit:p.commit,isCheckingGitStatus:this.#Be,folderName:e.folderName}})}}else!A&&r!=="commits"&&g&&g!==p.commit&&(f=Math.max(f,1));let C=await this.#V(o),I=C.length>0,B=await this.#Cr(o);return{type:"git",folderName:e.folderName,remoteBranchExists:A,remoteBranchHasChanges:c,hasGeneratingPlaceholder:await this.#mr(),isSessionDirty:d||!!g&&g!==p.commit,canSync:(f>0||h>0||B)&&!I,canPush:(f>0||h>0)&&!I,hasStagedChanges:B,canPull:h>0&&A,ahead:f,hasMergeConflict:I,commitMode:r,behind:h,currentCommit:p.commit,currentBranch:p.currentBranch,pendingValidation:this.#ee,remoteBranch:i,unmergedFiles:C}}finally{this.#Be--}}#Nt(){let e=this.getSessionContext();return{type:"session",title:e.title,beforeCommit:e.beforeCommit,createdUnixTime:e.createdUnixTime,updatedUnixTime:e.updatedUnixTime,turns:e.turns.length,id:e.sessionId,lastCompletionId:this.getLastCompletionId(),sessionMode:e.sessionMode,fusionConfig:dv(this.#u),hasBrowserAutomation:e.customAgents.some(r=>r.name==="browser-testing"),customInstructions:e.customInstructions.filter(r=>!r.hideUI).map(r=>({name:r.name,description:r.description??"",type:r.type??"always",glob:r.glob,isSkill:r.isSkill??r.filePath?.toLowerCase().includes("/skills/")??!1})),hasPlanToApply:this.#k}}#Tt(){let r=this.getSessionContext().turns,n=[];n.push(this.#Nt()),Object.keys(this.#U).length>0&&n.push({type:"metadata",...this.#U}),this.#t.length>0&&n.push({type:"message-queue",queue:this.#t.map(i=>({idempotencyKey:i.idempotencyKey,displayPrompt:i.displayPrompt,user:i.user}))});for(let i of r){n.push({type:"user",displayPrompt:i.userMessage?i.userMessage.displayPrompt??i.userMessage.userPrompt:void 0,attachments:i.userMessage?.attachments,id:i.completionId,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.userMessage?.idempotencyKey??""});for(let o of i.actions)if(o.type==="tool"||o.type==="text"||o.type==="thinking")if(n.push({type:"start",name:o.type,content:"",id:o.id??"",filePath:o.filePath??"",title:o.actionTitle??o.artifactTitle??o.filePath??""}),n.push({type:"delta",name:o.type,delta:o.content}),o.type==="tool"){if(n.push({type:o.type,id:o.id,name:o.filePath,content:o.content}),o.filePath==="UpdateSetupValue"||o.filePath==="ProposeConfig")try{let s=JSON.parse(o.content);if(o.filePath==="UpdateSetupValue")n.push({type:"update_setup_value",field:s.field,value:s.value,reason:s.reason});else{let a=s.config,A=a!=null&&!a.installCommand?.command&&(!a.runtimeDependencies||a.runtimeDependencies.length===0);n.push({type:"propose_config",config:a,message:s.message,noDependencies:A})}}catch{}}else o.type==="thinking"?n.push({type:"thinking",content:o.content}):o.type==="text"&&n.push({type:"text",content:o.content})}return n}connectToEventLoop(e,r,n){let i=n?.canHandleTools??[];if(e){let o=[],s=this.getSessionContext();o.push({type:"state",newState:"replay",abortable:!1,previousState:s.state}),this.#He&&o.push(this.#He),o.push(...this.#ie),o.push(...this.#Tt()),this.#X.forEach(c=>{o.push({type:"tool-call-request",id:c.id,name:c.name,input:c.input})});let a=this.#Ie?oc(this.#Ie):void 0;if(a)switch(a.type){case"file":case"diff":case"text":case"thinking":case"suggestion":case"tool":o.push({type:"start",id:a.id,name:a.type,filePath:a.filePath??"",title:a.actionTitle??a.artifactTitle??"",content:""}),o.push({type:"delta",name:a.type,delta:a.content});break}o.push({type:"terminals",terminals:this.#nt()});let A=this.#d;A?(o.push({type:"dev-server",devServerState:A.devState,setupState:A.setupState,httpServerState:A.httpServerState.state,devCommand:A.devCommand,setupCommand:A.setupCommand,proxyServer:A.proxyTarget,proxyServerSelection:A.proxyServerSelection,remoteAddress:A.httpServerState.remoteAddress,remotePort:A.httpServerState.remotePort,proxyServerReachable:!!this.#u?.isLocal,validateState:A.validateCommandState}),A.setupState!=="installed"&&o.push({type:"stdio",id:"setupCommand",command:A.setupCommand??"",content:A.getSetupWrite(),source:"run-command",stream:"stdout"}),o.push({type:"stdio",id:"devServer",command:A.devCommand,content:A.getDevWrite(),source:"run-command",stream:"stdout"})):r({type:"dev-server",devServerState:"running",setupState:"installed",httpServerState:"ok-2xx",devCommand:this.#u?.devCommand,setupCommand:this.#u?.setupCommand,proxyServer:this.#u?.serverUrl,proxyServerSelection:"hardcoded",remoteAddress:void 0,remotePort:void 0,proxyServerReachable:!!this.#u?.isLocal,validateState:"unset"}),o.push({type:"state",newState:s.state,abortable:s.state==="generating",previousState:"replay"}),this.#oe&&s.state!=="generating"&&o.push({type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:s.state,suggestion:this.#se,sessionMode:s.sessionMode,hasPlanToApply:this.#k}),r({type:"batch",steps:o})}this.#g.on("step",r);for(let o of i)this.#W.set(o,(this.#W.get(o)??0)+1);return this.waitForEventLoop(),()=>{this.#g.off("step",r);for(let o of i)this.#W.set(o,(this.#W.get(o)??0)-1)}}waitUntilPendingPromises(e){let r=Za();return this.#n.debug(`(waitUntilPendingPromises-${r}): started`),Yc(Promise.allSettled(this.#le),e).then(()=>Bl()).then(()=>{this.#n.debug(`(waitUntilPendingPromises-${r}): finished`)})}waitUntilBlockingPendingPromises(e){let r=Za();return this.#n.debug(`(waitUntilBlockingPendingPromises-${r}): started`),Yc(Promise.allSettled(this.#_e),e).then(()=>Bl()).then(()=>{this.#n.debug(`(waitUntilBlockingPendingPromises-${r}): finished`)})}waitUntilIdle(e){let r=Za();return this.waitForEventLoop(),this.#n.debug(`(waitUntilIdle-${r}): started`),Yc(Bl().then(()=>this.waitUntilPendingPromises()).then(()=>{let n=this.getSessionContext();return this.#n.debug(`(waitUntilIdle-${r}): starting in ${n.state} `),n.state==="generating"?(0,EF.once)(this.#g,"idle"):Promise.resolve(void 0)}).then(()=>this.waitUntilPendingPromises()).then(()=>{this.#n.debug(`(waitUntilIdle-${r}): idle reached in ${this.getSessionContext().state} `)}),e)}async#Mt(e){let r=this.#d;if(!r)throw new Error("Dev server not found");let n=await r.runValidateCommand(void 0,e);return n.status==="success"&&(this.#ee=!1,this.#m&&(await this.#rt()).length===0&&(await this.#At()||await this.manualCommit({add:".",commitMessage:"Validate command fixes"}))),n}waitForEventLoop(){return this.#oe?this.#oe:this.#oe=this.#ur()}async#ur(){if(this.#oe||this.#F)throw new Error("Event loop already started");this.#n.debug("(eventLoop): started");let e=Fye(),r=c=>{if(c.type==="error"&&this.#ue>0&&(pye.includes(c.code)||(c.restoreCredits=this.#ue,this.#ue=0,Qye(this.#e,this.#s,o.sessionId,c.restoreCredits).catch(u=>{this.#e.Sentry?.captureException(u)}))),c.type==="tool_result"&&(c.result.tool_name==="ExitPlanMode"||c.result.tool_name==="TodoWrite")&&ia(this.#s,"/events/publish",{event:Fce,extraData:{toolUseId:c.result.tool_use_id,toolName:c.result.tool_name??"",result:c.result.content,isError:c.result.is_error,sessionId:o.sessionId,projectId:this.#E,branchName:this.#D},extraAttributes:{toolName:c.result.tool_name??"",projectId:this.#E,branchName:this.#D}}),c.type==="tool"&&c.name==="Agent"){let u;try{u=JSON.parse(c.content)?.description}catch{}ia(this.#s,"/events/publish",{event:xce,extraData:{toolUseId:c.id,toolName:c.name,content:JSON.stringify({description:u}),sessionId:o.sessionId,projectId:this.#E,branchName:this.#D},extraAttributes:{toolName:c.name,projectId:this.#E,branchName:this.#D}})}this.#g.emit("step",c)};this.#F=new AbortController;let n=this.#F.signal,i=this.#d,o=this.getSessionContext(),s=()=>this.getLastCompletionId();this.#e.Sentry?.setContext("codeGen",{sessionId:o.sessionId,get completionId(){return s()}}),await this.#K(this.#S(),"initial-emitGitStatus");let a=setInterval(()=>{this.canHandleTool("GetScreenshot")&&(this.#Be>0||this.#S().catch(()=>{}))},6e4),A=()=>clearInterval(a);if(this.#Fe.push(A),process.env.FUSION_IDE_PORT){let c=setInterval(()=>{sue().then(u=>{let l=JSON.stringify(u);l!==this.#ut&&(this.#ut=l,this.#g.emit("step",{type:"ide",context:u}),this.queueSystemReminder({text:u?Aue(u):"",tag:"reminder:ide-context"}))}).catch(()=>{})},1e3);this.#Fe.push(()=>clearInterval(c))}this.queueGitStatusReminder({trigger:"session-start"}),i?.setupState==="not-installed"&&this.runSetupCommand();try{let c=0;for(;!n.aborted;){c++,this.#c=void 0;let u=this.#ir();if(this.#n.debug(`(eventLoop-${c}): started (shouldWait: ${u.shouldWait})`),u.shouldWait){await this.#kt();let g=await this.#fe();if(n.aborted)break;g&&Tye(u.promise,500).then(d=>{d&&(this.#n.debug(`(eventLoop-${c}): emitting idle on next message wait`),this.#g.emit("idle"))})}let l=await u.promise;if(n.aborted)break;if(!l)continue;this.#c=new AbortController;let p=qn([n,this.#c.signal]);try{if(this.#se=void 0,l.logsCheckpoint&&i?.addCheckpoint(),p?.aborted)throw yn(p.reason);this.#j("generating"),i?.abortValidateCommand(),l.syncChanges&&(this.#n.debug(`(eventLoop-${c}): syncing changes from remote`),await this.syncChangesFromRemote(l.syncChanges),await this.#et(!1,"critical")),l.sessionMode&&l.sessionMode!==o.sessionMode&&this.switchSessionMode(l.sessionMode),await this.#lr(l,p,r),this.#j("success");let g=l.autoPush??this.#me??"none";if(g!=="none"&&this.#m&&(this.#n.debug(`(eventLoop-${c}): autoPush: ${g}`),await this.waitUntilBlockingPendingPromises(),(await this.#rt()).length===0)){let f=(()=>{switch(g){case"force-push":return{actor:"agent",forcePush:!0,pullFirst:!1};case"merge-push":return{actor:"agent",pullFirst:!0,forcePush:!1};case"ff-push":return{actor:"agent",requireFastForward:!0,pullFirst:!1};case"safe-push":return{actor:"agent",pullFirst:!0,abortOnMergeConflict:!0};default:return{actor:"agent"}}})();if(this.#p.length>1)for(let h of this.#p)await this.#xe({...f,folderName:h.folderName});else await this.#xe(f)}this.#se=void 0}catch(g){g instanceof Error?g.name==="AbortError"?(r({type:"user-abort",hasContinueMessage:this.#t.length>0}),this.#j("abort")):g instanceof ze?(this.#i=void 0,r({type:"error",code:"cli-network-error",message:g.message}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#j("error")):g instanceof $t?(this.#i=void 0,r({type:"error",code:"unknown",message:"An internal error occurred. Please try again."}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#j("error")):g instanceof yi?(this.#i=void 0,r({type:"error",code:g.code,message:g.message}),pye.includes(g.code)||this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#j("error")):(this.#i=void 0,r({type:"error",code:"cli-genetic-error",message:g.message,metadata:{error:g}}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#j("error")):this.#j("error")}this.#_t++}}catch(c){throw this.#e.Sentry?.captureException(c,{level:"fatal"}),c}finally{A(),this.#F=void 0,this.#oe=void 0,e()}this.#n.debug("(eventLoop): emitting idle on close"),this.#g.emit("idle"),this.#j("close")}async#lr(e,r,n){this.#ue=0,this.#ee=!1;let i=this.getSessionContext(),o=e.displayPrompt||e.userPrompt||"";o&&this.#Xe.push(o);let s;if(e.agentType&&e.agentType!==this.#re){let D=await this.getNamedAgentConfig(e.agentType,this.getSessionId(),r);D.success&&(s={enabledTools:this.#Q,modelOverride:this.#_,mode:this.#M,systemPromptOverride:this.#ae,position:this.#h,includeMemories:this.#x},this.#Q=D.options.enabledTools,this.#_=D.options.modelOverride,this.#M=D.options.mode,this.#ae=D.options.systemPromptOverride,this.#h=D.options.position,this.#x=D.options.includeMemories)}let a=e.maxCompletions??this.#u?.maxAgentCompletions,A=a??BF,c=a??Iye,u=0,l=0,p=!0,g=!1,d=!1,f=!1,h,C=0,I=0,B=!1,E=0;try{for(;;E++){if(this.#n.debug(`(agentCompletion-${E}): started`),this.#e.connectionTracker.getConnectionCount()>0&&l>=A||l>=c){n({type:"error",code:"ask-to-continue",message:"The agent has been working for a while. Do you want to continue?"});break}if(r?.aborted)throw yn(r.reason);try{if(this.cancelAllPendingToolFulfilments(),h||(h=await this.#dr(e,p,r,n),h.modelOverride=e.modelOverride),h.user.role==="user"){let b=h.files.filter(Q=>(Q.importance??0)>2.5&&Q.content).map(Q=>({filePath:Q.filePath,size:Q.content?.length??0,isCustomInstruction:!1,wasIncluded:Q.wasIncluded}));i.customInstructions.forEach(Q=>{Q.filePath&&Q.type==="always"&&b.push({filePath:Q.filePath,size:Q.content?.length??0,isCustomInstruction:!0,wasIncluded:!0})}),n({type:"user-input",prompt:h.userMessage?.displayPrompt??h.userPrompt,files:b})}try{let b=await this.#gr(i,h,r,n),{shouldContinue:Q,completions:v,filesChanged:S}=b;if(this.#a&&this.#n.debug(`(agentCompletion-${E}): completion: ${JSON.stringify(b)}`),p=!1,h=void 0,u=0,g||=S,d||=S,f||=b.navigatePreviewCalled,l+=v,this.#ee||=S,this.#i=void 0,S&&this.#d?.addCheckpoint(),r?.aborted)throw yn(r.reason);let{hasHealthIssue:x}=await this.#Kt();if(!Q){if(r?.aborted)throw yn(r.reason);let U=this.getSessionMode();if((U==="planning"||U==="auto-planning")&&!this.#k&&!B&&I<3){this.#n.debug(`(agentCompletion-${E}): adding reminder for missing plan`),B=!0,I++,this.queueSystemReminder({text:"Remember to always write the plan file and call the ExitPlanMode tool before finishing. Also, prefer using AskUserQuestion tool to ask questions to the user."});continue}if(x&&I<3){this.#n.debug(`(agentCompletion-${E}): has health issue, continuing`),I++;continue}let H=this.#nr();if(H?.syncChanges&&await this.syncChangesFromRemote(H.syncChanges),H){this.#n.debug(`(agentCompletion-${E}): consumed queued messages`),p=!0,e=H,l=0;continue}let L=this.#d,M=e.runValidateCommand??!0;if(L?.validateCommand&&M&&C<2&&this.#ee){d=!0,C++,n({type:"start",name:"validate-command",id:"validate-command",title:"Validate Command",content:""});let _=e.autoPush;this.#n.debug(`(agentCompletion-${E}): running validate command`),this.#Mt(r).then(Y=>{if(this.#n.debug(`(validate-command): result status ${Y.status}`),Y.status==="failure"&&Y.code){let W=Y.output?JA(Y.output,100,500):"";this.sendMessage({user:e.user,maxCompletions:e.maxCompletions,runValidateCommand:!0,userPrompt:`The validate command failed with code ${Y.code}):
|
|
1935
|
+
`),tag:"reminder:git-status"})}async manualCommit(e){if(!this.#m)return!1;let r=this.getSessionContext();if(!r.beforeCommit){let n=await this.#O();Object.keys(n).length>0&&(r.beforeCommit=Ks(n))}return await this.commitWorkInProgress(e.commitMessage,[e.add]),await this.#ne(!0),!0}getLastSuggestedAction(){return this.#se}async#fe(){let e=this.getSessionContext();if(e.state==="generating"||e.state==="close")return this.#se=void 0,!1;let r=await this.#et(!0,"all");return e=this.getSessionContext(),e.state!=="generating"&&e.state!=="close"?(this.#se=r,this.#g.emit("step",{type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:e.state,suggestion:r,sessionMode:e.sessionMode,hasPlanToApply:this.#k,modelOverride:this.#_}),!0):!1}async#cr(e){if(!this.#m)return null;this.#Be++;try{let r=this.getCommitMode(),n=this.getFeatureBranch(),i=this.#ge(e),o=e.path,s=e.folderName===this.#p[0]?.folderName,a=this.getSessionContext(),A=!1,c=!1,u="",l=null;try{let E=await this.git(["rev-parse","--absolute-git-dir"],{cwd:o});l=this.#e.join(E.trim(),"FETCH_HEAD"),Zl.default.existsSync(l)&&Zl.default.unlinkSync(l)}catch(E){this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchHeadFilePath:l,isCheckingGitStatus:this.#Be,folderName:e.folderName}}),l=null}try{u=await this.git(["fetch","--no-tags","origin",i],{cwd:o}),A=!0}catch{A=!1}let p=await this.#e.getRepoInfo(o),g=yl(a.beforeCommit,e.folderName,this.gitRepoContexts[0]?.folderName);!s&&!e.initialCommit&&p.commit&&(e.initialCommit=p.commit),!g&&e.initialCommit&&(g=e.initialCommit);let d=this.#at(e.folderName),f=d?1:0,h=0;if(A){if(n!==i)try{await this.git(["--no-pager","diff","--quiet",`refs/remotes/origin/${n}...refs/remotes/origin/${i}`],{cwd:o}),c=!1}catch{c=!0}else c=!0;try{let E=kye(await this.git(["rev-list","--left-right","--count","HEAD...FETCH_HEAD"],{cwd:o}));f=E.ahead,h=E.behind}catch(E){let y=null;if(l)try{y=await this.#e.readFile(this.#e.join(o,".git/FETCH_HEAD")),y=`FETCH_HEAD: ${y} `}catch(D){y=`FETCH_HEAD FAILED: ${String(D)} `}else y="FETCH_HEAD MISSING";this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchOutput:u,fetchHead:y,remoteBranch:i,currentBranch:p.currentBranch,currentCommit:p.commit,isCheckingGitStatus:this.#Be,folderName:e.folderName}})}}else!A&&r!=="commits"&&g&&g!==p.commit&&(f=Math.max(f,1));let C=await this.#V(o),I=C.length>0,B=await this.#Cr(o);return{type:"git",folderName:e.folderName,remoteBranchExists:A,remoteBranchHasChanges:c,hasGeneratingPlaceholder:await this.#mr(),isSessionDirty:d||!!g&&g!==p.commit,canSync:(f>0||h>0||B)&&!I,canPush:(f>0||h>0)&&!I,hasStagedChanges:B,canPull:h>0&&A,ahead:f,hasMergeConflict:I,commitMode:r,behind:h,currentCommit:p.commit,currentBranch:p.currentBranch,pendingValidation:this.#ee,remoteBranch:i,unmergedFiles:C}}finally{this.#Be--}}#Nt(){let e=this.getSessionContext();return{type:"session",title:e.title,beforeCommit:e.beforeCommit,createdUnixTime:e.createdUnixTime,updatedUnixTime:e.updatedUnixTime,turns:e.turns.length,id:e.sessionId,lastCompletionId:this.getLastCompletionId(),sessionMode:e.sessionMode,fusionConfig:dv(this.#u),hasBrowserAutomation:e.customAgents.some(r=>r.name==="browser-testing"),customInstructions:e.customInstructions.filter(r=>!r.hideUI).map(r=>({name:r.name,description:r.description??"",type:r.type??"always",glob:r.glob,isSkill:r.isSkill??r.filePath?.toLowerCase().includes("/skills/")??!1})),hasPlanToApply:this.#k}}#Tt(){let r=this.getSessionContext().turns,n=[];n.push(this.#Nt()),Object.keys(this.#U).length>0&&n.push({type:"metadata",...this.#U}),this.#t.length>0&&n.push({type:"message-queue",queue:this.#t.map(i=>({idempotencyKey:i.idempotencyKey,displayPrompt:i.displayPrompt,user:i.user}))});for(let i of r){n.push({type:"user",displayPrompt:i.userMessage?i.userMessage.displayPrompt??i.userMessage.userPrompt:void 0,attachments:i.userMessage?.attachments,id:i.completionId,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.userMessage?.idempotencyKey??""});for(let o of i.actions)if(o.type==="tool"||o.type==="text"||o.type==="thinking")if(n.push({type:"start",name:o.type,content:"",id:o.id??"",filePath:o.filePath??"",title:o.actionTitle??o.artifactTitle??o.filePath??""}),n.push({type:"delta",name:o.type,delta:o.content}),o.type==="tool"){if(n.push({type:o.type,id:o.id,name:o.filePath,content:o.content}),o.filePath==="UpdateSetupValue"||o.filePath==="ProposeConfig")try{let s=JSON.parse(o.content);if(o.filePath==="UpdateSetupValue")n.push({type:"update_setup_value",field:s.field,value:s.value,reason:s.reason});else{let a=s.config,A=a!=null&&!a.installCommand?.command&&(!a.runtimeDependencies||a.runtimeDependencies.length===0);n.push({type:"propose_config",config:a,message:s.message,noDependencies:A})}}catch{}}else o.type==="thinking"?n.push({type:"thinking",content:o.content}):o.type==="text"&&n.push({type:"text",content:o.content})}return n}connectToEventLoop(e,r,n){let i=n?.canHandleTools??[];if(e){let o=[],s=this.getSessionContext();o.push({type:"state",newState:"replay",abortable:!1,previousState:s.state}),this.#He&&o.push(this.#He),o.push(...this.#ie),o.push(...this.#Tt()),this.#X.forEach(c=>{o.push({type:"tool-call-request",id:c.id,name:c.name,input:c.input})});let a=this.#Ie?oc(this.#Ie):void 0;if(a)switch(a.type){case"file":case"diff":case"text":case"thinking":case"suggestion":case"tool":o.push({type:"start",id:a.id,name:a.type,filePath:a.filePath??"",title:a.actionTitle??a.artifactTitle??"",content:""}),o.push({type:"delta",name:a.type,delta:a.content});break}o.push({type:"terminals",terminals:this.#nt()});let A=this.#d;A?(o.push({type:"dev-server",devServerState:A.devState,setupState:A.setupState,httpServerState:A.httpServerState.state,devCommand:A.devCommand,setupCommand:A.setupCommand,proxyServer:A.proxyTarget,proxyServerSelection:A.proxyServerSelection,remoteAddress:A.httpServerState.remoteAddress,remotePort:A.httpServerState.remotePort,proxyServerReachable:!!this.#u?.isLocal,validateState:A.validateCommandState}),A.setupState!=="installed"&&o.push({type:"stdio",id:"setupCommand",command:A.setupCommand??"",content:A.getSetupWrite(),source:"run-command",stream:"stdout"}),o.push({type:"stdio",id:"devServer",command:A.devCommand,content:A.getDevWrite(),source:"run-command",stream:"stdout"})):r({type:"dev-server",devServerState:"running",setupState:"installed",httpServerState:"ok-2xx",devCommand:this.#u?.devCommand,setupCommand:this.#u?.setupCommand,proxyServer:this.#u?.serverUrl,proxyServerSelection:"hardcoded",remoteAddress:void 0,remotePort:void 0,proxyServerReachable:!!this.#u?.isLocal,validateState:"unset"}),o.push({type:"state",newState:s.state,abortable:s.state==="generating",previousState:"replay"}),this.#oe&&s.state!=="generating"&&o.push({type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:s.state,suggestion:this.#se,sessionMode:s.sessionMode,hasPlanToApply:this.#k}),r({type:"batch",steps:o})}this.#g.on("step",r);for(let o of i)this.#W.set(o,(this.#W.get(o)??0)+1);return this.waitForEventLoop(),()=>{this.#g.off("step",r);for(let o of i)this.#W.set(o,(this.#W.get(o)??0)-1)}}waitUntilPendingPromises(e){let r=Za();return this.#r.debug(`(waitUntilPendingPromises-${r}): started`),Yc(Promise.allSettled(this.#le),e).then(()=>Bl()).then(()=>{this.#r.debug(`(waitUntilPendingPromises-${r}): finished`)})}waitUntilBlockingPendingPromises(e){let r=Za();return this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): started`),Yc(Promise.allSettled(this.#_e),e).then(()=>Bl()).then(()=>{this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): finished`)})}waitUntilIdle(e){let r=Za();return this.waitForEventLoop(),this.#r.debug(`(waitUntilIdle-${r}): started`),Yc(Bl().then(()=>this.waitUntilPendingPromises()).then(()=>{let n=this.getSessionContext();return this.#r.debug(`(waitUntilIdle-${r}): starting in ${n.state} `),n.state==="generating"?(0,EF.once)(this.#g,"idle"):Promise.resolve(void 0)}).then(()=>this.waitUntilPendingPromises()).then(()=>{this.#r.debug(`(waitUntilIdle-${r}): idle reached in ${this.getSessionContext().state} `)}),e)}async#Mt(e){let r=this.#d;if(!r)throw new Error("Dev server not found");let n=await r.runValidateCommand(void 0,e);return n.status==="success"&&(this.#ee=!1,this.#m&&(await this.#rt()).length===0&&(await this.#At()||await this.manualCommit({add:".",commitMessage:"Validate command fixes"}))),n}waitForEventLoop(){return this.#oe?this.#oe:this.#oe=this.#ur()}async#ur(){if(this.#oe||this.#F)throw new Error("Event loop already started");this.#r.debug("(eventLoop): started");let e=Fye(),r=c=>{if(c.type==="error"&&this.#ue>0&&(pye.includes(c.code)||(c.restoreCredits=this.#ue,this.#ue=0,Qye(this.#e,this.#s,o.sessionId,c.restoreCredits).catch(u=>{this.#e.Sentry?.captureException(u)}))),c.type==="tool_result"&&(c.result.tool_name==="ExitPlanMode"||c.result.tool_name==="TodoWrite")&&(this.#r.debug("emitting ClientDevtoolsToolResultV1",{toolName:c.result.tool_name,projectId:this.#h,branchName:this.#y}),ia(this.#s,"/events/publish",{event:Fce,extraData:{toolUseId:c.result.tool_use_id,toolName:c.result.tool_name??"",result:c.result.content,isError:c.result.is_error,sessionId:o.sessionId,projectId:this.#h,branchName:this.#y},extraAttributes:{toolName:c.result.tool_name??"",projectId:this.#h,branchName:this.#y}})),c.type==="tool"&&c.name==="Agent"){let u;try{u=JSON.parse(c.content)?.description}catch{}let l=JSON.stringify({description:u});this.#r.debug("emitting ClientDevtoolsToolCallV1",{toolName:c.name,projectId:this.#h,branchName:this.#y}),ia(this.#s,"/events/publish",{event:xce,extraData:{toolUseId:c.id,toolName:c.name,content:l,sessionId:o.sessionId,projectId:this.#h,branchName:this.#y},extraAttributes:{toolName:c.name,projectId:this.#h,branchName:this.#y}})}this.#g.emit("step",c)};this.#F=new AbortController;let n=this.#F.signal,i=this.#d,o=this.getSessionContext(),s=()=>this.getLastCompletionId();this.#e.Sentry?.setContext("codeGen",{sessionId:o.sessionId,get completionId(){return s()}}),await this.#K(this.#S(),"initial-emitGitStatus");let a=setInterval(()=>{this.canHandleTool("GetScreenshot")&&(this.#Be>0||this.#S().catch(()=>{}))},6e4),A=()=>clearInterval(a);if(this.#Fe.push(A),process.env.FUSION_IDE_PORT){let c=setInterval(()=>{sue().then(u=>{let l=JSON.stringify(u);l!==this.#ut&&(this.#ut=l,this.#g.emit("step",{type:"ide",context:u}),this.queueSystemReminder({text:u?Aue(u):"",tag:"reminder:ide-context"}))}).catch(()=>{})},1e3);this.#Fe.push(()=>clearInterval(c))}this.queueGitStatusReminder({trigger:"session-start"}),i?.setupState==="not-installed"&&this.runSetupCommand();try{let c=0;for(;!n.aborted;){c++,this.#c=void 0;let u=this.#ir();if(this.#r.debug(`(eventLoop-${c}): started (shouldWait: ${u.shouldWait})`),u.shouldWait){await this.#kt();let g=await this.#fe();if(n.aborted)break;g&&Tye(u.promise,500).then(d=>{d&&(this.#r.debug(`(eventLoop-${c}): emitting idle on next message wait`),this.#g.emit("idle"))})}let l=await u.promise;if(n.aborted)break;if(!l)continue;this.#c=new AbortController;let p=qn([n,this.#c.signal]);try{if(this.#se=void 0,l.logsCheckpoint&&i?.addCheckpoint(),p?.aborted)throw yn(p.reason);this.#j("generating"),i?.abortValidateCommand(),l.syncChanges&&(this.#r.debug(`(eventLoop-${c}): syncing changes from remote`),await this.syncChangesFromRemote(l.syncChanges),await this.#et(!1,"critical")),l.sessionMode&&l.sessionMode!==o.sessionMode&&this.switchSessionMode(l.sessionMode),await this.#lr(l,p,r),this.#j("success");let g=l.autoPush??this.#me??"none";if(g!=="none"&&this.#m&&(this.#r.debug(`(eventLoop-${c}): autoPush: ${g}`),await this.waitUntilBlockingPendingPromises(),(await this.#rt()).length===0)){let f=(()=>{switch(g){case"force-push":return{actor:"agent",forcePush:!0,pullFirst:!1};case"merge-push":return{actor:"agent",pullFirst:!0,forcePush:!1};case"ff-push":return{actor:"agent",requireFastForward:!0,pullFirst:!1};case"safe-push":return{actor:"agent",pullFirst:!0,abortOnMergeConflict:!0};default:return{actor:"agent"}}})();if(this.#p.length>1)for(let h of this.#p)await this.#xe({...f,folderName:h.folderName});else await this.#xe(f)}this.#se=void 0}catch(g){g instanceof Error?g.name==="AbortError"?(r({type:"user-abort",hasContinueMessage:this.#t.length>0}),this.#j("abort")):g instanceof ze?(this.#i=void 0,r({type:"error",code:"cli-network-error",message:g.message}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#j("error")):g instanceof $t?(this.#i=void 0,r({type:"error",code:"unknown",message:"An internal error occurred. Please try again."}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#j("error")):g instanceof yi?(this.#i=void 0,r({type:"error",code:g.code,message:g.message}),pye.includes(g.code)||this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#j("error")):(this.#i=void 0,r({type:"error",code:"cli-genetic-error",message:g.message,metadata:{error:g}}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#j("error")):this.#j("error")}this.#_t++}}catch(c){throw this.#e.Sentry?.captureException(c,{level:"fatal"}),c}finally{A(),this.#F=void 0,this.#oe=void 0,e()}this.#r.debug("(eventLoop): emitting idle on close"),this.#g.emit("idle"),this.#j("close")}async#lr(e,r,n){this.#ue=0,this.#ee=!1;let i=this.getSessionContext(),o=e.displayPrompt||e.userPrompt||"";o&&this.#Xe.push(o);let s;if(e.agentType&&e.agentType!==this.#re){let D=await this.getNamedAgentConfig(e.agentType,this.getSessionId(),r);D.success&&(s={enabledTools:this.#D,modelOverride:this.#_,mode:this.#M,systemPromptOverride:this.#ae,position:this.#C,includeMemories:this.#x},this.#D=D.options.enabledTools,this.#_=D.options.modelOverride,this.#M=D.options.mode,this.#ae=D.options.systemPromptOverride,this.#C=D.options.position,this.#x=D.options.includeMemories)}let a=e.maxCompletions??this.#u?.maxAgentCompletions,A=a??BF,c=a??Iye,u=0,l=0,p=!0,g=!1,d=!1,f=!1,h,C=0,I=0,B=!1,E=0;try{for(;;E++){if(this.#r.debug(`(agentCompletion-${E}): started`),this.#e.connectionTracker.getConnectionCount()>0&&l>=A||l>=c){n({type:"error",code:"ask-to-continue",message:"The agent has been working for a while. Do you want to continue?"});break}if(r?.aborted)throw yn(r.reason);try{if(this.cancelAllPendingToolFulfilments(),h||(h=await this.#dr(e,p,r,n),h.modelOverride=e.modelOverride),h.user.role==="user"){let b=h.files.filter(Q=>(Q.importance??0)>2.5&&Q.content).map(Q=>({filePath:Q.filePath,size:Q.content?.length??0,isCustomInstruction:!1,wasIncluded:Q.wasIncluded}));i.customInstructions.forEach(Q=>{Q.filePath&&Q.type==="always"&&b.push({filePath:Q.filePath,size:Q.content?.length??0,isCustomInstruction:!0,wasIncluded:!0})}),n({type:"user-input",prompt:h.userMessage?.displayPrompt??h.userPrompt,files:b})}try{let b=await this.#gr(i,h,r,n),{shouldContinue:Q,completions:v,filesChanged:S}=b;if(this.#a&&this.#r.debug(`(agentCompletion-${E}): completion: ${JSON.stringify(b)}`),p=!1,h=void 0,u=0,g||=S,d||=S,f||=b.navigatePreviewCalled,l+=v,this.#ee||=S,this.#i=void 0,S&&this.#d?.addCheckpoint(),r?.aborted)throw yn(r.reason);let{hasHealthIssue:x}=await this.#Kt();if(!Q){if(r?.aborted)throw yn(r.reason);let U=this.getSessionMode();if((U==="planning"||U==="auto-planning")&&!this.#k&&!B&&I<3){this.#r.debug(`(agentCompletion-${E}): adding reminder for missing plan`),B=!0,I++,this.queueSystemReminder({text:"Remember to always write the plan file and call the ExitPlanMode tool before finishing. Also, prefer using AskUserQuestion tool to ask questions to the user."});continue}if(x&&I<3){this.#r.debug(`(agentCompletion-${E}): has health issue, continuing`),I++;continue}let H=this.#nr();if(H?.syncChanges&&await this.syncChangesFromRemote(H.syncChanges),H){this.#r.debug(`(agentCompletion-${E}): consumed queued messages`),p=!0,e=H,l=0;continue}let L=this.#d,M=e.runValidateCommand??!0;if(L?.validateCommand&&M&&C<2&&this.#ee){d=!0,C++,n({type:"start",name:"validate-command",id:"validate-command",title:"Validate Command",content:""});let _=e.autoPush;this.#r.debug(`(agentCompletion-${E}): running validate command`),this.#Mt(r).then(Y=>{if(this.#r.debug(`(validate-command): result status ${Y.status}`),Y.status==="failure"&&Y.code){let W=Y.output?JA(Y.output,100,500):"";this.sendMessage({user:e.user,maxCompletions:e.maxCompletions,runValidateCommand:!0,userPrompt:`The validate command failed with code ${Y.code}):
|
|
1936
1936
|
<validate_command>
|
|
1937
1937
|
${Y.command}
|
|
1938
1938
|
</validate_command>
|
|
@@ -1941,10 +1941,10 @@ ${Y.command}
|
|
|
1941
1941
|
${W}
|
|
1942
1942
|
</output>
|
|
1943
1943
|
|
|
1944
|
-
failed with code ${Y.code}`,dropAbortedPrompt:!0,attachments:void 0,displayPrompt:`The validation command ${Y.command} failed with code ${Y.code}.`,queue:!0,category:"repair-validate-command",syncChanges:void 0,autoPush:_})}})}break}}catch(b){throw await this.#S(),b}}catch(b){let Q=function(v){return!!(v instanceof yi&&v.code==="abrupt-end"||v instanceof Error&&v.name==="HTTPStreamBroke"||v instanceof ze&&[502,503].includes(v.statusCode??0)||v instanceof ze&&!v.statusCode&&["connection_reset","connection_timeout","connection_aborted"].includes(v.type))};var y=Q;if(u<3&&Q(b)){this.#
|
|
1945
|
-
${E.completionId}`,U),await this.#S(),this.#de({completionId:x.completionId,beforeCommit:x.beforeCommit}),i({type:"done",stopReason:S.stopReason,id:S.id,applyResults:x.applyResults,actions:S.actions??[],creditsUsed:S.creditsUsed,sessionUsage:S.sessionUsage,contextWindow:S.contextWindow,model:S.model,usage:S.usage,url:S.nextUrl,promptVersion:S.promptVersion,hasChanges:H})}else{if(S.type==="continue")return y=S.autoContinue,D=!0,i({type:"continue",id:S.id,url:S.nextUrl,autoContinue:S.autoContinue}),!0;S.type==="thinking"&&(S.actionTitle="Planning"),"content"in S&&S.type!=="delta"&&i({type:"start",name:S.type,filePath:S.filePath??"",id:"id"in S?S.id:void 0,title:S.actionTitle??S.artifactTitle??S.filePath??"",content:S.content??""})}}return!1},Q=S=>{if(S.type==="thinking"&&i({type:"thinking",content:S.content}),S.type==="server_tool_result"){let x;try{x=JSON.parse(S.content)}catch(U){this.#e.Sentry?.captureException(U,{extra:{contentPreview:S.content?.substring(0,500),contentLength:S.content?.length},tags:{operation:"server-tool-result-parse"}}),x=S.content}i({type:"server_tool_result",content:x,title:S.actionTitle??S.artifactTitle??"Server Tool Result",id:S.id})}S.type==="file"&&S.filePath&&!S.synthetic&&i({type:"file",filePath:S.filePath,content:S.content,title:S.actionTitle??S.artifactTitle??"Created",id:S.id,errors:S.errors}),S.type==="diff"&&S.filePath&&!S.synthetic&&i({type:"diff",filePath:S.filePath,title:S.actionTitle??S.artifactTitle??"Updated",content:S.content,id:S.id,errors:S.errors}),S.type==="tool"&&S.filePath?i({type:"tool",name:S.filePath,id:S.id,content:S.content}):S.type==="text"&&i({type:"text",content:S.content})},v=(S,x)=>{i({type:"delta",name:S.type,delta:x})};for await(let S of B){if(S.type==="ping"){this.#
|
|
1946
|
-
${e}`:this.#De=e}async#ne(e){if(!this.#m)return!1;let r=this.#De,n=this.#Xe,i=this.getLastTurn(),o=i?.completionId;this.#De=null,this.#Xe=[];let a=(async()=>{if(await this.#Qt,!r)return!1;this.#
|
|
1947
|
-
`).flatMap(E=>["-m",E]);try{await this.git(["commit","--quiet","--no-verify","--no-gpg-sign",...B],{cwd:l.path}),A=!0}catch(E){this.#e.Sentry?.captureException(new Error(`Error in batch commit for ${l.folderName}: ${E}`),{tags:{operation:"codegen-git-batch-commit"}})}});let c=await this.#O(),u=Ks(c);return u&&(this.#R={...this.#R,...c},i&&(i.afterCommit=u,i.lastCommit=u),this.#de({completionId:o,beforeCommit:i?.beforeCommit,afterCommit:u,lastCommit:u,commitFailed:!1})),e&&await this.#S(),A}catch(c){return this.#e.Sentry?.captureException(new Error(`Error in #commitAccumulatedChanges: ${c}`),{tags:{operation:"codegen-git-batch-commit"}}),A}})();return this.#Qt=a,this.#K(a,"commitAccumulatedChanges",!0)}async#pr(e,r,n,i){let o=r.actions.filter(s=>s.type==="tool"&&s.id).map(s=>{let a=s.content.trim(),A={};try{A=a?JSON.parse(a):{}}catch{A={}}return{id:s.id,name:s.filePath,input:A,abortController:this.#Y.find(c=>c.id===s.id)?.abortController??new AbortController}})??[];if(o.length>0){this.#Y=o;try{let s={debug:this.#a,logger:ke("ToolContext",{debug:()=>!!(this.#a||process.env.DEBUG)}),sys:this.#e,credentials:this.#s,files:e.files,user:e.user,projectId:this.#
|
|
1944
|
+
failed with code ${Y.code}`,dropAbortedPrompt:!0,attachments:void 0,displayPrompt:`The validation command ${Y.command} failed with code ${Y.code}.`,queue:!0,category:"repair-validate-command",syncChanges:void 0,autoPush:_})}})}break}}catch(b){throw await this.#S(),b}}catch(b){let Q=function(v){return!!(v instanceof yi&&v.code==="abrupt-end"||v instanceof Error&&v.name==="HTTPStreamBroke"||v instanceof ze&&[502,503].includes(v.statusCode??0)||v instanceof ze&&!v.statusCode&&["connection_reset","connection_timeout","connection_aborted"].includes(v.type))};var y=Q;if(u<3&&Q(b)){this.#r.debug(`(agentCompletion-${E}): retrying error`,b),await Ap(u,r),u++;continue}throw b}finally{yye(i.turns)}}}finally{this.#r.debug(`(agentCompletion-${E}): finally block`),s&&(this.#D=s.enabledTools,this.#_=s.modelOverride,this.#M=s.mode,this.#ae=s.systemPromptOverride,this.#C=s.position,this.#x=s.includeMemories),await this.#ne(!0);let D=this.#u?.refreshPreview??!0;g&&D&&!f&&this.requestRefresh()}}async#gr(e,r,n,i){if(n.aborted)throw yn(n.reason);if(this.#Ie)throw new Error("generateCompletion already started");let o=Za(),s=this.getLastTurn()?.nextUrl??this.#B,a=!1,A=0,c=!1;try{let u=this.#Ie=[];if(!e.beforeCommit){let S=await this.#O();Object.keys(S).length>0&&(e.beforeCommit=Ks(S))}let l=await this.#O(),p=Ks(l),g=this.#qe;g&&this.#P?.enabled&&(g=!!this.#P.mcpServers);let d=r.userMessage?.uiContextPrompt;if(d&&!this.#N()){let S=this.#u?.workspace?.folders.find(x=>x.enableGit);S?.path&&(d=`Relative file paths are relative to: ${S.path}/`)}let f=this.#D,h={...e.userContext,fullstoryUrl:r.userMessage?.metadata?.fullstoryUrl,prNumber:r.userMessage?.metadata?.PR_NUMBER??e.userContext?.prNumber,prHeadSha:r.userMessage?.metadata?.PR_HEAD_SHA??e.userContext?.prHeadSha,repoFullName:r.userMessage?.metadata?.REPO_FULL_NAME??e.userContext?.repoFullName,hostname:r.userMessage?.metadata?.HOSTNAME??e.userContext?.hostname,checkRunId:r.userMessage?.metadata?.CHECK_RUN_ID??e.userContext?.checkRunId,containerUrl:process.env.FUSION_ENV_ORIGIN??e.userContext?.containerUrl,browserTestingShadowMode:r.userMessage?.metadata?.BROWSER_TESTING_SHADOW_MODE??e.userContext?.browserTestingShadowMode};e.userContext=h,this.#Pe=r.modelOverride;let C=this.#Ee?.listTools(),I={url:s,position:this.#C,eventName:"cli code",maxPages:2,autoContinue:1,codeGenMode:this.#M,userContext:h,systemReminders:r.systemReminders,files:r.files,skipFileDiff:this.#T,maxTokens:this.#pt,aclPolicy:this.#u?.accessControl,softContextWindow:this.#b,repoIndexingConfig:this.#u?.repoIndexingConfig??{designSystems:[]},recommendedRoot:this.#Qe,attachments:r.attachments,customInstructions:e.customInstructions,customAgents:e.customAgents.filter(S=>S.name!==this.#re).map(S=>({name:S.name,description:S.description})),systemPromptOverride:this.#ae,sessionId:e.sessionId,userPrompt:r.userPrompt,metadata:{...h.prNumber&&{PR_NUMBER:h.prNumber},...h.prHeadSha&&{PR_HEAD_SHA:h.prHeadSha},...h.repoFullName&&{REPO_FULL_NAME:h.repoFullName},...h.hostname&&{HOSTNAME:h.hostname},...h.containerUrl&&{CONTAINER_URL:h.containerUrl},...h.checkRunId&&{CHECK_RUN_ID:h.checkRunId},...r.userMessage?.metadata},ephemeralUserPrompt:r.userMessage?.ephemeralUserPrompt,uiContextPrompt:r.userMessage?.uiContextPrompt,displayUserPrompt:r.userMessage?.displayPrompt,isManualContinue:r.userMessage?.isManualContinue,sessionMode:this.getSessionMode(),includeRelevantMemories:r.userMessage?r.userMessage.includeRelevantMemories??this.#x:void 0,projectId:this.#h,branchName:this.#y,repoHash:this.#mt,repoBranch:this.#H,pingEvents:!0,workingDirectory:this.#v,beforeCommit:p,toolResults:r.toolResults,role:r.user.role,user:r.user,repair:r.repair,category:r.category,enabledTools:f,enabledMCPs:g?r.enabledMCPs:void 0,localMCPTools:C,isLocal:this.#u?.isLocal,searchResponse:r.searchResponse,encryptKey:this.#he,maxAgentTiming:180*1e3,mcpServers:g,environmentVariables:Rye(this.#u?.environmentVariables??[],this.#d?.environmentVariables??[]),redactUserMessages:this.#P?.redactUserMessages,redactLLMMessages:this.#P?.redactLLMMessages,modelOverride:this.#_??r.modelOverride,reasoning:this.#Ve,interruptActiveTask:r.userMessage?.queue===!1||void 0,parentSessionId:this.#yt};this.#a&&this.#r.debug(`(generateCompletion-${o}): request partial body. ${JSON.stringify({url:I.url,userPrompt:I.userPrompt,systemReminders:I.systemReminders,toolResultsCount:I.toolResults?.length})}`);let B=Dye(this.#e,this.#s,I,n,this.#a),E,y=!1,D=!1,b=async S=>{if(S.type==="user"){E&&E.state!=="done"&&this.#e.Sentry?.captureException(new Error("Turn was not completed before starting a new turn"),{tags:{operation:"codegen-stream"},extra:{lastTurn:E}});let x=E={state:"running",unixTime:Date.now(),title:"",sentiment:void 0,userMessage:r.userMessage,afterCommit:p,beforeCommit:p,lastCommit:void 0,creditsUsed:0,actions:[],applyResults:[],completionId:S.id??"",nextUrl:void 0,user:S.user,autoContinue:!1};E=x,e.turns.push(x),S.compacting&&(e.customInstructions=await this.#Se(),e.customAgents=await this.#Ge()),i({type:"user",displayPrompt:S.displayPrompt,id:S.id,user:S.user,role:S.user.role,compacting:S.compacting,idempotencyKey:r.userMessage?.idempotencyKey})}else if(S.type==="mcp-status")this.#He=S,i(S);else{if(S.type==="mcp-auth-required")return D=!0,i(S),!0;if(S.type==="error")return D=!0,i(S),!0;if(S.type==="done"){A++,this.#$.length=0,this.#ue+=S.creditsUsed;let x=E=await this.#fr(e,S,E,p);for(let L of S.actions??[])L.type==="tool_result"&&(L.filePath==="ExitPlanMode"&&(this.#k=!0),L.filePath==="NavigatePreview"&&(c=!0),i({type:"tool_result",result:{content:L.content,tool_use_id:L.id,type:"tool_result",title:L.actionTitle,tool_name:L.filePath,is_error:!!L.errors?.length}}));await this.waitUntilBlockingPendingPromises(n);let U=await this.#Ir(this.#e,x),H=U.length>0;H&&(a=!0),await this.commitWorkInProgress(`${E.title}
|
|
1945
|
+
${E.completionId}`,U),await this.#S(),this.#de({completionId:x.completionId,beforeCommit:x.beforeCommit}),i({type:"done",stopReason:S.stopReason,id:S.id,applyResults:x.applyResults,actions:S.actions??[],creditsUsed:S.creditsUsed,sessionUsage:S.sessionUsage,contextWindow:S.contextWindow,model:S.model,usage:S.usage,url:S.nextUrl,promptVersion:S.promptVersion,hasChanges:H})}else{if(S.type==="continue")return y=S.autoContinue,D=!0,i({type:"continue",id:S.id,url:S.nextUrl,autoContinue:S.autoContinue}),!0;S.type==="thinking"&&(S.actionTitle="Planning"),"content"in S&&S.type!=="delta"&&i({type:"start",name:S.type,filePath:S.filePath??"",id:"id"in S?S.id:void 0,title:S.actionTitle??S.artifactTitle??S.filePath??"",content:S.content??""})}}return!1},Q=S=>{if(S.type==="thinking"&&i({type:"thinking",content:S.content}),S.type==="server_tool_result"){let x;try{x=JSON.parse(S.content)}catch(U){this.#e.Sentry?.captureException(U,{extra:{contentPreview:S.content?.substring(0,500),contentLength:S.content?.length},tags:{operation:"server-tool-result-parse"}}),x=S.content}i({type:"server_tool_result",content:x,title:S.actionTitle??S.artifactTitle??"Server Tool Result",id:S.id})}S.type==="file"&&S.filePath&&!S.synthetic&&i({type:"file",filePath:S.filePath,content:S.content,title:S.actionTitle??S.artifactTitle??"Created",id:S.id,errors:S.errors}),S.type==="diff"&&S.filePath&&!S.synthetic&&i({type:"diff",filePath:S.filePath,title:S.actionTitle??S.artifactTitle??"Updated",content:S.content,id:S.id,errors:S.errors}),S.type==="tool"&&S.filePath?i({type:"tool",name:S.filePath,id:S.id,content:S.content}):S.type==="text"&&i({type:"text",content:S.content})},v=(S,x)=>{i({type:"delta",name:S.type,delta:x})};for await(let S of B){if(S.type==="ping"){this.#r.debug(`(generateCompletion-${o}): ping`);continue}if(S.type==="delta"){let x=S.content,U=oc(u);U&&"content"in U&&(U.content+=x,v(U,x))}else{let x=oc(u);if(S.type==="thinking"&&x?.type==="thinking")continue;if(x&&"content"in x&&(x.incomplete=!1,Q(x)),u.push(S),await b(S))break}}if(!D)throw new yi("Completion stream ended abruptly","abrupt-end");if(!E)throw new yi("Completion stream ended abruptly","abrupt-end");return{completions:A,filesChanged:a,navigatePreviewCalled:c,shouldContinue:y||E.actions.some(S=>S.type==="tool")||E.autoContinue}}finally{this.#Ie=void 0}}async commitWorkInProgress(e,r){if(!this.#m)return;let n=this.#Xt(r);await this.#J(async i=>{let o=n.get(i.folderName)||[],s=await this.#V(i.path);try{s.length>0?(o.length>0&&await this.git(["add",...o],{cwd:i.path,retry:2}),(await this.#V(i.path)).length===0&&await this.git(["add","-A","."],{cwd:i.path,retry:2})):await this.git(["add","-A","."],{cwd:i.path,retry:2})}catch(a){this.#e.Sentry?.captureException(new Error(`Error staging files in ${i.folderName}: ${a}`),{tags:{operation:"codegen-git-stage"}})}}),typeof this.#De=="string"?this.#De+=`
|
|
1946
|
+
${e}`:this.#De=e}async#ne(e){if(!this.#m)return!1;let r=this.#De,n=this.#Xe,i=this.getLastTurn(),o=i?.completionId;this.#De=null,this.#Xe=[];let a=(async()=>{if(await this.#Qt,!r)return!1;this.#r.debug("(#commitAccumulatedChanges): committing pending changes");let A=!1;try{await this.#J(async l=>{let p="";try{await this.git(["--no-pager","diff","--cached","--quiet"],{cwd:l.path});return}catch{try{if(p=await this.git(["--no-pager","diff","--cached","--no-color"],{cwd:l.path}),!p.trim())return}catch{return}}let g=await this.#zt(l.path),d=r,f=performance.now(),h=await ia(this.#s,"/codegen/commit-message",{diff:JA(p,500),userMessages:n,recentCommits:g,projectId:this.#h},{signal:AbortSignal.timeout(2e4),debug:this.#a});this.#G("git_commit_message_llm",performance.now()-f,{folder:l.folderName});let B=(h?.message||d).split(`
|
|
1947
|
+
`).flatMap(E=>["-m",E]);try{await this.git(["commit","--quiet","--no-verify","--no-gpg-sign",...B],{cwd:l.path}),A=!0}catch(E){this.#e.Sentry?.captureException(new Error(`Error in batch commit for ${l.folderName}: ${E}`),{tags:{operation:"codegen-git-batch-commit"}})}});let c=await this.#O(),u=Ks(c);return u&&(this.#R={...this.#R,...c},i&&(i.afterCommit=u,i.lastCommit=u),this.#de({completionId:o,beforeCommit:i?.beforeCommit,afterCommit:u,lastCommit:u,commitFailed:!1})),e&&await this.#S(),A}catch(c){return this.#e.Sentry?.captureException(new Error(`Error in #commitAccumulatedChanges: ${c}`),{tags:{operation:"codegen-git-batch-commit"}}),A}})();return this.#Qt=a,this.#K(a,"commitAccumulatedChanges",!0)}async#pr(e,r,n,i){let o=r.actions.filter(s=>s.type==="tool"&&s.id).map(s=>{let a=s.content.trim(),A={};try{A=a?JSON.parse(a):{}}catch{A={}}return{id:s.id,name:s.filePath,input:A,abortController:this.#Y.find(c=>c.id===s.id)?.abortController??new AbortController}})??[];if(o.length>0){this.#Y=o;try{let s={debug:this.#a,logger:ke("ToolContext",{debug:()=>!!(this.#a||process.env.DEBUG)}),sys:this.#e,credentials:this.#s,files:e.files,user:e.user,projectId:this.#h,branchName:this.#y,position:this.#C,fusionConfig:this.#u,enabledTools:this.#D??[],sessionMode:this.getSessionMode(),fusionStatusMonitor:this.#$e,asyncSubAgents:this.#ze,switchSessionMode:A=>this.switchSessionMode(A),signal:n,canCollapseWorkspace:this.#N(),emitter:this.#g,session:this,filterText:A=>(A=qie(A,this.#v),this.#u?.accessControl?.secrets&&(A=Vie(A,this.#u.accessControl.secrets)),A),allowedCommands:Xb(this.#u?.allowedCommands??[]),getAllFiles:A=>this.getAllFiles({getDotFiles:A.getDotFiles,includePattern:A.pattern,gitignore:!0,maxFiles:A.maxFiles}),workingDirectory:this.#I,bashWorkingDirectory:this.#v,workspaceFolders:this.#E?.folders??[],restore:A=>this.restore(A),patchFusionConfig:A=>{e.patchFusionConfig||(e.patchFusionConfig={});let c=e.patchFusionConfig.envVariables;Object.assign(e.patchFusionConfig,A),e.patchFusionConfig.envVariables={...c,...A.envVariables}},readFile:A=>this.readFile(A),writeFile:(A,c)=>this.writeFile(A,c),deleteFile:A=>this.deleteFile(A),fileExists:A=>this.fileExists(A),listDir:A=>this.listDir(A),evaluateAccess:(A,c)=>Ua(A,c,this.#u?.accessControl,this.#z()),stat:A=>this.stat(A),localMCPManager:this.#Ee,passThrough:(A,c)=>new Promise((u,l)=>{let p=c?.messageValid??!1,g=c?.signal??new AbortController().signal;if(!this.canHandleTool(A.name)&&!p){l(new Error("The user is currently not present in the chat. Ie, he is not able to respond to the request"));return}let f=()=>{g.removeEventListener("abort",h),this.#X.delete(A.id)},h=()=>{f(),l(new Error("Aborted by the user. So the task could not be completed."))};if(g.aborted){h();return}g.addEventListener("abort",h,{once:!0}),this.#X.set(A.id,{id:A.id,name:A.name,input:A.input,messageValid:p,resolve:C=>{f(),u(C)}}),this.#g.emit("step",{type:"tool-call-request",id:A.id,name:A.name,input:A.input,messageValid:p}),A.name==="AskUserQuestion"&&(this.#r.debug("emitting ClientDevtoolsToolCallRequestV1",{toolName:A.name,projectId:this.#h,branchName:this.#y}),ia(this.#s,"/events/publish",{event:Sce,extraData:{toolUseId:A.id,toolName:A.name,input:A.input,sessionId:this.getSessionId(),projectId:this.#h,branchName:this.#y,messageValid:p},extraAttributes:{toolName:A.name,projectId:this.#h,branchName:this.#y}}))}),resolveWorkspacePath:(A,c)=>{if(typeof A!="string")throw new TypeError(`resolveWorkspacePath: 'path' must be a string, received ${typeof A}: ${na(A)}`);return this.resolveWorkspacePath(A,c)},absolutePathToWorkspaceUrl:A=>this.absolutePathToWorkspaceUrl(A),setHasPlanToApply:(A,c)=>{this.#k=A,this.#te=A?c:void 0},devServerOrchestrator:this.#d},a=await mye(s,o,r.cachedToolResults,i);if(r.cachedToolResults=a,s.signal?.aborted)throw yn(s.signal.reason);e.patchFusionConfig&&this.#g.emit("step",{type:"fusion-config-patch",patch:e.patchFusionConfig}),e.files=s.files,e.toolResults=a}finally{this.#Y=[]}}}async#dr(e,r,n,i){let o=this.getSessionContext(),s=oc(o.turns),a=structuredClone(e.user??s?.user??{source:"agent",role:"agent"}),A={userMessage:void 0,userPrompt:"",systemReminders:this.#$.slice(),files:[],attachments:[],searchResponse:null,rerankFiles:0,mostRelevantFile:null,toolResults:[],user:a,modelOverride:e.modelOverride,repair:e.repair,category:e.category,enabledMCPs:e.enabledMCPs},c=!!this.getLastTurn()?.nextUrl,u=o.turns.length<2||!c;if(r){let l=null;if(u){let p=Cye(await this.getAllFiles({getDotFiles:!1,gitignore:!0,deep:4,truncate:2e4})),g=new Set,d=new Set;if(e.files)for(let B of e.files)g.add(Jie(B));let f=e.includeBaseFiles??o.turns.length===0,h=Array.from(g),C=B=>f&&Sye(B,this.#Qe)?10:f&&vye(B,this.#Qe)?5:d.has(B)||h.some(E=>B.toLowerCase().startsWith(E.toLowerCase()))?2:0,I=n.aborted?[]:p.map(B=>{let E=C(B);if(E===0)return{filePath:B};let y=null;try{if(y=this.readFileSync(B),!y)return{filePath:B}}catch{return{filePath:B}}let D=y.length<3e4;return{filePath:B,content:y,importance:D?E:2}});A.files=I,A.attachments=e.attachments??[]}if(this.#m&&!this.#re){let p,g=await this.getChangesReport();if(g){for(let d of g.files)if(!A.files.some(f=>f.filePath===d))try{let f=await this.readFile(d);A.files.push({filePath:d,importance:0,content:f??void 0})}catch{A.files.push({filePath:d,importance:0})}g.diff.length<3e4?p=g.diff:p=g.files.map(d=>`- ${d}`).join(`
|
|
1948
1948
|
`).trim().slice(0,3e4),p&&A.systemReminders.push({text:`
|
|
1949
1949
|
Since last time, some files were changed by the user or tools (formatting for example):
|
|
1950
1950
|
<modified-files-context>
|
|
@@ -1957,8 +1957,8 @@ ${p}
|
|
|
1957
1957
|
${l}`):r.push(l))}catch(a){this.#e.Sentry?.captureException(a,{tags:{operation:"codegen-git",folderName:i.folderName}})}}if(e.length===0)return{files:[],diff:""};let n="";if(!this.#N()&&r.length>0)if(this.#p.length>1)n=`Notice: This is a multi-repo workspace with folders: ${this.#p.map(o=>o.folderName).join(", ")}. File paths are prefixed with their folder names when using Read/Write/Edit tools.
|
|
1958
1958
|
`;else{let i=this.gitEnabledFolder;i&&(n=`Notice that all the relative paths, are inside "${i.name}/", remember that when using Read/Write/Edit tools:
|
|
1959
1959
|
`)}return{files:e,diff:rm(`${n}${r.join(`
|
|
1960
|
-
`)}`,1e4)}}catch(e){this.#e.Sentry?.captureException(e,{tags:{operation:"codegen-git"}});return}}#hr(){return["status","--porcelain=v1","-z","--ignore-submodules=dirty"]}async#At(e){try{let r=this.#hr();return(await this.git(r,{cwd:e})).trim().length===0}catch{return!1}}async#Cr(e){try{return await this.git(["diff","--cached","--quiet"],{cwd:e}),!1}catch{return!0}}async#Ir(e,r){let n=r.applyResults,i=[];for(let o of n)try{if(o.action==="delete"){let s=await this.deleteFile(o.filePath);s&&i.push(s)}else if(o.content){let s=await this.writeFile(o.filePath,o.content);s&&(this.#Lt.add(s),i.push(s))}}catch(s){e.Sentry?.captureException(s)}return i}#N(){return this.#I?.folders?.length===1||!this.#I?.folders?.length}resolveWorkspacePath(e,r){if(typeof e!="string")throw new TypeError(`resolveWorkspacePath: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);return Kge({filePath:e,forceWorkspace:r,workspace:this.#I,workingDirectory:this.#C,sys:this.#e,canCollapseWorkspace:this.#N()})}#z(){try{let e=this.getSessionContext();return oc(e.turns)?.user.principals}catch{return}}absolutePathToWorkspaceUrl(e){return Hge({absolutePath:e,workspace:this.#I,workingDirectory:this.#C,sys:this.#e,canCollapseWorkspace:this.#N()})}async launchEditor(e={}){let r,n,i;return e.filePath?(r=this.resolveWorkspacePath(e.filePath,!1).resolvedPath,n=e.line??void 0,i=e.column??void 0):r=this.primaryGitPath,await this.#e.exists(r)?await this.#e.launchEditor({filePath:r,line:n,column:i}):{success:!1,message:`File not found: ${r}`}}async readFile(e,r){if(typeof e!="string")throw new TypeError(`readFile: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);if(!r){let n=Ua(e,"read",this.#u?.accessControl,this.#z());if(!n.allowed)throw new $t(`ACL denied: ${n.message}`)}try{if(e==="AGENTS.md"&&this.#I?.agentsMD)return this.#I.agentsMD;let{resolvedPath:n}=this.resolveWorkspacePath(e,!!r),i=await this.#e.readFile(n);return i!==null?i:({resolvedPath:n}=this.resolveWorkspacePath(e,!0),await this.#e.readFile(n))}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async readFileWithChecksum(e){let r=await this.readFile(e.filePath,e.skipAclCheck);if(r===null)return{content:null,checksum:null};let n=(0,oJ.createHash)("md5").update(r).digest("hex");return e.previousChecksum&&n===e.previousChecksum?{content:null,checksum:n,notModified:!0}:{content:r,checksum:n}}async readBinaryFile(e){let r=Ua(e,"read",this.#u?.accessControl,this.#z());if(!r.allowed)throw new $t(`ACL denied: ${r.message}`);try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!1),i=await this.#e.readBinaryFile(n);if(i===null&&({resolvedPath:n}=this.resolveWorkspacePath(e,!0),i=await this.#e.readBinaryFile(n)),i)return Buffer.from(i).toString("base64")}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async#ct(e){let r;e?r=this.#p.find(o=>o.path===e)?.branchName:r=this.gitEnabledFolder?.branchName;let n=r?r.startsWith("origin/")?r:`origin/${r}`:await this.getDefaultBranch(e);if(!n)throw new Error("Could not find parent branch");return n}async#Er(e){let r=this.#we.get(e);if(r&&Date.now()-r.timestamp<t.#wt)return r.promise;let n=(async()=>{let i=await this.#ct(e);try{return(await this.git(["merge-base",i,"HEAD"],{cwd:e})).trim()}catch{return i}})().catch(i=>{throw this.#we.get(e)?.promise===n&&this.#we.delete(e),i});return this.#we.set(e,{promise:n,timestamp:Date.now()}),n}async getFileAtRef(e,r,n){if(!this.#m)return null;try{let i,o;if(n)i=n,e.startsWith(i)?(o=e.substring(i.length),o.startsWith("/")&&(o=o.substring(1))):o=e;else{let{resolvedPath:u,workspaceFolder:l}=this.resolveWorkspacePath(e,!0);i=l?.path||this.#C,o=e,i&&u.startsWith(i)&&(o=u.substring(i.length),o.startsWith("/")&&(o=o.substring(1)))}let s=r??await this.#Er(i),a=`${i}:${s}:${o}`,A=this.#be.get(a);if(A&&Date.now()-A.timestamp<t.#wt)return A.promise;let c=this.git(["show",`${s}:${o}`],{cwd:i}).catch(u=>{let l=u instanceof Error?u.message:String(u);return l.includes("does not exist")||l.includes("exists on disk")||this.#be.get(a)?.promise===c&&this.#be.delete(a),null});return this.#be.set(a,{promise:c,timestamp:Date.now()}),c}catch{return null}}async getSingleFileDiff(e){if(e===null||typeof e!="string"&&typeof e!="object")throw new TypeError(`getSingleFileDiff: 'args' must be a string or object, received ${e===null?"null":typeof e}: ${na(e)}`);let r=typeof e=="string"?{path:e}:e;if(typeof r.path!="string")throw new TypeError(`getSingleFileDiff: 'path' must be a string, received ${typeof r.path}: ${na(r.path)}`);let n=typeof e=="object"?e.previousChecksum:void 0,{repoPath:i,relativePath:o}=this.#bt(r.path,r.folderName),s=this.#e.join(i,o),[a,A]=await Promise.all([this.#e.readFile(s).catch(()=>null),this.getFileAtRef(o,void 0,i)]),c=A===null?"":`${A}`,u=a===null?"":`${a}`,l=(0,oJ.createHash)("md5").update(`${c}\0${u}`).digest("hex"),p=A===null&&a!==null?"create":A!==null&&a===null?"delete":"update";return n===l?{oldContent:null,newContent:null,action:p,checksum:l,notModified:!0}:{oldContent:A,newContent:a,action:p,checksum:l}}async discardFileChanges(e){let r=typeof e=="string"?{filePath:e}:e;if(!this.#m)return{success:!1,error:"Git not configured"};try{let{repoPath:n,relativePath:i}=this.#bt(r.filePath,r.folderName),o=this.#e.join(n,i),s=await this.#ct(n),a;try{a=(await this.git(["merge-base",s,"HEAD"],{cwd:n})).trim()}catch{a=s}let A=await this.getFileAtRef(i,a,n),u=(await this.git(["--no-pager","diff",`${a}`,"HEAD","--",i],{cwd:n})).trim().length>0,p=(await this.git(["status","--porcelain","--",i],{cwd:n})).trim().length>0;if(!u&&!p)return{success:!0};if(A===null){try{await this.#e.exists(o)&&await this.#e.unlink(o)}catch{}let f=this.#e.dirname(i);if(f&&f!==".")try{await this.git(["clean","-fd",f],{cwd:n})}catch{}}else try{await this.git(["restore",`--source=${a}`,"--",i],{cwd:n})}catch(f){return{success:!1,error:`Failed to restore file: ${f}`}}await this.git(["add","--",i],{cwd:n});let g=`Discard changes to ${i}`;await this.git(["commit","--no-gpg-sign","-m",g],{cwd:n});let d=(await this.git(["rev-parse","HEAD"],{cwd:n})).trim();try{await this.#S()}catch(f){this.#e.Sentry?.captureException(f,{tags:{operation:"discard-file-changes",step:"emit-git-status"}})}return{success:!0,commitHash:d}}catch(n){try{await this.#S()}catch(i){this.#e.Sentry?.captureException(i,{tags:{operation:"discard-file-changes",step:"emit-git-status"}})}return{success:!1,error:n instanceof Error?n.message:String(n)}}}async revertDiscard(e){let{commitHash:r,folderName:n}=e;if(!this.#m)return{success:!1,error:"Git not configured"};try{let i=this.#ve(n);await this.git(["revert","--no-edit",r],{cwd:i});try{await this.#S()}catch(o){this.#e.Sentry?.captureException(o,{tags:{operation:"revert-discard",step:"emit-git-status"}})}return{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async fileExists(e){if(typeof e!="string")throw new TypeError(`fileExists: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);let r=n=>n.startsWith(this.#C)?this.#e.relative(this.#C,n):n;try{if(e==="AGENTS.md"&&this.#I?.agentsMD)return{absolutePath:e,recommendedPath:void 0,workspaceFolder:void 0,virtual:!0};let{resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!1);return await this.#e.exists(n)?{absolutePath:n,recommendedPath:void 0,workspaceFolder:i,virtual:!1}:i?{absolutePath:void 0,recommendedPath:void 0,workspaceFolder:i,virtual:!1}:({resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!0),await this.#e.exists(n)?{absolutePath:n,recommendedPath:r(n),workspaceFolder:i,virtual:!1}:{absolutePath:void 0,recommendedPath:r(n),workspaceFolder:i,virtual:!1})}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return{absolutePath:void 0,recommendedPath:void 0,workspaceFolder:void 0,virtual:!1}}readFileSync(e,r){if(!r){let n=Ua(e,"read",this.#u?.accessControl,this.#z());if(!n.allowed)throw new $t(`ACL denied: ${n.message}`)}try{if(e==="AGENTS.md"&&this.#I?.agentsMD)return this.#I.agentsMD;let{resolvedPath:n}=this.resolveWorkspacePath(e,!1);if(this.#e.existsSync(n))return this.#e.readFileSync(n);if({resolvedPath:n}=this.resolveWorkspacePath(e,!0),this.#e.existsSync(n))return this.#e.readFileSync(n)}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async writeFile(e,r,n){if(typeof e!="string")throw new TypeError(`writeFile: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);if(!n){let i=Ua(e,"write",this.#u?.accessControl,this.#z());if(!i.allowed)throw new $t(`ACL denied: ${i.message}`)}try{let{resolvedPath:i}=this.resolveWorkspacePath(e,!!n);return await this.#e.writeFile(i,r),i}catch(i){return this.#e.Sentry?.captureException(i,{extra:{filePath:e}}),null}}async listDir(e){if(typeof e!="string")throw new TypeError(`listDir: 'dirPath' must be a string, received ${typeof e}: ${na(e)}`);let r=Ua(e,"list",this.#u?.accessControl,this.#z());if(!r.allowed)throw new $t(`ACL denied: ${r.message}`);try{let{resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!1);if(!$ge({resolvedPath:n,workingDirectory:this.#C,workspace:this.#I,sys:this.#e}))throw new $t("Access denied: path outside working directory");if(!await this.#e.exists(n))return[];let A=(await(0,fye.readdir)(n,{withFileTypes:!0})).map(c=>c.name+(c.isDirectory()?"/":""));if(this.#N()){let c=A.map(u=>us(this.#e.join(e,u)));return nm({files:c,policy:this.#u?.accessControl,getDotFiles:!0})}if(i&&this.#I?.folders){let c=i.name||i.path,u=e;e.startsWith(c+"/")?u=e.substring(c.length+1):e===c&&(u="");let l=A.map(p=>{let g=u?this.#e.join(u,p):p,d=us(g);return`${c}/${d}`});return nm({files:l,policy:this.#u?.accessControl,getDotFiles:!0})}return nm({files:A,policy:this.#u?.accessControl,getDotFiles:!0})}catch(n){return this.#e.Sentry?.captureException(n,{extra:{dirPath:e}}),[]}}async listCustomInstructions(){return(await this.#Se()).filter(r=>!r.hideUI).map(r=>({id:r.id,name:r.name,description:r.description,type:r.type,isSkill:r.isSkill??r.filePath?.toLowerCase().includes("/skills/")??!1,disableModelInvocation:r.disableModelInvocation,userInvocable:r.userInvocable}))}async stat(e,r){if(typeof e!="string")throw new TypeError(`stat: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);if(!r){let n=Ua(e,"read",this.#u?.accessControl,this.#z());if(!n.allowed)throw new $t(`ACL denied: ${n.message}`)}try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!1);if(await this.#e.exists(n))return await this.#e.stat(n)}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async deleteFile(e,r){if(typeof e!="string")throw new TypeError(`deleteFile: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);if(!r){let n=Ua(e,"write",this.#u?.accessControl,this.#z());if(!n.allowed)throw new $t(`ACL denied: ${n.message}`)}try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!!r);return await this.#e.exists(n)?(await this.#e.unlink(n),n):null}catch(n){return this.#e.Sentry?.captureException(n,{extra:{filePath:e}}),null}}getLinesStats(){let e=this.#r?.turns.reduce((r,n)=>{let i=n.applyResults.reduce((o,s)=>({added:o.added+s.addedLines,removed:o.removed+s.removedLines}),{added:0,removed:0});return{added:r.added+i.added,removed:r.removed+i.removed}},{added:0,removed:0})??{added:0,removed:0};return{...e,net:e.added-e.removed}}async getDiffFromRemote({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i}){if(!this.#m)return[];let o=this.#ve(i);try{let s=(await this.git(["branch","--show-current"],{cwd:o})).trim();if(!s)throw new Error("Could not determine current branch");let a=!1;try{a=(await this.git(["remote"],{cwd:o})).includes("origin")}catch(p){throw this.#n.warn("No git remotes configured, cannot get diff from remote"),p}if(!a){this.#n.warn("Origin remote not found, trying to get diff from main branch");try{return await this.getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i})}catch(p){throw this.#n.warn("Failed to get diff from main branch:",p),p}}let A=!1,c;try{let p=`origin/${s}`;if(A=(await this.git(["ls-remote","--heads","origin",s],{cwd:o})).trim().length>0,A)c=p;else return await this.getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i})}catch(p){throw this.#n.warn("Failed to check remote branches:",p),p}let u=["diff",c];r?u.push("--raw","--numstat","--no-renames"):e!==void 0&&u.push(`-U${e}`),u.push("--"),n&&n.length>0&&u.push(...n);let l=await this.git(u,{cwd:o});return!l||l.trim()===""?[]:q$(l,r)}catch(s){throw s instanceof td||this.#n.error("getDiffFromRemote error:",s),s}}async getDiff({mode:e="remote-parent-branch",numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:o}){if(!this.#m)return{state:"error",error:new Error("Git not configured")};try{switch(e){case"remote-parent-branch":return{state:"success",diff:await this.getDiffFromParentBranch({numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:o})};case"remote-current-branch":return{state:"success",diff:await this.getDiffFromRemote({numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:o})};default:throw new Error(`Unknown diff mode: ${e}`)}}catch(s){return s instanceof td?{state:"error",error:s}:(this.#n.error(`getDiff error for mode '${e}':`,s),this.#e.Sentry?.captureException(s),{state:"error",error:s instanceof Error?s:new Error(String(s))})}}async getDefaultBranch(e){let r=e??"__primary__",n=this.#Oe.get(r);if(n)return n;let i=this.#Br(e).catch(o=>{throw this.#Oe.get(r)===i&&this.#Oe.delete(r),o});return this.#Oe.set(r,i),i}async#Br(e){try{let n=(await this.git(["remote","show","origin"],{cwd:e})).match(/HEAD branch: (.+)/);if(n)return`origin/${n[1].trim()}`}catch{}try{if((await this.git(["ls-remote","--heads","origin","main"],{cwd:e})).trim().length>0)return"origin/main"}catch{}try{if((await this.git(["ls-remote","--heads","origin","master"],{cwd:e})).trim().length>0)return"origin/master"}catch{}try{let n=(await this.git(["ls-remote","--heads","origin"],{cwd:e})).trim().split(`
|
|
1961
|
-
`).map(i=>i.split(" ")[1]).filter(i=>i&&!i.includes("HEAD"));if(n.length>0)return`origin/${n[0].replace("refs/heads/","")}`}catch{}throw new Error("Could not determine default branch. No remote branches found.")}async getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i}){let o=this.#ve(i);try{if(!(await this.git(["branch","--show-current"],{cwd:o})).trim())throw new Error("Could not determine current branch");let a=await this.#ct(o),A;try{A=(await this.git(["merge-base",a,"HEAD"],{cwd:o})).trim()}catch(l){throw l instanceof oa&&l.code===128?new td(a,{cause:l}):l}let c=["--no-pager","diff",A];r?c.push("--raw","--numstat","--no-renames"):e!==void 0&&c.push(`-U${e}`),c.push("--"),n&&n.length>0&&c.push(...n);let u=await this.git(c,{cwd:o});return!u||u.trim()===""?[]:q$(u,r)}catch(s){throw s instanceof td||this.#
|
|
1960
|
+
`)}`,1e4)}}catch(e){this.#e.Sentry?.captureException(e,{tags:{operation:"codegen-git"}});return}}#hr(){return["status","--porcelain=v1","-z","--ignore-submodules=dirty"]}async#At(e){try{let r=this.#hr();return(await this.git(r,{cwd:e})).trim().length===0}catch{return!1}}async#Cr(e){try{return await this.git(["diff","--cached","--quiet"],{cwd:e}),!1}catch{return!0}}async#Ir(e,r){let n=r.applyResults,i=[];for(let o of n)try{if(o.action==="delete"){let s=await this.deleteFile(o.filePath);s&&i.push(s)}else if(o.content){let s=await this.writeFile(o.filePath,o.content);s&&(this.#Lt.add(s),i.push(s))}}catch(s){e.Sentry?.captureException(s)}return i}#N(){return this.#E?.folders?.length===1||!this.#E?.folders?.length}resolveWorkspacePath(e,r){if(typeof e!="string")throw new TypeError(`resolveWorkspacePath: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);return Kge({filePath:e,forceWorkspace:r,workspace:this.#E,workingDirectory:this.#I,sys:this.#e,canCollapseWorkspace:this.#N()})}#z(){try{let e=this.getSessionContext();return oc(e.turns)?.user.principals}catch{return}}absolutePathToWorkspaceUrl(e){return Hge({absolutePath:e,workspace:this.#E,workingDirectory:this.#I,sys:this.#e,canCollapseWorkspace:this.#N()})}async launchEditor(e={}){let r,n,i;return e.filePath?(r=this.resolveWorkspacePath(e.filePath,!1).resolvedPath,n=e.line??void 0,i=e.column??void 0):r=this.primaryGitPath,await this.#e.exists(r)?await this.#e.launchEditor({filePath:r,line:n,column:i}):{success:!1,message:`File not found: ${r}`}}async readFile(e,r){if(typeof e!="string")throw new TypeError(`readFile: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);if(!r){let n=Ua(e,"read",this.#u?.accessControl,this.#z());if(!n.allowed)throw new $t(`ACL denied: ${n.message}`)}try{if(e==="AGENTS.md"&&this.#E?.agentsMD)return this.#E.agentsMD;let{resolvedPath:n}=this.resolveWorkspacePath(e,!!r),i=await this.#e.readFile(n);return i!==null?i:({resolvedPath:n}=this.resolveWorkspacePath(e,!0),await this.#e.readFile(n))}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async readFileWithChecksum(e){let r=await this.readFile(e.filePath,e.skipAclCheck);if(r===null)return{content:null,checksum:null};let n=(0,oJ.createHash)("md5").update(r).digest("hex");return e.previousChecksum&&n===e.previousChecksum?{content:null,checksum:n,notModified:!0}:{content:r,checksum:n}}async readBinaryFile(e){let r=Ua(e,"read",this.#u?.accessControl,this.#z());if(!r.allowed)throw new $t(`ACL denied: ${r.message}`);try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!1),i=await this.#e.readBinaryFile(n);if(i===null&&({resolvedPath:n}=this.resolveWorkspacePath(e,!0),i=await this.#e.readBinaryFile(n)),i)return Buffer.from(i).toString("base64")}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async#ct(e){let r;e?r=this.#p.find(o=>o.path===e)?.branchName:r=this.gitEnabledFolder?.branchName;let n=r?r.startsWith("origin/")?r:`origin/${r}`:await this.getDefaultBranch(e);if(!n)throw new Error("Could not find parent branch");return n}async#Er(e){let r=this.#we.get(e);if(r&&Date.now()-r.timestamp<t.#wt)return r.promise;let n=(async()=>{let i=await this.#ct(e);try{return(await this.git(["merge-base",i,"HEAD"],{cwd:e})).trim()}catch{return i}})().catch(i=>{throw this.#we.get(e)?.promise===n&&this.#we.delete(e),i});return this.#we.set(e,{promise:n,timestamp:Date.now()}),n}async getFileAtRef(e,r,n){if(!this.#m)return null;try{let i,o;if(n)i=n,e.startsWith(i)?(o=e.substring(i.length),o.startsWith("/")&&(o=o.substring(1))):o=e;else{let{resolvedPath:u,workspaceFolder:l}=this.resolveWorkspacePath(e,!0);i=l?.path||this.#I,o=e,i&&u.startsWith(i)&&(o=u.substring(i.length),o.startsWith("/")&&(o=o.substring(1)))}let s=r??await this.#Er(i),a=`${i}:${s}:${o}`,A=this.#be.get(a);if(A&&Date.now()-A.timestamp<t.#wt)return A.promise;let c=this.git(["show",`${s}:${o}`],{cwd:i}).catch(u=>{let l=u instanceof Error?u.message:String(u);return l.includes("does not exist")||l.includes("exists on disk")||this.#be.get(a)?.promise===c&&this.#be.delete(a),null});return this.#be.set(a,{promise:c,timestamp:Date.now()}),c}catch{return null}}async getSingleFileDiff(e){if(e===null||typeof e!="string"&&typeof e!="object")throw new TypeError(`getSingleFileDiff: 'args' must be a string or object, received ${e===null?"null":typeof e}: ${na(e)}`);let r=typeof e=="string"?{path:e}:e;if(typeof r.path!="string")throw new TypeError(`getSingleFileDiff: 'path' must be a string, received ${typeof r.path}: ${na(r.path)}`);let n=typeof e=="object"?e.previousChecksum:void 0,{repoPath:i,relativePath:o}=this.#bt(r.path,r.folderName),s=this.#e.join(i,o),[a,A]=await Promise.all([this.#e.readFile(s).catch(()=>null),this.getFileAtRef(o,void 0,i)]),c=A===null?"":`${A}`,u=a===null?"":`${a}`,l=(0,oJ.createHash)("md5").update(`${c}\0${u}`).digest("hex"),p=A===null&&a!==null?"create":A!==null&&a===null?"delete":"update";return n===l?{oldContent:null,newContent:null,action:p,checksum:l,notModified:!0}:{oldContent:A,newContent:a,action:p,checksum:l}}async discardFileChanges(e){let r=typeof e=="string"?{filePath:e}:e;if(!this.#m)return{success:!1,error:"Git not configured"};try{let{repoPath:n,relativePath:i}=this.#bt(r.filePath,r.folderName),o=this.#e.join(n,i),s=await this.#ct(n),a;try{a=(await this.git(["merge-base",s,"HEAD"],{cwd:n})).trim()}catch{a=s}let A=await this.getFileAtRef(i,a,n),u=(await this.git(["--no-pager","diff",`${a}`,"HEAD","--",i],{cwd:n})).trim().length>0,p=(await this.git(["status","--porcelain","--",i],{cwd:n})).trim().length>0;if(!u&&!p)return{success:!0};if(A===null){try{await this.#e.exists(o)&&await this.#e.unlink(o)}catch{}let f=this.#e.dirname(i);if(f&&f!==".")try{await this.git(["clean","-fd",f],{cwd:n})}catch{}}else try{await this.git(["restore",`--source=${a}`,"--",i],{cwd:n})}catch(f){return{success:!1,error:`Failed to restore file: ${f}`}}await this.git(["add","--",i],{cwd:n});let g=`Discard changes to ${i}`;await this.git(["commit","--no-gpg-sign","-m",g],{cwd:n});let d=(await this.git(["rev-parse","HEAD"],{cwd:n})).trim();try{await this.#S()}catch(f){this.#e.Sentry?.captureException(f,{tags:{operation:"discard-file-changes",step:"emit-git-status"}})}return{success:!0,commitHash:d}}catch(n){try{await this.#S()}catch(i){this.#e.Sentry?.captureException(i,{tags:{operation:"discard-file-changes",step:"emit-git-status"}})}return{success:!1,error:n instanceof Error?n.message:String(n)}}}async revertDiscard(e){let{commitHash:r,folderName:n}=e;if(!this.#m)return{success:!1,error:"Git not configured"};try{let i=this.#ve(n);await this.git(["revert","--no-edit",r],{cwd:i});try{await this.#S()}catch(o){this.#e.Sentry?.captureException(o,{tags:{operation:"revert-discard",step:"emit-git-status"}})}return{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async fileExists(e){if(typeof e!="string")throw new TypeError(`fileExists: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);let r=n=>n.startsWith(this.#I)?this.#e.relative(this.#I,n):n;try{if(e==="AGENTS.md"&&this.#E?.agentsMD)return{absolutePath:e,recommendedPath:void 0,workspaceFolder:void 0,virtual:!0};let{resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!1);return await this.#e.exists(n)?{absolutePath:n,recommendedPath:void 0,workspaceFolder:i,virtual:!1}:i?{absolutePath:void 0,recommendedPath:void 0,workspaceFolder:i,virtual:!1}:({resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!0),await this.#e.exists(n)?{absolutePath:n,recommendedPath:r(n),workspaceFolder:i,virtual:!1}:{absolutePath:void 0,recommendedPath:r(n),workspaceFolder:i,virtual:!1})}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return{absolutePath:void 0,recommendedPath:void 0,workspaceFolder:void 0,virtual:!1}}readFileSync(e,r){if(!r){let n=Ua(e,"read",this.#u?.accessControl,this.#z());if(!n.allowed)throw new $t(`ACL denied: ${n.message}`)}try{if(e==="AGENTS.md"&&this.#E?.agentsMD)return this.#E.agentsMD;let{resolvedPath:n}=this.resolveWorkspacePath(e,!1);if(this.#e.existsSync(n))return this.#e.readFileSync(n);if({resolvedPath:n}=this.resolveWorkspacePath(e,!0),this.#e.existsSync(n))return this.#e.readFileSync(n)}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async writeFile(e,r,n){if(typeof e!="string")throw new TypeError(`writeFile: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);if(!n){let i=Ua(e,"write",this.#u?.accessControl,this.#z());if(!i.allowed)throw new $t(`ACL denied: ${i.message}`)}try{let{resolvedPath:i}=this.resolveWorkspacePath(e,!!n);return await this.#e.writeFile(i,r),i}catch(i){return this.#e.Sentry?.captureException(i,{extra:{filePath:e}}),null}}async listDir(e){if(typeof e!="string")throw new TypeError(`listDir: 'dirPath' must be a string, received ${typeof e}: ${na(e)}`);let r=Ua(e,"list",this.#u?.accessControl,this.#z());if(!r.allowed)throw new $t(`ACL denied: ${r.message}`);try{let{resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!1);if(!$ge({resolvedPath:n,workingDirectory:this.#I,workspace:this.#E,sys:this.#e}))throw new $t("Access denied: path outside working directory");if(!await this.#e.exists(n))return[];let A=(await(0,fye.readdir)(n,{withFileTypes:!0})).map(c=>c.name+(c.isDirectory()?"/":""));if(this.#N()){let c=A.map(u=>us(this.#e.join(e,u)));return nm({files:c,policy:this.#u?.accessControl,getDotFiles:!0})}if(i&&this.#E?.folders){let c=i.name||i.path,u=e;e.startsWith(c+"/")?u=e.substring(c.length+1):e===c&&(u="");let l=A.map(p=>{let g=u?this.#e.join(u,p):p,d=us(g);return`${c}/${d}`});return nm({files:l,policy:this.#u?.accessControl,getDotFiles:!0})}return nm({files:A,policy:this.#u?.accessControl,getDotFiles:!0})}catch(n){return this.#e.Sentry?.captureException(n,{extra:{dirPath:e}}),[]}}async listCustomInstructions(){return(await this.#Se()).filter(r=>!r.hideUI).map(r=>({id:r.id,name:r.name,description:r.description,type:r.type,isSkill:r.isSkill??r.filePath?.toLowerCase().includes("/skills/")??!1,disableModelInvocation:r.disableModelInvocation,userInvocable:r.userInvocable}))}async stat(e,r){if(typeof e!="string")throw new TypeError(`stat: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);if(!r){let n=Ua(e,"read",this.#u?.accessControl,this.#z());if(!n.allowed)throw new $t(`ACL denied: ${n.message}`)}try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!1);if(await this.#e.exists(n))return await this.#e.stat(n)}catch(n){this.#e.Sentry?.captureException(n,{extra:{filePath:e}})}return null}async deleteFile(e,r){if(typeof e!="string")throw new TypeError(`deleteFile: 'filePath' must be a string, received ${typeof e}: ${na(e)}`);if(!r){let n=Ua(e,"write",this.#u?.accessControl,this.#z());if(!n.allowed)throw new $t(`ACL denied: ${n.message}`)}try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!!r);return await this.#e.exists(n)?(await this.#e.unlink(n),n):null}catch(n){return this.#e.Sentry?.captureException(n,{extra:{filePath:e}}),null}}getLinesStats(){let e=this.#n?.turns.reduce((r,n)=>{let i=n.applyResults.reduce((o,s)=>({added:o.added+s.addedLines,removed:o.removed+s.removedLines}),{added:0,removed:0});return{added:r.added+i.added,removed:r.removed+i.removed}},{added:0,removed:0})??{added:0,removed:0};return{...e,net:e.added-e.removed}}async getDiffFromRemote({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i}){if(!this.#m)return[];let o=this.#ve(i);try{let s=(await this.git(["branch","--show-current"],{cwd:o})).trim();if(!s)throw new Error("Could not determine current branch");let a=!1;try{a=(await this.git(["remote"],{cwd:o})).includes("origin")}catch(p){throw this.#r.warn("No git remotes configured, cannot get diff from remote"),p}if(!a){this.#r.warn("Origin remote not found, trying to get diff from main branch");try{return await this.getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i})}catch(p){throw this.#r.warn("Failed to get diff from main branch:",p),p}}let A=!1,c;try{let p=`origin/${s}`;if(A=(await this.git(["ls-remote","--heads","origin",s],{cwd:o})).trim().length>0,A)c=p;else return await this.getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i})}catch(p){throw this.#r.warn("Failed to check remote branches:",p),p}let u=["diff",c];r?u.push("--raw","--numstat","--no-renames"):e!==void 0&&u.push(`-U${e}`),u.push("--"),n&&n.length>0&&u.push(...n);let l=await this.git(u,{cwd:o});return!l||l.trim()===""?[]:q$(l,r)}catch(s){throw s instanceof td||this.#r.error("getDiffFromRemote error:",s),s}}async getDiff({mode:e="remote-parent-branch",numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:o}){if(!this.#m)return{state:"error",error:new Error("Git not configured")};try{switch(e){case"remote-parent-branch":return{state:"success",diff:await this.getDiffFromParentBranch({numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:o})};case"remote-current-branch":return{state:"success",diff:await this.getDiffFromRemote({numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:o})};default:throw new Error(`Unknown diff mode: ${e}`)}}catch(s){return s instanceof td?{state:"error",error:s}:(this.#r.error(`getDiff error for mode '${e}':`,s),this.#e.Sentry?.captureException(s),{state:"error",error:s instanceof Error?s:new Error(String(s))})}}async getDefaultBranch(e){let r=e??"__primary__",n=this.#Oe.get(r);if(n)return n;let i=this.#Br(e).catch(o=>{throw this.#Oe.get(r)===i&&this.#Oe.delete(r),o});return this.#Oe.set(r,i),i}async#Br(e){try{let n=(await this.git(["remote","show","origin"],{cwd:e})).match(/HEAD branch: (.+)/);if(n)return`origin/${n[1].trim()}`}catch{}try{if((await this.git(["ls-remote","--heads","origin","main"],{cwd:e})).trim().length>0)return"origin/main"}catch{}try{if((await this.git(["ls-remote","--heads","origin","master"],{cwd:e})).trim().length>0)return"origin/master"}catch{}try{let n=(await this.git(["ls-remote","--heads","origin"],{cwd:e})).trim().split(`
|
|
1961
|
+
`).map(i=>i.split(" ")[1]).filter(i=>i&&!i.includes("HEAD"));if(n.length>0)return`origin/${n[0].replace("refs/heads/","")}`}catch{}throw new Error("Could not determine default branch. No remote branches found.")}async getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i}){let o=this.#ve(i);try{if(!(await this.git(["branch","--show-current"],{cwd:o})).trim())throw new Error("Could not determine current branch");let a=await this.#ct(o),A;try{A=(await this.git(["merge-base",a,"HEAD"],{cwd:o})).trim()}catch(l){throw l instanceof oa&&l.code===128?new td(a,{cause:l}):l}let c=["--no-pager","diff",A];r?c.push("--raw","--numstat","--no-renames"):e!==void 0&&c.push(`-U${e}`),c.push("--"),n&&n.length>0&&c.push(...n);let u=await this.git(c,{cwd:o});return!u||u.trim()===""?[]:q$(u,r)}catch(s){throw s instanceof td||this.#r.error("getDiffFromParentBranch error:",s),s}}},mF=(t,e)=>e.filter(r=>!t?.disabledTools?.includes(r))});function Uye(t){return t instanceof Error?t.message:String(t)}function iQ(t,e){if(CJ(e).test(t))return!0;if(e.toLowerCase().includes("localhost")){let n=e.replace(/localhost/gi,"127.0.0.1");if(CJ(n).test(t))return!0}else if(e.includes("127.0.0.1")){let n=e.replace(/127\.0\.0\.1/g,"localhost");if(CJ(n).test(t))return!0}return!1}function CJ(t){return t=String(t).replace(/\./g,"\\.").replace(/\?/g,".").replace(/\*/g,".*"),new RegExp(`^${t}$`,"i")}var QF,Oye=N(()=>{"use strict";m();QF=class{logger;currentOrigin=null;currentOriginPattern=null;currentDestination=null;currentOriginHost=null;constructor(e){this.logger=e}getCurrentOrigin(){return this.currentOrigin}getCurrentDestination(){return this.currentDestination}clearMapping(){this.currentOrigin=null,this.currentOriginPattern=null,this.currentDestination=null,this.currentOriginHost=null,this.logger?.info("[UrlMapper] Mapping cleared")}setMapping(e,r){if(e.includes("*")||!e.startsWith("https://")&&!e.startsWith("http://")){this.currentOriginPattern=e,this.currentOriginHost=null,this.currentOrigin=e;try{let i=new URL(r);this.currentDestination=`${i.protocol}//${i.hostname}${i.port?":"+i.port:""}`}catch(i){this.logger?.error(`[UrlMapper] Failed to parse destination URL: ${Uye(i)}`),this.currentDestination=r}this.logger?.info(`[UrlMapper] Set mapping (PATTERN): ${e} \u2192 ${r}`)}else{this.currentOriginPattern=null;try{let i=new URL(e),o=i.protocol==="https:"?"443":"80",s=i.port||o;this.currentOriginHost=`${i.hostname}:${s}`,this.currentOrigin=`${i.protocol}//${i.hostname}${i.port?":"+i.port:""}`;let a=new URL(r);this.currentDestination=`${a.protocol}//${a.hostname}${a.port?":"+a.port:""}`,this.logger?.info(`[UrlMapper] Set mapping (EXACT): ${e} \u2192 ${r}`),this.logger?.debug(`[UrlMapper] Normalized origin: ${this.currentOrigin} (host: ${this.currentOriginHost})`),this.logger?.debug(`[UrlMapper] Normalized destination: ${this.currentDestination}`)}catch(i){this.logger?.error(`[UrlMapper] Failed to parse origin/destination URL: ${Uye(i)}`),this.currentOriginHost=null,this.currentOrigin=e,this.currentDestination=r}}}getUpstream(e){if(!this.currentDestination)return null;if(this.currentOriginPattern){let r=this.currentOriginPattern.replace(/^https?:\/\//g,""),n=r.split(":")[0],i=e.split(":")[0];return iQ(i,n)?(this.logger?.debug(`[UrlMapper] PATTERN MATCH FOUND getUpstream(${e}) matched hostname: ${n} -> ${this.currentDestination}`),this.currentDestination):iQ(e,r)?(this.logger?.debug(`[UrlMapper] PATTERN MATCH FOUND getUpstream(${e}) matched host: ${r} -> ${this.currentDestination}`),this.currentDestination):(this.logger?.debug(`[UrlMapper] NO PATTERN MATCH getUpstream(${e}) !== ${r}`),null)}return this.currentOriginHost?iQ(e,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) -> ${this.currentDestination}`),this.currentDestination):iQ(`${e}:80`,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) (HTTP) -> ${this.currentDestination}`),this.currentDestination):iQ(`${e}:443`,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) (TLS) -> ${this.currentDestination}`),this.currentDestination):(this.logger?.debug(`[UrlMapper] NO MATCH getUpstream(${e}) !== ${this.currentOriginHost}`),null):null}buildUpstreamUrl(e,r="/"){let n=r||"/";n=n.replace(/^\/+/,"/");let i=new URL(n,e),o=new URL(e);return o.pathname=i.pathname.replace(/\/+/g,"/"),o.search=i.search,o.hash=i.hash,o}mapUrl(e){let r=e.host,n=this.getUpstream(r);if(!n)return e;let i=e.pathname+e.search+e.hash;return this.buildUpstreamUrl(n,i)}isOriginHttps(e=443){let r=this.currentOrigin?.split("://")[0];return r==="http"||r==="https"?r==="https":e===443}}});var Gye,hlt,IJ,Kye=N(()=>{"use strict";m();Gye=z(require("node:os"),1);Pt();hlt=ke("Priority"),IJ=(t,e)=>{try{Gye.default.setPriority(t,e)}catch(r){hlt.error(`Failed to set priority to ${e}: ${r}`)}}});function Hye(t){yJ=t}async function Fh(){if(yJ){if(EJ){BJ=!0;return}EJ=!0;try{await yJ()}finally{EJ=!1,BJ&&(BJ=!1,Fh())}}}var yJ,EJ,BJ,QJ=N(()=>{"use strict";m();EJ=!1,BJ=!1});async function*Clt(t){for await(let e of Of(t.body))if(e.length)try{yield JSON.parse(e)}catch{}}function Ilt(t){t.toolContext.session.sendMessage({userPrompt:Hce({originChannelId:t.originChannelId,senderDisplayName:t.senderDisplayName,projectId:t.projectId,branchName:t.branchName,content:t.content}),category:"background-subagent",user:{...t.toolContext.user,role:"agent",source:"builder.io"},queue:!0})}function Elt(t,e){return e??("builderUserId"in t.user?t.user.builderUserId:t.user.source==="builder.io"?t.user.userId:t.credentials.userId)}function $ye(t,e){let{credentials:r}=t,{project_id:n,message:i}=e,o,s=new Promise(g=>o=g),a=!1,A,c,u,l;return(async()=>{let g=new URL("/projects/branch",Oe);g.searchParams.set("apiKey",r.builderPublicKey);let d=Elt(t,e.builder_user_id);d&&g.searchParams.set("userId",d);let f=e.model&&e.model!=="auto"?Bm(e.model):void 0,h=e.attachment_urls?.map(y=>({type:"url",value:y})),C=e.origin_channel_id??t.user.channelId,I={projectId:n,userMessage:{userPrompt:i,user:{...t.user,channelId:C,role:"user"},...e.session_mode&&{sessionMode:e.session_mode},...f&&{modelOverride:f},...h?.length&&{attachments:h}},hidden:e.hidden,actor:"org-agent",metadata:{origin_channel_id:C}},B=await Ue(g,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r.builderPrivateKey}`},body:JSON.stringify(I)},t.debug);if(!B.ok){let y=await B.text();throw new Error(`Failed to spawn branch: ${y}`)}let E;for await(let y of Clt(B))if(y.type==="branch-created")E=y;else if(y.type==="error")E=y;else if(!a&&y.type==="setting-up-container")a=!0,c||(c=y.projectName),u||(u=y.branchFriendlyName??void 0),l||(l=y.branchName),o(y);else{let D=Pce(y);D&&(A=D.plan)}if(!E)throw new Error("Stream ended unexpectedly");return E})().then(g=>{a||o(null);let d=c??g.projectName??n,f=u??l??g.branchName,h=`https://builder.io/app/projects/${n}/${l??g.branchName}`;if(g.type!=="error"){let C=`Branch \`${f}\` in \`${d}\` completed.
|
|
1962
1962
|
- Url: \`${h}\`
|
|
1963
1963
|
|
|
1964
1964
|
==================
|
|
@@ -2799,7 +2799,7 @@ return fn.apply(this, arguments)
|
|
|
2799
2799
|
`)+`\r
|
|
2800
2800
|
\r
|
|
2801
2801
|
`+r)}function Id(t,e,r,n,i,o){if(t.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,Id),t.emit("wsClientError",s,r,e)}else JQ(r,n,i,o)}});var uRe=k((uwr,cRe)=>{m();var CY=class{constructor(e,r,n){this.etaBufferLength=e||100,this.valueBuffer=[n],this.timeBuffer=[r],this.eta="0"}update(e,r,n){this.valueBuffer.push(r),this.timeBuffer.push(e),this.calculate(n-r)}getTime(){return this.eta}calculate(e){let r=this.valueBuffer.length,n=Math.min(this.etaBufferLength,r),i=this.valueBuffer[r-1]-this.valueBuffer[r-n],o=this.timeBuffer[r-1]-this.timeBuffer[r-n],s=i/o;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let a=Math.ceil(e/s/1e3);isNaN(a)?this.eta="NULL":isFinite(a)?a>1e7?this.eta="INF":a<0?this.eta=0:this.eta=a:this.eta="INF"}};cRe.exports=CY});var EY=k((gwr,lRe)=>{m();var Bd=require("readline"),IY=class{constructor(e){this.stream=e,this.linewrap=!0,this.dy=0}cursorSave(){this.stream.isTTY&&this.stream.write("\x1B7")}cursorRestore(){this.stream.isTTY&&this.stream.write("\x1B8")}cursor(e){this.stream.isTTY&&(e?this.stream.write("\x1B[?25h"):this.stream.write("\x1B[?25l"))}cursorTo(e=null,r=null){this.stream.isTTY&&Bd.cursorTo(this.stream,e,r)}cursorRelative(e=null,r=null){this.stream.isTTY&&(this.dy=this.dy+r,Bd.moveCursor(this.stream,e,r))}cursorRelativeReset(){this.stream.isTTY&&(Bd.moveCursor(this.stream,0,-this.dy),Bd.cursorTo(this.stream,0,null),this.dy=0)}clearRight(){this.stream.isTTY&&Bd.clearLine(this.stream,1)}clearLine(){this.stream.isTTY&&Bd.clearLine(this.stream,0)}clearBottom(){this.stream.isTTY&&Bd.clearScreenDown(this.stream)}newline(){this.stream.write(`
|
|
2802
|
-
`),this.dy++}write(e,r=!1){this.linewrap===!0&&r===!1?this.stream.write(e.substr(0,this.getWidth())):this.stream.write(e)}lineWrapping(e){this.stream.isTTY&&(this.linewrap=e,e?this.stream.write("\x1B[?7h"):this.stream.write("\x1B[?7l"))}isTTY(){return this.stream.isTTY===!0}getWidth(){return this.stream.columns||(this.stream.isTTY?80:200)}};lRe.exports=IY});var pRe=k((dwr,BY)=>{"use strict";m();var gRe=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);BY.exports=gRe;BY.exports.default=gRe});var fRe=k((mwr,dRe)=>{"use strict";m();dRe.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var hRe=k((Cwr,yY)=>{"use strict";m();var Hwt=t2(),$wt=pRe(),Jwt=fRe(),mRe=t=>{if(typeof t!="string"||t.length===0||(t=Hwt(t),t.length===0))return 0;t=t.replace(Jwt()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=$wt(n)?2:1)}return e};yY.exports=mRe;yY.exports.default=mRe});var QY=k((Ewr,CRe)=>{m();CRe.exports=function(e,r,n){if(r.autopadding!==!0)return e;function i(o,s){return(r.autopaddingChar+o).slice(-s)}return n==="percentage"?i(e,3):e}});var DY=k((ywr,IRe)=>{m();IRe.exports=function(e,r){let n=Math.round(e*r.barsize),i=r.barsize-n;return r.barCompleteString.substr(0,n)+r.barGlue+r.barIncompleteString.substr(0,i)}});var wY=k((Dwr,ERe)=>{m();ERe.exports=function(e,r,n){function i(s){return n?n*Math.round(s/n):s}function o(s){return(r.autopaddingChar+s).slice(-2)}return e>3600?o(Math.floor(e/3600))+"h"+o(i(e%3600/60))+"m":e>60?o(Math.floor(e/60))+"m"+o(i(e%60))+"s":e>10?o(i(e))+"s":o(e)+"s"}});var bY=k((bwr,BRe)=>{m();var jwt=hRe(),Ywt=QY(),qwt=DY(),Vwt=wY();BRe.exports=function(e,r,n){let i=e.format,o=e.formatTime||Vwt,s=e.formatValue||Ywt,a=e.formatBar||qwt,A=Math.floor(r.progress*100)+"",c=r.stopTime||Date.now(),u=Math.round((c-r.startTime)/1e3),l=Object.assign({},n,{bar:a(r.progress,e),percentage:s(A,e,"percentage"),total:s(r.total,e,"total"),value:s(r.value,e,"value"),eta:s(r.eta,e,"eta"),eta_formatted:o(r.eta,e,5),duration:s(u,e,"duration"),duration_formatted:o(u,e,1)});i=i.replace(/\{(\w+)\}/g,function(d,f){return typeof l[f]<"u"?l[f]:d});let p=Math.max(0,r.maxWidth-jwt(i)-2),g=Math.floor(p/2);switch(e.align){case"right":i=p>0?" ".repeat(p)+i:i;break;case"center":i=g>0?" ".repeat(g)+i:i;break;default:break}return i}});var gR=k((Swr,yRe)=>{m();function Mr(t,e){return typeof t>"u"||t===null?e:t}yRe.exports={parse:function(e,r){let n={},i=Object.assign({},r,e);return n.throttleTime=1e3/Mr(i.fps,10),n.stream=Mr(i.stream,process.stderr),n.terminal=Mr(i.terminal,null),n.clearOnComplete=Mr(i.clearOnComplete,!1),n.stopOnComplete=Mr(i.stopOnComplete,!1),n.barsize=Mr(i.barsize,40),n.align=Mr(i.align,"left"),n.hideCursor=Mr(i.hideCursor,!1),n.linewrap=Mr(i.linewrap,!1),n.barGlue=Mr(i.barGlue,""),n.barCompleteChar=Mr(i.barCompleteChar,"="),n.barIncompleteChar=Mr(i.barIncompleteChar,"-"),n.format=Mr(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=Mr(i.formatTime,null),n.formatValue=Mr(i.formatValue,null),n.formatBar=Mr(i.formatBar,null),n.etaBufferLength=Mr(i.etaBuffer,10),n.etaAsynchronousUpdate=Mr(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=Mr(i.progressCalculationRelative,!1),n.synchronousUpdate=Mr(i.synchronousUpdate,!0),n.noTTYOutput=Mr(i.noTTYOutput,!1),n.notTTYSchedule=Mr(i.notTTYSchedule,2e3),n.emptyOnZero=Mr(i.emptyOnZero,!1),n.forceRedraw=Mr(i.forceRedraw,!1),n.autopadding=Mr(i.autopadding,!1),n.gracefulExit=Mr(i.gracefulExit,!1),n},assignDerivedOptions:function(e){return e.barCompleteString=e.barCompleteChar.repeat(e.barsize+1),e.barIncompleteString=e.barIncompleteChar.repeat(e.barsize+1),e.autopaddingChar=e.autopadding?Mr(e.autopaddingChar," "):"",e}}});var vY=k((kwr,DRe)=>{m();var QRe=uRe(),zwt=EY(),Wwt=bY(),Zwt=gR(),Xwt=require("events");DRe.exports=class extends Xwt{constructor(e){super(),this.options=Zwt.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new zwt(this.options.stream),this.value=0,this.startValue=0,this.total=100,this.lastDrawnString=null,this.startTime=null,this.stopTime=null,this.lastRedraw=Date.now(),this.eta=new QRe(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:Wwt}render(e=!1){let r={progress:this.getProgress(),eta:this.eta.getTime(),startTime:this.startTime,stopTime:this.stopTime,total:this.total,value:this.value,maxWidth:this.terminal.getWidth()};this.options.etaAsynchronousUpdate&&this.updateETA();let n=this.formatter(this.options,r,this.payload);(e||this.options.forceRedraw||this.options.noTTYOutput&&!this.terminal.isTTY()||this.lastDrawnString!=n)&&(this.emit("redraw-pre"),this.terminal.cursorTo(0,null),this.terminal.write(n),this.terminal.clearRight(),this.lastDrawnString=n,this.lastRedraw=Date.now(),this.emit("redraw-post"))}start(e,r,n){this.value=r||0,this.total=typeof e<"u"&&e>=0?e:100,this.startValue=r||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new QRe(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",e,r)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(e,r={}){typeof e=="number"&&(this.value=e,this.eta.update(Date.now(),e,this.total));let n=(typeof e=="object"?e:r)||{};this.emit("update",this.total,this.value);for(let i in n)this.payload[i]=n[i];this.value>=this.getTotal()&&this.options.stopOnComplete&&this.stop()}getProgress(){let e=this.value/this.total;return this.options.progressCalculationRelative&&(e=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(e)&&(e=this.options&&this.options.emptyOnZero?0:1),e=Math.min(Math.max(e,0),1),e}increment(e=1,r={}){typeof e=="object"?this.update(this.value+1,e):this.update(this.value+e,r)}getTotal(){return this.total}setTotal(e){typeof e<"u"&&e>=0&&(this.total=e)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var bRe=k((Twr,wRe)=>{m();var e0t=vY(),t0t=gR();wRe.exports=class extends e0t{constructor(e,r){super(t0t.parse(e,r)),this.timer=null,this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.options.synchronousUpdate=!1),this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.sigintCallback=null}render(){this.timer&&(clearTimeout(this.timer),this.timer=null),super.render(),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&this.terminal.newline(),this.timer=setTimeout(this.render.bind(this),this.schedulingRate)}update(e,r){this.timer&&(super.update(e,r),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(e,r,n){this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.terminal.cursorSave(),this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),super.start(e,r,n),this.render())}stop(){this.timer&&(this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.render(),super.stop(),clearTimeout(this.timer),this.timer=null,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRestore(),this.options.clearOnComplete?(this.terminal.cursorTo(0,null),this.terminal.clearLine()):this.terminal.newline())}}});var SRe=k((_wr,vRe)=>{m();var r0t=EY(),n0t=vY(),i0t=gR(),o0t=require("events");vRe.exports=class extends o0t{constructor(e,r){super(),this.bars=[],this.options=i0t.parse(e,r),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new r0t(this.options.stream),this.timer=null,this.isActive=!1,this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.loggingBuffer=[],this.sigintCallback=null}create(e,r,n,i={}){let o=new n0t(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(o),this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.isActive||(this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),this.timer=setTimeout(this.update.bind(this),this.schedulingRate)),this.isActive=!0,o.start(e,r,n),this.emit("start")),o}remove(e){let r=this.bars.indexOf(e);return r<0?!1:(this.bars.splice(r,1),this.update(),this.terminal.newline(),this.terminal.clearBottom(),!0)}update(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.emit("update-pre"),this.terminal.cursorRelativeReset(),this.emit("redraw-pre"),this.loggingBuffer.length>0)for(this.terminal.clearLine();this.loggingBuffer.length>0;)this.terminal.write(this.loggingBuffer.shift(),!0);for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render();this.emit("redraw-post"),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.terminal.newline(),this.terminal.newline()),this.timer=setTimeout(this.update.bind(this),this.schedulingRate),this.emit("update-post"),this.options.stopOnComplete&&!this.bars.find(e=>e.isActive)&&this.stop()}stop(){if(clearTimeout(this.timer),this.timer=null,this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.isActive=!1,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRelativeReset(),this.emit("stop-pre-clear"),this.options.clearOnComplete)this.terminal.clearBottom();else{for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render(),this.bars[e].stop();this.terminal.newline()}this.emit("stop")}log(e){this.loggingBuffer.push(e)}}});var FRe=k((Uwr,xRe)=>{m();xRe.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var RRe=k((Gwr,kRe)=>{m();kRe.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var TRe=k((Hwr,NRe)=>{m();NRe.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var PRe=k((Jwr,MRe)=>{m();MRe.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var LRe=k((Ywr,_Re)=>{m();var s0t=FRe(),a0t=RRe(),A0t=TRe(),c0t=PRe();_Re.exports={legacy:s0t,shades_classic:a0t,shades_grey:A0t,rect:c0t}});var GRe=k((Vwr,ORe)=>{m();var URe=bRe(),u0t=SRe(),l0t=LRe(),g0t=bY(),p0t=QY(),d0t=DY(),f0t=wY();ORe.exports={Bar:URe,SingleBar:URe,MultiBar:u0t,Presets:l0t,Format:{Formatter:g0t,BarFormat:d0t,ValueFormat:p0t,TimeFormat:f0t}}});var qRe=k((C0r,YRe)=>{m();YRe.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var SRt={};lA(SRt,{default:()=>vRt});module.exports=mn(SRt);m();m();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="33328133-c3c9-462a-962b-0694a52c4812",t._sentryDebugIdIdentifier="sentry-dbid-33328133-c3c9-462a-962b-0694a52c4812")}catch{}})();m();var ILe=require("../core/index.cjs"),ELe=require("../node/index.cjs"),BLe=require("../server/index.cjs"),yLe=z(R5(),1);m();m();var OF=require("fs/promises");VN();Bn();uE();mr();var an=z(Hr(),1),Uh=require("node:path");ba();ns();nn();Pn();wh();var vpt="https://cdn.builder.io",mDe=async(t,e)=>{console.log(""),fr((0,an.bgCyan)((0,an.bold)((0,an.white)(" figma migrate ")))+" "+(0,an.dim)(vt));let{builderPrivateKey:r,builderPublicKey:n}=await Er(t,e,{forceSpaceId:e.spaceId,builderPrivateKey:!0,builderPublicKey:!0});await Jt("figma publish started",{spaceId:n});let i=await cE(t);if(i.length>0){await Jt("figma migrate with existing files",{spaceId:n}),G.warning(`${(0,an.yellow)("This repo already has figma mappings in:")}
|
|
2802
|
+
`),this.dy++}write(e,r=!1){this.linewrap===!0&&r===!1?this.stream.write(e.substr(0,this.getWidth())):this.stream.write(e)}lineWrapping(e){this.stream.isTTY&&(this.linewrap=e,e?this.stream.write("\x1B[?7h"):this.stream.write("\x1B[?7l"))}isTTY(){return this.stream.isTTY===!0}getWidth(){return this.stream.columns||(this.stream.isTTY?80:200)}};lRe.exports=IY});var pRe=k((dwr,BY)=>{"use strict";m();var gRe=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);BY.exports=gRe;BY.exports.default=gRe});var fRe=k((mwr,dRe)=>{"use strict";m();dRe.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var hRe=k((Cwr,yY)=>{"use strict";m();var Hwt=t2(),$wt=pRe(),Jwt=fRe(),mRe=t=>{if(typeof t!="string"||t.length===0||(t=Hwt(t),t.length===0))return 0;t=t.replace(Jwt()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=$wt(n)?2:1)}return e};yY.exports=mRe;yY.exports.default=mRe});var QY=k((Ewr,CRe)=>{m();CRe.exports=function(e,r,n){if(r.autopadding!==!0)return e;function i(o,s){return(r.autopaddingChar+o).slice(-s)}return n==="percentage"?i(e,3):e}});var DY=k((ywr,IRe)=>{m();IRe.exports=function(e,r){let n=Math.round(e*r.barsize),i=r.barsize-n;return r.barCompleteString.substr(0,n)+r.barGlue+r.barIncompleteString.substr(0,i)}});var wY=k((Dwr,ERe)=>{m();ERe.exports=function(e,r,n){function i(s){return n?n*Math.round(s/n):s}function o(s){return(r.autopaddingChar+s).slice(-2)}return e>3600?o(Math.floor(e/3600))+"h"+o(i(e%3600/60))+"m":e>60?o(Math.floor(e/60))+"m"+o(i(e%60))+"s":e>10?o(i(e))+"s":o(e)+"s"}});var bY=k((bwr,BRe)=>{m();var jwt=hRe(),Ywt=QY(),qwt=DY(),Vwt=wY();BRe.exports=function(e,r,n){let i=e.format,o=e.formatTime||Vwt,s=e.formatValue||Ywt,a=e.formatBar||qwt,A=Math.floor(r.progress*100)+"",c=r.stopTime||Date.now(),u=Math.round((c-r.startTime)/1e3),l=Object.assign({},n,{bar:a(r.progress,e),percentage:s(A,e,"percentage"),total:s(r.total,e,"total"),value:s(r.value,e,"value"),eta:s(r.eta,e,"eta"),eta_formatted:o(r.eta,e,5),duration:s(u,e,"duration"),duration_formatted:o(u,e,1)});i=i.replace(/\{(\w+)\}/g,function(d,f){return typeof l[f]<"u"?l[f]:d});let p=Math.max(0,r.maxWidth-jwt(i)-2),g=Math.floor(p/2);switch(e.align){case"right":i=p>0?" ".repeat(p)+i:i;break;case"center":i=g>0?" ".repeat(g)+i:i;break;default:break}return i}});var gR=k((Swr,yRe)=>{m();function Mr(t,e){return typeof t>"u"||t===null?e:t}yRe.exports={parse:function(e,r){let n={},i=Object.assign({},r,e);return n.throttleTime=1e3/Mr(i.fps,10),n.stream=Mr(i.stream,process.stderr),n.terminal=Mr(i.terminal,null),n.clearOnComplete=Mr(i.clearOnComplete,!1),n.stopOnComplete=Mr(i.stopOnComplete,!1),n.barsize=Mr(i.barsize,40),n.align=Mr(i.align,"left"),n.hideCursor=Mr(i.hideCursor,!1),n.linewrap=Mr(i.linewrap,!1),n.barGlue=Mr(i.barGlue,""),n.barCompleteChar=Mr(i.barCompleteChar,"="),n.barIncompleteChar=Mr(i.barIncompleteChar,"-"),n.format=Mr(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=Mr(i.formatTime,null),n.formatValue=Mr(i.formatValue,null),n.formatBar=Mr(i.formatBar,null),n.etaBufferLength=Mr(i.etaBuffer,10),n.etaAsynchronousUpdate=Mr(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=Mr(i.progressCalculationRelative,!1),n.synchronousUpdate=Mr(i.synchronousUpdate,!0),n.noTTYOutput=Mr(i.noTTYOutput,!1),n.notTTYSchedule=Mr(i.notTTYSchedule,2e3),n.emptyOnZero=Mr(i.emptyOnZero,!1),n.forceRedraw=Mr(i.forceRedraw,!1),n.autopadding=Mr(i.autopadding,!1),n.gracefulExit=Mr(i.gracefulExit,!1),n},assignDerivedOptions:function(e){return e.barCompleteString=e.barCompleteChar.repeat(e.barsize+1),e.barIncompleteString=e.barIncompleteChar.repeat(e.barsize+1),e.autopaddingChar=e.autopadding?Mr(e.autopaddingChar," "):"",e}}});var vY=k((kwr,DRe)=>{m();var QRe=uRe(),zwt=EY(),Wwt=bY(),Zwt=gR(),Xwt=require("events");DRe.exports=class extends Xwt{constructor(e){super(),this.options=Zwt.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new zwt(this.options.stream),this.value=0,this.startValue=0,this.total=100,this.lastDrawnString=null,this.startTime=null,this.stopTime=null,this.lastRedraw=Date.now(),this.eta=new QRe(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:Wwt}render(e=!1){let r={progress:this.getProgress(),eta:this.eta.getTime(),startTime:this.startTime,stopTime:this.stopTime,total:this.total,value:this.value,maxWidth:this.terminal.getWidth()};this.options.etaAsynchronousUpdate&&this.updateETA();let n=this.formatter(this.options,r,this.payload);(e||this.options.forceRedraw||this.options.noTTYOutput&&!this.terminal.isTTY()||this.lastDrawnString!=n)&&(this.emit("redraw-pre"),this.terminal.cursorTo(0,null),this.terminal.write(n),this.terminal.clearRight(),this.lastDrawnString=n,this.lastRedraw=Date.now(),this.emit("redraw-post"))}start(e,r,n){this.value=r||0,this.total=typeof e<"u"&&e>=0?e:100,this.startValue=r||0,this.payload=n||{},this.startTime=Date.now(),this.stopTime=null,this.lastDrawnString="",this.eta=new QRe(this.options.etaBufferLength,this.startTime,this.value),this.isActive=!0,this.emit("start",e,r)}stop(){this.isActive=!1,this.stopTime=Date.now(),this.emit("stop",this.total,this.value)}update(e,r={}){typeof e=="number"&&(this.value=e,this.eta.update(Date.now(),e,this.total));let n=(typeof e=="object"?e:r)||{};this.emit("update",this.total,this.value);for(let i in n)this.payload[i]=n[i];this.value>=this.getTotal()&&this.options.stopOnComplete&&this.stop()}getProgress(){let e=this.value/this.total;return this.options.progressCalculationRelative&&(e=(this.value-this.startValue)/(this.total-this.startValue)),isNaN(e)&&(e=this.options&&this.options.emptyOnZero?0:1),e=Math.min(Math.max(e,0),1),e}increment(e=1,r={}){typeof e=="object"?this.update(this.value+1,e):this.update(this.value+e,r)}getTotal(){return this.total}setTotal(e){typeof e<"u"&&e>=0&&(this.total=e)}updateETA(){this.eta.update(Date.now(),this.value,this.total)}}});var bRe=k((Twr,wRe)=>{m();var e0t=vY(),t0t=gR();wRe.exports=class extends e0t{constructor(e,r){super(t0t.parse(e,r)),this.timer=null,this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.options.synchronousUpdate=!1),this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.sigintCallback=null}render(){this.timer&&(clearTimeout(this.timer),this.timer=null),super.render(),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&this.terminal.newline(),this.timer=setTimeout(this.render.bind(this),this.schedulingRate)}update(e,r){this.timer&&(super.update(e,r),this.options.synchronousUpdate&&this.lastRedraw+this.options.throttleTime*2<Date.now()&&this.render())}start(e,r,n){this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.terminal.cursorSave(),this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),super.start(e,r,n),this.render())}stop(){this.timer&&(this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.render(),super.stop(),clearTimeout(this.timer),this.timer=null,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRestore(),this.options.clearOnComplete?(this.terminal.cursorTo(0,null),this.terminal.clearLine()):this.terminal.newline())}}});var SRe=k((_wr,vRe)=>{m();var r0t=EY(),n0t=vY(),i0t=gR(),o0t=require("events");vRe.exports=class extends o0t{constructor(e,r){super(),this.bars=[],this.options=i0t.parse(e,r),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new r0t(this.options.stream),this.timer=null,this.isActive=!1,this.schedulingRate=this.terminal.isTTY()?this.options.throttleTime:this.options.notTTYSchedule,this.loggingBuffer=[],this.sigintCallback=null}create(e,r,n,i={}){let o=new n0t(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(o),this.options.noTTYOutput===!1&&this.terminal.isTTY()===!1||(this.sigintCallback===null&&this.options.gracefulExit&&(this.sigintCallback=this.stop.bind(this),process.once("SIGINT",this.sigintCallback),process.once("SIGTERM",this.sigintCallback)),this.isActive||(this.options.hideCursor===!0&&this.terminal.cursor(!1),this.options.linewrap===!1&&this.terminal.lineWrapping(!1),this.timer=setTimeout(this.update.bind(this),this.schedulingRate)),this.isActive=!0,o.start(e,r,n),this.emit("start")),o}remove(e){let r=this.bars.indexOf(e);return r<0?!1:(this.bars.splice(r,1),this.update(),this.terminal.newline(),this.terminal.clearBottom(),!0)}update(){if(this.timer&&(clearTimeout(this.timer),this.timer=null),this.emit("update-pre"),this.terminal.cursorRelativeReset(),this.emit("redraw-pre"),this.loggingBuffer.length>0)for(this.terminal.clearLine();this.loggingBuffer.length>0;)this.terminal.write(this.loggingBuffer.shift(),!0);for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render();this.emit("redraw-post"),this.options.noTTYOutput&&this.terminal.isTTY()===!1&&(this.terminal.newline(),this.terminal.newline()),this.timer=setTimeout(this.update.bind(this),this.schedulingRate),this.emit("update-post"),this.options.stopOnComplete&&!this.bars.find(e=>e.isActive)&&this.stop()}stop(){if(clearTimeout(this.timer),this.timer=null,this.sigintCallback&&(process.removeListener("SIGINT",this.sigintCallback),process.removeListener("SIGTERM",this.sigintCallback),this.sigintCallback=null),this.isActive=!1,this.options.hideCursor===!0&&this.terminal.cursor(!0),this.options.linewrap===!1&&this.terminal.lineWrapping(!0),this.terminal.cursorRelativeReset(),this.emit("stop-pre-clear"),this.options.clearOnComplete)this.terminal.clearBottom();else{for(let e=0;e<this.bars.length;e++)e>0&&this.terminal.newline(),this.bars[e].render(),this.bars[e].stop();this.terminal.newline()}this.emit("stop")}log(e){this.loggingBuffer.push(e)}}});var FRe=k((Uwr,xRe)=>{m();xRe.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var RRe=k((Gwr,kRe)=>{m();kRe.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var TRe=k((Hwr,NRe)=>{m();NRe.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var PRe=k((Jwr,MRe)=>{m();MRe.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var LRe=k((Ywr,_Re)=>{m();var s0t=FRe(),a0t=RRe(),A0t=TRe(),c0t=PRe();_Re.exports={legacy:s0t,shades_classic:a0t,shades_grey:A0t,rect:c0t}});var GRe=k((Vwr,ORe)=>{m();var URe=bRe(),u0t=SRe(),l0t=LRe(),g0t=bY(),p0t=QY(),d0t=DY(),f0t=wY();ORe.exports={Bar:URe,SingleBar:URe,MultiBar:u0t,Presets:l0t,Format:{Formatter:g0t,BarFormat:d0t,ValueFormat:p0t,TimeFormat:f0t}}});var qRe=k((C0r,YRe)=>{m();YRe.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var SRt={};lA(SRt,{default:()=>vRt});module.exports=mn(SRt);m();m();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="225353a3-f3a9-4664-bdbe-f36054fefab0",t._sentryDebugIdIdentifier="sentry-dbid-225353a3-f3a9-4664-bdbe-f36054fefab0")}catch{}})();m();var ILe=require("../core/index.cjs"),ELe=require("../node/index.cjs"),BLe=require("../server/index.cjs"),yLe=z(R5(),1);m();m();var OF=require("fs/promises");VN();Bn();uE();mr();var an=z(Hr(),1),Uh=require("node:path");ba();ns();nn();Pn();wh();var vpt="https://cdn.builder.io",mDe=async(t,e)=>{console.log(""),fr((0,an.bgCyan)((0,an.bold)((0,an.white)(" figma migrate ")))+" "+(0,an.dim)(vt));let{builderPrivateKey:r,builderPublicKey:n}=await Er(t,e,{forceSpaceId:e.spaceId,builderPrivateKey:!0,builderPublicKey:!0});await Jt("figma publish started",{spaceId:n});let i=await cE(t);if(i.length>0){await Jt("figma migrate with existing files",{spaceId:n}),G.warning(`${(0,an.yellow)("This repo already has figma mappings in:")}
|
|
2803
2803
|
|
|
2804
2804
|
${i.map(c=>` - ${(0,Uh.relative)(t.getAppRootDir(),c)}`).join(`
|
|
2805
2805
|
`)}
|
|
@@ -4501,7 +4501,7 @@ Processed ${p.length} components${h>0?`
|
|
|
4501
4501
|
Skipped ${h} components
|
|
4502
4502
|
- ${g.length} empty (no inputs and no JSX)
|
|
4503
4503
|
- ${d.length} hidden (name starts with _ or .)`:""}`)};function Ypt(t){return t.name.startsWith("_")||t.name.startsWith(".")}function qpt(t){return t?t.inputs.length===0&&t.jsx==="":!0}var yDe=async(t,e,r)=>{if(e==="migrate")await mDe(t,r);else if(e==="publish"||e==="p")await cDe(t,r);else{if(e==="add"||e==="generate"||e==="gen"||e==="g")return Ze(`The 'figma generate' command has been removed. You can create mapper files manually.
|
|
4504
|
-
See: https://www.builder.io/c/docs/mapping-functions`),await Le(1);if(e==="report")await BDe(t,r);else if(e==="auth"){console.log(""),fr((0,Aa.bgCyan)((0,Aa.bold)((0,Aa.white)(" figma auth ")))+" "+(0,Aa.dim)(vt));let{builderPublicKey:n}=await Er(t,r,{requireFigmaAuth:"always",builderPrivateKey:!0,builderPublicKey:!0,force:!0});await Jt("figma auth",{spaceId:n}),Mn((0,Aa.bgGreen)((0,Aa.bold)((0,Aa.white)(" Done! \u{1F389} "))))}else e==="help"&&Eu(r._[2]||"figma")}};mr();Ji();tr();PU();m();function Ij(t,e){return{cwd:t,command:e[0],snippetId:e[1],path:e[2]}}wp();ba();ns();aQ();pj();m();var YQ=z(Vxe(),1),nRe=z(require("node:http"),1),iRe=z(require("node:https"),1),lR=z(require("net"),1),hY=z(require("node:fs"),1),oRe=z(require("node:os"),1),sRe=z(require("node:path"),1),aRe=z(require("@amplitude/analytics-node"),1),Es=z(Hr(),1);Bn();ba();ns();m();var Bke=z(require("node:stream"),1),yke=require("node:crypto");m();var vDt=z(gke(),1),SDt=z(Vk(),1),xDt=z(AC(),1),FDt=z(z9(),1),kDt=z(X9(),1),RDt=z(oY(),1),NDt=z(Xk(),1),aY=z(Eke(),1);function Qke(t){let e=!1,r="2.0",n=new aY.default(t),i=new Bke.default.EventEmitter,o={clients:new Map,events:new Map,methods:new Map},s=new Map([["rpc.on",p],["rpc.off",g]]);function a(E){return JSON.stringify({jsonrpc:r,id:E?.id,notification:E?.notification,result:E?.result,params:E?.params,error:E?.error})}function A(){n.on("listening",()=>{e=!0,i.emit("listening"),n.on("connection",(E,y)=>{let D=y.url||"/",b=(0,yke.randomUUID)();o.clients.set(b,E),i.emit("connection",E,b),u(E,b,D),E.on("error",Q=>i.emit("socket-error",b,Q)),E.on("close",()=>{o.clients.delete(b),i.emit("disconnection",b)})}),n.on("error",E=>i.emit("error",E))})}function c(E){return!!E.params&&Array.isArray(E.params)&&E.params.length>0}function u(E,y,D="/"){E.on("message",async b=>{let Q={};try{b instanceof ArrayBuffer&&(Q.binary=!0,b=Buffer.from(b).toString())}catch{return E.send(a({id:null,error:{code:-32700,message:"Parse error"}}))}let v;try{v=JSON.parse(b)}catch{return E.send(a({id:null,error:{code:-32700,message:"Parse error"}}))}try{let S=o;if(s.has(v.method)){let x=s.get(v.method);return E.send(x(S,v,y),Q)}if(!S.methods.has(v.method))return E.send(a({id:v.id,error:{code:-32601,message:"Method not found"}}),Q);try{let U=await S.methods.get(v.method)(v.params,y);return E.send(a({id:v.id,result:U||void 0}),Q)}catch(x){return E.send(a({id:v.id,error:{code:-32e3,message:x?.message||"Internal error",data:x?.data}}),Q)}}catch{return E.send(a({id:v?.id||null,error:{code:-32603,message:"Internal error"}}),Q)}})}function l(E,y,...D){let Q=[...o.clients.entries()].filter(([v])=>y.has(v)).map(([v,S])=>S);for(let v of Q)v.send(a({notification:E,params:D}))}function p(E,y,D){if(!c(y))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});if(!E.events.has(y.params[0]))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});let b=y.params[0];return E.events.get(b).add(D),a({id:y.id,result:{[b]:!0}})}function g(E,y,D){if(!c(y))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});if(!E.events.has(y.params[0]))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});let b=y.params[0];return E.events.get(b).delete(D),a({id:y.id,result:{[b]:!1}})}function d(E,y,D="/"){o.methods.set(E,y)}function f(E,y){i.on(E,y)}function h(E,y="/"){let D=o;D.events.has(E)||D.events.set(E,new Set)}function C(E,y="/",...D){let b=o;if(!b.events.has(E))return;let Q=b.events.get(E);l(E,Q,y,...D)}async function I(E,y,D,b){n.handleUpgrade(E,y,D,Q=>{e||n.emit("listening"),n.emit("connection",Q,E),b&&b(Q,E)})}function B(){return new Promise((E,y)=>{try{n.close(),i.emit("close"),E(null)}catch(D){y(D)}})}return A(),{on:f,event:E=>h(E),handleUpgrade:I,clients:()=>o.clients||new Map,register:(E,y)=>d(E,y),emit:(E,...y)=>C(E,"/",...y),notify:(E,y,...D)=>l(E,new Set([y]),...D),close:B}}xh();mr();Pt();N2();lQ();Ls();gQ();m();var fi=z(require("node:fs"),1),Li=z(require("fs/promises"),1),_i=z(require("node:path"),1);La();HA();Ls();var AY=z(require("dns/promises"),1);Pt();var wke=z(require("net"),1),tR=require("undici");Sv();Vc();lm();Vc();var cY=ke("Init"),TDt=t=>!!(t.name&&t.path),Dke=t=>!!(t.name&&t.path&&t.repoName&&t.repoUrl),dC=class{logIdCounter=0;initStatusLogs=[];sys;config;debug=!0;#r=cY;initState={isRunning:!1,isComplete:!1,success:!1,currentStep:"initial",error:void 0,repos:[]};constructor(e){this.sys=e.sys,this.config=e,this.debug=e.debug??!0}async checkout(e,r,n){try{await this.git(["checkout",e],n)}catch{return await this.git(["checkout","-b",e,r],n,1),!0}return await this.git(["reset","--hard",r],n),!1}async execAsync(e,r,n,i){return Ga(e,r,{cwd:n,sys:this.sys,retry:i})}async git(e,r,n,i,o){return Ga("git",e,{cwd:r,sys:this.sys,retry:n,skipLogging:o,timeout:i??(e[0].includes("clone")?600*1e3:60*1e3)})}async performBackup({sys:e,credentials:r,fusionConfig:n,volumePath:i,repositories:o,isConnectedToProvider:s,forcedFullBackup:a}){try{this.#r.info("Performing backup operation");let A=o.filter(d=>d.enableGit);if(A.length===0)throw new Error("No repository with git enabled found for backup");if(!n.branchName)throw new Error("Backup mode: No branch name found");if(!n.projectId)throw new Error("Backup mode: No project ID found");let c=[];for(let d of A){let f=_i.join(i,d.path);if(!fi.existsSync(f))throw new Error(`Backup mode: Repository directory does not exist at ${f}`);if(!fi.existsSync(_i.join(f,".git")))throw new Error(`Backup mode: Git repository not initialized at ${f}`);let{featureBranch:h,currentBranch:C}=await mv({sys:e,gitWorkingDirectory:f,strict:!a});c.push({repo:d,repoPath:f,featureBranch:h,currentBranch:C})}let u={};for(let{repo:d,repoPath:f}of c)try{let h=await Ga("git",["rev-parse","HEAD"],{cwd:f,sys:e,skipLogging:!0});h.trim()&&(u[d.name||d.path]=h.trim())}catch{}await vv(e,r,{commits:u,projectId:n.projectId,branchName:n.branchName},this.debug);let l=performance.now(),p=[];for(let{repo:d,repoPath:f,featureBranch:h,currentBranch:C}of c){this.#r.info(`Creating backup for AI branch: ${C} (${d.name||d.path})`);let I=await wv({sys:e,credentials:r,projectId:n.projectId,branchName:n.branchName,repoPath:f,aiBranch:C,featureBranch:h,workspace:n.workspace,isConnectedToProvider:s,forcedFullBackup:a,debug:!0,canAbortMerge:!1,folderName:d.name||d.path,repoUrl:d.originalRepoUrl??d.repoUrl});if(!I.success)throw new Error(`Backup upload failed for ${d.name||d.path}: ${I.reason||"Unknown error"}`);this.#r.info(`Backup uploaded successfully for ${d.name||d.path}`),p.push(I.backupEntry)}let g=performance.now()-l;await bv(r,p,g,this.debug)}catch(A){let c=new Error("Failed to perform git backup",{cause:A});throw this.config.sys.Sentry?.captureException(c,{tags:{launchMode:this.config.fusionConfig.mode,forcedFullBackup:a,isConnectedToProvider:s}}),c}}async performRegularBackup(e){await this.performBackup({...e,isConnectedToProvider:!0,forcedFullBackup:!1})}async performOfflineBackup(e){await this.performBackup({...e,isConnectedToProvider:!1,forcedFullBackup:!1})}async performForcedFullBackup(e){await this.performBackup({...e,isConnectedToProvider:!1,forcedFullBackup:!0})}async init(){let e=this.config;this.clearInitLogs(),this.initState.isRunning=!0,this.initState.isComplete=!1;let r=e.fusionConfig.workspace?.folders?.filter(TDt)??[];this.addInitLog("log",`Starting initialization with ${r.length} repositories`,{step:"init"});try{if(!r.length){let i="At least one repository must be configured";throw new Error(i)}if(!e.sys){let i="DevToolsSys is required in config";throw this.addInitLog("error",i,{step:"validation",error:i}),new Error(i)}let n=fv(e.fusionConfig);switch(e.fusionConfig.mode){case"backup":{try{await this.performRegularBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}catch(i){this.#r.info(`Online backup failed: ${i}. Attempting offline backup...`),await this.performOfflineBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}break}case"backup-force-full":{try{await this.performRegularBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}catch(i){this.#r.info(`Online backup failed: ${i}. Attempting offline backup...`);try{await this.performOfflineBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}catch(o){this.#r.info(`Offline backup failed: ${o}. Attempting forced full offline backup...`),await this.performForcedFullBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}}break}case"init-and-launch":{await this.step1CheckDirectories(n,r),this.addInitLog("log","Directories checked",{step:"check-directories"}),await this.step2ConfigureGitRepositories(n,r),this.addInitLog("log","Git repositories configured",{step:"configure-git-repos"}),await this.step3ConfigureGitUser(n,r),this.addInitLog("log","Git user configured",{step:"configure-git-user"}),await this.step4CollectRepoInfo(e,n,r),this.addInitLog("log","Repo info collected",{step:"collect-repo-info"});break}default:throw new Error(`Invalid mode: ${e.fusionConfig.mode}`)}return this.addInitLog("complete","Initialization completed successfully",{step:"init-success",success:!0}),!0}catch(n){let i=n instanceof Error?n.message:String(n),o=this.initStatusLogs.some(s=>s.type==="error"&&s.step&&s.step!=="init-failed");return this.addInitLog("complete",`Initialization failed with error: ${i}`,{step:o?void 0:"init-failed",success:!1,error:i}),e.sys.Sentry?.captureException(n,{tags:{operation:"init",...e.sentryTags}}),!1}}addInitLog(e,r,n){let i={id:++this.logIdCounter,timestamp:new Date().toISOString(),type:e,message:r,step:n?.step,error:n?.error,success:n?.success};this.#r.debug(`${i.timestamp} ${i.type} ${i.message}`),this.initStatusLogs.push(i),this.initStatusLogs.length>1e3&&this.initStatusLogs.splice(0,this.initStatusLogs.length-1e3),n?.step&&(this.initState.currentStep=n.step),e==="complete"&&(this.initState.isComplete=!0,this.initState.isRunning=!1,this.initState.success=n?.success??!1,this.initState.error=n?.error??this.initState.error,n?.gitDiagnostics&&(this.initState.gitDiagnostics=n.gitDiagnostics)),e==="error"&&n?.error&&(this.initState.error=n.error,n?.gitDiagnostics&&(this.initState.gitDiagnostics=n.gitDiagnostics))}clearInitLogs(){this.initStatusLogs.length=0,this.logIdCounter=0,this.initState.isRunning=!1,this.initState.isComplete=!1,this.initState.success=!1,this.initState.currentStep="initial",this.initState.error=void 0,this.initState.gitDiagnostics=void 0}async hasFilesButNoGit(e){if(fi.existsSync(e))try{let n=(await Li.readdir(e)).length>0,i=fi.existsSync(_i.join(e,".git"));return n&&!i}catch{return!1}return!1}async step1CheckDirectories(e,r){this.addInitLog("log","Checking directories",{step:"check-directories"}),fi.existsSync(e)||await Li.mkdir(e,{recursive:!0}),e.startsWith("/root")&&MDt("root"),this.addInitLog("log",`Volume directory exists: ${e}`,{step:"check-directories"});for(let n of r){let i=_i.join(e,n.path);if(fi.existsSync(i))this.addInitLog("log",`Directory already exists: ${i}`,{step:"check-directories"});else{this.addInitLog("log",`Creating directory: ${i}`,{step:"create-directories"});try{await Li.mkdir(i,{recursive:!0})}catch(o){let s=`Failed to create directory for ${n.repoName} at ${i}: ${o}`;throw this.addInitLog("error",s,{step:"create-directories",error:s}),new Error(s,{cause:o})}}}}async step2ConfigureGitRepositories(e,r){this.addInitLog("log","Configuring git repositories",{step:"configure-git-repos"});let n=_i.join(e,"temp-cloning"),i=async()=>{fi.existsSync(n)&&(this.addInitLog("log",`Removing temp cloning directory: ${n}`,{step:"configure-git-repos"}),await Li.rm(n,{recursive:!0,force:!0}))};await i(),this.addInitLog("log",`Creating temp cloning path: ${n}`,{step:"configure-git-repos"}),await Li.mkdir(n,{recursive:!0});let o=await this.fetchGitConfigsOnce();try{for(let s of r){let a=_i.join(e,s.path);this.addInitLog("log",`Processing repository: ${s.repoName}`,{step:"configure-git-repos"});let A=await this.isGitConfigured(a),c=!A;if(this.config.fusionConfig.rebuildGit&&A&&(this.addInitLog("log",`rebuildGit flag set, removing existing repo for ${s.repoName} to re-clone`,{step:"check-existing-git"}),await Li.rm(a,{recursive:!0,force:!0}),c=!0),A&&!c){if(s.enableGit&&o){let u=s===r.find(p=>p.enableGit),l=r.filter(p=>p.enableGit).length;this.applyGitConfig(s,o,u,l)}await this.cleanupLockFiles(a);try{s.enableGit?(this.addInitLog("log",`Git already configured for ${s.repoName}, validating repo`,{step:"check-existing-git"}),await this.validateGitRepo(a)):this.addInitLog("log",`Git already configured for ${s.repoName}, skipping validation because it's not main repo`,{step:"check-existing-git"})}catch(u){let l=`Git repo is in bad state for ${s.repoName}, will re-clone: ${u}`;this.config.sys.Sentry?.captureMessage(l,{level:"warning",tags:{operation:"init",...this.config.sentryTags},extra:{repoName:s.repoName,repoPath:a}}),this.addInitLog("error",l,{step:"check-existing-git",error:l})}if(!c){if(this.addInitLog("log","Git repo is in good state, checking remote URL",{step:"check-existing-git"}),s.initializationCommand){this.addInitLog("log","Skipping remote URL update because it has an initialization command",{step:"update-remote-url"});continue}if(!Dke(s))throw new Error("Remote URL update failed because repoUrl is undefined");if(await this.getGitRemoteUrl(a))try{await this.git(["remote","set-url","origin",s.repoUrl],a)}catch(l){let p=`Failed to update git remote URL for ${s.repoName}: ${l}`;throw this.addInitLog("error",p,{step:"update-remote-url",error:p}),new Error(p)}else{this.addInitLog("log",`Adding remote origin for ${s.repoName}`,{step:"check-existing-git"});try{await this.git(["remote","add","origin",s.repoUrl],a)}catch(l){let p=`Failed to add git remote origin for ${s.repoName}: ${l}`;throw this.addInitLog("error",p,{step:"check-existing-git",error:p}),new Error(p)}}if(this.config.fusionConfig.syncBranch&&s.enableGit&&!this.config.fusionConfig.isFork){let l=s.branchName||"main";try{let p=(await this.git(["rev-parse","HEAD"],a)).trim(),d=(await this.git(["ls-remote","origin",l],a)).trim().split(/\s/)[0]||"";p===d?this.addInitLog("log",`Snapshot git is already up-to-date with origin/${l}`,{step:"snapshot-git-sync"}):(this.addInitLog("log",`Snapshot git is behind origin/${l}, syncing...`,{step:"snapshot-git-sync"}),await this.git(["pull","--ff-only","origin",l],a),this.addInitLog("log",`Git synced to origin/${l}`,{step:"snapshot-git-sync"}))}catch(p){this.addInitLog("error",`Failed to sync git from snapshot: ${p}`,{step:"snapshot-git-sync",error:String(p)})}}if(this.config.fusionConfig.pvcCreationSource==="snapshot"&&s.backupMetadata&&s.enableGit){let l=this.config.fusionConfig.aiBranch||s.backupMetadata.check.backup.gitBranchName;if(await this.isBackupAlreadyApplied(a,l,s.backupMetadata.check.backup.lastCommitHash))this.addInitLog("log",`Backup already applied for ${s.repoName} (branch ${l} exists), skipping restore`,{step:"snapshot-backup-restore"}),await this.git(["checkout",l],a);else{this.addInitLog("log",`Snapshot volume detected with backup, downloading backup for ${s.repoName}`,{step:"snapshot-backup-restore"});let g=await sO(this.config.sys,s.backupMetadata);if(g.success)try{await this.restoreFromPartialBackup({repo:s,repoPath:a,backupResult:g}),this.addInitLog("log",`Restored backup on snapshot volume for ${s.repoName}`,{step:"snapshot-backup-restore"})}catch(d){throw this.addInitLog("error",`Failed to restore backup on snapshot volume: ${d}`,{step:"snapshot-backup-restore",error:String(d)}),d}else throw this.addInitLog("error",`Failed to download backup for snapshot restore: ${g.error}`,{step:"snapshot-backup-restore",error:g.error.message}),g.error}}}}if(c){if(await this.hasFilesButNoGit(a)){let d="Code directory already exists but is not a git repo";throw this.addInitLog("error",d,{step:"check-existing-git",error:d}),new Error(d)}let l=s.backupMetadata?await sO(this.config.sys,s.backupMetadata):void 0;if(l&&!l.success)throw this.addInitLog("error",`Failed to download backup for ${s.repoName}: ${l.error}`,{step:"clone-repo",error:l.error.message}),l.error;l?.success&&this.sys.Sentry?.setTag("backup",l.partial?"partial":"full");let p=_i.join(n,s.path),g=!1;if(s.initializationCommand){this.addInitLog("log","Running initialization command.",{step:"init-command"});let d=await this.runInitializationCommand({repo:s,tempCloningDir:n,repoPath:p,initCommand:s.initializationCommand});if(g=d.outcome,g)this.addInitLog("log",`Successfully initialized ${s.repoName}`,{step:"init-command"});else{let f=d.error?.message||"Failed to run initialization command.";throw this.addInitLog("error",f,{step:"init-command",error:f}),new Error(f)}}else{if(!Dke(s))throw new Error("repoUrl or repoName is undefined");if(this.addInitLog("log",`Cloning repository: ${s.repoName}`,{step:"clone-repo"}),g=await this.cloneRepository({repo:s,repoPath:p,backupResult:l}),g)this.addInitLog("log",`Successfully cloned ${s.repoName}`,{step:"clone-repo"});else{let d=`Failed to clone repository ${s.repoName}`;throw this.addInitLog("error",d,{step:"clone-repo",error:d}),new Error(d)}}if(l&&l.success&&l.partial)try{await this.restoreFromPartialBackup({repo:s,repoPath:p,backupResult:l})}catch(d){throw d}if(process.platform==="win32"&&fi.existsSync(a)){if((await Li.readdir(a)).length>0){let f=`Target directory ${a} already exists and is not empty. Cannot safely rename.`;throw this.addInitLog("error",f,{step:"configure-git-repos",error:f}),new Error(f)}this.addInitLog("log",`Removing empty directory before rename (Windows workaround): ${a}`,{step:"configure-git-repos"}),await Li.rm(a,{recursive:!0,force:!0})}await Li.rename(p,a),await this.markGitSafe(a)}}}catch(s){throw this.addInitLog("error",`Failed to configure git repositories: ${s}`,{step:"configure-git-repos",error:String(s)}),s}finally{await i()}}async step3ConfigureGitUser(e,r){this.addInitLog("log","Configuring git user",{step:"configure-git-user"});for(let n of r){let i=_i.join(e,n.path);this.addInitLog("log",`Setting git user for ${n.repoName}`,{step:"configure-git-user"});try{await this.git(["config","user.email","builder-bot@builder.io"],i),await this.git(["config","user.name","Builder.io"],i)}catch(o){let s=`Failed to configure git user for ${n.repoName}: ${o}`;throw this.addInitLog("error",s,{step:"configure-git-user",error:s}),new Error(s)}}}async step4CollectRepoInfo(e,r,n){this.addInitLog("log","Collecting repo info",{step:"collect-repo-info"}),this.initState.repos=[];for(let i of n){let o=_i.join(r,i.path);try{let s=await this.git(["rev-parse","HEAD"],o),a=await this.git(["branch","--show-current"],o),A={repoName:i.repoName||i.path,enabledGit:!!i.enableGit,lastCommitHash:s.trim(),branch:a.trim()};this.initState.repos.push(A),this.addInitLog("log",`Collected repo info: ${JSON.stringify(A)}`,{step:"collect-repo-info"})}catch(s){e.sys.Sentry?.captureException(s,{tags:{operation:"init",...e.sentryTags}})}}}async isGitConfigured(e){try{return await this.git(["rev-parse","--is-inside-work-tree"],e,void 0,void 0,!0),!0}catch{return!1}}async getGitRemoteUrl(e){try{return(await this.git(["config","--get","remote.origin.url"],e)).trim()}catch{return null}}isStandardGitHost(e){let r=["github.com","gitlab.com","bitbucket.org"];try{let n=new URL(e);return r.some(i=>n.hostname===i||n.hostname.endsWith(`.${i}`))}catch{return!1}}async checkHostConnectivity(e){try{let r=e.startsWith("git@")||e.startsWith("ssh://"),n,i;if(r){let o=e.match(/^(?:ssh:\/\/)?(?:[^@]+@)?([^/:]+)(?::|\/)/);if(!o)return{reachable:!1,error:"Invalid SSH repository URL format"};n=o[1],i=22}else{let o=e.match(/^https?:\/\/(?:[^@]+@)?([^/:?#]+)/);if(!o)return{reachable:!1,error:"Invalid repository URL format"};n=o[1],i=443}this.addInitLog("log",`Checking connectivity to host: ${n}:${i}`,{step:"clone-repo"});try{let o=[];try{o=await AY.default.resolve4(n),o.length>0&&this.addInitLog("log",`DNS resolved ${n} to IPv4: ${o.join(", ")}`,{step:"clone-repo"})}catch{o=await AY.default.resolve6(n),o.length>0&&this.addInitLog("log",`DNS resolved ${n} to IPv6: ${o.join(", ")}`,{step:"clone-repo"})}if(o.length===0)return{reachable:!1,hostname:n,error:`DNS resolution failed: no addresses found for ${n}`}}catch(o){let s=o instanceof Error?o.message:String(o);return{reachable:!1,hostname:n,error:`DNS resolution failed for ${n}: ${s}`}}try{let o=await this.checkConnectivityDirect(n,i);if(o.reachable)return o;let s=process.env.HTTP_PROXY||process.env.http_proxy;return s?(this.addInitLog("log",`Direct connection failed, trying proxy: ${s}`,{step:"clone-repo"}),await this.checkConnectivityViaProxy(n,i,s)):o}catch(o){let s=o instanceof Error?o.message:String(o);return{reachable:!1,hostname:n,error:`Connection attempt failed: ${s}`}}}catch(r){return{reachable:!1,error:`Unexpected error during connectivity check: ${r instanceof Error?r.message:String(r)}`}}}async checkConnectivityDirect(e,r){let i=wke.default.createConnection({host:e,port:r,timeout:5e3});return await new Promise(o=>{i.on("connect",()=>{i.destroy(),this.addInitLog("log",`Successfully connected to ${e}:${r}`,{step:"clone-repo"}),o({reachable:!0,hostname:e})}),i.on("error",s=>{i.destroy(),this.addInitLog("error",`Connection failed to ${e}:${r}: ${s.message}`,{step:"clone-repo",error:s.message}),o({reachable:!1,hostname:e,error:`Cannot connect to ${e}:${r}: ${s.message}`})}),i.on("timeout",()=>{i.destroy(),this.addInitLog("error",`Connection timeout to ${e}:${r} (${5e3/1e3}s)`,{step:"clone-repo",error:`Connection timeout to ${e}:${r} after ${5e3/1e3} seconds`}),o({reachable:!1,hostname:e,error:`Connection timeout to ${e}:${r} after ${5e3/1e3} seconds`})})})}async checkConnectivityViaProxy(e,r,n){try{this.addInitLog("log",`Attempting proxy connection to ${e}:${r} via proxy`,{step:"clone-repo"});let i=new URL(n),o=`${i.protocol}//${i.host}`,s=new tR.ProxyAgent({uri:o,token:i.username&&i.password?`Basic ${Buffer.from(`${i.username}:${i.password}`).toString("base64")}`:void 0}),a=`http://${e}:${r}`;return await(0,tR.fetch)(a,{dispatcher:s,signal:AbortSignal.timeout(3e4)}),this.addInitLog("log",`Successfully connected via proxy to ${e}:${r}`,{step:"clone-repo"}),{reachable:!0,hostname:e}}catch(i){return{reachable:!1,hostname:e,error:`Proxy connection failed: ${i instanceof Error?i.message:String(i)}`}}}async ensureParentDirExists(e){let r=_i.dirname(e);return await Li.mkdir(r,{recursive:!0}),r}async cleanupLockFiles(e){let r=_i.join(e,".git");try{let i=(await Li.readdir(r)).filter(s=>s.endsWith(".lock"));if(i.length===0)return;let o=[];for(let s of i){let a=_i.join(r,s);try{await Li.unlink(a),o.push(s)}catch(A){this.config.sys.Sentry?.captureException(new Error(`Failed to remove ${s} for ${e}: ${A}`),{tags:{operation:"init",...this.config.sentryTags}})}}o.length>0&&this.config.sys.Sentry?.captureMessage(`Lock files found for ${e} and removed: ${o.join(", ")}`,{tags:{operation:"init",...this.config.sentryTags}})}catch(n){this.config.sys.Sentry?.captureException(new Error(`Failed to cleanup lock files for ${e}: ${n}`),{tags:{operation:"init",...this.config.sentryTags}})}}async validateGitRepo(e){try{await this.git(["fsck","--connectivity-only"],e)}catch(r){throw new Error("Git repo is in bad state",{cause:r})}}async isBackupAlreadyApplied(e,r,n){try{let i=(await this.git(["rev-parse","--verify",`refs/heads/${r}`],e)).trim();return i?(await this.git(["merge-base","--is-ancestor",n,i],e),!0):!1}catch{return!1}}async restoreFromPartialBackup({repo:e,repoPath:r,backupResult:n}){try{this.addInitLog("log",`Checking for git backup for ${e.repoName}`,{step:"apply-partial-backup"});let i=async()=>{try{await this.git(["remote","remove","backup"],r)}catch(o){this.addInitLog("error",`Failed to cleanup restore: ${o}`,{step:"apply-partial-backup",error:String(o)})}};if(!n.bundlePath){try{this.addInitLog("log",`Found empty git backup, applying it to ${e.repoName}`,{step:"apply-partial-backup"});let o=this.config.fusionConfig.aiBranch||n.gitBranchName;await this.checkout(o,n.lastCommitHash,r)}catch(o){throw this.addInitLog("error",`Failed to checkout backup branch: ${o}`,{step:"apply-partial-backup",error:String(o)}),o}return}try{this.addInitLog("log",`Found git backup, applying it to ${e.repoName}`,{step:"apply-partial-backup"});try{await this.git(["remote","remove","backup"],r)}catch{}await this.git(["remote","add","backup",n.bundlePath],r),await this.git(["fetch","backup"],r);let o=n.gitBranchName,s=this.config.fusionConfig.aiBranch||o;s!==o?(this.addInitLog("log",`Creating new branch ${s} from backup/${o}`,{step:"apply-partial-backup"}),await this.git(["branch",s,`backup/${o}`],r),await this.git(["checkout",s],r)):await this.checkout(o,`backup/${o}`,r),this.addInitLog("log",`Successfully restored from backup to branch ${s}`,{step:"apply-partial-backup"}),await i(),this.addInitLog("log",`Cleaned up backup for ${e.repoName}`,{step:"apply-partial-backup"})}catch(o){throw await i(),this.addInitLog("error",String(o),{step:"apply-partial-backup",error:String(o)}),o}}catch(i){let o=new Error(`Failed to check git backup for ${e.repoName}. Cannot proceed without backup recovery.`,{cause:i});throw this.addInitLog("error",o.message,{step:"apply-partial-backup",error:String(i)}),o}}async initializeGitRepo(e,r){await this.git(["init"],e),await this.git(["add","."],e),await this.git(["branch","-M","main"],e),await this.git([...r?["-c","user.email=team@builder.io","-c","user.name=Builder.io"]:[],"commit","-m","Initial setup"],e)}async fetchGitConfigsOnce(){if(this.config.fusionConfig.projectId)try{let e=await hm(this.config.credentials,this.config.fusionConfig.projectId,this.debug);if(e.success)return Object.keys(e.gitConfigs).length>0?e.gitConfigs:void 0;e.gitDiagnostics&&(this.initState.gitDiagnostics=e.gitDiagnostics),this.config.sys.Sentry?.captureException(e.error,{tags:{operation:"init",endpoint:"fetch-git-configs",...this.config.sentryTags},extra:{gitDiagnostics:e.gitDiagnostics}})}catch(e){this.config.sys.Sentry?.captureException(new Error("Failed to fetch git configs in InitStateMachine",{cause:e instanceof Error?e:new Error(String(e))}),{tags:{operation:"init",endpoint:"fetch-git-configs",...this.config.sentryTags}})}}applyGitConfig(e,r,n,i){if(e.initializationCommand||e.repoUrl?.startsWith("ssh://")||e.repoUrl?.startsWith("git@"))return;let o;if(e.repoName&&r[e.repoName]?o=e.repoName:n&&(o=Object.keys(r)[0]),!o)return;let s=r[o];s?.url&&(e.repoUrl=s.url,n&&(e.repoName=o),(s.provider==="github"||s.provider==="selfHostedGithub")&&s.token&&(n&&(process.env.GH_TOKEN=s.token),i>1&&(process.env[yF(e.name)]=s.token)))}async runInitializationCommand({repo:e,tempCloningDir:r,repoPath:n,initCommand:i}){this.addInitLog("log",`Init command paths args: tempCloningDir: ${r} repoPath: ${n}`,{step:"init-command"});try{this.addInitLog("log",`Executing initialization command in ${r}`,{step:"init-command"});let o=process.env.SHELL||process.env.COMSPEC||"/bin/sh";try{let s=KA(o,i,{stdio:["ignore","pipe","pipe"],cwd:r,env:{...process.env,TERM:"dumb"}},!0),a=[],A=[];s.stdout?.on("data",c=>{a.push(c);let u=c.toString().trim();u&&this.addInitLog("log",u,{step:"init-command"})}),s.stderr?.on("data",c=>{A.push(c);let u=c.toString().trim();u&&this.addInitLog("error",u,{step:"init-command"})}),await new Promise((c,u)=>{s.on("error",l=>{u(l)}),s.on("close",l=>{if(l===0)c();else{let p=Buffer.concat(a).toString().trim(),g=Buffer.concat(A).toString().trim(),d=[`Command exited with code ${l}`,g&&`stderr: ${g}`,p&&`stdout: ${p}`].filter(Boolean).join(`
|
|
4504
|
+
See: https://www.builder.io/c/docs/mapping-functions`),await Le(1);if(e==="report")await BDe(t,r);else if(e==="auth"){console.log(""),fr((0,Aa.bgCyan)((0,Aa.bold)((0,Aa.white)(" figma auth ")))+" "+(0,Aa.dim)(vt));let{builderPublicKey:n}=await Er(t,r,{requireFigmaAuth:"always",builderPrivateKey:!0,builderPublicKey:!0,force:!0});await Jt("figma auth",{spaceId:n}),Mn((0,Aa.bgGreen)((0,Aa.bold)((0,Aa.white)(" Done! \u{1F389} "))))}else e==="help"&&Eu(r._[2]||"figma")}};mr();Ji();tr();PU();m();function Ij(t,e){return{cwd:t,command:e[0],snippetId:e[1],path:e[2]}}wp();ba();ns();aQ();pj();m();var YQ=z(Vxe(),1),nRe=z(require("node:http"),1),iRe=z(require("node:https"),1),lR=z(require("net"),1),hY=z(require("node:fs"),1),oRe=z(require("node:os"),1),sRe=z(require("node:path"),1),aRe=z(require("@amplitude/analytics-node"),1),Es=z(Hr(),1);Bn();ba();ns();m();var Bke=z(require("node:stream"),1),yke=require("node:crypto");m();var vDt=z(gke(),1),SDt=z(Vk(),1),xDt=z(AC(),1),FDt=z(z9(),1),kDt=z(X9(),1),RDt=z(oY(),1),NDt=z(Xk(),1),aY=z(Eke(),1);function Qke(t){let e=!1,r="2.0",n=new aY.default(t),i=new Bke.default.EventEmitter,o={clients:new Map,events:new Map,methods:new Map},s=new Map([["rpc.on",p],["rpc.off",g]]);function a(E){return JSON.stringify({jsonrpc:r,id:E?.id,notification:E?.notification,result:E?.result,params:E?.params,error:E?.error})}function A(){n.on("listening",()=>{e=!0,i.emit("listening"),n.on("connection",(E,y)=>{let D=y.url||"/",b=(0,yke.randomUUID)();o.clients.set(b,E),i.emit("connection",E,b),u(E,b,D),E.on("error",Q=>i.emit("socket-error",b,Q)),E.on("close",()=>{o.clients.delete(b),i.emit("disconnection",b)})}),n.on("error",E=>i.emit("error",E))})}function c(E){return!!E.params&&Array.isArray(E.params)&&E.params.length>0}function u(E,y,D="/"){E.on("message",async b=>{let Q={};try{b instanceof ArrayBuffer&&(Q.binary=!0,b=Buffer.from(b).toString())}catch{return E.send(a({id:null,error:{code:-32700,message:"Parse error"}}))}let v;try{v=JSON.parse(b)}catch{return E.send(a({id:null,error:{code:-32700,message:"Parse error"}}))}try{let S=o;if(s.has(v.method)){let x=s.get(v.method);return E.send(x(S,v,y),Q)}if(!S.methods.has(v.method))return E.send(a({id:v.id,error:{code:-32601,message:"Method not found"}}),Q);try{let U=await S.methods.get(v.method)(v.params,y);return E.send(a({id:v.id,result:U||void 0}),Q)}catch(x){return E.send(a({id:v.id,error:{code:-32e3,message:x?.message||"Internal error",data:x?.data}}),Q)}}catch{return E.send(a({id:v?.id||null,error:{code:-32603,message:"Internal error"}}),Q)}})}function l(E,y,...D){let Q=[...o.clients.entries()].filter(([v])=>y.has(v)).map(([v,S])=>S);for(let v of Q)v.send(a({notification:E,params:D}))}function p(E,y,D){if(!c(y))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});if(!E.events.has(y.params[0]))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});let b=y.params[0];return E.events.get(b).add(D),a({id:y.id,result:{[b]:!0}})}function g(E,y,D){if(!c(y))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});if(!E.events.has(y.params[0]))return a({id:y.id,error:{code:-32602,message:"Invalid params"}});let b=y.params[0];return E.events.get(b).delete(D),a({id:y.id,result:{[b]:!1}})}function d(E,y,D="/"){o.methods.set(E,y)}function f(E,y){i.on(E,y)}function h(E,y="/"){let D=o;D.events.has(E)||D.events.set(E,new Set)}function C(E,y="/",...D){let b=o;if(!b.events.has(E))return;let Q=b.events.get(E);l(E,Q,y,...D)}async function I(E,y,D,b){n.handleUpgrade(E,y,D,Q=>{e||n.emit("listening"),n.emit("connection",Q,E),b&&b(Q,E)})}function B(){return new Promise((E,y)=>{try{n.close(),i.emit("close"),E(null)}catch(D){y(D)}})}return A(),{on:f,event:E=>h(E),handleUpgrade:I,clients:()=>o.clients||new Map,register:(E,y)=>d(E,y),emit:(E,...y)=>C(E,"/",...y),notify:(E,y,...D)=>l(E,new Set([y]),...D),close:B}}xh();mr();Pt();N2();lQ();Ls();gQ();m();var fi=z(require("node:fs"),1),Li=z(require("fs/promises"),1),_i=z(require("node:path"),1);La();HA();Ls();var AY=z(require("dns/promises"),1);Pt();var wke=z(require("net"),1),tR=require("undici");Sv();Vc();lm();Vc();var cY=ke("Init"),TDt=t=>!!(t.name&&t.path),Dke=t=>!!(t.name&&t.path&&t.repoName&&t.repoUrl),dC=class{logIdCounter=0;initStatusLogs=[];sys;config;debug=!0;#n=cY;initState={isRunning:!1,isComplete:!1,success:!1,currentStep:"initial",error:void 0,repos:[]};constructor(e){this.sys=e.sys,this.config=e,this.debug=e.debug??!0}async checkout(e,r,n){try{await this.git(["checkout",e],n)}catch{return await this.git(["checkout","-b",e,r],n,1),!0}return await this.git(["reset","--hard",r],n),!1}async execAsync(e,r,n,i){return Ga(e,r,{cwd:n,sys:this.sys,retry:i})}async git(e,r,n,i,o){return Ga("git",e,{cwd:r,sys:this.sys,retry:n,skipLogging:o,timeout:i??(e[0].includes("clone")?600*1e3:60*1e3)})}async performBackup({sys:e,credentials:r,fusionConfig:n,volumePath:i,repositories:o,isConnectedToProvider:s,forcedFullBackup:a}){try{this.#n.info("Performing backup operation");let A=o.filter(d=>d.enableGit);if(A.length===0)throw new Error("No repository with git enabled found for backup");if(!n.branchName)throw new Error("Backup mode: No branch name found");if(!n.projectId)throw new Error("Backup mode: No project ID found");let c=[];for(let d of A){let f=_i.join(i,d.path);if(!fi.existsSync(f))throw new Error(`Backup mode: Repository directory does not exist at ${f}`);if(!fi.existsSync(_i.join(f,".git")))throw new Error(`Backup mode: Git repository not initialized at ${f}`);let{featureBranch:h,currentBranch:C}=await mv({sys:e,gitWorkingDirectory:f,strict:!a});c.push({repo:d,repoPath:f,featureBranch:h,currentBranch:C})}let u={};for(let{repo:d,repoPath:f}of c)try{let h=await Ga("git",["rev-parse","HEAD"],{cwd:f,sys:e,skipLogging:!0});h.trim()&&(u[d.name||d.path]=h.trim())}catch{}await vv(e,r,{commits:u,projectId:n.projectId,branchName:n.branchName},this.debug);let l=performance.now(),p=[];for(let{repo:d,repoPath:f,featureBranch:h,currentBranch:C}of c){this.#n.info(`Creating backup for AI branch: ${C} (${d.name||d.path})`);let I=await wv({sys:e,credentials:r,projectId:n.projectId,branchName:n.branchName,repoPath:f,aiBranch:C,featureBranch:h,workspace:n.workspace,isConnectedToProvider:s,forcedFullBackup:a,debug:!0,canAbortMerge:!1,folderName:d.name||d.path,repoUrl:d.originalRepoUrl??d.repoUrl});if(!I.success)throw new Error(`Backup upload failed for ${d.name||d.path}: ${I.reason||"Unknown error"}`);this.#n.info(`Backup uploaded successfully for ${d.name||d.path}`),p.push(I.backupEntry)}let g=performance.now()-l;await bv(r,p,g,this.debug)}catch(A){let c=new Error("Failed to perform git backup",{cause:A});throw this.config.sys.Sentry?.captureException(c,{tags:{launchMode:this.config.fusionConfig.mode,forcedFullBackup:a,isConnectedToProvider:s}}),c}}async performRegularBackup(e){await this.performBackup({...e,isConnectedToProvider:!0,forcedFullBackup:!1})}async performOfflineBackup(e){await this.performBackup({...e,isConnectedToProvider:!1,forcedFullBackup:!1})}async performForcedFullBackup(e){await this.performBackup({...e,isConnectedToProvider:!1,forcedFullBackup:!0})}async init(){let e=this.config;this.clearInitLogs(),this.initState.isRunning=!0,this.initState.isComplete=!1;let r=e.fusionConfig.workspace?.folders?.filter(TDt)??[];this.addInitLog("log",`Starting initialization with ${r.length} repositories`,{step:"init"});try{if(!r.length){let i="At least one repository must be configured";throw new Error(i)}if(!e.sys){let i="DevToolsSys is required in config";throw this.addInitLog("error",i,{step:"validation",error:i}),new Error(i)}let n=fv(e.fusionConfig);switch(e.fusionConfig.mode){case"backup":{try{await this.performRegularBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}catch(i){this.#n.info(`Online backup failed: ${i}. Attempting offline backup...`),await this.performOfflineBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}break}case"backup-force-full":{try{await this.performRegularBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}catch(i){this.#n.info(`Online backup failed: ${i}. Attempting offline backup...`);try{await this.performOfflineBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}catch(o){this.#n.info(`Offline backup failed: ${o}. Attempting forced full offline backup...`),await this.performForcedFullBackup({sys:e.sys,credentials:e.credentials,fusionConfig:e.fusionConfig,volumePath:n,repositories:r})}}break}case"init-and-launch":{await this.step1CheckDirectories(n,r),this.addInitLog("log","Directories checked",{step:"check-directories"}),await this.step2ConfigureGitRepositories(n,r),this.addInitLog("log","Git repositories configured",{step:"configure-git-repos"}),await this.step3ConfigureGitUser(n,r),this.addInitLog("log","Git user configured",{step:"configure-git-user"}),await this.step4CollectRepoInfo(e,n,r),this.addInitLog("log","Repo info collected",{step:"collect-repo-info"});break}default:throw new Error(`Invalid mode: ${e.fusionConfig.mode}`)}return this.addInitLog("complete","Initialization completed successfully",{step:"init-success",success:!0}),!0}catch(n){let i=n instanceof Error?n.message:String(n),o=this.initStatusLogs.some(s=>s.type==="error"&&s.step&&s.step!=="init-failed");return this.addInitLog("complete",`Initialization failed with error: ${i}`,{step:o?void 0:"init-failed",success:!1,error:i}),e.sys.Sentry?.captureException(n,{tags:{operation:"init",...e.sentryTags}}),!1}}addInitLog(e,r,n){let i={id:++this.logIdCounter,timestamp:new Date().toISOString(),type:e,message:r,step:n?.step,error:n?.error,success:n?.success};this.#n.debug(`${i.timestamp} ${i.type} ${i.message}`),this.initStatusLogs.push(i),this.initStatusLogs.length>1e3&&this.initStatusLogs.splice(0,this.initStatusLogs.length-1e3),n?.step&&(this.initState.currentStep=n.step),e==="complete"&&(this.initState.isComplete=!0,this.initState.isRunning=!1,this.initState.success=n?.success??!1,this.initState.error=n?.error??this.initState.error,n?.gitDiagnostics&&(this.initState.gitDiagnostics=n.gitDiagnostics)),e==="error"&&n?.error&&(this.initState.error=n.error,n?.gitDiagnostics&&(this.initState.gitDiagnostics=n.gitDiagnostics))}clearInitLogs(){this.initStatusLogs.length=0,this.logIdCounter=0,this.initState.isRunning=!1,this.initState.isComplete=!1,this.initState.success=!1,this.initState.currentStep="initial",this.initState.error=void 0,this.initState.gitDiagnostics=void 0}async hasFilesButNoGit(e){if(fi.existsSync(e))try{let n=(await Li.readdir(e)).length>0,i=fi.existsSync(_i.join(e,".git"));return n&&!i}catch{return!1}return!1}async step1CheckDirectories(e,r){this.addInitLog("log","Checking directories",{step:"check-directories"}),fi.existsSync(e)||await Li.mkdir(e,{recursive:!0}),e.startsWith("/root")&&MDt("root"),this.addInitLog("log",`Volume directory exists: ${e}`,{step:"check-directories"});for(let n of r){let i=_i.join(e,n.path);if(fi.existsSync(i))this.addInitLog("log",`Directory already exists: ${i}`,{step:"check-directories"});else{this.addInitLog("log",`Creating directory: ${i}`,{step:"create-directories"});try{await Li.mkdir(i,{recursive:!0})}catch(o){let s=`Failed to create directory for ${n.repoName} at ${i}: ${o}`;throw this.addInitLog("error",s,{step:"create-directories",error:s}),new Error(s,{cause:o})}}}}async step2ConfigureGitRepositories(e,r){this.addInitLog("log","Configuring git repositories",{step:"configure-git-repos"});let n=_i.join(e,"temp-cloning"),i=async()=>{fi.existsSync(n)&&(this.addInitLog("log",`Removing temp cloning directory: ${n}`,{step:"configure-git-repos"}),await Li.rm(n,{recursive:!0,force:!0}))};await i(),this.addInitLog("log",`Creating temp cloning path: ${n}`,{step:"configure-git-repos"}),await Li.mkdir(n,{recursive:!0});let o=await this.fetchGitConfigsOnce();try{for(let s of r){let a=_i.join(e,s.path);this.addInitLog("log",`Processing repository: ${s.repoName}`,{step:"configure-git-repos"});let A=await this.isGitConfigured(a),c=!A;if(this.config.fusionConfig.rebuildGit&&A&&(this.addInitLog("log",`rebuildGit flag set, removing existing repo for ${s.repoName} to re-clone`,{step:"check-existing-git"}),await Li.rm(a,{recursive:!0,force:!0}),c=!0),A&&!c){if(s.enableGit&&o){let u=s===r.find(p=>p.enableGit),l=r.filter(p=>p.enableGit).length;this.applyGitConfig(s,o,u,l)}await this.cleanupLockFiles(a);try{s.enableGit?(this.addInitLog("log",`Git already configured for ${s.repoName}, validating repo`,{step:"check-existing-git"}),await this.validateGitRepo(a)):this.addInitLog("log",`Git already configured for ${s.repoName}, skipping validation because it's not main repo`,{step:"check-existing-git"})}catch(u){let l=`Git repo is in bad state for ${s.repoName}, will re-clone: ${u}`;this.config.sys.Sentry?.captureMessage(l,{level:"warning",tags:{operation:"init",...this.config.sentryTags},extra:{repoName:s.repoName,repoPath:a}}),this.addInitLog("error",l,{step:"check-existing-git",error:l})}if(!c){if(this.addInitLog("log","Git repo is in good state, checking remote URL",{step:"check-existing-git"}),s.initializationCommand){this.addInitLog("log","Skipping remote URL update because it has an initialization command",{step:"update-remote-url"});continue}if(!Dke(s))throw new Error("Remote URL update failed because repoUrl is undefined");if(await this.getGitRemoteUrl(a))try{await this.git(["remote","set-url","origin",s.repoUrl],a)}catch(l){let p=`Failed to update git remote URL for ${s.repoName}: ${l}`;throw this.addInitLog("error",p,{step:"update-remote-url",error:p}),new Error(p)}else{this.addInitLog("log",`Adding remote origin for ${s.repoName}`,{step:"check-existing-git"});try{await this.git(["remote","add","origin",s.repoUrl],a)}catch(l){let p=`Failed to add git remote origin for ${s.repoName}: ${l}`;throw this.addInitLog("error",p,{step:"check-existing-git",error:p}),new Error(p)}}if(this.config.fusionConfig.syncBranch&&s.enableGit&&!this.config.fusionConfig.isFork){let l=s.branchName||"main";try{let p=(await this.git(["rev-parse","HEAD"],a)).trim(),d=(await this.git(["ls-remote","origin",l],a)).trim().split(/\s/)[0]||"";p===d?this.addInitLog("log",`Snapshot git is already up-to-date with origin/${l}`,{step:"snapshot-git-sync"}):(this.addInitLog("log",`Snapshot git is behind origin/${l}, syncing...`,{step:"snapshot-git-sync"}),await this.git(["pull","--ff-only","origin",l],a),this.addInitLog("log",`Git synced to origin/${l}`,{step:"snapshot-git-sync"}))}catch(p){this.addInitLog("error",`Failed to sync git from snapshot: ${p}`,{step:"snapshot-git-sync",error:String(p)})}}if(this.config.fusionConfig.pvcCreationSource==="snapshot"&&s.backupMetadata&&s.enableGit){let l=this.config.fusionConfig.aiBranch||s.backupMetadata.check.backup.gitBranchName;if(await this.isBackupAlreadyApplied(a,l,s.backupMetadata.check.backup.lastCommitHash))this.addInitLog("log",`Backup already applied for ${s.repoName} (branch ${l} exists), skipping restore`,{step:"snapshot-backup-restore"}),await this.git(["checkout",l],a);else{this.addInitLog("log",`Snapshot volume detected with backup, downloading backup for ${s.repoName}`,{step:"snapshot-backup-restore"});let g=await sO(this.config.sys,s.backupMetadata);if(g.success)try{await this.restoreFromPartialBackup({repo:s,repoPath:a,backupResult:g}),this.addInitLog("log",`Restored backup on snapshot volume for ${s.repoName}`,{step:"snapshot-backup-restore"})}catch(d){throw this.addInitLog("error",`Failed to restore backup on snapshot volume: ${d}`,{step:"snapshot-backup-restore",error:String(d)}),d}else throw this.addInitLog("error",`Failed to download backup for snapshot restore: ${g.error}`,{step:"snapshot-backup-restore",error:g.error.message}),g.error}}}}if(c){if(await this.hasFilesButNoGit(a)){let d="Code directory already exists but is not a git repo";throw this.addInitLog("error",d,{step:"check-existing-git",error:d}),new Error(d)}let l=s.backupMetadata?await sO(this.config.sys,s.backupMetadata):void 0;if(l&&!l.success)throw this.addInitLog("error",`Failed to download backup for ${s.repoName}: ${l.error}`,{step:"clone-repo",error:l.error.message}),l.error;l?.success&&this.sys.Sentry?.setTag("backup",l.partial?"partial":"full");let p=_i.join(n,s.path),g=!1;if(s.initializationCommand){this.addInitLog("log","Running initialization command.",{step:"init-command"});let d=await this.runInitializationCommand({repo:s,tempCloningDir:n,repoPath:p,initCommand:s.initializationCommand});if(g=d.outcome,g)this.addInitLog("log",`Successfully initialized ${s.repoName}`,{step:"init-command"});else{let f=d.error?.message||"Failed to run initialization command.";throw this.addInitLog("error",f,{step:"init-command",error:f}),new Error(f)}}else{if(!Dke(s))throw new Error("repoUrl or repoName is undefined");if(this.addInitLog("log",`Cloning repository: ${s.repoName}`,{step:"clone-repo"}),g=await this.cloneRepository({repo:s,repoPath:p,backupResult:l}),g)this.addInitLog("log",`Successfully cloned ${s.repoName}`,{step:"clone-repo"});else{let d=`Failed to clone repository ${s.repoName}`;throw this.addInitLog("error",d,{step:"clone-repo",error:d}),new Error(d)}}if(l&&l.success&&l.partial)try{await this.restoreFromPartialBackup({repo:s,repoPath:p,backupResult:l})}catch(d){throw d}if(process.platform==="win32"&&fi.existsSync(a)){if((await Li.readdir(a)).length>0){let f=`Target directory ${a} already exists and is not empty. Cannot safely rename.`;throw this.addInitLog("error",f,{step:"configure-git-repos",error:f}),new Error(f)}this.addInitLog("log",`Removing empty directory before rename (Windows workaround): ${a}`,{step:"configure-git-repos"}),await Li.rm(a,{recursive:!0,force:!0})}await Li.rename(p,a),await this.markGitSafe(a)}}}catch(s){throw this.addInitLog("error",`Failed to configure git repositories: ${s}`,{step:"configure-git-repos",error:String(s)}),s}finally{await i()}}async step3ConfigureGitUser(e,r){this.addInitLog("log","Configuring git user",{step:"configure-git-user"});for(let n of r){let i=_i.join(e,n.path);this.addInitLog("log",`Setting git user for ${n.repoName}`,{step:"configure-git-user"});try{await this.git(["config","user.email","builder-bot@builder.io"],i),await this.git(["config","user.name","Builder.io"],i)}catch(o){let s=`Failed to configure git user for ${n.repoName}: ${o}`;throw this.addInitLog("error",s,{step:"configure-git-user",error:s}),new Error(s)}}}async step4CollectRepoInfo(e,r,n){this.addInitLog("log","Collecting repo info",{step:"collect-repo-info"}),this.initState.repos=[];for(let i of n){let o=_i.join(r,i.path);try{let s=await this.git(["rev-parse","HEAD"],o),a=await this.git(["branch","--show-current"],o),A={repoName:i.repoName||i.path,enabledGit:!!i.enableGit,lastCommitHash:s.trim(),branch:a.trim()};this.initState.repos.push(A),this.addInitLog("log",`Collected repo info: ${JSON.stringify(A)}`,{step:"collect-repo-info"})}catch(s){e.sys.Sentry?.captureException(s,{tags:{operation:"init",...e.sentryTags}})}}}async isGitConfigured(e){try{return await this.git(["rev-parse","--is-inside-work-tree"],e,void 0,void 0,!0),!0}catch{return!1}}async getGitRemoteUrl(e){try{return(await this.git(["config","--get","remote.origin.url"],e)).trim()}catch{return null}}isStandardGitHost(e){let r=["github.com","gitlab.com","bitbucket.org"];try{let n=new URL(e);return r.some(i=>n.hostname===i||n.hostname.endsWith(`.${i}`))}catch{return!1}}async checkHostConnectivity(e){try{let r=e.startsWith("git@")||e.startsWith("ssh://"),n,i;if(r){let o=e.match(/^(?:ssh:\/\/)?(?:[^@]+@)?([^/:]+)(?::|\/)/);if(!o)return{reachable:!1,error:"Invalid SSH repository URL format"};n=o[1],i=22}else{let o=e.match(/^https?:\/\/(?:[^@]+@)?([^/:?#]+)/);if(!o)return{reachable:!1,error:"Invalid repository URL format"};n=o[1],i=443}this.addInitLog("log",`Checking connectivity to host: ${n}:${i}`,{step:"clone-repo"});try{let o=[];try{o=await AY.default.resolve4(n),o.length>0&&this.addInitLog("log",`DNS resolved ${n} to IPv4: ${o.join(", ")}`,{step:"clone-repo"})}catch{o=await AY.default.resolve6(n),o.length>0&&this.addInitLog("log",`DNS resolved ${n} to IPv6: ${o.join(", ")}`,{step:"clone-repo"})}if(o.length===0)return{reachable:!1,hostname:n,error:`DNS resolution failed: no addresses found for ${n}`}}catch(o){let s=o instanceof Error?o.message:String(o);return{reachable:!1,hostname:n,error:`DNS resolution failed for ${n}: ${s}`}}try{let o=await this.checkConnectivityDirect(n,i);if(o.reachable)return o;let s=process.env.HTTP_PROXY||process.env.http_proxy;return s?(this.addInitLog("log",`Direct connection failed, trying proxy: ${s}`,{step:"clone-repo"}),await this.checkConnectivityViaProxy(n,i,s)):o}catch(o){let s=o instanceof Error?o.message:String(o);return{reachable:!1,hostname:n,error:`Connection attempt failed: ${s}`}}}catch(r){return{reachable:!1,error:`Unexpected error during connectivity check: ${r instanceof Error?r.message:String(r)}`}}}async checkConnectivityDirect(e,r){let i=wke.default.createConnection({host:e,port:r,timeout:5e3});return await new Promise(o=>{i.on("connect",()=>{i.destroy(),this.addInitLog("log",`Successfully connected to ${e}:${r}`,{step:"clone-repo"}),o({reachable:!0,hostname:e})}),i.on("error",s=>{i.destroy(),this.addInitLog("error",`Connection failed to ${e}:${r}: ${s.message}`,{step:"clone-repo",error:s.message}),o({reachable:!1,hostname:e,error:`Cannot connect to ${e}:${r}: ${s.message}`})}),i.on("timeout",()=>{i.destroy(),this.addInitLog("error",`Connection timeout to ${e}:${r} (${5e3/1e3}s)`,{step:"clone-repo",error:`Connection timeout to ${e}:${r} after ${5e3/1e3} seconds`}),o({reachable:!1,hostname:e,error:`Connection timeout to ${e}:${r} after ${5e3/1e3} seconds`})})})}async checkConnectivityViaProxy(e,r,n){try{this.addInitLog("log",`Attempting proxy connection to ${e}:${r} via proxy`,{step:"clone-repo"});let i=new URL(n),o=`${i.protocol}//${i.host}`,s=new tR.ProxyAgent({uri:o,token:i.username&&i.password?`Basic ${Buffer.from(`${i.username}:${i.password}`).toString("base64")}`:void 0}),a=`http://${e}:${r}`;return await(0,tR.fetch)(a,{dispatcher:s,signal:AbortSignal.timeout(3e4)}),this.addInitLog("log",`Successfully connected via proxy to ${e}:${r}`,{step:"clone-repo"}),{reachable:!0,hostname:e}}catch(i){return{reachable:!1,hostname:e,error:`Proxy connection failed: ${i instanceof Error?i.message:String(i)}`}}}async ensureParentDirExists(e){let r=_i.dirname(e);return await Li.mkdir(r,{recursive:!0}),r}async cleanupLockFiles(e){let r=_i.join(e,".git");try{let i=(await Li.readdir(r)).filter(s=>s.endsWith(".lock"));if(i.length===0)return;let o=[];for(let s of i){let a=_i.join(r,s);try{await Li.unlink(a),o.push(s)}catch(A){this.config.sys.Sentry?.captureException(new Error(`Failed to remove ${s} for ${e}: ${A}`),{tags:{operation:"init",...this.config.sentryTags}})}}o.length>0&&this.config.sys.Sentry?.captureMessage(`Lock files found for ${e} and removed: ${o.join(", ")}`,{tags:{operation:"init",...this.config.sentryTags}})}catch(n){this.config.sys.Sentry?.captureException(new Error(`Failed to cleanup lock files for ${e}: ${n}`),{tags:{operation:"init",...this.config.sentryTags}})}}async validateGitRepo(e){try{await this.git(["fsck","--connectivity-only"],e)}catch(r){throw new Error("Git repo is in bad state",{cause:r})}}async isBackupAlreadyApplied(e,r,n){try{let i=(await this.git(["rev-parse","--verify",`refs/heads/${r}`],e)).trim();return i?(await this.git(["merge-base","--is-ancestor",n,i],e),!0):!1}catch{return!1}}async restoreFromPartialBackup({repo:e,repoPath:r,backupResult:n}){try{this.addInitLog("log",`Checking for git backup for ${e.repoName}`,{step:"apply-partial-backup"});let i=async()=>{try{await this.git(["remote","remove","backup"],r)}catch(o){this.addInitLog("error",`Failed to cleanup restore: ${o}`,{step:"apply-partial-backup",error:String(o)})}};if(!n.bundlePath){try{this.addInitLog("log",`Found empty git backup, applying it to ${e.repoName}`,{step:"apply-partial-backup"});let o=this.config.fusionConfig.aiBranch||n.gitBranchName;await this.checkout(o,n.lastCommitHash,r)}catch(o){throw this.addInitLog("error",`Failed to checkout backup branch: ${o}`,{step:"apply-partial-backup",error:String(o)}),o}return}try{this.addInitLog("log",`Found git backup, applying it to ${e.repoName}`,{step:"apply-partial-backup"});try{await this.git(["remote","remove","backup"],r)}catch{}await this.git(["remote","add","backup",n.bundlePath],r),await this.git(["fetch","backup"],r);let o=n.gitBranchName,s=this.config.fusionConfig.aiBranch||o;s!==o?(this.addInitLog("log",`Creating new branch ${s} from backup/${o}`,{step:"apply-partial-backup"}),await this.git(["branch",s,`backup/${o}`],r),await this.git(["checkout",s],r)):await this.checkout(o,`backup/${o}`,r),this.addInitLog("log",`Successfully restored from backup to branch ${s}`,{step:"apply-partial-backup"}),await i(),this.addInitLog("log",`Cleaned up backup for ${e.repoName}`,{step:"apply-partial-backup"})}catch(o){throw await i(),this.addInitLog("error",String(o),{step:"apply-partial-backup",error:String(o)}),o}}catch(i){let o=new Error(`Failed to check git backup for ${e.repoName}. Cannot proceed without backup recovery.`,{cause:i});throw this.addInitLog("error",o.message,{step:"apply-partial-backup",error:String(i)}),o}}async initializeGitRepo(e,r){await this.git(["init"],e),await this.git(["add","."],e),await this.git(["branch","-M","main"],e),await this.git([...r?["-c","user.email=team@builder.io","-c","user.name=Builder.io"]:[],"commit","-m","Initial setup"],e)}async fetchGitConfigsOnce(){if(this.config.fusionConfig.projectId)try{let e=await hm(this.config.credentials,this.config.fusionConfig.projectId,this.debug);if(e.success)return Object.keys(e.gitConfigs).length>0?e.gitConfigs:void 0;e.gitDiagnostics&&(this.initState.gitDiagnostics=e.gitDiagnostics),this.config.sys.Sentry?.captureException(e.error,{tags:{operation:"init",endpoint:"fetch-git-configs",...this.config.sentryTags},extra:{gitDiagnostics:e.gitDiagnostics}})}catch(e){this.config.sys.Sentry?.captureException(new Error("Failed to fetch git configs in InitStateMachine",{cause:e instanceof Error?e:new Error(String(e))}),{tags:{operation:"init",endpoint:"fetch-git-configs",...this.config.sentryTags}})}}applyGitConfig(e,r,n,i){if(e.initializationCommand||e.repoUrl?.startsWith("ssh://")||e.repoUrl?.startsWith("git@"))return;let o;if(e.repoName&&r[e.repoName]?o=e.repoName:n&&(o=Object.keys(r)[0]),!o)return;let s=r[o];s?.url&&(e.repoUrl=s.url,n&&(e.repoName=o),(s.provider==="github"||s.provider==="selfHostedGithub")&&s.token&&(n&&(process.env.GH_TOKEN=s.token),i>1&&(process.env[yF(e.name)]=s.token)))}async runInitializationCommand({repo:e,tempCloningDir:r,repoPath:n,initCommand:i}){this.addInitLog("log",`Init command paths args: tempCloningDir: ${r} repoPath: ${n}`,{step:"init-command"});try{this.addInitLog("log",`Executing initialization command in ${r}`,{step:"init-command"});let o=process.env.SHELL||process.env.COMSPEC||"/bin/sh";try{let s=KA(o,i,{stdio:["ignore","pipe","pipe"],cwd:r,env:{...process.env,TERM:"dumb"}},!0),a=[],A=[];s.stdout?.on("data",c=>{a.push(c);let u=c.toString().trim();u&&this.addInitLog("log",u,{step:"init-command"})}),s.stderr?.on("data",c=>{A.push(c);let u=c.toString().trim();u&&this.addInitLog("error",u,{step:"init-command"})}),await new Promise((c,u)=>{s.on("error",l=>{u(l)}),s.on("close",l=>{if(l===0)c();else{let p=Buffer.concat(a).toString().trim(),g=Buffer.concat(A).toString().trim(),d=[`Command exited with code ${l}`,g&&`stderr: ${g}`,p&&`stdout: ${p}`].filter(Boolean).join(`
|
|
4505
4505
|
`);u(new Error(d))}})})}catch(s){let a=new Error("Failed to execute initCommand.",{cause:s});return this.addInitLog("error",a.message+`: ${s}`,{step:"init-command",error:String(s)}),{outcome:!1,error:a}}return{outcome:!0}}catch(o){return this.addInitLog("error",`Failed to run initialization command: ${o}`,{step:"init-command",error:String(o)}),{outcome:!1,error:o instanceof Error?o:new Error(String(o))}}}async cloneRepository({repo:e,repoPath:r,backupResult:n}){let i=[e.branchName??"main",null,"main","master"];if(n&&n.success&&!n.partial){if(!n.bundlePath)throw new Error("Full backups must have a bundle path");this.addInitLog("log",`Downloaded full git backup, cloning it to ${r}`,{step:"clone-repo"});try{let s=await this.ensureParentDirExists(r);await this.git(["clone",n.bundlePath,r],s,void 0,600*1e3),await this.markGitSafe(r);for(let c of i)if(c)try{await this.git(["checkout",c],r)}catch{continue}await this.checkout(n.gitBranchName,n.lastCommitHash,r);let a=(await this.git(["branch","--show-current"],r)).trim(),A=(await this.git(["rev-parse","HEAD"],r)).trim();if(a!==n.gitBranchName)throw new Error(`Backup branch ${n.gitBranchName} does not match local branch ${a}`);if(A!==n.lastCommitHash)throw new Error(`Backup commit hash ${n.lastCommitHash} does not match local commit hash ${A}`);return!0}catch(s){throw this.addInitLog("error",`Failed to clone git backup for ${e.repoName}: ${s}`,{step:"clone-repo",error:String(s)}),s}}let o=process.env.TEST_NEEDS_GIT_INIT==="1";if(!this.isStandardGitHost(e.repoUrl)){this.addInitLog("log",`Non-standard git host detected, checking connectivity to ${e.repoUrl}`,{step:"clone-repo"});let s=await this.checkHostConnectivity(e.repoUrl);if(!s.reachable){let a=`Git host unreachable: ${s.hostname||"unknown host"}. ${s.error||"Network connectivity check failed"}. This host may be behind a firewall or VPN.`,A=s.error?zb(s.error):null,c={provider:HU(e.repoUrl),hostname:s.hostname||"",sourceIp:"",repoName:e.repoName||"",issue:"network",...A&&{connectivityErrorCode:A.connectivityErrorCode,checkType:A.checkType,likelyCause:Vb(A.connectivityErrorCode)}};throw this.addInitLog("error",a,{step:"clone-repo",error:a,gitDiagnostics:c}),this.config.sys.Sentry?.captureException(new Error("Git host unreachable"),{tags:{operation:"init",...this.config.sentryTags},extra:{repo:e,connectivityResult:s,gitDiagnostics:c}}),new Error(a)}this.addInitLog("log",`Host connectivity verified for ${s.hostname}`,{step:"clone-repo"})}for(let s of i)try{let a=process.env.FUSION_TEMPLATE_DIR&&process.env.FUSION_TEMPLATE_DIR.trim().length>0?process.env.FUSION_TEMPLATE_DIR:"/template";if(fi.existsSync(a)&&e.repoName===em){if(this.addInitLog("log",`Starting copy of template to ${r}`,{step:"clone-repo"}),await this.execAsync("rm",["-rf",r],"/"),await this.execAsync("cp",["-a",a,r],"/"),this.addInitLog("log",`Copied from template for ${e.repoName}`,{step:"clone-repo"}),o)try{await this.initializeGitRepo(r,o)}catch(A){let c=`Failed to initialize git repo for ${e.repoName} after template copy: ${A}`;throw this.addInitLog("error",c,{step:"clone-repo",error:String(A)}),new Error(c)}return!0}else{let A=HU(e.repoUrl),c=A==="github"||A==="gitlab"||A==="selfHostedGithub",u=e.resetGit!==void 0?e.resetGit:$U.includes(e.repoName),l=n&&n.success&&n.partial,p=this.config.fusionConfig.isFork&&this.config.fusionConfig.prNumber,g=u&&e.enableGit&&!l&&!p,d=!e.enableGit||g?["clone","--depth","1"]:c?["clone","--filter=blob:none"]:["clone"];s&&d.push("-b",s),d.push(e.repoUrl,r),this.addInitLog("log",`Cloning repository: ${e.repoName} with branch: ${s||"default"}`,{step:"clone-repo"});let f=await this.ensureParentDirExists(r);if(await this.git(d,f,void 0,600*1e3),await this.markGitSafe(r),this.config.fusionConfig.isFork&&this.config.fusionConfig.prNumber){let h=this.config.fusionConfig.prNumber,C=this.config.fusionConfig.featureBranch||`pr-${h}`;this.addInitLog("log",`Fork PR detected - fetching PR #${h} using refs/pulls/${h}/head into branch ${C}`,{step:"clone-repo"});try{await this.git(["fetch","origin",`pull/${h}/head:${C}`],r),await this.git(["switch",C],r),this.addInitLog("log",`Successfully checked out fork PR #${h} on branch ${C}`,{step:"clone-repo"})}catch(I){let B=`Failed to fetch fork PR #${h}: ${I}`;throw this.addInitLog("error",B,{step:"clone-repo",error:String(I)}),new Error(B,{cause:I})}}return g&&(fi.rmSync(_i.join(r,".git"),{recursive:!0,force:!0}),await this.initializeGitRepo(r,o),this.addInitLog("log",`Cleared git history for ${e.repoName}`,{step:"clone-repo"})),!0}}catch(a){this.addInitLog("error",`Clone failed for branch ${s||"default"}: ${a}`,{step:"clone-repo",error:String(a)});continue}return!1}async markGitSafe(e){try{let r=await this.git(["config","--global","--get-all","safe.directory"],e);if(r.trim().split(`
|
|
4506
4506
|
`).includes(e))return r}catch{}return this.git(["config","--global","--add","safe.directory",e],e)}};function MDt(t){let e=[".npm",".local",".cache"];try{let r=`/${t}`,n=`/${t}-backup`;if(fi.existsSync(n)){let i=fi.readdirSync(n);for(let o of i)if(!e.includes(o)){let s=_i.join(r,o);if(!fi.existsSync(s))try{fi.cpSync(_i.join(n,o),s,{recursive:!0,force:!0})}catch(a){cY.error(`Failed to restore ${o} for ${t}: ${a}`)}}}}catch(r){cY.error(`Failed to restore ${t} backup: ${r}`)}}vE();M2();gn();nn();HA();m();var bke=z(require("@sentry/node"),1),vke=z(require("@amplitude/analytics-node"),1),rR=async()=>{let t=process.env.BUILDER_DISABLE_AMPLITUDE==="true",e=[bke.flush()];t||e.push(vke.flush().promise),await Promise.allSettled(e),process.exit(0)};function Ske(){process.on("SIGINT",rR),process.on("SIGTERM",rR)}function xke(){process.removeListener("SIGINT",rR),process.removeListener("SIGTERM",rR)}Pn();m();gn();nn();lm();m();Pt();var PDt=ke("EventLoopMonitor");function Fke(){let t,e=[],n=performance.now();return{consumeDelays:()=>{let i=[...e];return e.length=0,i},start:()=>{t||(n=performance.now(),t=setInterval(()=>{try{let i=performance.now(),o=i-n,s=Math.max(0,o-5e3);e.push(s),n=i}catch(i){PDt.error("Error sampling:",i)}},5e3),t.unref())},stop:()=>{t&&(clearInterval(t),t=void 0)}}}m();var kke=z(require("v8"),1);function Rke(){let t=process.constrainedMemory?.();if(t){let{rss:r}=process.memoryUsage();return Math.min(1,r/t)}let e=kke.getHeapStatistics();return Math.min(1,1-e.total_available_size/e.heap_size_limit)}var rA=z(require("node:os"),1),Nke=z(require("node:fs"),1),_Dt="/root";function LDt(){try{let t=Nke.statfsSync(_Dt),e=t.bsize*t.blocks,r=t.bsize*t.bavail;if(e===0)return;let n=e-r,i=Math.min(1,Math.max(0,n/e));return{bytes:n,ratio:i}}catch{return}}function UDt(){try{let t=rA.totalmem(),e=rA.freemem();if(t===0)return;let r=t-e,n=Math.min(1,Math.max(0,r/t));return{bytes:r,ratio:n}}catch{return}}function Tke(t,e,r,n){let i=null,o=Fke(),s,a,A=async()=>{try{let c=new URL(`${Oe}/projects/machine-status`);e.builderPublicKey&&c.searchParams.set("apiKey",e.builderPublicKey),e.userId&&c.searchParams.set("userId",e.userId);let u=_le(),l;u&&r.machine?l={...r.machine,environment:n.fusionEnvironment}:u||(l={cpus:rA.cpus().length,memory:Math.round(rA.totalmem()/(1024*1024*1024)),platform:rA.platform(),arch:rA.arch(),environment:"local"});let p=o.consumeDelays(),g=Rke(),d=LDt(),f=UDt();n.diskUsage=d?.ratio,n.memoryUsage=f?.ratio,d!==void 0&&(s=s===void 0?d.bytes:Math.max(s,d.bytes)),f!==void 0&&(a=a===void 0?f.bytes:Math.max(a,f.bytes));let h={status:"ok",state:n.state,setupState:n.setupState,devState:n.devState,editorReady:n.editorReady,httpServerState:n.httpServerState,initState:n.initState,errorMessage:n.errorMessage,devToolsVersion:n.devToolsVersion,idleTime:performance.now()-n.lastRequestTime,upTime:performance.now()-n.startTime,machine:l,projectId:r.projectId,detectedServerUrl:n.detectedServerUrl,_attemptDryRunBackupOutcome:n._attemptDryRunBackupOutcome,workingDirectory:n.workingDirectory,fusionEnvironment:n.fusionEnvironment,containerState:n.containerState,containerStateTimestamp:n.containerStateTimestamp,wsClients:t.connectionTracker.getConnectionCount(),httpClients:n.httpClients,eventLoopDelays:p.length>0?p:void 0,memoryPressure:g,diskUsage:d?.ratio,memoryUsage:f?.ratio},C={"Content-Type":"application/json"};e.builderPrivateKey&&(C.Authorization=`Bearer ${e.builderPrivateKey}`),await Ue(c,{method:"POST",body:JSON.stringify(h),headers:C,keepalive:!0,signal:AbortSignal.timeout(5e3)})}catch{}};return{start:()=>{if(i)return;o.start(),A();let c=30*1e3;i=setInterval(A,c)},stop:()=>{i&&(clearInterval(i),i=null),o.stop()},getPeakUsage:()=>({peakDiskUsage:s,peakMemoryUsage:a})}}eO();m();var Tu=require("node:fs"),Mke=require("fs/promises");m();gn();nn();async function nR(t,e,r){try{let n=new URL(`${Oe}/projects/metrics`);e.builderPublicKey&&n.searchParams.set("apiKey",e.builderPublicKey),e.userId&&n.searchParams.set("userId",e.userId);let i={"Content-Type":"application/json"};e.builderPrivateKey&&(i.Authorization=`Bearer ${e.builderPrivateKey}`),await Ue(n,{method:"POST",body:JSON.stringify(r),headers:i,keepalive:!0,signal:AbortSignal.timeout(5e3)})}catch(n){t.Sentry?.captureException(new Error("Failed to push metrics",{cause:n}))}}mr();Pn();Pt();var Ed=ke("DryRunBackup"),iR="/app-backup-test",uY="/app/.mark",lY={operation:"dry-run-backup-git",dryRunBackupGit:"true"},Pke=async(t,e)=>{let r=await ODt(t,e);return r&&(r.success?G.success("\u2705 Dry run backup git succeeded"):(G.error(`\u274C Dry run backup git failed: ${r.error}`),t.sys.Sentry?.captureException(new Error(`Attempted dry run backup failed: ${r.error}`),{tags:lY})),nR(t.sys,t.credentials,{counters:[{key:"projects_backup_dry_run_ended",value:1,attributes:{outcome:r.success?"success":r.error??"unknown",version:vt}}]}),r)},ODt=async({sys:t,fusionConfig:e,credentials:r},n)=>{function i(o){let s=e.workspace?.folders.find(c=>c.backupMetadata)?.backupMetadata?.check,a=n.repos.find(c=>c.enabledGit),A=o.initState.repos.find(c=>c.enabledGit);return JSON.stringify({backupCheck:s,mainRepo:a,backupMainRepo:A},null,2)}try{let o=process.env.FLY_MACHINE_ID??"unknown";if((0,Tu.existsSync)(uY)&&(0,Tu.readFileSync)(uY,"utf8")===o)return null;if((0,Tu.writeFileSync)(uY,o),G.info("Attempting dry run backup git"),n.currentStep!=="init-success")return{success:!1,error:"main-init-failed"};(0,Tu.existsSync)(iR)&&await(0,Mke.rm)(iR,{recursive:!0,force:!0}),(0,Tu.mkdirSync)(iR,{recursive:!0});let s=new dC({sys:t,fusionConfig:{...e,_attemptDryRunBackupGit:!1,workingDirectory:iR},debug:!0,credentials:r,sentryTags:lY}),a=await s.init(),A=i(s);if(!a)return Ed.error(`\u274C Backup failed: ${s.initState.currentStep}
|
|
4507
4507
|
${A}`),{success:!1,error:`backup-failed:${s.initState.currentStep}`};let c=s.initState.repos.find(p=>p.enabledGit);if(!c)return Ed.error(`\u274C Backup repo not found
|
|
@@ -6974,7 +6974,7 @@ ${t.message}`,t}},IPe=(t,e)=>{if(e===CPe())return t;let r;try{r=(0,dPe.statSync)
|
|
|
6974
6974
|
${n.message}
|
|
6975
6975
|
${t}`}return r.isDirectory()?t:`The "cwd" option is not a directory: ${e}.
|
|
6976
6976
|
${t}`};var uN=(t,e,r)=>{r.cwd=hPe(r.cwd);let[n,i,o]=APe(t,e,r),{command:s,args:a,options:A}=BPe.default._parse(n,i,o),c=NTe(A),u=dSt(c);return oPe(u),pPe(u),uPe(u),CMe(u),rPe(u),u.shell=XY(u.shell),u.env=fSt(u),u.killSignal=lMe(u.killSignal),u.forceKillAfterDelay=fMe(u.forceKillAfterDelay),u.lines=u.lines.map((l,p)=>l&&!Bs.has(u.encoding)&&u.buffer[p]),Iq.default.platform==="win32"&&EPe.default.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},dSt=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:o=!0,cleanup:s=!0,all:a=!1,windowsHide:A=!0,killSignal:c="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:l=!1,ipcInput:p,ipc:g=p!==void 0||l,serialization:d="advanced",...f})=>({...f,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:o,cleanup:s,all:a,windowsHide:A,killSignal:c,forceKillAfterDelay:u,gracefulCancel:l,ipcInput:p,ipc:g,serialization:d}),fSt=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...Iq.default.env,...t}:t;return r||n?ZTe({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s};m();var lN=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r];m();m();var $Pe=require("node:util");m();function wC(t){if(typeof t=="string")return mSt(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return hSt(t)}var mSt=t=>t.at(-1)===yPe?t.slice(0,t.at(-2)===QPe?-2:-1):t,hSt=t=>t.at(-1)===CSt?t.subarray(0,t.at(-2)===ISt?-2:-1):t,yPe=`
|
|
6977
|
-
`,CSt=yPe.codePointAt(0),QPe="\r",ISt=QPe.codePointAt(0);m();m();var PPe=require("node:events"),_Pe=require("node:stream/promises");m();m();function ESt(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function DPe(t,{checkOpen:e=!0}={}){return ESt(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}m();m();var BSt=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),Eq=class{#
|
|
6977
|
+
`,CSt=yPe.codePointAt(0),QPe="\r",ISt=QPe.codePointAt(0);m();m();var PPe=require("node:events"),_Pe=require("node:stream/promises");m();m();function ESt(t,{checkOpen:e=!0}={}){return t!==null&&typeof t=="object"&&(t.writable||t.readable||!e||t.writable===void 0&&t.readable===void 0)&&typeof t.pipe=="function"}function DPe(t,{checkOpen:e=!0}={}){return ESt(t,{checkOpen:e})&&(t.readable||!e)&&typeof t.read=="function"&&typeof t.readable=="boolean"&&typeof t.readableObjectMode=="boolean"&&typeof t.destroy=="function"&&typeof t.destroyed=="boolean"}m();m();var BSt=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),Eq=class{#n;#c;#o=!1;#t=void 0;constructor(e,r){this.#n=e,this.#c=r}next(){let e=()=>this.#A();return this.#t=this.#t?this.#t.then(e,e):e(),this.#t}return(e){let r=()=>this.#i(e);return this.#t?this.#t.then(r,r):r()}async#A(){if(this.#o)return{done:!0,value:void 0};let e;try{e=await this.#n.read()}catch(r){throw this.#t=void 0,this.#o=!0,this.#n.releaseLock(),r}return e.done&&(this.#t=void 0,this.#o=!0,this.#n.releaseLock()),e}async#i(e){if(this.#o)return{done:!0,value:e};if(this.#o=!0,!this.#c){let r=this.#n.cancel(e);return this.#n.releaseLock(),await r,{done:!0,value:e}}return this.#n.releaseLock(),{done:!0,value:e}}},Bq=Symbol();function wPe(){return this[Bq].next()}Object.defineProperty(wPe,"name",{value:"next"});function bPe(t){return this[Bq].return(t)}Object.defineProperty(bPe,"name",{value:"return"});var ySt=Object.create(BSt,{next:{enumerable:!0,configurable:!0,writable:!0,value:wPe},return:{enumerable:!0,configurable:!0,writable:!0,value:bPe}});function yq({preventCancel:t=!1}={}){let e=this.getReader(),r=new Eq(e,t),n=Object.create(ySt);return n[Bq]=r,n}m();var vPe=t=>{if(DPe(t,{checkOpen:!1})&&AD.on!==void 0)return DSt(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(QSt.call(t)==="[object ReadableStream]")return yq.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:QSt}=Object.prototype,DSt=async function*(t){let e=new AbortController,r={};wSt(t,e,r);try{for await(let[n]of AD.on(t,"data",{signal:e.signal}))yield n}catch(n){if(r.error!==void 0)throw r.error;if(!e.signal.aborted)throw n}finally{t.destroy()}},wSt=async(t,e,r)=>{try{await AD.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},AD={};m();m();m();var bC=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:A=Number.POSITIVE_INFINITY}={})=>{let c=vPe(t),u=e();u.length=0;try{for await(let l of c){let p=vSt(l),g=r[p](l,u);FPe({convertedChunk:g,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:A})}return bSt({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,maxBuffer:A}),a(u)}catch(l){let p=typeof l=="object"&&l!==null?l:new Error(l);throw p.bufferedData=a(u),p}},bSt=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&FPe({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},FPe=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){SPe(t,e,i,a);return}let A=n(t,o-e.length);throw A!==void 0&&SPe(A,e,i,o),new yc},SPe=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},vSt=t=>{let e=typeof t;if(e==="string")return"string";if(e!=="object"||t===null)return"others";if(globalThis.Buffer?.isBuffer(t))return"buffer";let r=xPe.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&xPe.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:xPe}=Object.prototype,yc=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}};m();var Lu=t=>t,cD=()=>{},gN=({contents:t})=>t,pN=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},dN=t=>t.length;async function fN(t,e){return bC(t,kSt,e)}var SSt=()=>({contents:[]}),xSt=()=>1,FSt=(t,{contents:e})=>(e.push(t),e),kSt={init:SSt,convertChunk:{string:Lu,buffer:Lu,arrayBuffer:Lu,dataView:Lu,typedArray:Lu,others:Lu},getSize:xSt,truncateChunk:cD,addChunk:FSt,getFinalChunk:cD,finalize:gN};m();async function mN(t,e){return bC(t,OSt,e)}var RSt=()=>({contents:new ArrayBuffer(0)}),NSt=t=>TSt.encode(t),TSt=new TextEncoder,kPe=t=>new Uint8Array(t),RPe=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),MSt=(t,e)=>t.slice(0,e),PSt=(t,{contents:e,length:r},n)=>{let i=MPe()?LSt(e,n):_St(e,n);return new Uint8Array(i).set(t,r),i},_St=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(TPe(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},LSt=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:TPe(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},TPe=t=>NPe**Math.ceil(Math.log(t)/Math.log(NPe)),NPe=2,USt=({contents:t,length:e})=>MPe()?t:t.slice(0,e),MPe=()=>"resize"in ArrayBuffer.prototype,OSt={init:RSt,convertChunk:{string:NSt,buffer:kPe,arrayBuffer:kPe,dataView:RPe,typedArray:RPe,others:pN},getSize:dN,truncateChunk:MSt,addChunk:PSt,getFinalChunk:cD,finalize:USt};m();async function CN(t,e){return bC(t,JSt,e)}var GSt=()=>({contents:"",textDecoder:new TextDecoder}),hN=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),KSt=(t,{contents:e})=>e+t,HSt=(t,e)=>t.slice(0,e),$St=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},JSt={init:GSt,convertChunk:{string:Lu,buffer:hN,arrayBuffer:hN,dataView:hN,typedArray:hN,others:pN},getSize:dN,truncateChunk:HSt,addChunk:KSt,getFinalChunk:$St,finalize:gN};Object.assign(AD,{on:PPe.on,finished:_Pe.finished});var LPe=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:o})=>{if(!(t instanceof yc))throw t;if(o==="all")return t;let s=jSt(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},jSt=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",UPe=(t,e,r)=>{if(e.length!==r)return;let n=new yc;throw n.maxBufferInfo={fdNumber:"ipc"},n},OPe=(t,e)=>{let{streamName:r,threshold:n,unit:i}=YSt(t,e);return`Command's ${r} was larger than ${n} ${i}`},YSt=(t,e)=>{if(t?.maxBufferInfo===void 0)return{streamName:"output",threshold:e[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:r,unit:n}}=t;delete t.maxBufferInfo;let i=_u(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:_R(r),threshold:i,unit:n}},GPe=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>IN(r)),KPe=(t,e,r)=>{if(!e)return t;let n=IN(r);return t.length>n?t.slice(0,n):t},IN=([,t])=>t;var JPe=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:o,exitCode:s,escapedCommand:a,timedOut:A,isCanceled:c,isGracefullyCanceled:u,isMaxBuffer:l,isForcefullyTerminated:p,forceKillAfterDelay:g,killSignal:d,maxBuffer:f,timeout:h,cwd:C})=>{let I=n?.code,B=qSt({originalError:n,timedOut:A,timeout:h,isMaxBuffer:l,maxBuffer:f,errorCode:I,signal:i,signalDescription:o,exitCode:s,isCanceled:c,isGracefullyCanceled:u,isForcefullyTerminated:p,forceKillAfterDelay:g,killSignal:d}),E=zSt(n,C),y=E===void 0?"":`
|
|
6978
6978
|
${E}`,D=`${B}: ${a}${y}`,b=e===void 0?[t[2],t[1]]:[e],Q=[D,...b,...t.slice(3),r.map(v=>WSt(v)).join(`
|
|
6979
6979
|
`)].map(v=>rD(wC(ZSt(v)))).filter(Boolean).join(`
|
|
6980
6980
|
|
|
@@ -6986,7 +6986,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
|
|
|
6986
6986
|
`,LF:`
|
|
6987
6987
|
`,concatBytes:Pq},lFt=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},gFt={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:lFt};m();var F_e=require("node:buffer");var k_e=(t,e)=>t?void 0:pFt.bind(void 0,e),pFt=function*(t,e){if(typeof e!="string"&&!ri(e)&&!F_e.Buffer.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},R_e=(t,e)=>t?dFt.bind(void 0,e):fFt.bind(void 0,e),dFt=function*(t,e){N_e(t,e),yield e},fFt=function*(t,e){if(N_e(t,e),typeof e!="string"&&!ri(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},N_e=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
|
|
6988
6988
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
6989
|
-
if (condition) { yield value; }`)};m();var T_e=require("node:buffer"),M_e=require("node:string_decoder");var vN=(t,e,r)=>{if(r)return;if(t)return{transform:mFt.bind(void 0,new TextEncoder)};let n=new M_e.StringDecoder(e);return{transform:hFt.bind(void 0,n),final:CFt.bind(void 0,n)}},mFt=function*(t,e){T_e.Buffer.isBuffer(e)?yield Pu(e):typeof e=="string"?yield t.encode(e):yield e},hFt=function*(t,e){yield ri(e)?t.write(e):e},CFt=function*(t){let e=t.end();e!==""&&(yield e)};m();var Lq=require("node:util"),Uq=(0,Lq.callbackify)(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),SN=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=EFt}=e[r];for await(let i of n(t))yield*SN(i,e,r+1)},P_e=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*IFt(r,Number(e),t)},IFt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*SN(n,r,e+1)},__e=(0,Lq.callbackify)(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),EFt=function*(t){yield t};m();var Oq=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},L_e=(t,e)=>[...e.flatMap(r=>[...xd(r,t,0)]),...gD(t)],xd=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=yFt}=e[r];for(let i of n(t))yield*xd(i,e,r+1)},gD=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*BFt(r,Number(e),t)},BFt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*xd(n,r,e+1)},yFt=function*(t){yield t};var Gq=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},A=U_e(t,s,o),c=Sd(e),u=Sd(r),l=c?Uq.bind(void 0,SN,a):Oq.bind(void 0,xd),p=c||u?Uq.bind(void 0,P_e,a):Oq.bind(void 0,gD),g=c||u?__e.bind(void 0,a):void 0;return{stream:new pD.Transform({writableObjectMode:n,writableHighWaterMark:(0,pD.getDefaultHighWaterMark)(n),readableObjectMode:i,readableHighWaterMark:(0,pD.getDefaultHighWaterMark)(i),transform(f,h,C){l([f,A,0],this,C)},flush(f){p([A],this,f)},destroy:g})}},xN=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let A=U_e(s,r,a);t=L_e(A,t)}return t},U_e=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let A={};return[{transform:k_e(n,a)},vN(r,s,n),bN(r,o,n,A),{transform:t,final:e},{transform:R_e(i,a)},x_e({binary:r,preserveNewlines:o,readableObjectMode:i,state:A})].filter(Boolean)};var O_e=(t,e)=>{for(let r of QFt(t))DFt(t,r,e)},QFt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),DFt=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:A}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${A}\`, can be ${Bg[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>wFt(a,n));r.input=tD(s)},wFt=(t,e)=>{let r=xN(t,e,"utf8",!0);return bFt(r),tD(r)},bFt=t=>{let e=t.find(r=>typeof r!="string"&&!ri(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};m();var kN=require("node:fs");m();var FN=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&EC(r,n)&&!Bs.has(e)&&vFt(n)&&(t.some(({type:i,value:o})=>i==="native"&&SFt.has(o))||t.every(({type:i})=>Ca.has(i))),vFt=t=>t===1||t===2,SFt=new Set(["pipe","overlapped"]),G_e=async(t,e,r,n)=>{for await(let i of t)xFt(e)||H_e(i,r,n)},K_e=(t,e,r)=>{for(let n of t)H_e(n,e,r)},xFt=t=>t._readableState.pipes.length>0,H_e=(t,e,r)=>{let n=HR(t);Ic({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var $_e=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((A,c)=>FFt({result:A,fileDescriptors:t,fdNumber:c,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},FFt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:A,lines:c,stripFinalNewline:u,maxBuffer:l})=>{if(t===null)return;let p=KPe(t,o,l),g=Pu(p),{stdioItems:d,objectMode:f}=e[r],h=kFt([g],d,A,n),{serializedResult:C,finalResult:I=C}=RFt({chunks:h,objectMode:f,encoding:A,lines:c,stripFinalNewline:u,fdNumber:r});NFt({serializedResult:C,fdNumber:r,state:n,verboseInfo:s,encoding:A,stdioItems:d,objectMode:f});let B=a[r]?I:void 0;try{return n.error===void 0&&TFt(C,d,i),B}catch(E){return n.error=E,B}},kFt=(t,e,r,n)=>{try{return xN(t,e,r,!1)}catch(i){return n.error=i,t}},RFt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:tD(t)};let s=DTe(t,r);return n[o]?{serializedResult:s,finalResult:_q(s,!i[o],e)}:{serializedResult:s}},NFt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!FN({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=_q(t,!1,s);try{K_e(a,e,n)}catch(A){r.error??=A}},TFt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>QN.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?(0,kN.appendFileSync)(n,t):(r.add(o),(0,kN.writeFileSync)(n,t))}};m();var J_e=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Uu(e,r,"all")]:Array.isArray(e)?[Uu(t,r,"all"),...e]:ri(t)&&ri(e)?eq([t,e]):`${t}${e}`};m();m();var RN=require("node:events");var j_e=async(t,e)=>{let[r,n]=await MFt(t);return e.isForcefullyTerminated??=!1,[r,n]},MFt=async t=>{let[e,r]=await Promise.allSettled([(0,RN.once)(t,"spawn"),(0,RN.once)(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Y_e(t):r.value},Y_e=async t=>{try{return await(0,RN.once)(t,"exit")}catch{return Y_e(t)}},q_e=async t=>{let[e,r]=await t;if(!PFt(e,r)&&Kq(e,r))throw new aA;return[e,r]},PFt=(t,e)=>t===void 0&&e===void 0,Kq=(t,e)=>t!==0||e!==null;var V_e=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=_Ft(t,e,r),s=o?.code==="ETIMEDOUT",a=GPe(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},_Ft=(t,e,r)=>t!==void 0?t:Kq(e,r)?new aA:void 0;var W_e=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:A,options:c,fileDescriptors:u}=LFt(t,e,r),l=GFt({file:n,commandArguments:i,options:c,command:o,escapedCommand:s,verboseInfo:A,fileDescriptors:u,startTime:a});return SC(l,A,c)},LFt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=JR(t,e,r),a=UFt(r),{file:A,commandArguments:c,options:u}=uN(t,e,a);OFt(u);let l=w_e(u,s);return{file:A,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:l}},UFt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,OFt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&NN("ipcInput"),t&&NN("ipc: true"),r&&NN("detached: true"),n&&NN("cancelSignal")},NN=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},GFt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let A=KFt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(A.failed)return A;let{resultError:c,exitCode:u,signal:l,timedOut:p,isMaxBuffer:g}=V_e(A,r),{output:d,error:f=c}=$_e({fileDescriptors:s,syncResult:A,options:r,isMaxBuffer:g,verboseInfo:o}),h=d.map((I,B)=>Uu(I,r,B)),C=Uu(J_e(d,r),r,"all");return $Ft({error:f,exitCode:u,signal:l,timedOut:p,isMaxBuffer:g,stdio:h,all:C,options:r,command:n,escapedCommand:i,startTime:a})},KFt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{O_e(o,r);let a=HFt(r);return(0,z_e.spawnSync)(...lN(t,e,a))}catch(a){return vC({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},HFt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:IN(e)}),$Ft=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:A,escapedCommand:c,startTime:u})=>t===void 0?EN({command:A,escapedCommand:c,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):uD({error:t,command:A,escapedCommand:c,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});m();var oLe=require("node:events"),sLe=require("node:child_process");m();var $q=z(require("node:process"),1);m();var FC=require("node:events");var Z_e=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(yC({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:nN(t)}),JFt({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),JFt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{XR(e,i);let o=Eg(t,e,r),s=new AbortController;try{return await Promise.race([jFt(o,n,s),YFt(o,r,s),qFt(o,r,s)])}catch(a){throw QC(t),a}finally{s.abort(),eN(e,i)}},jFt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await(0,FC.once)(t,"message",{signal:r});return n}for await(let[n]of(0,FC.on)(t,"message",{signal:r}))if(e(n))return n},YFt=async(t,e,{signal:r})=>{await(0,FC.once)(t,"disconnect",{signal:r}),EMe(e)},qFt=async(t,e,{signal:r})=>{let[n]=await(0,FC.once)(t,"strict:error",{signal:r});throw zR(n,e)};m();var dD=require("node:events");var e1e=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>Hq({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),Hq=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{yC({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:nN(t)}),XR(e,o);let s=Eg(t,e,r),a=new AbortController,A={};return VFt(t,s,a),zFt({ipcEmitter:s,isSubprocess:r,controller:a,state:A}),WFt({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:A,reference:o})},VFt=async(t,e,r)=>{try{await(0,dD.once)(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},zFt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await(0,dD.once)(t,"strict:error",{signal:r.signal});n.error=zR(i,e),r.abort()}catch{}},WFt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[A]of(0,dD.on)(r,"message",{signal:o.signal}))X_e(s),yield A}catch{X_e(s)}finally{o.abort(),eN(e,a),n||QC(t),i&&await t}},X_e=({error:t})=>{if(t)throw t};var t1e=(t,{ipc:e})=>{Object.assign(t,n1e(t,!1,e))},r1e=()=>{let t=$q.default,e=!0,r=$q.default.channel!==void 0;return{...n1e(t,e,r),getCancelSignal:ePe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},n1e=(t,e,r)=>({sendMessage:aN.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Z_e.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:e1e.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});m();var i1e=require("node:child_process"),yg=require("node:stream");var o1e=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{Nq(n);let a=new i1e.ChildProcess;ZFt(a,n),Object.assign(a,{readable:XFt,writable:ekt,duplex:tkt});let A=vC({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),c=rkt(A,s,i);return{subprocess:a,promise:c}},ZFt=(t,e)=>{let r=fD(),n=fD(),i=fD(),o=Array.from({length:e.length-3},fD),s=fD(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},fD=()=>{let t=new yg.PassThrough;return t.end(),t},XFt=()=>new yg.Readable({read(){}}),ekt=()=>new yg.Writable({write(){}}),tkt=()=>new yg.Duplex({read(){},write(){}}),rkt=async(t,e,r)=>SC(t,e,r);m();var kC=require("node:fs"),a1e=require("node:buffer"),Dc=require("node:stream");var A1e=(t,e)=>wN(nkt,t,e,!1),mD=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Bg[t]}.`)},s1e={fileNumber:mD,generator:Gq,asyncGenerator:Gq,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Dc.Duplex.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},nkt={input:{...s1e,fileUrl:({value:t})=>({stream:(0,kC.createReadStream)(t)}),filePath:({value:{file:t}})=>({stream:(0,kC.createReadStream)(t)}),webStream:({value:t})=>({stream:Dc.Readable.fromWeb(t)}),iterable:({value:t})=>({stream:Dc.Readable.from(t)}),asyncIterable:({value:t})=>({stream:Dc.Readable.from(t)}),string:({value:t})=>({stream:Dc.Readable.from(t)}),uint8Array:({value:t})=>({stream:Dc.Readable.from(a1e.Buffer.from(t))})},output:{...s1e,fileUrl:({value:t})=>({stream:(0,kC.createWriteStream)(t)}),filePath:({value:{file:t,append:e}})=>({stream:(0,kC.createWriteStream)(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Dc.Writable.fromWeb(t)}),iterable:mD,asyncIterable:mD,string:mD,uint8Array:mD}};m();m();var hD=require("node:events"),MN=require("node:stream"),Yq=require("node:stream/promises");function Fd(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)jq(i);let e=t.some(({readableObjectMode:i})=>i),r=ikt(t,e),n=new Jq({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var ikt=(t,e)=>{if(t.length===0)return(0,MN.getDefaultHighWaterMark)(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},Jq=class extends MN.PassThrough{#r=new Set([]);#c=new Set([]);#o=new Set([]);#t;#A=Symbol("unpipe");#i=new WeakMap;add(e){if(jq(e),this.#r.has(e))return;this.#r.add(e),this.#t??=okt(this,this.#r,this.#A);let r=Akt({passThroughStream:this,stream:e,streams:this.#r,ended:this.#c,aborted:this.#o,onFinished:this.#t,unpipeEvent:this.#A});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(jq(e),!this.#r.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},okt=async(t,e,r)=>{TN(t,c1e);let n=new AbortController;try{await Promise.race([skt(t,n),akt(t,e,r,n)])}finally{n.abort(),TN(t,-c1e)}},skt=async(t,{signal:e})=>{try{await(0,Yq.finished)(t,{signal:e,cleanup:!0})}catch(r){throw l1e(t,r),r}},akt=async(t,e,r,{signal:n})=>{for await(let[i]of(0,hD.on)(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},jq=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Akt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{TN(t,u1e);let a=new AbortController;try{await Promise.race([ckt(o,e,a),ukt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),lkt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),TN(t,-u1e)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?qq(t):gkt(t))},ckt=async(t,e,{signal:r})=>{try{await t,r.aborted||qq(e)}catch(n){r.aborted||l1e(e,n)}},ukt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await(0,Yq.finished)(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;g1e(s)?i.add(e):p1e(t,s)}},lkt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await(0,hD.once)(t,i,{signal:o}),!t.readable)return(0,hD.once)(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},gkt=t=>{t.writable&&t.end()},l1e=(t,e)=>{g1e(e)?qq(t):p1e(t,e)},g1e=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",qq=t=>{(t.readable||t.writable)&&t.destroy()},p1e=(t,e)=>{t.destroyed||(t.once("error",pkt),t.destroy(e))},pkt=()=>{},TN=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},c1e=2,u1e=1;m();var Vq=require("node:stream/promises");var RC=(t,e)=>{t.pipe(e),dkt(t,e),fkt(t,e)},dkt=async(t,e)=>{if(!(sA(t)||sA(e))){try{await(0,Vq.finished)(t,{cleanup:!0,readable:!0,writable:!1})}catch{}zq(e)}},zq=t=>{t.writable&&t.end()},fkt=async(t,e)=>{if(!(sA(t)||sA(e))){try{await(0,Vq.finished)(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Wq(t)}},Wq=t=>{t.readable&&t.destroy()};var d1e=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:A})=>Ca.has(A)))mkt(t,a,s,i);for(let{stream:a}of o.filter(({type:A})=>!Ca.has(A)))Ckt({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fd(o);RC(s,i)}},mkt=(t,e,r,n)=>{r==="output"?RC(t.stdio[n],e):RC(e,t.stdio[n]);let i=hkt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},hkt=["stdin","stdout","stderr"],Ckt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Ikt(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],A=i.get(s)??[];i.set(s,[...A,a])},Ikt=(t,{signal:e})=>{sA(t)&&vd(t,Ekt,e)},Ekt=2;m();var m1e=require("node:events");m();m();var kd=[];kd.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&kd.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&kd.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var PN=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",Zq=Symbol.for("signal-exit emitter"),Xq=globalThis,Bkt=Object.defineProperty.bind(Object),e5=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Xq[Zq])return Xq[Zq];Bkt(Xq,Zq,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},_N=class{},ykt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),t5=class extends _N{onExit(){return()=>{}}load(){}unload(){}},r5=class extends _N{#r=n5.platform==="win32"?"SIGINT":"SIGHUP";#c=new e5;#o;#t;#A;#i={};#e=!1;constructor(e){super(),this.#o=e,this.#i={};for(let r of kd)this.#i[r]=()=>{let n=this.#o.listeners(r),{count:i}=this.#c,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#c.emit("exit",null,r),a=r==="SIGHUP"?this.#r:r;s||e.kill(e.pid,a)}};this.#A=e.reallyExit,this.#t=e.emit}onExit(e,r){if(!PN(this.#o))return()=>{};this.#e===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#c.on(n,e),()=>{this.#c.removeListener(n,e),this.#c.listeners.exit.length===0&&this.#c.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#e){this.#e=!0,this.#c.count+=1;for(let e of kd)try{let r=this.#i[e];r&&this.#o.on(e,r)}catch{}this.#o.emit=(e,...r)=>this.#B(e,...r),this.#o.reallyExit=e=>this.#s(e)}}unload(){this.#e&&(this.#e=!1,kd.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#o.removeListener(e,r)}catch{}}),this.#o.emit=this.#t,this.#o.reallyExit=this.#A,this.#c.count-=1)}#s(e){return PN(this.#o)?(this.#o.exitCode=e||0,this.#c.emit("exit",this.#o.exitCode,null),this.#A.call(this.#o,this.#o.exitCode)):0}#B(e,...r){let n=this.#t;if(e==="exit"&&PN(this.#o)){typeof r[0]=="number"&&(this.#o.exitCode=r[0]);let i=n.call(this.#o,e,...r);return this.#c.emit("exit",this.#o.exitCode,null),i}else return n.call(this.#o,e,...r)}},n5=globalThis.process,{onExit:f1e,load:__r,unload:L_r}=ykt(PN(n5)?new r5(n5):new t5);var h1e=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=f1e(()=>{t.kill()});(0,m1e.addAbortListener)(n,()=>{i()})};m();m();var I1e=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=$R(),{destination:s,destinationStream:a,destinationError:A,from:c,unpipeSignal:u}=Qkt(r,n,i),{sourceStream:l,sourceError:p}=wkt(t,c),{options:g,fileDescriptors:d}=Bc.get(t);return{sourcePromise:e,sourceStream:l,sourceOptions:g,sourceError:p,destination:s,destinationStream:a,destinationError:A,unpipeSignal:u,fileDescriptors:d,startTime:o}},Qkt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=Dkt(t,e,...r),a=ZR(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},Dkt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(C1e,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||ZY(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=NR(r,...n);return{destination:e(C1e)(i,o,s),pipeOptions:s}}if(Bc.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},C1e=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),wkt=(t,e)=>{try{return{sourceStream:DC(t,e)}}catch(r){return{sourceError:r}}};m();var B1e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=bkt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw i5({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},bkt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return Wq(t),n;if(e!==void 0)return zq(r),e},i5=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>vC({error:t,command:E1e,escapedCommand:E1e,fileDescriptors:e,options:r,startTime:n,isSync:!1}),E1e="source.pipe(destination)";m();var y1e=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};m();var Q1e=require("node:stream/promises");var D1e=(t,e,r)=>{let n=LN.has(e)?Skt(t,e):vkt(t,e);return vd(t,Fkt,r.signal),vd(e,kkt,r.signal),xkt(e),n},vkt=(t,e)=>{let r=Fd([t]);return RC(r,e),LN.set(e,r),r},Skt=(t,e)=>{let r=LN.get(e);return r.add(t),r},xkt=async t=>{try{await(0,Q1e.finished)(t,{cleanup:!0,readable:!1,writable:!0})}catch{}LN.delete(t)},LN=new WeakMap,Fkt=2,kkt=1;m();var w1e=require("node:util");var b1e=(t,e)=>t===void 0?[]:[Rkt(t,e)],Rkt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await(0,w1e.aborted)(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw i5({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var UN=(t,...e)=>{if(Tn(e[0]))return UN.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=I1e(t,...e),i=Nkt({...n,destination:r});return i.pipe=UN.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Nkt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:A,startTime:c})=>{let u=Tkt(t,i);B1e({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:A,sourceOptions:r,startTime:c});let l=new AbortController;try{let p=D1e(e,o,l);return await Promise.race([y1e(u),...b1e(a,{sourceStream:e,mergedStream:p,sourceOptions:r,fileDescriptors:A,startTime:c})])}finally{l.abort()}},Tkt=(t,e)=>Promise.allSettled([t,e]);m();m();m();var k1e=require("node:timers/promises");m();var S1e=require("node:events"),x1e=require("node:stream");var ON=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Mkt(e,s),F1e({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Mkt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},o5=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Pkt(e,s,t);let a=t.readableObjectMode&&!o;return F1e({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Pkt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},F1e=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=(0,S1e.on)(t,"data",{signal:e.signal,highWaterMark:v1e,highWatermark:v1e});return _kt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},s5=(0,x1e.getDefaultHighWaterMark)(!0),v1e=s5,_kt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Lkt({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[A]of t)yield*xd(A,a,0)}catch(A){if(!e.signal.aborted)throw A}finally{yield*gD(a)}},Lkt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[vN(t,r,!e),bN(t,i,!n,{})].filter(Boolean);var R1e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:A,verboseInfo:c,streamInfo:u})=>{let l=Ukt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:c,streamInfo:u});if(!i){await Promise.all([Okt(t),l]);return}let p=Mq(A,r),g=o5({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:p,allMixed:a}),[d]=await Promise.all([Gkt({stream:t,iterable:g,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),l]);return d},Ukt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!FN({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=o5({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await G_e(a,t,r,o)},Okt=async t=>{await(0,k1e.setImmediate)(),t.readableFlowing===null&&t.resume()},Gkt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await fN(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await mN(r,{maxBuffer:o})):await CN(r,{maxBuffer:o})}catch(a){return N1e(LPe({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},a5=async t=>{try{return await t}catch(e){return N1e(e)}},N1e=({bufferedData:t})=>yTe(t)?new Uint8Array(t):t;m();var M1e=require("node:stream/promises"),CD=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Kkt(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],(0,M1e.finished)(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Jkt(a,e,r,n)}finally{s.abort()}},Kkt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Hkt(t,r,n),n},Hkt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{$kt(e,r),n.call(t,...i)}},$kt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Jkt=(t,e,r,n)=>{if(!jkt(t,e,r,n))throw t},jkt=(t,e,r,n=!0)=>r.propagating?T1e(t)||GN(t):(r.propagating=!0,A5(r,e)===n?T1e(t):GN(t)),A5=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",GN=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",T1e=t=>t?.code==="EPIPE";var P1e=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((A,c)=>c5({stream:A,fdNumber:c,encoding:e,buffer:r[c],maxBuffer:n[c],lines:i[c],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),c5=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:A,streamInfo:c})=>{if(!t)return;let u=CD(t,e,c);if(A5(c,e)){await u;return}let[l]=await Promise.all([R1e({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:A,streamInfo:c}),u]);return l};var _1e=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fd([t,e].filter(Boolean)):void 0,L1e=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>c5({...Ykt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:qkt(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Ykt=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},qkt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;m();var H1e=require("node:events");m();m();var U1e=t=>EC(t,"ipc"),O1e=(t,e)=>{let r=HR(t);Ic({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var G1e=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=U1e(o),a=_u(e,"ipc"),A=_u(r,"ipc");for await(let c of Hq({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(UPe(t,i,A),i.push(c)),s&&O1e(c,o);return i},K1e=async(t,e)=>(await Promise.allSettled([t]),e);var $1e=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:A,stripFinalNewline:c,ipc:u,ipcInput:l},context:p,verboseInfo:g,fileDescriptors:d,originalStreams:f,onInternalError:h,controller:C})=>{let I=j_e(t,p),B={originalStreams:f,fileDescriptors:d,subprocess:t,exitPromise:I,propagating:!1},E=P1e({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:c,verboseInfo:g,streamInfo:B}),y=L1e({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:c,verboseInfo:g,streamInfo:B}),D=[],b=G1e({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:D,verboseInfo:g}),Q=Vkt(f,t,B),v=zkt(d,B);try{return await Promise.race([Promise.all([{},q_e(I),Promise.all(E),y,b,lPe(t,l),...Q,...v]),h,Wkt(t,C),...sPe(t,o,p,C),...IMe({subprocess:t,cancelSignal:s,gracefulCancel:a,context:p,controller:C}),...nPe({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:A,context:p,controller:C})])}catch(S){return p.terminationReason??="other",Promise.all([{error:S},I,Promise.all(E.map(x=>a5(x))),a5(y),K1e(b,D),Promise.allSettled(Q),Promise.allSettled(v)])}},Vkt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:CD(n,i,r)),zkt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>cA(o,{checkOpen:!1})&&!sA(o)).map(({type:i,value:o,stream:s=o})=>CD(s,n,e,{isSameDirection:Ca.has(i),stopOnExit:i==="native"}))),Wkt=async(t,{signal:e})=>{let[r]=await(0,H1e.once)(t,"error",{signal:e});throw r};m();m();var J1e=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),ID=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ec();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},NC=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};m();var Y1e=require("node:stream"),q1e=require("node:util");m();var u5=require("node:stream/promises");var l5=async t=>{if(t!==void 0)try{await g5(t)}catch{}},j1e=async t=>{if(t!==void 0)try{await p5(t)}catch{}},g5=async t=>{await(0,u5.finished)(t,{cleanup:!0,readable:!1,writable:!0})},p5=async t=>{await(0,u5.finished)(t,{cleanup:!0,readable:!0,writable:!1})},KN=async(t,e)=>{if(await t,e)throw e},HN=(t,e,r)=>{r&&!GN(r)?t.destroy(r):e&&t.destroy()};var V1e=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Bs.has(r),{subprocessStdout:a,waitReadableDestroy:A}=d5(t,n,e),{readableEncoding:c,readableObjectMode:u,readableHighWaterMark:l}=f5(a,s),{read:p,onStdoutDataDone:g}=m5({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),d=new Y1e.Readable({read:p,destroy:(0,q1e.callbackify)(C5.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:A})),highWaterMark:l,objectMode:u,encoding:c});return h5({subprocessStdout:a,onStdoutDataDone:g,readable:d,subprocess:t}),d},d5=(t,e,r)=>{let n=DC(t,e),i=ID(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},f5=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:s5},m5=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ec(),s=ON({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Zkt(this,s,o)},onStdoutDataDone:o}},Zkt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},h5=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await p5(t),await n,await l5(i),await e,r.readable&&r.push(null)}catch(o){await l5(i),z1e(r,o)}},C5=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await NC(r,e)&&(z1e(t,n),await KN(e,n))},z1e=(t,e)=>{HN(t,t.readable,e)};m();var W1e=require("node:stream"),I5=require("node:util");var Z1e=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=E5(t,r,e),s=new W1e.Writable({...B5(n,t,i),destroy:(0,I5.callbackify)(Q5.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return y5(n,s),s},E5=(t,e,r)=>{let n=ZR(t,e),i=ID(r,n,"writableFinal"),o=ID(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},B5=(t,e,r)=>({write:Xkt.bind(void 0,t),final:(0,I5.callbackify)(eRt.bind(void 0,t,e,r))}),Xkt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},eRt=async(t,e,r)=>{await NC(r,e)&&(t.writable&&t.end(),await e)},y5=async(t,e,r)=>{try{await g5(t),e.writable&&e.end()}catch(n){await j1e(r),X1e(e,n)}},Q5=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await NC(r,e),await NC(n,e)&&(X1e(t,i),await KN(e,i))},X1e=(t,e)=>{HN(t,t.writable,e)};m();var eLe=require("node:stream"),tLe=require("node:util");var rLe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Bs.has(r),{subprocessStdout:A,waitReadableDestroy:c}=d5(t,n,e),{subprocessStdin:u,waitWritableFinal:l,waitWritableDestroy:p}=E5(t,i,e),{readableEncoding:g,readableObjectMode:d,readableHighWaterMark:f}=f5(A,a),{read:h,onStdoutDataDone:C}=m5({subprocessStdout:A,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),I=new eLe.Duplex({read:h,...B5(u,t,l),destroy:(0,tLe.callbackify)(tRt.bind(void 0,{subprocessStdout:A,subprocessStdin:u,subprocess:t,waitReadableDestroy:c,waitWritableFinal:l,waitWritableDestroy:p})),readableHighWaterMark:f,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:d,writableObjectMode:u.writableObjectMode,encoding:g});return h5({subprocessStdout:A,onStdoutDataDone:C,readable:I,subprocess:t,subprocessStdin:u}),y5(u,I,A),I},tRt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([C5({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),Q5({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};m();var D5=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Bs.has(e),s=DC(t,r),a=ON({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return rRt(a,s,t)},rRt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var nLe=(t,{encoding:e})=>{let r=J1e();t.readable=V1e.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Z1e.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=rLe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=D5.bind(void 0,t,e),t[Symbol.asyncIterator]=D5.bind(void 0,t,e,{})};m();var iLe=(t,e)=>{for(let[r,n]of iRt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},nRt=(async()=>{})().constructor.prototype,iRt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(nRt,t)]);var aLe=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:A,verboseInfo:c,options:u,fileDescriptors:l}=oRt(t,e,r),{subprocess:p,promise:g}=aRt({file:i,commandArguments:o,options:u,startTime:A,verboseInfo:c,command:s,escapedCommand:a,fileDescriptors:l});return p.pipe=UN.bind(void 0,{source:p,sourcePromise:g,boundOptions:{},createNested:n}),iLe(p,g),Bc.set(p,{options:u,fileDescriptors:l}),p},oRt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=JR(t,e,r),{file:a,commandArguments:A,options:c}=uN(t,e,r),u=sRt(c),l=A1e(u,s);return{file:a,commandArguments:A,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:l}},sRt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},aRt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let A;try{A=(0,sLe.spawn)(...lN(t,e,r))}catch(d){return o1e({error:d,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let c=new AbortController;(0,oLe.setMaxListeners)(Number.POSITIVE_INFINITY,c.signal);let u=[...A.stdio];d1e(A,a,c),h1e(A,r,c);let l={},p=Ec();A.kill=mMe.bind(void 0,{kill:A.kill.bind(A),options:r,onInternalError:p,context:l,controller:c}),A.all=_1e(A,r),nLe(A,r),t1e(A,r);let g=ARt({subprocess:A,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:l,onInternalError:p,controller:c});return{subprocess:A,promise:g}},ARt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:A,onInternalError:c,controller:u})=>{let[l,[p,g],d,f,h]=await $1e({subprocess:t,options:e,context:A,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:c,controller:u});u.abort(),c.resolve();let C=d.map((E,y)=>Uu(E,e,y)),I=Uu(f,e,"all"),B=cRt({errorInfo:l,exitCode:p,signal:g,stdio:C,all:I,ipcOutput:h,context:A,options:e,command:s,escapedCommand:a,startTime:r});return SC(B,n,e)},cRt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:A,escapedCommand:c,startTime:u})=>"error"in t?uD({error:t.error,command:A,escapedCommand:c,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof yc,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):EN({command:A,escapedCommand:c,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});m();var $N=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,uRt(n,t[n],i)]));return{...t,...r}},uRt=(t,e,r)=>lRt.has(t)&&Tn(e)&&Tn(r)?{...e,...r}:r,lRt=new Set(["env",...nq]);var Qg=(t,e,r,n)=>{let i=(s,a,A)=>Qg(s,a,r,A),o=(...s)=>gRt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},gRt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Tn(o))return i(t,$N(r,o),n);let{file:a,commandArguments:A,options:c,isSync:u}=pRt({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?W_e(a,A,c):aLe(a,A,c,i)},pRt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=xTe(e)?FTe(e,r):[e,...r],[s,a,A]=NR(...o),c=$N($N(n,i),A),{file:u=s,commandArguments:l=a,options:p=c,isSync:g=!1}=t({file:s,commandArguments:a,options:c});return{file:u,commandArguments:l,options:p,isSync:g}};m();var ALe=({file:t,commandArguments:e})=>uLe(t,e),cLe=({file:t,commandArguments:e})=>({...uLe(t,e),isSync:!0}),uLe=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=dRt(t);return{file:r,commandArguments:n}},dRt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(fRt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},fRt=/ +/g;m();var lLe=(t,e,r)=>{t.sync=e(mRt,r),t.s=t.sync},gLe=({options:t})=>pLe(t),mRt=({options:t})=>({...pLe(t),isSync:!0}),pLe=t=>({options:{...hRt(t),...t}}),hRt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},dLe={preferLocal:!0};var uA=Qg(()=>({})),UUr=Qg(()=>({isSync:!0})),OUr=Qg(ALe),GUr=Qg(cLe),KUr=Qg(aPe),HUr=Qg(gLe,{},dLe,lLe),{sendMessage:$Ur,getOneMessage:JUr,getEachMessage:jUr,getCancelSignal:YUr}=r1e();Bn();tg();mr();var jN=z(Hr(),1);nn();gn();sb();var Ou=require("node:fs"),w5=require("node:os"),JN=require("node:path");Vc();async function fLe(){try{let{stdout:t}=await uA("git",["remote","get-url","origin"]);return t.trim()}catch{return null}}function mLe(){let t=(0,JN.join)((0,w5.homedir)(),".builder","projects.json");try{if((0,Ou.existsSync)(t)){let e=(0,Ou.readFileSync)(t,"utf-8");return JSON.parse(e)}}catch{}return{}}function CRt(t){let e=(0,JN.join)((0,w5.homedir)(),".builder");(0,Ou.existsSync)(e)||(0,Ou.mkdirSync)(e,{recursive:!0}),(0,Ou.writeFileSync)((0,JN.join)(e,"projects.json"),JSON.stringify(t,null,2),"utf-8")}async function IRt(){let t=await fLe();return t?mLe()[t]?.pinnedProjectId??null:null}async function b5(t){let e=await fLe();if(!e)return;let r=mLe();r[e]={pinnedProjectId:t},CRt(r)}async function ERt(t,e,r){let n=new URL("/projects",Oe);n.searchParams.set("apiKey",t),n.searchParams.set("userId",r),n.searchParams.set("includeBranches","false");let i=await Ue(n,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!i.ok){let s=await i.text();throw new Error(`Failed to list projects: ${s}`)}return(await i.json()).projects??[]}async function v5(t,e,r,n){let i=new URL(`/projects/${n}`,Oe);i.searchParams.set("apiKey",t),i.searchParams.set("userId",r),i.searchParams.set("includeBranches","true");let o=await Ue(i,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!o.ok){let s=await o.text();throw new Error(`Failed to fetch project: ${s}`)}return o.json()}function BRt(t,e){let r=t.branches??{};for(let[n,i]of Object.entries(r))if(i.gitAiBranch===e)return[n,i];return null}async function yRt(t,e,r,n,i){let o=new URL("/projects/branch",Oe);o.searchParams.set("apiKey",t),o.searchParams.set("userId",r);let s=await Ue(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({projectId:n,gitAiBranch:i,checkoutBranch:i,actor:"push-command",userMessage:{userPrompt:`Track git branch: ${i}`}})});if(!s.ok){let A=await s.text();throw new Error(`Failed to create Builder branch: ${A}`)}let a;for await(let A of Of(s.body))if(A.length)try{let c=JSON.parse(A);c.branchName&&(c.type==="creating-branch"||c.type==="setting-up-container"||c.type==="branch-created")&&(a=c.branchName)}catch{}if(!a)throw new Error("Branch created but could not determine the branch name from the response.");return a}async function S5(t,e,r,n){if(t.projectId)return t.projectId;let i=await IRt();if(i)return i;let o=await ERt(e,r,n);if(o.length===0)throw new Error("No Builder.io projects found. Create a project first at https://builder.io/app/projects.");if(o.length===1)return o[0].id;let s=await ni({message:"Select a Builder.io project:",options:o.map(a=>({label:a.name,value:a.id}))});return et(s)&&(Ze("Cancelled."),process.exit(0)),s}async function QRt(t,e,r,n,i){let o=new URL("/projects/branch/sync",Oe);o.searchParams.set("apiKey",t),o.searchParams.set("userId",r);let s=await Ue(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({projectId:n,branchName:i,syncOptions:{remoteBranches:"ai",canPush:!1,requestRefresh:!0,uncommittedChanges:"stash",fastForward:"auto"}})}),a=await s.text();if(!s.ok)throw new Error(`${s.status} ${s.statusText}: ${a}`)}async function hLe(t,e){let{builderPublicKey:r,builderPrivateKey:n,userId:i}=await Er(t,e,{builderPrivateKey:!0,builderPublicKey:!0});if(!r||!n)throw new Error("Builder.io credentials are required. Run `npx builder.io auth` first.");let o=i??"",s;try{let{stdout:l}=await uA("git",["symbolic-ref","--short","HEAD"]);s=l.trim()}catch{throw new Error("Not inside a git repository, or HEAD is detached. Please run this command from a git branch.")}if(e.dryrun){G.info(`Dry run: would push "${s}" and ensure a Builder branch exists.`);try{await uA("git",["push","--dry-run","origin",s])}catch(l){throw new Error(`git push --dry-run failed: ${nd(l)}`)}return}let a=Ni();a.start(`Pushing "${s}" to origin...`);try{await uA("git",["push","origin",s])}catch(l){throw a.stop("git push failed.",1),G.error(nd(l)),G.info(`If the remote is ahead of your local branch, run:
|
|
6989
|
+
if (condition) { yield value; }`)};m();var T_e=require("node:buffer"),M_e=require("node:string_decoder");var vN=(t,e,r)=>{if(r)return;if(t)return{transform:mFt.bind(void 0,new TextEncoder)};let n=new M_e.StringDecoder(e);return{transform:hFt.bind(void 0,n),final:CFt.bind(void 0,n)}},mFt=function*(t,e){T_e.Buffer.isBuffer(e)?yield Pu(e):typeof e=="string"?yield t.encode(e):yield e},hFt=function*(t,e){yield ri(e)?t.write(e):e},CFt=function*(t){let e=t.end();e!==""&&(yield e)};m();var Lq=require("node:util"),Uq=(0,Lq.callbackify)(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),SN=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=EFt}=e[r];for await(let i of n(t))yield*SN(i,e,r+1)},P_e=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*IFt(r,Number(e),t)},IFt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*SN(n,r,e+1)},__e=(0,Lq.callbackify)(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),EFt=function*(t){yield t};m();var Oq=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},L_e=(t,e)=>[...e.flatMap(r=>[...xd(r,t,0)]),...gD(t)],xd=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=yFt}=e[r];for(let i of n(t))yield*xd(i,e,r+1)},gD=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*BFt(r,Number(e),t)},BFt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*xd(n,r,e+1)},yFt=function*(t){yield t};var Gq=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},A=U_e(t,s,o),c=Sd(e),u=Sd(r),l=c?Uq.bind(void 0,SN,a):Oq.bind(void 0,xd),p=c||u?Uq.bind(void 0,P_e,a):Oq.bind(void 0,gD),g=c||u?__e.bind(void 0,a):void 0;return{stream:new pD.Transform({writableObjectMode:n,writableHighWaterMark:(0,pD.getDefaultHighWaterMark)(n),readableObjectMode:i,readableHighWaterMark:(0,pD.getDefaultHighWaterMark)(i),transform(f,h,C){l([f,A,0],this,C)},flush(f){p([A],this,f)},destroy:g})}},xN=(t,e,r,n)=>{let i=e.filter(({type:s})=>s==="generator"),o=n?i.reverse():i;for(let{value:s,optionName:a}of o){let A=U_e(s,r,a);t=L_e(A,t)}return t},U_e=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let A={};return[{transform:k_e(n,a)},vN(r,s,n),bN(r,o,n,A),{transform:t,final:e},{transform:R_e(i,a)},x_e({binary:r,preserveNewlines:o,readableObjectMode:i,state:A})].filter(Boolean)};var O_e=(t,e)=>{for(let r of QFt(t))DFt(t,r,e)},QFt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),DFt=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:A}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${A}\`, can be ${Bg[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>wFt(a,n));r.input=tD(s)},wFt=(t,e)=>{let r=xN(t,e,"utf8",!0);return bFt(r),tD(r)},bFt=t=>{let e=t.find(r=>typeof r!="string"&&!ri(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};m();var kN=require("node:fs");m();var FN=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&EC(r,n)&&!Bs.has(e)&&vFt(n)&&(t.some(({type:i,value:o})=>i==="native"&&SFt.has(o))||t.every(({type:i})=>Ca.has(i))),vFt=t=>t===1||t===2,SFt=new Set(["pipe","overlapped"]),G_e=async(t,e,r,n)=>{for await(let i of t)xFt(e)||H_e(i,r,n)},K_e=(t,e,r)=>{for(let n of t)H_e(n,e,r)},xFt=t=>t._readableState.pipes.length>0,H_e=(t,e,r)=>{let n=HR(t);Ic({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var $_e=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let o={},s=new Set([]);return{output:e.map((A,c)=>FFt({result:A,fileDescriptors:t,fdNumber:c,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},FFt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:A,lines:c,stripFinalNewline:u,maxBuffer:l})=>{if(t===null)return;let p=KPe(t,o,l),g=Pu(p),{stdioItems:d,objectMode:f}=e[r],h=kFt([g],d,A,n),{serializedResult:C,finalResult:I=C}=RFt({chunks:h,objectMode:f,encoding:A,lines:c,stripFinalNewline:u,fdNumber:r});NFt({serializedResult:C,fdNumber:r,state:n,verboseInfo:s,encoding:A,stdioItems:d,objectMode:f});let B=a[r]?I:void 0;try{return n.error===void 0&&TFt(C,d,i),B}catch(E){return n.error=E,B}},kFt=(t,e,r,n)=>{try{return xN(t,e,r,!1)}catch(i){return n.error=i,t}},RFt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:tD(t)};let s=DTe(t,r);return n[o]?{serializedResult:s,finalResult:_q(s,!i[o],e)}:{serializedResult:s}},NFt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!FN({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=_q(t,!1,s);try{K_e(a,e,n)}catch(A){r.error??=A}},TFt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>QN.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?(0,kN.appendFileSync)(n,t):(r.add(o),(0,kN.writeFileSync)(n,t))}};m();var J_e=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,Uu(e,r,"all")]:Array.isArray(e)?[Uu(t,r,"all"),...e]:ri(t)&&ri(e)?eq([t,e]):`${t}${e}`};m();m();var RN=require("node:events");var j_e=async(t,e)=>{let[r,n]=await MFt(t);return e.isForcefullyTerminated??=!1,[r,n]},MFt=async t=>{let[e,r]=await Promise.allSettled([(0,RN.once)(t,"spawn"),(0,RN.once)(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?Y_e(t):r.value},Y_e=async t=>{try{return await(0,RN.once)(t,"exit")}catch{return Y_e(t)}},q_e=async t=>{let[e,r]=await t;if(!PFt(e,r)&&Kq(e,r))throw new aA;return[e,r]},PFt=(t,e)=>t===void 0&&e===void 0,Kq=(t,e)=>t!==0||e!==null;var V_e=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=_Ft(t,e,r),s=o?.code==="ETIMEDOUT",a=GPe(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},_Ft=(t,e,r)=>t!==void 0?t:Kq(e,r)?new aA:void 0;var W_e=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:A,options:c,fileDescriptors:u}=LFt(t,e,r),l=GFt({file:n,commandArguments:i,options:c,command:o,escapedCommand:s,verboseInfo:A,fileDescriptors:u,startTime:a});return SC(l,A,c)},LFt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=JR(t,e,r),a=UFt(r),{file:A,commandArguments:c,options:u}=uN(t,e,a);OFt(u);let l=w_e(u,s);return{file:A,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:l}},UFt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,OFt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&NN("ipcInput"),t&&NN("ipc: true"),r&&NN("detached: true"),n&&NN("cancelSignal")},NN=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},GFt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let A=KFt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:a});if(A.failed)return A;let{resultError:c,exitCode:u,signal:l,timedOut:p,isMaxBuffer:g}=V_e(A,r),{output:d,error:f=c}=$_e({fileDescriptors:s,syncResult:A,options:r,isMaxBuffer:g,verboseInfo:o}),h=d.map((I,B)=>Uu(I,r,B)),C=Uu(J_e(d,r),r,"all");return $Ft({error:f,exitCode:u,signal:l,timedOut:p,isMaxBuffer:g,stdio:h,all:C,options:r,command:n,escapedCommand:i,startTime:a})},KFt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{O_e(o,r);let a=HFt(r);return(0,z_e.spawnSync)(...lN(t,e,a))}catch(a){return vC({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},HFt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:IN(e)}),$Ft=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:o,all:s,options:a,command:A,escapedCommand:c,startTime:u})=>t===void 0?EN({command:A,escapedCommand:c,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):uD({error:t,command:A,escapedCommand:c,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:o,all:s,ipcOutput:[],options:a,startTime:u,isSync:!0});m();var oLe=require("node:events"),sLe=require("node:child_process");m();var $q=z(require("node:process"),1);m();var FC=require("node:events");var Z_e=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(yC({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:nN(t)}),JFt({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),JFt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{XR(e,i);let o=Eg(t,e,r),s=new AbortController;try{return await Promise.race([jFt(o,n,s),YFt(o,r,s),qFt(o,r,s)])}catch(a){throw QC(t),a}finally{s.abort(),eN(e,i)}},jFt=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await(0,FC.once)(t,"message",{signal:r});return n}for await(let[n]of(0,FC.on)(t,"message",{signal:r}))if(e(n))return n},YFt=async(t,e,{signal:r})=>{await(0,FC.once)(t,"disconnect",{signal:r}),EMe(e)},qFt=async(t,e,{signal:r})=>{let[n]=await(0,FC.once)(t,"strict:error",{signal:r});throw zR(n,e)};m();var dD=require("node:events");var e1e=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>Hq({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),Hq=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{yC({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:nN(t)}),XR(e,o);let s=Eg(t,e,r),a=new AbortController,A={};return VFt(t,s,a),zFt({ipcEmitter:s,isSubprocess:r,controller:a,state:A}),WFt({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:A,reference:o})},VFt=async(t,e,r)=>{try{await(0,dD.once)(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},zFt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await(0,dD.once)(t,"strict:error",{signal:r.signal});n.error=zR(i,e),r.abort()}catch{}},WFt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[A]of(0,dD.on)(r,"message",{signal:o.signal}))X_e(s),yield A}catch{X_e(s)}finally{o.abort(),eN(e,a),n||QC(t),i&&await t}},X_e=({error:t})=>{if(t)throw t};var t1e=(t,{ipc:e})=>{Object.assign(t,n1e(t,!1,e))},r1e=()=>{let t=$q.default,e=!0,r=$q.default.channel!==void 0;return{...n1e(t,e,r),getCancelSignal:ePe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},n1e=(t,e,r)=>({sendMessage:aN.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:Z_e.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:e1e.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});m();var i1e=require("node:child_process"),yg=require("node:stream");var o1e=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{Nq(n);let a=new i1e.ChildProcess;ZFt(a,n),Object.assign(a,{readable:XFt,writable:ekt,duplex:tkt});let A=vC({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),c=rkt(A,s,i);return{subprocess:a,promise:c}},ZFt=(t,e)=>{let r=fD(),n=fD(),i=fD(),o=Array.from({length:e.length-3},fD),s=fD(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},fD=()=>{let t=new yg.PassThrough;return t.end(),t},XFt=()=>new yg.Readable({read(){}}),ekt=()=>new yg.Writable({write(){}}),tkt=()=>new yg.Duplex({read(){},write(){}}),rkt=async(t,e,r)=>SC(t,e,r);m();var kC=require("node:fs"),a1e=require("node:buffer"),Dc=require("node:stream");var A1e=(t,e)=>wN(nkt,t,e,!1),mD=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Bg[t]}.`)},s1e={fileNumber:mD,generator:Gq,asyncGenerator:Gq,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:Dc.Duplex.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},nkt={input:{...s1e,fileUrl:({value:t})=>({stream:(0,kC.createReadStream)(t)}),filePath:({value:{file:t}})=>({stream:(0,kC.createReadStream)(t)}),webStream:({value:t})=>({stream:Dc.Readable.fromWeb(t)}),iterable:({value:t})=>({stream:Dc.Readable.from(t)}),asyncIterable:({value:t})=>({stream:Dc.Readable.from(t)}),string:({value:t})=>({stream:Dc.Readable.from(t)}),uint8Array:({value:t})=>({stream:Dc.Readable.from(a1e.Buffer.from(t))})},output:{...s1e,fileUrl:({value:t})=>({stream:(0,kC.createWriteStream)(t)}),filePath:({value:{file:t,append:e}})=>({stream:(0,kC.createWriteStream)(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:Dc.Writable.fromWeb(t)}),iterable:mD,asyncIterable:mD,string:mD,uint8Array:mD}};m();m();var hD=require("node:events"),MN=require("node:stream"),Yq=require("node:stream/promises");function Fd(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)jq(i);let e=t.some(({readableObjectMode:i})=>i),r=ikt(t,e),n=new Jq({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var ikt=(t,e)=>{if(t.length===0)return(0,MN.getDefaultHighWaterMark)(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},Jq=class extends MN.PassThrough{#n=new Set([]);#c=new Set([]);#o=new Set([]);#t;#A=Symbol("unpipe");#i=new WeakMap;add(e){if(jq(e),this.#n.has(e))return;this.#n.add(e),this.#t??=okt(this,this.#n,this.#A);let r=Akt({passThroughStream:this,stream:e,streams:this.#n,ended:this.#c,aborted:this.#o,onFinished:this.#t,unpipeEvent:this.#A});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(jq(e),!this.#n.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},okt=async(t,e,r)=>{TN(t,c1e);let n=new AbortController;try{await Promise.race([skt(t,n),akt(t,e,r,n)])}finally{n.abort(),TN(t,-c1e)}},skt=async(t,{signal:e})=>{try{await(0,Yq.finished)(t,{signal:e,cleanup:!0})}catch(r){throw l1e(t,r),r}},akt=async(t,e,r,{signal:n})=>{for await(let[i]of(0,hD.on)(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},jq=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Akt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{TN(t,u1e);let a=new AbortController;try{await Promise.race([ckt(o,e,a),ukt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),lkt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),TN(t,-u1e)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?qq(t):gkt(t))},ckt=async(t,e,{signal:r})=>{try{await t,r.aborted||qq(e)}catch(n){r.aborted||l1e(e,n)}},ukt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await(0,Yq.finished)(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;g1e(s)?i.add(e):p1e(t,s)}},lkt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await(0,hD.once)(t,i,{signal:o}),!t.readable)return(0,hD.once)(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},gkt=t=>{t.writable&&t.end()},l1e=(t,e)=>{g1e(e)?qq(t):p1e(t,e)},g1e=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",qq=t=>{(t.readable||t.writable)&&t.destroy()},p1e=(t,e)=>{t.destroyed||(t.once("error",pkt),t.destroy(e))},pkt=()=>{},TN=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},c1e=2,u1e=1;m();var Vq=require("node:stream/promises");var RC=(t,e)=>{t.pipe(e),dkt(t,e),fkt(t,e)},dkt=async(t,e)=>{if(!(sA(t)||sA(e))){try{await(0,Vq.finished)(t,{cleanup:!0,readable:!0,writable:!1})}catch{}zq(e)}},zq=t=>{t.writable&&t.end()},fkt=async(t,e)=>{if(!(sA(t)||sA(e))){try{await(0,Vq.finished)(e,{cleanup:!0,readable:!1,writable:!0})}catch{}Wq(t)}},Wq=t=>{t.readable&&t.destroy()};var d1e=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:o,direction:s}]of Object.entries(e)){for(let{stream:a}of o.filter(({type:A})=>Ca.has(A)))mkt(t,a,s,i);for(let{stream:a}of o.filter(({type:A})=>!Ca.has(A)))Ckt({subprocess:t,stream:a,direction:s,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,o]of n.entries()){let s=o.length===1?o[0]:Fd(o);RC(s,i)}},mkt=(t,e,r,n)=>{r==="output"?RC(t.stdio[n],e):RC(e,t.stdio[n]);let i=hkt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},hkt=["stdin","stdout","stderr"],Ckt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;Ikt(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],A=i.get(s)??[];i.set(s,[...A,a])},Ikt=(t,{signal:e})=>{sA(t)&&vd(t,Ekt,e)},Ekt=2;m();var m1e=require("node:events");m();m();var kd=[];kd.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&kd.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&kd.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var PN=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",Zq=Symbol.for("signal-exit emitter"),Xq=globalThis,Bkt=Object.defineProperty.bind(Object),e5=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Xq[Zq])return Xq[Zq];Bkt(Xq,Zq,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},_N=class{},ykt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),t5=class extends _N{onExit(){return()=>{}}load(){}unload(){}},r5=class extends _N{#n=n5.platform==="win32"?"SIGINT":"SIGHUP";#c=new e5;#o;#t;#A;#i={};#e=!1;constructor(e){super(),this.#o=e,this.#i={};for(let r of kd)this.#i[r]=()=>{let n=this.#o.listeners(r),{count:i}=this.#c,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),n.length===i){this.unload();let s=this.#c.emit("exit",null,r),a=r==="SIGHUP"?this.#n:r;s||e.kill(e.pid,a)}};this.#A=e.reallyExit,this.#t=e.emit}onExit(e,r){if(!PN(this.#o))return()=>{};this.#e===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#c.on(n,e),()=>{this.#c.removeListener(n,e),this.#c.listeners.exit.length===0&&this.#c.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#e){this.#e=!0,this.#c.count+=1;for(let e of kd)try{let r=this.#i[e];r&&this.#o.on(e,r)}catch{}this.#o.emit=(e,...r)=>this.#B(e,...r),this.#o.reallyExit=e=>this.#s(e)}}unload(){this.#e&&(this.#e=!1,kd.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#o.removeListener(e,r)}catch{}}),this.#o.emit=this.#t,this.#o.reallyExit=this.#A,this.#c.count-=1)}#s(e){return PN(this.#o)?(this.#o.exitCode=e||0,this.#c.emit("exit",this.#o.exitCode,null),this.#A.call(this.#o,this.#o.exitCode)):0}#B(e,...r){let n=this.#t;if(e==="exit"&&PN(this.#o)){typeof r[0]=="number"&&(this.#o.exitCode=r[0]);let i=n.call(this.#o,e,...r);return this.#c.emit("exit",this.#o.exitCode,null),i}else return n.call(this.#o,e,...r)}},n5=globalThis.process,{onExit:f1e,load:__r,unload:L_r}=ykt(PN(n5)?new r5(n5):new t5);var h1e=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=f1e(()=>{t.kill()});(0,m1e.addAbortListener)(n,()=>{i()})};m();m();var I1e=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=$R(),{destination:s,destinationStream:a,destinationError:A,from:c,unpipeSignal:u}=Qkt(r,n,i),{sourceStream:l,sourceError:p}=wkt(t,c),{options:g,fileDescriptors:d}=Bc.get(t);return{sourcePromise:e,sourceStream:l,sourceOptions:g,sourceError:p,destination:s,destinationStream:a,destinationError:A,unpipeSignal:u,fileDescriptors:d,startTime:o}},Qkt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=Dkt(t,e,...r),a=ZR(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},Dkt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(C1e,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||ZY(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,o,s]=NR(r,...n);return{destination:e(C1e)(i,o,s),pipeOptions:s}}if(Bc.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},C1e=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),wkt=(t,e)=>{try{return{sourceStream:DC(t,e)}}catch(r){return{sourceError:r}}};m();var B1e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=bkt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw i5({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},bkt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return Wq(t),n;if(e!==void 0)return zq(r),e},i5=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>vC({error:t,command:E1e,escapedCommand:E1e,fileDescriptors:e,options:r,startTime:n,isSync:!1}),E1e="source.pipe(destination)";m();var y1e=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:o,value:s=o}]=await t;if(s.pipedFrom.includes(n)||s.pipedFrom.push(n),i==="rejected")throw s;if(e==="rejected")throw n;return s};m();var Q1e=require("node:stream/promises");var D1e=(t,e,r)=>{let n=LN.has(e)?Skt(t,e):vkt(t,e);return vd(t,Fkt,r.signal),vd(e,kkt,r.signal),xkt(e),n},vkt=(t,e)=>{let r=Fd([t]);return RC(r,e),LN.set(e,r),r},Skt=(t,e)=>{let r=LN.get(e);return r.add(t),r},xkt=async t=>{try{await(0,Q1e.finished)(t,{cleanup:!0,readable:!1,writable:!0})}catch{}LN.delete(t)},LN=new WeakMap,Fkt=2,kkt=1;m();var w1e=require("node:util");var b1e=(t,e)=>t===void 0?[]:[Rkt(t,e)],Rkt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await(0,w1e.aborted)(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw i5({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})};var UN=(t,...e)=>{if(Tn(e[0]))return UN.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=I1e(t,...e),i=Nkt({...n,destination:r});return i.pipe=UN.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Nkt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:A,startTime:c})=>{let u=Tkt(t,i);B1e({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:A,sourceOptions:r,startTime:c});let l=new AbortController;try{let p=D1e(e,o,l);return await Promise.race([y1e(u),...b1e(a,{sourceStream:e,mergedStream:p,sourceOptions:r,fileDescriptors:A,startTime:c})])}finally{l.abort()}},Tkt=(t,e)=>Promise.allSettled([t,e]);m();m();m();var k1e=require("node:timers/promises");m();var S1e=require("node:events"),x1e=require("node:stream");var ON=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Mkt(e,s),F1e({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Mkt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},o5=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Pkt(e,s,t);let a=t.readableObjectMode&&!o;return F1e({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Pkt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},F1e=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=(0,S1e.on)(t,"data",{signal:e.signal,highWaterMark:v1e,highWatermark:v1e});return _kt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},s5=(0,x1e.getDefaultHighWaterMark)(!0),v1e=s5,_kt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Lkt({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[A]of t)yield*xd(A,a,0)}catch(A){if(!e.signal.aborted)throw A}finally{yield*gD(a)}},Lkt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[vN(t,r,!e),bN(t,i,!n,{})].filter(Boolean);var R1e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:o,lines:s,allMixed:a,stripFinalNewline:A,verboseInfo:c,streamInfo:u})=>{let l=Ukt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:c,streamInfo:u});if(!i){await Promise.all([Okt(t),l]);return}let p=Mq(A,r),g=o5({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:p,allMixed:a}),[d]=await Promise.all([Gkt({stream:t,iterable:g,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),l]);return d},Ukt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!FN({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=o5({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await G_e(a,t,r,o)},Okt=async t=>{await(0,k1e.setImmediate)(),t.readableFlowing===null&&t.resume()},Gkt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await fN(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await mN(r,{maxBuffer:o})):await CN(r,{maxBuffer:o})}catch(a){return N1e(LPe({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},a5=async t=>{try{return await t}catch(e){return N1e(e)}},N1e=({bufferedData:t})=>yTe(t)?new Uint8Array(t):t;m();var M1e=require("node:stream/promises"),CD=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Kkt(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],(0,M1e.finished)(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Jkt(a,e,r,n)}finally{s.abort()}},Kkt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Hkt(t,r,n),n},Hkt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{$kt(e,r),n.call(t,...i)}},$kt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Jkt=(t,e,r,n)=>{if(!jkt(t,e,r,n))throw t},jkt=(t,e,r,n=!0)=>r.propagating?T1e(t)||GN(t):(r.propagating=!0,A5(r,e)===n?T1e(t):GN(t)),A5=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",GN=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",T1e=t=>t?.code==="EPIPE";var P1e=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((A,c)=>c5({stream:A,fdNumber:c,encoding:e,buffer:r[c],maxBuffer:n[c],lines:i[c],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),c5=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:A,streamInfo:c})=>{if(!t)return;let u=CD(t,e,c);if(A5(c,e)){await u;return}let[l]=await Promise.all([R1e({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:o,allMixed:s,stripFinalNewline:a,verboseInfo:A,streamInfo:c}),u]);return l};var _1e=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Fd([t,e].filter(Boolean)):void 0,L1e=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>c5({...Ykt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:qkt(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Ykt=({stdout:t,stderr:e,all:r},[,n,i])=>{let o=n||i;return o?n?i?{stream:r,buffer:o}:{stream:t,buffer:o}:{stream:e,buffer:o}:{stream:r,buffer:o}},qkt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;m();var H1e=require("node:events");m();m();var U1e=t=>EC(t,"ipc"),O1e=(t,e)=>{let r=HR(t);Ic({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var G1e=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=U1e(o),a=_u(e,"ipc"),A=_u(r,"ipc");for await(let c of Hq({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(UPe(t,i,A),i.push(c)),s&&O1e(c,o);return i},K1e=async(t,e)=>(await Promise.allSettled([t]),e);var $1e=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:o,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:A,stripFinalNewline:c,ipc:u,ipcInput:l},context:p,verboseInfo:g,fileDescriptors:d,originalStreams:f,onInternalError:h,controller:C})=>{let I=j_e(t,p),B={originalStreams:f,fileDescriptors:d,subprocess:t,exitPromise:I,propagating:!1},E=P1e({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:c,verboseInfo:g,streamInfo:B}),y=L1e({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:c,verboseInfo:g,streamInfo:B}),D=[],b=G1e({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:D,verboseInfo:g}),Q=Vkt(f,t,B),v=zkt(d,B);try{return await Promise.race([Promise.all([{},q_e(I),Promise.all(E),y,b,lPe(t,l),...Q,...v]),h,Wkt(t,C),...sPe(t,o,p,C),...IMe({subprocess:t,cancelSignal:s,gracefulCancel:a,context:p,controller:C}),...nPe({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:A,context:p,controller:C})])}catch(S){return p.terminationReason??="other",Promise.all([{error:S},I,Promise.all(E.map(x=>a5(x))),a5(y),K1e(b,D),Promise.allSettled(Q),Promise.allSettled(v)])}},Vkt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:CD(n,i,r)),zkt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>cA(o,{checkOpen:!1})&&!sA(o)).map(({type:i,value:o,stream:s=o})=>CD(s,n,e,{isSameDirection:Ca.has(i),stopOnExit:i==="native"}))),Wkt=async(t,{signal:e})=>{let[r]=await(0,H1e.once)(t,"error",{signal:e});throw r};m();m();var J1e=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),ID=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),o=Ec();return i.push(o),{resolve:o.resolve.bind(o),promises:i}},NC=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};m();var Y1e=require("node:stream"),q1e=require("node:util");m();var u5=require("node:stream/promises");var l5=async t=>{if(t!==void 0)try{await g5(t)}catch{}},j1e=async t=>{if(t!==void 0)try{await p5(t)}catch{}},g5=async t=>{await(0,u5.finished)(t,{cleanup:!0,readable:!1,writable:!0})},p5=async t=>{await(0,u5.finished)(t,{cleanup:!0,readable:!0,writable:!1})},KN=async(t,e)=>{if(await t,e)throw e},HN=(t,e,r)=>{r&&!GN(r)?t.destroy(r):e&&t.destroy()};var V1e=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||Bs.has(r),{subprocessStdout:a,waitReadableDestroy:A}=d5(t,n,e),{readableEncoding:c,readableObjectMode:u,readableHighWaterMark:l}=f5(a,s),{read:p,onStdoutDataDone:g}=m5({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),d=new Y1e.Readable({read:p,destroy:(0,q1e.callbackify)(C5.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:A})),highWaterMark:l,objectMode:u,encoding:c});return h5({subprocessStdout:a,onStdoutDataDone:g,readable:d,subprocess:t}),d},d5=(t,e,r)=>{let n=DC(t,e),i=ID(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},f5=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:s5},m5=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Ec(),s=ON({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Zkt(this,s,o)},onStdoutDataDone:o}},Zkt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},h5=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await p5(t),await n,await l5(i),await e,r.readable&&r.push(null)}catch(o){await l5(i),z1e(r,o)}},C5=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await NC(r,e)&&(z1e(t,n),await KN(e,n))},z1e=(t,e)=>{HN(t,t.readable,e)};m();var W1e=require("node:stream"),I5=require("node:util");var Z1e=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=E5(t,r,e),s=new W1e.Writable({...B5(n,t,i),destroy:(0,I5.callbackify)(Q5.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return y5(n,s),s},E5=(t,e,r)=>{let n=ZR(t,e),i=ID(r,n,"writableFinal"),o=ID(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},B5=(t,e,r)=>({write:Xkt.bind(void 0,t),final:(0,I5.callbackify)(eRt.bind(void 0,t,e,r))}),Xkt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},eRt=async(t,e,r)=>{await NC(r,e)&&(t.writable&&t.end(),await e)},y5=async(t,e,r)=>{try{await g5(t),e.writable&&e.end()}catch(n){await j1e(r),X1e(e,n)}},Q5=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await NC(r,e),await NC(n,e)&&(X1e(t,i),await KN(e,i))},X1e=(t,e)=>{HN(t,t.writable,e)};m();var eLe=require("node:stream"),tLe=require("node:util");var rLe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||Bs.has(r),{subprocessStdout:A,waitReadableDestroy:c}=d5(t,n,e),{subprocessStdin:u,waitWritableFinal:l,waitWritableDestroy:p}=E5(t,i,e),{readableEncoding:g,readableObjectMode:d,readableHighWaterMark:f}=f5(A,a),{read:h,onStdoutDataDone:C}=m5({subprocessStdout:A,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),I=new eLe.Duplex({read:h,...B5(u,t,l),destroy:(0,tLe.callbackify)(tRt.bind(void 0,{subprocessStdout:A,subprocessStdin:u,subprocess:t,waitReadableDestroy:c,waitWritableFinal:l,waitWritableDestroy:p})),readableHighWaterMark:f,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:d,writableObjectMode:u.writableObjectMode,encoding:g});return h5({subprocessStdout:A,onStdoutDataDone:C,readable:I,subprocess:t,subprocessStdin:u}),y5(u,I,A),I},tRt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([C5({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),Q5({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])};m();var D5=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||Bs.has(e),s=DC(t,r),a=ON({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return rRt(a,s,t)},rRt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var nLe=(t,{encoding:e})=>{let r=J1e();t.readable=V1e.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Z1e.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=rLe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=D5.bind(void 0,t,e),t[Symbol.asyncIterator]=D5.bind(void 0,t,e,{})};m();var iLe=(t,e)=>{for(let[r,n]of iRt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},nRt=(async()=>{})().constructor.prototype,iRt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(nRt,t)]);var aLe=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:A,verboseInfo:c,options:u,fileDescriptors:l}=oRt(t,e,r),{subprocess:p,promise:g}=aRt({file:i,commandArguments:o,options:u,startTime:A,verboseInfo:c,command:s,escapedCommand:a,fileDescriptors:l});return p.pipe=UN.bind(void 0,{source:p,sourcePromise:g,boundOptions:{},createNested:n}),iLe(p,g),Bc.set(p,{options:u,fileDescriptors:l}),p},oRt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=JR(t,e,r),{file:a,commandArguments:A,options:c}=uN(t,e,r),u=sRt(c),l=A1e(u,s);return{file:a,commandArguments:A,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:l}},sRt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},aRt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let A;try{A=(0,sLe.spawn)(...lN(t,e,r))}catch(d){return o1e({error:d,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let c=new AbortController;(0,oLe.setMaxListeners)(Number.POSITIVE_INFINITY,c.signal);let u=[...A.stdio];d1e(A,a,c),h1e(A,r,c);let l={},p=Ec();A.kill=mMe.bind(void 0,{kill:A.kill.bind(A),options:r,onInternalError:p,context:l,controller:c}),A.all=_1e(A,r),nLe(A,r),t1e(A,r);let g=ARt({subprocess:A,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:o,escapedCommand:s,context:l,onInternalError:p,controller:c});return{subprocess:A,promise:g}},ARt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:o,command:s,escapedCommand:a,context:A,onInternalError:c,controller:u})=>{let[l,[p,g],d,f,h]=await $1e({subprocess:t,options:e,context:A,verboseInfo:n,fileDescriptors:i,originalStreams:o,onInternalError:c,controller:u});u.abort(),c.resolve();let C=d.map((E,y)=>Uu(E,e,y)),I=Uu(f,e,"all"),B=cRt({errorInfo:l,exitCode:p,signal:g,stdio:C,all:I,ipcOutput:h,context:A,options:e,command:s,escapedCommand:a,startTime:r});return SC(B,n,e)},cRt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,context:s,options:a,command:A,escapedCommand:c,startTime:u})=>"error"in t?uD({error:t.error,command:A,escapedCommand:c,timedOut:s.terminationReason==="timeout",isCanceled:s.terminationReason==="cancel"||s.terminationReason==="gracefulCancel",isGracefullyCanceled:s.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof yc,isForcefullyTerminated:s.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:o,options:a,startTime:u,isSync:!1}):EN({command:A,escapedCommand:c,stdio:n,all:i,ipcOutput:o,options:a,startTime:u});m();var $N=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,uRt(n,t[n],i)]));return{...t,...r}},uRt=(t,e,r)=>lRt.has(t)&&Tn(e)&&Tn(r)?{...e,...r}:r,lRt=new Set(["env",...nq]);var Qg=(t,e,r,n)=>{let i=(s,a,A)=>Qg(s,a,r,A),o=(...s)=>gRt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},gRt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Tn(o))return i(t,$N(r,o),n);let{file:a,commandArguments:A,options:c,isSync:u}=pRt({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?W_e(a,A,c):aLe(a,A,c,i)},pRt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=xTe(e)?FTe(e,r):[e,...r],[s,a,A]=NR(...o),c=$N($N(n,i),A),{file:u=s,commandArguments:l=a,options:p=c,isSync:g=!1}=t({file:s,commandArguments:a,options:c});return{file:u,commandArguments:l,options:p,isSync:g}};m();var ALe=({file:t,commandArguments:e})=>uLe(t,e),cLe=({file:t,commandArguments:e})=>({...uLe(t,e),isSync:!0}),uLe=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=dRt(t);return{file:r,commandArguments:n}},dRt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(fRt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},fRt=/ +/g;m();var lLe=(t,e,r)=>{t.sync=e(mRt,r),t.s=t.sync},gLe=({options:t})=>pLe(t),mRt=({options:t})=>({...pLe(t),isSync:!0}),pLe=t=>({options:{...hRt(t),...t}}),hRt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},dLe={preferLocal:!0};var uA=Qg(()=>({})),UUr=Qg(()=>({isSync:!0})),OUr=Qg(ALe),GUr=Qg(cLe),KUr=Qg(aPe),HUr=Qg(gLe,{},dLe,lLe),{sendMessage:$Ur,getOneMessage:JUr,getEachMessage:jUr,getCancelSignal:YUr}=r1e();Bn();tg();mr();var jN=z(Hr(),1);nn();gn();sb();var Ou=require("node:fs"),w5=require("node:os"),JN=require("node:path");Vc();async function fLe(){try{let{stdout:t}=await uA("git",["remote","get-url","origin"]);return t.trim()}catch{return null}}function mLe(){let t=(0,JN.join)((0,w5.homedir)(),".builder","projects.json");try{if((0,Ou.existsSync)(t)){let e=(0,Ou.readFileSync)(t,"utf-8");return JSON.parse(e)}}catch{}return{}}function CRt(t){let e=(0,JN.join)((0,w5.homedir)(),".builder");(0,Ou.existsSync)(e)||(0,Ou.mkdirSync)(e,{recursive:!0}),(0,Ou.writeFileSync)((0,JN.join)(e,"projects.json"),JSON.stringify(t,null,2),"utf-8")}async function IRt(){let t=await fLe();return t?mLe()[t]?.pinnedProjectId??null:null}async function b5(t){let e=await fLe();if(!e)return;let r=mLe();r[e]={pinnedProjectId:t},CRt(r)}async function ERt(t,e,r){let n=new URL("/projects",Oe);n.searchParams.set("apiKey",t),n.searchParams.set("userId",r),n.searchParams.set("includeBranches","false");let i=await Ue(n,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!i.ok){let s=await i.text();throw new Error(`Failed to list projects: ${s}`)}return(await i.json()).projects??[]}async function v5(t,e,r,n){let i=new URL(`/projects/${n}`,Oe);i.searchParams.set("apiKey",t),i.searchParams.set("userId",r),i.searchParams.set("includeBranches","true");let o=await Ue(i,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}});if(!o.ok){let s=await o.text();throw new Error(`Failed to fetch project: ${s}`)}return o.json()}function BRt(t,e){let r=t.branches??{};for(let[n,i]of Object.entries(r))if(i.gitAiBranch===e)return[n,i];return null}async function yRt(t,e,r,n,i){let o=new URL("/projects/branch",Oe);o.searchParams.set("apiKey",t),o.searchParams.set("userId",r);let s=await Ue(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({projectId:n,gitAiBranch:i,checkoutBranch:i,actor:"push-command",userMessage:{userPrompt:`Track git branch: ${i}`}})});if(!s.ok){let A=await s.text();throw new Error(`Failed to create Builder branch: ${A}`)}let a;for await(let A of Of(s.body))if(A.length)try{let c=JSON.parse(A);c.branchName&&(c.type==="creating-branch"||c.type==="setting-up-container"||c.type==="branch-created")&&(a=c.branchName)}catch{}if(!a)throw new Error("Branch created but could not determine the branch name from the response.");return a}async function S5(t,e,r,n){if(t.projectId)return t.projectId;let i=await IRt();if(i)return i;let o=await ERt(e,r,n);if(o.length===0)throw new Error("No Builder.io projects found. Create a project first at https://builder.io/app/projects.");if(o.length===1)return o[0].id;let s=await ni({message:"Select a Builder.io project:",options:o.map(a=>({label:a.name,value:a.id}))});return et(s)&&(Ze("Cancelled."),process.exit(0)),s}async function QRt(t,e,r,n,i){let o=new URL("/projects/branch/sync",Oe);o.searchParams.set("apiKey",t),o.searchParams.set("userId",r);let s=await Ue(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({projectId:n,branchName:i,syncOptions:{remoteBranches:"ai",canPush:!1,requestRefresh:!0,uncommittedChanges:"stash",fastForward:"auto"}})}),a=await s.text();if(!s.ok)throw new Error(`${s.status} ${s.statusText}: ${a}`)}async function hLe(t,e){let{builderPublicKey:r,builderPrivateKey:n,userId:i}=await Er(t,e,{builderPrivateKey:!0,builderPublicKey:!0});if(!r||!n)throw new Error("Builder.io credentials are required. Run `npx builder.io auth` first.");let o=i??"",s;try{let{stdout:l}=await uA("git",["symbolic-ref","--short","HEAD"]);s=l.trim()}catch{throw new Error("Not inside a git repository, or HEAD is detached. Please run this command from a git branch.")}if(e.dryrun){G.info(`Dry run: would push "${s}" and ensure a Builder branch exists.`);try{await uA("git",["push","--dry-run","origin",s])}catch(l){throw new Error(`git push --dry-run failed: ${nd(l)}`)}return}let a=Ni();a.start(`Pushing "${s}" to origin...`);try{await uA("git",["push","origin",s])}catch(l){throw a.stop("git push failed.",1),G.error(nd(l)),G.info(`If the remote is ahead of your local branch, run:
|
|
6990
6990
|
${(0,jN.cyan)("npx builder.io pull <builder-branch>")} first, then retry.`),new Error("git push failed")}a.stop(`Pushed "${s}" to origin.`);let A;try{A=await S5(e,r,n,o)}catch(l){throw G.error("Could not resolve project."),l}a.start("Looking up Builder branch...");let c;try{let l=await v5(r,n,o,A),p=BRt(l,s);if(p){let[g]=p;c=g,a.stop("Builder branch found.")}else a.stop("No existing Builder branch found. Creating one..."),a.start("Creating Builder branch..."),c=await yRt(r,n,o,A,s),a.stop("Builder branch created.")}catch(l){throw a.stop("Failed to ensure Builder branch.",1),l}await b5(A);try{await QRt(r,n,o,A,c),G.info("Remote container synced.")}catch(l){let p=l instanceof Error?l.message:String(l);G.warn(`Could not notify remote container to sync: ${p}`)}let u=`https://builder.io/app/projects/${A}/${c}`;G.success("Branch pushed successfully."),G.info(`View at: ${(0,jN.green)(u)}`)}m();Bn();tg();mr();var x5=z(Hr(),1);Vc();function DRt(t,e){let r=t.branches??{};for(let[n,i]of Object.entries(r)){let o=i;if(n===e||o.id===e)return o.gitAiBranch??null}return null}async function CLe(t,e){let{builderPublicKey:r,builderPrivateKey:n,userId:i}=await Er(t,e,{builderPrivateKey:!0,builderPublicKey:!0});if(!r||!n)throw new Error("Builder.io credentials are required. Run `npx builder.io auth` first.");let o=i??"",s=e._[1];if(!s)throw new Error("Builder branch is required. Usage: npx builder.io pull <builder-branch>");e.dryrun&&G.info(`Dry run: would resolve Builder branch "${s}" to a git branch and pull.`);let a=Ni();a.start("Resolving project...");let A;try{A=await S5(e,r,n,o)}catch(l){throw a.stop("Could not resolve project.",1),l}a.stop("Project resolved."),a.start(`Resolving Builder branch "${s}"...`);let c;try{let l=await v5(r,n,o,A),p=DRt(l,s);if(!p)throw a.stop("Could not resolve Builder branch.",1),new Error(`No Builder branch matching "${s}" was found in project "${A}". Make sure the branch exists and the Builder.io web app has pushed its changes to the git remote before pulling.`);c=p,a.stop(`Resolved to git branch "${c}".`)}catch(l){throw(!(l instanceof Error)||!l.message.includes("No Builder branch"))&&a.stop("Failed to resolve branch.",1),l}if(e.dryrun){G.info(`Dry run: would pull git branch "${c}" (Builder branch: ${s})`);try{await uA("git",["pull","--dry-run","origin",c])}catch(l){throw new Error(`git pull --dry-run failed: ${nd(l)}`)}return}a.start(`Fetching "${c}" from origin...`);let u=!0;try{await uA("git",["fetch","origin",c]),a.stop(`Fetched "${c}".`)}catch{u=!1,a.stop(`Branch "${c}" not found on remote.`)}a.start(`Checking out "${c}"...`);try{await uA("git",["checkout",c])}catch{try{let l=u?["checkout","-b",c,`origin/${c}`]:["checkout","-b",c];await uA("git",l)}catch(l){a.stop("git checkout failed.",1);let p=nd(l);throw p&&G.error(p),await PE(process.cwd(),t)||G.info(`If you have local uncommitted changes blocking checkout, stash them first:
|
|
6991
6991
|
${(0,x5.cyan)("git stash")}`),new Error("git checkout failed")}}if(a.stop(`Checked out "${c}".`),u){a.start("Pulling latest changes...");try{await uA("git",["pull","origin",c])}catch(l){a.stop("git pull failed.",1);let p=nd(l);throw p&&G.error(p),await PE(process.cwd(),t)||G.info(`If you have local uncommitted changes blocking the pull, stash them first:
|
|
6992
6992
|
${(0,x5.cyan)("git stash")}`),new Error("git pull failed")}a.stop(`Pulled "${s}" successfully.`)}else G.info(`Checked out local branch "${c}". No remote branch to pull from.`);await b5(A)}async function wRt(t,e){console.log(""),fr((0,Dg.bgMagenta)((0,Dg.bold)((0,Dg.white)(" dev-tools server ")))+" "+(0,Dg.dim)(vt)),t.debug("builder dev tools cli init");let r=await(0,ILe.createDevTools)(t,e.nativeApp);await(0,BLe.createDevToolsServer)({...r,getClientId:()=>"builder-dev-tools-cli",closeAppServer:async()=>{},restartAppServer:async()=>{t.debug("restart server")},enableAppWatch:async n=>n,...t})}Ske();async function bRt(){let t=(0,yLe.default)(process.argv.slice(2),{string:["figmaToken","privateKey","spaceId","cwd","prompt","mode","token","url","sessionId","command","c","serverUrl","builderPublicKey","builderPrivateKey","builderUserId","repoFullName","branchName","installCommand","projectId","configJson","configPath","workspace","enabledTools","disabledTools","designSystemPackage","includeDirectories","addDirectory","scope","components","include","exclude","instructions","uploadCustomDocs"],boolean:["help","ci","force","verbose","fusionInit","debug","dryrun","yes","skipInstallation","skipDetailedGrouping","noAuth","auth","dev","app","noOpen","open","silent","interactive","jsonOutput","local","clearMappings","index","listIndexedRepos","disableMcp","reset","privacyMode","nativeApp","acceptSelfSigned","chat","createFusionExample","testFusionExample","continuous"],alias:{p:"port",c:"command",json:"jsonOutput",native:"nativeApp",y:"yes",add:"addDirectory",i:"include",e:"exclude",project:"projectId","dry-run":"dryrun"},default:{interactive:!1,fusionInit:!1}});t.cwd&&process.chdir(t.cwd),t.debug&&(process.env.DEBUG="1"),t.acceptSelfSigned&&(process.env.FUSION_REJECT_UNAUTHORIZED="0");let e=await Wte(!!(t.verbose||t.debug));await e.withScope(async r=>{try{let n=await(0,ELe.createDevToolsNodeSys)({cwd:process.cwd(),ignoreMissingConfig:!0});n.Sentry?.setTag("cli-command",t._.join(" ")),n.Sentry?.setContext("flags-args",{...t});let{builderPublicKey:i}=await Er(n,t,{});if(n.Sentry?.setTag("spaceId",i),t.help)return Eu(t._[t._.length-1]),await Le(0);let o=t._[0];if(o==="figma"){let s=t._[1];try{return await yDe(n,s,t),await Le(0)}catch(a){return n.Sentry?.captureException(a),a instanceof ze&&(Cn(a),Ze()),await Le(1)}}else if(o==="code"){let s=t._[1];try{t.index&&(t.skipDetailedGrouping=!0,t.skipHeader=!0,await _Y(n,t)),await iDe(n,s,t)}catch(a){return n.Sentry?.captureException(a),a instanceof ze&&(Cn(a),Ze()),await Le(1)}}else if(o==="index-repo"||o==="repo-index")try{return await _Y(n,t),await Le(0)}catch(s){return n.Sentry?.captureException(s),s instanceof ze&&(Cn(s),Ze()),await Le(1)}else if(o==="launch"||o==="fusion")try{await ARe({sys:n,args:t})}catch(s){return n.Sentry?.captureException(s),s instanceof ze&&(Cn(s),Ze()),await Le(1)}else if(o==="add"){let s=Ij(n.getAppRootDir(),process.argv.slice(2));return await pce(s),await Le(0)}else if(o==="sync"){let s=Ij(n.getAppRootDir(),process.argv.slice(2)),a=await wJ(s);await nQe(n,a).then(()=>{G.success("Builder dev tools is running")}).catch(A=>(G.error("Cannot start builder dev tools"),n.Sentry?.captureException(A),Le(1)))}else if(o==="auth"){let s=t._[1];try{return await RNe(n,s,t),await Le(0)}catch(a){return n.Sentry?.captureException(a),a instanceof ze&&(Cn(a),Ze()),await Le(1)}}else if(o==="doctor"){let s=t._[1];try{return await ATe(n,s,t),await Le(0)}catch(a){return n.Sentry?.captureException(a),a instanceof ze&&(Cn(a),Ze()),await Le(1)}}else if(o==="connect-repo"||o==="repo-connect")try{return await XNe(n,t),await Le(0)}catch(s){return n.Sentry?.captureException(s),s instanceof ze&&(Cn(s),Ze()),await Le(1)}else if(o==="agent"){let s=t._[1];try{return await hTe(n,s,t),await Le(0)}catch(a){return n.Sentry?.captureException(a),a instanceof ze&&(Cn(a),Ze()),await Le(1)}}else if(o==="space-sync")try{return await CTe(n,t),await Le(0)}catch(s){return n.Sentry?.captureException(s),s instanceof ze&&(Cn(s),Ze()),await Le(1)}else if(o==="push")try{return await hLe(n,t),await Le(0)}catch(s){return n.Sentry?.captureException(s),s instanceof ze&&(Cn(s),Ze()),await Le(1)}else if(o==="pull")try{return await CLe(n,t),await Le(0)}catch(s){return n.Sentry?.captureException(s),s instanceof ze&&(Cn(s),Ze()),await Le(1)}else if(o==="dsi-mcp")try{await dTe(n,t)}catch(s){return n.Sentry?.captureException(s),s instanceof ze&&(Cn(s),Ze()),await Le(1)}else{if(o==="help")return Eu(t._[1]),await Le(0);if(o==="publish"||o==="migrate"||o==="generate")return Ze("Command not found, do you mean `npx "+Cr()+" figma "+o+"`?"),await Le(1);wRt(n,t).then(()=>{G.success("Builder dev tools is running")}).catch(s=>(G.error("Cannot start builder dev tools"),e.captureException(s),Le(1)))}}catch(n){return e.captureException(n),n instanceof ze&&(Cn(n),Ze("Cannot start builder dev tools due to network error")),await Le(1)}})}bRt();var vRt=void 0;
|