@builder.io/dev-tools 1.53.3 → 1.53.4-beta.202605061129.94c473a
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 +29 -29
- package/cli/index.cjs.map +4 -4
- 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/cli/codegen.d.ts +5 -1
- package/types/tsconfig.tsbuildinfo +1 -1
package/cli/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var vve=Object.create;var UB=Object.defineProperty;var xve=Object.getOwnPropertyDescriptor;var Fve=Object.getOwnPropertyNames;var kve=Object.getPrototypeOf,Rve=Object.prototype.hasOwnProperty;var L=(t,e)=>()=>(t&&(e=t(t=0)),e);var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),GB=(t,e)=>{for(var r in e)UB(t,r,{get:e[r],enumerable:!0})},IJ=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Fve(e))!Rve.call(t,i)&&i!==r&&UB(t,i,{get:()=>e[i],enumerable:!(n=xve(e,i))||n.enumerable});return t};var z=(t,e,r)=>(r=t!=null?vve(kve(t)):{},IJ(e||!t||!t.__esModule?UB(r,"default",{value:t,enumerable:!0}):r,t)),Kr=t=>IJ(UB({},"__esModule",{value:!0}),t);var h=L(()=>{(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 vve=Object.create;var UB=Object.defineProperty;var xve=Object.getOwnPropertyDescriptor;var Fve=Object.getOwnPropertyNames;var kve=Object.getPrototypeOf,Rve=Object.prototype.hasOwnProperty;var L=(t,e)=>()=>(t&&(e=t(t=0)),e);var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),GB=(t,e)=>{for(var r in e)UB(t,r,{get:e[r],enumerable:!0})},IJ=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Fve(e))!Rve.call(t,i)&&i!==r&&UB(t,i,{get:()=>e[i],enumerable:!(n=xve(e,i))||n.enumerable});return t};var z=(t,e,r)=>(r=t!=null?vve(kve(t)):{},IJ(e||!t||!t.__esModule?UB(r,"default",{value:t,enumerable:!0}):r,t)),Kr=t=>IJ(UB({},"__esModule",{value:!0}),t);var h=L(()=>{(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"94c473aa7a717a09e8f1aef7fb892c89dcda9821"}}catch{}})()});var BJ=R((TEt,EJ)=>{h();function EF(t){return t==null?[]:Array.isArray(t)?t:[t]}function Nve(t,e,r,n){var i,s=t[e],o=~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]=s==null?o:Array.isArray(s)?s.concat(o):[s,o]}EJ.exports=function(t,e){t=t||[],e=e||{};var r,n,i,s,o,a={_:[]},A=0,c=0,u=0,l=t.length;let d=e.alias!==void 0,g=e.unknown!==void 0,p=e.default!==void 0;if(e.alias=e.alias||{},e.string=EF(e.string),e.boolean=EF(e.boolean),d)for(r in e.alias)for(n=e.alias[r]=EF(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(p){for(r in e.default)if(s=typeof e.default[r],n=e.alias[r]=e.alias[r]||[],e[s]!==void 0)for(e[s].push(r),A=0;A<n.length;A++)e[s].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(s=i.substring(c+3),g&&!~f.indexOf(s))return e.unknown(i);a[s]=!1}else{for(u=c+1;u<i.length&&i.charCodeAt(u)!==61;u++);for(s=i.substring(c,u),o=i.substring(++u)||A+1===l||(""+t[A+1]).charCodeAt(0)===45||t[++A],n=c===2?[s]:s,u=0;u<n.length;u++){if(s=n[u],g&&!~f.indexOf(s))return e.unknown("-".repeat(c)+s);Nve(a,s,u+1<n.length||o,e)}}}if(p)for(r in e.default)a[r]===void 0&&(a[r]=e.default[r]);if(d)for(r in a)for(n=e.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a}});function Tve(){if(em!==void 0)return em;try{return em=require("prettier"),em}catch{return em=null,null}}function Mve(t){let e=[],r=Dl.default.dirname(t);for(;r!==Dl.default.dirname(r);){let n=Dl.default.join(r,".prettierignore");BF.default.existsSync(n)&&e.push(n);let i=Dl.default.join(r,".git");if(BF.default.existsSync(i))break;r=Dl.default.dirname(r)}return e}function Pve(t){if(t)try{let r=(0,yJ.createRequire)(t)("prettier");if(r)return r}catch{}return Tve()}async function FA(t,e,r,n){try{let i=Dl.default.resolve(t,n??"file.tsx"),s=Pve(i);if(!s)return e;if(n){let A=Mve(i);if((await s.getFileInfo(i,{ignorePath:A.length>0?A:void 0})).ignored)return e}let o=await s.resolveConfig(i);return await s.format(e,{...o,filepath:n,parser:r})}catch{return e}}var yJ,Dl,BF,em,yF=L(()=>{"use strict";h();yJ=require("node:module"),Dl=z(require("node:path"),1),BF=z(require("node:fs"),1)});var QF,yp,OB,KB,QJ,wl,DF,wF,bl,DJ,Qp=L(()=>{"use strict";h();QF="preview-url",yp="framework",OB="platform",KB="node",QJ="/~builder-connect",wl="/~builder-connected",DF="/~builder-dev-tools",wF="/~builder-dev-tools.js",bl="/~builder-dev-tools-close",DJ="/mappings"});var HB=R((GEt,wJ)=>{"use strict";h();var bF={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"},Lve={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},_ve={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?bF.up():"");return t&&(e+=bF.left),e}};wJ.exports={cursor:bF,scroll:Lve,erase:_ve,beep:"\x07"}});var pr=R((KEt,SF)=>{h();var YB=process||{},bJ=YB.argv||[],JB=YB.env||{},Uve=!(JB.NO_COLOR||bJ.includes("--no-color"))&&(!!JB.FORCE_COLOR||bJ.includes("--color")||YB.platform==="win32"||(YB.stdout||{}).isTTY&&JB.TERM!=="dumb"||!!JB.CI),Gve=(t,e,r=t)=>n=>{let i=""+n,s=i.indexOf(e,t.length);return~s?t+Ove(i,e,r,s)+e:t+i+e},Ove=(t,e,r,n)=>{let i="",s=0;do i+=t.substring(s,n)+r,s=n+e.length,n=t.indexOf(e,s);while(~n);return i+t.substring(s)},SJ=(t=Uve)=>{let e=t?Gve:()=>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")}};SF.exports=SJ();SF.exports.createColors=SJ});function Kve({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 _J(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Hve,"")}function UJ(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function tm(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=_J(t),t.length===0))return 0;t=t.replace(qve()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(Yve.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function Wve(){let t=new Map;for(let[e,r]of Object.entries(vr)){for(let[n,i]of Object.entries(r))vr[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=vr[n],t.set(i[0],i[1]);Object.defineProperty(vr,e,{value:r,enumerable:!1})}return Object.defineProperty(vr,"codes",{value:t,enumerable:!1}),vr.color.close="\x1B[39m",vr.bgColor.close="\x1B[49m",vr.color.ansi=vJ(),vr.color.ansi256=xJ(),vr.color.ansi16m=FJ(),vr.bgColor.ansi=vJ(vF),vr.bgColor.ansi256=xJ(vF),vr.bgColor.ansi16m=FJ(vF),Object.defineProperties(vr,{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(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>vr.rgbToAnsi256(...vr.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 s=Math.max(r,n,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>vr.ansi256ToAnsi(vr.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>vr.ansi256ToAnsi(vr.hexToAnsi256(e)),enumerable:!1}}),vr}function NJ(t,e,r){return String(t).normalize().replace(/\r\n/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`).map(n=>rxe(n,e,r)).join(`
|
|
4
4
|
`)}function TF(t,e){if(typeof t=="string")return qB.aliases.get(t)===e;for(let r of t)if(r!==void 0&&TF(r,e))return!0;return!1}function ixe(t,e){if(t===e)return;let r=t.split(`
|
|
@@ -73,7 +73,7 @@ ${qJ}${n.trimStart()}`),r=3+(0,Sl.stripVTControlCharacters)(n.trimStart()).lengt
|
|
|
73
73
|
`),p(),i()};return{start:I,stop:B,message:(E="")=>{a=m(E??a)}}}});function Ht(t,e=""){return t.ts.createSourceFile("module.tsx",typeof e=="string"?e:"",t.ts.ScriptTarget.Latest,void 0)}function ey(t,e=""){let r=Ht(t,e?.trim());if(r.statements.length===0)throw new Error(`No statements found in code: ${e}`);return r.statements[0]}function vn(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 _r=L(()=>{"use strict";h()});var t9=R((iBt,e9)=>{"use strict";h();e9.exports=function(){if(process.env.npm_config_user_agent)return Bxe(process.env.npm_config_user_agent)};function Bxe(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 _s(t){return t.endsWith(".mapper.tsx")||t.endsWith(".mapper.jsx")||t.endsWith(".mapper.ts")||t.endsWith(".mapper.js")||t.endsWith(".mapper.mjs")}function Jt(t,e,r){e=No(e),r=No(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=No(t.normalize(i)),i.startsWith(".")||(i="./"+i),i}function No(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}function xl(t,e){let r=t.extname(e),n=t.basename(e,r).split(/[\/\\]/),i=n[n.length-1];return r9(i==="index"?t.basename(t.dirname(e)):i)}function r9(t){return dr(t).replace(/ /g,"")}function Us(t,e){let r=t.extname(e),n=No(t.basename(e,r)).split("/").pop();return dr(n==="index"?t.basename(t.dirname(e)):n)}function fr(t,e){let r=No(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 er(t,e){let r=e,n=[];for(let i=0;i<2;i++){let s=t.basename(r);if(!s||s==="components")break;n.unshift(s),r=t.dirname(r)}return n.join("/")}function dr(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 qi(t){return t.sort((e,r)=>e.name.toLocaleLowerCase().localeCompare(r.name.toLocaleLowerCase()))}async function ur(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 i9(t){return(await t.hash(t.getAppRootDir())).substring(0,8)}function nm(t){return typeof t=="number"}function Sp(t){return typeof t=="boolean"}function Si(t){return typeof t=="string"}function vp(t){return typeof t=="string"?/^[A-Z][A-Za-z0-9]*$/.test(t):!1}function Is(t){return JSON.parse(JSON.stringify(t))}function ty(t,e,r){for(let n of e)if(t.dirname(r).includes(n))return!0;return!1}function s9(){try{let t=(0,n9.default)();if(t?.name)return t.name}catch{}return"npm"}function yxe(){return process.platform.startsWith("win")}function rt(){return process.pkg?"@builder.io/agent":yxe()?'"@builder.io/dev-tools"':"builder.io"}function GF(t){return t.replace(/[^a-zA-Z0-9-_]/g,"_")}var n9,Qt=L(()=>{"use strict";h();n9=z(t9(),1)});function vi(t){let e=t.join(t.getAppRootDir(),"tsconfig.json");return t.exists(e)}async function $i(t,e){async function r(i,s){if(s>10)return;let o=await t.readdir(i);for(let a of o){if(Qxe.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,s+1);if(u)return u}}}}let n=await r(t.getAppRootDir(),0);if(!n){let s=`builder-registry.${await vi(t)?"ts":"js"}`;return t.join(e,s)}return n}async function To(t,e){let r=t.resolve("/");for(let n=0;n<20;n++){let i=t.join(e,"package.json"),s=await t.readFile(i);if(s)return JSON.parse(s);if(e===r)break;e=t.dirname(e)}return null}async function o9(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 im(t,e,r){let n=await t.readdir(e);return n.includes(r)?t.join(e,r):(await Promise.all(n.map(async s=>{if(s.startsWith(".")||s==="node_modules")return;let o=t.join(e,s);if((await t.stat(o)).isDirectory()){let A=await im(t,o,r);if(A)return A}}))).find(s=>typeof s=="string")}var Qxe,gi=L(()=>{"use strict";h();Qxe=["node_modules","dist","build","public"]});async function fn(t,e,r){if(!Array.isArray(e)||e.length===0)throw new Error(`createTsProgram() Invalid filePaths: ${e}`);let n=await o9(t,e[0]),i=t.join(n,"typescript","lib"),s=new Map,o={fileExists:a=>{if(a=t.normalize(a),a.includes("node_modules")){let A=sm.get(a);if(!A){try{t.statSync(a).isFile()?A={exists:!0,content:t.readFileSync(a)}:A={exists:!1}}catch{A={exists:!1}}sm.set(a,A)}return A.exists}if(!s.has(a))if(t.existsSync(a)){let c=t.statSync(a);s.set(a,c.isFile())}else s.set(a,!1);return s.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=sm.get(a);if(c)return Ht(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=A9.get(c),A==null&&typeof self<"u"&&typeof fetch=="function"))throw new ny(c)}return a.includes("node_modules")&&(A?sm.set(a,{exists:!0,content:A}):sm.set(a,{exists:!1})),Ht(t,A)},readFile:a=>{let A=t.readFileSync(a);return typeof A=="string"?A:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return Dxe(t,o,e,r)}catch(a){if(a instanceof ny){await wxe(t,a.libName);continue}throw t.Sentry?.captureException(a),new Error(`createTsProgram() Could not create program for: ${e[0]}`,{cause:a})}}function Dxe(t,e,r,n){let i={rootNames:[...r],host:e,options:{}},s=t.ts.findConfigFile(t.dirname(r[0]),o=>t.existsSync(o));if(s){let o=a9.get(s);if(!o){let a=t.ts.readConfigFile(s,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:s}}):(o=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(s),void 0,s).options,a9.set(s,o))}o&&(i.options=Is(o))}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 xp(t,e,r){r||(r=await fn(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 wxe(t,e){let r=`https://cdn.jsdelivr.net/npm/typescript@${t.ts.version}/lib/${e}`;ry.has(e)||ry.set(e,fetch(r).then(n=>n.text()).then(n=>{A9.set(e,n)})),await ry.get(e),ry.delete(e)}async function c9(t,e){let r=await t.readFile(e.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${e.filePath}`}],code:null,output:null}:OF(t,{code:r,filePath:e.filePath,compilerOptions:e.compilerOptions})}function OF(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 ny,A9,ry,sm,a9,Gs=L(()=>{"use strict";h();_r();Qt();gi();ny=class{libName;constructor(e){this.libName=e}};A9=new Map,ry=new Map,sm=new Map,a9=new Map});var bxe,ut,Hr=L(()=>{"use strict";h();bxe="1.53.
|
|
76
|
+
`,getSourceFile:a=>{if(a=t.normalize(a),a.includes("node_modules")){let c=sm.get(a);if(c)return Ht(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=A9.get(c),A==null&&typeof self<"u"&&typeof fetch=="function"))throw new ny(c)}return a.includes("node_modules")&&(A?sm.set(a,{exists:!0,content:A}):sm.set(a,{exists:!1})),Ht(t,A)},readFile:a=>{let A=t.readFileSync(a);return typeof A=="string"?A:void 0},useCaseSensitiveFileNames:()=>!1,writeFile:()=>{}};for(;;)try{return Dxe(t,o,e,r)}catch(a){if(a instanceof ny){await wxe(t,a.libName);continue}throw t.Sentry?.captureException(a),new Error(`createTsProgram() Could not create program for: ${e[0]}`,{cause:a})}}function Dxe(t,e,r,n){let i={rootNames:[...r],host:e,options:{}},s=t.ts.findConfigFile(t.dirname(r[0]),o=>t.existsSync(o));if(s){let o=a9.get(s);if(!o){let a=t.ts.readConfigFile(s,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:s}}):(o=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(s),void 0,s).options,a9.set(s,o))}o&&(i.options=Is(o))}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 xp(t,e,r){r||(r=await fn(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 wxe(t,e){let r=`https://cdn.jsdelivr.net/npm/typescript@${t.ts.version}/lib/${e}`;ry.has(e)||ry.set(e,fetch(r).then(n=>n.text()).then(n=>{A9.set(e,n)})),await ry.get(e),ry.delete(e)}async function c9(t,e){let r=await t.readFile(e.filePath);return r==null?{diagnostics:[{messageText:`Error reading: ${e.filePath}`}],code:null,output:null}:OF(t,{code:r,filePath:e.filePath,compilerOptions:e.compilerOptions})}function OF(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 ny,A9,ry,sm,a9,Gs=L(()=>{"use strict";h();_r();Qt();gi();ny=class{libName;constructor(e){this.libName=e}};A9=new Map,ry=new Map,sm=new Map,a9=new Map});var bxe,ut,Hr=L(()=>{"use strict";h();bxe="1.53.4-beta.202605061129.94c473a",ut=process.env.OVERRIDE_VERSION??bxe});async function Fl(t){let e=[],r=await To(t,t.getRepoRootDir());if(r){let n=await l9(r,t);e.push(...n)}return e}async function l9(t,e){let r=[];if(t&&typeof t=="object"){let n=new Set(Object.keys({...t.dependencies,...t.devDependencies}));for(let i of Sxe)if(n.has(i)&&!r.some(s=>s.name===i)){let s={name:i};u9.has(i)&&(s.version=await u9.get(i)(e)),r.push(s)}}return r}function KF(t){let e=parseInt(t);return Number.isNaN(e)?void 0:e}var u9,Sxe,kl=L(()=>{"use strict";h();gi();Qt();u9=new Map([["next",async t=>{if(!t.spawnSync)return;let e=s9(),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 s=i[0].split("Next.js v")[1],[o,a,A]=s.split(".");return{major:KF(o),minor:KF(a),patch:KF(A)}}]]),Sxe=["@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 Os(t){let e=g9(t),r=await t.readFile(e);return typeof r=="string"?JSON.parse(r):{}}async function Ks(t,e){e=typeof e=="object"&&e!=null?e:{};let r=g9(t);await t.writeFile(r,JSON.stringify(e??{},null,2))}function g9(t){let e=t.getAppRootDir();return t.join(e,"node_modules",".builder","builder-cache.json")}var Rl=L(()=>{"use strict";h()});async function Ba(t,e,r){let n={envKey:r,envValue:null,file:""};for(let i of e){let s=t.join(t.getAppRootDir(),i),o=await vxe(t,s);if(o){let a=o[r];if(typeof a=="string"&&a.length>0&&a!=="YOUR_API_KEY")return n.envValue=a,n.file=s,n}}return n.file=t.join(t.getAppRootDir(),e[e.length-1]),n}async function vxe(t,e){let r=await t.readFile(e);return typeof r=="string"?p9(r):null}function p9(t){let e={},r=t.replace(/\r\n?/gm,`
|
|
77
77
|
`),n;for(;(n=xxe.exec(r))!=null;){let i=n[1],s=n[2]||"";s=s.trim();let o=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/gm,"$2"),o==='"'&&(s=s.replace(/\\n/g,`
|
|
78
78
|
`),s=s.replace(/\\r/g,"\r")),e[i]=s}return e}async function ya(t,e,r,n){let i="# https://www.builder.io/c/docs/using-your-api-key",s=await t.readFile(e);try{if(s)if(s.includes(r))if(s.includes(n))t.debug(`"${r}" with "${n}" already set in ${e}`);else return t.debug(`Replace "${r}" in ${e}`),s=s.replace(new RegExp(`${r}=.*`),`${r}=${n}`),await t.writeFile(e,s),"update";else return t.debug(`Append "${r}" to ${e}`),s+=`
|
|
79
79
|
|
|
@@ -1107,7 +1107,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),K=Y,U=J),O===void 0&&(
|
|
|
1107
1107
|
`:`
|
|
1108
1108
|
`)+r,i=n+1,n=t.indexOf(`
|
|
1109
1109
|
`,i)}while(n!==-1);return s+=t.slice(i),s}var x5=L(()=>{h()});function Rm(t){return N5(t)}var F5,k5,oR,Vp,km,R5,Wp,STe,Hy,N5,aR,vTe,xTe,AR,Jy,FTe,Gkt,Okt,T5=L(()=>{h();y5();b5();x5();({stdout:F5,stderr:k5}=w5),oR=Symbol("GENERATOR"),Vp=Symbol("STYLER"),km=Symbol("IS_EMPTY"),R5=["ansi","ansi","ansi256","ansi16m"],Wp=Object.create(null),STe=(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=F5?F5.level:0;t.level=e.level===void 0?r:e.level},Hy=class{constructor(e){return N5(e)}},N5=t=>{let e=(...r)=>r.join(" ");return STe(e,t),Object.setPrototypeOf(e,Rm.prototype),e};Object.setPrototypeOf(Rm.prototype,Function.prototype);for(let[t,e]of Object.entries(Uo))Wp[t]={get(){let r=Jy(this,AR(e.open,e.close,this[Vp]),this[km]);return Object.defineProperty(this,t,{value:r}),r}};Wp.visible={get(){let t=Jy(this,this[Vp],!0);return Object.defineProperty(this,"visible",{value:t}),t}};aR=(t,e,r,...n)=>t==="rgb"?e==="ansi16m"?Uo[r].ansi16m(...n):e==="ansi256"?Uo[r].ansi256(Uo.rgbToAnsi256(...n)):Uo[r].ansi(Uo.rgbToAnsi(...n)):t==="hex"?aR("rgb",e,r,...Uo.hexToRgb(...n)):Uo[r][t](...n),vTe=["rgb","hex","ansi256"];for(let t of vTe){Wp[t]={get(){let{level:r}=this;return function(...n){let i=AR(aR(t,R5[r],"color",...n),Uo.color.close,this[Vp]);return Jy(this,i,this[km])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);Wp[e]={get(){let{level:r}=this;return function(...n){let i=AR(aR(t,R5[r],"bgColor",...n),Uo.bgColor.close,this[Vp]);return Jy(this,i,this[km])}}}}xTe=Object.defineProperties(()=>{},{...Wp,level:{enumerable:!0,get(){return this[oR].level},set(t){this[oR].level=t}}}),AR=(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}},Jy=(t,e,r)=>{let n=(...i)=>FTe(n,i.length===1?""+i[0]:i.join(" "));return Object.setPrototypeOf(n,xTe),n[oR]=t,n[Vp]=e,n[km]=r,n},FTe=(t,e)=>{if(t.level<=0||!e)return t[km]?"":e;let r=t[Vp];if(r===void 0)return e;let{openAll:n,closeAll:i}=r;if(e.includes("\x1B"))for(;r!==void 0;)e=S5(e,r.close,r.open),r=r.parent;let s=e.indexOf(`
|
|
1110
|
-
`);return s!==-1&&(e=v5(e,i,n,s)),n+e+i};Object.defineProperties(Rm.prototype,Wp);Gkt=Rm(),Okt=Rm({level:k5?k5.level:0})});function uR(t){let e=nR(t);return{highlight:r,highlightAuto:n,listLanguages:e.listLanguages,register:e.register,registerAlias:e.registerAlias,registered:e.registered};function r(i,s,o){let a=e.highlight(i,s),A=a.data;return{language:A.language,relevance:A.relevance,value:cR(o||M5,a)}}function n(i,s){let o,a;if(s&&("subset"in s||"sheet"in s)){let u=s;a={subset:u.subset},o=u.sheet}else o=s;let A=e.highlightAuto(i,a),c=A.data;return{language:c.language,relevance:c.relevance,value:cR(o||M5,A)}}}function cR(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,s="",o;for(o in t)if(Object.hasOwn(t,o)){let a=o.split(" "),A=t[o];r.has(a[0])?a.length===1?i=A:n[a.slice(1).join(" ")]=A:n[o]=A}return"value"in e?s=e.value:"children"in e&&(s=kTe(n,e.children)),i&&(s=i(s)),s}function kTe(t,e){let r=[],n=-1;for(;++n<e.length;)r.push(cR(t,e[n]));return r.join("")}var Ut,M5,P5=L(()=>{h();T5();iR();Ut=new Hy({level:2}),M5={comment:Ut.gray,quote:Ut.gray,keyword:Ut.green,"selector-tag":Ut.green,addition:Ut.green,number:Ut.cyan,string:Ut.cyan,"meta meta-string":Ut.cyan,literal:Ut.cyan,doctag:Ut.cyan,regexp:Ut.cyan,title:Ut.blue,section:Ut.blue,name:Ut.blue,"selector-id":Ut.blue,"selector-class":Ut.blue,attribute:Ut.yellow,attr:Ut.yellow,variable:Ut.yellow,"template-variable":Ut.yellow,"class title":Ut.yellow,type:Ut.yellow,symbol:Ut.magenta,bullet:Ut.magenta,subst:Ut.magenta,meta:Ut.magenta,"meta keyword":Ut.magenta,"selector-attr":Ut.magenta,"selector-pseudo":Ut.magenta,link:Ut.magenta,built_in:Ut.red,deletion:Ut.red,emphasis:Ut.italic,strong:Ut.bold,formula:Ut.inverse}});var L5=L(()=>{h();iR();P5()});async function Ne(t){if(process.env.NODE_ENV!=="test")try{let e=process.env.BUILDER_DISABLE_AMPLITUDE==="true",r=[_5.flush(2e3)];e||r.push(U5.flush().promise),await Promise.allSettled(r)}catch(e){RTe.error(e)}process.exit(t)}var _5,U5,RTe,Bs=L(()=>{"use strict";h();_5=z(require("@sentry/node"),1),U5=z(require("@amplitude/analytics-node"),1);Dt();RTe=Se("Exit")});var ke,yr=L(()=>{"use strict";h();ke=process.env.AIR_HOST||process.env.BUILDER_HOST||"https://api.builder.io"});var O5,G5=L(()=>{O5="1.53.
|
|
1110
|
+
`);return s!==-1&&(e=v5(e,i,n,s)),n+e+i};Object.defineProperties(Rm.prototype,Wp);Gkt=Rm(),Okt=Rm({level:k5?k5.level:0})});function uR(t){let e=nR(t);return{highlight:r,highlightAuto:n,listLanguages:e.listLanguages,register:e.register,registerAlias:e.registerAlias,registered:e.registered};function r(i,s,o){let a=e.highlight(i,s),A=a.data;return{language:A.language,relevance:A.relevance,value:cR(o||M5,a)}}function n(i,s){let o,a;if(s&&("subset"in s||"sheet"in s)){let u=s;a={subset:u.subset},o=u.sheet}else o=s;let A=e.highlightAuto(i,a),c=A.data;return{language:c.language,relevance:c.relevance,value:cR(o||M5,A)}}}function cR(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,s="",o;for(o in t)if(Object.hasOwn(t,o)){let a=o.split(" "),A=t[o];r.has(a[0])?a.length===1?i=A:n[a.slice(1).join(" ")]=A:n[o]=A}return"value"in e?s=e.value:"children"in e&&(s=kTe(n,e.children)),i&&(s=i(s)),s}function kTe(t,e){let r=[],n=-1;for(;++n<e.length;)r.push(cR(t,e[n]));return r.join("")}var Ut,M5,P5=L(()=>{h();T5();iR();Ut=new Hy({level:2}),M5={comment:Ut.gray,quote:Ut.gray,keyword:Ut.green,"selector-tag":Ut.green,addition:Ut.green,number:Ut.cyan,string:Ut.cyan,"meta meta-string":Ut.cyan,literal:Ut.cyan,doctag:Ut.cyan,regexp:Ut.cyan,title:Ut.blue,section:Ut.blue,name:Ut.blue,"selector-id":Ut.blue,"selector-class":Ut.blue,attribute:Ut.yellow,attr:Ut.yellow,variable:Ut.yellow,"template-variable":Ut.yellow,"class title":Ut.yellow,type:Ut.yellow,symbol:Ut.magenta,bullet:Ut.magenta,subst:Ut.magenta,meta:Ut.magenta,"meta keyword":Ut.magenta,"selector-attr":Ut.magenta,"selector-pseudo":Ut.magenta,link:Ut.magenta,built_in:Ut.red,deletion:Ut.red,emphasis:Ut.italic,strong:Ut.bold,formula:Ut.inverse}});var L5=L(()=>{h();iR();P5()});async function Ne(t){if(process.env.NODE_ENV!=="test")try{let e=process.env.BUILDER_DISABLE_AMPLITUDE==="true",r=[_5.flush(2e3)];e||r.push(U5.flush().promise),await Promise.allSettled(r)}catch(e){RTe.error(e)}process.exit(t)}var _5,U5,RTe,Bs=L(()=>{"use strict";h();_5=z(require("@sentry/node"),1),U5=z(require("@amplitude/analytics-node"),1);Dt();RTe=Se("Exit")});var ke,yr=L(()=>{"use strict";h();ke=process.env.AIR_HOST||process.env.BUILDER_HOST||"https://api.builder.io"});var O5,G5=L(()=>{O5="1.53.4"});var m$=R(Km=>{"use strict";h();Object.defineProperty(Km,"__esModule",{value:!0});function TTe(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 Ga=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}},ed=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 Ri(t,e){let{line:r,column:n,index:i}=t;return new Ga(r,n+e,i+e)}var K5="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",MTe={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:K5},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:K5}},H5={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"},qy=t=>t.type==="UpdateExpression"?H5.UpdateExpression[`${t.prefix}`]:H5[t.type],PTe={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 ${qy(t)}.`,InvalidLhsBinding:({ancestor:t})=>`Binding invalid left-hand side in ${qy(t)}.`,InvalidLhsOptionalChaining:({ancestor:t})=>`Invalid optional chaining in the left-hand side of ${qy(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."},LTe={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."},_Te={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)}\`.`},UTe=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),GTe=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 ${qy({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.'}),OTe=["message"];function J5(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!0,value:r})}function KTe({toMessage:t,code:e,reasonCode:r,syntaxPlugin:n}){let i=r==="MissingPlugin"||r==="MissingOneOfPlugins",s={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};return s[r]&&(r=s[r]),function o(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),J5(c,"clone",function(l={}){var d;let{line:g,column:p,index:f}=(d=l.loc)!=null?d:a;return o(new Ga(g,p,f),Object.assign({},A,l.details))}),J5(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 _a(t,e){if(Array.isArray(t))return n=>_a(n,t[0]);let r={};for(let n of Object.keys(t)){let i=t[n],s=typeof i=="string"?{message:()=>i}:typeof i=="function"?{message:i}:i,{message:o}=s,a=TTe(s,OTe),A=typeof o=="string"?()=>o:o;r[n]=KTe(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:n,toMessage:A},e?{syntaxPlugin:e}:{},a))}return r}var W=Object.assign({},_a(MTe),_a(PTe),_a(LTe),_a(_Te),_a`pipelineOperator`(GTe));function HTe(){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 JTe(t){let e=HTe();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:YTe}=Object,Y5=(t,e)=>{t&&YTe(t,e,{enumerable:!1,value:t[e]})};function Nm(t){return Y5(t.loc.start,"index"),Y5(t.loc.end,"index"),t}var jTe=t=>class extends t{parse(){let r=Nm(super.parse());return this.optionFlags&256&&(r.tokens=r.tokens.map(Nm)),r}parseRegExpLiteral({pattern:r,flags:n}){let i=null;try{i=new RegExp(r,n)}catch{}let s=this.estreeParseLiteral(i);return s.regex={pattern:r,flags:n},s}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:s,range:o,raw:a,value:A}=r,c=Object.create(r.constructor.prototype);return c.type="Literal",c.start=n,c.end=i,c.loc=s,c.range=o,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,s,o){super.parseBlockBody(r,n,i,s,o);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,s,o,a,A=!1){let c=this.startNode();c.kind=r.kind,c=super.parseMethod(c,n,i,s,o,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,s){let o=super.parseObjectProperty(r,n,i,s);return o&&(o.kind="init",this.castNodeTo(o,"Property")),o}finishObjectProperty(r){return r.kind="init",this.finishNode(r,"Property")}isValidLVal(r,n,i,s){return r==="Property"?"value":super.isValidLVal(r,n,i,s)}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:s}=r;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.loc.start),this.toAssignable(s,n)}else super.toAssignable(r,n)}toAssignableObjectExpressionProp(r,n,i){r.type==="Property"&&(r.kind==="get"||r.kind==="set")?this.raise(W.PatternHasAccessor,r.key):r.type==="Property"&&r.method?this.raise(W.PatternHasMethod,r.key):super.toAssignableObjectExpressionProp(r,n,i)}finishCallExpression(r,n){let i=super.finishCallExpression(r,n);if(i.callee.type==="Import"){var s,o;this.castNodeTo(i,"ImportExpression"),i.source=i.arguments[0],i.options=(s=i.arguments[1])!=null?s:null,i.attributes=(o=i.arguments[1])!=null?o: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,s=super.parseExport(r,n);switch(s.type){case"ExportAllDeclaration":s.exported=null;break;case"ExportNamedDeclaration":s.specifiers.length===1&&s.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(s,"ExportAllDeclaration"),s.exported=s.specifiers[0].exported,delete s.specifiers);case"ExportDefaultDeclaration":{var o;let{declaration:a}=s;a?.type==="ClassDeclaration"&&((o=a.decorators)==null?void 0:o.length)>0&&a.start===s.start&&this.resetStartLocation(s,i)}break}return s}stopParseSubscript(r,n){let i=super.stopParseSubscript(r,n);return n.optionalChainMember?this.estreeParseChainExpression(i,r.loc.end):i}parseMember(r,n,i,s,o){let a=super.parseMember(r,n,i,s,o);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 Nm(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),Nm(r)}resetEndLocation(r,n=this.state.lastTokEndLoc){super.resetEndLocation(r,n),Nm(r)}},jl=class{constructor(e,r){this.token=void 0,this.preserveSpace=void 0,this.token=e,this.preserveSpace=!!r}},zt={brace:new jl("{"),j_oTag:new jl("<tag"),j_cTag:new jl("</tag"),j_expr:new jl("<tag>...</tag>",!0)};zt.template=new jl("`",!0);var It=!0,be=!0,lR=!0,Tm=!0,eu=!0,qTe=!0,Wy=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}},_R=new Map;function Gt(t,e={}){e.keyword=t;let r=Je(t,e);return _R.set(t,r),r}function ki(t,e){return Je(t,{beforeExpr:It,binop:e})}var _m=-1,GA=[],UR=[],GR=[],OR=[],KR=[],HR=[];function Je(t,e={}){var r,n,i,s;return++_m,UR.push(t),GR.push((r=e.binop)!=null?r:-1),OR.push((n=e.beforeExpr)!=null?n:!1),KR.push((i=e.startsExpr)!=null?i:!1),HR.push((s=e.prefix)!=null?s:!1),GA.push(new Wy(t,e)),_m}function wt(t,e={}){var r,n,i,s;return++_m,_R.set(t,_m),UR.push(t),GR.push((r=e.binop)!=null?r:-1),OR.push((n=e.beforeExpr)!=null?n:!1),KR.push((i=e.startsExpr)!=null?i:!1),HR.push((s=e.prefix)!=null?s:!1),GA.push(new Wy("name",e)),_m}var $Te={bracketL:Je("[",{beforeExpr:It,startsExpr:be}),bracketHashL:Je("#[",{beforeExpr:It,startsExpr:be}),bracketBarL:Je("[|",{beforeExpr:It,startsExpr:be}),bracketR:Je("]"),bracketBarR:Je("|]"),braceL:Je("{",{beforeExpr:It,startsExpr:be}),braceBarL:Je("{|",{beforeExpr:It,startsExpr:be}),braceHashL:Je("#{",{beforeExpr:It,startsExpr:be}),braceR:Je("}"),braceBarR:Je("|}"),parenL:Je("(",{beforeExpr:It,startsExpr:be}),parenR:Je(")"),comma:Je(",",{beforeExpr:It}),semi:Je(";",{beforeExpr:It}),colon:Je(":",{beforeExpr:It}),doubleColon:Je("::",{beforeExpr:It}),dot:Je("."),question:Je("?",{beforeExpr:It}),questionDot:Je("?."),arrow:Je("=>",{beforeExpr:It}),template:Je("template"),ellipsis:Je("...",{beforeExpr:It}),backQuote:Je("`",{startsExpr:be}),dollarBraceL:Je("${",{beforeExpr:It,startsExpr:be}),templateTail:Je("...`",{startsExpr:be}),templateNonTail:Je("...${",{beforeExpr:It,startsExpr:be}),at:Je("@"),hash:Je("#",{startsExpr:be}),interpreterDirective:Je("#!..."),eq:Je("=",{beforeExpr:It,isAssign:Tm}),assign:Je("_=",{beforeExpr:It,isAssign:Tm}),slashAssign:Je("_=",{beforeExpr:It,isAssign:Tm}),xorAssign:Je("_=",{beforeExpr:It,isAssign:Tm}),moduloAssign:Je("_=",{beforeExpr:It,isAssign:Tm}),incDec:Je("++/--",{prefix:eu,postfix:qTe,startsExpr:be}),bang:Je("!",{beforeExpr:It,prefix:eu,startsExpr:be}),tilde:Je("~",{beforeExpr:It,prefix:eu,startsExpr:be}),doubleCaret:Je("^^",{startsExpr:be}),doubleAt:Je("@@",{startsExpr:be}),pipeline:ki("|>",0),nullishCoalescing:ki("??",1),logicalOR:ki("||",1),logicalAND:ki("&&",2),bitwiseOR:ki("|",3),bitwiseXOR:ki("^",4),bitwiseAND:ki("&",5),equality:ki("==/!=/===/!==",6),lt:ki("</>/<=/>=",7),gt:ki("</>/<=/>=",7),relational:ki("</>/<=/>=",7),bitShift:ki("<</>>/>>>",8),bitShiftL:ki("<</>>/>>>",8),bitShiftR:ki("<</>>/>>>",8),plusMin:Je("+/-",{beforeExpr:It,binop:9,prefix:eu,startsExpr:be}),modulo:Je("%",{binop:10,startsExpr:be}),star:Je("*",{binop:10}),slash:ki("/",10),exponent:Je("**",{beforeExpr:It,binop:11,rightAssociative:!0}),_in:Gt("in",{beforeExpr:It,binop:7}),_instanceof:Gt("instanceof",{beforeExpr:It,binop:7}),_break:Gt("break"),_case:Gt("case",{beforeExpr:It}),_catch:Gt("catch"),_continue:Gt("continue"),_debugger:Gt("debugger"),_default:Gt("default",{beforeExpr:It}),_else:Gt("else",{beforeExpr:It}),_finally:Gt("finally"),_function:Gt("function",{startsExpr:be}),_if:Gt("if"),_return:Gt("return",{beforeExpr:It}),_switch:Gt("switch"),_throw:Gt("throw",{beforeExpr:It,prefix:eu,startsExpr:be}),_try:Gt("try"),_var:Gt("var"),_const:Gt("const"),_with:Gt("with"),_new:Gt("new",{beforeExpr:It,startsExpr:be}),_this:Gt("this",{startsExpr:be}),_super:Gt("super",{startsExpr:be}),_class:Gt("class",{startsExpr:be}),_extends:Gt("extends",{beforeExpr:It}),_export:Gt("export"),_import:Gt("import",{startsExpr:be}),_null:Gt("null",{startsExpr:be}),_true:Gt("true",{startsExpr:be}),_false:Gt("false",{startsExpr:be}),_typeof:Gt("typeof",{beforeExpr:It,prefix:eu,startsExpr:be}),_void:Gt("void",{beforeExpr:It,prefix:eu,startsExpr:be}),_delete:Gt("delete",{beforeExpr:It,prefix:eu,startsExpr:be}),_do:Gt("do",{isLoop:lR,beforeExpr:It}),_for:Gt("for",{isLoop:lR}),_while:Gt("while",{isLoop:lR}),_as:wt("as",{startsExpr:be}),_assert:wt("assert",{startsExpr:be}),_async:wt("async",{startsExpr:be}),_await:wt("await",{startsExpr:be}),_defer:wt("defer",{startsExpr:be}),_from:wt("from",{startsExpr:be}),_get:wt("get",{startsExpr:be}),_let:wt("let",{startsExpr:be}),_meta:wt("meta",{startsExpr:be}),_of:wt("of",{startsExpr:be}),_sent:wt("sent",{startsExpr:be}),_set:wt("set",{startsExpr:be}),_source:wt("source",{startsExpr:be}),_static:wt("static",{startsExpr:be}),_using:wt("using",{startsExpr:be}),_yield:wt("yield",{startsExpr:be}),_asserts:wt("asserts",{startsExpr:be}),_checks:wt("checks",{startsExpr:be}),_exports:wt("exports",{startsExpr:be}),_global:wt("global",{startsExpr:be}),_implements:wt("implements",{startsExpr:be}),_intrinsic:wt("intrinsic",{startsExpr:be}),_infer:wt("infer",{startsExpr:be}),_is:wt("is",{startsExpr:be}),_mixins:wt("mixins",{startsExpr:be}),_proto:wt("proto",{startsExpr:be}),_require:wt("require",{startsExpr:be}),_satisfies:wt("satisfies",{startsExpr:be}),_keyof:wt("keyof",{startsExpr:be}),_readonly:wt("readonly",{startsExpr:be}),_unique:wt("unique",{startsExpr:be}),_abstract:wt("abstract",{startsExpr:be}),_declare:wt("declare",{startsExpr:be}),_enum:wt("enum",{startsExpr:be}),_module:wt("module",{startsExpr:be}),_namespace:wt("namespace",{startsExpr:be}),_interface:wt("interface",{startsExpr:be}),_type:wt("type",{startsExpr:be}),_opaque:wt("opaque",{startsExpr:be}),name:Je("name",{startsExpr:be}),placeholder:Je("%%",{startsExpr:be}),string:Je("string",{startsExpr:be}),num:Je("num",{startsExpr:be}),bigint:Je("bigint",{startsExpr:be}),decimal:Je("decimal",{startsExpr:be}),regexp:Je("regexp",{startsExpr:be}),privateName:Je("#name",{startsExpr:be}),eof:Je("eof"),jsxName:Je("jsxName"),jsxText:Je("jsxText",{beforeExpr:It}),jsxTagStart:Je("jsxTagStart",{startsExpr:be}),jsxTagEnd:Je("jsxTagEnd")};function tr(t){return t>=93&&t<=133}function VTe(t){return t<=92}function Go(t){return t>=58&&t<=133}function n$(t){return t>=58&&t<=137}function WTe(t){return OR[t]}function Pm(t){return KR[t]}function zTe(t){return t>=29&&t<=33}function j5(t){return t>=129&&t<=131}function XTe(t){return t>=90&&t<=92}function JR(t){return t>=58&&t<=92}function ZTe(t){return t>=39&&t<=59}function eMe(t){return t===34}function tMe(t){return HR[t]}function rMe(t){return t>=121&&t<=123}function nMe(t){return t>=124&&t<=130}function ru(t){return UR[t]}function $y(t){return GR[t]}function iMe(t){return t===57}function zy(t){return t>=24&&t<=25}function UA(t){return GA[t]}GA[8].updateContext=t=>{t.pop()};GA[5].updateContext=GA[7].updateContext=GA[23].updateContext=t=>{t.push(zt.brace)};GA[22].updateContext=t=>{t[t.length-1]===zt.template?t.pop():t.push(zt.template)};GA[143].updateContext=t=>{t.push(zt.j_expr,zt.j_oTag)};var YR="\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",i$="\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",sMe=new RegExp("["+YR+"]"),oMe=new RegExp("["+YR+i$+"]");YR=i$=null;var s$=[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],aMe=[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 mR(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 Ua(t){return t<65?t===36:t<=90?!0:t<97?t===95:t<=122?!0:t<=65535?t>=170&&sMe.test(String.fromCharCode(t)):mR(t,s$)}function ql(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&&oMe.test(String.fromCharCode(t)):mR(t,s$)||mR(t,aMe)}var jR={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"]},AMe=new Set(jR.keyword),cMe=new Set(jR.strict),uMe=new Set(jR.strictBind);function o$(t,e){return e&&t==="await"||t==="enum"}function a$(t,e){return o$(t,e)||cMe.has(t)}function A$(t){return uMe.has(t)}function c$(t,e){return a$(t,e)||A$(t)}function lMe(t){return AMe.has(t)}function gMe(t,e,r){return t===64&&e===64&&Ua(r)}var pMe=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 dMe(t){return pMe.has(t)}var Um=class{constructor(e){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=e}},Gm=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 Um(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 s=i.names.get(e)||0;r&16?s=s|4:(i.firstLexicalName||(i.firstLexicalName=e),s=s|2),i.names.set(e,s),r&8&&this.maybeExportDefined(i,e)}else if(r&4)for(let s=this.scopeStack.length-1;s>=0&&(i=this.scopeStack[s],this.checkRedeclarationInScope(i,e,r,n),i.names.set(e,(i.names.get(e)||0)|1),this.maybeExportDefined(i,e),!(i.flags&1667));--s);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(W.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}}},CR=class extends Um{constructor(...e){super(...e),this.declareFunctions=new Set}},IR=class extends Gm{createScope(e){return new CR(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)}},fMe=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),qe=_a`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 hMe(t){return t.type==="DeclareExportAllDeclaration"||t.type==="DeclareExportDeclaration"&&(!t.declaration||t.declaration.type!=="TypeAlias"&&t.declaration.type!=="InterfaceDeclaration")}function q5(t){return t.importKind==="type"||t.importKind==="typeof"}var mMe={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function CMe(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 IMe=/\*?\s*@((?:no)?flow)\b/,EMe=t=>class extends t{constructor(...r){super(...r),this.flowPragma=void 0}getScopeHandler(){return IR}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=IMe.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(qe.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(),s=this.startNode();this.match(47)?i.typeParameters=this.flowParseTypeParameterDeclaration():i.typeParameters=null,this.expect(10);let o=this.flowParseFunctionTypeParams();return i.params=o.params,i.rest=o.rest,i.this=o._this,this.expect(11),[i.returnType,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),s.typeAnnotation=this.finishNode(i,"FunctionTypeAnnotation"),n.typeAnnotation=this.finishNode(s,"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(qe.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(qe.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),i.push(super.parseImport(a))):(this.expectContextual(125,qe.UnsupportedStatementInDeclareModule),i.push(this.flowParseDeclare(a,!0)))}this.scope.exit(),this.expect(8),this.finishNode(n,"BlockStatement");let s=null,o=!1;return i.forEach(a=>{hMe(a)?(s==="CommonJS"&&this.raise(qe.AmbiguousDeclareModuleKind,a),s="ES"):a.type==="DeclareModuleExports"&&(o&&this.raise(qe.DuplicateDeclareModuleExports,a),s==="ES"&&this.raise(qe.AmbiguousDeclareModuleKind,a),s="CommonJS",o=!0)}),r.kind=s||"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(qe.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:i,suggestion:mMe[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(qe.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(r,n,i){fMe.has(r)&&this.raise(i?qe.AssignReservedType:qe.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(),s=this.flowParseVariance(),o=this.flowParseTypeAnnotatableIdentifier();return i.name=o.name,i.variance=s,i.bound=o.typeAnnotation,this.match(29)?(this.eat(29),i.default=this.flowParseType()):r&&this.raise(qe.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 s=this.flowParseTypeParameter(i);n.params.push(s),s.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()!==zt.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()===zt.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:s,allowInexact:o}){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,p=null,f=null,m=this.startNode();if(s&&this.isContextual(118)){let I=this.lookahead();I.type!==14&&I.type!==17&&(this.next(),p=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))p!=null&&this.unexpected(p),this.eat(0)?(C&&this.unexpected(C.loc.start),A.internalSlots.push(this.flowParseObjectTypeInternalSlot(m,g))):A.indexers.push(this.flowParseObjectTypeIndexer(m,g,C));else if(this.match(10)||this.match(47))p!=null&&this.unexpected(p),C&&this.unexpected(C.loc.start),A.callProperties.push(this.flowParseObjectTypeCallProperty(m,g));else{let I="init";if(this.isContextual(99)||this.isContextual(104)){let E=this.lookahead();n$(E.type)&&(I=this.state.value,this.next())}let B=this.flowParseObjectTypeProperty(m,g,p,C,I,i,o??!u);B===null?(l=!0,f=this.state.lastTokStartLoc):A.properties.push(B)}this.flowObjectTypeSemicolon(),f&&!this.match(8)&&!this.match(9)&&this.raise(qe.UnexpectedExplicitInexactInObject,f)}this.expect(c),i&&(A.inexact=l);let d=this.finishNode(A,"ObjectTypeAnnotation");return this.state.inType=a,d}flowParseObjectTypeProperty(r,n,i,s,o,a,A){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(a?A||this.raise(qe.InexactInsideExact,this.state.lastTokStartLoc):this.raise(qe.InexactInsideNonObject,this.state.lastTokStartLoc),s&&this.raise(qe.InexactVariance,s),null):(a||this.raise(qe.UnexpectedSpreadType,this.state.lastTokStartLoc),i!=null&&this.unexpected(i),s&&this.raise(qe.SpreadVariance,s),r.argument=this.flowParseType(),this.finishNode(r,"ObjectTypeSpreadProperty"));{r.key=this.flowParseObjectPropertyKey(),r.static=n,r.proto=i!=null,r.kind=o;let c=!1;return this.match(47)||this.match(10)?(r.method=!0,i!=null&&this.unexpected(i),s&&this.unexpected(s.loc.start),r.value=this.flowParseObjectTypeMethodish(this.startNodeAt(r.loc.start)),(o==="get"||o==="set")&&this.flowCheckGetterSetterParams(r),!a&&r.key.name==="constructor"&&r.value.this&&this.raise(qe.ThisParamBannedInConstructor,r.value.this)):(o!=="init"&&this.unexpected(),r.method=!1,this.eat(17)&&(c=!0),r.value=this.flowParseTypeInitialiser(),r.variance=s),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"?qe.GetterMayNotHaveThisParam:qe.SetterMayNotHaveThisParam,r.value.this),i!==n&&this.raise(r.kind==="get"?W.BadGetterArity:W.BadSetterArity,r),r.kind==="set"&&r.value.rest&&this.raise(W.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 s=this.startNodeAt(r);s.qualification=i,s.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(s,"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,s=null,o=this.startNode(),a=this.lookahead(),A=this.state.type===78;return a.type===14||a.type===17?(A&&!r&&this.raise(qe.ThisParamMustBeFirst,o),n=this.parseIdentifier(A),this.eat(17)&&(i=!0,A&&this.raise(qe.ThisParamMayNotBeOptional,o)),s=this.flowParseTypeInitialiser()):s=this.flowParseType(),o.name=n,o.optional=i,o.typeAnnotation=s,this.finishNode(o,"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,s,o=!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,s=this.flowParseTupleType(),this.state.noAnonFunctionType=a,s;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(tr(this.state.type)||this.match(78)){let c=this.lookahead().type;o=c!==17&&c!==14}else o=!0;if(o){if(this.state.noAnonFunctionType=!1,s=this.flowParseType(),this.state.noAnonFunctionType=a,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),s;this.eat(12)}return s?i=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(s)]):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(qe.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(JR(this.state.type)){let A=ru(this.state.type);return this.next(),super.createIdentifier(n,A)}else if(tr(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 s=this.startNodeAt(r),o=this.eat(18);i=i||o,this.expect(0),!o&&this.match(3)?(s.elementType=n,this.next(),n=this.finishNode(s,"ArrayTypeAnnotation")):(s.objectType=n,s.indexType=this.flowParseType(),this.expect(3),i?(s.optional=o,n=this.finishNode(s,"OptionalIndexedAccessType")):n=this.finishNode(s,"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 s=this.startNode();[s.typeAnnotation,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),r.returnType=s.typeAnnotation?this.finishNode(s,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(r,n,i)}parseStatementLike(r){if(this.state.strict&&this.isContextual(129)){let i=this.lookahead();if(Go(i.type)){let s=this.startNode();return this.next(),this.flowParseInterface(s)}}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)||tr(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(r)}else if(tr(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||j5(r)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:r}=this.state;return r===126||j5(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 d=this.lookaheadCharCode();if(d===44||d===61||d===58||d===41)return this.setOptionalParametersError(i),r}this.expect(17);let s=this.state.clone(),o=this.state.noArrowAt,a=this.startNodeAt(n),{consequent:A,failed:c}=this.tryParseConditionalConsequent(),[u,l]=this.getArrowLikeExpressions(A);if(c||l.length>0){let d=[...o];if(l.length>0){this.state=s,this.state.noArrowAt=d;for(let g=0;g<l.length;g++)d.push(l[g].start);({consequent:A,failed:c}=this.tryParseConditionalConsequent()),[u,l]=this.getArrowLikeExpressions(A)}c&&u.length>1&&this.raise(qe.AmbiguousConditionalArrow,s.startLoc),c&&u.length===1&&(this.state=s,d.push(u[0].start),this.state.noArrowAt=d,{consequent:A,failed:c}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(A,!0),this.state.noArrowAt=o,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],s=[];for(;i.length!==0;){let o=i.pop();o.type==="ArrowFunctionExpression"&&o.body.type!=="BlockStatement"?(o.typeParameters||!o.returnType?this.finishArrowValidation(o):s.push(o),i.push(o.body)):o.type==="ConditionalExpression"&&(i.push(o.consequent),i.push(o.alternate))}return n?(s.forEach(o=>this.finishArrowValidation(o)),[s,[]]):CMe(s,o=>o.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 s=this.startNodeAt(n);return s.expression=i,s.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(s,"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:s}=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(qe.DeclareClassElement,s):n.value&&this.raise(qe.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(W.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):gMe(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 s=0;s<r.length;s++){let o=r[s];o?.type==="TypeCastExpression"&&(r[s]=this.typeCastToParameter(o))}super.toAssignableList(r,n,i)}toReferencedList(r,n){for(let s=0;s<r.length;s++){var i;let o=r[s];o&&o.type==="TypeCastExpression"&&!((i=o.extra)!=null&&i.parenthesized)&&(r.length>1||!n)&&this.raise(qe.TypeCastInPattern,o.typeAnnotation)}return r}parseArrayLike(r,n,i){let s=super.parseArrayLike(r,n,i);return i!=null&&!this.state.maybeInArrowParameters&&this.toReferencedList(s.elements),s}isValidLVal(r,n,i,s){return r==="TypeCastExpression"||super.isValidLVal(r,n,i,s)}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,s,o,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,s,o,a),n.params&&o){let A=n.params;A.length>0&&this.isThisParam(A[0])&&this.raise(qe.ThisParamBannedInConstructor,n)}else if(n.type==="MethodDefinition"&&o&&n.value.params){let A=n.value.params;A.length>0&&this.isThisParam(A[0])&&this.raise(qe.ThisParamBannedInConstructor,n)}}pushClassPrivateMethod(r,n,i,s){n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(r,n,i,s)}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(qe.GetterMayNotHaveThisParam,i):this.isThisParam(i)&&this.raise(qe.SetterMayNotHaveThisParam,i)}}parsePropertyNamePrefixOperator(r){r.variance=this.flowParseVariance()}parseObjPropValue(r,n,i,s,o,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,s,o,a,A);return c&&((u.value||u).typeParameters=c),u}parseFunctionParamType(r){return this.eat(17)&&(r.type!=="Identifier"&&this.raise(qe.PatternIsOptional,r),this.isThisParam(r)&&this.raise(qe.ThisParamMayNotBeOptional,r),r.optional=!0),this.match(14)?r.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(r)&&this.raise(qe.ThisParamAnnotationRequired,r),this.match(29)&&this.isThisParam(r)&&this.raise(qe.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(qe.TypeBeforeInitializer,i.typeAnnotation),i}checkImportReflection(r){super.checkImportReflection(r),r.module&&r.importKind!=="value"&&this.raise(qe.ImportReflectionHasImportType,r.specifiers[0].loc.start)}parseImportSpecifierLocal(r,n,i){n.local=q5(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,s){if(super.applyImportPhase(r,n,i,s),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,s,o){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&&!Go(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&&Go(this.state.type))r.imported=this.parseIdentifier(!0),r.importKind=A;else{if(n)throw this.raise(W.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=q5(r);return i&&u&&this.raise(qe.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 s=null,o;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(s=this.state.clone(),o=this.tryParse(()=>super.parseMaybeAssign(r,n),s),!o.error)return o.node;let{context:c}=this.state,u=c[c.length-1];(u===zt.j_oTag||u===zt.j_expr)&&c.pop()}if((i=o)!=null&&i.error||this.match(47)){var a,A;s=s||this.state.clone();let c,u=this.tryParse(d=>{var g;c=this.flowParseTypeParameterDeclaration();let p=this.forwardNoArrowParamsConversionAt(c,()=>{let m=super.parseMaybeAssign(r,n);return this.resetStartLocationFromNode(m,c),m});(g=p.extra)!=null&&g.parenthesized&&d();let f=this.maybeUnwrapTypeCastExpression(p);return f.type!=="ArrowFunctionExpression"&&d(),f.typeParameters=c,this.resetStartLocationFromNode(f,c),p},s),l=null;if(u.node&&this.maybeUnwrapTypeCastExpression(u.node).type==="ArrowFunctionExpression"){if(!u.error&&!u.aborted)return u.node.async&&this.raise(qe.UnexpectedTypeParameterBeforeAsyncArrowFunction,c),u.node;l=u.node}if((a=o)!=null&&a.node)return this.state=o.failState,o.node;if(l)return this.state=u.failState,l;throw(A=o)!=null&&A.thrown?o.error:u.thrown?u.error:this.raise(qe.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 s=this.startNode();return[s.typeAnnotation,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=i,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),s});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,s=!0){if(!(i&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start)))){for(let o=0;o<r.params.length;o++)this.isThisParam(r.params[o])&&o>0&&this.raise(qe.ThisParamMustBeFirst,r.params[o]);super.checkParams(r,n,i,s)}}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 s=this.startNodeAt(n);s.callee=r,s.arguments=super.parseCallExpressionArguments(),r=this.finishNode(s,"CallExpression")}else if(r.type==="Identifier"&&r.name==="async"&&this.match(47)){let s=this.state.clone(),o=this.tryParse(A=>this.parseAsyncArrowWithTypeParameters(n)||A(),s);if(!o.error&&!o.aborted)return o.node;let a=this.tryParse(()=>super.parseSubscripts(r,n,i),s);if(a.node&&!a.error)return a.node;if(o.node)return this.state=o.failState,o.node;if(a.node)return this.state=a.failState,a.node;throw o.error||a.error}return super.parseSubscripts(r,n,i)}parseSubscript(r,n,i,s){if(this.match(18)&&this.isLookaheadToken_lt()){if(s.optionalChainMember=!0,i)return s.stop=!0,r;this.next();let o=this.startNodeAt(n);return o.callee=r,o.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),o.arguments=this.parseCallExpressionArguments(),o.optional=!0,this.finishCallExpression(o,!0)}else if(!i&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){let o=this.startNodeAt(n);o.callee=r;let a=this.tryParse(()=>(o.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),o.arguments=super.parseCallExpressionArguments(),s.optionalChainMember&&(o.optional=!1),this.finishCallExpression(o,s.optionalChainMember)));if(a.node)return a.error&&(this.state=a.failState),a.node}return super.parseSubscript(r,n,i,s)}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(qe.UnterminatedFlowComment,this.state.curPosition()),i}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(qe.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),s=this.input.charCodeAt(n+r+1);return i===58&&s===58?n+2:this.input.slice(n+r,n+r+12)==="flow-include"?n+12:i===58&&s!==58?n:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(W.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(r,{enumName:n,memberName:i}){this.raise(qe.EnumBooleanMemberNotInitialized,r,{memberName:i,enumName:n})}flowEnumErrorInvalidMemberInitializer(r,n){return this.raise(n.explicitType?n.explicitType==="symbol"?qe.EnumInvalidMemberInitializerSymbolType:qe.EnumInvalidMemberInitializerPrimaryType:qe.EnumInvalidMemberInitializerUnknownType,r,n)}flowEnumErrorNumberMemberNotInitialized(r,n){this.raise(qe.EnumNumberMemberNotInitialized,r,n)}flowEnumErrorStringMemberInconsistentlyInitialized(r,n){this.raise(qe.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:s}=n;s!==null&&s!==i&&this.flowEnumErrorInvalidMemberInitializer(r,n)}flowEnumMembers({enumName:r,explicitType:n}){let i=new Set,s={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},o=!1;for(;!this.match(8);){if(this.eat(21)){o=!0;break}let a=this.startNode(),{id:A,init:c}=this.flowEnumMemberRaw(),u=A.name;if(u==="")continue;/^[a-z]/.test(u)&&this.raise(qe.EnumInvalidMemberName,A,{memberName:u,suggestion:u[0].toUpperCase()+u.slice(1),enumName:r}),i.has(u)&&this.raise(qe.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,s.booleanMembers.push(this.finishNode(a,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(c.loc,l,"number"),a.init=c.value,s.numberMembers.push(this.finishNode(a,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(c.loc,l,"string"),a.init=c.value,s.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:s.defaultedMembers.push(this.finishNode(a,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:s,hasUnknownMembers:o}}flowEnumStringMembers(r,n,{enumName:i}){if(r.length===0)return n;if(n.length===0)return r;if(n.length>r.length){for(let s of r)this.flowEnumErrorStringMemberInconsistentlyInitialized(s,{enumName:i});return n}else{for(let s of n)this.flowEnumErrorStringMemberInconsistentlyInitialized(s,{enumName:i});return r}}flowEnumParseExplicitType({enumName:r}){if(!this.eatContextual(102))return null;if(!tr(this.state.type))throw this.raise(qe.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:r});let{value:n}=this.state;return this.next(),n!=="boolean"&&n!=="number"&&n!=="string"&&n!=="symbol"&&this.raise(qe.EnumInvalidExplicitType,this.state.startLoc,{enumName:r,invalidEnumType:n}),n}flowEnumBody(r,n){let i=n.name,s=n.loc.start,o=this.flowEnumParseExplicitType({enumName:i});this.expect(5);let{members:a,hasUnknownMembers:A}=this.flowEnumMembers({enumName:i,explicitType:o});switch(r.hasUnknownMembers=A,o){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,d=a.stringMembers.length,g=a.defaultedMembers.length;if(!u&&!l&&!d&&!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&&!d&&u>=g){for(let p of a.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(p.loc.start,{enumName:i,memberName:p.id.name});return r.members=a.booleanMembers,this.expect(8),this.finishNode(r,"EnumBooleanBody")}else if(!u&&!d&&l>=g){for(let p of a.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(p.loc.start,{enumName:i,memberName:p.id.name});return r.members=a.numberMembers,this.expect(8),this.finishNode(r,"EnumNumberBody")}else return this.raise(qe.EnumInconsistentMemberValues,s,{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}},BMe={__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"},yMe=/\r\n|[\r\n\u2028\u2029]/,Yy=new RegExp(yMe.source,"g");function Xp(t){switch(t){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function $5(t,e,r){for(let n=e;n<r;n++)if(Xp(t.charCodeAt(n)))return!0;return!1}var gR=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,pR=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function QMe(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 Yl=_a`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 tu(t){return t?t.type==="JSXOpeningFragment"||t.type==="JSXClosingFragment":!1}function zp(t){if(t.type==="JSXIdentifier")return t.name;if(t.type==="JSXNamespacedName")return t.namespace.name+":"+t.name.name;if(t.type==="JSXMemberExpression")return zp(t.object)+"."+zp(t.property);throw new Error("Node had unexpected type: "+t.type)}var DMe=t=>class extends t{jsxReadToken(){let r="",n=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Yl.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:Xp(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
|
|
@@ -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.53.3"}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.53.4-beta.202605061129.94c473a"}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.53.
|
|
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.53.4-beta.202605061129.94c473a"),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.53.4-beta.202605061129.94c473a"),mo());})();`)}async function Ote(t){return Kte(t,`<!doctype html>
|
|
1319
1319
|
<html lang="en" dir="ltr">
|
|
1320
1320
|
<head>
|
|
1321
1321
|
<meta charset="utf-8" />
|
|
@@ -1834,9 +1834,9 @@ ${r}
|
|
|
1834
1834
|
`):void 0})}let f=p.substring(4).split(" ")[0],m=H7e(f);p.startsWith("--- ")?(s=m,i=m,a=0,A=0,c=[],u=[],o=null,l=f==="/dev/null",d=!1):p.startsWith("+++ ")&&(d=f==="/dev/null",f==="/dev/null"?i=s:i=m);continue}else{if(p.startsWith("@@"))continue;p.startsWith("+")?(a++,c.push(p.substring(1)),o===null&&(o="update")):p.startsWith("-")?(A++,u.push(p.substring(1)),o===null&&(o="update")):(p.startsWith(" ")||p==="")&&(c.push(p.substring(1)),u.push(p.substring(1)))}}if(i&&o){let g;l?g="create":d?g="delete":g="update";let p=g==="delete"&&s?s:i;r.push({filePath:p,addedLines:a,removedLines:A,action:g,content:c.length>0?c.join(`
|
|
1835
1835
|
`):void 0,oldContent:u.length>0?u.join(`
|
|
1836
1836
|
`):void 0})}return r}var xue=L(()=>{"use strict";h()});var ju,Fue=L(()=>{"use strict";h();ju=(...t)=>{typeof process<"u"&&process.env.DEBUG==="true"&&console.debug("[DEBUG] ",...t)}});var Y7e,Hf,kue,j7e,q7e,$7e,Fb,TG=L(()=>{"use strict";h();Fue();Y7e=()=>{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.")},Hf=Y7e(),kue=async()=>{let t=await Hf.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),e=await Hf.subtle.exportKey("jwk",t);return JSON.stringify(e)},j7e=async()=>Hf.getRandomValues(new Uint8Array(16)),q7e=async(t,e,r)=>{let n=await Hf.subtle.encrypt({name:"AES-GCM",iv:e,tagLength:128},t,typeof r=="string"?new TextEncoder().encode(r):r);return Buffer.from(n)},$7e=async(t,e,r)=>{let n=await Hf.subtle.decrypt({name:"AES-GCM",iv:e,tagLength:128},t,r);return new TextDecoder().decode(n)},Fb=async t=>{try{ju("validateEncryptionKey: Validating encryption key");let e=JSON.parse(t);ju("validateEncryptionKey: Parsed JWK");let r=await Hf.subtle.importKey("jwk",e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);ju("validateEncryptionKey: Imported crypto key");let n="test",i=await j7e();ju("validateEncryptionKey: Generated test IV",i);let s=await q7e(r,i,n);ju("validateEncryptionKey: Encrypted test data",s);let o=new Uint8Array(s);ju("validateEncryptionKey: Encrypted test data array",o);let a=await $7e(r,i,o);return ju("validateEncryptionKey: Decrypted test data",a),a===n}catch(e){return console.error("Could not validate encryption key:",e),!1}}});function Rue(t){return t.length<=MG?t:t.slice(0,MG)+`... [+${t.length-MG} chars]`}var V7e,MG,kb,Nue=L(()=>{"use strict";h();Rr();yr();mr();V7e=5e3,MG=8e3,kb=class{#n;#c;#s;#t=[];#A;#i=!1;#e=Promise.resolve();constructor(e){this.#n=e.credentials,this.#c=e.replayId,this.#s=e.debug??!1;let r=setInterval(()=>{this.#B()},V7e);r.unref?.(),this.#A=r}recordText(e,r=Date.now()){this.#i||this.#o({ts:r,type:"text",content:Rue(e)})}recordReasoning(e,r=Date.now()){this.#i||this.#o({ts:r,type:"thinking",content:Rue(e)})}recordCheckpoint(e=Date.now(),r="",n){this.#i||this.#o({ts:e,type:"checkpoint",label:r,imageUrl:n})}#o(e){e.type!=="checkpoint"&&!e.content||this.#t.push(e)}async#B(){if(this.#t.length===0)return;let e=this.#t;return this.#t=[],this.#e=this.#e.catch(()=>{}).then(()=>this.#h(e)),this.#e}async#h(e){try{let r=new URL(`${ke}/codegen/replay/${encodeURIComponent(this.#c)}/actions`);this.#n.builderPublicKey&&r.searchParams.set("apiKey",this.#n.builderPublicKey),this.#n.userId&&r.searchParams.set("userId",this.#n.userId);let n={"content-type":"application/json"};this.#n.builderPrivateKey&&(n.authorization=`Bearer ${this.#n.builderPrivateKey}`),await Fe(r,{method:"POST",body:JSON.stringify({actions:e}),headers:n,keepalive:!0},this.#s)}catch{}}async flush(){await this.#B(),await this.#e.catch(()=>{})}async close(){this.#i||(this.#i=!0,this.#A&&clearInterval(this.#A),await this.flush())}}});var PG,Tue,W7e,Mue=L(()=>{h();PG=(t,e,r)=>{let n=t instanceof RegExp?Tue(t,r):t,i=e instanceof RegExp?Tue(e,r):e,s=n!==null&&i!=null&&W7e(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},Tue=(t,e)=>{let r=e.match(t);return r?r[0]:null},W7e=(t,e,r)=>{let n,i,s,o,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=[],s=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<s&&(s=i,o=c),c=r.indexOf(e,u+1);u=A<c&&A>=0?A:c}n.length&&o!==void 0&&(a=[s,o])}return a}});function LG(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function Aze(t){return t.replace(rze,Pue).replace(nze,Lue).replace(ize,_G).replace(sze,_ue).replace(oze,Uue)}function cze(t){return t.replace(z7e,"\\").replace(X7e,"{").replace(Z7e,"}").replace(eze,",").replace(tze,".")}function Gue(t){if(!t)return[""];let e=[],r=PG("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=Gue(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function Oue(t,e={}){if(!t)return[];let{max:r=aze}=e;return t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),lE(Aze(t),r,!0).map(cze)}function uze(t){return"{"+t+"}"}function lze(t){return/^-?0\d/.test(t)}function gze(t,e){return t<=e}function pze(t,e){return t>=e}function lE(t,e,r){let n=[],i=PG("{","}",t);if(!i)return[t];let s=i.pre,o=i.post.length?lE(i.post,e,!1):[""];if(/\$$/.test(i.pre))for(let a=0;a<o.length&&a<e;a++){let A=s+"{"+i.body+"}"+o[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+_G+i.post,lE(t,e,!0)):[t];let l;if(c)l=i.body.split(/\.\./);else if(l=Gue(i.body),l.length===1&&l[0]!==void 0&&(l=lE(l[0],e,!1).map(uze),l.length===1))return o.map(g=>i.pre+l[0]+g);let d;if(c&&l[0]!==void 0&&l[1]!==void 0){let g=LG(l[0]),p=LG(l[1]),f=Math.max(l[0].length,l[1].length),m=l.length===3&&l[2]!==void 0?Math.abs(LG(l[2])):1,C=gze;p<g&&(m*=-1,C=pze);let B=l.some(lze);d=[];for(let E=g;C(E,p);E+=m){let y;if(A)y=String.fromCharCode(E),y==="\\"&&(y="");else if(y=String(E),B){let Q=f-y.length;if(Q>0){let w=new Array(Q+1).join("0");E<0?y="-"+w+y.slice(1):y=w+y}}d.push(y)}}else{d=[];for(let g=0;g<l.length;g++)d.push.apply(d,lE(l[g],e,!1))}for(let g=0;g<d.length;g++)for(let p=0;p<o.length&&n.length<e;p++){let f=s+d[g]+o[p];(!r||c||f)&&n.push(f)}}return n}var Pue,Lue,_G,_ue,Uue,z7e,X7e,Z7e,eze,tze,rze,nze,ize,sze,oze,aze,Kue=L(()=>{h();Mue();Pue="\0SLASH"+Math.random()+"\0",Lue="\0OPEN"+Math.random()+"\0",_G="\0CLOSE"+Math.random()+"\0",_ue="\0COMMA"+Math.random()+"\0",Uue="\0PERIOD"+Math.random()+"\0",z7e=new RegExp(Pue,"g"),X7e=new RegExp(Lue,"g"),Z7e=new RegExp(_G,"g"),eze=new RegExp(_ue,"g"),tze=new RegExp(Uue,"g"),rze=/\\\\/g,nze=/\\{/g,ize=/\\}/g,sze=/\\,/g,oze=/\\\./g,aze=1e5});var gE,Hue=L(()=>{h();gE=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")}});var dze,pE,fze,Jue,Yue,jue=L(()=>{h();dze={"[: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]},pE=t=>t.replace(/[[\]\\-]/g,"\\$&"),fze=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Jue=t=>t.join(""),Yue=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,A=!1,c=!1,u=r,l="";e:for(;s<t.length;){let f=t.charAt(s);if((f==="!"||f==="^")&&s===r+1){c=!0,s++;continue}if(f==="]"&&o&&!A){u=s+1;break}if(o=!0,f==="\\"&&!A){A=!0,s++;continue}if(f==="["&&!A){for(let[m,[C,I,B]]of Object.entries(dze))if(t.startsWith(m,s)){if(l)return["$.",!1,t.length-r,!0];s+=m.length,B?i.push(C):n.push(C),a=a||I;continue e}}if(A=!1,l){f>l?n.push(pE(l)+"-"+pE(f)):f===l&&n.push(pE(f)),l="",s++;continue}if(t.startsWith("-]",s+1)){n.push(pE(f+"-")),s+=2;continue}if(t.startsWith("-",s+1)){l=f,s+=2;continue}n.push(pE(f)),s++}if(u<s)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[fze(f),!1,u-r,!1]}let d="["+(c?"^":"")+Jue(n)+"]",g="["+(c?"":"^")+Jue(i)+"]";return[n.length&&i.length?"("+d+"|"+g+")":n.length?d:g,a,u-r,!0]}});var qu,Rb=L(()=>{h();qu=(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 ls,hze,UG,que,mze,Cze,Ize,$ue,Eze,Nb,Bze,yze,Qze,Dze,GG,Vue,Wue,wze,Hg,OG=L(()=>{h();jue();Rb();hze=new Set(["!","?","+","*","@"]),UG=t=>hze.has(t),que=t=>UG(t.type),mze=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Cze=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),Ize=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),$ue=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Eze="(?!(?:^|/)\\.\\.?(?:$|/))",Nb="(?!\\.)",Bze=new Set(["[","."]),yze=new Set(["..","."]),Qze=new Set("().*{}+?[]^$\\!"),Dze=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),GG="[^/]",Vue=GG+"*?",Wue=GG+"+?",wze=0,Hg=class{type;#n;#c;#s=!1;#t=[];#A;#i;#e;#o=!1;#B;#h;#M=!1;id=++wze;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.#o&&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("")}#k(){if(this!==this.#n)throw new Error("should only call on root");if(this.#o)return this;this.toString(),this.#o=!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 s of e.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.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 ls&&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.#o&&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 ls&&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 ls(this.type,e);for(let n of this.#t)r.copyIn(n);return r}static#S(e,r,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,A=!1,c=-1,u=!1;if(r.type===null){let f=n,m="";for(;f<e.length;){let C=e.charAt(f++);if(a||C==="\\"){a=!a,m+=C;continue}if(A){f===c+1?(C==="^"||C==="!")&&(u=!0):C==="]"&&!(f===c+2&&u)&&(A=!1),m+=C;continue}else if(C==="["){A=!0,c=f,u=!1,m+=C;continue}if(!i.noext&&UG(C)&&e.charAt(f)==="("&&s<=o){r.push(m),m="";let B=new ls(C,r);f=ls.#S(e,B,f,i,s+1),r.push(B);continue}m+=C}return r.push(m),f}let l=n+1,d=new ls(null,r),g=[],p="";for(;l<e.length;){let f=e.charAt(l++);if(a||f==="\\"){a=!a,p+=f;continue}if(A){l===c+1?(f==="^"||f==="!")&&(u=!0):f==="]"&&!(l===c+2&&u)&&(A=!1),p+=f;continue}else if(f==="["){A=!0,c=l,u=!1,p+=f;continue}if(!i.noext&&UG(f)&&e.charAt(l)==="("&&(s<=o||r&&r.#p(f))){let C=r&&r.#p(f)?0:1;d.push(p),p="";let I=new ls(f,d);d.push(I),l=ls.#S(e,I,l,i,s+C);continue}if(f==="|"){d.push(p),p="",g.push(d),d=new ls(null,r);continue}if(f===")")return p===""&&r.#t.length===0&&(r.#M=!0),d.push(p),p="",r.push(...g,d),l;p+=f}return r.type=null,r.#c=void 0,r.#t=[e.substring(n-1)],l}#v(e){return this.#a(e,Cze)}#a(e,r=mze){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.#p(n.type,r)}#p(e,r=Ize){return!!r.get(this.type)?.includes(e)}#r(e,r){let n=e.#t[0],i=new ls(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}#H(e){return!!$ue.get(this.type)?.has(e)}#W(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.#H(r.type)}#w(e){let r=$ue.get(this.type),n=e.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let s of this.#t)typeof s=="object"&&(s.#A=this);this.type=i,this.#h=void 0,this.#M=!1}static fromGlob(e,r={}){let n=new ls(null,void 0,r);return ls.#S(e,n,0,r,0),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let e=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#c||this.#B.nocase&&!this.#B.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#B.nocase?"i":"")+(s?"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.#J(),this.#k()),!que(this)){let A=this.isStart()&&this.isEnd()&&!this.#t.some(g=>typeof g!="string"),c=this.#t.map(g=>{let[p,f,m,C]=typeof g=="string"?ls.#P(g,this.#c,A):g.toRegExpSource(e);return this.#c=this.#c||m,this.#s=this.#s||C,p}).join(""),u="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&yze.has(this.#t[0]))){let p=Bze,f=r&&p.has(c.charAt(0))||c.startsWith("\\.")&&p.has(c.charAt(2))||c.startsWith("\\.\\.")&&p.has(c.charAt(4)),m=!r&&!e&&p.has(c.charAt(0));u=f?Eze:m?Nb:""}let l="";return this.isEnd()&&this.#n.#o&&this.#A?.type==="!"&&(l="(?:$|\\/)"),[u+c+l,qu(c),this.#c=!!this.#c,this.#s]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#R(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let A=this.toString(),c=this;return c.#t=[A],c.type=null,c.#c=void 0,[A,qu(this.toString()),!1,!1]}let o=!n||e||r||!Nb?"":this.#R(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#M)a=(this.isStart()&&!r?Nb:"")+Wue;else{let A=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Nb:"")+Vue+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+A}return[a,qu(s),this.#c=!!this.#c,this.#s]}#J(){if(que(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.#J(),this.#a(i)?(r=!1,this.#g(i,n)):this.#v(i)?(r=!1,this.#r(i,n)):this.#W(i)&&(r=!1,this.#w(i)))}}while(!r&&++e<10)}else for(let e of this.#t)typeof e=="object"&&e.#J();this.#h=void 0}#R(e){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(e);return this.#s=this.#s||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#P(e,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let A=0;A<e.length;A++){let c=e.charAt(A);if(i){i=!1,s+=(Qze.has(c)?"\\":"")+c;continue}if(c==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(e)?Wue:Vue,r=!0;continue}else a=!1;if(c==="\\"){A===e.length-1?s+="\\\\":i=!0;continue}if(c==="["){let[u,l,d,g]=Yue(e,A);if(d){s+=u,o=o||l,A+=d-1,r=r||g;continue}}if(c==="?"){s+=GG,r=!0;continue}s+=Dze(c)}return[s,qu(e),!!r,o]}};ls=Hg});var KG,HG=L(()=>{h();KG=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&")});var ti,bze,Sze,vze,xze,Fze,kze,Rze,Nze,Tze,Mze,Pze,Lze,_ze,Uze,Gze,Oze,Kze,Hze,Zue,ele,tle,zue,Jze,wi,Yze,jze,qze,$ze,Vze,fo,Wze,rle,zze,Xze,Xue,Zze,Jf,nle=L(()=>{h();Kue();Hue();OG();HG();Rb();OG();HG();Rb();ti=(t,e,r={})=>(gE(e),!r.nocomment&&e.charAt(0)==="#"?!1:new Jf(e,r).match(t)),bze=/^\*+([^+@!?\*\[\(]*)$/,Sze=t=>e=>!e.startsWith(".")&&e.endsWith(t),vze=t=>e=>e.endsWith(t),xze=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),Fze=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),kze=/^\*+\.\*+$/,Rze=t=>!t.startsWith(".")&&t.includes("."),Nze=t=>t!=="."&&t!==".."&&t.includes("."),Tze=/^\.\*+$/,Mze=t=>t!=="."&&t!==".."&&t.startsWith("."),Pze=/^\*+$/,Lze=t=>t.length!==0&&!t.startsWith("."),_ze=t=>t.length!==0&&t!=="."&&t!=="..",Uze=/^\?+([^+@!?\*\[\(]*)?$/,Gze=([t,e=""])=>{let r=Zue([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Oze=([t,e=""])=>{let r=ele([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},Kze=([t,e=""])=>{let r=ele([t]);return e?n=>r(n)&&n.endsWith(e):r},Hze=([t,e=""])=>{let r=Zue([t]);return e?n=>r(n)&&n.endsWith(e):r},Zue=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},ele=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},tle=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",zue={win32:{sep:"\\"},posix:{sep:"/"}},Jze=tle==="win32"?zue.win32.sep:zue.posix.sep;ti.sep=Jze;wi=Symbol("globstar **");ti.GLOBSTAR=wi;Yze="[^/]",jze=Yze+"*?",qze="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",$ze="(?:(?!(?:\\/|^)\\.).)*?",Vze=(t,e={})=>r=>ti(r,t,e);ti.filter=Vze;fo=(t,e={})=>Object.assign({},t,e),Wze=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return ti;let e=ti;return Object.assign((n,i,s={})=>e(n,i,fo(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,fo(t,s))}static defaults(i){return e.defaults(fo(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,fo(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,fo(t,s))}},unescape:(n,i={})=>e.unescape(n,fo(t,i)),escape:(n,i={})=>e.escape(n,fo(t,i)),filter:(n,i={})=>e.filter(n,fo(t,i)),defaults:n=>e.defaults(fo(t,n)),makeRe:(n,i={})=>e.makeRe(n,fo(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,fo(t,i)),match:(n,i,s={})=>e.match(n,i,fo(t,s)),sep:e.sep,GLOBSTAR:wi})};ti.defaults=Wze;rle=(t,e={})=>(gE(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:Oue(t,{max:e.braceExpandMax}));ti.braceExpand=rle;zze=(t,e={})=>new Jf(t,e).makeRe();ti.makeRe=zze;Xze=(t,e,r={})=>{let n=new Jf(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};ti.match=Xze;Xue=/[?*]|[+@!]\(.*?\)|\[|\]/,Zze=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Jf=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,r={}){gE(e),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=e,this.platform=r.platform||tle,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=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let A=s[0]===""&&s[1]===""&&(s[2]==="?"||!Xue.test(s[2]))&&!Xue.test(s[3]),c=/^[a-z]:/i.test(s[0]);if(A)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(c)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(A=>this.parse(A))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[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 s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(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 s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(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 o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-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 o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let A=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...A),n.length===0&&n.push(""),s-=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,s=0,o=[],a="";for(;i<e.length&&s<r.length;)if(e[i]===r[s])o.push(a==="b"?r[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&r[s]===e[i+1])o.push(e[i]),i++;else if(n&&r[s]==="**"&&e[i]===r[s+1])o.push(r[s]),s++;else if(e[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(r[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return e.length===r.length&&o}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,s=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,d=u?3:c?0:void 0;if(typeof l=="number"&&typeof d=="number"){let[g,p]=[e[l],r[d]];g.toLowerCase()===p.toLowerCase()&&(r[d]=g,s=d,i=l)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(e=this.levelTwoFileOptimize(e)),r.includes(wi)?this.#n(e,r,n,i,s):this.#s(e,r,n,i,s)}#n(e,r,n,i,s){let o=r.indexOf(wi,s),a=r.lastIndexOf(wi),[A,c,u]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(A.length){let I=e.slice(i,i+A.length);if(!this.#s(I,A,n,0,0))return!1;i+=A.length,s+=A.length}let l=0;if(u.length){if(u.length+i>e.length)return!1;let I=e.length-u.length;if(this.#s(e,u,n,I,0))l=u.length;else{if(e[e.length-1]!==""||i+u.length===e.length||(I--,!this.#s(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 d=[[[],0]],g=d[0],p=0,f=[0];for(let I of c)I===wi?(f.push(p),g=[[],0],d.push(g)):(g[0].push(I),p++);let m=d.length-1,C=e.length-l;for(let I of d)I[1]=C-(f[m--]+I[0].length);return!!this.#c(e,d,i,0,n,0,!!l)}#c(e,r,n,i,s,o,a){let A=r[i];if(!A){for(let l=n;l<e.length;l++){a=!0;let d=e[l];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1}return a}let[c,u]=A;for(;n<=u;){if(this.#s(e.slice(0,n+c.length),c,s,n,0)&&o<this.maxGlobstarRecursion){let g=this.#c(e,r,n+c.length,i+1,s,o+1,a);if(g!==!1)return g}let d=e[n];if(d==="."||d===".."||!this.options.dot&&d.startsWith("."))return!1;n++}return s||null}#s(e,r,n,i,s){let o,a,A,c;for(o=i,a=s,c=e.length,A=r.length;o<c&&a<A;o++,a++){this.debug("matchOne loop");let u=r[a],l=e[o];if(this.debug(r,u,l),u===!1||u===wi)return!1;let d;if(typeof u=="string"?(d=l===u,this.debug("string match",u,l,d)):(d=u.test(l),this.debug("pattern match",u,l,d)),!d)return!1}if(o===c&&a===A)return!0;if(o===c)return n;if(a===A)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return rle(this.pattern,this.options)}parse(e){gE(e);let r=this.options;if(e==="**")return wi;if(e==="")return"";let n,i=null;(n=e.match(Pze))?i=r.dot?_ze:Lze:(n=e.match(bze))?i=(r.nocase?r.dot?Fze:xze:r.dot?vze:Sze)(n[1]):(n=e.match(Uze))?i=(r.nocase?r.dot?Oze:Gze:r.dot?Kze:Hze)(n):(n=e.match(kze))?i=r.dot?Nze:Rze:(n=e.match(Tze))&&(i=Mze);let s=Hg.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}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?jze:r.dot?qze:$ze,i=new Set(r.nocase?["i"]:[]),s=e.map(A=>{let c=A.map(l=>{if(l instanceof RegExp)for(let d of l.flags.split(""))i.add(d);return typeof l=="string"?Zze(l):l===wi?wi:l._src});c.forEach((l,d)=>{let g=c[d+1],p=c[d-1];l!==wi||p===wi||(p===void 0?g!==void 0&&g!==wi?c[d+1]="(?:\\/|"+n+"\\/)?"+g:c[d]=n:g===void 0?c[d-1]=p+"(?:\\/|\\/"+n+")?":g!==wi&&(c[d-1]=p+"(?:\\/|\\/"+n+"\\/)"+g,c[d+1]=wi))});let u=c.filter(l=>l!==wi);if(this.partial&&u.length>=1){let l=[];for(let d=1;d<=u.length;d++)l.push(u.slice(0,d).join("/"));return"(?:"+l.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...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 s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a=0;a<s.length;a++){let A=s[a],c=i;if(n.matchBase&&A.length===1&&(c=[o]),this.matchOne(c,A,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return ti.defaults(e).Minimatch}};ti.AST=Hg;ti.Minimatch=Jf;ti.escape=KG;ti.unescape=qu});async function eXe(t,e,r){let n=t.builderPublicKey;if(!n)return[];let i=new URL(`${ke}/projects/memories`);i.searchParams.set("apiKey",n),i.searchParams.set("projectId",e),t.userId&&i.searchParams.set("userId",t.userId);let s={"Content-Type":"application/json"};t.builderPrivateKey&&(s.Authorization=`Bearer ${t.builderPrivateKey}`);let a=await(await Fe(i,{method:"GET",headers:s,keepalive:!0,signal:r})).json();return Array.isArray(a?.memories)?a.memories:[]}function tXe(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ile(t){return t.replace(/[*?{}[\]!]/g,"").replace(/\/+/g,"/").toLowerCase()}async function rXe(t,e){let r=new Map;for(let i of t){let s=i.category||"general";r.has(s)||r.set(s,[]),r.get(s).push(i)}if(r.size===0)return;await Tb.default.mkdir(e,{recursive:!0});let n=[];for(let[i,s]of r){let o=`${tXe(i)}.md`,a=sle.default.join(e,o),A=s.filter(g=>g.glob),c=s.filter(g=>!g.glob),u=new Map;for(let g of A){let p=g.glob;u.has(p)||u.set(p,[]),u.get(p).push(g)}let l=[...u.keys()].sort((g,p)=>ile(g).localeCompare(ile(p))),d=[];if(d.push(`# ${i}`),d.push(""),l.length>0){d.push("## File-specific"),d.push("");for(let g of l){let p=u.get(g);d.push(`### \`${g}\``),d.push("");for(let f of p)d.push(`- **When**: ${f.when}`),d.push(` ${f.memory}`),d.push("")}}if(c.length>0){d.push("## General"),d.push("");for(let g of c)d.push(`- **When**: ${g.when}`),d.push(` ${g.memory}`),d.push("")}n.push(Tb.default.writeFile(a,d.join(`
|
|
1837
|
-
`),"utf-8"))}await Promise.all(n)}function nXe(t){let e=[],r=0,n=0;for(let i=0;i<t.length;i++){let s=t[i];s==="{"?r++:s==="}"&&r>0?r--:s===","&&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 ole(t,e){if(!e)return[];let r=e.replace(/\\/g,"/");return t.filter(n=>n.glob?nXe(n.glob).some(s=>{try{return ti(r,s.replace(/\\/g,"/"),{matchBase:!0})}catch{return!1}}):!1)}async function ale(t,e,r,n){try{return await eXe(e,r,n)}catch(i){return t.Sentry?.captureException(new Error("Failed to load memories",{cause:i})),[]}}async function Mb(t,e,r){try{await Tb.default.rm(r,{recursive:!0,force:!0}),e.length>0&&await rXe(e,r)}catch(n){t.Sentry?.captureException(new Error("Failed to sync memories to disk",{cause:n}))}}var Tb,sle,JG=L(()=>{"use strict";h();Tb=z(require("node:fs/promises"),1),sle=z(require("node:path"),1);nle();yr();mr()});function iXe(){if(dE!==void 0)return dE;try{return dE=require("prettier"),dE}catch{return dE=null,null}}function ho(t){try{return JSON.stringify(t)}catch{return String(t)}}var $u,YG,Lb,cle,Gb,_b,ule,dE,Ale,sXe,oXe,aXe,AXe,ua,Pb,Yf=L(()=>{"use strict";h();Dg();Jie();Rr();Ds();yr();mr();$u=z(require("node:fs"),1),YG=require("node:crypto");mL();CL();Vie();Xie();Yw();B1();NC();use();Lb=z(require("node:os"),1);UL();fi();Dt();Cse();n0();kse();Tse();Xs();GL();cle=z(require("chokidar"),1);KL();XG();Use();tO();Wt();Gb=z(require("node:events"),1);UC();_b=require("node:crypto");ef();Kse();w1();LC();sg();vue();ta();xue();ule=require("node:fs/promises");TG();_C();jC();WA();Nue();JG();zo();Ew();DD();o0();Ale=["ask-to-continue","credits-limit-daily","credits-limit-monthly","credits-limit-other","invalid-last-message"],sXe=["initial-with-url","initial-without-url","success"],oXe=1800*1e3,aXe=2147483647,AXe=t=>{let e=Number(process.env.AGENT_TIMEOUT_OVERRIDE_MS),r=Number.isFinite(e)&&e>0?e:t&&Number.isFinite(t)&&t>0?t:oXe;return Math.min(r,aXe)},ua=class t{#n;#c;#s;#t=[];#A;#i;#e;#o;#B;#h;#M;#k;#S;#v;#a=!!(process.env.DEBUG||process.env.FUSION_DEBUG==="true");#p=!1;#r=Se("Agent",{debug:()=>this.#a});#g=new Gb.default;#H=new Map;#W=new Set;#w;#J;#R;#P;#Te=[];#Ze=void 0;#It="";#ee;#Et=Promise.resolve(void 0);#z=[];#L;#Y=[];#Ie;#te=new Map;#Me=[];#ie;#Ht=0;#se;#X;#f;#C;#Bt;#et;#tt;#Pe=!1;#Ee;#Be=void 0;#rt;#Le;#_e;#oe;#m;#d=[];#x;#yt;#E;#nt;#ye;#Qe=0;#ae;#D;#Qt=[];#Dt=new Set;#u;#I;#y;#Ue;#j;#Ae;#it;#Ge=!1;#wt=0;#ce=null;#ue=0;#re=!1;#Oe;#Ke;#_;#bt;#St;#le=[];#He=[];#st=!1;#ge=new Map;#Je=new Map;#De={};#U={};#vt=!1;#Ye;#ot=!1;#Jt=new Set;#we;#N={};#at;#At=[];#je=0;#be=null;#xt=void 0;#b=new Map;#Q={watcher:null,listeners:new Set,debounceMs:300,pendingEvents:[]};#Ft=!1;#l=null;#qe=new Set;#$e=new Map;#Se=new Map;#ve=new Map;#xe=new Map;static#Ve=3e4;#Fe=null;#pe=[];get primaryGitPath(){return this.#d[0]?.path||this.#m}#ke(e){if(!e)return this.primaryGitPath;let r=this.#d.find(n=>n.folderName===e);if(!r)throw new Error(`Folder "${e}" not found in git-enabled folders`);return r.path}#kt(e,r){if(typeof e!="string")throw new TypeError(`#parsePathWithFolder: 'path' must be a string, received ${typeof e}: ${ho(e)}`);if(r)return{repoPath:this.#ke(r),relativePath:e};for(let n of this.#d){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.#j=e.modelOverride,this.#Ae=e.agentModelOverrides,this.#o=e.credentials,"initialUrl"in e){let n=Ile(e.initialUrl).id;n?this.#X=n:this.#B=e.initialUrl}typeof e.autoImportLocalMCPs=="boolean"&&(this.#Ft=e.autoImportLocalMCPs),"sessionOrCompletionId"in e?this.#X=e.sessionOrCompletionId:this.#X=e.fusionConfig?.sessionId;let r=e.workingDirectory??e.fusionConfig?.workingDirectory;if(this.#m=r?e.sys.resolve(e.sys.cwd(),r):e.sys.getCwdDir(),this.#M=e.skipFileDiff??!0,this.#h=e.position,this.#w=e.mode,this.#L=e.privacyMode??e.fusionConfig?.privacyMode,this.#f=e.devServerOrchestrator,this.#C=e.git??!1,this.#S=e.softContextWindow,this.#C&&(process.env.GIT_CEILING_DIRECTORIES=this.#m),this.#Bt=e.gitAutoInit??!1,this.#u=e.fusionConfig,this.#st=e.asyncSubAgents??!1,this.#A=e.queueMode??"next-turn",this.#J=e.fusionConfig?.autoPush,this.#I=e.fusionConfig?.projectId,this.#y=e.fusionConfig?.branchName,this.#R=e.fusionConfig?.featureBranch,this.#P=e.fusionConfig?.aiBranch,this.#Oe=e.fusionConfig?.proxyOrigin,this.#Ke=e.fusionConfig?.proxyDefaultOrigin,this.#et=e.fusionStatusMonitor,process.env.FUSION_ENV_ORIGIN&&(this.#bt=process.env.FUSION_ENV_ORIGIN),this.#_=e.agentType,this.#vt=e.persistSessionLocally??!1,this.#Ye=e.parentSessionId,e.enabledTools)this.#D=Pb(this.#u,e.enabledTools);else if(this.#w==="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.#f&&n.push("dev_server_control"),this.#D=Pb(this.#u,n)}else if(this.#w==="quality-v4"){let n=["Write","Edit","Read","MultiEdit","Grep","Glob","Skill","TaskCreate","TaskUpdate","TaskList","Agent","Media","WebFetch","AskUserQuestion","ExitPlanMode","EnterPlanMode",process.platform==="win32"?"PowerShell":"Bash"],i=!!(this.#L?.enabled||this.#L?.redactUserMessages||this.#L?.redactLLMMessages);i||n.push("WebSearch"),this.#I&&!i&&this.getCommitMode()!=="commits"&&n.push("SearchMemories"),i||n.push("GetScreenshot"),n.push("NavigatePreview"),this.#f&&(n.push("DevServerLogs"),n.push("DevServerRestart"),n.push("ProposeEnvVariable")),process.env.FUSION_IDE_PORT&&n.push("IDEDiagnostics"),n.push("PullPrototype"),this.#D=Pb(this.#u,n)}if(this.#yt=e.maxTokens,this.#it=e.reasoning,this.#rt=e.builtInCustomInstructions??[],this.#Le=e.builtInCustomAgents??[],this.#_e=e.builtInMCPServerConfig??{},this.#oe=e.systemPromptOverride,this.#E=e.fusionConfig?.workspace,this.#nt=e.mcpServers??!1,this.#x=this.#m,this.#d=[],this.#E?.folders.length){let n=this.#E.folders.filter(i=>i.enableGit);this.#d=n.map(i=>({folderName:i.name??i.path,path:this.#e.resolve(this.#m,i.path),branchName:i.branchName||"main",repoUrl:i.repoUrl,originalRepoUrl:i.originalRepoUrl,repoName:i.repoName}));for(let i of n){let s=i.backupMetadata?.check.backup,o=i.name??i.path,a=ZC({version:s?.version,originalRepoUrl:s?.repoUrl,commitHash:s?.lastCommitHash});a&&(this.#De[o]=a)}}this.#d.length===0&&(this.#d=[{folderName:this.#e.basename(this.#m),path:this.#m,branchName:"main"}]),this.#we=Fle(this.#E),this.#E?.folders[0]&&this.#T()&&(this.#x=this.#e.resolve(this.#m,this.#E.folders[0].path)),this.#g.on("idle",()=>{let n=this.#je;if(this.#je=0,this.#I==null&&this.#y==null||this.#Ye)return;this.clearSessionCanHandleTools(),this.#r.debug("emitting ClientDevtoolsSessionIdleEventV1",{projectId:this.#I,branchName:this.#y});let i=this.#de;lA(this.#o,"/events/publish",{event:fre,extraData:{sessionId:this.getSessionId(),lastMessage:this.getLastMessage(),projectId:this.#I,branchName:this.#y,hasPlanToApply:i,sessionMode:this.getSessionMode(),gifId:this.#U.gif_id,planContent:this.#Yt,completionId:this.getLastCompletionId(),credits:n},extraAttributes:{projectId:this.#I,branchName:this.#y}},{debug:this.#a})})}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.#d}get workingDirectory(){return this.#m}get bashWorkingDirectory(){return this.#x}getSessionMode(){return this.#n?.sessionMode??"normal"}get#Yt(){let e=this.getSessionContext();for(let r=e.turns.length-1;r>=0;r--){let n=e.turns[r];if(n.state==="done"){if(n.user.role==="user")return;for(let i of n.actions??[])if(i.type==="tool"&&i.filePath==="ExitPlanMode")try{let s=JSON.parse(i.content);if(typeof s.plan=="string")return s.plan}catch{}}}}get#de(){let e=this.getSessionContext();if(e.sessionMode!=="planning")return!1;for(let r=e.turns.length-1;r>=0;r--){let n=e.turns[r];if(n.state==="done"){if(n.user.role==="user")return!1;for(let i of n.actions??[])if(i.type==="tool"&&i.filePath==="ExitPlanMode")try{let s=JSON.parse(i.content);if(s.hasPlanToApply||s.sessionMode==="planning")return!0}catch{}}}return!1}async switchSessionMode(e){let r=this.getSessionContext();r.sessionMode!==e&&(r.sessionMode=e,await this.#Ce())}async switchModelOverride(e){this.#j=e||void 0,await this.#Ce()}#jt(){if(!this.#_||!this.#Ae)return;let e=this.#Ae[this.#_];if(e){if(typeof e=="string")return Su(e);if(Array.isArray(e)&&e.length){let r=this.#ge.get(this.#_)??0;return this.#ge.set(this.#_,r+1),Su(e[r%e.length])}}}removeSystemReminder(e){let r=this.#Y.findIndex(n=>n.tag===e);r!==-1&&this.#Y.splice(r,1)}getMemoriesForFile(e){let r=ole(this.#Qt,e).filter(n=>!this.#Dt.has(n.id));for(let n of r)this.#Dt.add(n.id);return r}queueSystemReminder(e){let r=e.tag?this.#Y.findIndex(n=>n.tag===e.tag):-1;return r!==-1?e.text?(this.#Y[r]=e,{operation:"update"}):(this.#Y.splice(r,1),{operation:"delete"}):e.text?(this.#Y.push(e),{operation:"add"}):{operation:"noop"}}setDefaultAutoPush(e){this.#J=e}async setPrivacyMode(e){if(e&&e.enabled){if(!e.encryptKey&&!this.#Ie)this.#Ie=await kue();else if(e.encryptKey){if(!await Fb(e.encryptKey))throw new Error("Invalid encryption key: key failed validation");this.#Ie=e.encryptKey}}else this.#Ie=void 0;this.#L=e}async initializeSession(e={}){return this.#tt||(this.#tt=this.#Vt(e)),await this.#tt}async loadHistory(){let e=this.getSessionContext(),r=await Ub(this.#e,this.#o,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=sf(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 s=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 d=(await this.git(["cat-file","--batch-check","--buffer"],{sys:this.#e,cwd:c.path,stdin:Array.from(A).map(p=>`${p}^{commit}`).join(`
|
|
1837
|
+
`),"utf-8"))}await Promise.all(n)}function nXe(t){let e=[],r=0,n=0;for(let i=0;i<t.length;i++){let s=t[i];s==="{"?r++:s==="}"&&r>0?r--:s===","&&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 ole(t,e){if(!e)return[];let r=e.replace(/\\/g,"/");return t.filter(n=>n.glob?nXe(n.glob).some(s=>{try{return ti(r,s.replace(/\\/g,"/"),{matchBase:!0})}catch{return!1}}):!1)}async function ale(t,e,r,n){try{return await eXe(e,r,n)}catch(i){return t.Sentry?.captureException(new Error("Failed to load memories",{cause:i})),[]}}async function Mb(t,e,r){try{await Tb.default.rm(r,{recursive:!0,force:!0}),e.length>0&&await rXe(e,r)}catch(n){t.Sentry?.captureException(new Error("Failed to sync memories to disk",{cause:n}))}}var Tb,sle,JG=L(()=>{"use strict";h();Tb=z(require("node:fs/promises"),1),sle=z(require("node:path"),1);nle();yr();mr()});function iXe(){if(dE!==void 0)return dE;try{return dE=require("prettier"),dE}catch{return dE=null,null}}function ho(t){try{return JSON.stringify(t)}catch{return String(t)}}var $u,YG,Lb,cle,Gb,_b,ule,dE,Ale,sXe,oXe,aXe,AXe,ua,Pb,Yf=L(()=>{"use strict";h();Dg();Jie();Rr();Ds();yr();mr();$u=z(require("node:fs"),1),YG=require("node:crypto");mL();CL();Vie();Xie();Yw();B1();NC();use();Lb=z(require("node:os"),1);UL();fi();Dt();Cse();n0();kse();Tse();Xs();GL();cle=z(require("chokidar"),1);KL();XG();Use();tO();Wt();Gb=z(require("node:events"),1);UC();_b=require("node:crypto");ef();Kse();w1();LC();sg();vue();ta();xue();ule=require("node:fs/promises");TG();_C();jC();WA();Nue();JG();zo();Ew();DD();o0();Ale=["ask-to-continue","credits-limit-daily","credits-limit-monthly","credits-limit-other","invalid-last-message"],sXe=["initial-with-url","initial-without-url","success"],oXe=1800*1e3,aXe=2147483647,AXe=t=>{let e=Number(process.env.AGENT_TIMEOUT_OVERRIDE_MS),r=Number.isFinite(e)&&e>0?e:t&&Number.isFinite(t)&&t>0?t:oXe;return Math.min(r,aXe)},ua=class t{#n;#c;#s;#t=[];#A;#i;#e;#o;#B;#h;#M;#k;#S;#v;#a=!!(process.env.DEBUG||process.env.FUSION_DEBUG==="true");#p=!1;#r=Se("Agent",{debug:()=>this.#a});#g=new Gb.default;#H=new Map;#W=new Set;#w;#J;#R;#P;#Te=[];#Ze=void 0;#It="";#ee;#Et=Promise.resolve(void 0);#z=[];#L;#Y=[];#Ie;#te=new Map;#Me=[];#ie;#Jt=0;#se;#X;#f;#C;#Bt;#et;#tt;#Pe=!1;#Ee;#Be=void 0;#rt;#Le;#_e;#oe;#m;#d=[];#x;#yt;#E;#nt;#ye;#Qe=0;#ae;#D;#Qt=[];#Dt=new Set;#u;#I;#y;#Ue;#j;#Ae;#it;#Ge=!1;#wt=0;#ce=null;#ue=0;#re=!1;#Oe;#Ke;#_;#bt;#St;#le=[];#He=[];#st=!1;#ge=new Map;#Je=new Map;#De={};#U={};#vt=!1;#Ye;#xt;#ot=!1;#Yt=new Set;#we;#N={};#at;#At=[];#je=0;#be=null;#Ft=void 0;#b=new Map;#Q={watcher:null,listeners:new Set,debounceMs:300,pendingEvents:[]};#kt=!1;#l=null;#qe=new Set;#$e=new Map;#Se=new Map;#ve=new Map;#xe=new Map;static#Ve=3e4;#Fe=null;#pe=[];get primaryGitPath(){return this.#d[0]?.path||this.#m}#ke(e){if(!e)return this.primaryGitPath;let r=this.#d.find(n=>n.folderName===e);if(!r)throw new Error(`Folder "${e}" not found in git-enabled folders`);return r.path}#Rt(e,r){if(typeof e!="string")throw new TypeError(`#parsePathWithFolder: 'path' must be a string, received ${typeof e}: ${ho(e)}`);if(r)return{repoPath:this.#ke(r),relativePath:e};for(let n of this.#d){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.#j=e.modelOverride,this.#Ae=e.agentModelOverrides,this.#o=e.credentials,"initialUrl"in e){let n=Ile(e.initialUrl).id;n?this.#X=n:this.#B=e.initialUrl}typeof e.autoImportLocalMCPs=="boolean"&&(this.#kt=e.autoImportLocalMCPs),"sessionOrCompletionId"in e?this.#X=e.sessionOrCompletionId:this.#X=e.fusionConfig?.sessionId;let r=e.workingDirectory??e.fusionConfig?.workingDirectory;if(this.#m=r?e.sys.resolve(e.sys.cwd(),r):e.sys.getCwdDir(),this.#M=e.skipFileDiff??!0,this.#h=e.position,this.#w=e.mode,this.#L=e.privacyMode??e.fusionConfig?.privacyMode,this.#f=e.devServerOrchestrator,this.#C=e.git??!1,this.#S=e.softContextWindow,this.#C&&(process.env.GIT_CEILING_DIRECTORIES=this.#m),this.#Bt=e.gitAutoInit??!1,this.#u=e.fusionConfig,this.#st=e.asyncSubAgents??!1,this.#A=e.queueMode??"next-turn",this.#J=e.fusionConfig?.autoPush,this.#I=e.fusionConfig?.projectId,this.#y=e.fusionConfig?.branchName,this.#R=e.fusionConfig?.featureBranch,this.#P=e.fusionConfig?.aiBranch,this.#Oe=e.fusionConfig?.proxyOrigin,this.#Ke=e.fusionConfig?.proxyDefaultOrigin,this.#et=e.fusionStatusMonitor,process.env.FUSION_ENV_ORIGIN&&(this.#bt=process.env.FUSION_ENV_ORIGIN),this.#_=e.agentType,this.#vt=e.persistSessionLocally??!1,this.#Ye=e.parentSessionId,this.#xt=e.mainSessionId,e.enabledTools)this.#D=Pb(this.#u,e.enabledTools);else if(this.#w==="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.#f&&n.push("dev_server_control"),this.#D=Pb(this.#u,n)}else if(this.#w==="quality-v4"){let n=["Write","Edit","Read","MultiEdit","Grep","Glob","Skill","TaskCreate","TaskUpdate","TaskList","Agent","Media","WebFetch","AskUserQuestion","ExitPlanMode","EnterPlanMode",process.platform==="win32"?"PowerShell":"Bash"],i=!!(this.#L?.enabled||this.#L?.redactUserMessages||this.#L?.redactLLMMessages);i||n.push("WebSearch"),this.#I&&!i&&this.getCommitMode()!=="commits"&&n.push("SearchMemories"),i||n.push("GetScreenshot"),n.push("NavigatePreview"),this.#f&&(n.push("DevServerLogs"),n.push("DevServerRestart"),n.push("ProposeEnvVariable")),process.env.FUSION_IDE_PORT&&n.push("IDEDiagnostics"),n.push("PullPrototype"),this.#D=Pb(this.#u,n)}if(this.#yt=e.maxTokens,this.#it=e.reasoning,this.#rt=e.builtInCustomInstructions??[],this.#Le=e.builtInCustomAgents??[],this.#_e=e.builtInMCPServerConfig??{},this.#oe=e.systemPromptOverride,this.#E=e.fusionConfig?.workspace,this.#nt=e.mcpServers??!1,this.#x=this.#m,this.#d=[],this.#E?.folders.length){let n=this.#E.folders.filter(i=>i.enableGit);this.#d=n.map(i=>({folderName:i.name??i.path,path:this.#e.resolve(this.#m,i.path),branchName:i.branchName||"main",repoUrl:i.repoUrl,originalRepoUrl:i.originalRepoUrl,repoName:i.repoName}));for(let i of n){let s=i.backupMetadata?.check.backup,o=i.name??i.path,a=ZC({version:s?.version,originalRepoUrl:s?.repoUrl,commitHash:s?.lastCommitHash});a&&(this.#De[o]=a)}}this.#d.length===0&&(this.#d=[{folderName:this.#e.basename(this.#m),path:this.#m,branchName:"main"}]),this.#we=Fle(this.#E),this.#E?.folders[0]&&this.#T()&&(this.#x=this.#e.resolve(this.#m,this.#E.folders[0].path)),this.#g.on("idle",()=>{let n=this.#je;if(this.#je=0,this.#I==null&&this.#y==null||this.#Ye)return;this.clearSessionCanHandleTools(),this.#r.debug("emitting ClientDevtoolsSessionIdleEventV1",{projectId:this.#I,branchName:this.#y});let i=this.#de;lA(this.#o,"/events/publish",{event:fre,extraData:{sessionId:this.getSessionId(),lastMessage:this.getLastMessage(),projectId:this.#I,branchName:this.#y,hasPlanToApply:i,sessionMode:this.getSessionMode(),gifId:this.#U.gif_id,planContent:this.#jt,completionId:this.getLastCompletionId(),credits:n},extraAttributes:{projectId:this.#I,branchName:this.#y}},{debug:this.#a})})}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.#d}get workingDirectory(){return this.#m}get bashWorkingDirectory(){return this.#x}getSessionMode(){return this.#n?.sessionMode??"normal"}get#jt(){let e=this.getSessionContext();for(let r=e.turns.length-1;r>=0;r--){let n=e.turns[r];if(n.state==="done"){if(n.user.role==="user")return;for(let i of n.actions??[])if(i.type==="tool"&&i.filePath==="ExitPlanMode")try{let s=JSON.parse(i.content);if(typeof s.plan=="string")return s.plan}catch{}}}}get#de(){let e=this.getSessionContext();if(e.sessionMode!=="planning")return!1;for(let r=e.turns.length-1;r>=0;r--){let n=e.turns[r];if(n.state==="done"){if(n.user.role==="user")return!1;for(let i of n.actions??[])if(i.type==="tool"&&i.filePath==="ExitPlanMode")try{let s=JSON.parse(i.content);if(s.hasPlanToApply||s.sessionMode==="planning")return!0}catch{}}}return!1}async switchSessionMode(e){let r=this.getSessionContext();r.sessionMode!==e&&(r.sessionMode=e,await this.#Ce())}async switchModelOverride(e){this.#j=e||void 0,await this.#Ce()}#qt(){if(!this.#_||!this.#Ae)return;let e=this.#Ae[this.#_];if(e){if(typeof e=="string")return Su(e);if(Array.isArray(e)&&e.length){let r=this.#ge.get(this.#_)??0;return this.#ge.set(this.#_,r+1),Su(e[r%e.length])}}}removeSystemReminder(e){let r=this.#Y.findIndex(n=>n.tag===e);r!==-1&&this.#Y.splice(r,1)}getMemoriesForFile(e){let r=ole(this.#Qt,e).filter(n=>!this.#Dt.has(n.id));for(let n of r)this.#Dt.add(n.id);return r}queueSystemReminder(e){let r=e.tag?this.#Y.findIndex(n=>n.tag===e.tag):-1;return r!==-1?e.text?(this.#Y[r]=e,{operation:"update"}):(this.#Y.splice(r,1),{operation:"delete"}):e.text?(this.#Y.push(e),{operation:"add"}):{operation:"noop"}}setDefaultAutoPush(e){this.#J=e}async setPrivacyMode(e){if(e&&e.enabled){if(!e.encryptKey&&!this.#Ie)this.#Ie=await kue();else if(e.encryptKey){if(!await Fb(e.encryptKey))throw new Error("Invalid encryption key: key failed validation");this.#Ie=e.encryptKey}}else this.#Ie=void 0;this.#L=e}async initializeSession(e={}){return this.#tt||(this.#tt=this.#Wt(e)),await this.#tt}async loadHistory(){let e=this.getSessionContext(),r=await Ub(this.#e,this.#o,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=sf(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 s=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 d=(await this.git(["cat-file","--batch-check","--buffer"],{sys:this.#e,cwd:c.path,stdin:Array.from(A).map(p=>`${p}^{commit}`).join(`
|
|
1838
1838
|
`)})).trim().split(`
|
|
1839
|
-
`),g=new Set;for(let p of d)if(p.includes("missing")){let f=p.split(/\s+/)[0].replace("^{commit}","");g.add(f)}for(let p of A)g.has(p)||u.add(p)}catch(l){this.#e.Sentry?.captureException(l)}s.set(a,u)}let o=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(p=>p.folderName===u))continue;let g=s.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:o}}async loadWholeSession(e={}){let{getAll:r=!0}=e,n=this.getSessionContext(),i=0;for(;n.canLoadMore&&n.canLoadMore;){let s=await this.loadMoreTurns();i+=s.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.#Ee||(this.#Ee=this
|
|
1839
|
+
`),g=new Set;for(let p of d)if(p.includes("missing")){let f=p.split(/\s+/)[0].replace("^{commit}","");g.add(f)}for(let p of A)g.has(p)||u.add(p)}catch(l){this.#e.Sentry?.captureException(l)}s.set(a,u)}let o=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(p=>p.folderName===u))continue;let g=s.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:o}}async loadWholeSession(e={}){let{getAll:r=!0}=e,n=this.getSessionContext(),i=0;for(;n.canLoadMore&&n.canLoadMore;){let s=await this.loadMoreTurns();i+=s.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.#Ee||(this.#Ee=this.#$t().then(e=>(this.#Ee=void 0,e))),this.#Ee}async#$t(){let e=this.getSessionContext();if(e.canLoadMore){let r=e.turns[0]?.completionId,n=await Ub(this.#e,this.#o,e.sessionId,!0,this.#a,r);return n.turns.length>0&&e.turns.unshift(...n.turns),e.canLoadMore=n.canLoadMore,n.turns}return[]}async#Vt(){try{let e=iXe();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.#rt=e,this.#n&&(this.#n.customInstructions=await this.#Re())}async setCustomAgents(e){this.#Le=e,this.#n&&(this.#n.customAgents=await this.#We())}async#Re(){let r=(await Promise.all(this.#d.map(n=>eO({sys:this.#e,projectDir:this.#m,currentDir:n.path,rootDir:"/",allowedCommands:Cw(this.#u?.allowedCommands??[]),skipCommandSecurity:this.#u?.skipCommandSecurity===!0})))).flat();return jG(this.#rt??[],r)}async#We(){if(!this.#D?.includes("Agent"))return[];let r=(await Promise.all(this.#d.map(n=>_se({sys:this.#e,projectDir:this.#m,currentDir:n.path,rootDir:"/"})))).flat();return jG(this.#Le??[],r)}async#Wt(e){try{if(this.#Ge)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.#m}`),await this.setPrivacyMode(this.#L);let r=await this.#Xt(),n=await this.#Vt();r&&(this.#N=await this.#G());let i=this.#d[0]?.repoUrl;if(this.#Ue=await Zw(i),!this.#Ue)try{let c=await this.git(["remote","get-url","origin"],{cwd:this.#m});c&&(this.#Ue=await Zw(c))}catch{}let s,o;this.#X||(this.#X=r?.sessionId),this.#X?e.skipSessionLoading?s=this.#X:(o=await Ub(this.#e,this.#o,this.#X,!0,this.#a,void 0,e.signal),s=o.sessionId,this.#r.debug(`Session recovered (sessionId=${s}, turnsCount=${o.turns.length})`)):s=(0,_b.randomUUID)(),this.#R||(this.#R=r?.featureBranch?.trim());let a={turns:o?.turns??[],sessionId:s,customInstructions:await this.#Re(),customAgents:await this.#We(),title:o?.title,beforeCommit:o?.beforeCommit,createdUnixTime:o?.createdUnixTime??Date.now(),updatedUnixTime:o?.updatedUnixTime??Date.now(),userContext:await Ele(this.#e,this.primaryGitPath),prettierConfig:n,canLoadMore:o?.canLoadMore??!1,state:o?.turns.length?"success":this.#B?"initial-with-url":"initial-without-url",sessionMode:o?.sessionMode??"normal"};if(this.#U=o?.metadata??{},o){let c=uA(o.turns);c?.completionId!==o.lastCompletionId&&this.#e.Sentry?.captureException(new Error("Last completion id mismatch"),{tags:{operation:"codegen-initialize-session"},extra:{lastTurn:c,sessionMetadata:o}})}if(this.#a&&this.#g.on("step",c=>{c.type!=="delta"&&this.#r.debug(`(${c.type}): ${Yd(JSON.stringify(c),400)}`)}),await this.#er(a),this.#n=a,this.#_){let c=await this.getNamedAgentConfig(this.#_,this.getSessionId(),e.signal);if(c.success){if(this.#k=c.options.includeMemories,this.#D=c.options.enabledTools,this.#j=c.options.modelOverride,this.#w=c.options.mode,this.#oe=c.options.systemPromptOverride,this.#h=c.options.position,this.#A=c.options.queueMode??"next-turn",this.#st=c.options.asyncSubAgents??!1,this.#S=c.options.softContextWindow,this.#_e={...this.#_e,...c.options.builtInMCPServerConfig},c.options.builtInMCPServerConfig?.chrome&&!this.#ze){let u=new zC(this.getSessionId(),{framesDir:this.#e.join(Lb.default.homedir(),".builder","recordings"),debug:this.#a});this.setTimeline(u)}typeof c.options.mcpServers=="boolean"&&(this.#nt=c.options.mcpServers)}else this.#r.error(c.response)}try{let c=await Sue(this.#e,this.primaryGitPath,this.#_e,this.#kt,e.signal);c.length>0?(this.#r.debug(`Initializing ${c.length} local MCP server(s)...`),this.#ye=await bue(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.#C&&this.#I&&this.#D?.includes("SearchMemories")){let c=await ale(this.#e,this.#o,this.#I,e.signal);await Mb(this.#e,c,this.#e.join(this.#x,".builder","memories")),this.#Qt=c,this.#D&&c.length===0&&(this.#D=this.#D.filter(u=>u!=="SearchMemories"))}let A=this.#f;if(A){let c=()=>{this.#g.emit("step",zG(A,this.#u))},u=()=>{this.#g.emit("step",zG(A,this.#u)),this.#Ce(),this.#he()},l=d=>{d==="ok-2xx"&&this.requestRefresh()};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.#Me.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#ct(e,r){let n="reminder:health";this.removeSystemReminder(n);let i=this.#f;if(!i||!(this.#D?.includes("DevServerLogs")||this.#D?.includes("DevServerRestart")||this.#D?.includes("DevServerControl")||this.#D?.includes("ProposeEnvVariable")))return;let o=this.getSessionContext();if(o.sessionMode!=="normal")return;e&&await i.waitUntilIdle(500,500);let a=i.setupState,A=await this.#lt(),c=i.devCommand,u=i.devState,l=i.state,d=i.setupCommand,g=await i.getOpenPorts(),p=i.proxyTarget,f=i.httpServerState.state,m=i.lastServerStatus,C=f==="error-fetch",I=!1;this.#C&&(I=await this.getCurrentBranch()!==this.getAiBranch());let B=f==="error-5xx"||f==="error-4xx"&&m!==401&&m!==404,E="",y=!1,Q=!1;l==="install-failed"||l==="install-aborted"?E=i.getSetupOutput():(E=i.getCheckpoints(1,u!=="running"?"err":"all"),y=Qle(E??""));let w="",D="",x="error",S="Try to fix",v="repair-unknown";if(l==="not-installed"||l==="install-failed"||l==="install-aborted"||l==="failed"||I||C||B||y||A.length>0){if(I&&(v="repair-bad-branch",D+=`- The current git branch is not the AI branch (${this.getAiBranch()}).
|
|
1840
1840
|
`,D+=`- Please switch to the AI branch using the 'git' tool.
|
|
1841
1841
|
`,w=`The current branch is not the AI branch (${this.getAiBranch()}).`),A.length>0){v="repair-merge-conflict",S="Resolve conflict",w="Merge conflict detected - changes from different sources need to be combined";let H=this.#at,M=H?`
|
|
1842
1842
|
ours (:2:) = ${H.ourBranch} (AI branch), theirs (:3:) = ${H.theirBranch} (${H.theirIsMain?"main \u2014 prefer preserving these changes":"AI remote"})`:"";D+=`Merge conflict detected. Resolve ALL conflicted files:
|
|
@@ -1887,19 +1887,19 @@ ${i.getSetupOutput().slice(-8e3)}
|
|
|
1887
1887
|
`:E&&(D+=`<dev_logs>
|
|
1888
1888
|
${E}
|
|
1889
1889
|
</dev_logs>
|
|
1890
|
-
`)}(r==="all"||r==="critical"&&!Q)&&this.queueSystemReminder({text:Yd(D,2e3),tag:n});let P={devServerState:u,setupState:a,httpServerState:f,proxyServer:p,devCommand:c,setupCommand:d,hasMergeConflict:A.length>0,hasConfigurationIssue:Q,logs:E,prompt:"Debug and fix the issue before continuing.",message:w},$=this.#t.length===0&&sXe.includes(o.state);return{actionButtonText:S,type:"build-error",level:x,canAutoApply:$,healthStatus:P,message:P.message,userMessage:{userPrompt:P.prompt,repair:!0,category:v,displayPrompt:P.message}}}}async#Wt(){let e=await this.#ct(!1,"critical"),r=!!(e&&!e.healthStatus.hasConfigurationIssue);return r&&this.#f?.addCheckpoint(),{hasHealthIssue:r}}async#zt(){let e;if(this.#C)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.#Bt){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 Mw({sys:this.#e,gitWorkingDirectory:this.primaryGitPath,strict:!0})}catch(r){q.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#Xt(e,r){try{await this.git(["checkout",e],{cwd:r})}catch{await this.git(["checkout","-b",e],{cwd:r})}}async#Zt(e){if(!this.#C)return;if(!this.#P){let s=Sie(this.getFeatureBranch(),e.sessionId);this.#P=s}let r=this.getAiBranch();await this.#q(async s=>{await this.getCurrentBranch(s.path)!==r&&await this.#Xt(r,s.path);try{await this.git(["branch","--set-upstream-to",`refs/remotes/origin/${this.#fe(s)}`],{cwd:s.path})}catch{}});let n=uA(e.turns),i=n?.afterCommit??n?.lastCommit;if(i)for(let s of this.gitRepoContexts){let o=this.gitRepoContexts[0]?.folderName,a=Du(i,s.folderName,o);if(a){let A=await this.getCurrentCommitHash("HEAD",s.path);A&&A!==a&&this.#e.Sentry?.captureException(new Error(`Init: After commit mismatch for ${s.folderName}`),{tags:{operation:"codegen-initialize-session",folderName:s.folderName},extra:{sessionId:e.sessionId,targetCommit:a,currentCommitHash:A,lastTurn:n}})}}if(e.beforeCommit)for(let s of this.gitRepoContexts){let o=this.gitRepoContexts[0]?.folderName,a=Du(e.beforeCommit,s.folderName,o);if(a)try{await this.git(["rev-parse","--quiet","--verify",a],{cwd:s.path})}catch(A){this.#e.Sentry?.captureException(new Error(`Init: Before commit not found for ${s.folderName}`,{cause:A}),{tags:{operation:"codegen-initialize-session",folderName:s.folderName},extra:{sessionId:e.sessionId,beforeCommit:a,turnStates:e.turns.length,lastCompletionId:uA(e.turns)?.completionId}})}}}async#er(e,r,n){let i;try{i=(await this.git(["remote","get-url","origin"],r)).trim()}catch{}let{url:s,token:o,provider:a}=e;try{new URL(s)}catch{throw this.#e.Sentry?.captureException(new Error("Provided remote url is invalid"),{tags:{operation:"codegen-git"},extra:{url:s,currentOriginUrl:i}}),new Error("Provided remote url is invalid")}if(i!==s&&(this.#De={},i?await this.git(["remote","set-url","origin",s],r):await this.git(["remote","add","origin",s],r),(a==="github"||a==="selfHostedGithub")&&o)){(!n||n===this.gitEnabledFolders[0]?.name)&&(process.env.GH_TOKEN=o);let c=this.gitEnabledFolders.length>1;n&&c&&(process.env[Kb(n)]=o)}}async pushRepoV2(e){return await this.#K(this.#Ne({pullFirst:!1,updateRepo:e,refreshRemote:!0}),"pushRepoV2",!0)}async ensureGitAuth(){return this.#C?this.#ut():{success:!0,message:"Git is not enabled, skipping auth"}}async#ut({force:e}={}){if(!this.#C)return{success:!0,message:"Git is not enabled"};let n=Date.now()-this.#wt,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.#tr().then(s=>(s.success&&(this.#wt=Date.now()),s)).finally(()=>{this.#ce=null}),this.#ce}async#tr(){let e;try{let r=this.gitEnabledFolders;if(r.length===0)throw new Error("No git-enabled repos found");let n=r.filter(s=>!s.initializationCommand&&!s.repoUrl?.startsWith("ssh://"));if(n.length===0)return{success:!0,message:"Git remote URLs update not needed"};if(!this.#I)throw new Error("Project ID is required to update git URLs");let i=await of(this.#o,this.#I,this.#a);if(!i.success)throw i.error;e=i.gitConfigs;for(let s of n){if(!s.repoName)continue;let o=e?.[s.repoName];if(o?.url){let a=this.#e.resolve(this.#m,s.path);await this.#er(o,a,s.name)}}return{success:!0,message:"Git remote URLs updated"}}catch(r){let n=`Failed to update git remote URLs: ${Jg(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.#I,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}: ${ho(e)}`);let{resolvedPath:r}=this.resolveWorkspacePath(e,!1),n=Date.now(),i=Math.random().toString(36).substring(2,8),s=`zip-${n}-${i}.zip`,o="/tmp",a=this.#e.join(o,s);return $u.default.mkdirSync(o,{recursive:!0}),await ea("zip",["-r",a,".","-x","**/node_modules/**"],{cwd:r,sys:this.#e}),a}async archiveProject(){if(!this.#C)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",s=this.#e.join(i,n);return $u.default.mkdirSync(i,{recursive:!0}),await this.git(["archive","--format=zip","-o",s,"HEAD"]),s}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.#C||!this.#I||!this.#y)return!1;for(let e of this.#d){let r=e.originalRepoUrl??e.repoUrl;if(!r)continue;let n=await this.getCurrentCommitHash("HEAD",e.path);if(!n)continue;let i=ZC({version:"v2",originalRepoUrl:r,commitHash:n});if(this.#De[e.folderName]!==i)return!0}return!1}async uploadBackup(e=!1){try{await this.waitUntilBlockingPendingPromises(),await this.#ne(!1);let r=this.#I,n=this.#y;if(!this.#C)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(),s=this.getFeatureBranch(),o=await this.#G();await r0(this.#e,this.#o,{commits:o,projectId:r,branchName:n},this.#a);let a=performance.now(),A=[];for(let l of this.#d){let d=l.originalRepoUrl??l.repoUrl;if(!d)continue;let g=await this.#Mt(()=>e0({sys:this.#e,credentials:this.#o,projectId:r,branchName:n,repoPath:l.path,aiBranch:i,featureBranch:l.branchName||s,workspace:this.#E,debug:this.#a,isConnectedToProvider:!0,forcedFullBackup:e,canAbortMerge:this.#Ge,folderName:l.folderName,repoUrl:d}));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 t0(this.#o,c,u,this.#a);for(let{result:l,folderName:d}of A)l.backupRef&&(this.#De[d]=l.backupRef);return A[0].result}catch(r){if(this.#r.error("Failed to upload backup",r),this.#De={},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"}#fe(e){return this.getCommitMode()==="commits"?`${e?.branchName||this.getFeatureBranch()}`:`${this.getAiBranch()}`}async#Rt(e,r){let n=this.getCommitMode(),i=this.#fe(r),s=await this.getCurrentBranch(r?.path);return n==="commits"?["push","--no-verify","--set-upstream",...e?["-f"]:[],"origin",`${s}:${i}`]:["push","--no-verify","--set-upstream",...e?["-f"]:[],"origin",i]}async pushChanges(e){let r=performance.now(),n=await this.#K(this.#Ne(e),"pushChanges",!0);return this.#O("git_push_changes_total",performance.now()-r,{success:String(n.success!==!1)}),n}async#Ne(e){let{pullFirst:r,updateRepo:n,actor:i,refreshRemote:s,forcePush:o,folderName:a,requireFastForward:A,abortOnMergeConflict:c}=Sle(e);try{if(!this.#C)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 m=this.#E?.folders.find(C=>C.enableGit);m&&(m.repoName=n.repoFullName,m.originalRepoUrl=n.repoUrl)}if(s||n){let m=performance.now(),C=await this.#ut({force:!!s});if(this.#O("git_push_ensure_auth",performance.now()-m),!C.success)throw C.error}let u=a?this.#d.find(m=>m.folderName===a):this.#d[0];if(!u)throw new Error(a?`Folder "${a}" not found in workspace`:"No git repos configured");if(A&&await this.#rr(u),r){let m=performance.now(),C=await this.#nr({requestRefresh:!1,abortOnMergeConflict:c,ctx:u});if(this.#O("git_push_pull_latest",performance.now()-m,{success:String(C.success!==!1)}),!C.success)throw C.error??new Error(C.message)}if((await this.#Z(u.path)).length>0)throw new Error(`Merge conflict detected in ${u.folderName}, please resolve before pushing`);let d=await this.#Rt(o??!1,u),g=performance.now(),p=!0;try{await this.git(d,{cwd:u.path})}catch(m){throw p=!1,m}finally{this.#O("git_push_push",performance.now()-g,{success:String(p)})}await this.#F();let f=await this.#G();return await this.#me({lastCommit:no(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:o,requireFastForward:A,abortOnMergeConflict:c,commitMode:this.getCommitMode(),updateRepo:n,refreshRemote:s}});let l=Jg(u);return{success:!1,message:l,error:u instanceof Error?u:new Error(l)}}}async#rr(e){let r=this.#fe(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#nr(e){if(e?.abortOnMergeConflict){let n=e.ctx?[e.ctx]:this.#d;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 s=this.#fe(i),o=performance.now();await this.git(["fetch","origin",s],{cwd:i.path}),this.#O("git_push_fetch",performance.now()-o,{folder:i.folderName,mode:"abort-on-conflict"});let a=performance.now(),A=!0;try{await this.git(["merge",`origin/${s}`],{cwd:i.path})}catch(c){if(A=!1,(await this.#Z(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.#O("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 s=Jg(i);return{success:!1,message:s,error:i instanceof Error?i:new Error(s)}}}return await this.#K(this.#Nt({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.#q(async n=>{try{return await this.git(["merge","--abort"],{cwd:n.path}),!0}catch{return!1}});return this.#at=void 0,e&&r.results.some(n=>n.result===!0)&&(await this.#F(),await this.#Ce(),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.#F();let n=Jg(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.#Nt({branches:r,allowUnrelatedHistory:e?.allowUnrelatedHistory??!0,canPush:e?.canPush??!1,uncommittedChanges:e?.uncommittedChanges??"commit",requestRefresh:e?.requestRefresh,fastForward:e?.fastForward??"auto"}),"syncChangesFromRemote",!0)}async#Z(e){try{return(await this.git(["--no-pager","diff","--name-only","--diff-filter=U"],{cwd:e})).trim().split(`
|
|
1891
|
-
`).filter(i=>i.length>0)}catch{return[]}}async#lt(){return(await this.#q(async r=>{let n=await this.#Z(r.path);return this.#T()?n:n.map(i=>this.#e.join(r.path,i))})).results.flatMap(r=>r.success?r.result??[]:[])}async#
|
|
1892
|
-
`).map(i=>i.trim().slice(0,400)).filter(i=>i.length>0).slice(0,20);try{let n=this.#R||"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#
|
|
1890
|
+
`)}(r==="all"||r==="critical"&&!Q)&&this.queueSystemReminder({text:Yd(D,2e3),tag:n});let P={devServerState:u,setupState:a,httpServerState:f,proxyServer:p,devCommand:c,setupCommand:d,hasMergeConflict:A.length>0,hasConfigurationIssue:Q,logs:E,prompt:"Debug and fix the issue before continuing.",message:w},$=this.#t.length===0&&sXe.includes(o.state);return{actionButtonText:S,type:"build-error",level:x,canAutoApply:$,healthStatus:P,message:P.message,userMessage:{userPrompt:P.prompt,repair:!0,category:v,displayPrompt:P.message}}}}async#zt(){let e=await this.#ct(!1,"critical"),r=!!(e&&!e.healthStatus.hasConfigurationIssue);return r&&this.#f?.addCheckpoint(),{hasHealthIssue:r}}async#Xt(){let e;if(this.#C)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.#Bt){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 Mw({sys:this.#e,gitWorkingDirectory:this.primaryGitPath,strict:!0})}catch(r){q.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#Zt(e,r){try{await this.git(["checkout",e],{cwd:r})}catch{await this.git(["checkout","-b",e],{cwd:r})}}async#er(e){if(!this.#C)return;if(!this.#P){let s=Sie(this.getFeatureBranch(),e.sessionId);this.#P=s}let r=this.getAiBranch();await this.#q(async s=>{await this.getCurrentBranch(s.path)!==r&&await this.#Zt(r,s.path);try{await this.git(["branch","--set-upstream-to",`refs/remotes/origin/${this.#fe(s)}`],{cwd:s.path})}catch{}});let n=uA(e.turns),i=n?.afterCommit??n?.lastCommit;if(i)for(let s of this.gitRepoContexts){let o=this.gitRepoContexts[0]?.folderName,a=Du(i,s.folderName,o);if(a){let A=await this.getCurrentCommitHash("HEAD",s.path);A&&A!==a&&this.#e.Sentry?.captureException(new Error(`Init: After commit mismatch for ${s.folderName}`),{tags:{operation:"codegen-initialize-session",folderName:s.folderName},extra:{sessionId:e.sessionId,targetCommit:a,currentCommitHash:A,lastTurn:n}})}}if(e.beforeCommit)for(let s of this.gitRepoContexts){let o=this.gitRepoContexts[0]?.folderName,a=Du(e.beforeCommit,s.folderName,o);if(a)try{await this.git(["rev-parse","--quiet","--verify",a],{cwd:s.path})}catch(A){this.#e.Sentry?.captureException(new Error(`Init: Before commit not found for ${s.folderName}`,{cause:A}),{tags:{operation:"codegen-initialize-session",folderName:s.folderName},extra:{sessionId:e.sessionId,beforeCommit:a,turnStates:e.turns.length,lastCompletionId:uA(e.turns)?.completionId}})}}}async#tr(e,r,n){let i;try{i=(await this.git(["remote","get-url","origin"],r)).trim()}catch{}let{url:s,token:o,provider:a}=e;try{new URL(s)}catch{throw this.#e.Sentry?.captureException(new Error("Provided remote url is invalid"),{tags:{operation:"codegen-git"},extra:{url:s,currentOriginUrl:i}}),new Error("Provided remote url is invalid")}if(i!==s&&(this.#De={},i?await this.git(["remote","set-url","origin",s],r):await this.git(["remote","add","origin",s],r),(a==="github"||a==="selfHostedGithub")&&o)){(!n||n===this.gitEnabledFolders[0]?.name)&&(process.env.GH_TOKEN=o);let c=this.gitEnabledFolders.length>1;n&&c&&(process.env[Kb(n)]=o)}}async pushRepoV2(e){return await this.#K(this.#Ne({pullFirst:!1,updateRepo:e,refreshRemote:!0}),"pushRepoV2",!0)}async ensureGitAuth(){return this.#C?this.#ut():{success:!0,message:"Git is not enabled, skipping auth"}}async#ut({force:e}={}){if(!this.#C)return{success:!0,message:"Git is not enabled"};let n=Date.now()-this.#wt,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.#rr().then(s=>(s.success&&(this.#wt=Date.now()),s)).finally(()=>{this.#ce=null}),this.#ce}async#rr(){let e;try{let r=this.gitEnabledFolders;if(r.length===0)throw new Error("No git-enabled repos found");let n=r.filter(s=>!s.initializationCommand&&!s.repoUrl?.startsWith("ssh://"));if(n.length===0)return{success:!0,message:"Git remote URLs update not needed"};if(!this.#I)throw new Error("Project ID is required to update git URLs");let i=await of(this.#o,this.#I,this.#a);if(!i.success)throw i.error;e=i.gitConfigs;for(let s of n){if(!s.repoName)continue;let o=e?.[s.repoName];if(o?.url){let a=this.#e.resolve(this.#m,s.path);await this.#tr(o,a,s.name)}}return{success:!0,message:"Git remote URLs updated"}}catch(r){let n=`Failed to update git remote URLs: ${Jg(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.#I,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}: ${ho(e)}`);let{resolvedPath:r}=this.resolveWorkspacePath(e,!1),n=Date.now(),i=Math.random().toString(36).substring(2,8),s=`zip-${n}-${i}.zip`,o="/tmp",a=this.#e.join(o,s);return $u.default.mkdirSync(o,{recursive:!0}),await ea("zip",["-r",a,".","-x","**/node_modules/**"],{cwd:r,sys:this.#e}),a}async archiveProject(){if(!this.#C)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",s=this.#e.join(i,n);return $u.default.mkdirSync(i,{recursive:!0}),await this.git(["archive","--format=zip","-o",s,"HEAD"]),s}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.#C||!this.#I||!this.#y)return!1;for(let e of this.#d){let r=e.originalRepoUrl??e.repoUrl;if(!r)continue;let n=await this.getCurrentCommitHash("HEAD",e.path);if(!n)continue;let i=ZC({version:"v2",originalRepoUrl:r,commitHash:n});if(this.#De[e.folderName]!==i)return!0}return!1}async uploadBackup(e=!1){try{await this.waitUntilBlockingPendingPromises(),await this.#ne(!1);let r=this.#I,n=this.#y;if(!this.#C)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(),s=this.getFeatureBranch(),o=await this.#G();await r0(this.#e,this.#o,{commits:o,projectId:r,branchName:n},this.#a);let a=performance.now(),A=[];for(let l of this.#d){let d=l.originalRepoUrl??l.repoUrl;if(!d)continue;let g=await this.#Pt(()=>e0({sys:this.#e,credentials:this.#o,projectId:r,branchName:n,repoPath:l.path,aiBranch:i,featureBranch:l.branchName||s,workspace:this.#E,debug:this.#a,isConnectedToProvider:!0,forcedFullBackup:e,canAbortMerge:this.#Ge,folderName:l.folderName,repoUrl:d}));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 t0(this.#o,c,u,this.#a);for(let{result:l,folderName:d}of A)l.backupRef&&(this.#De[d]=l.backupRef);return A[0].result}catch(r){if(this.#r.error("Failed to upload backup",r),this.#De={},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"}#fe(e){return this.getCommitMode()==="commits"?`${e?.branchName||this.getFeatureBranch()}`:`${this.getAiBranch()}`}async#Nt(e,r){let n=this.getCommitMode(),i=this.#fe(r),s=await this.getCurrentBranch(r?.path);return n==="commits"?["push","--no-verify","--set-upstream",...e?["-f"]:[],"origin",`${s}:${i}`]:["push","--no-verify","--set-upstream",...e?["-f"]:[],"origin",i]}async pushChanges(e){let r=performance.now(),n=await this.#K(this.#Ne(e),"pushChanges",!0);return this.#O("git_push_changes_total",performance.now()-r,{success:String(n.success!==!1)}),n}async#Ne(e){let{pullFirst:r,updateRepo:n,actor:i,refreshRemote:s,forcePush:o,folderName:a,requireFastForward:A,abortOnMergeConflict:c}=Sle(e);try{if(!this.#C)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 m=this.#E?.folders.find(C=>C.enableGit);m&&(m.repoName=n.repoFullName,m.originalRepoUrl=n.repoUrl)}if(s||n){let m=performance.now(),C=await this.#ut({force:!!s});if(this.#O("git_push_ensure_auth",performance.now()-m),!C.success)throw C.error}let u=a?this.#d.find(m=>m.folderName===a):this.#d[0];if(!u)throw new Error(a?`Folder "${a}" not found in workspace`:"No git repos configured");if(A&&await this.#nr(u),r){let m=performance.now(),C=await this.#ir({requestRefresh:!1,abortOnMergeConflict:c,ctx:u});if(this.#O("git_push_pull_latest",performance.now()-m,{success:String(C.success!==!1)}),!C.success)throw C.error??new Error(C.message)}if((await this.#Z(u.path)).length>0)throw new Error(`Merge conflict detected in ${u.folderName}, please resolve before pushing`);let d=await this.#Nt(o??!1,u),g=performance.now(),p=!0;try{await this.git(d,{cwd:u.path})}catch(m){throw p=!1,m}finally{this.#O("git_push_push",performance.now()-g,{success:String(p)})}await this.#F();let f=await this.#G();return await this.#me({lastCommit:no(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:o,requireFastForward:A,abortOnMergeConflict:c,commitMode:this.getCommitMode(),updateRepo:n,refreshRemote:s}});let l=Jg(u);return{success:!1,message:l,error:u instanceof Error?u:new Error(l)}}}async#nr(e){let r=this.#fe(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#ir(e){if(e?.abortOnMergeConflict){let n=e.ctx?[e.ctx]:this.#d;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 s=this.#fe(i),o=performance.now();await this.git(["fetch","origin",s],{cwd:i.path}),this.#O("git_push_fetch",performance.now()-o,{folder:i.folderName,mode:"abort-on-conflict"});let a=performance.now(),A=!0;try{await this.git(["merge",`origin/${s}`],{cwd:i.path})}catch(c){if(A=!1,(await this.#Z(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.#O("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 s=Jg(i);return{success:!1,message:s,error:i instanceof Error?i:new Error(s)}}}return await this.#K(this.#Tt({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.#q(async n=>{try{return await this.git(["merge","--abort"],{cwd:n.path}),!0}catch{return!1}});return this.#at=void 0,e&&r.results.some(n=>n.result===!0)&&(await this.#F(),await this.#Ce(),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.#F();let n=Jg(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.#Tt({branches:r,allowUnrelatedHistory:e?.allowUnrelatedHistory??!0,canPush:e?.canPush??!1,uncommittedChanges:e?.uncommittedChanges??"commit",requestRefresh:e?.requestRefresh,fastForward:e?.fastForward??"auto"}),"syncChangesFromRemote",!0)}async#Z(e){try{return(await this.git(["--no-pager","diff","--name-only","--diff-filter=U"],{cwd:e})).trim().split(`
|
|
1891
|
+
`).filter(i=>i.length>0)}catch{return[]}}async#lt(){return(await this.#q(async r=>{let n=await this.#Z(r.path);return this.#T()?n:n.map(i=>this.#e.join(r.path,i))})).results.flatMap(r=>r.success?r.result??[]:[])}async#sr(e){let r=n=>n.split(`
|
|
1892
|
+
`).map(i=>i.trim().slice(0,400)).filter(i=>i.length>0).slice(0,20);try{let n=this.#R||"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#Tt({branches:e,allowUnrelatedHistory:r,canPush:n,fastForward:i,uncommittedChanges:s,requestRefresh:o=!1,syncRemoteBranch:a=!1}){try{if(!this.#C)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.#O("git_sync_commit_accumulated",performance.now()-l);let g=(await this.#q(async p=>{let f=p.path,m;a?m=[this.#fe(p)]:m=e.map(D=>D===c?p.branchName:D);let C=await this.getCurrentBranch(f);if(C!==A)throw new Error(`Repo ${p.folderName} not on AI branch: ${C} != ${A}`);let I=await this.#Z(f);if(I.length>0)throw new Error(`Merge conflict in ${p.folderName}:
|
|
1893
1893
|
${I.join(`
|
|
1894
1894
|
`)}`);let B=!1;if(!await this.#ht(f))switch(s){case"stash":await this.git(["stash","--include-untracked"],{cwd:f}),B=!0;break;case"commit":await this.git(["add","-A","."],{cwd:f}),await this.git(["commit","--no-verify","--no-gpg-sign","-m","Commit unstaged changes"],{cwd:f});break;default:throw new Error(`Uncommitted changes in ${p.folderName}`)}let y=performance.now();await this.git(["fetch","origin","--prune"],{cwd:f}),this.#O("git_sync_fetch",performance.now()-y,{folder:p.folderName});let Q=await this.git(["for-each-ref","refs/remotes/origin"],{cwd:f}),w=m.filter(D=>Q.includes(`refs/remotes/origin/${D}`));for(let D of w){D!==A&&await this.git(["update-ref",`refs/heads/${D}`,`refs/remotes/origin/${D}`],{cwd:f});try{let x=performance.now(),S=!0,v;try{v=await this.git(["merge",...i==="never"?["--no-ff"]:[],...i==="required"?["--ff-only"]:[],...i==="auto"?["--ff"]:[],...r?["--allow-unrelated-histories"]:[],`refs/remotes/origin/${D}`],{cwd:f})}catch(M){throw S=!1,M}finally{this.#O("git_sync_merge",performance.now()-x,{folder:p.folderName,branch:D,success:String(S)})}let P=D===p.branchName,$=v?.includes("Already up to date"),H=this.#T()?"":`[${p.folderName}] `;$||u.push(`${H}Successfully merged branch "${D}" into ${A}${P?" (this was the main/feature branch \u2014 its changes are now in your working branch)":" (AI branch synced with remote)"}.`)}catch(x){let S=D===p.branchName,v=this.#T()?"":`[${p.folderName}] `;throw this.#at={ourBranch:A,theirBranch:D,theirIsMain:S},x instanceof mo&&u.push(`${v}The user tries to sync git changes, but something failed:
|
|
1895
1895
|
- our branch (ours): ${A} -- this is the AI's working branch
|
|
1896
1896
|
- their branch (theirs): refs/remotes/origin/${D} ${S?" -- this is main/feature branch (work here needs to be preserved)":"-- same branch pushed by remote"}
|
|
1897
|
-
`),x}}if(n){let D=await this.#
|
|
1897
|
+
`),x}}if(n){let D=await this.#Nt(!0,p);await this.git(D,{cwd:p.path})}if(B)try{await this.git(["stash","pop"],{cwd:f})}catch(D){this.#e.Sentry?.captureException(D,{tags:{operation:"codegen-git",endpoint:"syncChanges-stash-pop"}})}})).results.filter(p=>!p.success||p.error);if(g.length>0){let p=g.map(f=>f.error?.message||`${f.folderName} failed`).join("; ");throw new Error(`Sync failed: ${p}`)}if(n){let p=await this.#Ne(!1);if(!p.success)throw p.error}else{await this.#F();let p=await this.#G();this.#N={...this.#N,...p},await this.#me({lastCommit:no(p)})}return u.length>0&&this.queueSystemReminder({text:u.join(`
|
|
1898
1898
|
|
|
1899
|
-
`)}),o&&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.#F();let c=await this.#G();this.#N={...this.#N,...c},this.#e.Sentry?.captureException(A,{tags:{operation:"codegen-git",endpoint:"syncChangesFromBranches"},extra:{branches:e,allowUnrelatedHistory:r}});let u=Jg(A);return{success:!1,message:u,error:A instanceof Error?A:new Error(u)}}}async getCurrentCommitHash(e="HEAD",r){if(this.#C)try{let n=["rev-parse",e];return(await this.git(n,{sys:this.#e,cwd:r})).trim()}catch{return}}async#G(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.#R)throw new Error("Feature branch is missing");return this.#R}getAiBranch(){if(!this.#P)throw new Error("AI branch is missing");return this.#P}async git(e,r){let n=e[0];(n==="push"||n==="fetch"||n==="pull")&&await this.#ut();let s=typeof r=="object"?{sys:this.#e,...r}:r,o=await this.#
|
|
1899
|
+
`)}),o&&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.#F();let c=await this.#G();this.#N={...this.#N,...c},this.#e.Sentry?.captureException(A,{tags:{operation:"codegen-git",endpoint:"syncChangesFromBranches"},extra:{branches:e,allowUnrelatedHistory:r}});let u=Jg(A);return{success:!1,message:u,error:A instanceof Error?A:new Error(u)}}}async getCurrentCommitHash(e="HEAD",r){if(this.#C)try{let n=["rev-parse",e];return(await this.git(n,{sys:this.#e,cwd:r})).trim()}catch{return}}async#G(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.#R)throw new Error("Feature branch is missing");return this.#R}getAiBranch(){if(!this.#P)throw new Error("AI branch is missing");return this.#P}async git(e,r){let n=e[0];(n==="push"||n==="fetch"||n==="pull")&&await this.#ut();let s=typeof r=="object"?{sys:this.#e,...r}:r,o=await this.#Pt(()=>this.#cr(e,s));return this.#ar(n)&&(this.#xe.clear(),this.#Se.clear(),this.#ve.clear()),o}static#or=new Set(["commit","merge","rebase","checkout","switch","pull","fetch","reset","cherry-pick","revert","am","stash","push"]);#ar(e){return!!e&&t.#or.has(e)}async#q(e){if(this.#d.length===0)return{success:!0,partialSuccess:!1,results:[]};let n=(await Promise.allSettled(this.#d.map(o=>e(o)))).map((o,a)=>({folderName:this.#d[a].folderName,success:o.status==="fulfilled",result:o.status==="fulfilled"?o.value:void 0,error:o.status==="rejected"?o.reason:void 0,message:o.status==="rejected"?o.reason?.message:void 0})),i=n.filter(o=>o.success),s=n.filter(o=>!o.success);return{success:s.length===0,partialSuccess:i.length>0&&s.length>0,results:n}}#Mt(e){let r=pn(e),n=this.#d.find(a=>{let A=pn(a.folderName);return r.startsWith(A+"/")||r===A});if(n)return n;let i=e.startsWith("/")||e.includes(":")?e:this.#e.resolve(this.#m,e),s=pn(i);return this.#d.find(a=>{let A=pn(a.path);return s.startsWith(A+"/")||s===A})}#Ar(e){let r=new Map;for(let n of e){let i=this.#Mt(n);if(i){let s=r.get(i.folderName)||[];s.push(n),r.set(i.folderName,s)}}return r}#Pt(e){let r=this.#Et.then(()=>e());return this.#Et=r.catch(()=>{}),r}async#cr(e,r){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,s=typeof r=="string"?r:i?.cwd??this.primaryGitPath;return await ea("git",e,{...i,cwd:s,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.#p=!0):!e&&this.#p&&(delete process.env.DEBUG,this.#p=!1)}async createTerminal(e){let r=this.#f,n=e?.terminalId||`pty_${Date.now()}_${(0,_b.randomUUID)()}`,i=this.#gt().find(B=>B.terminalId===n),s=new Set,o=new Set;if(i&&e?.terminalId){if(!e?.force)return i;let B=this.#b.get(e.terminalId);if(!B)return i;B.onDataListeners.forEach(E=>{s.add(E)}),B.onExitListeners.forEach(E=>{o.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.#o.userId,u.BUILDER_PUBLIC_KEY=this.#o.builderPublicKey,u.BUILDER_PRIVATE_KEY=this.#o.builderPrivateKey);let l=[],d=B=>{for(let E of s)E(B)},g=({exitCode:B,error:E})=>{let y=this.#b.get(n);y&&(y.state=E?"error":"exited",y.exitCode=B);for(let Q of o)Q(B);this.#b.delete(n),l.forEach(Q=>Q())},p=e?.cwd||this.#x,f,m;if(e?.readonly){f="starting";let B=!r?.hasSetupEnvVars,E=Wa(a,e?.initialCommand??"true",{cwd:p,env:u,stdio:["ignore","pipe","pipe"]},B);E.on("spawn",()=>{let y=this.#b.get(n);y&&(y.state="running")}),E.stdout.on("data",y=>{d(y.toString())}),E.stderr.on("data",y=>{d(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()}),m=E}else{f="running";let B=lL(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 $ ",Q=B.spawn(a,[],{name:"xterm-color",cwd:p,cols:A,rows:c,env:E?{...u,PS1:y}:u}),w=Q.onData(d);l.push(()=>{try{w?.dispose?.()}catch{}});let D=Q.onExit(g);l.push(()=>{try{D?.dispose?.()}catch{}});let x=e?.initialCommand;x&&(x.endsWith(`
|
|
1900
1900
|
`)||(x+=`
|
|
1901
|
-
`),Q.write(x)),m=Q}let C=Date.now(),I={terminalId:n,title:e?.title||`Terminal ${this.#b.size+1}`,cwd:p,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.#b.set(n,{...I,pty:m,onDataListeners:s,onExitListeners:o,disposeFns:l,env:e?.env,shell:a,inheritCredentials:e?.inheritCredentials}),(e?.emitTerminals??!0)&&this.#he(),I}#gt(){let e=this.getSessionContext(),r=Array.from(this.#b.values()).map(s=>({terminalId:s.terminalId,title:s.title,cwd:s.cwd,createdAt:s.createdAt,lastWrittenAt:s.lastWrittenAt,createdBy:s.createdBy,readonly:s.readonly,builtIn:s.builtIn,exitCode:s.exitCode,state:s.state,stale:s.stale,command:s.command})),n=[];this.#D?.includes("Bash")&&n.push({terminalId:"bash-tools",title:"Bash",cwd:this.#x,createdAt:e.createdUnixTime,lastWrittenAt:Date.now(),createdBy:"fusion",readonly:!0,builtIn:!0,exitCode:void 0,state:"running",command:void 0});let i=this.#f;if(i){let s=Date.now();if(i.devState!=="unset"&&n.push({terminalId:"dev-command",title:"Dev Command",cwd:this.#x,createdAt:e.createdUnixTime,lastWrittenAt:s,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.#x,createdAt:e.createdUnixTime,lastWrittenAt:s,createdBy:"fusion",readonly:!0,builtIn:!0,state:i.setupState==="installing"?"running":"exited",exitCode:void 0,command:i.setupCommand}),i.validateCommandState!=="unset"){let o;switch(i.validateCommandState){case"running":o="running";break;case"success":o="exited";break;case"failure":o="error";break;case"stopped":o="exited";break}n.unshift({terminalId:"validate-command",title:"Validate Command",cwd:this.#x,createdAt:e.createdUnixTime,lastWrittenAt:s,createdBy:"fusion",readonly:!0,builtIn:!0,state:o,exitCode:void 0,command:i.validateCommand})}}return n.push(...r),n}#he(){this.#g.emit("step",{type:"terminals",terminals:this.#gt()})}updateTerminal({terminalId:e,cols:r,rows:n,title:i}){if(e==="dev-command"){if(r||n){let o=this.#f;if(o?.devCommandProcess?.resize)return o.devCommandProcess.resize(r,n),!0}return!1}let s=this.#b.get(e);return s?("resize"in s.pty&&(r||n)&&s.pty.resize(r??s.pty.cols,n??s.pty.rows),i&&(s.title=i,this.#he()),!0):!1}writeTerminal({terminalId:e,data:r}){if(e==="dev-command"){let i=this.#f;return i?.devCommandProcess?.write?(i.devCommandProcess.write(r),!0):!1}let n=this.#b.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.#f;return i?.devCommandProcess?.kill?(i.devCommandProcess.kill(r),!0):!1}let n=this.#b.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.#b.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.#b.delete(e),r&&this.#he(),!0}async restartTerminal({terminalId:e}){if(e==="dev-command"){let i=this.#f;if(i)try{return await i.restart(),!0}catch(s){return this.#e.Sentry?.captureException(s),!1}return!1}if(e==="setup-command"){let i=this.#f;if(i)try{return await i.runSetupCommand(),!0}catch(s){return this.#e.Sentry?.captureException(s),!1}return!1}if(e==="validate-command"){if(this.#f)try{return await this.#
|
|
1902
|
-
`),B=[],E=null;for(let Q of I)if(Q.trim())try{let w=JSON.parse(Q);if(w.type==="match"){let D=w.data.path.text,x=w.data.line_number,S=w.data.lines.text.trimEnd(),v=w.data.submatches||[],P,$;v.length>0&&(P=v[0].start,$=v[0].end),m.add(D);let H={filePath:D,lineNumber:x,lineContent:S,columnStart:P,columnEnd:$,contextBefore:B,contextAfter:[]};if(B=[],E=H,f.push(H),f.length>=o)break}else if(w.type==="context"){let D=w.data.line_number,x=w.data.lines.text.trimEnd();E&&D>E.lineNumber?E.contextAfter.push(x):B.push(x)}}catch{continue}let y=f.length>=o;l({matches:f,totalMatches:f.length,filesWithMatches:m.size,truncated:y})}})})}#Pt(e){let r=this.#pe.indexOf(e);r!==-1&&this.#pe.splice(r,1),this.#pe.unshift(e),this.#pe.length>50&&(this.#pe.length=50)}async#cr(){let e=this.#Fe;if(e&&Date.now()-e.timestamp<t.#Ve)return e.promise;let r=this.#u?.accessControl,n=bu({basePath:this.#x,extraIgnorePatterns:Iw(r).deny,gitignore:!0,dot:!0,sys:this.#e}).then(i=>jd({files:i,policy:r,getDotFiles:!0}));return this.#Fe={promise:n,timestamp:Date.now(),fuse:null},n}async#ur(){let e=this.#Fe;if(e?.fuse)return e.fuse;let r=await this.#cr(),n=new rc(r,{includeScore:!0,includeMatches:!0,threshold:.3,ignoreLocation:!0,minMatchCharLength:1});return this.#Fe&&(this.#Fe.fuse=n),n}async searchFileTree(e){let{query:r,maxResults:n=100}=e;if(!r){let A=this.#pe.slice(0,n).map(c=>{let u=c.lastIndexOf("/");return{filePath:c,fileName:u>=0?c.slice(u+1):c,parentPath:u>=0?c.slice(0,u):"",matchIndices:[]}});return{matches:A,totalMatches:A.length,truncated:!1}}let s=(await this.#ur()).search(r,{limit:n});return{matches:s.map(a=>{let A=a.item,c=A.lastIndexOf("/"),u=c>=0?A.slice(c+1):A,l=c>=0?A.slice(0,c):"",d=a.matches?.[0]?.indices??[],g=[];for(let[p,f]of d)for(let m=p;m<=f;m++)g.push(m);return{filePath:A,fileName:u,parentPath:l,matchIndices:g}}),totalMatches:s.length,truncated:s.length>=n}}async collectRepoMetrics(e={}){let r=this.#ke(e.folderName);return e.rootPath&&(r=this.#e.join(r,e.rootPath)),Fse(this.#e,r)}getSessionId(){return this.getSessionContext().sessionId}updateMetadata(e){this.#pt(e,!1)}getMetadata(){return this.#U}#ze=null;setTimeline(e){this.#ze=e}getTimeline(){return this.#ze}getSpaceId(){return this.#o.builderPublicKey}async revertToCommitSnapshot(e){await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let n=(await this.#q(async s=>{let o=Du(e,s.folderName,this.gitRepoContexts[0]?.folderName);return o?(await this.git(["revert","--no-commit",`${o}..HEAD`],{cwd:s.path}),await this.git(["commit","--allow-empty","--quiet","--no-verify","--no-gpg-sign","-m","Revert changes"],{cwd:s.path}),{commitHash:await this.getCurrentCommitHash("HEAD",s.path)}):(this.#r.warn(`No commit found for ${s.folderName}, skipping revert`),{skipped:!0})})).results.filter(s=>!s.success);if(n.length>0)throw new Error(`Failed to revert ${n.length} repos`);let i=await this.#G();this.#N={...this.#N,...i},await this.#F(),this.requestRefresh(),await this.#me({lastCommit:no(i)})}async revertToCommitHash(e){let r=sf(e,this.gitRepoContexts[0]?.folderName),n=Object.keys(r).length===0?e:no(r);return this.revertToCommitSnapshot(n)}async resetToCommitSnapshot(e,r=!0){await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let i=(await this.#q(async o=>{let a=Du(e,o.folderName,this.gitRepoContexts[0]?.folderName);if(!a)return this.#r.warn(`No commit found for ${o.folderName}, skipping reset`),{skipped:!0};await this.git(["reset","--quiet","--hard",a],{cwd:o.path}),await this.git(["clean","-fd"],{cwd:o.path});let A=await this.getCurrentCommitHash("HEAD",o.path);if(A!==a)throw new Error(`Failed to reset commit hash for ${o.folderName}: expected ${a}, got ${A}`);return{commitHash:A}})).results.filter(o=>!o.success);if(i.length>0)throw new Error(`Failed to reset ${i.length} repos`);let s=sf(e,this.gitRepoContexts[0]?.folderName);this.#N={...this.#N,...s},await this.#F(),r&&this.requestRefresh()}async resetToCommitHash(e,r=!0){let n=sf(e,this.gitRepoContexts[0]?.folderName),i=Object.keys(n).length===0?e:no(n);return this.resetToCommitSnapshot(i,r)}async restore({location:e,predicate:r,revert:n=!1,dryRun:i=!1,forceReplay:s=!1,debug:o}){let a=this.getSessionContext(),A=a.turns.length,c=null;for(let p=A-1;p>=-1;p--)if(r(p>=0?a.turns[p]:null,p)){c=p;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.#C,d=a.turns,g=Math.max(0,e==="before"?c:c+1);for(let p=d.length-1;p>=g;p--){let f=d[p];for(let m of f.applyResults)u.set(m.filePath,m.oldContent??"")}if(!i){let p;if(l){c===-1?a.beforeCommit?p=a.beforeCommit:d.length>0&&(p=d[0].beforeCommit):c<d.length&&(e==="after"?(p=d[c].afterCommit,!p&&c+1<d.length&&(p=d[c+1].beforeCommit)):p=d[c].beforeCommit);let I={commitSnapshot:p,sessionId:a.sessionId,sessionBeforeCommit:a.beforeCommit,turnsLength:d.length,targetIndex:c,currentTurn:d[d.length-1],targetTurn:d[c],targetTurnNext:d[c+1],location:e,forceReplay:s,dryRun:i,debug:o};if(!p)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(p):await this.resetToCommitSnapshot(p)}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=d.splice(g,d.length-g),m=uA(d);m&&m?.afterCommit!==p&&(this.#e.Sentry?.captureException(new Error("Reset After commit snapshot mismatch"),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},extra:{lastTurn:m,commitSnapshot:p}}),m.lastCommit=p,await this.#me({completionId:m.completionId,lastCommit:p}));let C=m?.completionId;if(f.length>0&&(await VG(this.#e,this.#o,{lastCompletionId:C,sessionId:a.sessionId},!!this.#a),a.updatedUnixTime=Date.now()),s){let I=a.state;this.#g.emit("step",{type:"batch",steps:[{type:"state",newState:"replay",abortable:!1,previousState:I},...this.#Gt(),{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.#Lt(),{undone:Array.from(u.keys()),message:"The restore operation was successful"}}async#Lt(e){return await this.#f?.ensureDevCommand(e)}async restoreFromCompletionId({location:e,completionId:r,forceReplay:n}){let i=this.getSessionContext();return i.turns.find(o=>o.completionId===r)?this.restore({location:e,predicate:o=>o?.completionId===r,forceReplay:n,debug:`restore to: ${r}`}):(await this.#Ee,i.turns=[],i.canLoadMore=!0,await VG(this.#e,this.#o,{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 dle(e)?.completionId}getLastCompletionId(){let e=this.getSessionContext();return qG(e)?.completionId}getCurrentState(){return this.getSessionContext().state}getLastApplyResultsTurn(){let e=this.getSessionContext();return fle(e)}getLastTurn(){let e=this.getSessionContext();return qG(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"})}kt("quality code feedback given",{spaceId:this.#o.builderPublicKey,sentiment:e.feedbackSentiment,mode:"cli"});let r=e.id??this.getLastCompletionId();r&&await this.#gr({...e,id:r})}#me(e){let r=e.completionId;if(!r){let i=this.getLastTurn();i&&e.lastCommit&&(i.lastCommit=e.lastCommit),r=i?.completionId}let n=$G(this.#e,this.#o,"/codegen/finalize",{completionId:r,projectId:this.#u?.projectId,branchName:this.#u?.branchName,userCompletionId:this.getLastUserCompletionId(),sessionId:this.getSessionId(),metadata:this.#U,hasPlanToApply:this.#de,...e},this.#a);return this.#vt&&this.#lr(),this.#K(n,"completionFinalize")}#lr(){try{let e=this.#e.getCwdDir(),r=this.getSessionId();if(this.#ot){_L(this.#e,e,r).catch(()=>{});return}let n=Xw(this.#e,e).then(i=>{if(i.some(l=>l.sessionId===r)){this.#ot=!0,_L(this.#e,e,r).catch(()=>{});return}let s=this.getSessionContext().turns,o=s[s.length-1],a=o?.title,A=a&&a!=="Untitled"&&!a.startsWith("completionId:"),c=o?.userMessage?.displayPrompt??o?.userMessage?.userPrompt??"",u=A?a:hse(c);return fse(this.#e,e,r,u).then(()=>{this.#ot=!0})}).catch(()=>{});this.#K(n,"saveLocalHistory")}catch{}}#gr(e){let r=$G(this.#e,this.#o,"/codegen/feedback",e,this.#a);return this.#K(r,"completionFeedback")}#O(e,r,n={}){this.#f?.emitter.emit("metrics",{durations:[{key:e,ms:r,attributes:n}]})}#K(e,r,n=!1){let i=ca();this.#r.debug(`(addToPendingPromises-${i}): adding ${r} (blocking: ${n})`),this.#le.push(e),n&&this.#He.push(e);let s=new Error(`Deadlock detected in codegen (function: ${r})`),o=setTimeout(()=>{this.#e.Sentry?.captureException(s,{level:"fatal",tags:{operation:"codegen-stream",functionName:r,sessionId:this.getSessionId(),projectId:this.#I,branchName:this.#y}})},300*1e3);return e.finally(()=>{clearTimeout(o),this.#r.debug(`(addToPendingPromises-${i}): removing ${r} (blocking: ${n})`);let a=this.#He.indexOf(e);a!==-1&&this.#He.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}#$(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 s,o=a=>{a.type==="state"&&a.newState===e&&(clearTimeout(s),this.#g.removeListener("step",o),n())};s=setTimeout(()=>{this.#g.removeListener("step",o),n()},r),this.#g.on("step",o)})}getProxyConfig(){return qre({devServerUrl:this.#u?.serverUrl,proxyOrigin:this.#Oe,proxyDefaultOrigin:this.#Ke,proxyDestination:this.#bt})}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.#Re(),e.customAgents=await this.#We(),this.#Y.length=0,this.#U={},this.#ee=void 0,this.#Pe=!1,this.#je=0,this.clearMessageQueue(!1),this.queueGitStatusReminder({trigger:"session-start"}),this.#g.emit("step",this.#Ut())}async clearMessageQueue(e=!1){let r=[],n=this.getSessionMode();if(e)for(let i of this.#t)i.user&&r.push({type:"user",previousId:this.getLastCompletionId(),displayPrompt:i.displayPrompt,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.idempotencyKey,sessionMode:i.sessionMode??n});this.#t.length=0,this.#Xe(),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&&xle(this.#t,r,r+e.delta)}this.#Xe()}async flushMessageQueue(){this.#r.debug("(flushMessageQueue): flushing message queue"),await this.abort({cleanCurrentMessage:!1,flushMessageQueue:!0}),this.#s&&this.#s()}#_t(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,_b.randomUUID)();if(e.queue==null&&(e.queue=!0),e.user?e.user={...this.#ee,...e.user}:e.user=this.#ee,e.userPrompt==="___BROWSER_AUTOMATION_PROMPT___"){let n=this.getProxyConfig();e.userPrompt=mse(n.proxyDefaultOrigin,this.#we||void 0)}return this.#t.push(e),!0}async sendMessage(e){this.#Pe=!1;let r=0;if(Array.isArray(e))for(let i of e)this.#_t(i)&&r++;else this.#_t(e)&&r++;if(r===0)return null;this.#r.debug(`(sendMessage): added messages(${r}) to queue(${this.#t.length})`),this.#Xe();let n=this.#t[this.#t.length-1];return n?(this.cancelAllPendingToolFulfilments(n.userPrompt),n.queue?this.#s&&this.#s():await this.flushMessageQueue(),await Qu(),n.idempotencyKey):null}#pr(){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=WG(e),this.#ee=this.#i.user,this.#i.softContextWindow&&(this.#S=Math.min(this.#S??3e4,this.#i.softContextWindow)),this.clearMessageQueue(!0),this.#i}}#dr(){let e=this.#t.length===0||this.#Pe,r=new Promise(n=>{e?this.#s=n:n()}).then(()=>{let n=this.#t;if(n.length!==0)if(this.#A==="until-idle"){let i=this.#t.shift();if(i.user&&!i.forceCompact){this.#ee=i.user;let s=this.getSessionMode();this.#g.emit("step",{type:"user",previousId:this.getLastCompletionId(),displayPrompt:i.displayPrompt,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.idempotencyKey,sessionMode:i.sessionMode??s})}if(i.systemReminders)for(let s of i.systemReminders)this.queueSystemReminder(s);return this.#i=i,this.#ee=i.user,this.#i.softContextWindow&&(this.#S=Math.min(this.#S??3e4,this.#i.softContextWindow)),this.#Xe(),i}else{for(let s of n)if(s.systemReminders)for(let o of s.systemReminders)this.queueSystemReminder(o);let i=WG(n);if(!i.dropAbortedPrompt&&this.#i){let s=i.idempotencyKey;i=nO(this.#i,i),i.idempotencyKey=s}return this.clearMessageQueue(!0),this.#i=i,this.#ee=i.user,i}});return{shouldWait:e,promise:r}}#Xe(){this.#g.emit("step",{type:"message-queue",queue:this.#t.map(e=>({idempotencyKey:e.idempotencyKey,displayPrompt:e.displayPrompt,user:e.user}))})}#pt(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.#f;if(!r)return{state:"installed",shouldProceed:!0};if(r.setupState==="installing")try{await ZA(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.#f&&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 s=this.#f;if(s){await s.ensureDevCommand(e);let o=await s.waitUntilServer(e,r,n);return o.ok?{shouldProceed:!0,message:"Dev server is ready.",serverUrl:s.serverUrl?.toString()}:{shouldProceed:!1,message:o.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(),s=i.customAgents,o=e?s.find(Y=>Y.name.toLowerCase()===e.toLowerCase()):void 0,a=o?.name??"explorer",{mcpServers:A=!1,model:c,mode:u="quality-v4-agent",systemPrompt:l,subagent_type:d,includeMemories:g,needDevServer:p,needValidation:f,queueMode:m,asyncSubAgents:C,resetAfterRun:I=!1,reasoning:B,softContextWindow:E,maxTimeoutMs:y}={mcpServers:o?.mcpServers,subagent_type:a,systemPrompt:o?.systemPrompt,softContextWindow:o?.softContextWindow,model:(()=>{let Y=o?.name??a,J=Y?this.#Ae?.[Y]:void 0;if(typeof J=="string")return J;if(Array.isArray(J)&&J.length){let O=Y,U=this.#ge.get(O)??0;return this.#ge.set(O,U+1),J[U%J.length]}if(o?.roundRobinModels?.length){let O=o.name,U=this.#ge.get(O)??0;return this.#ge.set(O,U+1),o.roundRobinModels[U%o.roundRobinModels.length]}return o?.model})(),mode:o?.mode,includeMemories:o?.includeMemories??a==="explorer",needDevServer:o?.needDevServer,needValidation:o?.needValidation,resetAfterRun:o?.resetAfterRun,queueMode:o?.queueMode,asyncSubAgents:o?.asyncSubAgents,reasoning:o?.reasoning??this.#it,maxTimeoutMs:o?.maxTimeoutMs},Q=["Read","Glob","Skill","Grep","WebSearch","SearchMemories"];i.sessionMode==="deep-research"&&Q.push("Bash","WebFetch"),Q=Q.filter(Y=>this.#D?this.#D.includes(Y):!0),Q.push("ExplorationMetadata");let w=Pb(this.#u,o?.tools??Q),D=c===void 0?d==="explorer"?"opa5-mini":void 0:c,x=this.#f;if(p&&n){if(!x)return{success:!1,response:`The ${d} agent can not be used on this session. Do no try again.`};if(x.httpServerState.state==="stopped"||x.httpServerState.state==="connecting"||x.httpServerState.state==="error-fetch")try{if(x.state==="not-installed")throw new Error(`The ${d} agent can not be used until the setupCommand finish successfully. However, the dev server is not installed.`);if(x.state==="install-failed")throw new Error(`The ${d} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it failed.`);if(x.state==="install-aborted")throw new Error(`The ${d} 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 x.ensureDevCommand(n)}catch(J){return{success:!1,response:J instanceof Error?J.message:String(J)}}if(f&&x.validateCommand&&this.#re){let J=await x.runValidateCommand(void 0,n);if(J.status==="failure")return{success:!1,response:`The Agent could not start yet, because the validate command failed:
|
|
1901
|
+
`),Q.write(x)),m=Q}let C=Date.now(),I={terminalId:n,title:e?.title||`Terminal ${this.#b.size+1}`,cwd:p,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.#b.set(n,{...I,pty:m,onDataListeners:s,onExitListeners:o,disposeFns:l,env:e?.env,shell:a,inheritCredentials:e?.inheritCredentials}),(e?.emitTerminals??!0)&&this.#he(),I}#gt(){let e=this.getSessionContext(),r=Array.from(this.#b.values()).map(s=>({terminalId:s.terminalId,title:s.title,cwd:s.cwd,createdAt:s.createdAt,lastWrittenAt:s.lastWrittenAt,createdBy:s.createdBy,readonly:s.readonly,builtIn:s.builtIn,exitCode:s.exitCode,state:s.state,stale:s.stale,command:s.command})),n=[];this.#D?.includes("Bash")&&n.push({terminalId:"bash-tools",title:"Bash",cwd:this.#x,createdAt:e.createdUnixTime,lastWrittenAt:Date.now(),createdBy:"fusion",readonly:!0,builtIn:!0,exitCode:void 0,state:"running",command:void 0});let i=this.#f;if(i){let s=Date.now();if(i.devState!=="unset"&&n.push({terminalId:"dev-command",title:"Dev Command",cwd:this.#x,createdAt:e.createdUnixTime,lastWrittenAt:s,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.#x,createdAt:e.createdUnixTime,lastWrittenAt:s,createdBy:"fusion",readonly:!0,builtIn:!0,state:i.setupState==="installing"?"running":"exited",exitCode:void 0,command:i.setupCommand}),i.validateCommandState!=="unset"){let o;switch(i.validateCommandState){case"running":o="running";break;case"success":o="exited";break;case"failure":o="error";break;case"stopped":o="exited";break}n.unshift({terminalId:"validate-command",title:"Validate Command",cwd:this.#x,createdAt:e.createdUnixTime,lastWrittenAt:s,createdBy:"fusion",readonly:!0,builtIn:!0,state:o,exitCode:void 0,command:i.validateCommand})}}return n.push(...r),n}#he(){this.#g.emit("step",{type:"terminals",terminals:this.#gt()})}updateTerminal({terminalId:e,cols:r,rows:n,title:i}){if(e==="dev-command"){if(r||n){let o=this.#f;if(o?.devCommandProcess?.resize)return o.devCommandProcess.resize(r,n),!0}return!1}let s=this.#b.get(e);return s?("resize"in s.pty&&(r||n)&&s.pty.resize(r??s.pty.cols,n??s.pty.rows),i&&(s.title=i,this.#he()),!0):!1}writeTerminal({terminalId:e,data:r}){if(e==="dev-command"){let i=this.#f;return i?.devCommandProcess?.write?(i.devCommandProcess.write(r),!0):!1}let n=this.#b.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.#f;return i?.devCommandProcess?.kill?(i.devCommandProcess.kill(r),!0):!1}let n=this.#b.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.#b.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.#b.delete(e),r&&this.#he(),!0}async restartTerminal({terminalId:e}){if(e==="dev-command"){let i=this.#f;if(i)try{return await i.restart(),!0}catch(s){return this.#e.Sentry?.captureException(s),!1}return!1}if(e==="setup-command"){let i=this.#f;if(i)try{return await i.runSetupCommand(),!0}catch(s){return this.#e.Sentry?.captureException(s),!1}return!1}if(e==="validate-command"){if(this.#f)try{return await this.#Kt(),!0}catch(s){return this.#e.Sentry?.captureException(s),!1}return!1}if(e==="bash-tools")return!1;let r=this.#b.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.#b.get(e)?(this.#he(),!0):!1):!1}subscribeTerminal({terminalId:e,onData:r,onExit:n}){if(e==="dev-command"){let i=this.#f;if(i){let s=i.getDevWrite();return s&&r(s),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.#f;if(i){let s=i.getSetupOutput();return s&&r(s),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.#f;if(i){let s=i.getValidateOutput();return s&&r(s),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=s=>{s.type==="stdio"&&s.source==="tool-command"&&r(s.content)};return this.#g.on("step",i),()=>{this.#g.off("step",i)}}else{let i=this.#b.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:s,deep:o,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 bu({basePath:this.#m,globPattern:[i??n,...l],extraIgnorePatterns:Iw(u).deny,dot:r,gitignore:s,sys:this.#e,deep:o,onlyFiles:c,maxFiles:A});return D1(f,a)}let d=[],g=await this.#e.readdir(this.#m);for(let f of g)rO(f)&&d.push(f);!d.includes("AGENTS.md")&&this.#E.agentsMD&&d.push("AGENTS.md");for(let f of this.#E.folders){let m=this.#e.resolve(this.#m,f.path),C=await bu({basePath:m,globPattern:[n,...l],dot:r,gitignore:s,sys:this.#e,deep:o,onlyFiles:c,maxFiles:A}),I=this.#T()?".":f.name||this.#e.basename(m);for(let B of C)I!=="."?d.push(this.#e.join(I,B)):d.push(B)}let p=jd({files:d,policy:u,filterPattern:i,getDotFiles:r});return D1(p,a)}async searchFiles(e){let{query:r,caseInsensitive:n=!0,includeGlob:i,excludeGlob:s,maxResults:o=1e3,contextBefore:a=0,contextAfter:A=0}=e,c=await fE(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),s&&u.push("--glob",`!${s}`),u.push("--ignore-file",".builderignore"),u.push("--",r),new Promise(l=>{let d=VA({command:c,args:u,options:{env:process.env,cwd:this.#x,stdio:["ignore","pipe","pipe"]}}),g=new Ei(5e4);d.stdout.on("data",p=>{g.write(p.toString())}),d.on("error",()=>{l({matches:[],totalMatches:0,filesWithMatches:0,truncated:!1})}),d.on("close",p=>{if(p!==0)l({matches:[],totalMatches:0,filesWithMatches:0,truncated:!1});else{let f=[],m=new Set,I=g.getContent().split(`
|
|
1902
|
+
`),B=[],E=null;for(let Q of I)if(Q.trim())try{let w=JSON.parse(Q);if(w.type==="match"){let D=w.data.path.text,x=w.data.line_number,S=w.data.lines.text.trimEnd(),v=w.data.submatches||[],P,$;v.length>0&&(P=v[0].start,$=v[0].end),m.add(D);let H={filePath:D,lineNumber:x,lineContent:S,columnStart:P,columnEnd:$,contextBefore:B,contextAfter:[]};if(B=[],E=H,f.push(H),f.length>=o)break}else if(w.type==="context"){let D=w.data.line_number,x=w.data.lines.text.trimEnd();E&&D>E.lineNumber?E.contextAfter.push(x):B.push(x)}}catch{continue}let y=f.length>=o;l({matches:f,totalMatches:f.length,filesWithMatches:m.size,truncated:y})}})})}#Lt(e){let r=this.#pe.indexOf(e);r!==-1&&this.#pe.splice(r,1),this.#pe.unshift(e),this.#pe.length>50&&(this.#pe.length=50)}async#ur(){let e=this.#Fe;if(e&&Date.now()-e.timestamp<t.#Ve)return e.promise;let r=this.#u?.accessControl,n=bu({basePath:this.#x,extraIgnorePatterns:Iw(r).deny,gitignore:!0,dot:!0,sys:this.#e}).then(i=>jd({files:i,policy:r,getDotFiles:!0}));return this.#Fe={promise:n,timestamp:Date.now(),fuse:null},n}async#lr(){let e=this.#Fe;if(e?.fuse)return e.fuse;let r=await this.#ur(),n=new rc(r,{includeScore:!0,includeMatches:!0,threshold:.3,ignoreLocation:!0,minMatchCharLength:1});return this.#Fe&&(this.#Fe.fuse=n),n}async searchFileTree(e){let{query:r,maxResults:n=100}=e;if(!r){let A=this.#pe.slice(0,n).map(c=>{let u=c.lastIndexOf("/");return{filePath:c,fileName:u>=0?c.slice(u+1):c,parentPath:u>=0?c.slice(0,u):"",matchIndices:[]}});return{matches:A,totalMatches:A.length,truncated:!1}}let s=(await this.#lr()).search(r,{limit:n});return{matches:s.map(a=>{let A=a.item,c=A.lastIndexOf("/"),u=c>=0?A.slice(c+1):A,l=c>=0?A.slice(0,c):"",d=a.matches?.[0]?.indices??[],g=[];for(let[p,f]of d)for(let m=p;m<=f;m++)g.push(m);return{filePath:A,fileName:u,parentPath:l,matchIndices:g}}),totalMatches:s.length,truncated:s.length>=n}}async collectRepoMetrics(e={}){let r=this.#ke(e.folderName);return e.rootPath&&(r=this.#e.join(r,e.rootPath)),Fse(this.#e,r)}getSessionId(){return this.getSessionContext().sessionId}getMainSessionId(){return this.#xt??this.getSessionId()}updateMetadata(e){this.#pt(e,!1)}getMetadata(){return this.#U}#ze=null;setTimeline(e){this.#ze=e}getTimeline(){return this.#ze}getSpaceId(){return this.#o.builderPublicKey}async revertToCommitSnapshot(e){await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let n=(await this.#q(async s=>{let o=Du(e,s.folderName,this.gitRepoContexts[0]?.folderName);return o?(await this.git(["revert","--no-commit",`${o}..HEAD`],{cwd:s.path}),await this.git(["commit","--allow-empty","--quiet","--no-verify","--no-gpg-sign","-m","Revert changes"],{cwd:s.path}),{commitHash:await this.getCurrentCommitHash("HEAD",s.path)}):(this.#r.warn(`No commit found for ${s.folderName}, skipping revert`),{skipped:!0})})).results.filter(s=>!s.success);if(n.length>0)throw new Error(`Failed to revert ${n.length} repos`);let i=await this.#G();this.#N={...this.#N,...i},await this.#F(),this.requestRefresh(),await this.#me({lastCommit:no(i)})}async revertToCommitHash(e){let r=sf(e,this.gitRepoContexts[0]?.folderName),n=Object.keys(r).length===0?e:no(r);return this.revertToCommitSnapshot(n)}async resetToCommitSnapshot(e,r=!0){await this.waitUntilBlockingPendingPromises(),await this.abortMerge(!1),await this.#ne(!1);let i=(await this.#q(async o=>{let a=Du(e,o.folderName,this.gitRepoContexts[0]?.folderName);if(!a)return this.#r.warn(`No commit found for ${o.folderName}, skipping reset`),{skipped:!0};await this.git(["reset","--quiet","--hard",a],{cwd:o.path}),await this.git(["clean","-fd"],{cwd:o.path});let A=await this.getCurrentCommitHash("HEAD",o.path);if(A!==a)throw new Error(`Failed to reset commit hash for ${o.folderName}: expected ${a}, got ${A}`);return{commitHash:A}})).results.filter(o=>!o.success);if(i.length>0)throw new Error(`Failed to reset ${i.length} repos`);let s=sf(e,this.gitRepoContexts[0]?.folderName);this.#N={...this.#N,...s},await this.#F(),r&&this.requestRefresh()}async resetToCommitHash(e,r=!0){let n=sf(e,this.gitRepoContexts[0]?.folderName),i=Object.keys(n).length===0?e:no(n);return this.resetToCommitSnapshot(i,r)}async restore({location:e,predicate:r,revert:n=!1,dryRun:i=!1,forceReplay:s=!1,debug:o}){let a=this.getSessionContext(),A=a.turns.length,c=null;for(let p=A-1;p>=-1;p--)if(r(p>=0?a.turns[p]:null,p)){c=p;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.#C,d=a.turns,g=Math.max(0,e==="before"?c:c+1);for(let p=d.length-1;p>=g;p--){let f=d[p];for(let m of f.applyResults)u.set(m.filePath,m.oldContent??"")}if(!i){let p;if(l){c===-1?a.beforeCommit?p=a.beforeCommit:d.length>0&&(p=d[0].beforeCommit):c<d.length&&(e==="after"?(p=d[c].afterCommit,!p&&c+1<d.length&&(p=d[c+1].beforeCommit)):p=d[c].beforeCommit);let I={commitSnapshot:p,sessionId:a.sessionId,sessionBeforeCommit:a.beforeCommit,turnsLength:d.length,targetIndex:c,currentTurn:d[d.length-1],targetTurn:d[c],targetTurnNext:d[c+1],location:e,forceReplay:s,dryRun:i,debug:o};if(!p)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(p):await this.resetToCommitSnapshot(p)}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=d.splice(g,d.length-g),m=uA(d);m&&m?.afterCommit!==p&&(this.#e.Sentry?.captureException(new Error("Reset After commit snapshot mismatch"),{tags:{operation:"codegen-git",endpoint:"resetToCommitHash"},extra:{lastTurn:m,commitSnapshot:p}}),m.lastCommit=p,await this.#me({completionId:m.completionId,lastCommit:p}));let C=m?.completionId;if(f.length>0&&(await VG(this.#e,this.#o,{lastCompletionId:C,sessionId:a.sessionId},!!this.#a),a.updatedUnixTime=Date.now()),s){let I=a.state;this.#g.emit("step",{type:"batch",steps:[{type:"state",newState:"replay",abortable:!1,previousState:I},...this.#Ot(),{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.#_t(),{undone:Array.from(u.keys()),message:"The restore operation was successful"}}async#_t(e){return await this.#f?.ensureDevCommand(e)}async restoreFromCompletionId({location:e,completionId:r,forceReplay:n}){let i=this.getSessionContext();return i.turns.find(o=>o.completionId===r)?this.restore({location:e,predicate:o=>o?.completionId===r,forceReplay:n,debug:`restore to: ${r}`}):(await this.#Ee,i.turns=[],i.canLoadMore=!0,await VG(this.#e,this.#o,{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 dle(e)?.completionId}getLastCompletionId(){let e=this.getSessionContext();return qG(e)?.completionId}getCurrentState(){return this.getSessionContext().state}getLastApplyResultsTurn(){let e=this.getSessionContext();return fle(e)}getLastTurn(){let e=this.getSessionContext();return qG(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"})}kt("quality code feedback given",{spaceId:this.#o.builderPublicKey,sentiment:e.feedbackSentiment,mode:"cli"});let r=e.id??this.getLastCompletionId();r&&await this.#pr({...e,id:r})}#me(e){let r=e.completionId;if(!r){let i=this.getLastTurn();i&&e.lastCommit&&(i.lastCommit=e.lastCommit),r=i?.completionId}let n=$G(this.#e,this.#o,"/codegen/finalize",{completionId:r,projectId:this.#u?.projectId,branchName:this.#u?.branchName,userCompletionId:this.getLastUserCompletionId(),sessionId:this.getSessionId(),metadata:this.#U,hasPlanToApply:this.#de,...e},this.#a);return this.#vt&&this.#gr(),this.#K(n,"completionFinalize")}#gr(){try{let e=this.#e.getCwdDir(),r=this.getSessionId();if(this.#ot){_L(this.#e,e,r).catch(()=>{});return}let n=Xw(this.#e,e).then(i=>{if(i.some(l=>l.sessionId===r)){this.#ot=!0,_L(this.#e,e,r).catch(()=>{});return}let s=this.getSessionContext().turns,o=s[s.length-1],a=o?.title,A=a&&a!=="Untitled"&&!a.startsWith("completionId:"),c=o?.userMessage?.displayPrompt??o?.userMessage?.userPrompt??"",u=A?a:hse(c);return fse(this.#e,e,r,u).then(()=>{this.#ot=!0})}).catch(()=>{});this.#K(n,"saveLocalHistory")}catch{}}#pr(e){let r=$G(this.#e,this.#o,"/codegen/feedback",e,this.#a);return this.#K(r,"completionFeedback")}#O(e,r,n={}){this.#f?.emitter.emit("metrics",{durations:[{key:e,ms:r,attributes:n}]})}#K(e,r,n=!1){let i=ca();this.#r.debug(`(addToPendingPromises-${i}): adding ${r} (blocking: ${n})`),this.#le.push(e),n&&this.#He.push(e);let s=new Error(`Deadlock detected in codegen (function: ${r})`),o=setTimeout(()=>{this.#e.Sentry?.captureException(s,{level:"fatal",tags:{operation:"codegen-stream",functionName:r,sessionId:this.getSessionId(),projectId:this.#I,branchName:this.#y}})},300*1e3);return e.finally(()=>{clearTimeout(o),this.#r.debug(`(addToPendingPromises-${i}): removing ${r} (blocking: ${n})`);let a=this.#He.indexOf(e);a!==-1&&this.#He.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}#$(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 s,o=a=>{a.type==="state"&&a.newState===e&&(clearTimeout(s),this.#g.removeListener("step",o),n())};s=setTimeout(()=>{this.#g.removeListener("step",o),n()},r),this.#g.on("step",o)})}getProxyConfig(){return qre({devServerUrl:this.#u?.serverUrl,proxyOrigin:this.#Oe,proxyDefaultOrigin:this.#Ke,proxyDestination:this.#bt})}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.#Re(),e.customAgents=await this.#We(),this.#Y.length=0,this.#U={},this.#ee=void 0,this.#Pe=!1,this.#je=0,this.clearMessageQueue(!1),this.queueGitStatusReminder({trigger:"session-start"}),this.#g.emit("step",this.#Gt())}async clearMessageQueue(e=!1){let r=[],n=this.getSessionMode();if(e)for(let i of this.#t)i.user&&r.push({type:"user",previousId:this.getLastCompletionId(),displayPrompt:i.displayPrompt,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.idempotencyKey,sessionMode:i.sessionMode??n});this.#t.length=0,this.#Xe(),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&&xle(this.#t,r,r+e.delta)}this.#Xe()}async flushMessageQueue(){this.#r.debug("(flushMessageQueue): flushing message queue"),await this.abort({cleanCurrentMessage:!1,flushMessageQueue:!0}),this.#s&&this.#s()}#Ut(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,_b.randomUUID)();if(e.queue==null&&(e.queue=!0),e.user?e.user={...this.#ee,...e.user}:e.user=this.#ee,e.userPrompt==="___BROWSER_AUTOMATION_PROMPT___"){let n=this.getProxyConfig();e.userPrompt=mse(n.proxyDefaultOrigin,this.#we||void 0)}return this.#t.push(e),!0}async sendMessage(e){this.#Pe=!1;let r=0;if(Array.isArray(e))for(let i of e)this.#Ut(i)&&r++;else this.#Ut(e)&&r++;if(r===0)return null;this.#r.debug(`(sendMessage): added messages(${r}) to queue(${this.#t.length})`),this.#Xe();let n=this.#t[this.#t.length-1];return n?(this.cancelAllPendingToolFulfilments(n.userPrompt),n.queue?this.#s&&this.#s():await this.flushMessageQueue(),await Qu(),n.idempotencyKey):null}#dr(){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=WG(e),this.#ee=this.#i.user,this.#i.softContextWindow&&(this.#S=Math.min(this.#S??3e4,this.#i.softContextWindow)),this.clearMessageQueue(!0),this.#i}}#fr(){let e=this.#t.length===0||this.#Pe,r=new Promise(n=>{e?this.#s=n:n()}).then(()=>{let n=this.#t;if(n.length!==0)if(this.#A==="until-idle"){let i=this.#t.shift();if(i.user&&!i.forceCompact){this.#ee=i.user;let s=this.getSessionMode();this.#g.emit("step",{type:"user",previousId:this.getLastCompletionId(),displayPrompt:i.displayPrompt,user:i.user,role:i.user.role,compacting:!1,idempotencyKey:i.idempotencyKey,sessionMode:i.sessionMode??s})}if(i.systemReminders)for(let s of i.systemReminders)this.queueSystemReminder(s);return this.#i=i,this.#ee=i.user,this.#i.softContextWindow&&(this.#S=Math.min(this.#S??3e4,this.#i.softContextWindow)),this.#Xe(),i}else{for(let s of n)if(s.systemReminders)for(let o of s.systemReminders)this.queueSystemReminder(o);let i=WG(n);if(!i.dropAbortedPrompt&&this.#i){let s=i.idempotencyKey;i=nO(this.#i,i),i.idempotencyKey=s}return this.clearMessageQueue(!0),this.#i=i,this.#ee=i.user,i}});return{shouldWait:e,promise:r}}#Xe(){this.#g.emit("step",{type:"message-queue",queue:this.#t.map(e=>({idempotencyKey:e.idempotencyKey,displayPrompt:e.displayPrompt,user:e.user}))})}#pt(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.#f;if(!r)return{state:"installed",shouldProceed:!0};if(r.setupState==="installing")try{await ZA(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.#f&&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 s=this.#f;if(s){await s.ensureDevCommand(e);let o=await s.waitUntilServer(e,r,n);return o.ok?{shouldProceed:!0,message:"Dev server is ready.",serverUrl:s.serverUrl?.toString()}:{shouldProceed:!1,message:o.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(),s=i.customAgents,o=e?s.find(Y=>Y.name.toLowerCase()===e.toLowerCase()):void 0,a=o?.name??"explorer",{mcpServers:A=!1,model:c,mode:u="quality-v4-agent",systemPrompt:l,subagent_type:d,includeMemories:g,needDevServer:p,needValidation:f,queueMode:m,asyncSubAgents:C,resetAfterRun:I=!1,reasoning:B,softContextWindow:E,maxTimeoutMs:y}={mcpServers:o?.mcpServers,subagent_type:a,systemPrompt:o?.systemPrompt,softContextWindow:o?.softContextWindow,model:(()=>{let Y=o?.name??a,J=Y?this.#Ae?.[Y]:void 0;if(typeof J=="string")return J;if(Array.isArray(J)&&J.length){let O=Y,U=this.#ge.get(O)??0;return this.#ge.set(O,U+1),J[U%J.length]}if(o?.roundRobinModels?.length){let O=o.name,U=this.#ge.get(O)??0;return this.#ge.set(O,U+1),o.roundRobinModels[U%o.roundRobinModels.length]}return o?.model})(),mode:o?.mode,includeMemories:o?.includeMemories??a==="explorer",needDevServer:o?.needDevServer,needValidation:o?.needValidation,resetAfterRun:o?.resetAfterRun,queueMode:o?.queueMode,asyncSubAgents:o?.asyncSubAgents,reasoning:o?.reasoning??this.#it,maxTimeoutMs:o?.maxTimeoutMs},Q=["Read","Glob","Skill","Grep","WebSearch","SearchMemories"];i.sessionMode==="deep-research"&&Q.push("Bash","WebFetch"),Q=Q.filter(Y=>this.#D?this.#D.includes(Y):!0),Q.push("ExplorationMetadata");let w=Pb(this.#u,o?.tools??Q),D=c===void 0?d==="explorer"?"opa5-mini":void 0:c,x=this.#f;if(p&&n){if(!x)return{success:!1,response:`The ${d} agent can not be used on this session. Do no try again.`};if(x.httpServerState.state==="stopped"||x.httpServerState.state==="connecting"||x.httpServerState.state==="error-fetch")try{if(x.state==="not-installed")throw new Error(`The ${d} agent can not be used until the setupCommand finish successfully. However, the dev server is not installed.`);if(x.state==="install-failed")throw new Error(`The ${d} agent can not be used until the setupCommand finish successfully. However, last time we try to run the install script, it failed.`);if(x.state==="install-aborted")throw new Error(`The ${d} 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 x.ensureDevCommand(n)}catch(J){return{success:!1,response:J instanceof Error?J.message:String(J)}}if(f&&x.validateCommand&&this.#re){let J=await x.runValidateCommand(void 0,n);if(J.status==="failure")return{success:!1,response:`The Agent could not start yet, because the validate command failed:
|
|
1903
1903
|
<command>
|
|
1904
1904
|
${J.command}
|
|
1905
1905
|
</command>
|
|
@@ -1907,20 +1907,20 @@ ${J.command}
|
|
|
1907
1907
|
${J.output}
|
|
1908
1908
|
</logs>
|
|
1909
1909
|
|
|
1910
|
-
Make the necessary changes and try again.`};if(J.status==="aborted")return{success:!1,response:"The Agent could not start yet, because the validate command was aborted by the user."};this.#re=!1}let Y=await this.waitForDevServer(n);if(!Y.shouldProceed)return{success:!1,response:Y.message}}let S=this.#h.replace(/-agent$/,""),v={},P=a==="browser-testing",$,H;if(w.includes("mcp:chrome")){let Y=await this.#
|
|
1910
|
+
Make the necessary changes and try again.`};if(J.status==="aborted")return{success:!1,response:"The Agent could not start yet, because the validate command was aborted by the user."};this.#re=!1}let Y=await this.waitForDevServer(n);if(!Y.shouldProceed)return{success:!1,response:Y.message}}let S=this.#h.replace(/-agent$/,""),v={},P=a==="browser-testing",$,H;if(w.includes("mcp:chrome")){let Y=await this.#hr(r,n,{recordReplay:P});if(Y?.wsUrl)P&&($=Y.uuid),H=Y.disconnectUrl,v.chrome={command:"npx",args:["-y","chrome-devtools-mcp@latest","--wsEndpoint",Y.wsUrl,"--categoryEmulation=false"],retries:5};else{let J=["mcp:chrome","RecordFrame"];for(let O of J){let U=w.indexOf(O);U!==-1&&w.splice(U,1)}this.#r.debug("Chrome MCP not available \u2014 browser tools removed from agent")}}let M=["## Workspace Context","",`**Bash tool Working Directory:** ${this.#x}`,"","**Git Repositories:**",...this.#d.map(Y=>`- repository: ${Y.repoName} in folder: ${Y.folderName}`)].join(`
|
|
1911
1911
|
`),G=l?Uw(l,{cwd:this.#x,env:{...x?.envVars??process.env,FUSION_CONTEXT:M,FUSION_TEST_PROMPT:this.#u?.browserAutomationInstructions??"",...jie(i.customAgents)},allowedCommands:Cw(this.#u?.allowedCommands??[]),skipCommandSecurity:this.#u?.skipCommandSecurity===!0}):void 0;return{success:!0,subagent_type:d,resetAfterRun:I,replayId:$,browserDisconnectUrl:H,maxTimeoutMs:y,options:{sys:this.#e,credentials:this.#o,position:o?.position??`${S}-${a}`,mode:u,softContextWindow:E,includeMemories:g,modelOverride:Su(D)??this.#St??this.#j,agentModelOverrides:this.#Ae,sessionOrCompletionId:r,workingDirectory:this.#m,mcpServers:A,fusionStatusMonitor:this.#et,autoImportLocalMCPs:!1,fusionConfig:this.#u,privacyMode:this.#L,enabledTools:w,builtInMCPServerConfig:v,builtInCustomAgents:this.#Le,systemPromptOverride:G,queueMode:m,asyncSubAgents:C,reasoning:B,devServerOrchestrator:w.includes("DevServerLogs")||w.includes("DevServerRestart")||w.includes("DevServerControl")||w.includes("ProposeEnvVariable")?this.#f:void 0}}}async spawnNamedAgent(e,r){let n=r.resume??r.sessionId,i=await this.getNamedAgentConfig(e,n,r.signal);if(!i.success)return this.#r.debug(`(spawnNamedAgent) failed to resolve config for "${e}": ${i.response}`),{success:!1,response:i.response};this.#r.debug(`(spawnNamedAgent) spawning "${i.subagent_type}" (sessionId=${n}), tools=${(i.options.enabledTools??[]).join(",")}, resetAfterRun=${i.resetAfterRun}`),await this.waitUntilBlockingPendingPromises(),await this.#ne(!0);let s;if(i.resetAfterRun){if(this.#C&&!await this.#ht())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.
|
|
1912
1912
|
|
|
1913
|
-
Please commit or stash your changes first, then try again.`};s=(await this.#F())?.currentCommit}let o=i.subagent_type,a=new t({...i.options,git:!1,parentSessionId:this.getSessionId()}),A=r.sessionId??r.resume??n,c=Promise.withResolvers();this.#Je.set(A,{description:r.prompt.substring(0,200),startedAt:Date.now(),promise:c.promise});let u=!1,l=J=>{u||(u=!0,c.resolve(J))},d=new AbortController,g=gn([r.signal,d.signal]);await a.initializeSession({skipSessionLoading:!r.resume,signal:g}),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 p=a.getSessionId(),f={important_files:[]},m=new zC(p,{framesDir:this.#e.join(Lb.default.homedir(),".builder","recordings"),debug:this.#a}),C,I=()=>{C||!i.replayId||(C=new kb({credentials:this.#o,replayId:i.replayId,debug:this.#a}),m.setReplayUploader(C))};a.setTimeline(m);let B=J=>{let O=m.readState(),U=new Map;for(let K of O)K.kind==="test_outcome"&&K.status==="accepted"&&K.test_case_id&&U.set(K.test_case_id,K);return{success:!1,response:`Agent finalized from disk (${J}): ${U.size} test case(s) recovered`}},E=AXe(i.maxTimeoutMs),y=setTimeout(()=>{u||(this.#r.warn(`[${o}] Agent max timeout fired after ${E/1e3}s \u2014 aborting agent`),d.abort(),l(B("watchdog_timeout")))},E),Q=[],w={value:null},D=[],x={value:null},v=[...r.prompt.matchAll(/###\s+(TC-\d+)[:\s]+([^\n]*)/g)].map(J=>({id:J[1],title:J[2].trim(),description:J[2].trim(),expected_outcome:"",priority:"high"}));v.length>0&&(x.value={mode:"extracted-from-prompt",test_cases:v});let P=[],$=r.maxCompletions,H=0,M=a.connectToEventLoop(!1,J=>{try{if(J.type==="tool_result"&&J.result.tool_name==="ExplorationMetadata"&&typeof J.result.content=="string")try{f=JSON.parse(J.result.content)}catch(O){this.#e.Sentry?.captureException(O,{extra:{contentPreview:J.result.content.substring(0,500),contentLength:J.result.content.length},tags:{operation:"exploration-metadata-parse"}})}else{if(J.type==="done"&&($--,$<10)){let O="";if(x.value){let U=new Set(P.map(ne=>ne.test_case_id)),K=x.value.test_cases.filter(ne=>!U.has(ne.id));K.length>0&&(O=` You have ${K.length} unreported test cases: ${K.map(ne=>ne.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 ${$} turns.${O}`})}this.#g.emit("step",{type:"agent",id:p,step:J,subagent_type:o})}if(J.type==="tool"&&(m.onToolCall(J.name,J.content),J.name==="mcp__chrome__navigate_page"&&I()),J.type==="thinking"&&(m.onThinking(J.content),C&&typeof J.content=="string"&&C.recordReasoning(J.content)),J.type==="text"&&C&&C.recordText(J.content),J.type==="tool_result"){let O=m.getFrameCount();if(O>H&&(H=O,this.#pt({timeline_progress:m.getProgressSnapshot()},!1)),J.result.tool_name==="ReportUIIssue")try{let U=JSON.parse(J.result.tool_input||"{}");U.title&&U.description&&Q.push({title:U.title,description:U.description,debugInfo:U.debugInfo})}catch{}if(J.result.tool_name==="ReportTestOutcome")try{let U=JSON.parse(J.result.tool_input||"{}");if(U.test_case_id){let K=x.value&&!x.value.test_cases.some(ge=>ge.id===U.test_case_id);K&&a.queueSystemReminder({text:`WARNING: "${U.test_case_id}" is not in your registered test plan. Use one of: ${x.value.test_cases.map(ge=>ge.id).join(", ")}`,tag:"reminder:unknown-test-case"});let ne=!!K;if(U.outcome==="succeeded"&&(!U.evidence_frame_count||U.evidence_frame_count<1)&&(a.queueSystemReminder({text:`REJECTED: You reported "${U.test_case_id}" as "succeeded" but evidence_frame_count is ${U.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"}),ne=!0),U.outcome!=="succeeded"&&U.outcome!=="other"&&!U.failure_category&&(a.queueSystemReminder({text:`WARNING: "${U.test_case_id}" reported as "${U.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"}),ne=!0),!ne){let ge=P.findIndex(Ae=>Ae.test_case_id===U.test_case_id),me={...U,timestamp:Date.now()};if(ge!==-1?P[ge]=me:P.push(me),x.value){let Ae=new Set(P.map(Qe=>Qe.test_case_id)),X=x.value.test_cases.filter(Qe=>!Ae.has(Qe.id));X.length>0&&a.queueSystemReminder({text:`Progress: ${P.length}/${x.value.test_cases.length} test cases reported. Remaining: ${X.map(Qe=>Qe.id).join(", ")}`,tag:"reminder:test-progress"})}}}else if(U.outcome&&U.summary&&(w.value={outcome:U.outcome,summary:U.summary,details:U.details}),x.value){let K=new Set(P.map(ge=>ge.test_case_id)),ne=x.value.test_cases.filter(ge=>!K.has(ge.id)).map(ge=>ge.id);ne.length>0&&a.queueSystemReminder({text:`WARNING: ${ne.length} test cases unreported: ${ne.join(", ")}. Call ReportTestOutcome with test_case_id for each remaining case before the final summary.`,tag:"reminder:missing-test-cases"})}}catch{}if(J.result.tool_name==="ReportIssue")try{let U=JSON.parse(J.result.tool_input||"{}");U.file_path&&U.line&&U.title&&U.severity&&U.body&&D.push({file_path:U.file_path,line:U.line,...U.start_line?{start_line:U.start_line}:{},title:U.title,severity:U.severity,body:U.body})}catch{}}}catch{}}),G=async()=>{if(M(),C)try{await C.close()}catch{}if(i.browserDisconnectUrl)try{let J=new AbortController,O=setTimeout(()=>J.abort(),2e3);await fetch(i.browserDisconnectUrl,{method:"POST",signal:J.signal,keepalive:!0}).finally(()=>clearTimeout(O))}catch{}await a.close(!1)};if(r.signal?.aborted){await G(),this.#Je.delete(A),clearTimeout(y);let J={success:!1,response:"Agent task aborted"};return l(J),J}let Y=async()=>{await G()};g.addEventListener("abort",Y);try{let J=r.attachmentUrls?.map(Ae=>({type:"url",value:Ae}));await a.sendMessage({userPrompt:r.prompt,user:r.user,maxCompletions:r.maxCompletions,category:"background-subagent",includeRelevantMemories:i.options.includeMemories,queue:!0,...J?.length&&{attachments:J}}),await a.waitUntilIdle(g);let O=a.getLastTurn();if(!O){let Ae=B("no_last_turn");return l(Ae),Ae}let U=O.actions.filter(Ae=>Ae.type==="text").map(Ae=>Ae.content).join(`
|
|
1913
|
+
Please commit or stash your changes first, then try again.`};s=(await this.#F())?.currentCommit}let o=i.subagent_type,a=new t({...i.options,git:!1,parentSessionId:this.getSessionId(),mainSessionId:this.getMainSessionId()}),A=r.sessionId??r.resume??n,c=Promise.withResolvers();this.#Je.set(A,{description:r.prompt.substring(0,200),startedAt:Date.now(),promise:c.promise});let u=!1,l=J=>{u||(u=!0,c.resolve(J))},d=new AbortController,g=gn([r.signal,d.signal]);await a.initializeSession({skipSessionLoading:!r.resume,signal:g}),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 p=a.getSessionId(),f={important_files:[]},m=new zC(p,{framesDir:this.#e.join(Lb.default.homedir(),".builder","recordings"),debug:this.#a}),C,I=()=>{C||!i.replayId||(C=new kb({credentials:this.#o,replayId:i.replayId,debug:this.#a}),m.setReplayUploader(C))};a.setTimeline(m);let B=J=>{let O=m.readState(),U=new Map;for(let K of O)K.kind==="test_outcome"&&K.status==="accepted"&&K.test_case_id&&U.set(K.test_case_id,K);return{success:!1,response:`Agent finalized from disk (${J}): ${U.size} test case(s) recovered`}},E=AXe(i.maxTimeoutMs),y=setTimeout(()=>{u||(this.#r.warn(`[${o}] Agent max timeout fired after ${E/1e3}s \u2014 aborting agent`),d.abort(),l(B("watchdog_timeout")))},E),Q=[],w={value:null},D=[],x={value:null},v=[...r.prompt.matchAll(/###\s+(TC-\d+)[:\s]+([^\n]*)/g)].map(J=>({id:J[1],title:J[2].trim(),description:J[2].trim(),expected_outcome:"",priority:"high"}));v.length>0&&(x.value={mode:"extracted-from-prompt",test_cases:v});let P=[],$=r.maxCompletions,H=0,M=a.connectToEventLoop(!1,J=>{try{if(J.type==="tool_result"&&J.result.tool_name==="ExplorationMetadata"&&typeof J.result.content=="string")try{f=JSON.parse(J.result.content)}catch(O){this.#e.Sentry?.captureException(O,{extra:{contentPreview:J.result.content.substring(0,500),contentLength:J.result.content.length},tags:{operation:"exploration-metadata-parse"}})}else{if(J.type==="done"&&($--,$<10)){let O="";if(x.value){let U=new Set(P.map(ne=>ne.test_case_id)),K=x.value.test_cases.filter(ne=>!U.has(ne.id));K.length>0&&(O=` You have ${K.length} unreported test cases: ${K.map(ne=>ne.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 ${$} turns.${O}`})}this.#g.emit("step",{type:"agent",id:p,step:J,subagent_type:o})}if(J.type==="tool"&&(m.onToolCall(J.name,J.content),J.name==="mcp__chrome__navigate_page"&&I()),J.type==="thinking"&&(m.onThinking(J.content),C&&typeof J.content=="string"&&C.recordReasoning(J.content)),J.type==="text"&&C&&C.recordText(J.content),J.type==="tool_result"){let O=m.getFrameCount();if(O>H&&(H=O,this.#pt({timeline_progress:m.getProgressSnapshot()},!1)),J.result.tool_name==="ReportUIIssue")try{let U=JSON.parse(J.result.tool_input||"{}");U.title&&U.description&&Q.push({title:U.title,description:U.description,debugInfo:U.debugInfo})}catch{}if(J.result.tool_name==="ReportTestOutcome")try{let U=JSON.parse(J.result.tool_input||"{}");if(U.test_case_id){let K=x.value&&!x.value.test_cases.some(ge=>ge.id===U.test_case_id);K&&a.queueSystemReminder({text:`WARNING: "${U.test_case_id}" is not in your registered test plan. Use one of: ${x.value.test_cases.map(ge=>ge.id).join(", ")}`,tag:"reminder:unknown-test-case"});let ne=!!K;if(U.outcome==="succeeded"&&(!U.evidence_frame_count||U.evidence_frame_count<1)&&(a.queueSystemReminder({text:`REJECTED: You reported "${U.test_case_id}" as "succeeded" but evidence_frame_count is ${U.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"}),ne=!0),U.outcome!=="succeeded"&&U.outcome!=="other"&&!U.failure_category&&(a.queueSystemReminder({text:`WARNING: "${U.test_case_id}" reported as "${U.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"}),ne=!0),!ne){let ge=P.findIndex(Ae=>Ae.test_case_id===U.test_case_id),me={...U,timestamp:Date.now()};if(ge!==-1?P[ge]=me:P.push(me),x.value){let Ae=new Set(P.map(Qe=>Qe.test_case_id)),X=x.value.test_cases.filter(Qe=>!Ae.has(Qe.id));X.length>0&&a.queueSystemReminder({text:`Progress: ${P.length}/${x.value.test_cases.length} test cases reported. Remaining: ${X.map(Qe=>Qe.id).join(", ")}`,tag:"reminder:test-progress"})}}}else if(U.outcome&&U.summary&&(w.value={outcome:U.outcome,summary:U.summary,details:U.details}),x.value){let K=new Set(P.map(ge=>ge.test_case_id)),ne=x.value.test_cases.filter(ge=>!K.has(ge.id)).map(ge=>ge.id);ne.length>0&&a.queueSystemReminder({text:`WARNING: ${ne.length} test cases unreported: ${ne.join(", ")}. Call ReportTestOutcome with test_case_id for each remaining case before the final summary.`,tag:"reminder:missing-test-cases"})}}catch{}if(J.result.tool_name==="ReportIssue")try{let U=JSON.parse(J.result.tool_input||"{}");U.file_path&&U.line&&U.title&&U.severity&&U.body&&D.push({file_path:U.file_path,line:U.line,...U.start_line?{start_line:U.start_line}:{},title:U.title,severity:U.severity,body:U.body})}catch{}}}catch{}}),G=async()=>{if(M(),C)try{await C.close()}catch{}if(i.browserDisconnectUrl)try{let J=new AbortController,O=setTimeout(()=>J.abort(),2e3);await fetch(i.browserDisconnectUrl,{method:"POST",signal:J.signal,keepalive:!0}).finally(()=>clearTimeout(O))}catch{}await a.close(!1)};if(r.signal?.aborted){await G(),this.#Je.delete(A),clearTimeout(y);let J={success:!1,response:"Agent task aborted"};return l(J),J}let Y=async()=>{await G()};g.addEventListener("abort",Y);try{let J=r.attachmentUrls?.map(Ae=>({type:"url",value:Ae}));await a.sendMessage({userPrompt:r.prompt,user:r.user,maxCompletions:r.maxCompletions,category:"background-subagent",includeRelevantMemories:i.options.includeMemories,queue:!0,...J?.length&&{attachments:J}}),await a.waitUntilIdle(g);let O=a.getLastTurn();if(!O){let Ae=B("no_last_turn");return l(Ae),Ae}let U=O.actions.filter(Ae=>Ae.type==="text").map(Ae=>Ae.content).join(`
|
|
1914
1914
|
`),K=m.getMergedTestCaseResults();if(K.length>0)for(let Ae of K){if(!Ae.test_case_id){P.push(Ae);continue}let X=P.findIndex(Te=>Te.test_case_id===Ae.test_case_id);if(X===-1){P.push(Ae);continue}let Qe=P[X],Oe=Number(Qe.timestamp??Qe.ts??0);Number(Ae.timestamp??Ae.ts??Date.now())>=Oe&&(P[X]=Ae)}let ne=m.getMergedTestPlan()??x.value;ne&&(U=`<browser_automation_test_plan>${JSON.stringify(ne,null,2)}</browser_automation_test_plan>
|
|
1915
1915
|
${U}`),P.length>0&&(U=`<browser_automation_test_results>${JSON.stringify(P,null,2)}</browser_automation_test_results>
|
|
1916
1916
|
${U}`),Q.length>0&&(U=`<browser_automation_ui_issues>${JSON.stringify(Q,null,2)}</browser_automation_ui_issues><browser_automation_summary>${U}</browser_automation_summary>`),D.length>0&&(U=`<code_review_issues>${JSON.stringify(D,null,2)}</code_review_issues><code_review_summary>${U}</code_review_summary>`);let ge=this.#ze;if(ge&&ge!==m){ne&&ge.mergeTestPlan(ne),P.length>0&&ge.mergeTestCaseResults(P);let Ae=P.filter(pe=>pe.test_case_id),X=Ae.filter(pe=>pe.outcome==="succeeded").length,Qe=Ae.length,Oe=Qe>0?`${X}/${Qe} passed`:void 0,Ce=Ae.map(pe=>pe.test_case_id),Te=`${o}:${p}`;ge.mergeChildTimeline(m,Te,{summary:Oe,sessionId:p,testCaseIds:Ce.length>0?Ce:void 0,replayId:i.replayId})}else if(m.hasAnyFrames())try{let Ae=a.getSessionId(),X=m.getHighlightImages(),Qe=X.length>0?m.getHighlightMetadataFrames():m.getLegacyMetadataFrames(),Oe=X.length>0?X:m.getExplicitImages(),Ce=`${Ae}.webp`,Te=`${Ae}.json`,pe=`${Ae}-timeline.json`,Re=this.#e.join(Lb.default.homedir(),".builder","recordings"),De=this.#e.join(Re,Ce),We=this.#e.join(Re,Te),tt=this.#e.join(Re,pe);await $u.default.promises.mkdir(Re,{recursive:!0}),await $u.default.promises.writeFile(We,JSON.stringify(Qe,null,2));let Bt=await m.finalize();await $u.default.promises.writeFile(tt,JSON.stringify(Bt,null,2)),f.timeline_id=pe;let _t=this.getSessionContext().userContext,ir=_t?.browserTestingShadowMode==="true",Ke=_t?.prNumber&&!ir?{prNumber:Number(_t.prNumber),repoFullName:_t.repoFullName,hostname:_t.hostname,prHeadSha:_t.prHeadSha,checkRunId:_t.checkRunId?Number(_t.checkRunId):void 0,projectId:this.#I??void 0,branchName:this.#y??void 0,ownerId:this.#o.builderPublicKey,configId:this.getLastCompletionId(),containerUrl:_t.containerUrl,recordingCaption:(()=>{if(P.length>0){let rr=P.filter(Ve=>Ve.outcome==="succeeded").length,At=P.filter(Ve=>Ve.outcome==="failed").length,yt=P.length,Vr=[`${rr}/${yt} passed`];return At>0&&Vr.push(`${At} failed`),`Browser testing: ${Vr.join(", ")}`}return w.value?`Browser testing: ${w.value.outcome}`:"Browser testing"})(),summary:w.value?.summary??void 0}:null;try{let rr=await lA(this.#o,"/codegen/timeline",{...Bt,projectId:this.#I??null,branchName:this.#y??null,testOutcome:w.value?.outcome??null,testSummary:w.value?.summary??null,testDetails:w.value?.details??null,uiIssues:Q.length>0?Q:null,testPlan:ne??null,testCaseResults:P.length>0?P:null,submission:Ke});rr?.recording_id&&(f.recording_id=rr.recording_id)}catch(rr){this.#r.warn(`[${o}] Timeline POST failed (non-fatal): ${rr instanceof Error?rr.message:String(rr)}`),this.#e.Sentry?.captureException(rr,{level:"warning",tags:{component:"timeline-post",subagent_type:o},extra:{sessionId:p}})}if(Oe.length>0){let rr=X.length>0?m.getHighlightFrameDurations():m.getExplicitFrameDurations();if(await $ie(Oe,{duration:"1",frameDurations:rr.length>0?rr:void 0,outputPath:De,cleanup:!1,sys:this.#e,debug:this.#a,signal:r.signal})&&(f.gif_id=Ce??void 0,this.#r.debug(`(subagent=${o}): Generated recording from ${Oe.length} frames: ${Ce}`),Ce)){let yt=Qe.map(Vr=>Vr.title);U=`<browser_automation_gif_id>${Ce}</browser_automation_gif_id>
|
|
1917
1917
|
<browser_automation_timeline_id>${pe}</browser_automation_timeline_id>
|
|
1918
1918
|
<browser_automation_recorded_frames>${JSON.stringify(yt)}</browser_automation_recorded_frames>
|
|
1919
1919
|
|
|
1920
|
-
${U}`}}this.#pt({gif_id:f.gif_id,gif_frames:Qe,timeline_id:pe,recording_id:f.recording_id,...i.replayId?{replay_id:i.replayId,replay_url:`${ke}/replay/${i.replayId}`}:{}},!1)}catch(Ae){this.#r.warn(`[${o}] Failed to generate recording (non-critical): ${Ae instanceof Error?Ae.message:String(Ae)}`),this.#e.Sentry?.captureException(Ae,{level:"warning",tags:{component:"gif-generator",operation:"generateGifFromImages",subagent_type:o},extra:{sessionId:a.getSessionId(),frameCount:m.getFrameCount()}})}let me={success:!0,response:U,metadata:f,sessionId:p,lastTurn:O};return l(me),me}catch(J){let O={success:!1,response:`Agent task failed: ${J instanceof Error?J.message:String(J)}`,metadata:{important_files:[]}};return l(O),O}finally{u||l(B("finally_safety_net")),clearTimeout(y),this.#Je.delete(A),g.removeEventListener("abort",Y);try{await G()}catch(J){this.#r.warn(`[${o}] Cleanup failed: ${J instanceof Error?J.message:String(J)}`)}if(i.resetAfterRun&&s)try{await this.resetToCommitHash(s,!1)}catch(J){this.#r.warn(`[${o}] Failed to reset changes: ${J instanceof Error?J.message:String(J)}`)}}}getRunningSubAgents(){return Array.from(this.#Je.entries()).map(([e,r])=>({id:e,description:r.description,startedAt:r.startedAt}))}canHandleTool(e){let n=(this.#H.get(e)??0)>0,i=this.#W.has(e);return n||i}setSessionCanHandleTools(e){for(let r of e)this.#W.add(r)}clearSessionCanHandleTools(){this.#W.clear()}setProxyOrigin(e,r){if(e!==this.#Oe||r!==this.#Ke){this.#Oe=e,this.#Ke=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#
|
|
1921
|
-
${kle(r.environmentVariables)}`,tag:"reminder:environment-variables"})),e.proxyServer?i.push(r?.setProxyServer(e.proxyServer).then(s=>{n.proxyServer=s.updatedProxyServer,n.hosts=s.updatedHosts})):e.proxyPort&&i.push(r?.setPort(e.proxyPort).then(s=>n.proxyServer=s)),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(s=>{n.setupCommand=!!s,n.setupResult=s??void 0})):(e.forceSetupCommand||n.fileOverrides||n.env&&r.setupState!=="installed")&&i.push(r?.runSetupCommand().then(s=>{n.setupCommand=!!s,n.setupResult=s??void 0})),e.devCommand!==void 0?i.push(r.setDevCommand(e.devCommand??void 0,e.forceDevCommand||n.env).then(s=>{n.devCommand=s.status==="success",n.devResult=s??void 0})):(e.forceDevCommand||n.env)&&i.push(r?.restart().then(s=>{n.devCommand=!0,n.devResult=s??void 0})),e.autoDetectDevServer!==void 0&&i.push(r.setAutoDetectSettings(e.autoDetectDevServer,e.autoDetectDevServerPatterns).then(s=>n.proxyServer=n.proxyServer||s)),e.validateCommand!==void 0&&i.push(r.runValidateCommand(e.validateCommand).then(s=>n.validateResult=s)),await Promise.allSettled(i),n.env){let s=!1;for(let o of this.#b.values())(o.state==="running"||o.state==="starting")&&(o.stale=!0,s=!0);s&&this.#he()}}return n}#
|
|
1920
|
+
${U}`}}this.#pt({gif_id:f.gif_id,gif_frames:Qe,timeline_id:pe,recording_id:f.recording_id,...i.replayId?{replay_id:i.replayId,replay_url:`${ke}/replay/${i.replayId}`}:{}},!1)}catch(Ae){this.#r.warn(`[${o}] Failed to generate recording (non-critical): ${Ae instanceof Error?Ae.message:String(Ae)}`),this.#e.Sentry?.captureException(Ae,{level:"warning",tags:{component:"gif-generator",operation:"generateGifFromImages",subagent_type:o},extra:{sessionId:a.getSessionId(),frameCount:m.getFrameCount()}})}let me={success:!0,response:U,metadata:f,sessionId:p,lastTurn:O};return l(me),me}catch(J){let O={success:!1,response:`Agent task failed: ${J instanceof Error?J.message:String(J)}`,metadata:{important_files:[]}};return l(O),O}finally{u||l(B("finally_safety_net")),clearTimeout(y),this.#Je.delete(A),g.removeEventListener("abort",Y);try{await G()}catch(J){this.#r.warn(`[${o}] Cleanup failed: ${J instanceof Error?J.message:String(J)}`)}if(i.resetAfterRun&&s)try{await this.resetToCommitHash(s,!1)}catch(J){this.#r.warn(`[${o}] Failed to reset changes: ${J instanceof Error?J.message:String(J)}`)}}}getRunningSubAgents(){return Array.from(this.#Je.entries()).map(([e,r])=>({id:e,description:r.description,startedAt:r.startedAt}))}canHandleTool(e){let n=(this.#H.get(e)??0)>0,i=this.#W.has(e);return n||i}setSessionCanHandleTools(e){for(let r of e)this.#W.add(r)}clearSessionCanHandleTools(){this.#W.clear()}setProxyOrigin(e,r){if(e!==this.#Oe||r!==this.#Ke){this.#Oe=e,this.#Ke=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#hr(e,r,n){let i=this.getProxyConfig();if(i.proxyOrigin&&!i.proxyDestination)return;let s=await lA(this.#o,"/codegen/get-browser-connection",{sessionId:e,projectId:this.#I,branchName:this.#y,proxyOrigin:i.proxyOrigin,proxyDefaultOrigin:i.proxyDefaultOrigin,proxyDst:i.proxyDestination,recordReplay:n?.recordReplay===!0},{signal:r,debug:this.#a});if(typeof s?.wsUrl=="string")return{wsUrl:s.wsUrl,uuid:s.uuid,disconnectUrl:s.disconnectUrl}}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.#f?.runSetupCommand()}abortSetupCommand(){return this.#f?.abortSetupCommand()}abortValidateCommand(){return this.#f?.abortValidateCommand()}toolsRunning(){return this.#z.length>0}abortAllTools(){for(let e of this.#z)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.#te.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.#te.clear()}fulfillToolCall(e,r){let n=this.#te.get(e);return n?(n.resolve(r),this.#te.delete(e),!0):!1}abortToolCall(e,r){let n=this.#z.find(s=>s.id===e),i=$r(r??"The user manually aborted the tool call.");if(n)return n.abortController.abort(i),!0;if(this.#z.length===0){let s=new AbortController;return s.abort(i),this.#z.push({id:e,abortController:s,input:{id:e},name:"bash"}),!0}return!1}async acceptCode(){if(this.#ft()){let e=this.getLinesStats();await this.sendFeedback({position:this.#h,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.#je=0,this.clearMessageQueue()),this.#Pe=!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.#v?.abort(),this.#v=void 0,this.#s&&this.#s()}requestRefresh(){this.#g.emit("step",{type:"builder-action",action:"refresh",metadata:{}})}async configureDevOrchestrator(e){let r=this.#f,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(([s,o])=>{r.setEnvVariable(s,o??void 0)&&(n.env=!0)}),this.queueSystemReminder({text:`The system has the following environment variables:
|
|
1921
|
+
${kle(r.environmentVariables)}`,tag:"reminder:environment-variables"})),e.proxyServer?i.push(r?.setProxyServer(e.proxyServer).then(s=>{n.proxyServer=s.updatedProxyServer,n.hosts=s.updatedHosts})):e.proxyPort&&i.push(r?.setPort(e.proxyPort).then(s=>n.proxyServer=s)),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(s=>{n.setupCommand=!!s,n.setupResult=s??void 0})):(e.forceSetupCommand||n.fileOverrides||n.env&&r.setupState!=="installed")&&i.push(r?.runSetupCommand().then(s=>{n.setupCommand=!!s,n.setupResult=s??void 0})),e.devCommand!==void 0?i.push(r.setDevCommand(e.devCommand??void 0,e.forceDevCommand||n.env).then(s=>{n.devCommand=s.status==="success",n.devResult=s??void 0})):(e.forceDevCommand||n.env)&&i.push(r?.restart().then(s=>{n.devCommand=!0,n.devResult=s??void 0})),e.autoDetectDevServer!==void 0&&i.push(r.setAutoDetectSettings(e.autoDetectDevServer,e.autoDetectDevServerPatterns).then(s=>n.proxyServer=n.proxyServer||s)),e.validateCommand!==void 0&&i.push(r.runValidateCommand(e.validateCommand).then(s=>n.validateResult=s)),await Promise.allSettled(i),n.env){let s=!1;for(let o of this.#b.values())(o.state==="running"||o.state==="starting")&&(o.stale=!0,s=!0);s&&this.#he()}}return n}#mr(){for(let e of Array.from(this.#b.keys()))try{this.disposeTerminal({terminalId:e})}catch{}this.#b.clear()}async#dt(){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}}#Cr(){if(this.#Q.watcher)return;let e=this.#d.map(A=>A.path),r=new Map;for(let A of this.#d)r.set(A.path,ZG(A.path));let n=A=>{for(let c of this.#d)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.#Ht(u))return!0;let l=r.get(c);return l?l(u):!1},s,o=!1;try{s=cle.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.#d.length>1&&u){let g=this.#d.find(p=>p.path===u);g&&!this.#T()&&(l=`${g.folderName}/${l}`)}let d={type:"folder-watch",watchId:"global",event:A,path:l,timestamp:Date.now()};this.#Q.pendingEvents.push(d),this.#Q.debounceTimer&&clearTimeout(this.#Q.debounceTimer),this.#Q.debounceTimer=setTimeout(()=>{let g=this.#Q.pendingEvents;this.#Q.pendingEvents=[];for(let p of g)for(let f of this.#Q.listeners)try{f(p)}catch(m){this.#e.Sentry?.captureException(m)}},this.#Q.debounceMs)};s.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=>{o||(o=!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.#dt().catch(()=>{}))}),this.#Q.watcher=s,this.#r.debug(`Initialized global file watcher on: ${e.join(", ")}`)}subscribeToFileChanges(e){return this.#Q.listeners.size===0&&this.#Cr(),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.#dt(),this.#r.debug("Closed global file watcher (no more listeners)"))}}async tsServerInit(){try{return this.#l?{ok:!0,cwd:this.#m}:(this.#l=new s0(this.#m),this.#l.setEventHandler(e=>{for(let r of this.#qe)r(e)}),await this.#l.start(),{ok:!0,cwd:this.#m})}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,s,o){return this.#l?this.#l.getCodeFixes(e,r,n,i,s,o):{success:!1,body:null}}async tsServerGetApplicableRefactors(e,r,n,i,s){return this.#l?this.#l.getApplicableRefactors(e,r,n,i,s):{success:!1,body:null}}async tsServerGetEditsForRefactor(e,r,n,i,s,o,a){return this.#l?this.#l.getEditsForRefactor(e,r,n,i,s,o,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,s){return this.#l?this.#l.getFormatRange(e,r,n,i,s):{success:!1,body:null}}subscribeToDiagnostics(e){return this.#qe.add(e),()=>{this.#qe.delete(e)}}async close(e=!1){if(!this.#Ge){if(this.#Ge=!0,this.#p&&(delete process.env.DEBUG,this.#p=!1),this.#Me.forEach(r=>r()),this.#mr(),await this.#dt(),this.#l&&(this.#l.dispose(),this.#l=null),this.#qe.clear(),this.#ye)try{this.#r.debug("Cleaning up local MCP servers"),await this.#ye.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#F(){if(this.#d.length===0||this.#Ye)return null;let r=(await this.#q(async i=>this.#Er(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.#Te=r,this.#K(this.#Ir(r),"updateBranchUnpushedStatus",!1),r.some(i=>i.hasMergeConflict)&&await this.#Ce(),r[0]}async#Ir(e){if(!this.#I||!this.#y||!this.#o.builderPublicKey||!this.#o.userId||!this.#o.builderPrivateKey)return;let r=e.some(n=>n.ahead>0||n.isSessionDirty);try{let n=new URL("/projects/branches",ke);n.searchParams.set("apiKey",this.#o.builderPublicKey),n.searchParams.set("userId",this.#o.userId),n.searchParams.set("projectId",this.#I),n.searchParams.set("branchName",this.#y);let i=await Fe(n,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#o.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",ke);this.#o.builderPublicKey&&r.searchParams.set("apiKey",this.#o.builderPublicKey),this.#o.userId&&r.searchParams.set("userId",this.#o.userId);let n=await Fe(r,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#o.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.#Te.length===0||this.#_||this.#w!=="quality-v4")return;let r=this.#Te.map(n=>Rle(n,this.gitEnabledFolders,e));this.queueSystemReminder({text:r.join(`
|
|
1922
1922
|
|
|
1923
|
-
`),tag:"reminder:git-status"})}async manualCommit(e){if(!this.#C)return!1;let r=this.getSessionContext();if(!r.beforeCommit){let n=await this.#G();Object.keys(n).length>0&&(r.beforeCommit=no(n))}return await this.commitWorkInProgress(e.commitMessage,[e.add]),await this.#ne(!0),!0}getLastSuggestedAction(){return this.#se}async#Ce(){let e=this.getSessionContext();if(e.state==="generating"||e.state==="close")return this.#se=void 0,!1;let r=await this.#ct(!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.#de,modelOverride:this.#j}),!0):!1}async#Ir(e){this.#Qe++;try{let r=this.getCommitMode(),n=this.#C?this.getFeatureBranch():e.branchName,i=this.#fe(e),s=e.path,o=e.folderName===this.#d[0]?.folderName,a=this.getSessionContext(),A=!1,c=!1,u="",l=null;try{let E=await this.git(["rev-parse","--absolute-git-dir"],{cwd:s});l=this.#e.join(E.trim(),"FETCH_HEAD"),$u.default.existsSync(l)&&$u.default.unlinkSync(l)}catch(E){this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchHeadFilePath:l,isCheckingGitStatus:this.#Qe,folderName:e.folderName}}),l=null}try{u=await this.git(["fetch","--no-tags","origin",i],{cwd:s}),A=!0}catch{A=!1}let d=await this.#e.getRepoInfo(s),g=Du(a.beforeCommit,e.folderName,this.gitRepoContexts[0]?.folderName);!o&&!e.initialCommit&&d.commit&&(e.initialCommit=d.commit),!g&&e.initialCommit&&(g=e.initialCommit);let p=this.#ft(e.folderName),f=p?1:0,m=0;if(A){if(n!==i)try{await this.git(["--no-pager","diff","--quiet",`refs/remotes/origin/${n}...refs/remotes/origin/${i}`],{cwd:s}),c=!1}catch{c=!0}else c=!0;try{let E=wle(await this.git(["rev-list","--left-right","--count","HEAD...FETCH_HEAD"],{cwd:s}));f=E.ahead,m=E.behind}catch(E){let y=null;if(l)try{y=await this.#e.readFile(this.#e.join(s,".git/FETCH_HEAD")),y=`FETCH_HEAD: ${y} `}catch(Q){y=`FETCH_HEAD FAILED: ${String(Q)} `}else y="FETCH_HEAD MISSING";this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchOutput:u,fetchHead:y,remoteBranch:i,currentBranch:d.currentBranch,currentCommit:d.commit,isCheckingGitStatus:this.#Qe,folderName:e.folderName}})}}else!A&&r!=="commits"&&g&&g!==d.commit&&(f=Math.max(f,1));let C=await this.#Z(s),I=C.length>0,B=await this.#vr(s);return{type:"git",folderName:e.folderName,remoteBranchExists:A,remoteBranchHasChanges:c,hasGeneratingPlaceholder:await this.#br(),isSessionDirty:p||!!g&&g!==d.commit,canSync:(f>0||m>0||B)&&!I,canPush:(f>0||m>0)&&!I,hasStagedChanges:B,canPull:m>0&&A,ahead:f,hasMergeConflict:I,commitMode:r,behind:m,currentCommit:d.commit,currentBranch:d.currentBranch,pendingValidation:this.#re,remoteBranch:i,unmergedFiles:C}}finally{this.#Qe--}}#Ut(){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:Nw(this.#u),hasBrowserAutomation:e.customAgents.some(r=>r.name==="browser-testing"),customInstructions:e.customInstructions.filter(r=>!r.hideUI&&(r.userInvocable??!0)).map(r=>({name:r.name,description:r.description??"",type:r.type??"always",glob:r.glob,isSkill:r.isSkill??r.filePath?.toLowerCase().includes("/skills/")??!1,userInvocable:r.userInvocable})),hasPlanToApply:this.#de}}#Gt(){let e=this.getSessionContext(),r=e.turns,n=[];n.push(this.#Ut()),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(s=>({idempotencyKey:s.idempotencyKey,displayPrompt:s.displayPrompt,user:s.user}))});let i;for(let s of r){n.push({type:"user",previousId:i,displayPrompt:s.userMessage?s.userMessage.displayPrompt??s.userMessage.userPrompt:void 0,attachments:s.userMessage?.attachments,id:s.completionId,user:s.user,role:s.user.role,compacting:!1,idempotencyKey:s.userMessage?.idempotencyKey??"",sessionMode:e.sessionMode}),i=s.completionId;for(let o of s.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 a=JSON.parse(o.content);if(o.filePath==="UpdateSetupValue")n.push({type:"update_setup_value",field:a.field,value:a.value,reason:a.reason});else{let A=a.config,c=A!=null&&!A.installCommand?.command&&(!A.runtimeDependencies||A.runtimeDependencies.length===0);n.push({type:"propose_config",config:A,message:a.message,noDependencies:c})}}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 s=[],o=this.getSessionContext();s.push({type:"state",newState:"replay",abortable:!1,previousState:o.state}),this.#Ze&&s.push(this.#Ze),s.push(...this.#Te),s.push(...this.#Gt()),this.#te.forEach(c=>{s.push({type:"tool-call-request",id:c.id,name:c.name,input:c.input})});let a=this.#Be?uA(this.#Be):void 0;if(a)switch(a.type){case"file":case"diff":case"text":case"thinking":case"suggestion":case"tool":s.push({type:"start",id:a.id,name:a.type,filePath:a.filePath??"",title:a.actionTitle??a.artifactTitle??"",content:""}),s.push({type:"delta",name:a.type,delta:a.content});break}s.push({type:"terminals",terminals:this.#gt()});let A=this.#f;A?(s.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"&&s.push({type:"stdio",id:"setupCommand",command:A.setupCommand??"",content:A.getSetupWrite(),source:"run-command",stream:"stdout"}),s.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"}),s.push({type:"state",newState:o.state,abortable:o.state==="generating",previousState:"replay"}),this.#ie&&o.state!=="generating"&&s.push({type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:o.state,suggestion:this.#se,sessionMode:o.sessionMode,hasPlanToApply:this.#de}),r({type:"batch",steps:s})}this.#g.on("step",r);for(let s of i)this.#H.set(s,(this.#H.get(s)??0)+1);return this.waitForEventLoop(),()=>{this.#g.off("step",r);for(let s of i)this.#H.set(s,(this.#H.get(s)??0)-1)}}waitUntilPendingPromises(e){let r=ca();return this.#r.debug(`(waitUntilPendingPromises-${r}): started`),ZA(Promise.allSettled(this.#le),e).then(()=>Qu()).then(()=>{this.#r.debug(`(waitUntilPendingPromises-${r}): finished`)})}waitUntilBlockingPendingPromises(e){let r=ca();return this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): started`),ZA(Promise.allSettled(this.#He),e).then(()=>Qu()).then(()=>{this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): finished`)})}waitUntilIdle(e){let r=ca();return this.waitForEventLoop(),this.#r.debug(`(waitUntilIdle-${r}): started`),ZA(Qu().then(()=>this.waitUntilPendingPromises()).then(()=>{let n=this.getSessionContext();return this.#r.debug(`(waitUntilIdle-${r}): starting in ${n.state} `),n.state==="generating"?(0,Gb.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#Ot(e){let r=this.#f;if(!r)throw new Error("Dev server not found");let n=await r.runValidateCommand(void 0,e);return n.status==="success"&&(this.#re=!1,this.#C&&(await this.#lt()).length===0&&(await this.#ht()||await this.manualCommit({add:".",commitMessage:"Validate command fixes"}))),n}waitForEventLoop(){return this.#ie?this.#ie:this.#ie=this.#Er()}async#Er(){if(this.#ie||this.#v)throw new Error("Event loop already started");this.#r.debug("(eventLoop): started");let e=Dle(),r=c=>{c.type==="error"&&this.#ue>0&&(Ale.includes(c.code)||(c.restoreCredits=this.#ue,this.#ue=0,mle(this.#e,this.#o,s.sessionId,c.restoreCredits).catch(l=>{this.#e.Sentry?.captureException(l)})));let u=["ExitPlanMode","TodoWrite","TaskCreate","TaskUpdate"];if(c.type==="tool_result"&&u.includes(c.result.tool_name)&&(this.#r.debug("emitting ClientDevtoolsToolResultV1",{toolName:c.result.tool_name,projectId:this.#I,branchName:this.#y}),lA(this.#o,"/events/publish",{event:Cre,extraData:{toolUseId:c.result.tool_use_id,toolName:c.result.tool_name??"",result:c.result.content,isError:c.result.is_error,sessionId:s.sessionId,projectId:this.#I,branchName:this.#y},extraAttributes:{toolName:c.result.tool_name??"",projectId:this.#I,branchName:this.#y}},{debug:this.#a})),c.type==="tool"&&c.name==="Agent"){let l;try{l=JSON.parse(c.content)?.description}catch{}let d=JSON.stringify({description:l});this.#r.debug("emitting ClientDevtoolsToolCallV1",{toolName:c.name,projectId:this.#I,branchName:this.#y}),lA(this.#o,"/events/publish",{event:mre,extraData:{toolUseId:c.id,toolName:c.name,content:d,sessionId:s.sessionId,projectId:this.#I,branchName:this.#y},extraAttributes:{toolName:c.name,projectId:this.#I,branchName:this.#y}},{debug:this.#a})}this.#g.emit("step",c)};this.#v=new AbortController;let n=this.#v.signal,i=this.#f,s=this.getSessionContext(),o=()=>this.getLastCompletionId();this.#e.Sentry?.setContext("codeGen",{sessionId:s.sessionId,get completionId(){return o()}}),await this.#K(this.#F(),"initial-emitGitStatus");let a=setInterval(()=>{this.canHandleTool("GetScreenshot")&&(this.#Qe>0||this.#F().catch(()=>{}))},6e4),A=()=>clearInterval(a);if(this.#Me.push(A),process.env.FUSION_IDE_PORT){let c=setInterval(()=>{Vre().then(u=>{let l=JSON.stringify(u);l!==this.#It&&(this.#It=l,this.#g.emit("step",{type:"ide",context:u}),this.queueSystemReminder({text:u?zre(u):"",tag:"reminder:ide-context"}))}).catch(()=>{})},1e3);this.#Me.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.#dr();if(this.#r.debug(`(eventLoop-${c}): started (shouldWait: ${u.shouldWait})`),u.shouldWait){await this.#Lt();let g=await this.#Ce();if(n.aborted)break;g&&vle(u.promise,500).then(p=>{p&&(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 d=gn([n,this.#c.signal]);try{if(this.#se=void 0,l.logsCheckpoint&&i?.addCheckpoint(),d?.aborted)throw $r(d.reason);this.#$("generating"),i?.abortValidateCommand(),l.syncChanges&&(this.#r.debug(`(eventLoop-${c}): syncing changes from remote`),await this.syncChangesFromRemote(l.syncChanges),await this.#ct(!1,"critical")),l.sessionMode&&l.sessionMode!==s.sessionMode&&this.switchSessionMode(l.sessionMode),await this.#Br(l,d,r),this.#$("success");let g=l.autoPush??this.#J??"none";if(g!=="none"&&this.#C&&(this.#r.debug(`(eventLoop-${c}): autoPush: ${g}`),await this.waitUntilBlockingPendingPromises(),(await this.#lt()).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.#d.length>1)for(let m of this.#d)await this.#Ne({...f,folderName:m.folderName});else await this.#Ne(f)}this.#se=void 0}catch(g){g instanceof Error?g.name==="AbortError"?(r({type:"user-abort",hasContinueMessage:this.#t.length>0}),this.#$("abort")):g instanceof Ye?(this.#i=void 0,r({type:"error",code:"cli-network-error",message:g.message}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):g instanceof ft?(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.#$("error")):g instanceof jn?(this.#i=void 0,r({type:"error",code:g.code,message:g.message}),Ale.includes(g.code)||this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("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.#$("error")):this.#$("error")}this.#Ht++}}catch(c){throw this.#e.Sentry?.captureException(c,{level:"fatal"}),c}finally{A(),this.#v=void 0,this.#ie=void 0,e()}this.#r.debug("(eventLoop): emitting idle on close"),this.#g.emit("idle"),this.#$("close")}async#Br(e,r,n){this.#ue=0,this.#re=!1;let i=this.getSessionContext(),s=e.displayPrompt||e.userPrompt||"";s&&this.#At.push(s);let o;if(e.agentType&&e.agentType!==this.#_){let Q=await this.getNamedAgentConfig(e.agentType,this.getSessionId(),r);Q.success&&(o={enabledTools:this.#D,modelOverride:this.#j,mode:this.#w,systemPromptOverride:this.#oe,position:this.#h,includeMemories:this.#k},this.#D=Q.options.enabledTools,this.#j=Q.options.modelOverride,this.#w=Q.options.mode,this.#oe=Q.options.systemPromptOverride,this.#h=Q.options.position,this.#k=Q.options.includeMemories)}let a=e.maxCompletions??this.#u?.maxAgentCompletions,A=a??Ob,c=a??ple,u=0,l=0,d=!0,g=!1,p=!1,f=!1,m,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 $r(r.reason);try{if(this.cancelAllPendingToolFulfilments(),m||(m=await this.#Dr(e,d,r,n),m.modelOverride=e.modelOverride,m.reasoning=e.reasoning,m.agentModelOverrides=e.agentModelOverrides),m.user.role==="user"){let w=m.files.filter(D=>(D.importance??0)>2.5&&D.content).map(D=>({filePath:D.filePath,size:D.content?.length??0,isCustomInstruction:!1,wasIncluded:D.wasIncluded}));i.customInstructions.forEach(D=>{D.filePath&&D.type==="always"&&w.push({filePath:D.filePath,size:D.content?.length??0,isCustomInstruction:!0,wasIncluded:!0})}),n({type:"user-input",prompt:m.userMessage?.displayPrompt??m.userPrompt,files:w})}try{let w=await this.#yr(i,m,r,n),{shouldContinue:D,completions:x,filesChanged:S}=w;if(this.#a&&this.#r.debug(`(agentCompletion-${E}): completion: ${JSON.stringify(w)}`),d=!1,m=void 0,u=0,g||=S,p||=S,f||=w.navigatePreviewCalled,l+=x,this.#re||=S,this.#i=void 0,S&&this.#f?.addCheckpoint(),r?.aborted)throw $r(r.reason);let{hasHealthIssue:v}=await this.#Wt();if(!D){if(r?.aborted)throw $r(r.reason);let P=this.getSessionMode();if((P==="planning"||P==="auto-planning")&&!this.#de&&!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(v&&I<3){this.#r.debug(`(agentCompletion-${E}): has health issue, continuing`),I++;continue}let $=this.#pr();if($?.syncChanges&&await this.syncChangesFromRemote($.syncChanges),$){this.#r.debug(`(agentCompletion-${E}): consumed queued messages`),d=!0,e=$,l=0;continue}let H=this.#f,M=e.runValidateCommand??!0;if(H?.validateCommand&&M&&C<2&&this.#re){p=!0,C++,n({type:"start",name:"validate-command",id:"validate-command",title:"Validate Command",content:""});let G=e.autoPush;this.#r.debug(`(agentCompletion-${E}): running validate command`),this.#Ot(r).then(Y=>{if(this.#r.debug(`(validate-command): result status ${Y.status}`),Y.status==="failure"&&Y.code){let J=Y.output?Xo(Y.output,100,500):"";this.sendMessage({user:e.user,maxCompletions:e.maxCompletions,runValidateCommand:!0,userPrompt:`The validate command failed with code ${Y.code}):
|
|
1923
|
+
`),tag:"reminder:git-status"})}async manualCommit(e){if(!this.#C)return!1;let r=this.getSessionContext();if(!r.beforeCommit){let n=await this.#G();Object.keys(n).length>0&&(r.beforeCommit=no(n))}return await this.commitWorkInProgress(e.commitMessage,[e.add]),await this.#ne(!0),!0}getLastSuggestedAction(){return this.#se}async#Ce(){let e=this.getSessionContext();if(e.state==="generating"||e.state==="close")return this.#se=void 0,!1;let r=await this.#ct(!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.#de,modelOverride:this.#j}),!0):!1}async#Er(e){this.#Qe++;try{let r=this.getCommitMode(),n=this.#C?this.getFeatureBranch():e.branchName,i=this.#fe(e),s=e.path,o=e.folderName===this.#d[0]?.folderName,a=this.getSessionContext(),A=!1,c=!1,u="",l=null;try{let E=await this.git(["rev-parse","--absolute-git-dir"],{cwd:s});l=this.#e.join(E.trim(),"FETCH_HEAD"),$u.default.existsSync(l)&&$u.default.unlinkSync(l)}catch(E){this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchHeadFilePath:l,isCheckingGitStatus:this.#Qe,folderName:e.folderName}}),l=null}try{u=await this.git(["fetch","--no-tags","origin",i],{cwd:s}),A=!0}catch{A=!1}let d=await this.#e.getRepoInfo(s),g=Du(a.beforeCommit,e.folderName,this.gitRepoContexts[0]?.folderName);!o&&!e.initialCommit&&d.commit&&(e.initialCommit=d.commit),!g&&e.initialCommit&&(g=e.initialCommit);let p=this.#ft(e.folderName),f=p?1:0,m=0;if(A){if(n!==i)try{await this.git(["--no-pager","diff","--quiet",`refs/remotes/origin/${n}...refs/remotes/origin/${i}`],{cwd:s}),c=!1}catch{c=!0}else c=!0;try{let E=wle(await this.git(["rev-list","--left-right","--count","HEAD...FETCH_HEAD"],{cwd:s}));f=E.ahead,m=E.behind}catch(E){let y=null;if(l)try{y=await this.#e.readFile(this.#e.join(s,".git/FETCH_HEAD")),y=`FETCH_HEAD: ${y} `}catch(Q){y=`FETCH_HEAD FAILED: ${String(Q)} `}else y="FETCH_HEAD MISSING";this.#e.Sentry?.captureException(E,{tags:{operation:"codegen-git",endpoint:"getGitStatus"},extra:{fetchOutput:u,fetchHead:y,remoteBranch:i,currentBranch:d.currentBranch,currentCommit:d.commit,isCheckingGitStatus:this.#Qe,folderName:e.folderName}})}}else!A&&r!=="commits"&&g&&g!==d.commit&&(f=Math.max(f,1));let C=await this.#Z(s),I=C.length>0,B=await this.#xr(s);return{type:"git",folderName:e.folderName,remoteBranchExists:A,remoteBranchHasChanges:c,hasGeneratingPlaceholder:await this.#Sr(),isSessionDirty:p||!!g&&g!==d.commit,canSync:(f>0||m>0||B)&&!I,canPush:(f>0||m>0)&&!I,hasStagedChanges:B,canPull:m>0&&A,ahead:f,hasMergeConflict:I,commitMode:r,behind:m,currentCommit:d.commit,currentBranch:d.currentBranch,pendingValidation:this.#re,remoteBranch:i,unmergedFiles:C}}finally{this.#Qe--}}#Gt(){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:Nw(this.#u),hasBrowserAutomation:e.customAgents.some(r=>r.name==="browser-testing"),customInstructions:e.customInstructions.filter(r=>!r.hideUI&&(r.userInvocable??!0)).map(r=>({name:r.name,description:r.description??"",type:r.type??"always",glob:r.glob,isSkill:r.isSkill??r.filePath?.toLowerCase().includes("/skills/")??!1,userInvocable:r.userInvocable})),hasPlanToApply:this.#de}}#Ot(){let e=this.getSessionContext(),r=e.turns,n=[];n.push(this.#Gt()),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(s=>({idempotencyKey:s.idempotencyKey,displayPrompt:s.displayPrompt,user:s.user}))});let i;for(let s of r){n.push({type:"user",previousId:i,displayPrompt:s.userMessage?s.userMessage.displayPrompt??s.userMessage.userPrompt:void 0,attachments:s.userMessage?.attachments,id:s.completionId,user:s.user,role:s.user.role,compacting:!1,idempotencyKey:s.userMessage?.idempotencyKey??"",sessionMode:e.sessionMode}),i=s.completionId;for(let o of s.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 a=JSON.parse(o.content);if(o.filePath==="UpdateSetupValue")n.push({type:"update_setup_value",field:a.field,value:a.value,reason:a.reason});else{let A=a.config,c=A!=null&&!A.installCommand?.command&&(!A.runtimeDependencies||A.runtimeDependencies.length===0);n.push({type:"propose_config",config:A,message:a.message,noDependencies:c})}}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 s=[],o=this.getSessionContext();s.push({type:"state",newState:"replay",abortable:!1,previousState:o.state}),this.#Ze&&s.push(this.#Ze),s.push(...this.#Te),s.push(...this.#Ot()),this.#te.forEach(c=>{s.push({type:"tool-call-request",id:c.id,name:c.name,input:c.input})});let a=this.#Be?uA(this.#Be):void 0;if(a)switch(a.type){case"file":case"diff":case"text":case"thinking":case"suggestion":case"tool":s.push({type:"start",id:a.id,name:a.type,filePath:a.filePath??"",title:a.actionTitle??a.artifactTitle??"",content:""}),s.push({type:"delta",name:a.type,delta:a.content});break}s.push({type:"terminals",terminals:this.#gt()});let A=this.#f;A?(s.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"&&s.push({type:"stdio",id:"setupCommand",command:A.setupCommand??"",content:A.getSetupWrite(),source:"run-command",stream:"stdout"}),s.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"}),s.push({type:"state",newState:o.state,abortable:o.state==="generating",previousState:"replay"}),this.#ie&&o.state!=="generating"&&s.push({type:"wait-for-input",id:this.getLastCompletionId()??"initial",state:o.state,suggestion:this.#se,sessionMode:o.sessionMode,hasPlanToApply:this.#de}),r({type:"batch",steps:s})}this.#g.on("step",r);for(let s of i)this.#H.set(s,(this.#H.get(s)??0)+1);return this.waitForEventLoop(),()=>{this.#g.off("step",r);for(let s of i)this.#H.set(s,(this.#H.get(s)??0)-1)}}waitUntilPendingPromises(e){let r=ca();return this.#r.debug(`(waitUntilPendingPromises-${r}): started`),ZA(Promise.allSettled(this.#le),e).then(()=>Qu()).then(()=>{this.#r.debug(`(waitUntilPendingPromises-${r}): finished`)})}waitUntilBlockingPendingPromises(e){let r=ca();return this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): started`),ZA(Promise.allSettled(this.#He),e).then(()=>Qu()).then(()=>{this.#r.debug(`(waitUntilBlockingPendingPromises-${r}): finished`)})}waitUntilIdle(e){let r=ca();return this.waitForEventLoop(),this.#r.debug(`(waitUntilIdle-${r}): started`),ZA(Qu().then(()=>this.waitUntilPendingPromises()).then(()=>{let n=this.getSessionContext();return this.#r.debug(`(waitUntilIdle-${r}): starting in ${n.state} `),n.state==="generating"?(0,Gb.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#Kt(e){let r=this.#f;if(!r)throw new Error("Dev server not found");let n=await r.runValidateCommand(void 0,e);return n.status==="success"&&(this.#re=!1,this.#C&&(await this.#lt()).length===0&&(await this.#ht()||await this.manualCommit({add:".",commitMessage:"Validate command fixes"}))),n}waitForEventLoop(){return this.#ie?this.#ie:this.#ie=this.#Br()}async#Br(){if(this.#ie||this.#v)throw new Error("Event loop already started");this.#r.debug("(eventLoop): started");let e=Dle(),r=c=>{c.type==="error"&&this.#ue>0&&(Ale.includes(c.code)||(c.restoreCredits=this.#ue,this.#ue=0,mle(this.#e,this.#o,s.sessionId,c.restoreCredits).catch(l=>{this.#e.Sentry?.captureException(l)})));let u=["ExitPlanMode","TodoWrite","TaskCreate","TaskUpdate"];if(c.type==="tool_result"&&u.includes(c.result.tool_name)&&(this.#r.debug("emitting ClientDevtoolsToolResultV1",{toolName:c.result.tool_name,projectId:this.#I,branchName:this.#y}),lA(this.#o,"/events/publish",{event:Cre,extraData:{toolUseId:c.result.tool_use_id,toolName:c.result.tool_name??"",result:c.result.content,isError:c.result.is_error,sessionId:s.sessionId,projectId:this.#I,branchName:this.#y},extraAttributes:{toolName:c.result.tool_name??"",projectId:this.#I,branchName:this.#y}},{debug:this.#a})),c.type==="tool"&&c.name==="Agent"){let l;try{l=JSON.parse(c.content)?.description}catch{}let d=JSON.stringify({description:l});this.#r.debug("emitting ClientDevtoolsToolCallV1",{toolName:c.name,projectId:this.#I,branchName:this.#y}),lA(this.#o,"/events/publish",{event:mre,extraData:{toolUseId:c.id,toolName:c.name,content:d,sessionId:s.sessionId,projectId:this.#I,branchName:this.#y},extraAttributes:{toolName:c.name,projectId:this.#I,branchName:this.#y}},{debug:this.#a})}this.#g.emit("step",c)};this.#v=new AbortController;let n=this.#v.signal,i=this.#f,s=this.getSessionContext(),o=()=>this.getLastCompletionId();this.#e.Sentry?.setContext("codeGen",{sessionId:s.sessionId,get completionId(){return o()}}),await this.#K(this.#F(),"initial-emitGitStatus");let a=setInterval(()=>{this.canHandleTool("GetScreenshot")&&(this.#Qe>0||this.#F().catch(()=>{}))},6e4),A=()=>clearInterval(a);if(this.#Me.push(A),process.env.FUSION_IDE_PORT){let c=setInterval(()=>{Vre().then(u=>{let l=JSON.stringify(u);l!==this.#It&&(this.#It=l,this.#g.emit("step",{type:"ide",context:u}),this.queueSystemReminder({text:u?zre(u):"",tag:"reminder:ide-context"}))}).catch(()=>{})},1e3);this.#Me.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.#fr();if(this.#r.debug(`(eventLoop-${c}): started (shouldWait: ${u.shouldWait})`),u.shouldWait){await this.#_t();let g=await this.#Ce();if(n.aborted)break;g&&vle(u.promise,500).then(p=>{p&&(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 d=gn([n,this.#c.signal]);try{if(this.#se=void 0,l.logsCheckpoint&&i?.addCheckpoint(),d?.aborted)throw $r(d.reason);this.#$("generating"),i?.abortValidateCommand(),l.syncChanges&&(this.#r.debug(`(eventLoop-${c}): syncing changes from remote`),await this.syncChangesFromRemote(l.syncChanges),await this.#ct(!1,"critical")),l.sessionMode&&l.sessionMode!==s.sessionMode&&this.switchSessionMode(l.sessionMode),await this.#yr(l,d,r),this.#$("success");let g=l.autoPush??this.#J??"none";if(g!=="none"&&this.#C&&(this.#r.debug(`(eventLoop-${c}): autoPush: ${g}`),await this.waitUntilBlockingPendingPromises(),(await this.#lt()).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.#d.length>1)for(let m of this.#d)await this.#Ne({...f,folderName:m.folderName});else await this.#Ne(f)}this.#se=void 0}catch(g){g instanceof Error?g.name==="AbortError"?(r({type:"user-abort",hasContinueMessage:this.#t.length>0}),this.#$("abort")):g instanceof Ye?(this.#i=void 0,r({type:"error",code:"cli-network-error",message:g.message}),this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("error")):g instanceof ft?(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.#$("error")):g instanceof jn?(this.#i=void 0,r({type:"error",code:g.code,message:g.message}),Ale.includes(g.code)||this.#e.Sentry?.captureException(g,{tags:{operation:"codegen-stream"}}),this.#$("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.#$("error")):this.#$("error")}this.#Jt++}}catch(c){throw this.#e.Sentry?.captureException(c,{level:"fatal"}),c}finally{A(),this.#v=void 0,this.#ie=void 0,e()}this.#r.debug("(eventLoop): emitting idle on close"),this.#g.emit("idle"),this.#$("close")}async#yr(e,r,n){this.#ue=0,this.#re=!1;let i=this.getSessionContext(),s=e.displayPrompt||e.userPrompt||"";s&&this.#At.push(s);let o;if(e.agentType&&e.agentType!==this.#_){let Q=await this.getNamedAgentConfig(e.agentType,this.getSessionId(),r);Q.success&&(o={enabledTools:this.#D,modelOverride:this.#j,mode:this.#w,systemPromptOverride:this.#oe,position:this.#h,includeMemories:this.#k},this.#D=Q.options.enabledTools,this.#j=Q.options.modelOverride,this.#w=Q.options.mode,this.#oe=Q.options.systemPromptOverride,this.#h=Q.options.position,this.#k=Q.options.includeMemories)}let a=e.maxCompletions??this.#u?.maxAgentCompletions,A=a??Ob,c=a??ple,u=0,l=0,d=!0,g=!1,p=!1,f=!1,m,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 $r(r.reason);try{if(this.cancelAllPendingToolFulfilments(),m||(m=await this.#wr(e,d,r,n),m.modelOverride=e.modelOverride,m.reasoning=e.reasoning,m.agentModelOverrides=e.agentModelOverrides),m.user.role==="user"){let w=m.files.filter(D=>(D.importance??0)>2.5&&D.content).map(D=>({filePath:D.filePath,size:D.content?.length??0,isCustomInstruction:!1,wasIncluded:D.wasIncluded}));i.customInstructions.forEach(D=>{D.filePath&&D.type==="always"&&w.push({filePath:D.filePath,size:D.content?.length??0,isCustomInstruction:!0,wasIncluded:!0})}),n({type:"user-input",prompt:m.userMessage?.displayPrompt??m.userPrompt,files:w})}try{let w=await this.#Qr(i,m,r,n),{shouldContinue:D,completions:x,filesChanged:S}=w;if(this.#a&&this.#r.debug(`(agentCompletion-${E}): completion: ${JSON.stringify(w)}`),d=!1,m=void 0,u=0,g||=S,p||=S,f||=w.navigatePreviewCalled,l+=x,this.#re||=S,this.#i=void 0,S&&this.#f?.addCheckpoint(),r?.aborted)throw $r(r.reason);let{hasHealthIssue:v}=await this.#zt();if(!D){if(r?.aborted)throw $r(r.reason);let P=this.getSessionMode();if((P==="planning"||P==="auto-planning")&&!this.#de&&!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(v&&I<3){this.#r.debug(`(agentCompletion-${E}): has health issue, continuing`),I++;continue}let $=this.#dr();if($?.syncChanges&&await this.syncChangesFromRemote($.syncChanges),$){this.#r.debug(`(agentCompletion-${E}): consumed queued messages`),d=!0,e=$,l=0;continue}let H=this.#f,M=e.runValidateCommand??!0;if(H?.validateCommand&&M&&C<2&&this.#re){p=!0,C++,n({type:"start",name:"validate-command",id:"validate-command",title:"Validate Command",content:""});let G=e.autoPush;this.#r.debug(`(agentCompletion-${E}): running validate command`),this.#Kt(r).then(Y=>{if(this.#r.debug(`(validate-command): result status ${Y.status}`),Y.status==="failure"&&Y.code){let J=Y.output?Xo(Y.output,100,500):"";this.sendMessage({user:e.user,maxCompletions:e.maxCompletions,runValidateCommand:!0,userPrompt:`The validate command failed with code ${Y.code}):
|
|
1924
1924
|
<validate_command>
|
|
1925
1925
|
${Y.command}
|
|
1926
1926
|
</validate_command>
|
|
@@ -1929,23 +1929,23 @@ ${Y.command}
|
|
|
1929
1929
|
${J}
|
|
1930
1930
|
</output>
|
|
1931
1931
|
|
|
1932
|
-
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:G})}})}break}}catch(w){throw await this.#F(),w}}catch(w){let D=function(x){return!!(x instanceof jn&&x.code==="abrupt-end"||x instanceof Error&&x.name==="HTTPStreamBroke"||x instanceof Ye&&[502,503].includes(x.statusCode??0)||x instanceof Ye&&!x.statusCode&&["connection_reset","connection_timeout","connection_aborted"].includes(x.type))};var y=D;if(u<3&&D(w)){this.#r.debug(`(agentCompletion-${E}): retrying error`,w),await og(u,r),u++;continue}throw w}finally{hle(i.turns)}}}finally{this.#r.debug(`(agentCompletion-${E}): finally block`),o&&(this.#D=o.enabledTools,this.#j=o.modelOverride,this.#w=o.mode,this.#oe=o.systemPromptOverride,this.#h=o.position,this.#k=o.includeMemories),await this.#ne(!0);let Q=this.#u?.refreshPreview??!0;g&&Q&&!f&&this.requestRefresh()}}async#
|
|
1933
|
-
${E.completionId}`,P),this.#C&&await this.#F(),this.#me({completionId:v.completionId,beforeCommit:v.beforeCommit}),i({type:"done",stopReason:S.stopReason,id:S.id,applyResults:v.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:$})}else{if(S.type==="continue")return y=S.autoContinue,Q=!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},D=S=>{if(S.type==="thinking"&&i({type:"thinking",content:S.content}),S.type==="server_tool_result"){let v;try{v=JSON.parse(S.content)}catch(P){this.#e.Sentry?.captureException(P,{extra:{contentPreview:S.content?.substring(0,500),contentLength:S.content?.length},tags:{operation:"server-tool-result-parse"}}),v=S.content}i({type:"server_tool_result",content:v,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})},x=(S,v)=>{i({type:"delta",name:S.type,delta:v})};for await(let S of B){if(S.type==="ping"){this.#r.debug(`(generateCompletion-${s}): ping`);continue}if(S.type==="delta"){let v=S.content,P=uA(u);P&&"content"in P&&(P.content+=v,x(P,v))}else{let v=uA(u);if(S.type==="thinking"&&v?.type==="thinking")continue;if(v&&"content"in v&&(v.incomplete=!1,D(v)),u.push(S),await w(S))break}}if(!Q)throw new jn("Completion stream ended abruptly","abrupt-end");if(!E)throw new jn("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.#Be=void 0}}async commitWorkInProgress(e,r){if(!this.#C)return;let n=this.#
|
|
1934
|
-
${e}`:this.#be=e}async#ne(e){if(!this.#C)return!1;let r=this.#be,n=this.#At,i=this.getLastTurn(),s=i?.completionId;this.#be=null,this.#At=[];let a=(async()=>{if(await this.#
|
|
1935
|
-
`).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.#G(),u=no(c);return u&&(this.#N={...this.#N,...c},i&&(i.afterCommit=u,i.lastCommit=u),this.#me({completionId:s,beforeCommit:i?.beforeCommit,afterCommit:u,lastCommit:u,commitFailed:!1})),e&&await this.#F(),A}catch(c){return this.#e.Sentry?.captureException(new Error(`Error in #commitAccumulatedChanges: ${c}`),{tags:{operation:"codegen-git-batch-commit"}}),A}})();return this.#
|
|
1932
|
+
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:G})}})}break}}catch(w){throw await this.#F(),w}}catch(w){let D=function(x){return!!(x instanceof jn&&x.code==="abrupt-end"||x instanceof Error&&x.name==="HTTPStreamBroke"||x instanceof Ye&&[502,503].includes(x.statusCode??0)||x instanceof Ye&&!x.statusCode&&["connection_reset","connection_timeout","connection_aborted"].includes(x.type))};var y=D;if(u<3&&D(w)){this.#r.debug(`(agentCompletion-${E}): retrying error`,w),await og(u,r),u++;continue}throw w}finally{hle(i.turns)}}}finally{this.#r.debug(`(agentCompletion-${E}): finally block`),o&&(this.#D=o.enabledTools,this.#j=o.modelOverride,this.#w=o.mode,this.#oe=o.systemPromptOverride,this.#h=o.position,this.#k=o.includeMemories),await this.#ne(!0);let Q=this.#u?.refreshPreview??!0;g&&Q&&!f&&this.requestRefresh()}}async#Qr(e,r,n,i){if(n.aborted)throw $r(n.reason);if(this.#Be)throw new Error("generateCompletion already started");let s=ca(),o=this.getLastTurn()?.nextUrl??this.#B,a=!1,A=0,c=!1;try{let u=this.#Be=[];if(!e.beforeCommit){let S=await this.#G();Object.keys(S).length>0&&(e.beforeCommit=no(S))}let l=await this.#G(),d=no(l),g=this.#nt;g&&this.#L?.enabled&&(g=!!this.#L.mcpServers);let p=r.userMessage?.uiContextPrompt;if(p&&!this.#T()){let S=this.#u?.workspace?.folders.find(v=>v.enableGit);S?.path&&(p=`Relative file paths are relative to: ${S.path}/`)}let f=this.#D,m={...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=m,this.#St=r.modelOverride,r.agentModelOverrides&&(this.#Ae=r.agentModelOverrides);let C=this.#ye?.listTools(),I={url:o,position:this.#h,eventName:"cli code",maxPages:2,autoContinue:1,codeGenMode:this.#w,userContext:m,systemReminders:r.systemReminders,files:r.files,skipFileDiff:this.#M,maxTokens:this.#yt,aclPolicy:this.#u?.accessControl,softContextWindow:this.#S,repoIndexingConfig:this.#u?.repoIndexingConfig??{designSystems:[]},recommendedRoot:this.#we,attachments:r.attachments,customInstructions:e.customInstructions,customAgents:e.customAgents.filter(S=>S.name!==this.#_).map(S=>({name:S.name,description:S.description})),systemPromptOverride:this.#oe,sessionId:e.sessionId,userPrompt:r.userPrompt,metadata:{...m.prNumber&&{PR_NUMBER:m.prNumber},...m.prHeadSha&&{PR_HEAD_SHA:m.prHeadSha},...m.repoFullName&&{REPO_FULL_NAME:m.repoFullName},...m.hostname&&{HOSTNAME:m.hostname},...m.containerUrl&&{CONTAINER_URL:m.containerUrl},...m.checkRunId&&{CHECK_RUN_ID:m.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.#k:void 0,projectId:this.#I,branchName:this.#y,repoHash:this.#Ue,repoBranch:this.#P,pingEvents:!0,workingDirectory:this.#x,beforeCommit:d,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.#Ie,maxAgentTiming:180*1e3,mcpServers:g,environmentVariables:ble(this.#u?.environmentVariables??[],this.#f?.environmentVariables??[]),redactUserMessages:this.#L?.redactUserMessages,redactLLMMessages:this.#L?.redactLLMMessages,modelOverride:this.#j??r.modelOverride??this.#qt(),reasoning:this.#it,interruptActiveTask:r.userMessage?.queue===!1||void 0,parentSessionId:this.#Ye,mainSessionId:this.getMainSessionId(),forceCompact:r.userMessage?.forceCompact};this.#a&&this.#r.debug(`(generateCompletion-${s}): request partial body. ${JSON.stringify({url:I.url,userPrompt:I.userPrompt,systemReminders:I.systemReminders,toolResultsCount:I.toolResults?.length})}`);let B=Cle(this.#e,this.#o,I,n,this.#a),E,y=!1,Q=!1,w=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 v=E={state:"running",unixTime:Date.now(),title:"",sentiment:void 0,userMessage:r.userMessage,afterCommit:d,beforeCommit:d,lastCommit:void 0,creditsUsed:0,actions:[],applyResults:[],completionId:S.id??"",nextUrl:void 0,user:S.user,autoContinue:!1};E=v,e.turns.push(v),S.compacting&&(e.customInstructions=await this.#Re(),e.customAgents=await this.#We()),i({type:"user",previousId:S.previousId,displayPrompt:S.displayPrompt,id:S.id,user:S.user,role:S.user.role,compacting:S.compacting,idempotencyKey:r.userMessage?.idempotencyKey,sessionMode:S.sessionMode})}else if(S.type==="mcp-status")this.#Ze=S,i(S);else{if(S.type==="mcp-auth-required")return Q=!0,i(S),!0;if(S.type==="error")return Q=!0,i(S),!0;if(S.type==="done"){A++,this.#Y.length=0,this.#ue+=S.creditsUsed;let v=E=await this.#br(e,S,E,d);for(let H of S.actions??[])H.type==="tool_result"&&(H.filePath==="NavigatePreview"&&(c=!0),i({type:"tool_result",result:{content:H.content,tool_use_id:H.id,type:"tool_result",title:H.actionTitle,tool_name:H.filePath,is_error:!!H.errors?.length}}));await this.waitUntilBlockingPendingPromises(n);let P=await this.#Fr(this.#e,v),$=P.length>0;$&&(a=!0),await this.commitWorkInProgress(`${E.title}
|
|
1933
|
+
${E.completionId}`,P),this.#C&&await this.#F(),this.#me({completionId:v.completionId,beforeCommit:v.beforeCommit}),i({type:"done",stopReason:S.stopReason,id:S.id,applyResults:v.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:$})}else{if(S.type==="continue")return y=S.autoContinue,Q=!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},D=S=>{if(S.type==="thinking"&&i({type:"thinking",content:S.content}),S.type==="server_tool_result"){let v;try{v=JSON.parse(S.content)}catch(P){this.#e.Sentry?.captureException(P,{extra:{contentPreview:S.content?.substring(0,500),contentLength:S.content?.length},tags:{operation:"server-tool-result-parse"}}),v=S.content}i({type:"server_tool_result",content:v,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})},x=(S,v)=>{i({type:"delta",name:S.type,delta:v})};for await(let S of B){if(S.type==="ping"){this.#r.debug(`(generateCompletion-${s}): ping`);continue}if(S.type==="delta"){let v=S.content,P=uA(u);P&&"content"in P&&(P.content+=v,x(P,v))}else{let v=uA(u);if(S.type==="thinking"&&v?.type==="thinking")continue;if(v&&"content"in v&&(v.incomplete=!1,D(v)),u.push(S),await w(S))break}}if(!Q)throw new jn("Completion stream ended abruptly","abrupt-end");if(!E)throw new jn("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.#Be=void 0}}async commitWorkInProgress(e,r){if(!this.#C)return;let n=this.#Ar(r);await this.#q(async i=>{let s=n.get(i.folderName)||[],o=await this.#Z(i.path);try{o.length>0?(s.length>0&&await this.git(["add",...s],{cwd:i.path,retry:2}),(await this.#Z(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.#be=="string"?this.#be+=`
|
|
1934
|
+
${e}`:this.#be=e}async#ne(e){if(!this.#C)return!1;let r=this.#be,n=this.#At,i=this.getLastTurn(),s=i?.completionId;this.#be=null,this.#At=[];let a=(async()=>{if(await this.#Ft,!r)return!1;this.#r.debug("(#commitAccumulatedChanges): committing pending changes");let A=!1;try{await this.#q(async l=>{let d="";try{await this.git(["--no-pager","diff","--cached","--quiet"],{cwd:l.path});return}catch{try{if(d=await this.git(["--no-pager","diff","--cached","--no-color"],{cwd:l.path}),!d.trim())return}catch{return}}let g=await this.#sr(l.path),p=r,f=performance.now(),m=await lA(this.#o,"/codegen/commit-message",{diff:Xo(d,500),userMessages:n,recentCommits:g,projectId:this.#I},{signal:AbortSignal.timeout(2e4),debug:this.#a});this.#O("git_commit_message_llm",performance.now()-f,{folder:l.folderName});let B=(m?.message||p).split(`
|
|
1935
|
+
`).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.#G(),u=no(c);return u&&(this.#N={...this.#N,...c},i&&(i.afterCommit=u,i.lastCommit=u),this.#me({completionId:s,beforeCommit:i?.beforeCommit,afterCommit:u,lastCommit:u,commitFailed:!1})),e&&await this.#F(),A}catch(c){return this.#e.Sentry?.captureException(new Error(`Error in #commitAccumulatedChanges: ${c}`),{tags:{operation:"codegen-git-batch-commit"}}),A}})();return this.#Ft=a,this.#K(a,"commitAccumulatedChanges",!0)}async#Dr(e,r,n,i){let s=r.actions.filter(o=>o.type==="tool"&&o.id).map(o=>{let a=o.content.trim(),A={};try{A=a?JSON.parse(a):{}}catch{A={}}return{id:o.id,name:o.filePath,input:A,abortController:this.#z.find(c=>c.id===o.id)?.abortController??new AbortController}})??[];if(s.length>0){this.#z=s;for(let o of s)["Read","Write","Edit","MultiEdit"].includes(o.name)&&typeof o.input.file_path=="string"&&this.#Lt(o.input.file_path);try{let o={debug:this.#a,logger:Se("ToolContext",{debug:()=>!!(this.#a||process.env.DEBUG)}),sys:this.#e,credentials:this.#o,files:e.files,user:e.user,projectId:this.#I,branchName:this.#y,position:this.#h,fusionConfig:this.#u,enabledTools:this.#D??[],sessionMode:this.getSessionMode(),fusionStatusMonitor:this.#et,asyncSubAgents:this.#st,switchSessionMode:A=>this.switchSessionMode(A),signal:n,canCollapseWorkspace:this.#T(),emitter:this.#g,session:this,filterText:A=>(A=Pz(A,this.#x),this.#u?.accessControl?.secrets&&(A=Lz(A,this.#u.accessControl.secrets)),A),allowedCommands:Cw(this.#u?.allowedCommands??[]),getAllFiles:A=>this.getAllFiles({getDotFiles:A.getDotFiles,includePattern:A.pattern,gitignore:!0,maxFiles:A.maxFiles}),workingDirectory:this.#m,bashWorkingDirectory:this.#x,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)=>Zs(A,c,this.#u?.accessControl,this.#V()),stat:A=>this.stat(A),localMCPManager:this.#ye,passThrough:(A,c)=>new Promise((u,l)=>{let d=c?.messageValid??!1,g=c?.signal??new AbortController().signal;if(!this.canHandleTool(A.name)&&!d){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",m),this.#te.delete(A.id)},m=()=>{f(),l(new Error("Aborted by the user. So the task could not be completed."))};if(g.aborted){m();return}g.addEventListener("abort",m,{once:!0}),this.#te.set(A.id,{id:A.id,name:A.name,input:A.input,messageValid:d,resolve:C=>{f(),u(C)}}),this.#g.emit("step",{type:"tool-call-request",id:A.id,name:A.name,input:A.input,messageValid:d}),A.name==="AskUserQuestion"&&(this.#r.debug("emitting ClientDevtoolsToolCallRequestV1",{toolName:A.name,projectId:this.#I,branchName:this.#y}),lA(this.#o,"/events/publish",{event:hre,extraData:{toolUseId:A.id,toolName:A.name,input:A.input,sessionId:this.getSessionId(),projectId:this.#I,branchName:this.#y,messageValid:d},extraAttributes:{toolName:A.name,projectId:this.#I,branchName:this.#y}},{debug:this.#a}))}),resolveWorkspacePath:(A,c)=>{if(typeof A!="string")throw new TypeError(`resolveWorkspacePath: 'path' must be a string, received ${typeof A}: ${ho(A)}`);return this.resolveWorkspacePath(A,c)},absolutePathToWorkspaceUrl:A=>this.absolutePathToWorkspaceUrl(A),devServerOrchestrator:this.#f},a=await lle(o,s,r.cachedToolResults,i);if(r.cachedToolResults=a,o.signal?.aborted)throw $r(o.signal.reason);e.patchFusionConfig&&this.#g.emit("step",{type:"fusion-config-patch",patch:e.patchFusionConfig}),e.files=o.files,e.toolResults=a}finally{this.#z=[]}}}async#wr(e,r,n,i){let s=this.getSessionContext(),o=uA(s.turns),a=structuredClone(e.user??o?.user??{source:"agent",role:"agent"}),A={userMessage:void 0,userPrompt:"",systemReminders:this.#Y.slice(),files:[],attachments:[],searchResponse:null,rerankFiles:0,mostRelevantFile:null,toolResults:[],user:a,modelOverride:e.modelOverride,agentModelOverrides:e.agentModelOverrides,repair:e.repair,category:e.category,enabledMCPs:e.enabledMCPs},c=!!this.getLastTurn()?.nextUrl,u=s.turns.length<2||!c;if(r){let d=null;if(u){let g=gle(await this.getAllFiles({getDotFiles:!1,gitignore:!0,deep:4,truncate:2e4})),p=new Set,f=new Set;if(e.files)for(let E of e.files)p.add(Nz(E));let m=e.includeBaseFiles??s.turns.length===0,C=Array.from(p),I=E=>m&&yle(E,this.#we)?10:m&&Ble(E,this.#we)?5:f.has(E)||C.some(y=>E.toLowerCase().startsWith(y.toLowerCase()))?2:0,B=n.aborted?[]:g.map(E=>{let y=I(E);if(y===0)return{filePath:E};let Q=null;try{if(Q=this.readFileSync(E),!Q)return{filePath:E}}catch{return{filePath:E}}let w=Q.length<3e4;return{filePath:E,content:Q,importance:w?y:2}});A.files=B,A.attachments=e.attachments??[]}if(this.#C&&!this.#_){let g,p=await this.getChangesReport();if(p){for(let f of p.files)A.files.some(m=>m.filePath===f)||A.files.push({filePath:f,importance:0});p.diff.length<1e3?g=p.diff:g=p.files.map(f=>`- ${f}`).join(`
|
|
1936
1936
|
`).trim(),g&&A.systemReminders.push({text:`
|
|
1937
1937
|
Some files changed by the user or tools (Bash, auto-formatting, etc.):
|
|
1938
1938
|
<modified-files-context>
|
|
1939
1939
|
${Xo(g,30)}
|
|
1940
|
-
</modified-files-context>`,tag:"reminder:modified-files-context"})}}A.userMessage=e,A.userPrompt=e.userPrompt,A.attachments=e.attachments??[],A.searchResponse=d,A.rerankFiles=0,A.mostRelevantFile=null,A.toolResults=[]}else A.user.role="agent";let l=0;return A.files=A.files.filter(d=>{let g=d.content?.length??0;return g>3e6||l+g>8e6?!1:(l+=g,!0)}),o&&await this.#
|
|
1940
|
+
</modified-files-context>`,tag:"reminder:modified-files-context"})}}A.userMessage=e,A.userPrompt=e.userPrompt,A.attachments=e.attachments??[],A.searchResponse=d,A.rerankFiles=0,A.mostRelevantFile=null,A.toolResults=[]}else A.user.role="agent";let l=0;return A.files=A.files.filter(d=>{let g=d.content?.length??0;return g>3e6||l+g>8e6?!1:(l+=g,!0)}),o&&await this.#Dr(A,o,n,i),A}async#br(e,r,n,i){let{actions:s}=r,o=n||{state:"done",unixTime:r.unixTime??Date.now(),title:r.actionTitle,user:{source:"agent",role:"agent"},completionId:r.id??"",creditsUsed:r.creditsUsed??0,nextUrl:r.nextUrl,applyResults:[],actions:s??[],userMessage:void 0,beforeCommit:i,afterCommit:i,lastCommit:void 0,sentiment:void 0,autoContinue:r.autoContinue};if(o.state="done",o.title=r.actionTitle??"",o.creditsUsed=r.creditsUsed??0,o.nextUrl=r.nextUrl,o.autoContinue=r.autoContinue,o.actions=s??[],n||e.turns.push(o),Array.isArray(s))for(let a of s){let A=a.filePath;if(a.type==="file"&&A&&!a.incomplete){let u=!!await this.stat(A,!0),l=null,d=!0;if(u)try{l=this.readFileSync(A,!0)}catch{d=!1}if(l)if(a.content.trim()==="")o.applyResults.push({action:"delete",filePath:A,addedLines:0,removedLines:l.split(`
|
|
1941
1941
|
`).length,content:"",oldContent:l});else{let g=Hie(l,a.content);o.applyResults.push({action:"update",filePath:A,addedLines:g.filter(p=>p.added).reduce((p,f)=>p+(f.count??0),0),removedLines:g.filter(p=>p.removed).reduce((p,f)=>p+(f.count??0),0),content:a.content,oldContent:l})}else u&&!d?o.applyResults.push({action:"update",filePath:A,addedLines:0,removedLines:0,content:a.content,oldContent:void 0}):o.applyResults.push({action:"create",filePath:A,addedLines:a.content.split(`
|
|
1942
|
-
`).length,removedLines:0,content:a.content,oldContent:""})}}return o}#ft(e){let r=this.getSessionContext();if(!e)return this.gitRepoContexts.some(A=>this.#ft(A.folderName));let n=e,i=Du(r.beforeCommit,n,this.gitRepoContexts[0]?.folderName),s=r.turns.findLast(A=>A.afterCommit??A.beforeCommit),o=s?.afterCommit??s?.beforeCommit,a=Du(o,n,this.gitRepoContexts[0]?.folderName);return i&&a&&i!==a?!0:r.turns.some(A=>A.applyResults.some(c=>this.#
|
|
1943
|
-
`).map(d=>d.trim()).filter(d=>d).filter(d=>!this.#
|
|
1942
|
+
`).length,removedLines:0,content:a.content,oldContent:""})}}return o}#ft(e){let r=this.getSessionContext();if(!e)return this.gitRepoContexts.some(A=>this.#ft(A.folderName));let n=e,i=Du(r.beforeCommit,n,this.gitRepoContexts[0]?.folderName),s=r.turns.findLast(A=>A.afterCommit??A.beforeCommit),o=s?.afterCommit??s?.beforeCommit,a=Du(o,n,this.gitRepoContexts[0]?.folderName);return i&&a&&i!==a?!0:r.turns.some(A=>A.applyResults.some(c=>this.#Mt(c.filePath)?.folderName===e))}async#Sr(){try{let e="{/* TODO: FUSION_GENERATION_APP_PLACEHOLDER replace everything here with the actual app! */}",r=await this.#e.readFile(this.resolveWorkspacePath("client/pages/Index.tsx",!0).resolvedPath);if((await this.#e.readFile(this.resolveWorkspacePath("client/App.tsx",!0).resolvedPath))?.includes('<Route path="/" element={<Index />} />')&&r&&r.includes(e))return!0}catch{}return!1}#Ht(e){let r=e.toLowerCase(),n=[".next/","dist/","build/","out/","node_modules/",".cache/","coverage/","__pycache__/","target/","vendor/",".gradle/",".build/"],i=[".gz",".zip",".tar",".tgz",".7z",".rar",".pack",".bin",".exe",".dll",".so",".dylib",".o",".a",".jar",".class",".pyc",".pyo",".wasm",".png",".jpg",".jpeg",".gif",".ico",".webp",".svg",".mp4",".mp3",".wav",".pdf",".woff",".woff2",".ttf",".eot",".map",".min.js",".min.css",".bundle.js",".chunk.js",".tsbuildinfo"];for(let s of n)if(r.includes(s))return!0;for(let s of i)if(r.endsWith(s))return!0;return!!(r.endsWith("package-lock.json")||r.endsWith("yarn.lock")||r.endsWith("pnpm-lock.yaml")||r.endsWith(".lock"))}async getChangesReport(){if(this.#C)try{let e=[],r=[];for(let i of this.#d){let s=this.#N[i.folderName];if(!s)continue;if((await this.#Z(i.path)).length>0)return;try{let c=(await this.git(["--no-pager","diff","--name-only",s],{cwd:i.path})).trim().split(`
|
|
1943
|
+
`).map(d=>d.trim()).filter(d=>d).filter(d=>!this.#Ht(d));if(c.length===0)continue;let u=c.map(d=>this.absolutePathToWorkspaceUrl(this.#e.join(i.path,d))).filter(d=>d!=null);e.push(...u);let l=await this.git(["--no-pager","diff","-U0","--no-color",s,"--",...c],{cwd:i.path}).then(d=>d.trim());l.length>0&&(this.#d.length>1?r.push(`
|
|
1944
1944
|
### Changes in ${i.folderName}:
|
|
1945
1945
|
${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.#T()&&r.length>0)if(this.#d.length>1)n=`Notice: This is a multi-repo workspace with folders: ${this.#d.map(s=>s.folderName).join(", ")}. File paths are prefixed with their folder names when using Read/Write/Edit tools.
|
|
1946
1946
|
`;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:
|
|
1947
1947
|
`)}return{files:e,diff:Yd(`${n}${r.join(`
|
|
1948
|
-
`)}`,1e4)}}catch(e){this.#e.Sentry?.captureException(e,{tags:{operation:"codegen-git"}});return}}#Sr(){return["status","--porcelain=v1","-z","--ignore-submodules=dirty"]}async#ht(e){try{let r=this.#Sr();return(await this.git(r,{cwd:e})).trim().length===0}catch{return!1}}async#vr(e){try{return await this.git(["diff","--cached","--quiet"],{cwd:e}),!1}catch{return!0}}async#xr(e,r){let n=r.applyResults;for(let s of n)this.#Pt(s.filePath);let i=[];for(let s of n)try{if(s.action==="delete"){let o=await this.deleteFile(s.filePath);o&&i.push(o)}else if(s.content){let o=await this.writeFile(s.filePath,s.content);o&&(this.#Jt.add(o),i.push(o))}}catch(o){e.Sentry?.captureException(o)}return i}#T(){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}: ${ho(e)}`);return Gse({filePath:e,forceWorkspace:r,workspace:this.#E,workingDirectory:this.#m,sys:this.#e,canCollapseWorkspace:this.#T()})}#V(){try{let e=this.getSessionContext();return uA(e.turns)?.user.principals}catch{return}}absolutePathToWorkspaceUrl(e){return Ose({absolutePath:e,workspace:this.#E,workingDirectory:this.#m,sys:this.#e,canCollapseWorkspace:this.#T()})}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}: ${ho(e)}`);if(!r){let n=Zs(e,"read",this.#u?.accessControl,this.#V());if(!n.allowed)throw new ft(`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,YG.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=Zs(e,"read",this.#u?.accessControl,this.#V());if(!r.allowed)throw new ft(`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#mt(e){let r;e?r=this.#d.find(s=>s.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#Ct(e){let r=this.#Se.get(e);if(r&&Date.now()-r.timestamp<t.#Ve)return r.promise;let n=(async()=>{let i=await this.#mt(e);try{return(await this.git(["merge-base",i,"HEAD"],{cwd:e})).trim()}catch{return i}})().catch(i=>{throw this.#Se.get(e)?.promise===n&&this.#Se.delete(e),i});return this.#Se.set(e,{promise:n,timestamp:Date.now()}),n}async getFileAtRef(e,r,n){if(!this.#C)return null;try{let i,s;if(n)i=n,e.startsWith(i)?(s=e.substring(i.length),s.startsWith("/")&&(s=s.substring(1))):s=e;else{let{resolvedPath:u,workspaceFolder:l}=this.resolveWorkspacePath(e,!0);i=l?.path||this.#m,s=e,i&&u.startsWith(i)&&(s=u.substring(i.length),s.startsWith("/")&&(s=s.substring(1)))}let o=r??await this.#Ct(i),a=`${i}:${o}:${s}`,A=this.#xe.get(a);if(A&&Date.now()-A.timestamp<t.#Ve)return A.promise;let c=this.git(["show",`${o}:${s}`],{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.#xe.get(a)?.promise===c&&this.#xe.delete(a),null});return this.#xe.set(a,{promise:c,timestamp:Date.now()}),c}catch{return null}}async#Fr(e){let r=this.#ve.get(e);if(r&&Date.now()-r.timestamp<t.#Ve)return r.promise;let n=(async()=>{try{let i=(await this.git(["branch","--show-current"],{cwd:e})).trim();if(i&&(await this.git(["ls-remote","--heads","origin",i],{cwd:e})).trim().length>0)return`origin/${i}`}catch{}return this.#Ct(e)})().catch(i=>{throw this.#ve.get(e)?.promise===n&&this.#ve.delete(e),i});return this.#ve.set(e,{promise:n,timestamp:Date.now()}),n}async#kr(e,r){return r==="remote-current-branch"?this.#Fr(e):this.#Ct(e)}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}: ${ho(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}: ${ho(r.path)}`);let n=typeof e=="object"?e.previousChecksum:void 0,i=typeof e=="object"&&e.mode?e.mode:"remote-parent-branch",{repoPath:s,relativePath:o}=this.#kt(r.path,r.folderName),a=this.#e.join(s,o),A=this.#C?await this.#kr(s,i).catch(()=>null):null,[c,u]=await Promise.all([this.#e.readFile(a).catch(()=>null),A===null?Promise.resolve(null):this.getFileAtRef(o,A,s)]),l=u===null?"":`${u}`,d=c===null?"":`${c}`,g=(0,YG.createHash)("md5").update(`${l}\0${d}`).digest("hex"),p=u===null&&c!==null?"create":u!==null&&c===null?"delete":"update";return n===g?{oldContent:null,newContent:null,action:p,checksum:g,notModified:!0}:{oldContent:u,newContent:c,action:p,checksum:g}}async discardFileChanges(e){let r=typeof e=="string"?{filePath:e}:e;if(!this.#C)return{success:!1,error:"Git not configured"};try{let{repoPath:n,relativePath:i}=this.#kt(r.filePath,r.folderName),s=this.#e.join(n,i),o=await this.#mt(n),a;try{a=(await this.git(["merge-base",o,"HEAD"],{cwd:n})).trim()}catch{a=o}let A=await this.getFileAtRef(i,a,n),u=(await this.git(["--no-pager","diff",`${a}`,"HEAD","--",i],{cwd:n})).trim().length>0,d=(await this.git(["status","--porcelain","--",i],{cwd:n})).trim().length>0;if(!u&&!d)return{success:!0};if(A===null){try{await this.#e.exists(s)&&await this.#e.unlink(s)}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 p=(await this.git(["rev-parse","HEAD"],{cwd:n})).trim();try{await this.#F()}catch(f){this.#e.Sentry?.captureException(f,{tags:{operation:"discard-file-changes",step:"emit-git-status"}})}return{success:!0,commitHash:p}}catch(n){try{await this.#F()}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.#C)return{success:!1,error:"Git not configured"};try{let i=this.#ke(n);await this.git(["revert","--no-edit",r],{cwd:i});try{await this.#F()}catch(s){this.#e.Sentry?.captureException(s,{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}: ${ho(e)}`);let r=n=>n.startsWith(this.#m)?this.#e.relative(this.#m,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=Zs(e,"read",this.#u?.accessControl,this.#V());if(!n.allowed)throw new ft(`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}: ${ho(e)}`);if(!n){let i=Zs(e,"write",this.#u?.accessControl,this.#V());if(!i.allowed)throw new ft(`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}: ${ho(e)}`);let r=Zs(e,"list",this.#u?.accessControl,this.#V());if(!r.allowed)throw new ft(`ACL denied: ${r.message}`);try{let{resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!1);if(!A0({resolvedPath:n,workingDirectory:this.#m,workspace:this.#E,sys:this.#e}))throw new ft("Access denied: path outside working directory");if(!await this.#e.exists(n))return[];let A=(await(0,ule.readdir)(n,{withFileTypes:!0})).map(c=>c.name+(c.isDirectory()?"/":""));if(this.#T()){let c=A.map(u=>pn(this.#e.join(e,u)));return jd({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(d=>{let g=u?this.#e.join(u,d):d,p=pn(g);return`${c}/${p}`});return jd({files:l,policy:this.#u?.accessControl,getDotFiles:!0})}return jd({files:A,policy:this.#u?.accessControl,getDotFiles:!0})}catch(n){return this.#e.Sentry?.captureException(n,{extra:{dirPath:e}}),[]}}async listCustomInstructions(){return(await this.#Re()).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}: ${ho(e)}`);if(!r){let n=Zs(e,"read",this.#u?.accessControl,this.#V());if(!n.allowed)throw new ft(`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}#Rr(e){let r=pn(this.#e.resolve(e)),n=this.absolutePathToWorkspaceUrl(r);return n!==void 0?pn(n):pn(this.#e.relative(this.#m,r))}async#Nr(e){let r=[],n=async i=>{let s=this.#e.resolve(i);if(!A0({resolvedPath:s,workingDirectory:this.#m,workspace:this.#E,sys:this.#e}))throw new ft("Access denied: path outside working directory");r.push(s);let o;try{o=await this.#e.stat(s)}catch(A){if(A?.code==="ENOENT")return;throw A}if(!o.isDirectory())return;let a=await this.#e.readdir(s);for(let A of a){let c=A.endsWith("/")?A.slice(0,-1):A;await n(this.#e.join(s,c))}};return await n(e),r}async deleteFile(e,r){if(typeof e!="string")throw new TypeError(`deleteFile: 'filePath' must be a string, received ${typeof e}: ${ho(e)}`);if(!r){let n=Zs(e,"write",this.#u?.accessControl,this.#V());if(!n.allowed)throw new ft(`ACL denied: ${n.message}`)}try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!!r);if(!A0({resolvedPath:n,workingDirectory:this.#m,workspace:this.#E,sys:this.#e}))throw new ft("Access denied: path outside working directory");if(!await this.#e.exists(n))return null;if((await this.#e.stat(n)).isDirectory()){if(!r){let o=await this.#Nr(n);for(let a of o){let A=Zs(this.#Rr(a),"write",this.#u?.accessControl,this.#V());if(!A.allowed)throw new ft(`ACL denied: ${A.message}`)}}await this.#e.rm(n,{recursive:!0,force:!0})}else await this.#e.unlink(n);return n}catch(n){if(n instanceof ft)throw 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((s,o)=>({added:s.added+o.addedLines,removed:s.removed+o.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.#C)return[];let s=this.#ke(i);try{let o=(await this.git(["branch","--show-current"],{cwd:s})).trim();if(!o)throw new Error("Could not determine current branch");let a=!1;try{a=(await this.git(["remote"],{cwd:s})).includes("origin")}catch(d){throw this.#r.warn("No git remotes configured, cannot get diff from remote"),d}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(d){throw this.#r.warn("Failed to get diff from main branch:",d),d}}let A=!1,c;try{let d=`origin/${o}`;if(A=(await this.git(["ls-remote","--heads","origin",o],{cwd:s})).trim().length>0,A)c=d;else return await this.getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i})}catch(d){throw this.#r.warn("Failed to check remote branches:",d),d}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:s});return!l||l.trim()===""?[]:NG(l,r)}catch(o){throw o instanceof Yg||this.#r.error("getDiffFromRemote error:",o),o}}async getDiff({mode:e="remote-parent-branch",numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:s}){if(!this.#C)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:s})};case"remote-current-branch":return{state:"success",diff:await this.getDiffFromRemote({numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:s})};default:throw new Error(`Unknown diff mode: ${e}`)}}catch(o){return o instanceof Yg?{state:"error",error:o}:(this.#r.error(`getDiff error for mode '${e}':`,o),this.#e.Sentry?.captureException(o),{state:"error",error:o instanceof Error?o:new Error(String(o))})}}async getDefaultBranch(e){let r=e??"__primary__",n=this.#$e.get(r);if(n)return n;let i=this.#Tr(e).catch(s=>{throw this.#$e.get(r)===i&&this.#$e.delete(r),s});return this.#$e.set(r,i),i}async#Tr(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(`
|
|
1948
|
+
`)}`,1e4)}}catch(e){this.#e.Sentry?.captureException(e,{tags:{operation:"codegen-git"}});return}}#vr(){return["status","--porcelain=v1","-z","--ignore-submodules=dirty"]}async#ht(e){try{let r=this.#vr();return(await this.git(r,{cwd:e})).trim().length===0}catch{return!1}}async#xr(e){try{return await this.git(["diff","--cached","--quiet"],{cwd:e}),!1}catch{return!0}}async#Fr(e,r){let n=r.applyResults;for(let s of n)this.#Lt(s.filePath);let i=[];for(let s of n)try{if(s.action==="delete"){let o=await this.deleteFile(s.filePath);o&&i.push(o)}else if(s.content){let o=await this.writeFile(s.filePath,s.content);o&&(this.#Yt.add(o),i.push(o))}}catch(o){e.Sentry?.captureException(o)}return i}#T(){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}: ${ho(e)}`);return Gse({filePath:e,forceWorkspace:r,workspace:this.#E,workingDirectory:this.#m,sys:this.#e,canCollapseWorkspace:this.#T()})}#V(){try{let e=this.getSessionContext();return uA(e.turns)?.user.principals}catch{return}}absolutePathToWorkspaceUrl(e){return Ose({absolutePath:e,workspace:this.#E,workingDirectory:this.#m,sys:this.#e,canCollapseWorkspace:this.#T()})}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}: ${ho(e)}`);if(!r){let n=Zs(e,"read",this.#u?.accessControl,this.#V());if(!n.allowed)throw new ft(`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,YG.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=Zs(e,"read",this.#u?.accessControl,this.#V());if(!r.allowed)throw new ft(`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#mt(e){let r;e?r=this.#d.find(s=>s.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#Ct(e){let r=this.#Se.get(e);if(r&&Date.now()-r.timestamp<t.#Ve)return r.promise;let n=(async()=>{let i=await this.#mt(e);try{return(await this.git(["merge-base",i,"HEAD"],{cwd:e})).trim()}catch{return i}})().catch(i=>{throw this.#Se.get(e)?.promise===n&&this.#Se.delete(e),i});return this.#Se.set(e,{promise:n,timestamp:Date.now()}),n}async getFileAtRef(e,r,n){if(!this.#C)return null;try{let i,s;if(n)i=n,e.startsWith(i)?(s=e.substring(i.length),s.startsWith("/")&&(s=s.substring(1))):s=e;else{let{resolvedPath:u,workspaceFolder:l}=this.resolveWorkspacePath(e,!0);i=l?.path||this.#m,s=e,i&&u.startsWith(i)&&(s=u.substring(i.length),s.startsWith("/")&&(s=s.substring(1)))}let o=r??await this.#Ct(i),a=`${i}:${o}:${s}`,A=this.#xe.get(a);if(A&&Date.now()-A.timestamp<t.#Ve)return A.promise;let c=this.git(["show",`${o}:${s}`],{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.#xe.get(a)?.promise===c&&this.#xe.delete(a),null});return this.#xe.set(a,{promise:c,timestamp:Date.now()}),c}catch{return null}}async#kr(e){let r=this.#ve.get(e);if(r&&Date.now()-r.timestamp<t.#Ve)return r.promise;let n=(async()=>{try{let i=(await this.git(["branch","--show-current"],{cwd:e})).trim();if(i&&(await this.git(["ls-remote","--heads","origin",i],{cwd:e})).trim().length>0)return`origin/${i}`}catch{}return this.#Ct(e)})().catch(i=>{throw this.#ve.get(e)?.promise===n&&this.#ve.delete(e),i});return this.#ve.set(e,{promise:n,timestamp:Date.now()}),n}async#Rr(e,r){return r==="remote-current-branch"?this.#kr(e):this.#Ct(e)}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}: ${ho(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}: ${ho(r.path)}`);let n=typeof e=="object"?e.previousChecksum:void 0,i=typeof e=="object"&&e.mode?e.mode:"remote-parent-branch",{repoPath:s,relativePath:o}=this.#Rt(r.path,r.folderName),a=this.#e.join(s,o),A=this.#C?await this.#Rr(s,i).catch(()=>null):null,[c,u]=await Promise.all([this.#e.readFile(a).catch(()=>null),A===null?Promise.resolve(null):this.getFileAtRef(o,A,s)]),l=u===null?"":`${u}`,d=c===null?"":`${c}`,g=(0,YG.createHash)("md5").update(`${l}\0${d}`).digest("hex"),p=u===null&&c!==null?"create":u!==null&&c===null?"delete":"update";return n===g?{oldContent:null,newContent:null,action:p,checksum:g,notModified:!0}:{oldContent:u,newContent:c,action:p,checksum:g}}async discardFileChanges(e){let r=typeof e=="string"?{filePath:e}:e;if(!this.#C)return{success:!1,error:"Git not configured"};try{let{repoPath:n,relativePath:i}=this.#Rt(r.filePath,r.folderName),s=this.#e.join(n,i),o=await this.#mt(n),a;try{a=(await this.git(["merge-base",o,"HEAD"],{cwd:n})).trim()}catch{a=o}let A=await this.getFileAtRef(i,a,n),u=(await this.git(["--no-pager","diff",`${a}`,"HEAD","--",i],{cwd:n})).trim().length>0,d=(await this.git(["status","--porcelain","--",i],{cwd:n})).trim().length>0;if(!u&&!d)return{success:!0};if(A===null){try{await this.#e.exists(s)&&await this.#e.unlink(s)}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 p=(await this.git(["rev-parse","HEAD"],{cwd:n})).trim();try{await this.#F()}catch(f){this.#e.Sentry?.captureException(f,{tags:{operation:"discard-file-changes",step:"emit-git-status"}})}return{success:!0,commitHash:p}}catch(n){try{await this.#F()}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.#C)return{success:!1,error:"Git not configured"};try{let i=this.#ke(n);await this.git(["revert","--no-edit",r],{cwd:i});try{await this.#F()}catch(s){this.#e.Sentry?.captureException(s,{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}: ${ho(e)}`);let r=n=>n.startsWith(this.#m)?this.#e.relative(this.#m,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=Zs(e,"read",this.#u?.accessControl,this.#V());if(!n.allowed)throw new ft(`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}: ${ho(e)}`);if(!n){let i=Zs(e,"write",this.#u?.accessControl,this.#V());if(!i.allowed)throw new ft(`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}: ${ho(e)}`);let r=Zs(e,"list",this.#u?.accessControl,this.#V());if(!r.allowed)throw new ft(`ACL denied: ${r.message}`);try{let{resolvedPath:n,workspaceFolder:i}=this.resolveWorkspacePath(e,!1);if(!A0({resolvedPath:n,workingDirectory:this.#m,workspace:this.#E,sys:this.#e}))throw new ft("Access denied: path outside working directory");if(!await this.#e.exists(n))return[];let A=(await(0,ule.readdir)(n,{withFileTypes:!0})).map(c=>c.name+(c.isDirectory()?"/":""));if(this.#T()){let c=A.map(u=>pn(this.#e.join(e,u)));return jd({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(d=>{let g=u?this.#e.join(u,d):d,p=pn(g);return`${c}/${p}`});return jd({files:l,policy:this.#u?.accessControl,getDotFiles:!0})}return jd({files:A,policy:this.#u?.accessControl,getDotFiles:!0})}catch(n){return this.#e.Sentry?.captureException(n,{extra:{dirPath:e}}),[]}}async listCustomInstructions(){return(await this.#Re()).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}: ${ho(e)}`);if(!r){let n=Zs(e,"read",this.#u?.accessControl,this.#V());if(!n.allowed)throw new ft(`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}#Nr(e){let r=pn(this.#e.resolve(e)),n=this.absolutePathToWorkspaceUrl(r);return n!==void 0?pn(n):pn(this.#e.relative(this.#m,r))}async#Tr(e){let r=[],n=async i=>{let s=this.#e.resolve(i);if(!A0({resolvedPath:s,workingDirectory:this.#m,workspace:this.#E,sys:this.#e}))throw new ft("Access denied: path outside working directory");r.push(s);let o;try{o=await this.#e.stat(s)}catch(A){if(A?.code==="ENOENT")return;throw A}if(!o.isDirectory())return;let a=await this.#e.readdir(s);for(let A of a){let c=A.endsWith("/")?A.slice(0,-1):A;await n(this.#e.join(s,c))}};return await n(e),r}async deleteFile(e,r){if(typeof e!="string")throw new TypeError(`deleteFile: 'filePath' must be a string, received ${typeof e}: ${ho(e)}`);if(!r){let n=Zs(e,"write",this.#u?.accessControl,this.#V());if(!n.allowed)throw new ft(`ACL denied: ${n.message}`)}try{let{resolvedPath:n}=this.resolveWorkspacePath(e,!!r);if(!A0({resolvedPath:n,workingDirectory:this.#m,workspace:this.#E,sys:this.#e}))throw new ft("Access denied: path outside working directory");if(!await this.#e.exists(n))return null;if((await this.#e.stat(n)).isDirectory()){if(!r){let o=await this.#Tr(n);for(let a of o){let A=Zs(this.#Nr(a),"write",this.#u?.accessControl,this.#V());if(!A.allowed)throw new ft(`ACL denied: ${A.message}`)}}await this.#e.rm(n,{recursive:!0,force:!0})}else await this.#e.unlink(n);return n}catch(n){if(n instanceof ft)throw 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((s,o)=>({added:s.added+o.addedLines,removed:s.removed+o.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.#C)return[];let s=this.#ke(i);try{let o=(await this.git(["branch","--show-current"],{cwd:s})).trim();if(!o)throw new Error("Could not determine current branch");let a=!1;try{a=(await this.git(["remote"],{cwd:s})).includes("origin")}catch(d){throw this.#r.warn("No git remotes configured, cannot get diff from remote"),d}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(d){throw this.#r.warn("Failed to get diff from main branch:",d),d}}let A=!1,c;try{let d=`origin/${o}`;if(A=(await this.git(["ls-remote","--heads","origin",o],{cwd:s})).trim().length>0,A)c=d;else return await this.getDiffFromParentBranch({numberOfContextLines:e,includeFilesOnly:r,filePaths:n,folderName:i})}catch(d){throw this.#r.warn("Failed to check remote branches:",d),d}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:s});return!l||l.trim()===""?[]:NG(l,r)}catch(o){throw o instanceof Yg||this.#r.error("getDiffFromRemote error:",o),o}}async getDiff({mode:e="remote-parent-branch",numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:s}){if(!this.#C)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:s})};case"remote-current-branch":return{state:"success",diff:await this.getDiffFromRemote({numberOfContextLines:r,includeFilesOnly:n,filePaths:i,folderName:s})};default:throw new Error(`Unknown diff mode: ${e}`)}}catch(o){return o instanceof Yg?{state:"error",error:o}:(this.#r.error(`getDiff error for mode '${e}':`,o),this.#e.Sentry?.captureException(o),{state:"error",error:o instanceof Error?o:new Error(String(o))})}}async getDefaultBranch(e){let r=e??"__primary__",n=this.#$e.get(r);if(n)return n;let i=this.#Mr(e).catch(s=>{throw this.#$e.get(r)===i&&this.#$e.delete(r),s});return this.#$e.set(r,i),i}async#Mr(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(`
|
|
1949
1949
|
`).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 s=this.#ke(i);try{if(!(await this.git(["branch","--show-current"],{cwd:s})).trim())throw new Error("Could not determine current branch");let a=await this.#mt(s),A;try{A=(await this.git(["merge-base",a,"HEAD"],{cwd:s})).trim()}catch(l){throw l instanceof mo&&l.code===128?new Yg(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:s});return!u||u.trim()===""?[]:NG(u,r)}catch(o){throw o instanceof Yg||this.#r.error("getDiffFromParentBranch error:",o),o}}},Pb=(t,e)=>e.filter(r=>!t?.disabledTools?.includes(r))});function Nle(t){return t instanceof Error?t.message:String(t)}function hE(t,e){if(iO(e).test(t))return!0;if(e.toLowerCase().includes("localhost")){let n=e.replace(/localhost/gi,"127.0.0.1");if(iO(n).test(t))return!0}else if(e.includes("127.0.0.1")){let n=e.replace(/127\.0\.0\.1/g,"localhost");if(iO(n).test(t))return!0}return!1}function iO(t){return t=String(t).replace(/\./g,"\\.").replace(/\?/g,".").replace(/\*/g,".*"),new RegExp(`^${t}$`,"i")}var Hb,Tle=L(()=>{"use strict";h();Hb=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: ${Nle(i)}`),this.currentDestination=r}this.logger?.info(`[UrlMapper] Set mapping (PATTERN): ${e} \u2192 ${r}`)}else{this.currentOriginPattern=null;try{let i=new URL(e),s=i.protocol==="https:"?"443":"80",o=i.port||s;this.currentOriginHost=`${i.hostname}:${o}`,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: ${Nle(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 hE(i,n)?(this.logger?.debug(`[UrlMapper] PATTERN MATCH FOUND getUpstream(${e}) matched hostname: ${n} -> ${this.currentDestination}`),this.currentDestination):hE(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?hE(e,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) -> ${this.currentDestination}`),this.currentDestination):hE(`${e}:80`,this.currentOriginHost)?(this.logger?.debug(`[UrlMapper] MATCH FOUND getUpstream(${e}) (HTTP) -> ${this.currentDestination}`),this.currentDestination):hE(`${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),s=new URL(e);return s.pathname=i.pathname.replace(/\/+/g,"/"),s.search=i.search,s.hash=i.hash,s}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 Mle,uXe,sO,Ple=L(()=>{"use strict";h();Mle=z(require("node:os"),1);Dt();uXe=Se("Priority"),sO=(t,e)=>{try{Mle.default.setPriority(t,e)}catch(r){uXe.error(`Failed to set priority to ${e}: ${r}`)}}});function Lle(t){AO=t}async function jf(){if(AO){if(oO){aO=!0;return}oO=!0;try{await AO()}finally{oO=!1,aO&&(aO=!1,jf())}}}var AO,oO,aO,cO=L(()=>{"use strict";h();oO=!1,aO=!1});async function*lXe(t){for await(let e of xd(t.body))if(e.length)try{yield JSON.parse(e)}catch{}}function gXe(t){t.toolContext.session.sendMessage({userPrompt:Rre({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 pXe(t,e){return e??("builderUserId"in t.user?t.user.builderUserId:t.user.source==="builder.io"?t.user.userId:t.credentials.userId)}function _le(t,e){let{credentials:r}=t,{project_id:n,message:i}=e,s,o=new Promise(g=>s=g),a=!1,A,c,u,l;return(async()=>{let g=new URL("/projects/branch",ke);g.searchParams.set("apiKey",r.builderPublicKey);let p=pXe(t,e.builder_user_id);p&&g.searchParams.set("userId",p);let f=e.model&&e.model!=="auto"?Su(e.model):void 0,m=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},...m?.length&&{attachments:m}},hidden:e.hidden,actor:"org-agent",metadata:{origin_channel_id:C},...e.git_base_branch&&{checkoutBranch:e.git_base_branch}},B=await Fe(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 lXe(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),s(y);else{let Q=wre(y);Q&&(A=Q.plan)}if(!E)throw new Error("Stream ended unexpectedly");return E})().then(g=>{a||s(null);let p=c??g.projectName??n,f=u??l??g.branchName,m=`https://builder.io/app/projects/${n}/${l??g.branchName}`;if(g.type!=="error"){let C=`Branch \`${f}\` in \`${p}\` completed.
|
|
1950
1950
|
- Url: \`${m}\`
|
|
1951
1951
|
|
|
@@ -2189,7 +2189,7 @@ ${(0,re.yellow)("Examples:")}
|
|
|
2189
2189
|
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var ege=L(()=>{h();Zle()});async function SO(t=bXe){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new bO(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=n.lastIndexOf("."),s=n.lastIndexOf("-"),o=i===-1?void 0:n.slice(0,i),a=s===-1?void 0:n.slice(0,s);return jb[n]??jb[o]??jb[a]??{name:n,id:n}}var tge,rge,bXe,jb,F$t,bO,nge=L(()=>{h();tge=require("node:util"),rge=require("node:child_process"),bXe=(0,tge.promisify)(rge.execFile),jb={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},F$t=new Map(Object.entries(jb)),bO=class extends Error{}});async function vO(){if(qb.default.platform==="darwin"){let t=await QO();return{name:await wO(t),id:t}}if(qb.default.platform==="linux"){let{stdout:t}=await SXe("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:vXe(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(qb.default.platform==="win32")return SO();throw new Error("Only macOS, Linux, and Windows are supported")}var ige,qb,sge,SXe,vXe,oge=L(()=>{h();ige=require("node:util"),qb=z(require("node:process"),1),sge=require("node:child_process");Vle();ege();nge();SXe=(0,ige.promisify)(sge.execFile),vXe=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});async function FXe(){let t=await yO(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=kO.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await xXe(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),i=n.trim(),s={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return s[i]?{id:s[i]}:{}}function uge(t){if(typeof t=="string"||Array.isArray(t))return t;let{[Age]:e}=t;if(!e)throw new Error(`${Age} is not supported`);return e}function Wb({[$f]:t},{wsl:e}){if(e&&Wu)return uge(e);if(!t)throw new Error(`${$f} is not supported`);return uge(t)}var FO,kO,RO,lge,gge,NO,Vb,xXe,xO,age,$f,Age,cge,$b,kXe,qg,pge,dge=L(()=>{h();FO=z(require("node:process"),1),kO=require("node:buffer"),RO=z(require("node:path"),1),lge=require("node:url"),gge=require("node:util"),NO=z(require("node:child_process"),1),Vb=z(require("node:fs/promises"),1);Jle();Yle();oge();CO();xXe=(0,gge.promisify)(NO.default.execFile),xO=RO.default.dirname((0,lge.fileURLToPath)("file:///C:/bundled/open/index.js")),age=RO.default.join(xO,"xdg-open"),{platform:$f,arch:Age}=FO.default;cge=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},$b=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return cge(t.app,a=>$b({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return cge(e,a=>$b({...t,app:{name:a,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},A={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=Wu?await FXe():await vO();if(c.id in a){let u=a[c.id];return e==="browserPrivate"&&r.push(A[u]),$b({...t,app:{name:qg[u],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,i=[],s={};if($f==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if($f==="win32"||Wu&&!jg()&&!e){n=await yO(),i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Wu||(s.windowsVerbatimArguments=!0);let a=["Start"];t.wait&&a.push("-Wait"),e?(a.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&a.push(`"${t.target}"`),r.length>0&&(r=r.map(A=>`"\`"${A}\`""`),a.push("-ArgumentList",r.join(","))),t.target=kO.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!xO||xO==="/",A=!1;try{await Vb.default.access(age,Vb.constants.X_OK),A=!0}catch{}n=FO.default.versions.electron??($f==="android"||a||!A)?"xdg-open":age}r.length>0&&i.push(...r),t.wait||(s.stdio="ignore",s.detached=!0)}$f==="darwin"&&r.length>0&&i.push("--args",...r),t.target&&i.push(t.target);let o=NO.default.spawn(n,i,s);return t.wait?new Promise((a,A)=>{o.once("error",A),o.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){A(new Error(`Exited with code ${c}`));return}a(o)})}):(o.unref(),o)},kXe=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return $b({...e,target:t})};qg={};zu(qg,"chrome",()=>Wb({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));zu(qg,"brave",()=>Wb({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));zu(qg,"firefox",()=>Wb({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));zu(qg,"edge",()=>Wb({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));zu(qg,"browser",()=>"browser");zu(qg,"browserPrivate",()=>"browserPrivate");pge=kXe});async function Xu(t){try{await pge(t)}catch{console.log(`
|
|
2190
2190
|
Could not open browser automatically.`),console.log(`Please open this URL manually:
|
|
2191
2191
|
${t}
|
|
2192
|
-
`)}}var BE=L(()=>{"use strict";h();dge()});async function zb(t,e,r){let n=t.isAbsolute(e)?e:t.resolve(t.cwd(),e),i=await t.readFile(n);if(!i)throw new Error(`Failed to read ${r} file: ${n}`);return q.info(`\u{1F4C4} Loaded ${r} from file: ${n}`),i}async function RXe(t,e,r){let n=r.httpsServerFiles?.key,i=r.httpsServerFiles?.cert,s=r.httpsServerFiles?.ca,o={...r.httpsServerOptions,key:n?await zb(t,n,"key"):r.httpsServerOptions?.key,cert:i?await zb(t,i,"cert"):r.httpsServerOptions?.cert,ca:s?await zb(t,s,"ca"):r.httpsServerOptions?.ca},a=Object.fromEntries(Object.entries(o).filter(([A,c])=>c!==void 0));if(Object.keys(a).length!==0)return a}async function Zu(t,e){let r=t.cwd(),n=!!e.local||!e.projectId,i={workingDirectory:r,projectId:e.projectId,branchName:e.branchName,commitMode:"commits",mode:"init-and-launch",isLocal:n,allowedCommands:["npm *","pnpm *","yarn *","yarn","bun *","bun","gh *","wc *","gradle *","gradle","rg *","./gradlew *","./gradlew","vp *","vp","git *","export *","rails *","gem *","bundle *","rake *","echo *","cd *","find *","ls *","rm *","cp *","mv *","pwd","curl *","npx tsc *","head *","lsof *","kill *","ps *","tr *","awk *","cat *","grep *","sed *","tail *","touch *","mkdir *","tee *","true","uniq *","test *","false","npx *","sort *","env","dirname","basename *","realpath *","readlink *","stat *","file *","diff *","xargs *","chmod *","which *","whoami","uname *","uname","date","date *","printenv *","sleep *","netlify *","node *","tsx *","builderio *","builder *","open *","xcrun *","xcodebuild *","xcode-select *","xed *","agvtool *"]};if(e.configJson)try{let l=JSON.parse(e.configJson);i=Object.assign({},i,l),i.isLocal?n=!0:i.projectId&&(n=!1,i.isLocal=!1)}catch(l){t.Sentry?.captureException(l)}else{let l=await fge(t,e);if(l&&await t.exists(l))try{let d=await t.readFile(l);if(d){let g=JSON.parse(d);i=Object.assign({},i,g)}}catch(d){t.Sentry?.captureException(d)}}i.command&&(i.devCommand||(i.devCommand=i.command),delete i.command);let s=e.c||e.command,o=e.p||e.port,a=e.installCommand,A=e.serverUrl,c=e.interactive&&!e.configJson&&!e.fusionInit&&n&&!e.chat;if(A)c=!1,i.serverUrl=A,s||(i.devCommand="");else if(s&&o){c=!1;let l="http://localhost";if(i.serverUrl)try{let d=new URL(i.serverUrl);l=`${d.protocol}//${d.hostname}`}catch{l="http://localhost"}i.serverUrl=`${l}:${o}`,i.devCommand=s}else s&&i.autoDetectDevServer&&(c=!1,i.devCommand=s);if(s&&o&&(c=!1),o&&!A&&(i.serverUrl=`http://localhost:${o}`),a&&(i.setupCommand=a),s&&(i.devCommand=s),s&&!i.serverUrl&&(i.autoDetectDevServer=!0,i.autoSuggestPort=!0),typeof e.authenticateProxy=="boolean"&&(i.authenticateProxy=e.authenticateProxy),typeof e.privacyMode=="boolean"&&e.privacyMode&&(i.privacyMode=Object.assign({},i.privacyMode,{enabled:!0})),typeof e.autoDetectDevServer=="boolean"&&(i.autoDetectDevServer=e.autoDetectDevServer),typeof e.https=="boolean"&&(i.https=e.https),e.localHttpsDomain&&(i.localHttpsDomain=e.localHttpsDomain),typeof e.nativeApp=="boolean"&&(i.nativeApp=e.nativeApp),e.disabledTools){let l=e.disabledTools.split(",").map(d=>d.trim());i.disabledTools=l}if(i.httpsServerOptions=await RXe(t,e,i),c&&!e.chat){if(!i.devCommand){let l=await or({message:"Enter the command to run for the dev server (e.g. 'npm run dev')",placeholder:"npm run dev",validate:d=>{if(d.trim()===""||d.length===0)return"Command cannot be empty"}});if(He(l))return Ue("Goodbye! \u{1F44B}"),await(0,TO.exit)(1);i.devCommand=l}if(!i.serverUrl){let l=await or({message:"Enter the dev server URL to proxy to (e.g. http://localhost:3000)",placeholder:"http://localhost:3000",validate:g=>{let p=g.trim();if(!p)return"Dev server URL cannot be empty";if(/^\d+$/.test(p)){let f=Number(p);return f<0||f>65535?"Invalid port number, must be between 0 and 65535":void 0}try{new URL(p)}catch{return"Enter a valid URL or port number"}}});if(He(l))return Ue("Goodbye! \u{1F44B}"),await(0,TO.exit)(1);let d=l.trim();/^\d+$/.test(d)?i.serverUrl=`http://localhost:${d}`:i.serverUrl=new URL(d).href}await MO(t,i,e)}if(e.sessionId&&(i.sessionId=e.sessionId),typeof i.fusionServerPort=="string"){let l=parseInt(i.fusionServerPort);if(!isNaN(l))i.fusionServerPort=l;else throw new Error(`Invalid fusionServerPort: ${i.fusionServerPort}. Expected a number between 0 and 65535, got "${i.fusionServerPort}".`)}let u=i.privacyMode?.encryptionKeyPath;if(u&&i.privacyMode)try{let d=(await zb(t,u,"encryption key")).trim();i.privacyMode.encryptKey=d,delete i.privacyMode.encryptionKeyPath}catch(l){let d=new Error(`Failed to load encryption key from path: ${u}`,{cause:l});throw t.Sentry?.captureException(d),q.warn(d.message),d}return i}async function MO(t,e,r){let n=await fge(t,r);await t.writeFile(n,JSON.stringify(NXe(e,"workingDirectory","projectId","authenticateProxy","privacyMode"),null,2))}function hge(t,e){let r=Nw(e);t.Sentry?.setTag("isLocal",r.isLocal),t.Sentry?.setTag("commitMode",r.commitMode),t.Sentry?.setTag("pvcCreationSource",r.pvcCreationSource??"unknown"),t.Sentry?.setTag("snapshot",r.syncBranch?"true":"false");let n=r.workspace?.folders.find(i=>i.enableGit)?.originalRepoUrl;if(n){let i=RC.some(s=>n.endsWith(s))?n:"custom-repo";t.Sentry?.setTag("repoUrl",i)}t.Sentry?.setContext("fusionConfig",{...r}),t.Sentry?.getCurrentScope().setContext("fusionConfig",{...r})}var TO,fge,NXe,yE=L(()=>{"use strict";h();Xs();Wt();TO=require("process");ef();fge=async(t,e)=>{if(e.configPath){let A=t.resolve(t.cwd(),e.configPath);if(await t.exists(A))return A;throw new Error(`Fusion config file not found: ${A}`)}let r=["builder.config.json","fusion.config.json"],n=t.cwd(),i=t.join(n,r[0]),s=t.join(n,r[1]),o=await t.exists(i),a=await t.exists(s);if(o&&a)throw new Error(`Both builder.config.json and fusion.config.json were found in your project.
|
|
2192
|
+
`)}}var BE=L(()=>{"use strict";h();dge()});async function zb(t,e,r){let n=t.isAbsolute(e)?e:t.resolve(t.cwd(),e),i=await t.readFile(n);if(!i)throw new Error(`Failed to read ${r} file: ${n}`);return q.info(`\u{1F4C4} Loaded ${r} from file: ${n}`),i}async function RXe(t,e,r){let n=r.httpsServerFiles?.key,i=r.httpsServerFiles?.cert,s=r.httpsServerFiles?.ca,o={...r.httpsServerOptions,key:n?await zb(t,n,"key"):r.httpsServerOptions?.key,cert:i?await zb(t,i,"cert"):r.httpsServerOptions?.cert,ca:s?await zb(t,s,"ca"):r.httpsServerOptions?.ca},a=Object.fromEntries(Object.entries(o).filter(([A,c])=>c!==void 0));if(Object.keys(a).length!==0)return a}async function Zu(t,e){let r=t.cwd(),n=!!e.local||!e.projectId,i={workingDirectory:r,projectId:e.projectId,branchName:e.branchName,commitMode:"commits",mode:"init-and-launch",isLocal:n,allowedCommands:["npm *","pnpm *","yarn *","yarn","bun *","bun","gh *","wc *","gradle *","gradle","rg *","./gradlew *","./gradlew","adb *","adb","vp *","vp","git *","export *","rails *","gem *","bundle *","rake *","echo *","cd *","find *","ls *","rm *","cp *","mv *","pwd","curl *","npx tsc *","head *","lsof *","kill *","ps *","tr *","awk *","cat *","grep *","sed *","tail *","touch *","mkdir *","tee *","true","uniq *","test *","false","npx *","sort *","env","dirname","basename *","realpath *","readlink *","stat *","file *","diff *","xargs *","chmod *","which *","whoami","uname *","uname","date","date *","printenv *","sleep *","netlify *","node *","tsx *","builderio *","builder *","open *","xcrun *","xcodebuild *","xcode-select *","xed *","agvtool *"]};if(e.configJson)try{let l=JSON.parse(e.configJson);i=Object.assign({},i,l),i.isLocal?n=!0:i.projectId&&(n=!1,i.isLocal=!1)}catch(l){t.Sentry?.captureException(l)}else{let l=await fge(t,e);if(l&&await t.exists(l))try{let d=await t.readFile(l);if(d){let g=JSON.parse(d);i=Object.assign({},i,g)}}catch(d){t.Sentry?.captureException(d)}}i.command&&(i.devCommand||(i.devCommand=i.command),delete i.command);let s=e.c||e.command,o=e.p||e.port,a=e.installCommand,A=e.serverUrl,c=e.interactive&&!e.configJson&&!e.fusionInit&&n&&!e.chat;if(A)c=!1,i.serverUrl=A,s||(i.devCommand="");else if(s&&o){c=!1;let l="http://localhost";if(i.serverUrl)try{let d=new URL(i.serverUrl);l=`${d.protocol}//${d.hostname}`}catch{l="http://localhost"}i.serverUrl=`${l}:${o}`,i.devCommand=s}else s&&i.autoDetectDevServer&&(c=!1,i.devCommand=s);if(s&&o&&(c=!1),o&&!A&&(i.serverUrl=`http://localhost:${o}`),a&&(i.setupCommand=a),s&&(i.devCommand=s),s&&!i.serverUrl&&(i.autoDetectDevServer=!0,i.autoSuggestPort=!0),typeof e.authenticateProxy=="boolean"&&(i.authenticateProxy=e.authenticateProxy),typeof e.privacyMode=="boolean"&&e.privacyMode&&(i.privacyMode=Object.assign({},i.privacyMode,{enabled:!0})),typeof e.autoDetectDevServer=="boolean"&&(i.autoDetectDevServer=e.autoDetectDevServer),typeof e.https=="boolean"&&(i.https=e.https),e.localHttpsDomain&&(i.localHttpsDomain=e.localHttpsDomain),typeof e.nativeApp=="boolean"&&(i.nativeApp=e.nativeApp),e.disabledTools){let l=e.disabledTools.split(",").map(d=>d.trim());i.disabledTools=l}if(i.httpsServerOptions=await RXe(t,e,i),c&&!e.chat){if(!i.devCommand){let l=await or({message:"Enter the command to run for the dev server (e.g. 'npm run dev')",placeholder:"npm run dev",validate:d=>{if(d.trim()===""||d.length===0)return"Command cannot be empty"}});if(He(l))return Ue("Goodbye! \u{1F44B}"),await(0,TO.exit)(1);i.devCommand=l}if(!i.serverUrl){let l=await or({message:"Enter the dev server URL to proxy to (e.g. http://localhost:3000)",placeholder:"http://localhost:3000",validate:g=>{let p=g.trim();if(!p)return"Dev server URL cannot be empty";if(/^\d+$/.test(p)){let f=Number(p);return f<0||f>65535?"Invalid port number, must be between 0 and 65535":void 0}try{new URL(p)}catch{return"Enter a valid URL or port number"}}});if(He(l))return Ue("Goodbye! \u{1F44B}"),await(0,TO.exit)(1);let d=l.trim();/^\d+$/.test(d)?i.serverUrl=`http://localhost:${d}`:i.serverUrl=new URL(d).href}await MO(t,i,e)}if(e.sessionId&&(i.sessionId=e.sessionId),typeof i.fusionServerPort=="string"){let l=parseInt(i.fusionServerPort);if(!isNaN(l))i.fusionServerPort=l;else throw new Error(`Invalid fusionServerPort: ${i.fusionServerPort}. Expected a number between 0 and 65535, got "${i.fusionServerPort}".`)}let u=i.privacyMode?.encryptionKeyPath;if(u&&i.privacyMode)try{let d=(await zb(t,u,"encryption key")).trim();i.privacyMode.encryptKey=d,delete i.privacyMode.encryptionKeyPath}catch(l){let d=new Error(`Failed to load encryption key from path: ${u}`,{cause:l});throw t.Sentry?.captureException(d),q.warn(d.message),d}return i}async function MO(t,e,r){let n=await fge(t,r);await t.writeFile(n,JSON.stringify(NXe(e,"workingDirectory","projectId","authenticateProxy","privacyMode"),null,2))}function hge(t,e){let r=Nw(e);t.Sentry?.setTag("isLocal",r.isLocal),t.Sentry?.setTag("commitMode",r.commitMode),t.Sentry?.setTag("pvcCreationSource",r.pvcCreationSource??"unknown"),t.Sentry?.setTag("snapshot",r.syncBranch?"true":"false");let n=r.workspace?.folders.find(i=>i.enableGit)?.originalRepoUrl;if(n){let i=RC.some(s=>n.endsWith(s))?n:"custom-repo";t.Sentry?.setTag("repoUrl",i)}t.Sentry?.setContext("fusionConfig",{...r}),t.Sentry?.getCurrentScope().setContext("fusionConfig",{...r})}var TO,fge,NXe,yE=L(()=>{"use strict";h();Xs();Wt();TO=require("process");ef();fge=async(t,e)=>{if(e.configPath){let A=t.resolve(t.cwd(),e.configPath);if(await t.exists(A))return A;throw new Error(`Fusion config file not found: ${A}`)}let r=["builder.config.json","fusion.config.json"],n=t.cwd(),i=t.join(n,r[0]),s=t.join(n,r[1]),o=await t.exists(i),a=await t.exists(s);if(o&&a)throw new Error(`Both builder.config.json and fusion.config.json were found in your project.
|
|
2193
2193
|
Please use only builder.config.json and remove fusion.config.json.
|
|
2194
2194
|
You can migrate any settings from fusion.config.json to builder.config.json before removing it.`);for(let A of r){let c=t.join(n,A);if(await t.exists(c))return c}return t.join(n,r[0])},NXe=(t,...e)=>{let r={};if(t&&typeof t=="object")for(let n in t)(!t.hasOwnProperty||t.hasOwnProperty(n))&&(e.includes(n)||(r[n]=t[n]));return r}});async function Wf(t,e={}){let r=new URL("/design-systems/v1",ke);r.searchParams.set("apiKey",t.builderPublicKey),r.searchParams.set("userId",t.userId),e.includeGlobalScopeDesignSystems&&r.searchParams.set("includeGlobalScopeDesignSystems","true"),e.includeDocumentCount&&r.searchParams.set("includeDocumentCount","true");let n=await Fe(r,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`}});if(!n.ok)return[];let i=await n.json()??[];return e.onlyEditAccess?i.filter(s=>s.spaceId===t.builderPublicKey):i}var PO,mge,LO,_O,Vf,QE,Xb,UO,TXe,MXe,PXe,GO,Cge,gs,Co,LXe,Ige,Ege,Bge,OO,yge,gA=L(()=>{"use strict";h();gi();Yf();PO=z(require("@sentry/node"),1);Dt();Rr();yr();mr();fi();Wt();mge=require("node:path"),LO=Se("RepoIndexing"),_O="AGENTS.md",Vf="icons.mdx",QE="tokens.mdx",Xb="installation.md",UO="repo-indexing",TXe=[{value:"space",label:"Space",hint:"Available to all applications in your current space"}],MXe=[{value:"organization",label:"Organization",hint:"Available to all applications in your organization"}],PXe=[{value:"global",label:"Global",hint:"Available to all applications in the Builder platform"}],GO=async(t,e,r)=>{if(!t.userId)throw new Error("User ID is required");let i=e?.isAdminInOrganization,s=e?.email?.includes("@builder.io"),o=[...TXe];if((i||s)&&o.push(...MXe),s&&o.push(...PXe),o.length===1)return o[0].value;if(r){if(!o.some(c=>c.value===r))throw new Error(`You don't have permission to use the scope "${r}"`);return r}let a=await li({message:"What is your design system scope?",options:o});if(!He(a))return a},Cge=async(t,e)=>{try{let r=t.getAppRootDir(),n=await To(t,r);if(!n)return{name:void 0,version:void 0};let i=e??n.name,s;if(e){let o=n.dependencies?.[e]||n.devDependencies?.[e];s=o?.replace(/^[\^~>=<]+/,"")||o}else s=n.version;return{name:i,version:s}}catch(r){return LO.error("Error parsing design system",r,{loggerOptions:{debug:!0}}),{name:void 0,version:void 0}}},gs=async(t,e,r)=>{try{let n=new URL("/mappings/store-component-docs",ke);n.searchParams.set("apiKey",t.builderPublicKey),n.searchParams.set("userId",t.userId);let i=await Fe(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t.builderPrivateKey}`},body:JSON.stringify(e)});if(!i.ok){let s=await i.text();throw LO.error("API request failed:",i.status,s,{loggerOptions:{debug:!0}}),new Error(`Failed to store component group: ${i.status} ${s}`)}return await i.json()}catch(n){throw n}},Co=async(t,e,r,n,i,s,o,a={},A)=>{let{maxTokens:c,retriesAllowed:u=0,expectFile:l="tool",include:d,exclude:g,instructions:p,privacyMode:f}=a,m=null,C=l==="tool"?{...t,writeFile:async(E,y)=>(m=typeof y=="string"?y:y.toString(),Promise.resolve())}:t,B={accessControl:LXe(d,g),workingDirectory:t.cwd(),...o&&{workspace:o}};s&&!(0,mge.isAbsolute)(s)&&B.accessControl?.entries?.push({action:"allow",resource:`**/node_modules/${s}/**/*`,permissions:["list","read"]},{action:"allow",resource:`!**/node_modules/${s}/node_modules/**/*`,permissions:["list"]},{action:"deny",resource:`**/node_modules/${s}/node_modules`,permissions:["list","read","write"]});try{let E=new ua({maxTokens:c,sys:C,credentials:e,position:"repo-indexing",mode:"quality-v4",sessionOrCompletionId:r,...s&&!s.startsWith("/")&&{workingDirectory:`node_modules/${s}`},fusionConfig:B,privacyMode:f,builtInCustomInstructions:p?[{id:"repo-indexing-instructions",name:"repo-indexing-instructions",type:"always",content:p}]:void 0,enabledTools:["Read","Write","Glob","Bash","Grep","Skill","TaskCreate","TaskUpdate","TaskList"],...A&&{metadata:A}});i&&E.setDebug(i),await E.initializeSession({skipSessionLoading:!0});let y=E.connectToEventLoop(!1,async Q=>{Q.type==="error"&&LO.error(Q.message,{loggerOptions:{debug:!0}})});try{await E.sendMessage(n),await E.waitUntilIdle()}finally{y(),await E.close()}if(l!=="tool"){let Q=t.join(t.cwd(),l);if(await t.exists(Q)){m=await t.readFile(Q);try{await t.unlink(Q)}catch(D){PO.captureException(D,{extra:{expectedFile:l,expectedFilePath:Q}})}}}if(!m){let Q=PO.captureException(new ft("Repo indexing failed: No essential files were written"),{tags:{...a?.tags,sessionId:r}});throw new ft(`Sorry, we ran into a problem when indexing your components.
|
|
2195
2195
|
Session ID: ${r}.
|
|
@@ -2813,7 +2813,7 @@ return fn.apply(this, arguments)
|
|
|
2813
2813
|
`)+`\r
|
|
2814
2814
|
\r
|
|
2815
2815
|
`+r)}function ap(t,e,r,n,i,s){if(t.listenerCount("wsClientError")){let o=new Error(i);Error.captureStackTrace(o,ap),t.emit("wsClientError",o,r,e)}else aB(r,n,i,s)}});var aye=R((vsr,oye)=>{h();var a4=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],s=this.timeBuffer[r-1]-this.timeBuffer[r-n],o=i/s;this.valueBuffer=this.valueBuffer.slice(-this.etaBufferLength),this.timeBuffer=this.timeBuffer.slice(-this.etaBufferLength);let a=Math.ceil(e/o/1e3);isNaN(a)?this.eta="NULL":isFinite(a)?a>1e7?this.eta="INF":a<0?this.eta=0:this.eta=a:this.eta="INF"}};oye.exports=a4});var c4=R((Fsr,Aye)=>{h();var cp=require("readline"),A4=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&&cp.cursorTo(this.stream,e,r)}cursorRelative(e=null,r=null){this.stream.isTTY&&(this.dy=this.dy+r,cp.moveCursor(this.stream,e,r))}cursorRelativeReset(){this.stream.isTTY&&(cp.moveCursor(this.stream,0,-this.dy),cp.cursorTo(this.stream,0,null),this.dy=0)}clearRight(){this.stream.isTTY&&cp.clearLine(this.stream,1)}clearLine(){this.stream.isTTY&&cp.clearLine(this.stream,0)}clearBottom(){this.stream.isTTY&&cp.clearScreenDown(this.stream)}newline(){this.stream.write(`
|
|
2816
|
-
`),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)}};Aye.exports=A4});var uye=R((Rsr,u4)=>{"use strict";h();var cye=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);u4.exports=cye;u4.exports.default=cye});var gye=R((Tsr,lye)=>{"use strict";h();lye.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 dye=R((Psr,l4)=>{"use strict";h();var zgt=v1(),Xgt=uye(),Zgt=gye(),pye=t=>{if(typeof t!="string"||t.length===0||(t=zgt(t),t.length===0))return 0;t=t.replace(Zgt()," ");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+=Xgt(n)?2:1)}return e};l4.exports=pye;l4.exports.default=pye});var g4=R((_sr,fye)=>{h();fye.exports=function(e,r,n){if(r.autopadding!==!0)return e;function i(s,o){return(r.autopaddingChar+s).slice(-o)}return n==="percentage"?i(e,3):e}});var p4=R((Gsr,hye)=>{h();hye.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 d4=R((Ksr,mye)=>{h();mye.exports=function(e,r,n){function i(o){return n?n*Math.round(o/n):o}function s(o){return(r.autopaddingChar+o).slice(-2)}return e>3600?s(Math.floor(e/3600))+"h"+s(i(e%3600/60))+"m":e>60?s(Math.floor(e/60))+"m"+s(i(e%60))+"s":e>10?s(i(e))+"s":s(e)+"s"}});var f4=R((Jsr,Cye)=>{h();var ept=dye(),tpt=g4(),rpt=p4(),npt=d4();Cye.exports=function(e,r,n){let i=e.format,s=e.formatTime||npt,o=e.formatValue||tpt,a=e.formatBar||rpt,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:o(A,e,"percentage"),total:o(r.total,e,"total"),value:o(r.value,e,"value"),eta:o(r.eta,e,"eta"),eta_formatted:s(r.eta,e,5),duration:o(u,e,"duration"),duration_formatted:s(u,e,1)});i=i.replace(/\{(\w+)\}/g,function(p,f){return typeof l[f]<"u"?l[f]:p});let d=Math.max(0,r.maxWidth-ept(i)-2),g=Math.floor(d/2);switch(e.align){case"right":i=d>0?" ".repeat(d)+i:i;break;case"center":i=g>0?" ".repeat(g)+i:i;break;default:break}return i}});var Mv=R((jsr,Iye)=>{h();function gr(t,e){return typeof t>"u"||t===null?e:t}Iye.exports={parse:function(e,r){let n={},i=Object.assign({},r,e);return n.throttleTime=1e3/gr(i.fps,10),n.stream=gr(i.stream,process.stderr),n.terminal=gr(i.terminal,null),n.clearOnComplete=gr(i.clearOnComplete,!1),n.stopOnComplete=gr(i.stopOnComplete,!1),n.barsize=gr(i.barsize,40),n.align=gr(i.align,"left"),n.hideCursor=gr(i.hideCursor,!1),n.linewrap=gr(i.linewrap,!1),n.barGlue=gr(i.barGlue,""),n.barCompleteChar=gr(i.barCompleteChar,"="),n.barIncompleteChar=gr(i.barIncompleteChar,"-"),n.format=gr(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=gr(i.formatTime,null),n.formatValue=gr(i.formatValue,null),n.formatBar=gr(i.formatBar,null),n.etaBufferLength=gr(i.etaBuffer,10),n.etaAsynchronousUpdate=gr(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=gr(i.progressCalculationRelative,!1),n.synchronousUpdate=gr(i.synchronousUpdate,!0),n.noTTYOutput=gr(i.noTTYOutput,!1),n.notTTYSchedule=gr(i.notTTYSchedule,2e3),n.emptyOnZero=gr(i.emptyOnZero,!1),n.forceRedraw=gr(i.forceRedraw,!1),n.autopadding=gr(i.autopadding,!1),n.gracefulExit=gr(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?gr(e.autopaddingChar," "):"",e}}});var h4=R((Vsr,Bye)=>{h();var Eye=aye(),ipt=c4(),spt=f4(),opt=Mv(),apt=require("events");Bye.exports=class extends apt{constructor(e){super(),this.options=opt.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new ipt(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 Eye(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:spt}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 Eye(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 Qye=R((Xsr,yye)=>{h();var Apt=h4(),cpt=Mv();yye.exports=class extends Apt{constructor(e,r){super(cpt.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 wye=R((tor,Dye)=>{h();var upt=c4(),lpt=h4(),gpt=Mv(),ppt=require("events");Dye.exports=class extends ppt{constructor(e,r){super(),this.bars=[],this.options=gpt.parse(e,r),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new upt(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 s=new lpt(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(s),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,s.start(e,r,n),this.emit("start")),s}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 Sye=R((nor,bye)=>{h();bye.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var xye=R((sor,vye)=>{h();vye.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var kye=R((aor,Fye)=>{h();Fye.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Nye=R((cor,Rye)=>{h();Rye.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var Mye=R((lor,Tye)=>{h();var dpt=Sye(),fpt=xye(),hpt=kye(),mpt=Nye();Tye.exports={legacy:dpt,shades_classic:fpt,shades_grey:hpt,rect:mpt}});var _ye=R((por,Lye)=>{h();var Pye=Qye(),Cpt=wye(),Ipt=Mye(),Ept=f4(),Bpt=g4(),ypt=p4(),Qpt=d4();Lye.exports={Bar:Pye,SingleBar:Pye,MultiBar:Cpt,Presets:Ipt,Format:{Formatter:Ept,BarFormat:ypt,ValueFormat:Bpt,TimeFormat:Qpt}}});var Yye=R((Lor,Jye)=>{h();Jye.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 kEt={};GB(kEt,{default:()=>FEt});module.exports=Kr(kEt);h();h();(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]="ae42970a-f783-49cd-96b4-0c0f655a4be1",t._sentryDebugIdIdentifier="sentry-dbid-ae42970a-f783-49cd-96b4-0c0f655a4be1")}catch{}})();h();var Qve=require("../core/index.cjs"),Dve=require("../node/index.cjs"),wve=require("../server/index.cjs"),bve=z(BJ(),1);h();h();var cS=require("fs/promises");yF();Rr();xC();Wt();var Mr=z(pr(),1),th=require("node:path");Bs();Ds();mr();Hr();Kf();var xet="https://cdn.builder.io",lpe=async(t,e)=>{console.log(""),Zt((0,Mr.bgCyan)((0,Mr.bold)((0,Mr.white)(" figma migrate ")))+" "+(0,Mr.dim)(ut));let{builderPrivateKey:r,builderPublicKey:n}=await $t(t,e,{forceSpaceId:e.spaceId,builderPrivateKey:!0,builderPublicKey:!0});await kt("figma publish started",{spaceId:n});let i=await vC(t);if(i.length>0){await kt("figma migrate with existing files",{spaceId:n}),q.warning(`${(0,Mr.yellow)("This repo already has figma mappings in:")}
|
|
2816
|
+
`),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)}};Aye.exports=A4});var uye=R((Rsr,u4)=>{"use strict";h();var cye=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);u4.exports=cye;u4.exports.default=cye});var gye=R((Tsr,lye)=>{"use strict";h();lye.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 dye=R((Psr,l4)=>{"use strict";h();var zgt=v1(),Xgt=uye(),Zgt=gye(),pye=t=>{if(typeof t!="string"||t.length===0||(t=zgt(t),t.length===0))return 0;t=t.replace(Zgt()," ");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+=Xgt(n)?2:1)}return e};l4.exports=pye;l4.exports.default=pye});var g4=R((_sr,fye)=>{h();fye.exports=function(e,r,n){if(r.autopadding!==!0)return e;function i(s,o){return(r.autopaddingChar+s).slice(-o)}return n==="percentage"?i(e,3):e}});var p4=R((Gsr,hye)=>{h();hye.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 d4=R((Ksr,mye)=>{h();mye.exports=function(e,r,n){function i(o){return n?n*Math.round(o/n):o}function s(o){return(r.autopaddingChar+o).slice(-2)}return e>3600?s(Math.floor(e/3600))+"h"+s(i(e%3600/60))+"m":e>60?s(Math.floor(e/60))+"m"+s(i(e%60))+"s":e>10?s(i(e))+"s":s(e)+"s"}});var f4=R((Jsr,Cye)=>{h();var ept=dye(),tpt=g4(),rpt=p4(),npt=d4();Cye.exports=function(e,r,n){let i=e.format,s=e.formatTime||npt,o=e.formatValue||tpt,a=e.formatBar||rpt,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:o(A,e,"percentage"),total:o(r.total,e,"total"),value:o(r.value,e,"value"),eta:o(r.eta,e,"eta"),eta_formatted:s(r.eta,e,5),duration:o(u,e,"duration"),duration_formatted:s(u,e,1)});i=i.replace(/\{(\w+)\}/g,function(p,f){return typeof l[f]<"u"?l[f]:p});let d=Math.max(0,r.maxWidth-ept(i)-2),g=Math.floor(d/2);switch(e.align){case"right":i=d>0?" ".repeat(d)+i:i;break;case"center":i=g>0?" ".repeat(g)+i:i;break;default:break}return i}});var Mv=R((jsr,Iye)=>{h();function gr(t,e){return typeof t>"u"||t===null?e:t}Iye.exports={parse:function(e,r){let n={},i=Object.assign({},r,e);return n.throttleTime=1e3/gr(i.fps,10),n.stream=gr(i.stream,process.stderr),n.terminal=gr(i.terminal,null),n.clearOnComplete=gr(i.clearOnComplete,!1),n.stopOnComplete=gr(i.stopOnComplete,!1),n.barsize=gr(i.barsize,40),n.align=gr(i.align,"left"),n.hideCursor=gr(i.hideCursor,!1),n.linewrap=gr(i.linewrap,!1),n.barGlue=gr(i.barGlue,""),n.barCompleteChar=gr(i.barCompleteChar,"="),n.barIncompleteChar=gr(i.barIncompleteChar,"-"),n.format=gr(i.format,"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}"),n.formatTime=gr(i.formatTime,null),n.formatValue=gr(i.formatValue,null),n.formatBar=gr(i.formatBar,null),n.etaBufferLength=gr(i.etaBuffer,10),n.etaAsynchronousUpdate=gr(i.etaAsynchronousUpdate,!1),n.progressCalculationRelative=gr(i.progressCalculationRelative,!1),n.synchronousUpdate=gr(i.synchronousUpdate,!0),n.noTTYOutput=gr(i.noTTYOutput,!1),n.notTTYSchedule=gr(i.notTTYSchedule,2e3),n.emptyOnZero=gr(i.emptyOnZero,!1),n.forceRedraw=gr(i.forceRedraw,!1),n.autopadding=gr(i.autopadding,!1),n.gracefulExit=gr(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?gr(e.autopaddingChar," "):"",e}}});var h4=R((Vsr,Bye)=>{h();var Eye=aye(),ipt=c4(),spt=f4(),opt=Mv(),apt=require("events");Bye.exports=class extends apt{constructor(e){super(),this.options=opt.assignDerivedOptions(e),this.terminal=this.options.terminal?this.options.terminal:new ipt(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 Eye(this.options.etaBufferLength,0,0),this.payload={},this.isActive=!1,this.formatter=typeof this.options.format=="function"?this.options.format:spt}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 Eye(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 Qye=R((Xsr,yye)=>{h();var Apt=h4(),cpt=Mv();yye.exports=class extends Apt{constructor(e,r){super(cpt.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 wye=R((tor,Dye)=>{h();var upt=c4(),lpt=h4(),gpt=Mv(),ppt=require("events");Dye.exports=class extends ppt{constructor(e,r){super(),this.bars=[],this.options=gpt.parse(e,r),this.options.synchronousUpdate=!1,this.terminal=this.options.terminal?this.options.terminal:new upt(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 s=new lpt(Object.assign({},this.options,{terminal:this.terminal},i));return this.bars.push(s),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,s.start(e,r,n),this.emit("start")),s}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 Sye=R((nor,bye)=>{h();bye.exports={format:"progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"=",barIncompleteChar:"-"}});var xye=R((sor,vye)=>{h();vye.exports={format:" {bar} {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var kye=R((aor,Fye)=>{h();Fye.exports={format:" \x1B[90m{bar}\x1B[0m {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}});var Nye=R((cor,Rye)=>{h();Rye.exports={format:" {bar}\u25A0 {percentage}% | ETA: {eta}s | {value}/{total}",barCompleteChar:"\u25A0",barIncompleteChar:" "}});var Mye=R((lor,Tye)=>{h();var dpt=Sye(),fpt=xye(),hpt=kye(),mpt=Nye();Tye.exports={legacy:dpt,shades_classic:fpt,shades_grey:hpt,rect:mpt}});var _ye=R((por,Lye)=>{h();var Pye=Qye(),Cpt=wye(),Ipt=Mye(),Ept=f4(),Bpt=g4(),ypt=p4(),Qpt=d4();Lye.exports={Bar:Pye,SingleBar:Pye,MultiBar:Cpt,Presets:Ipt,Format:{Formatter:Ept,BarFormat:ypt,ValueFormat:Bpt,TimeFormat:Qpt}}});var Yye=R((Lor,Jye)=>{h();Jye.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 kEt={};GB(kEt,{default:()=>FEt});module.exports=Kr(kEt);h();h();(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]="30fc15d7-81ee-43b2-a6e9-aee9ce77c2f1",t._sentryDebugIdIdentifier="sentry-dbid-30fc15d7-81ee-43b2-a6e9-aee9ce77c2f1")}catch{}})();h();var Qve=require("../core/index.cjs"),Dve=require("../node/index.cjs"),wve=require("../server/index.cjs"),bve=z(BJ(),1);h();h();var cS=require("fs/promises");yF();Rr();xC();Wt();var Mr=z(pr(),1),th=require("node:path");Bs();Ds();mr();Hr();Kf();var xet="https://cdn.builder.io",lpe=async(t,e)=>{console.log(""),Zt((0,Mr.bgCyan)((0,Mr.bold)((0,Mr.white)(" figma migrate ")))+" "+(0,Mr.dim)(ut));let{builderPrivateKey:r,builderPublicKey:n}=await $t(t,e,{forceSpaceId:e.spaceId,builderPrivateKey:!0,builderPublicKey:!0});await kt("figma publish started",{spaceId:n});let i=await vC(t);if(i.length>0){await kt("figma migrate with existing files",{spaceId:n}),q.warning(`${(0,Mr.yellow)("This repo already has figma mappings in:")}
|
|
2817
2817
|
|
|
2818
2818
|
${i.map(c=>` - ${(0,th.relative)(t.getAppRootDir(),c)}`).join(`
|
|
2819
2819
|
`)}
|