@minimax-ai/code 0.5.8 → 0.5.9
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/CHANGELOG.md +23 -0
- package/CHANGELOG.zh-CN.md +16 -0
- package/assets/agents/_default/prompt-base-all.md +1 -1
- package/assets/agents/_default/prompt-base-all.md.hbs +1 -28
- package/assets/agents/_v2/AGENT_CONTEXT.md.hbs +1 -1
- package/assets/agents/_v2/coding/SYSTEM.md.hbs +1 -1
- package/assets/agents/_v2/tui/SYSTEM.md.hbs +1 -1
- package/assets/agents/_v2/work/SYSTEM.md.hbs +1 -1
- package/assets/agents/mavis/features/cron.md.hbs +0 -24
- package/assets/agents/mavis/features/memory.md.hbs +1 -1
- package/assets/agents/mavis/modes/coding/online/SYSTEM.md.hbs +0 -1
- package/assets/agents/mavis/modes/work/online/SYSTEM.md.hbs +0 -1
- package/assets/skills/.seed-fingerprints.json +1 -1
- package/assets/skills/mcode-tools-master/SKILL.md +13 -9
- package/chunks/{auth-command-RALSSOBM.js → auth-command-NX42NZF7.js} +1 -1
- package/chunks/{chunk-LG37JEC6.js → chunk-6ETTLULN.js} +718 -705
- package/chunks/{chunk-ITKWU4ZJ.js → chunk-7AA5OH3H.js} +1 -1
- package/chunks/{chunk-TNWAAYEI.js → chunk-BDJJOCZ6.js} +1 -1
- package/chunks/{chunk-HOQXGGPN.js → chunk-EM6SRMJ6.js} +1 -1
- package/chunks/{chunk-OCFW7RRF.js → chunk-GN5KQHOZ.js} +84 -84
- package/chunks/{chunk-ZOTCLOIA.js → chunk-H4IKJTNO.js} +1 -1
- package/chunks/{chunk-X3H6BQVR.js → chunk-N55ACUNK.js} +1 -1
- package/chunks/chunk-QEPCDCRA.js +6806 -0
- package/chunks/{data-dir-LAVNS5CI.js → data-dir-ONMHHF2I.js} +1 -1
- package/chunks/dist-SQAQEOG4.js +2 -0
- package/chunks/{launcher-3OVH3OJ7.js → launcher-UFK2VC2A.js} +113 -113
- package/chunks/{lifecycle-74ZN3X75.js → lifecycle-A7N2MOIV.js} +1 -1
- package/chunks/{main-EALSBC4N.js → main-BEWP2E4J.js} +2 -2
- package/chunks/{plugin-command-6BTNVHCU.js → plugin-command-NZDDLHHT.js} +1 -1
- package/chunks/{provider-command-4SDHPXLP.js → provider-command-VA6AI6FF.js} +1 -1
- package/chunks/{run-acp-command-K3NOFRPR.js → run-acp-command-SBE5PYAH.js} +2 -2
- package/chunks/{run-exec-command-Z27JZUWY.js → run-exec-command-P3L2BJ4M.js} +1 -1
- package/cli.js +2 -2
- package/package.json +1 -1
- package/chunks/chunk-PF5H4F6R.js +0 -6793
- package/chunks/dist-2NNKON6X.js +0 -2
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
|
|
2
|
-
import{n as
|
|
3
|
-
GFS4: `),console.error(e)});F[z]||(Jl=global[z]||[],Ql(F,Jl),F.close=(function(e){function t(n,i){return e.call(F,n,function(r){r||Xl(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,Hn,{value:e}),t})(F.close),F.closeSync=(function(e){function t(n){e.apply(F,arguments),Xl()}return Object.defineProperty(t,Hn,{value:e}),t})(F.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ze(F[z]),ue("assert").equal(F[z].length,0)}));var Jl;global[z]||Ql(global,F[z]);Vr.exports=Ur(ky(F));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!F.__patched&&(Vr.exports=Ur(F),F.__patched=!0);function Ur(e){Ey(e),e.gracefulify=Ur,e.createReadStream=k,e.createWriteStream=C;var t=e.readFile;e.readFile=n;function n(A,O,E){return typeof O=="function"&&(E=O,O=null),T(A,O,E);function T($,G,D,q){return t($,G,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?bt([T,[$,G,D],N,q||Date.now(),Date.now()]):typeof D=="function"&&D.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=r;function r(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(G,D,q,N,X){return i(G,D,q,function(P){P&&(P.code==="EMFILE"||P.code==="ENFILE")?bt([$,[G,D,q,N],P,X||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=s);function s(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(G,D,q,N,X){return o(G,D,q,function(P){P&&(P.code==="EMFILE"||P.code==="ENFILE")?bt([$,[G,D,q,N],P,X||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var a=e.copyFile;a&&(e.copyFile=l);function l(A,O,E,T){return typeof E=="function"&&(T=E,E=0),$(A,O,E,T);function $(G,D,q,N,X){return a(G,D,q,function(P){P&&(P.code==="EMFILE"||P.code==="ENFILE")?bt([$,[G,D,q,N],P,X||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var c=e.readdir;e.readdir=f;var u=/^v[0-5]\./;function f(A,O,E){typeof O=="function"&&(E=O,O=null);var T=u.test(process.version)?function(D,q,N,X){return c(D,$(D,q,N,X))}:function(D,q,N,X){return c(D,q,$(D,q,N,X))};return T(A,O,E);function $(G,D,q,N){return function(X,P){X&&(X.code==="EMFILE"||X.code==="ENFILE")?bt([T,[G,D,q],X,N||Date.now(),Date.now()]):(P&&P.sort&&P.sort(),typeof q=="function"&&q.call(this,X,P))}}}if(process.version.substr(0,4)==="v0.8"){var d=xy(e);g=d.ReadStream,v=d.WriteStream}var p=e.ReadStream;p&&(g.prototype=Object.create(p.prototype),g.prototype.open=b);var y=e.WriteStream;y&&(v.prototype=Object.create(y.prototype),v.prototype.open=x),Object.defineProperty(e,"ReadStream",{get:function(){return g},set:function(A){g=A},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return v},set:function(A){v=A},enumerable:!0,configurable:!0});var m=g;Object.defineProperty(e,"FileReadStream",{get:function(){return m},set:function(A){m=A},enumerable:!0,configurable:!0});var h=v;Object.defineProperty(e,"FileWriteStream",{get:function(){return h},set:function(A){h=A},enumerable:!0,configurable:!0});function g(A,O){return this instanceof g?(p.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function b(){var A=this;w(A.path,A.flags,A.mode,function(O,E){O?(A.autoClose&&A.destroy(),A.emit("error",O)):(A.fd=E,A.emit("open",E),A.read())})}function v(A,O){return this instanceof v?(y.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(){var A=this;w(A.path,A.flags,A.mode,function(O,E){O?(A.destroy(),A.emit("error",O)):(A.fd=E,A.emit("open",E))})}function k(A,O){return new e.ReadStream(A,O)}function C(A,O){return new e.WriteStream(A,O)}var L=e.open;e.open=w;function w(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(G,D,q,N,X){return L(G,D,q,function(P,u_){P&&(P.code==="EMFILE"||P.code==="ENFILE")?bt([$,[G,D,q,N],P,X||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}return e}function bt(e){Ze("ENQUEUE",e[0].name,e[1]),F[z].push(e),Kr()}var Wn;function Xl(){for(var e=Date.now(),t=0;t<F[z].length;++t)F[z][t].length>2&&(F[z][t][3]=e,F[z][t][4]=e);Kr()}function Kr(){if(clearTimeout(Wn),Wn=void 0,F[z].length!==0){var e=F[z].shift(),t=e[0],n=e[1],i=e[2],r=e[3],o=e[4];if(r===void 0)Ze("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-r>=6e4){Ze("TIMEOUT",t.name,n);var s=n.pop();typeof s=="function"&&s.call(null,i)}else{var a=Date.now()-o,l=Math.max(o-r,1),c=Math.min(l*1.2,100);a>=c?(Ze("RETRY",t.name,n),t.apply(null,n.concat([r]))):F[z].push(e)}Wn===void 0&&(Wn=setTimeout(Kr,0))}}});var Zl=S((A_,zl)=>{function fe(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}zl.exports=fe;fe.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};fe.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};fe.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var i=this,r=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n);return this._options.unref&&r.unref(),!0};fe.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};fe.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};fe.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};fe.prototype.start=fe.prototype.try;fe.prototype.errors=function(){return this._errors};fe.prototype.attempts=function(){return this._attempts};fe.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,i=0;i<this._errors.length;i++){var r=this._errors[i],o=r.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=r,n=s)}return t}});var ec=S(et=>{var Oy=Zl();et.operation=function(e){var t=et.timeouts(e);return new Oy(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};et.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],r=0;r<t.retries;r++)i.push(this.createTimeout(r,t));return e&&e.forever&&!i.length&&i.push(this.createTimeout(r,t)),i.sort(function(o,s){return o-s}),i};et.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,i=Math.round(n*t.minTimeout*Math.pow(t.factor,e));return i=Math.min(i,t.maxTimeout),i};et.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var i in e)typeof e[i]=="function"&&n.push(i)}for(var r=0;r<n.length;r++){var o=n[r],s=e[o];e[o]=function(l){var c=et.operation(t),u=Array.prototype.slice.call(arguments,1),f=u.pop();u.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),f.apply(this,arguments))}),c.attempt(function(){l.apply(e,u)})}.bind(e,s),e[o].options=t}}});var nc=S((__,tc)=>{tc.exports=ec()});var ic=S((E_,Jn)=>{Jn.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Jn.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Jn.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var lc=S((x_,At)=>{var R=global.process,tt=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};tt(R)?(rc=ue("assert"),St=ic(),oc=/^win/i.test(R.platform),Qt=ue("events"),typeof Qt!="function"&&(Qt=Qt.EventEmitter),R.__signal_exit_emitter__?H=R.__signal_exit_emitter__:(H=R.__signal_exit_emitter__=new Qt,H.count=0,H.emitted={}),H.infinite||(H.setMaxListeners(1/0),H.infinite=!0),At.exports=function(e,t){if(!tt(global.process))return function(){};rc.equal(typeof e,"function","a callback must be provided for exit handler"),vt===!1&&Gr();var n="exit";t&&t.alwaysLast&&(n="afterexit");var i=function(){H.removeListener(n,e),H.listeners("exit").length===0&&H.listeners("afterexit").length===0&&Xn()};return H.on(n,e),i},Xn=function(){!vt||!tt(global.process)||(vt=!1,St.forEach(function(t){try{R.removeListener(t,Qn[t])}catch{}}),R.emit=zn,R.reallyExit=Wr,H.count-=1)},At.exports.unload=Xn,nt=function(t,n,i){H.emitted[t]||(H.emitted[t]=!0,H.emit(t,n,i))},Qn={},St.forEach(function(e){Qn[e]=function(){if(tt(global.process)){var n=R.listeners(e);n.length===H.count&&(Xn(),nt("exit",null,e),nt("afterexit",null,e),oc&&e==="SIGHUP"&&(e="SIGINT"),R.kill(R.pid,e))}}}),At.exports.signals=function(){return St},vt=!1,Gr=function(){vt||!tt(global.process)||(vt=!0,H.count+=1,St=St.filter(function(t){try{return R.on(t,Qn[t]),!0}catch{return!1}}),R.emit=ac,R.reallyExit=sc)},At.exports.load=Gr,Wr=R.reallyExit,sc=function(t){tt(global.process)&&(R.exitCode=t||0,nt("exit",R.exitCode,null),nt("afterexit",R.exitCode,null),Wr.call(R,R.exitCode))},zn=R.emit,ac=function(t,n){if(t==="exit"&&tt(global.process)){n!==void 0&&(R.exitCode=n);var i=zn.apply(this,arguments);return nt("exit",R.exitCode,null),nt("afterexit",R.exitCode,null),i}else return zn.apply(this,arguments)}):At.exports=function(){return function(){}};var rc,St,oc,Qt,H,Xn,nt,Qn,vt,Gr,Wr,sc,zn,ac});var uc=S((k_,Hr)=>{"use strict";var cc=Symbol();function Ty(e,t,n){let i=t[cc];if(i)return t.stat(e,(o,s)=>{if(o)return n(o);n(null,s.mtime,i)});let r=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,r,r,o=>{if(o)return n(o);t.stat(e,(s,a)=>{if(s)return n(s);let l=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(t,cc,{value:l}),n(null,a.mtime,l)})})}function Iy(e){let t=Date.now();return e==="s"&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}Hr.exports.probe=Ty;Hr.exports.getMtime=Iy});var hc=S((C_,Zt)=>{"use strict";var Ly=ue("path"),Qr=Yr(),My=nc(),Ny=lc(),fc=uc(),Ee={};function zt(e,t){return t.lockfilePath||`${e}.lock`}function zr(e,t,n){if(!t.realpath)return n(null,Ly.resolve(e));t.fs.realpath(e,n)}function Xr(e,t,n){let i=zt(e,t);t.fs.mkdir(i,r=>{if(!r)return fc.probe(i,t.fs,(o,s,a)=>{if(o)return t.fs.rmdir(i,()=>{}),n(o);n(null,s,a)});if(r.code!=="EEXIST")return n(r);if(t.stale<=0)return n(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));t.fs.stat(i,(o,s)=>{if(o)return o.code==="ENOENT"?Xr(e,{...t,stale:0},n):n(o);if(!dc(s,t))return n(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));pc(e,t,a=>{if(a)return n(a);Xr(e,{...t,stale:0},n)})})})}function dc(e,t){return e.mtime.getTime()<Date.now()-t.stale}function pc(e,t,n){t.fs.rmdir(zt(e,t),i=>{if(i&&i.code!=="ENOENT")return n(i);n()})}function Zn(e,t){let n=Ee[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(i,r)=>{let o=n.lastUpdate+t.stale<Date.now();if(i)return i.code==="ENOENT"||o?Jr(e,n,Object.assign(i,{code:"ECOMPROMISED"})):(n.updateDelay=1e3,Zn(e,t));if(!(n.mtime.getTime()===r.mtime.getTime()))return Jr(e,n,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=fc.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,a,a,l=>{let c=n.lastUpdate+t.stale<Date.now();if(!n.released){if(l)return l.code==="ENOENT"||c?Jr(e,n,Object.assign(l,{code:"ECOMPROMISED"})):(n.updateDelay=1e3,Zn(e,t));n.mtime=a,n.lastUpdate=Date.now(),n.updateDelay=null,Zn(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function Jr(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),Ee[e]===t&&delete Ee[e],t.options.onCompromised(n)}function Py(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:Qr,onCompromised:i=>{throw i},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),zr(e,t,(i,r)=>{if(i)return n(i);let o=My.operation(t.retries);o.attempt(()=>{Xr(r,t,(s,a,l)=>{if(o.retry(s))return;if(s)return n(o.mainError());let c=Ee[r]={lockfilePath:zt(r,t),mtime:a,mtimePrecision:l,options:t,lastUpdate:Date.now()};Zn(r,t),n(null,u=>{if(c.released)return u&&u(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));mc(r,{...t,realpath:!1},u)})})})})}function mc(e,t,n){t={fs:Qr,realpath:!0,...t},zr(e,t,(i,r)=>{if(i)return n(i);let o=Ee[r];if(!o)return n(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete Ee[r],pc(r,t,n)})}function Ry(e,t,n){t={stale:1e4,realpath:!0,fs:Qr,...t},t.stale=Math.max(t.stale||0,2e3),zr(e,t,(i,r)=>{if(i)return n(i);t.fs.stat(zt(r,t),(o,s)=>o?o.code==="ENOENT"?n(null,!1):n(o):n(null,!dc(s,t)))})}function Dy(){return Ee}Ny(()=>{for(let e in Ee){let t=Ee[e].options;try{t.fs.rmdirSync(zt(e,t))}catch{}}});Zt.exports.lock=Py;Zt.exports.unlock=mc;Zt.exports.check=Ry;Zt.exports.getLocks=Dy});var gc=S((O_,yc)=>{"use strict";var Fy=Yr();function By(e){let t=["mkdir","realpath","stat","rmdir","utimes"],n={...e};return t.forEach(i=>{n[i]=(...r)=>{let o=r.pop(),s;try{s=e[`${i}Sync`](...r)}catch(a){return o(a)}o(null,s)}}),n}function qy(e){return(...t)=>new Promise((n,i)=>{t.push((r,o)=>{r?i(r):n(o)}),e(...t)})}function $y(e){return(...t)=>{let n,i;if(t.push((r,o)=>{n=r,i=o}),e(...t),n)throw n;return i}}function jy(e){if(e={...e},e.fs=By(e.fs||Fy),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}yc.exports={toPromise:qy,toSync:$y,toSyncOptions:jy}});var eo=S((T_,Ne)=>{"use strict";var wt=hc(),{toPromise:ei,toSync:ti,toSyncOptions:Zr}=gc();async function bc(e,t){let n=await ei(wt.lock)(e,t);return ei(n)}function Uy(e,t){let n=ti(wt.lock)(e,Zr(t));return ti(n)}function Ky(e,t){return ei(wt.unlock)(e,t)}function Vy(e,t){return ti(wt.unlock)(e,Zr(t))}function Yy(e,t){return ei(wt.check)(e,t)}function Gy(e,t){return ti(wt.check)(e,Zr(t))}Ne.exports=bc;Ne.exports.lock=bc;Ne.exports.unlock=Ky;Ne.exports.lockSync=Uy;Ne.exports.unlockSync=Vy;Ne.exports.check=Yy;Ne.exports.checkSync=Gy});var I=S(Z=>{"use strict";var io=Symbol.for("yaml.alias"),_c=Symbol.for("yaml.document"),ni=Symbol.for("yaml.map"),Ec=Symbol.for("yaml.pair"),ro=Symbol.for("yaml.scalar"),ii=Symbol.for("yaml.seq"),xe=Symbol.for("yaml.node.type"),Xy=e=>!!e&&typeof e=="object"&&e[xe]===io,Qy=e=>!!e&&typeof e=="object"&&e[xe]===_c,zy=e=>!!e&&typeof e=="object"&&e[xe]===ni,Zy=e=>!!e&&typeof e=="object"&&e[xe]===Ec,xc=e=>!!e&&typeof e=="object"&&e[xe]===ro,eg=e=>!!e&&typeof e=="object"&&e[xe]===ii;function kc(e){if(e&&typeof e=="object")switch(e[xe]){case ni:case ii:return!0}return!1}function tg(e){if(e&&typeof e=="object")switch(e[xe]){case io:case ni:case ro:case ii:return!0}return!1}var ng=e=>(xc(e)||kc(e))&&!!e.anchor;Z.ALIAS=io;Z.DOC=_c;Z.MAP=ni;Z.NODE_TYPE=xe;Z.PAIR=Ec;Z.SCALAR=ro;Z.SEQ=ii;Z.hasAnchor=ng;Z.isAlias=Xy;Z.isCollection=kc;Z.isDocument=Qy;Z.isMap=zy;Z.isNode=tg;Z.isPair=Zy;Z.isScalar=xc;Z.isSeq=eg});var en=S(oo=>{"use strict";var V=I(),ae=Symbol("break visit"),Cc=Symbol("skip children"),Se=Symbol("remove node");function ri(e,t){let n=Oc(t);V.isDocument(e)?Et(null,e.contents,n,Object.freeze([e]))===Se&&(e.contents=null):Et(null,e,n,Object.freeze([]))}ri.BREAK=ae;ri.SKIP=Cc;ri.REMOVE=Se;function Et(e,t,n,i){let r=Tc(e,t,n,i);if(V.isNode(r)||V.isPair(r))return Ic(e,i,r),Et(e,r,n,i);if(typeof r!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=Et(o,t.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===ae)return ae;s===Se&&(t.items.splice(o,1),o-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let o=Et("key",t.key,n,i);if(o===ae)return ae;o===Se&&(t.key=null);let s=Et("value",t.value,n,i);if(s===ae)return ae;s===Se&&(t.value=null)}}return r}async function oi(e,t){let n=Oc(t);V.isDocument(e)?await xt(null,e.contents,n,Object.freeze([e]))===Se&&(e.contents=null):await xt(null,e,n,Object.freeze([]))}oi.BREAK=ae;oi.SKIP=Cc;oi.REMOVE=Se;async function xt(e,t,n,i){let r=await Tc(e,t,n,i);if(V.isNode(r)||V.isPair(r))return Ic(e,i,r),xt(e,r,n,i);if(typeof r!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=await xt(o,t.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===ae)return ae;s===Se&&(t.items.splice(o,1),o-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let o=await xt("key",t.key,n,i);if(o===ae)return ae;o===Se&&(t.key=null);let s=await xt("value",t.value,n,i);if(s===ae)return ae;s===Se&&(t.value=null)}}return r}function Oc(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Tc(e,t,n,i){if(typeof n=="function")return n(e,t,i);if(V.isMap(t))return n.Map?.(e,t,i);if(V.isSeq(t))return n.Seq?.(e,t,i);if(V.isPair(t))return n.Pair?.(e,t,i);if(V.isScalar(t))return n.Scalar?.(e,t,i);if(V.isAlias(t))return n.Alias?.(e,t,i)}function Ic(e,t,n){let i=t[t.length-1];if(V.isCollection(i))i.items[e]=n;else if(V.isPair(i))e==="key"?i.key=n:i.value=n;else if(V.isDocument(i))i.contents=n;else{let r=V.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}oo.visit=ri;oo.visitAsync=oi});var so=S(Mc=>{"use strict";var Lc=I(),ig=en(),rg={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},og=e=>e.replace(/[!,[\]{}]/g,t=>rg[t]),tn=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,s]=i;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let s=t.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,i,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(r)}catch(s){return n(String(s)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+og(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(t&&i.length>0&&Lc.isNode(t.contents)){let o={};ig.visit(t.contents,(s,a)=>{Lc.isNode(a)&&a.tag&&(o[a.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,s]of i)o==="!!"&&s==="tag:yaml.org,2002:"||(!t||r.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
|
|
4
|
-
`)}};tn.defaultYaml={explicit:!1,version:"1.2"};tn.defaultTags={"!!":"tag:yaml.org,2002:"};
|
|
5
|
-
`)?
|
|
2
|
+
import{n as Cr}from"./chunk-Z4VKGZFA.js";import{a as ue,c as S,e as kr}from"./chunk-D76SO2ME.js";var Vl=S((g_,Kl)=>{var Ne=ue("constants"),Sy=process.cwd,Yn=null,vy=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Yn||(Yn=Sy.call(process)),Yn};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Ur=process.chdir,process.chdir=function(e){Yn=null,Ur.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Ur));var Ur;Kl.exports=Ay;function Ay(e){Ne.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||n(e),e.chown=o(e.chown),e.fchown=o(e.fchown),e.lchown=o(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=s(e.chownSync),e.fchownSync=s(e.fchownSync),e.lchownSync=s(e.lchownSync),e.chmodSync=r(e.chmodSync),e.fchmodSync=r(e.fchmodSync),e.lchmodSync=r(e.lchmodSync),e.stat=a(e.stat),e.fstat=a(e.fstat),e.lstat=a(e.lstat),e.statSync=l(e.statSync),e.fstatSync=l(e.fstatSync),e.lstatSync=l(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(u,f,d){d&&process.nextTick(d)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(u,f,d,p){p&&process.nextTick(p)},e.lchownSync=function(){}),vy==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(u){function f(d,p,y){var m=Date.now(),h=0;u(d,p,function g(b){if(b&&(b.code==="EACCES"||b.code==="EPERM"||b.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){e.stat(p,function(v,x){v&&v.code==="ENOENT"?u(d,p,g):y(b)})},h),h<100&&(h+=10);return}y&&y(b)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,u),f})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(u){function f(d,p,y,m,h,g){var b;if(g&&typeof g=="function"){var v=0;b=function(x,k,C){if(x&&x.code==="EAGAIN"&&v<10)return v++,u.call(e,d,p,y,m,h,b);g.apply(this,arguments)}}return u.call(e,d,p,y,m,h,b)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,u),f})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(u){return function(f,d,p,y,m){for(var h=0;;)try{return u.call(e,f,d,p,y,m)}catch(g){if(g.code==="EAGAIN"&&h<10){h++;continue}throw g}}})(e.readSync);function t(u){u.lchmod=function(f,d,p){u.open(f,Ne.O_WRONLY|Ne.O_SYMLINK,d,function(y,m){if(y){p&&p(y);return}u.fchmod(m,d,function(h){u.close(m,function(g){p&&p(h||g)})})})},u.lchmodSync=function(f,d){var p=u.openSync(f,Ne.O_WRONLY|Ne.O_SYMLINK,d),y=!0,m;try{m=u.fchmodSync(p,d),y=!1}finally{if(y)try{u.closeSync(p)}catch{}else u.closeSync(p)}return m}}function n(u){Ne.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(f,d,p,y){u.open(f,Ne.O_SYMLINK,function(m,h){if(m){y&&y(m);return}u.futimes(h,d,p,function(g){u.close(h,function(b){y&&y(g||b)})})})},u.lutimesSync=function(f,d,p){var y=u.openSync(f,Ne.O_SYMLINK),m,h=!0;try{m=u.futimesSync(y,d,p),h=!1}finally{if(h)try{u.closeSync(y)}catch{}else u.closeSync(y)}return m}):u.futimes&&(u.lutimes=function(f,d,p,y){y&&process.nextTick(y)},u.lutimesSync=function(){})}function i(u){return u&&function(f,d,p){return u.call(e,f,d,function(y){c(y)&&(y=null),p&&p.apply(this,arguments)})}}function r(u){return u&&function(f,d){try{return u.call(e,f,d)}catch(p){if(!c(p))throw p}}}function o(u){return u&&function(f,d,p,y){return u.call(e,f,d,p,function(m){c(m)&&(m=null),y&&y.apply(this,arguments)})}}function s(u){return u&&function(f,d,p){try{return u.call(e,f,d,p)}catch(y){if(!c(y))throw y}}}function a(u){return u&&function(f,d,p){typeof d=="function"&&(p=d,d=null);function y(m,h){h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),p&&p.apply(this,arguments)}return d?u.call(e,f,d,y):u.call(e,f,y)}}function l(u){return u&&function(f,d){var p=d?u.call(e,f,d):u.call(e,f);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function c(u){if(!u||u.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var Wl=S((b_,Gl)=>{var Yl=ue("stream").Stream;Gl.exports=wy;function wy(e){return{ReadStream:t,WriteStream:n};function t(i,r){if(!(this instanceof t))return new t(i,r);Yl.call(this);var o=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,r=r||{};for(var s=Object.keys(r),a=0,l=s.length;a<l;a++){var c=s[a];this[c]=r[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}e.open(this.path,this.flags,this.mode,function(u,f){if(u){o.emit("error",u),o.readable=!1;return}o.fd=f,o.emit("open",f),o._read()})}function n(i,r){if(!(this instanceof n))return new n(i,r);Yl.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var o=Object.keys(r),s=0,a=o.length;s<a;s++){var l=o[s];this[l]=r[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Jl=S((S_,Hl)=>{"use strict";Hl.exports=Ey;var _y=Object.getPrototypeOf||function(e){return e.__proto__};function Ey(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:_y(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}),t}});var Gr=S((v_,Yr)=>{var D=ue("fs"),xy=Vl(),ky=Wl(),Cy=Jl(),Gn=ue("util"),z,Hn;typeof Symbol=="function"&&typeof Symbol.for=="function"?(z=Symbol.for("graceful-fs.queue"),Hn=Symbol.for("graceful-fs.previous")):(z="___graceful-fs.queue",Hn="___graceful-fs.previous");function Oy(){}function zl(e,t){Object.defineProperty(e,z,{get:function(){return t}})}var Ze=Oy;Gn.debuglog?Ze=Gn.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ze=function(){var e=Gn.format.apply(Gn,arguments);e="GFS4: "+e.split(/\n/).join(`
|
|
3
|
+
GFS4: `),console.error(e)});D[z]||(Xl=global[z]||[],zl(D,Xl),D.close=(function(e){function t(n,i){return e.call(D,n,function(r){r||Ql(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,Hn,{value:e}),t})(D.close),D.closeSync=(function(e){function t(n){e.apply(D,arguments),Ql()}return Object.defineProperty(t,Hn,{value:e}),t})(D.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ze(D[z]),ue("assert").equal(D[z].length,0)}));var Xl;global[z]||zl(global,D[z]);Yr.exports=Kr(Cy(D));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!D.__patched&&(Yr.exports=Kr(D),D.__patched=!0);function Kr(e){xy(e),e.gracefulify=Kr,e.createReadStream=k,e.createWriteStream=C;var t=e.readFile;e.readFile=n;function n(A,O,E){return typeof O=="function"&&(E=O,O=null),T(A,O,E);function T($,G,F,q){return t($,G,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?bt([T,[$,G,F],N,q||Date.now(),Date.now()]):typeof F=="function"&&F.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=r;function r(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(G,F,q,N,X){return i(G,F,q,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[G,F,q,N],R,X||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var o=e.appendFile;o&&(e.appendFile=s);function s(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(G,F,q,N,X){return o(G,F,q,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[G,F,q,N],R,X||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var a=e.copyFile;a&&(e.copyFile=l);function l(A,O,E,T){return typeof E=="function"&&(T=E,E=0),$(A,O,E,T);function $(G,F,q,N,X){return a(G,F,q,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[G,F,q,N],R,X||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var c=e.readdir;e.readdir=f;var u=/^v[0-5]\./;function f(A,O,E){typeof O=="function"&&(E=O,O=null);var T=u.test(process.version)?function(F,q,N,X){return c(F,$(F,q,N,X))}:function(F,q,N,X){return c(F,q,$(F,q,N,X))};return T(A,O,E);function $(G,F,q,N){return function(X,R){X&&(X.code==="EMFILE"||X.code==="ENFILE")?bt([T,[G,F,q],X,N||Date.now(),Date.now()]):(R&&R.sort&&R.sort(),typeof q=="function"&&q.call(this,X,R))}}}if(process.version.substr(0,4)==="v0.8"){var d=ky(e);g=d.ReadStream,v=d.WriteStream}var p=e.ReadStream;p&&(g.prototype=Object.create(p.prototype),g.prototype.open=b);var y=e.WriteStream;y&&(v.prototype=Object.create(y.prototype),v.prototype.open=x),Object.defineProperty(e,"ReadStream",{get:function(){return g},set:function(A){g=A},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return v},set:function(A){v=A},enumerable:!0,configurable:!0});var m=g;Object.defineProperty(e,"FileReadStream",{get:function(){return m},set:function(A){m=A},enumerable:!0,configurable:!0});var h=v;Object.defineProperty(e,"FileWriteStream",{get:function(){return h},set:function(A){h=A},enumerable:!0,configurable:!0});function g(A,O){return this instanceof g?(p.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function b(){var A=this;w(A.path,A.flags,A.mode,function(O,E){O?(A.autoClose&&A.destroy(),A.emit("error",O)):(A.fd=E,A.emit("open",E),A.read())})}function v(A,O){return this instanceof v?(y.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function x(){var A=this;w(A.path,A.flags,A.mode,function(O,E){O?(A.destroy(),A.emit("error",O)):(A.fd=E,A.emit("open",E))})}function k(A,O){return new e.ReadStream(A,O)}function C(A,O){return new e.WriteStream(A,O)}var L=e.open;e.open=w;function w(A,O,E,T){return typeof E=="function"&&(T=E,E=null),$(A,O,E,T);function $(G,F,q,N,X){return L(G,F,q,function(R,u_){R&&(R.code==="EMFILE"||R.code==="ENFILE")?bt([$,[G,F,q,N],R,X||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}return e}function bt(e){Ze("ENQUEUE",e[0].name,e[1]),D[z].push(e),Vr()}var Wn;function Ql(){for(var e=Date.now(),t=0;t<D[z].length;++t)D[z][t].length>2&&(D[z][t][3]=e,D[z][t][4]=e);Vr()}function Vr(){if(clearTimeout(Wn),Wn=void 0,D[z].length!==0){var e=D[z].shift(),t=e[0],n=e[1],i=e[2],r=e[3],o=e[4];if(r===void 0)Ze("RETRY",t.name,n),t.apply(null,n);else if(Date.now()-r>=6e4){Ze("TIMEOUT",t.name,n);var s=n.pop();typeof s=="function"&&s.call(null,i)}else{var a=Date.now()-o,l=Math.max(o-r,1),c=Math.min(l*1.2,100);a>=c?(Ze("RETRY",t.name,n),t.apply(null,n.concat([r]))):D[z].push(e)}Wn===void 0&&(Wn=setTimeout(Vr,0))}}});var ec=S((A_,Zl)=>{function fe(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Zl.exports=fe;fe.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};fe.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};fe.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var i=this,r=setTimeout(function(){i._attempts++,i._operationTimeoutCb&&(i._timeout=setTimeout(function(){i._operationTimeoutCb(i._attempts)},i._operationTimeout),i._options.unref&&i._timeout.unref()),i._fn(i._attempts)},n);return this._options.unref&&r.unref(),!0};fe.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};fe.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};fe.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};fe.prototype.start=fe.prototype.try;fe.prototype.errors=function(){return this._errors};fe.prototype.attempts=function(){return this._attempts};fe.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,i=0;i<this._errors.length;i++){var r=this._errors[i],o=r.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=r,n=s)}return t}});var tc=S(et=>{var Ty=ec();et.operation=function(e){var t=et.timeouts(e);return new Ty(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};et.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var i=[],r=0;r<t.retries;r++)i.push(this.createTimeout(r,t));return e&&e.forever&&!i.length&&i.push(this.createTimeout(r,t)),i.sort(function(o,s){return o-s}),i};et.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,i=Math.round(n*t.minTimeout*Math.pow(t.factor,e));return i=Math.min(i,t.maxTimeout),i};et.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var i in e)typeof e[i]=="function"&&n.push(i)}for(var r=0;r<n.length;r++){var o=n[r],s=e[o];e[o]=function(l){var c=et.operation(t),u=Array.prototype.slice.call(arguments,1),f=u.pop();u.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),f.apply(this,arguments))}),c.attempt(function(){l.apply(e,u)})}.bind(e,s),e[o].options=t}}});var ic=S((__,nc)=>{nc.exports=tc()});var rc=S((E_,Jn)=>{Jn.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Jn.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Jn.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var cc=S((x_,At)=>{var P=global.process,tt=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};tt(P)?(oc=ue("assert"),St=rc(),sc=/^win/i.test(P.platform),Qt=ue("events"),typeof Qt!="function"&&(Qt=Qt.EventEmitter),P.__signal_exit_emitter__?H=P.__signal_exit_emitter__:(H=P.__signal_exit_emitter__=new Qt,H.count=0,H.emitted={}),H.infinite||(H.setMaxListeners(1/0),H.infinite=!0),At.exports=function(e,t){if(!tt(global.process))return function(){};oc.equal(typeof e,"function","a callback must be provided for exit handler"),vt===!1&&Wr();var n="exit";t&&t.alwaysLast&&(n="afterexit");var i=function(){H.removeListener(n,e),H.listeners("exit").length===0&&H.listeners("afterexit").length===0&&Xn()};return H.on(n,e),i},Xn=function(){!vt||!tt(global.process)||(vt=!1,St.forEach(function(t){try{P.removeListener(t,Qn[t])}catch{}}),P.emit=zn,P.reallyExit=Hr,H.count-=1)},At.exports.unload=Xn,nt=function(t,n,i){H.emitted[t]||(H.emitted[t]=!0,H.emit(t,n,i))},Qn={},St.forEach(function(e){Qn[e]=function(){if(tt(global.process)){var n=P.listeners(e);n.length===H.count&&(Xn(),nt("exit",null,e),nt("afterexit",null,e),sc&&e==="SIGHUP"&&(e="SIGINT"),P.kill(P.pid,e))}}}),At.exports.signals=function(){return St},vt=!1,Wr=function(){vt||!tt(global.process)||(vt=!0,H.count+=1,St=St.filter(function(t){try{return P.on(t,Qn[t]),!0}catch{return!1}}),P.emit=lc,P.reallyExit=ac)},At.exports.load=Wr,Hr=P.reallyExit,ac=function(t){tt(global.process)&&(P.exitCode=t||0,nt("exit",P.exitCode,null),nt("afterexit",P.exitCode,null),Hr.call(P,P.exitCode))},zn=P.emit,lc=function(t,n){if(t==="exit"&&tt(global.process)){n!==void 0&&(P.exitCode=n);var i=zn.apply(this,arguments);return nt("exit",P.exitCode,null),nt("afterexit",P.exitCode,null),i}else return zn.apply(this,arguments)}):At.exports=function(){return function(){}};var oc,St,sc,Qt,H,Xn,nt,Qn,vt,Wr,Hr,ac,zn,lc});var fc=S((k_,Jr)=>{"use strict";var uc=Symbol();function Iy(e,t,n){let i=t[uc];if(i)return t.stat(e,(o,s)=>{if(o)return n(o);n(null,s.mtime,i)});let r=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,r,r,o=>{if(o)return n(o);t.stat(e,(s,a)=>{if(s)return n(s);let l=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(t,uc,{value:l}),n(null,a.mtime,l)})})}function Ly(e){let t=Date.now();return e==="s"&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}Jr.exports.probe=Iy;Jr.exports.getMtime=Ly});var yc=S((C_,Zt)=>{"use strict";var My=ue("path"),zr=Gr(),Ny=ic(),Ry=cc(),dc=fc(),Ee={};function zt(e,t){return t.lockfilePath||`${e}.lock`}function Zr(e,t,n){if(!t.realpath)return n(null,My.resolve(e));t.fs.realpath(e,n)}function Qr(e,t,n){let i=zt(e,t);t.fs.mkdir(i,r=>{if(!r)return dc.probe(i,t.fs,(o,s,a)=>{if(o)return t.fs.rmdir(i,()=>{}),n(o);n(null,s,a)});if(r.code!=="EEXIST")return n(r);if(t.stale<=0)return n(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));t.fs.stat(i,(o,s)=>{if(o)return o.code==="ENOENT"?Qr(e,{...t,stale:0},n):n(o);if(!pc(s,t))return n(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));mc(e,t,a=>{if(a)return n(a);Qr(e,{...t,stale:0},n)})})})}function pc(e,t){return e.mtime.getTime()<Date.now()-t.stale}function mc(e,t,n){t.fs.rmdir(zt(e,t),i=>{if(i&&i.code!=="ENOENT")return n(i);n()})}function Zn(e,t){let n=Ee[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(i,r)=>{let o=n.lastUpdate+t.stale<Date.now();if(i)return i.code==="ENOENT"||o?Xr(e,n,Object.assign(i,{code:"ECOMPROMISED"})):(n.updateDelay=1e3,Zn(e,t));if(!(n.mtime.getTime()===r.mtime.getTime()))return Xr(e,n,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=dc.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,a,a,l=>{let c=n.lastUpdate+t.stale<Date.now();if(!n.released){if(l)return l.code==="ENOENT"||c?Xr(e,n,Object.assign(l,{code:"ECOMPROMISED"})):(n.updateDelay=1e3,Zn(e,t));n.mtime=a,n.lastUpdate=Date.now(),n.updateDelay=null,Zn(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function Xr(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),Ee[e]===t&&delete Ee[e],t.options.onCompromised(n)}function Py(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:zr,onCompromised:i=>{throw i},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),Zr(e,t,(i,r)=>{if(i)return n(i);let o=Ny.operation(t.retries);o.attempt(()=>{Qr(r,t,(s,a,l)=>{if(o.retry(s))return;if(s)return n(o.mainError());let c=Ee[r]={lockfilePath:zt(r,t),mtime:a,mtimePrecision:l,options:t,lastUpdate:Date.now()};Zn(r,t),n(null,u=>{if(c.released)return u&&u(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));hc(r,{...t,realpath:!1},u)})})})})}function hc(e,t,n){t={fs:zr,realpath:!0,...t},Zr(e,t,(i,r)=>{if(i)return n(i);let o=Ee[r];if(!o)return n(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete Ee[r],mc(r,t,n)})}function Fy(e,t,n){t={stale:1e4,realpath:!0,fs:zr,...t},t.stale=Math.max(t.stale||0,2e3),Zr(e,t,(i,r)=>{if(i)return n(i);t.fs.stat(zt(r,t),(o,s)=>o?o.code==="ENOENT"?n(null,!1):n(o):n(null,!pc(s,t)))})}function Dy(){return Ee}Ry(()=>{for(let e in Ee){let t=Ee[e].options;try{t.fs.rmdirSync(zt(e,t))}catch{}}});Zt.exports.lock=Py;Zt.exports.unlock=hc;Zt.exports.check=Fy;Zt.exports.getLocks=Dy});var bc=S((O_,gc)=>{"use strict";var By=Gr();function qy(e){let t=["mkdir","realpath","stat","rmdir","utimes"],n={...e};return t.forEach(i=>{n[i]=(...r)=>{let o=r.pop(),s;try{s=e[`${i}Sync`](...r)}catch(a){return o(a)}o(null,s)}}),n}function $y(e){return(...t)=>new Promise((n,i)=>{t.push((r,o)=>{r?i(r):n(o)}),e(...t)})}function jy(e){return(...t)=>{let n,i;if(t.push((r,o)=>{n=r,i=o}),e(...t),n)throw n;return i}}function Uy(e){if(e={...e},e.fs=qy(e.fs||By),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}gc.exports={toPromise:$y,toSync:jy,toSyncOptions:Uy}});var to=S((T_,Re)=>{"use strict";var wt=yc(),{toPromise:ei,toSync:ti,toSyncOptions:eo}=bc();async function Sc(e,t){let n=await ei(wt.lock)(e,t);return ei(n)}function Ky(e,t){let n=ti(wt.lock)(e,eo(t));return ti(n)}function Vy(e,t){return ei(wt.unlock)(e,t)}function Yy(e,t){return ti(wt.unlock)(e,eo(t))}function Gy(e,t){return ei(wt.check)(e,t)}function Wy(e,t){return ti(wt.check)(e,eo(t))}Re.exports=Sc;Re.exports.lock=Sc;Re.exports.unlock=Vy;Re.exports.lockSync=Ky;Re.exports.unlockSync=Yy;Re.exports.check=Gy;Re.exports.checkSync=Wy});var I=S(Z=>{"use strict";var ro=Symbol.for("yaml.alias"),xc=Symbol.for("yaml.document"),ni=Symbol.for("yaml.map"),kc=Symbol.for("yaml.pair"),oo=Symbol.for("yaml.scalar"),ii=Symbol.for("yaml.seq"),xe=Symbol.for("yaml.node.type"),Qy=e=>!!e&&typeof e=="object"&&e[xe]===ro,zy=e=>!!e&&typeof e=="object"&&e[xe]===xc,Zy=e=>!!e&&typeof e=="object"&&e[xe]===ni,eg=e=>!!e&&typeof e=="object"&&e[xe]===kc,Cc=e=>!!e&&typeof e=="object"&&e[xe]===oo,tg=e=>!!e&&typeof e=="object"&&e[xe]===ii;function Oc(e){if(e&&typeof e=="object")switch(e[xe]){case ni:case ii:return!0}return!1}function ng(e){if(e&&typeof e=="object")switch(e[xe]){case ro:case ni:case oo:case ii:return!0}return!1}var ig=e=>(Cc(e)||Oc(e))&&!!e.anchor;Z.ALIAS=ro;Z.DOC=xc;Z.MAP=ni;Z.NODE_TYPE=xe;Z.PAIR=kc;Z.SCALAR=oo;Z.SEQ=ii;Z.hasAnchor=ig;Z.isAlias=Qy;Z.isCollection=Oc;Z.isDocument=zy;Z.isMap=Zy;Z.isNode=ng;Z.isPair=eg;Z.isScalar=Cc;Z.isSeq=tg});var en=S(so=>{"use strict";var V=I(),ae=Symbol("break visit"),Tc=Symbol("skip children"),Se=Symbol("remove node");function ri(e,t){let n=Ic(t);V.isDocument(e)?xt(null,e.contents,n,Object.freeze([e]))===Se&&(e.contents=null):xt(null,e,n,Object.freeze([]))}ri.BREAK=ae;ri.SKIP=Tc;ri.REMOVE=Se;function xt(e,t,n,i){let r=Lc(e,t,n,i);if(V.isNode(r)||V.isPair(r))return Mc(e,i,r),xt(e,r,n,i);if(typeof r!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=xt(o,t.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===ae)return ae;s===Se&&(t.items.splice(o,1),o-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let o=xt("key",t.key,n,i);if(o===ae)return ae;o===Se&&(t.key=null);let s=xt("value",t.value,n,i);if(s===ae)return ae;s===Se&&(t.value=null)}}return r}async function oi(e,t){let n=Ic(t);V.isDocument(e)?await kt(null,e.contents,n,Object.freeze([e]))===Se&&(e.contents=null):await kt(null,e,n,Object.freeze([]))}oi.BREAK=ae;oi.SKIP=Tc;oi.REMOVE=Se;async function kt(e,t,n,i){let r=await Lc(e,t,n,i);if(V.isNode(r)||V.isPair(r))return Mc(e,i,r),kt(e,r,n,i);if(typeof r!="symbol"){if(V.isCollection(t)){i=Object.freeze(i.concat(t));for(let o=0;o<t.items.length;++o){let s=await kt(o,t.items[o],n,i);if(typeof s=="number")o=s-1;else{if(s===ae)return ae;s===Se&&(t.items.splice(o,1),o-=1)}}}else if(V.isPair(t)){i=Object.freeze(i.concat(t));let o=await kt("key",t.key,n,i);if(o===ae)return ae;o===Se&&(t.key=null);let s=await kt("value",t.value,n,i);if(s===ae)return ae;s===Se&&(t.value=null)}}return r}function Ic(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Lc(e,t,n,i){if(typeof n=="function")return n(e,t,i);if(V.isMap(t))return n.Map?.(e,t,i);if(V.isSeq(t))return n.Seq?.(e,t,i);if(V.isPair(t))return n.Pair?.(e,t,i);if(V.isScalar(t))return n.Scalar?.(e,t,i);if(V.isAlias(t))return n.Alias?.(e,t,i)}function Mc(e,t,n){let i=t[t.length-1];if(V.isCollection(i))i.items[e]=n;else if(V.isPair(i))e==="key"?i.key=n:i.value=n;else if(V.isDocument(i))i.contents=n;else{let r=V.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}so.visit=ri;so.visitAsync=oi});var ao=S(Rc=>{"use strict";var Nc=I(),rg=en(),og={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},sg=e=>e.replace(/[!,[\]{}]/g,t=>og[t]),tn=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),r=i.shift();switch(r){case"%TAG":{if(i.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[o,s]=i;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=i;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let s=t.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,i,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);let o=this.tags[i];if(o)try{return o+decodeURIComponent(r)}catch(s){return n(String(s)),null}return i==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,i]of Object.entries(this.tags))if(t.startsWith(i))return n+sg(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),r;if(t&&i.length>0&&Nc.isNode(t.contents)){let o={};rg.visit(t.contents,(s,a)=>{Nc.isNode(a)&&a.tag&&(o[a.tag]=!0)}),r=Object.keys(o)}else r=[];for(let[o,s]of i)o==="!!"&&s==="tag:yaml.org,2002:"||(!t||r.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
|
|
4
|
+
`)}};tn.defaultYaml={explicit:!1,version:"1.2"};tn.defaultTags={"!!":"tag:yaml.org,2002:"};Rc.Directives=tn});var si=S(nn=>{"use strict";var Pc=I(),ag=en();function lg(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function Fc(e){let t=new Set;return ag.visit(e,{Value(n,i){i.anchor&&t.add(i.anchor)}}),t}function Dc(e,t){for(let n=1;;++n){let i=`${e}${n}`;if(!t.has(i))return i}}function cg(e,t){let n=[],i=new Map,r=null;return{onAnchor:o=>{n.push(o),r??(r=Fc(e));let s=Dc(t,r);return r.add(s),s},setAnchors:()=>{for(let o of n){let s=i.get(o);if(typeof s=="object"&&s.anchor&&(Pc.isScalar(s.node)||Pc.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:i}}nn.anchorIsValid=lg;nn.anchorNames=Fc;nn.createNodeAnchors=cg;nn.findNewAnchor=Dc});var lo=S(Bc=>{"use strict";function rn(e,t,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let r=0,o=i.length;r<o;++r){let s=i[r],a=rn(e,i,String(r),s);a===void 0?delete i[r]:a!==s&&(i[r]=a)}else if(i instanceof Map)for(let r of Array.from(i.keys())){let o=i.get(r),s=rn(e,i,r,o);s===void 0?i.delete(r):s!==o&&i.set(r,s)}else if(i instanceof Set)for(let r of Array.from(i)){let o=rn(e,i,r,r);o===void 0?i.delete(r):o!==r&&(i.delete(r),i.add(o))}else for(let[r,o]of Object.entries(i)){let s=rn(e,i,r,o);s===void 0?delete i[r]:s!==o&&(i[r]=s)}return e.call(t,n,i)}Bc.applyReviver=rn});var Fe=S($c=>{"use strict";var ug=I();function qc(e,t,n){if(Array.isArray(e))return e.map((i,r)=>qc(i,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!ug.hasAnchor(e))return e.toJSON(t,n);let i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=o=>{i.res=o,delete n.onCreate};let r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!n?.keep?Number(e):e}$c.toJS=qc});var ai=S(Uc=>{"use strict";var fg=lo(),jc=I(),dg=Fe(),co=class{constructor(t){Object.defineProperty(this,jc.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){if(!jc.isDocument(t))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=dg.toJS(this,"",s);if(typeof r=="function")for(let{count:l,res:c}of s.anchors.values())r(c,l);return typeof o=="function"?fg.applyReviver(o,{"":a},"",a):a}};Uc.NodeBase=co});var on=S(Kc=>{"use strict";var pg=si(),mg=en(),Ct=I(),hg=ai(),yg=Fe(),uo=class extends hg.NodeBase{constructor(t){super(Ct.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],mg.visit(t,{Node:(o,s)=>{(Ct.isAlias(s)||Ct.hasAnchor(s))&&i.push(s)}}),n&&(n.aliasResolveCache=i));let r;for(let o of i){if(o===this)break;o.anchor===this.source&&(r=o)}return r}toJSON(t,n){if(!n)return{source:this.source};let{anchors:i,doc:r,maxAliasCount:o}=n,s=this.resolve(r,n);if(!s){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=i.get(s);if(a||(yg.toJS(s,null,n),a=i.get(s)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=li(r,s,i)),a.count*a.aliasCount>o)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(t,n,i){let r=`*${this.source}`;if(t){if(pg.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(t.implicitKey)return`${r} `}return r}};function li(e,t,n){if(Ct.isAlias(t)){let i=t.resolve(e),r=n&&i&&n.get(i);return r?r.count*r.aliasCount:0}else if(Ct.isCollection(t)){let i=0;for(let r of t.items){let o=li(e,r,n);o>i&&(i=o)}return i}else if(Ct.isPair(t)){let i=li(e,t.key,n),r=li(e,t.value,n);return Math.max(i,r)}return 1}Kc.Alias=uo});var U=S(fo=>{"use strict";var gg=I(),bg=ai(),Sg=Fe(),vg=e=>!e||typeof e!="function"&&typeof e!="object",De=class extends bg.NodeBase{constructor(t){super(gg.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:Sg.toJS(this.value,t,n)}toString(){return String(this.value)}};De.BLOCK_FOLDED="BLOCK_FOLDED";De.BLOCK_LITERAL="BLOCK_LITERAL";De.PLAIN="PLAIN";De.QUOTE_DOUBLE="QUOTE_DOUBLE";De.QUOTE_SINGLE="QUOTE_SINGLE";fo.Scalar=De;fo.isScalarValue=vg});var sn=S(Yc=>{"use strict";var Ag=on(),rt=I(),Vc=U(),wg="tag:yaml.org,2002:";function _g(e,t,n){if(t){let i=n.filter(o=>o.tag===t),r=i.find(o=>!o.format)??i[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(i=>i.identify?.(e)&&!i.format)}function Eg(e,t,n){if(rt.isDocument(e)&&(e=e.contents),rt.isNode(e))return e;if(rt.isPair(e)){let f=n.schema[rt.MAP].createNode?.(n.schema,null,n);return f.items.push(e),f}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:r,onTagObj:o,schema:s,sourceObjects:a}=n,l;if(i&&e&&typeof e=="object"){if(l=a.get(e),l)return l.anchor??(l.anchor=r(e)),new Ag.Alias(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t=wg+t.slice(2));let c=_g(e,t,s.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let f=new Vc.Scalar(e);return l&&(l.node=f),f}c=e instanceof Map?s[rt.MAP]:Symbol.iterator in Object(e)?s[rt.SEQ]:s[rt.MAP]}o&&(o(c),delete n.onTagObj);let u=c?.createNode?c.createNode(n.schema,e,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,e,n):new Vc.Scalar(e);return t?u.tag=t:c.default||(u.tag=c.tag),l&&(l.node=u),u}Yc.createNode=Eg});var ui=S(ci=>{"use strict";var xg=sn(),ve=I(),kg=ai();function po(e,t,n){let i=n;for(let r=t.length-1;r>=0;--r){let o=t[r];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=i,i=s}else i=new Map([[o,i]])}return xg.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var Gc=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,mo=class extends kg.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(i=>ve.isNode(i)||ve.isPair(i)?i.clone(t):i),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Gc(t))this.add(n);else{let[i,...r]=t,o=this.get(i,!0);if(ve.isCollection(o))o.addIn(r,n);else if(o===void 0&&this.schema)this.set(i,po(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}deleteIn(t){let[n,...i]=t;if(i.length===0)return this.delete(n);let r=this.get(n,!0);if(ve.isCollection(r))return r.deleteIn(i);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}getIn(t,n){let[i,...r]=t,o=this.get(i,!0);return r.length===0?!n&&ve.isScalar(o)?o.value:o:ve.isCollection(o)?o.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!ve.isPair(n))return!1;let i=n.value;return i==null||t&&ve.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[n,...i]=t;if(i.length===0)return this.has(n);let r=this.get(n,!0);return ve.isCollection(r)?r.hasIn(i):!1}setIn(t,n){let[i,...r]=t;if(r.length===0)this.set(i,n);else{let o=this.get(i,!0);if(ve.isCollection(o))o.setIn(r,n);else if(o===void 0&&this.schema)this.set(i,po(this.schema,r,n));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}}};ci.Collection=mo;ci.collectionFromPath=po;ci.isEmptyPath=Gc});var an=S(fi=>{"use strict";var Cg=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function ho(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Og=(e,t,n)=>e.endsWith(`
|
|
5
|
+
`)?ho(n,t):n.includes(`
|
|
6
6
|
`)?`
|
|
7
|
-
`+
|
|
8
|
-
`)n===
|
|
7
|
+
`+ho(n,t):(e.endsWith(" ")?"":" ")+n;fi.indentComment=ho;fi.lineComment=Og;fi.stringifyComment=Cg});var Hc=S(ln=>{"use strict";var Tg="flow",yo="block",di="quoted";function Ig(e,t,n="flow",{indentAtStart:i,lineWidth:r=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!r||r<0)return e;r<o&&(o=0);let l=Math.max(1+o,1+r-t.length);if(e.length<=l)return e;let c=[],u={},f=r-t.length;typeof i=="number"&&(i>r-Math.max(2,o)?c.push(0):f=r-i);let d,p,y=!1,m=-1,h=-1,g=-1;n===yo&&(m=Wc(e,m,t.length),m!==-1&&(f=m+l));for(let v;v=e[m+=1];){if(n===di&&v==="\\"){switch(h=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}g=m}if(v===`
|
|
8
|
+
`)n===yo&&(m=Wc(e,m,t.length)),f=m+t.length+l,d=void 0;else{if(v===" "&&p&&p!==" "&&p!==`
|
|
9
9
|
`&&p!==" "){let x=e[m+1];x&&x!==" "&&x!==`
|
|
10
10
|
`&&x!==" "&&(d=m)}if(m>=f)if(d)c.push(d),f=d+l,d=void 0;else if(n===di){for(;p===" "||p===" ";)p=v,v=e[m+=1],y=!0;let x=m>g+1?m-2:h-1;if(u[x])return e;c.push(x),u[x]=!0,f=x+l,d=void 0}else y=!0}p=v}if(y&&a&&a(),c.length===0)return e;s&&s();let b=e.slice(0,c[0]);for(let v=0;v<c.length;++v){let x=c[v],k=c[v+1]||e.length;x===0?b=`
|
|
11
11
|
${t}${e.slice(0,k)}`:(n===di&&u[x]&&(b+=`${e[x]}\\`),b+=`
|
|
12
|
-
${t}${e.slice(x+1,k)}`)}return b}function
|
|
13
|
-
`);i=t,r=t+1,o=e[r]}return i}ln.FOLD_BLOCK=
|
|
12
|
+
${t}${e.slice(x+1,k)}`)}return b}function Wc(e,t,n){let i=t,r=t+1,o=e[r];for(;o===" "||o===" ";)if(t<r+n)o=e[++t];else{do o=e[++t];while(o&&o!==`
|
|
13
|
+
`);i=t,r=t+1,o=e[r]}return i}ln.FOLD_BLOCK=yo;ln.FOLD_FLOW=Tg;ln.FOLD_QUOTED=di;ln.foldFlowLines=Ig});var un=S(Jc=>{"use strict";var pe=U(),Be=Hc(),mi=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),hi=e=>/^(%|---|\.\.\.)/m.test(e);function Lg(e,t,n){if(!t||t<0)return!1;let i=t-n,r=e.length;if(r<=i)return!1;for(let o=0,s=0;o<r;++o)if(e[o]===`
|
|
14
14
|
`){if(o-s>i)return!0;if(s=o+1,r-s<=i)return!1}return!0}function cn(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:i}=t,r=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(hi(e)?" ":""),s="",a=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(s+=n.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{s+=n.slice(a,l);let u=n.substr(l+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(i||n[l+2]==='"'||n.length<r)l+=1;else{for(s+=n.slice(a,l)+`
|
|
15
15
|
|
|
16
16
|
`;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)s+=`
|
|
17
|
-
`,l+=2;s+=o,n[l+2]===" "&&(s+="\\"),l+=1,a=l+1}break;default:l+=1}return s=a?s+n.slice(a):n,i?s:
|
|
17
|
+
`,l+=2;s+=o,n[l+2]===" "&&(s+="\\"),l+=1,a=l+1}break;default:l+=1}return s=a?s+n.slice(a):n,i?s:Be.foldFlowLines(s,o,Be.FOLD_QUOTED,mi(t,!1))}function go(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
18
18
|
`)||/[ \t]\n|\n[ \t]/.test(e))return cn(e,t);let n=t.indent||(hi(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
-
${n}`)+"'";return t.implicitKey?i:
|
|
19
|
+
${n}`)+"'";return t.implicitKey?i:Be.foldFlowLines(i,n,Be.FOLD_FLOW,mi(t,!1))}function Ot(e,t){let{singleQuote:n}=t.options,i;if(n===!1)i=cn;else{let r=e.includes('"'),o=e.includes("'");r&&!o?i=go:o&&!r?i=cn:i=n?go:cn}return i(e,t)}var bo;try{bo=new RegExp(`(^|(?<!
|
|
20
20
|
))
|
|
21
21
|
+(?!
|
|
22
|
-
|$)`,"g")}catch{
|
|
22
|
+
|$)`,"g")}catch{bo=/\n+(?!\n|$)/g}function pi({comment:e,type:t,value:n},i,r,o){let{blockQuote:s,commentString:a,lineWidth:l}=i.options;if(!s||/\n[\t ]+$/.test(n))return Ot(n,i);let c=i.indent||(i.forceBlockIndent||hi(n)?" ":""),u=s==="literal"?!0:s==="folded"||t===pe.Scalar.BLOCK_FOLDED?!1:t===pe.Scalar.BLOCK_LITERAL?!0:!Lg(n,l,c.length);if(!n)return u?`|
|
|
23
23
|
`:`>
|
|
24
24
|
`;let f,d;for(d=n.length;d>0;--d){let k=n[d-1];if(k!==`
|
|
25
25
|
`&&k!==" "&&k!==" ")break}let p=n.substring(d),y=p.indexOf(`
|
|
26
26
|
`);y===-1?f="-":n===p||y!==p.length-1?(f="+",o&&o()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
27
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
27
|
+
`&&(p=p.slice(0,-1)),p=p.replace(bo,`$&${c}`));let m=!1,h,g=-1;for(h=0;h<n.length;++h){let k=n[h];if(k===" ")m=!0;else if(k===`
|
|
28
28
|
`)g=h;else break}let b=n.substring(0,g<h?g+1:h);b&&(n=n.substring(b.length),b=b.replace(/\n+/g,`$&${c}`));let x=(m?c?"2":"1":"")+f;if(e&&(x+=" "+a(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!u){let k=n.replace(/\n+/g,`
|
|
29
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),C=!1,L=mi(i,!0);s!=="folded"&&t!==pe.Scalar.BLOCK_FOLDED&&(L.onOverflow=()=>{C=!0});let w=
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),C=!1,L=mi(i,!0);s!=="folded"&&t!==pe.Scalar.BLOCK_FOLDED&&(L.onOverflow=()=>{C=!0});let w=Be.foldFlowLines(`${b}${k}${p}`,c,Be.FOLD_BLOCK,L);if(!C)return`>${x}
|
|
30
30
|
${c}${w}`}return n=n.replace(/\n+/g,`$&${c}`),`|${x}
|
|
31
|
-
${c}${b}${n}${p}`}function
|
|
32
|
-
`)||u&&/[[\]{},]/.test(o))return
|
|
33
|
-
`)?
|
|
34
|
-
`))return pi(e,t,n,i);if(hi(o)){if(l==="")return t.forceBlockIndent=!0,pi(e,t,n,i);if(a&&l===c)return
|
|
35
|
-
${l}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:y}=t.doc.schema;if(y.some(d)||p?.some(d))return
|
|
36
|
-
${t.indent}${a}`:a}
|
|
37
|
-
${a}:`):(h=`${h}:`,d&&(h+=dn.lineComment(h,n.indent,c(d))));let g,b,v;ke.isNode(t)?(g=!!t.spaceBefore,b=t.commentBefore,v=t.comment):(g=!1,b=null,v=null,t&&typeof t=="object"&&(t=s.createNode(t))),n.implicitKey=!1,!p&&!d&&ke.isScalar(t)&&(n.indentAtStart=h.length+1),m=!1,!u&&l.length>=2&&!n.inFlow&&!p&&ke.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let x=!1,k=
|
|
31
|
+
${c}${b}${n}${p}`}function Mg(e,t,n,i){let{type:r,value:o}=e,{actualString:s,implicitKey:a,indent:l,indentStep:c,inFlow:u}=t;if(a&&o.includes(`
|
|
32
|
+
`)||u&&/[[\]{},]/.test(o))return Ot(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
|
|
33
|
+
`)?Ot(o,t):pi(e,t,n,i);if(!a&&!u&&r!==pe.Scalar.PLAIN&&o.includes(`
|
|
34
|
+
`))return pi(e,t,n,i);if(hi(o)){if(l==="")return t.forceBlockIndent=!0,pi(e,t,n,i);if(a&&l===c)return Ot(o,t)}let f=o.replace(/\n+/g,`$&
|
|
35
|
+
${l}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:y}=t.doc.schema;if(y.some(d)||p?.some(d))return Ot(o,t)}return a?f:Be.foldFlowLines(f,l,Be.FOLD_FLOW,mi(t,!1))}function Ng(e,t,n,i){let{implicitKey:r,inFlow:o}=t,s=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==pe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=pe.Scalar.QUOTE_DOUBLE);let l=u=>{switch(u){case pe.Scalar.BLOCK_FOLDED:case pe.Scalar.BLOCK_LITERAL:return r||o?Ot(s.value,t):pi(s,t,n,i);case pe.Scalar.QUOTE_DOUBLE:return cn(s.value,t);case pe.Scalar.QUOTE_SINGLE:return go(s.value,t);case pe.Scalar.PLAIN:return Mg(s,t,n,i);default:return null}},c=l(a);if(c===null){let{defaultKeyType:u,defaultStringType:f}=t.options,d=r&&u||f;if(c=l(d),c===null)throw new Error(`Unsupported default string type ${d}`)}return c}Jc.stringifyString=Ng});var fn=S(So=>{"use strict";var Rg=si(),qe=I(),Pg=an(),Fg=un();function Dg(e,t){let n=Object.assign({blockQuote:!0,commentString:Pg.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function Bg(e,t){if(t.tag){let r=e.filter(o=>o.tag===t.tag);if(r.length>0)return r.find(o=>o.format===t.format)??r[0]}let n,i;if(qe.isScalar(t)){i=t.value;let r=e.filter(o=>o.identify?.(i));if(r.length>1){let o=r.filter(s=>s.test);o.length>0&&(r=o)}n=r.find(o=>o.format===t.format)??r.find(o=>!o.format)}else i=t,n=e.find(r=>r.nodeClass&&i instanceof r.nodeClass);if(!n){let r=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${r} value`)}return n}function qg(e,t,{anchors:n,doc:i}){if(!i.directives)return"";let r=[],o=(qe.isScalar(e)||qe.isCollection(e))&&e.anchor;o&&Rg.anchorIsValid(o)&&(n.add(o),r.push(`&${o}`));let s=e.tag??(t.default?null:t.tag);return s&&r.push(i.directives.tagString(s)),r.join(" ")}function $g(e,t,n,i){if(qe.isPair(e))return e.toString(t,n,i);if(qe.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r,o=qe.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>r=l});r??(r=Bg(t.doc.schema.tags,o));let s=qg(o,r,t);s.length>0&&(t.indentAtStart=(t.indentAtStart??0)+s.length+1);let a=typeof r.stringify=="function"?r.stringify(o,t,n,i):qe.isScalar(o)?Fg.stringifyString(o,t,n,i):o.toString(t,n,i);return s?qe.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
36
|
+
${t.indent}${a}`:a}So.createStringifyContext=Dg;So.stringify=$g});var Zc=S(zc=>{"use strict";var ke=I(),Xc=U(),Qc=fn(),dn=an();function jg({key:e,value:t},n,i,r){let{allNullValues:o,doc:s,indent:a,indentStep:l,options:{commentString:c,indentSeq:u,simpleKeys:f}}=n,d=ke.isNode(e)&&e.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ke.isCollection(e)||!ke.isNode(e)&&typeof e=="object"){let L="With simple keys, collection cannot be used as a key value";throw new Error(L)}}let p=!f&&(!e||d&&t==null&&!n.inFlow||ke.isCollection(e)||(ke.isScalar(e)?e.type===Xc.Scalar.BLOCK_FOLDED||e.type===Xc.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!o),indent:a+l});let y=!1,m=!1,h=Qc.stringify(e,n,()=>y=!0,()=>m=!0);if(!p&&!n.inFlow&&h.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(o||t==null)return y&&i&&i(),h===""?"?":p?`? ${h}`:h}else if(o&&!f||t==null&&p)return h=`? ${h}`,d&&!y?h+=dn.lineComment(h,n.indent,c(d)):m&&r&&r(),h;y&&(d=null),p?(d&&(h+=dn.lineComment(h,n.indent,c(d))),h=`? ${h}
|
|
37
|
+
${a}:`):(h=`${h}:`,d&&(h+=dn.lineComment(h,n.indent,c(d))));let g,b,v;ke.isNode(t)?(g=!!t.spaceBefore,b=t.commentBefore,v=t.comment):(g=!1,b=null,v=null,t&&typeof t=="object"&&(t=s.createNode(t))),n.implicitKey=!1,!p&&!d&&ke.isScalar(t)&&(n.indentAtStart=h.length+1),m=!1,!u&&l.length>=2&&!n.inFlow&&!p&&ke.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let x=!1,k=Qc.stringify(t,n,()=>x=!0,()=>m=!0),C=" ";if(d||g||b){if(C=g?`
|
|
38
38
|
`:"",b){let L=c(b);C+=`
|
|
39
39
|
${dn.indentComment(L,n.indent)}`}k===""&&!n.inFlow?C===`
|
|
40
40
|
`&&v&&(C=`
|
|
@@ -43,34 +43,34 @@ ${dn.indentComment(L,n.indent)}`}k===""&&!n.inFlow?C===`
|
|
|
43
43
|
${n.indent}`}else if(!p&&ke.isCollection(t)){let L=k[0],w=k.indexOf(`
|
|
44
44
|
`),A=w!==-1,O=n.inFlow??t.flow??t.items.length===0;if(A||!O){let E=!1;if(A&&(L==="&"||L==="!")){let T=k.indexOf(" ");L==="&"&&T!==-1&&T<w&&k[T+1]==="!"&&(T=k.indexOf(" ",T+1)),(T===-1||w<T)&&(E=!0)}E||(C=`
|
|
45
45
|
${n.indent}`)}}else(k===""||k[0]===`
|
|
46
|
-
`)&&(C="");return h+=C+k,n.inFlow?x&&i&&i():v&&!x?h+=dn.lineComment(h,n.indent,c(v)):m&&r&&r(),h}
|
|
46
|
+
`)&&(C="");return h+=C+k,n.inFlow?x&&i&&i():v&&!x?h+=dn.lineComment(h,n.indent,c(v)):m&&r&&r(),h}zc.stringifyPair=jg});var Ao=S(vo=>{"use strict";var eu=ue("process");function Ug(e,...t){e==="debug"&&console.log(...t)}function Kg(e,t){(e==="debug"||e==="warn")&&(typeof eu.emitWarning=="function"?eu.emitWarning(t):console.warn(t))}vo.debug=Ug;vo.warn=Kg});var vi=S(Si=>{"use strict";var bi=I(),tu=U(),yi="<<",gi={identify:e=>e===yi||typeof e=="symbol"&&e.description===yi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new tu.Scalar(Symbol(yi)),{addToJSMap:nu}),stringify:()=>yi},Vg=(e,t)=>(gi.identify(t)||bi.isScalar(t)&&(!t.type||t.type===tu.Scalar.PLAIN)&&gi.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===gi.tag&&n.default);function nu(e,t,n){let i=iu(e,n);if(bi.isSeq(i))for(let r of i.items)wo(e,t,r);else if(Array.isArray(i))for(let r of i)wo(e,t,r);else wo(e,t,i)}function wo(e,t,n){let i=iu(e,n);if(!bi.isMap(i))throw new Error("Merge sources must be maps or map aliases");let r=i.toJSON(null,e,Map);for(let[o,s]of r)t instanceof Map?t.has(o)||t.set(o,s):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return t}function iu(e,t){return e&&bi.isAlias(t)?t.resolve(e.doc,e):t}Si.addMergeToJSMap=nu;Si.isMergeKey=Vg;Si.merge=gi});var Eo=S(su=>{"use strict";var Yg=Ao(),ru=vi(),Gg=fn(),ou=I(),_o=Fe();function Wg(e,t,{key:n,value:i}){if(ou.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(ru.isMergeKey(e,n))ru.addMergeToJSMap(e,t,i);else{let r=_o.toJS(n,"",e);if(t instanceof Map)t.set(r,_o.toJS(i,r,e));else if(t instanceof Set)t.add(r);else{let o=Hg(n,r,e),s=_o.toJS(i,o,e);o in t?Object.defineProperty(t,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[o]=s}}return t}function Hg(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(ou.isNode(e)&&n?.doc){let i=Gg.createStringifyContext(n.doc,{});i.anchors=new Set;for(let o of n.anchors.keys())i.anchors.add(o.anchor);i.inFlow=!0,i.inStringifyKey=!0;let r=e.toString(i);if(!n.mapKeyWarned){let o=JSON.stringify(r);o.length>40&&(o=o.substring(0,36)+'..."'),Yg.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}su.addPairToJSMap=Wg});var $e=S(xo=>{"use strict";var au=sn(),Jg=Zc(),Xg=Eo(),Ai=I();function Qg(e,t,n){let i=au.createNode(e,void 0,n),r=au.createNode(t,void 0,n);return new wi(i,r)}var wi=class e{constructor(t,n=null){Object.defineProperty(this,Ai.NODE_TYPE,{value:Ai.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:i}=this;return Ai.isNode(n)&&(n=n.clone(t)),Ai.isNode(i)&&(i=i.clone(t)),new e(n,i)}toJSON(t,n){let i=n?.mapAsMap?new Map:{};return Xg.addPairToJSMap(n,i,this)}toString(t,n,i){return t?.doc?Jg.stringifyPair(this,t,n,i):JSON.stringify(this)}};xo.Pair=wi;xo.createPair=Qg});var ko=S(cu=>{"use strict";var ot=I(),lu=fn(),_i=an();function zg(e,t,n){return(t.inFlow??e.flow?eb:Zg)(e,t,n)}function Zg({comment:e,items:t},n,{blockItemPrefix:i,flowChars:r,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:l,options:{commentString:c}}=n,u=Object.assign({},n,{indent:o,type:null}),f=!1,d=[];for(let y=0;y<t.length;++y){let m=t[y],h=null;if(ot.isNode(m))!f&&m.spaceBefore&&d.push(""),Ei(n,d,m.commentBefore,f),m.comment&&(h=m.comment);else if(ot.isPair(m)){let b=ot.isNode(m.key)?m.key:null;b&&(!f&&b.spaceBefore&&d.push(""),Ei(n,d,b.commentBefore,f))}f=!1;let g=lu.stringify(m,u,()=>h=null,()=>f=!0);h&&(g+=_i.lineComment(g,o,c(h))),f&&h&&(f=!1),d.push(i+g)}let p;if(d.length===0)p=r.start+r.end;else{p=d[0];for(let y=1;y<d.length;++y){let m=d[y];p+=m?`
|
|
47
47
|
${l}${m}`:`
|
|
48
48
|
`}}return e?(p+=`
|
|
49
|
-
`+_i.indentComment(c(e),l),a&&a()):f&&s&&s(),p}function
|
|
49
|
+
`+_i.indentComment(c(e),l),a&&a()):f&&s&&s(),p}function eb({items:e},t,{flowChars:n,itemIndent:i}){let{indent:r,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=t;i+=o;let l=Object.assign({},t,{indent:i,inFlow:!0,type:null}),c=!1,u=0,f=[];for(let y=0;y<e.length;++y){let m=e[y],h=null;if(ot.isNode(m))m.spaceBefore&&f.push(""),Ei(t,f,m.commentBefore,!1),m.comment&&(h=m.comment);else if(ot.isPair(m)){let b=ot.isNode(m.key)?m.key:null;b&&(b.spaceBefore&&f.push(""),Ei(t,f,b.commentBefore,!1),b.comment&&(c=!0));let v=ot.isNode(m.value)?m.value:null;v?(v.comment&&(h=v.comment),v.commentBefore&&(c=!0)):m.value==null&&b?.comment&&(h=b.comment)}h&&(c=!0);let g=lu.stringify(m,l,()=>h=null);c||(c=f.length>u||g.includes(`
|
|
50
50
|
`)),y<e.length-1?g+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=f.reduce((b,v)=>b+v.length+2,2)+(g.length+2)>t.options.lineWidth)),c&&(g+=",")),h&&(g+=_i.lineComment(g,i,a(h))),f.push(g),u=f.length}let{start:d,end:p}=n;if(f.length===0)return d+p;if(!c){let y=f.reduce((m,h)=>m+h.length+2,2);c=t.options.lineWidth>0&&y>t.options.lineWidth}if(c){let y=d;for(let m of f)y+=m?`
|
|
51
51
|
${o}${r}${m}`:`
|
|
52
52
|
`;return`${y}
|
|
53
|
-
${r}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function Ei({indent:e,options:{commentString:t}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let o=_i.indentComment(t(i),e);n.push(o.trimStart())}}
|
|
54
|
-
`:" ")}return Db.stringifyString({comment:e,type:t,value:a},i,r,o)}};
|
|
53
|
+
${r}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function Ei({indent:e,options:{commentString:t}},n,i,r){if(i&&r&&(i=i.replace(/^\n+/,"")),i){let o=_i.indentComment(t(i),e);n.push(o.trimStart())}}cu.stringifyCollection=zg});var Ue=S(Oo=>{"use strict";var tb=ko(),nb=Eo(),ib=ui(),je=I(),xi=$e(),rb=U();function pn(e,t){let n=je.isScalar(t)?t.value:t;for(let i of e)if(je.isPair(i)&&(i.key===t||i.key===n||je.isScalar(i.key)&&i.key.value===n))return i}var Co=class extends ib.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(je.MAP,t),this.items=[]}static from(t,n,i){let{keepUndefined:r,replacer:o}=i,s=new this(t),a=(l,c)=>{if(typeof o=="function")c=o.call(n,l,c);else if(Array.isArray(o)&&!o.includes(l))return;(c!==void 0||r)&&s.items.push(xi.createPair(l,c,i))};if(n instanceof Map)for(let[l,c]of n)a(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof t.sortMapEntries=="function"&&s.items.sort(t.sortMapEntries),s}add(t,n){let i;je.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new xi.Pair(t,t?.value):i=new xi.Pair(t.key,t.value);let r=pn(this.items,i.key),o=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${i.key} already set`);je.isScalar(r.value)&&rb.isScalarValue(i.value)?r.value.value=i.value:r.value=i.value}else if(o){let s=this.items.findIndex(a=>o(i,a)<0);s===-1?this.items.push(i):this.items.splice(s,0,i)}else this.items.push(i)}delete(t){let n=pn(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let r=pn(this.items,t)?.value;return(!n&&je.isScalar(r)?r.value:r)??void 0}has(t){return!!pn(this.items,t)}set(t,n){this.add(new xi.Pair(t,n),!0)}toJSON(t,n,i){let r=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let o of this.items)nb.addPairToJSMap(n,r,o);return r}toString(t,n,i){if(!t)return JSON.stringify(this);for(let r of this.items)if(!je.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),tb.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:n})}};Oo.YAMLMap=Co;Oo.findPair=pn});var Tt=S(fu=>{"use strict";var ob=I(),uu=Ue(),sb={collection:"map",default:!0,nodeClass:uu.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return ob.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>uu.YAMLMap.from(e,t,n)};fu.map=sb});var Ke=S(du=>{"use strict";var ab=sn(),lb=ko(),cb=ui(),Ci=I(),ub=U(),fb=Fe(),To=class extends cb.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Ci.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=ki(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let i=ki(t);if(typeof i!="number")return;let r=this.items[i];return!n&&Ci.isScalar(r)?r.value:r}has(t){let n=ki(t);return typeof n=="number"&&n<this.items.length}set(t,n){let i=ki(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let r=this.items[i];Ci.isScalar(r)&&ub.isScalarValue(n)?r.value=n:this.items[i]=n}toJSON(t,n){let i=[];n?.onCreate&&n.onCreate(i);let r=0;for(let o of this.items)i.push(fb.toJS(o,String(r++),n));return i}toString(t,n,i){return t?lb.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof r=="function"){let l=n instanceof Set?a:String(s++);a=r.call(n,l,a)}o.items.push(ab.createNode(a,void 0,i))}}return o}};function ki(e){let t=Ci.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}du.YAMLSeq=To});var It=S(mu=>{"use strict";var db=I(),pu=Ke(),pb={collection:"seq",default:!0,nodeClass:pu.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return db.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>pu.YAMLSeq.from(e,t,n)};mu.seq=pb});var mn=S(hu=>{"use strict";var mb=un(),hb={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,i){return t=Object.assign({actualString:!0},t),mb.stringifyString(e,t,n,i)}};hu.string=hb});var Oi=S(bu=>{"use strict";var yu=U(),gu={identify:e=>e==null,createNode:()=>new yu.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new yu.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&gu.test.test(e)?e:t.options.nullStr};bu.nullTag=gu});var Io=S(vu=>{"use strict";var yb=U(),Su={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new yb.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Su.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?n.options.trueStr:n.options.falseStr}};vu.boolTag=Su});var Lt=S(Au=>{"use strict";function gb({format:e,minFractionDigits:t,tag:n,value:i}){if(typeof i=="bigint")return String(i);let r=typeof i=="number"?i:Number(i);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let o=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=t-(o.length-s-1);for(;a-- >0;)o+="0"}return o}Au.stringifyNumber=gb});var Mo=S(Ti=>{"use strict";var bb=U(),Lo=Lt(),Sb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Lo.stringifyNumber},vb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Lo.stringifyNumber(e)}},Ab={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new bb.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Lo.stringifyNumber};Ti.float=Ab;Ti.floatExp=vb;Ti.floatNaN=Sb});var Ro=S(Li=>{"use strict";var wu=Lt(),Ii=e=>typeof e=="bigint"||Number.isInteger(e),No=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function _u(e,t,n){let{value:i}=e;return Ii(i)&&i>=0?n+i.toString(t):wu.stringifyNumber(e)}var wb={identify:e=>Ii(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>No(e,2,8,n),stringify:e=>_u(e,8,"0o")},_b={identify:Ii,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>No(e,0,10,n),stringify:wu.stringifyNumber},Eb={identify:e=>Ii(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>No(e,2,16,n),stringify:e=>_u(e,16,"0x")};Li.int=_b;Li.intHex=Eb;Li.intOct=wb});var xu=S(Eu=>{"use strict";var xb=Tt(),kb=Oi(),Cb=It(),Ob=mn(),Tb=Io(),Po=Mo(),Fo=Ro(),Ib=[xb.map,Cb.seq,Ob.string,kb.nullTag,Tb.boolTag,Fo.intOct,Fo.int,Fo.intHex,Po.floatNaN,Po.floatExp,Po.float];Eu.schema=Ib});var Ou=S(Cu=>{"use strict";var Lb=U(),Mb=Tt(),Nb=It();function ku(e){return typeof e=="bigint"||Number.isInteger(e)}var Mi=({value:e})=>JSON.stringify(e),Rb=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Mi},{identify:e=>e==null,createNode:()=>new Lb.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Mi},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Mi},{identify:ku,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>ku(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Mi}],Pb={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Fb=[Mb.map,Nb.seq].concat(Rb,Pb);Cu.schema=Fb});var Bo=S(Tu=>{"use strict";var hn=ue("buffer"),Do=U(),Db=un(),Bb={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof hn.Buffer=="function")return hn.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(n.length);for(let r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},i,r,o){if(!n)return"";let s=n,a;if(typeof hn.Buffer=="function")a=s instanceof hn.Buffer?s.toString("base64"):hn.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<s.length;++c)l+=String.fromCharCode(s[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Do.Scalar.BLOCK_LITERAL),t!==Do.Scalar.QUOTE_DOUBLE){let l=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),c=Math.ceil(a.length/l),u=new Array(c);for(let f=0,d=0;f<c;++f,d+=l)u[f]=a.substr(d,l);a=u.join(t===Do.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return Db.stringifyString({comment:e,type:t,value:a},i,r,o)}};Tu.binary=Bb});var Pi=S(Ri=>{"use strict";var Ni=I(),qo=$e(),qb=U(),$b=Ke();function Iu(e,t){if(Ni.isSeq(e))for(let n=0;n<e.items.length;++n){let i=e.items[n];if(!Ni.isPair(i)){if(Ni.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let r=i.items[0]||new qo.Pair(new qb.Scalar(null));if(i.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${i.commentBefore}
|
|
55
55
|
${r.key.commentBefore}`:i.commentBefore),i.comment){let o=r.value??r.key;o.comment=o.comment?`${i.comment}
|
|
56
|
-
${o.comment}`:i.comment}i=r}e.items[n]=Ni.isPair(i)?i:new Bo.Pair(i)}}else t("Expected a sequence for this tag");return e}function Tu(e,t,n){let{replacer:i}=n,r=new qb.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){typeof i=="function"&&(s=i.call(t,String(o++),s));let a,l;if(Array.isArray(s))if(s.length===2)a=s[0],l=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let c=Object.keys(s);if(c.length===1)a=c[0],l=s[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=s;r.items.push(Bo.createPair(a,l,n))}return r}var $b={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ou,createNode:Tu};Pi.createPairs=Tu;Pi.pairs=$b;Pi.resolvePairs=Ou});var jo=S($o=>{"use strict";var Iu=I(),qo=Re(),yn=je(),jb=Ue(),Lu=Ri(),st=class e extends jb.YAMLSeq{constructor(){super(),this.add=yn.YAMLMap.prototype.add.bind(this),this.delete=yn.YAMLMap.prototype.delete.bind(this),this.get=yn.YAMLMap.prototype.get.bind(this),this.has=yn.YAMLMap.prototype.has.bind(this),this.set=yn.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let o,s;if(Iu.isPair(r)?(o=qo.toJS(r.key,"",n),s=qo.toJS(r.value,o,n)):o=qo.toJS(r,"",n),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,s)}return i}static from(t,n,i){let r=Lu.createPairs(t,n,i),o=new this;return o.items=r.items,o}};st.tag="tag:yaml.org,2002:omap";var Ub={collection:"seq",identify:e=>e instanceof Map,nodeClass:st,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=Lu.resolvePairs(e,t),i=[];for(let{key:r}of n.items)Iu.isScalar(r)&&(i.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new st,n)},createNode:(e,t,n)=>st.from(e,t,n)};$o.YAMLOMap=st;$o.omap=Ub});var Du=S(Uo=>{"use strict";var Mu=U();function Nu({value:e,source:t},n){return t&&(e?Pu:Ru).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Pu={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Mu.Scalar(!0),stringify:Nu},Ru={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Mu.Scalar(!1),stringify:Nu};Uo.falseTag=Ru;Uo.trueTag=Pu});var Fu=S(Di=>{"use strict";var Kb=U(),Ko=It(),Vb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ko.stringifyNumber},Yb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Ko.stringifyNumber(e)}},Gb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Kb.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:Ko.stringifyNumber};Di.float=Gb;Di.floatExp=Yb;Di.floatNaN=Vb});var qu=S(bn=>{"use strict";var Bu=It(),gn=e=>typeof e=="bigint"||Number.isInteger(e);function Fi(e,t,n,{intAsBigInt:i}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return r==="-"?BigInt(-1)*s:s}let o=parseInt(e,n);return r==="-"?-1*o:o}function Vo(e,t,n){let{value:i}=e;if(gn(i)){let r=i.toString(t);return i<0?"-"+n+r.substr(1):n+r}return Bu.stringifyNumber(e)}var Wb={identify:gn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Fi(e,2,2,n),stringify:e=>Vo(e,2,"0b")},Hb={identify:gn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Fi(e,1,8,n),stringify:e=>Vo(e,8,"0")},Jb={identify:gn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Fi(e,0,10,n),stringify:Bu.stringifyNumber},Xb={identify:gn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Fi(e,2,16,n),stringify:e=>Vo(e,16,"0x")};bn.int=Jb;bn.intBin=Wb;bn.intHex=Xb;bn.intOct=Hb});var Go=S(Yo=>{"use strict";var $i=I(),Bi=qe(),qi=je(),at=class e extends qi.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;$i.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Bi.Pair(t.key,null):n=new Bi.Pair(t,null),qi.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let i=qi.findPair(this.items,t);return!n&&$i.isPair(i)?$i.isScalar(i.key)?i.key.value:i.key:i}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=qi.findPair(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new Bi.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof r=="function"&&(s=r.call(n,s,s)),o.items.push(Bi.createPair(s,null,i));return o}};at.tag="tag:yaml.org,2002:set";var Qb={collection:"map",identify:e=>e instanceof Set,nodeClass:at,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>at.from(e,t,n),resolve(e,t){if($i.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new at,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Yo.YAMLSet=at;Yo.set=Qb});var Ho=S(ji=>{"use strict";var zb=It();function Wo(e,t){let n=e[0],i=n==="-"||n==="+"?e.substring(1):e,r=s=>t?BigInt(s):Number(s),o=i.replace(/_/g,"").split(":").reduce((s,a)=>s*r(60)+r(a),r(0));return n==="-"?r(-1)*o:o}function $u(e){let{value:t}=e,n=s=>s;if(typeof t=="bigint")n=s=>BigInt(s);else if(isNaN(t)||!isFinite(t))return zb.stringifyNumber(e);let i="";t<0&&(i="-",t*=n(-1));let r=n(60),o=[t%r];return t<60?o.unshift(0):(t=(t-o[0])/r,o.unshift(t%r),t>=60&&(t=(t-o[0])/r,o.unshift(t))),i+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Zb={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Wo(e,n),stringify:$u},e0={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Wo(e,!1),stringify:$u},ju={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(ju.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,o,s,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,i-1,r,o||0,s||0,a||0,l),u=t[8];if(u&&u!=="Z"){let f=Wo(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ji.floatTime=e0;ji.intTime=Zb;ji.timestamp=ju});var Vu=S(Ku=>{"use strict";var t0=Ot(),n0=Oi(),i0=Tt(),r0=mn(),o0=Fo(),Uu=Du(),Jo=Fu(),Ui=qu(),s0=vi(),a0=jo(),l0=Ri(),c0=Go(),Xo=Ho(),u0=[t0.map,i0.seq,r0.string,n0.nullTag,Uu.trueTag,Uu.falseTag,Ui.intBin,Ui.intOct,Ui.int,Ui.intHex,Jo.floatNaN,Jo.floatExp,Jo.float,o0.binary,s0.merge,a0.omap,l0.pairs,c0.set,Xo.intTime,Xo.floatTime,Xo.timestamp];Ku.schema=u0});var ef=S(Zo=>{"use strict";var Hu=Ot(),f0=Oi(),Ju=Tt(),d0=mn(),p0=To(),Qo=Lo(),zo=No(),m0=_u(),h0=ku(),Xu=Fo(),Sn=vi(),Qu=jo(),zu=Ri(),Yu=Vu(),Zu=Go(),Ki=Ho(),Gu=new Map([["core",m0.schema],["failsafe",[Hu.map,Ju.seq,d0.string]],["json",h0.schema],["yaml11",Yu.schema],["yaml-1.1",Yu.schema]]),Wu={binary:Xu.binary,bool:p0.boolTag,float:Qo.float,floatExp:Qo.floatExp,floatNaN:Qo.floatNaN,floatTime:Ki.floatTime,int:zo.int,intHex:zo.intHex,intOct:zo.intOct,intTime:Ki.intTime,map:Hu.map,merge:Sn.merge,null:f0.nullTag,omap:Qu.omap,pairs:zu.pairs,seq:Ju.seq,set:Zu.set,timestamp:Ki.timestamp},y0={"tag:yaml.org,2002:binary":Xu.binary,"tag:yaml.org,2002:merge":Sn.merge,"tag:yaml.org,2002:omap":Qu.omap,"tag:yaml.org,2002:pairs":zu.pairs,"tag:yaml.org,2002:set":Zu.set,"tag:yaml.org,2002:timestamp":Ki.timestamp};function g0(e,t,n){let i=Gu.get(t);if(i&&!e)return n&&!i.includes(Sn.merge)?i.concat(Sn.merge):i.slice();let r=i;if(!r)if(Array.isArray(e))r=[];else{let o=Array.from(Gu.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)r=r.concat(o);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(Sn.merge)),r.reduce((o,s)=>{let a=typeof s=="string"?Wu[s]:s;if(!a){let l=JSON.stringify(s),c=Object.keys(Wu).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return o.includes(a)||o.push(a),o},[])}Zo.coreKnownTags=y0;Zo.getTags=g0});var ns=S(tf=>{"use strict";var es=I(),b0=Ot(),S0=Tt(),v0=mn(),Vi=ef(),A0=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,ts=class e{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:r,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?Vi.getTags(t,"compat"):t?Vi.getTags(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?Vi.coreKnownTags:{},this.tags=Vi.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,es.MAP,{value:b0.map}),Object.defineProperty(this,es.SCALAR,{value:v0.string}),Object.defineProperty(this,es.SEQ,{value:S0.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?A0:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};tf.Schema=ts});var rf=S(nf=>{"use strict";var w0=I(),is=fn(),vn=an();function _0(e,t){let n=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");let r=is.createStringifyContext(e,t),{commentString:o}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=o(e.commentBefore);n.unshift(vn.indentComment(l,""))}let s=!1,a=null;if(e.contents){if(w0.isNode(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){let u=o(e.contents.commentBefore);n.push(vn.indentComment(u,""))}r.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>s=!0,c=is.stringify(e.contents,r,()=>a=null,l);a&&(c+=vn.lineComment(c,"",o(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(is.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let l=o(e.comment);l.includes(`
|
|
56
|
+
${o.comment}`:i.comment}i=r}e.items[n]=Ni.isPair(i)?i:new qo.Pair(i)}}else t("Expected a sequence for this tag");return e}function Lu(e,t,n){let{replacer:i}=n,r=new $b.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let s of t){typeof i=="function"&&(s=i.call(t,String(o++),s));let a,l;if(Array.isArray(s))if(s.length===2)a=s[0],l=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let c=Object.keys(s);if(c.length===1)a=c[0],l=s[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=s;r.items.push(qo.createPair(a,l,n))}return r}var jb={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Iu,createNode:Lu};Ri.createPairs=Lu;Ri.pairs=jb;Ri.resolvePairs=Iu});var Uo=S(jo=>{"use strict";var Mu=I(),$o=Fe(),yn=Ue(),Ub=Ke(),Nu=Pi(),st=class e extends Ub.YAMLSeq{constructor(){super(),this.add=yn.YAMLMap.prototype.add.bind(this),this.delete=yn.YAMLMap.prototype.delete.bind(this),this.get=yn.YAMLMap.prototype.get.bind(this),this.has=yn.YAMLMap.prototype.has.bind(this),this.set=yn.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let i=new Map;n?.onCreate&&n.onCreate(i);for(let r of this.items){let o,s;if(Mu.isPair(r)?(o=$o.toJS(r.key,"",n),s=$o.toJS(r.value,o,n)):o=$o.toJS(r,"",n),i.has(o))throw new Error("Ordered maps must not include duplicate keys");i.set(o,s)}return i}static from(t,n,i){let r=Nu.createPairs(t,n,i),o=new this;return o.items=r.items,o}};st.tag="tag:yaml.org,2002:omap";var Kb={collection:"seq",identify:e=>e instanceof Map,nodeClass:st,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=Nu.resolvePairs(e,t),i=[];for(let{key:r}of n.items)Mu.isScalar(r)&&(i.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):i.push(r.value));return Object.assign(new st,n)},createNode:(e,t,n)=>st.from(e,t,n)};jo.YAMLOMap=st;jo.omap=Kb});var Bu=S(Ko=>{"use strict";var Ru=U();function Pu({value:e,source:t},n){return t&&(e?Fu:Du).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Fu={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ru.Scalar(!0),stringify:Pu},Du={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ru.Scalar(!1),stringify:Pu};Ko.falseTag=Du;Ko.trueTag=Fu});var qu=S(Fi=>{"use strict";var Vb=U(),Vo=Lt(),Yb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Vo.stringifyNumber},Gb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Vo.stringifyNumber(e)}},Wb={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Vb.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let i=e.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:Vo.stringifyNumber};Fi.float=Wb;Fi.floatExp=Gb;Fi.floatNaN=Yb});var ju=S(bn=>{"use strict";var $u=Lt(),gn=e=>typeof e=="bigint"||Number.isInteger(e);function Di(e,t,n,{intAsBigInt:i}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let s=BigInt(e);return r==="-"?BigInt(-1)*s:s}let o=parseInt(e,n);return r==="-"?-1*o:o}function Yo(e,t,n){let{value:i}=e;if(gn(i)){let r=i.toString(t);return i<0?"-"+n+r.substr(1):n+r}return $u.stringifyNumber(e)}var Hb={identify:gn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Di(e,2,2,n),stringify:e=>Yo(e,2,"0b")},Jb={identify:gn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Di(e,1,8,n),stringify:e=>Yo(e,8,"0")},Xb={identify:gn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Di(e,0,10,n),stringify:$u.stringifyNumber},Qb={identify:gn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Di(e,2,16,n),stringify:e=>Yo(e,16,"0x")};bn.int=Xb;bn.intBin=Hb;bn.intHex=Qb;bn.intOct=Jb});var Wo=S(Go=>{"use strict";var $i=I(),Bi=$e(),qi=Ue(),at=class e extends qi.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;$i.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Bi.Pair(t.key,null):n=new Bi.Pair(t,null),qi.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let i=qi.findPair(this.items,t);return!n&&$i.isPair(i)?$i.isScalar(i.key)?i.key.value:i.key:i}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let i=qi.findPair(this.items,t);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new Bi.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(t,n,i){let{replacer:r}=i,o=new this(t);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof r=="function"&&(s=r.call(n,s,s)),o.items.push(Bi.createPair(s,null,i));return o}};at.tag="tag:yaml.org,2002:set";var zb={collection:"map",identify:e=>e instanceof Set,nodeClass:at,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>at.from(e,t,n),resolve(e,t){if($i.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new at,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Go.YAMLSet=at;Go.set=zb});var Jo=S(ji=>{"use strict";var Zb=Lt();function Ho(e,t){let n=e[0],i=n==="-"||n==="+"?e.substring(1):e,r=s=>t?BigInt(s):Number(s),o=i.replace(/_/g,"").split(":").reduce((s,a)=>s*r(60)+r(a),r(0));return n==="-"?r(-1)*o:o}function Uu(e){let{value:t}=e,n=s=>s;if(typeof t=="bigint")n=s=>BigInt(s);else if(isNaN(t)||!isFinite(t))return Zb.stringifyNumber(e);let i="";t<0&&(i="-",t*=n(-1));let r=n(60),o=[t%r];return t<60?o.unshift(0):(t=(t-o[0])/r,o.unshift(t%r),t>=60&&(t=(t-o[0])/r,o.unshift(t))),i+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var e0={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Ho(e,n),stringify:Uu},t0={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Ho(e,!1),stringify:Uu},Ku={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Ku.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,i,r,o,s,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,i-1,r,o||0,s||0,a||0,l),u=t[8];if(u&&u!=="Z"){let f=Ho(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ji.floatTime=t0;ji.intTime=e0;ji.timestamp=Ku});var Gu=S(Yu=>{"use strict";var n0=Tt(),i0=Oi(),r0=It(),o0=mn(),s0=Bo(),Vu=Bu(),Xo=qu(),Ui=ju(),a0=vi(),l0=Uo(),c0=Pi(),u0=Wo(),Qo=Jo(),f0=[n0.map,r0.seq,o0.string,i0.nullTag,Vu.trueTag,Vu.falseTag,Ui.intBin,Ui.intOct,Ui.int,Ui.intHex,Xo.floatNaN,Xo.floatExp,Xo.float,s0.binary,a0.merge,l0.omap,c0.pairs,u0.set,Qo.intTime,Qo.floatTime,Qo.timestamp];Yu.schema=f0});var nf=S(es=>{"use strict";var Xu=Tt(),d0=Oi(),Qu=It(),p0=mn(),m0=Io(),zo=Mo(),Zo=Ro(),h0=xu(),y0=Ou(),zu=Bo(),Sn=vi(),Zu=Uo(),ef=Pi(),Wu=Gu(),tf=Wo(),Ki=Jo(),Hu=new Map([["core",h0.schema],["failsafe",[Xu.map,Qu.seq,p0.string]],["json",y0.schema],["yaml11",Wu.schema],["yaml-1.1",Wu.schema]]),Ju={binary:zu.binary,bool:m0.boolTag,float:zo.float,floatExp:zo.floatExp,floatNaN:zo.floatNaN,floatTime:Ki.floatTime,int:Zo.int,intHex:Zo.intHex,intOct:Zo.intOct,intTime:Ki.intTime,map:Xu.map,merge:Sn.merge,null:d0.nullTag,omap:Zu.omap,pairs:ef.pairs,seq:Qu.seq,set:tf.set,timestamp:Ki.timestamp},g0={"tag:yaml.org,2002:binary":zu.binary,"tag:yaml.org,2002:merge":Sn.merge,"tag:yaml.org,2002:omap":Zu.omap,"tag:yaml.org,2002:pairs":ef.pairs,"tag:yaml.org,2002:set":tf.set,"tag:yaml.org,2002:timestamp":Ki.timestamp};function b0(e,t,n){let i=Hu.get(t);if(i&&!e)return n&&!i.includes(Sn.merge)?i.concat(Sn.merge):i.slice();let r=i;if(!r)if(Array.isArray(e))r=[];else{let o=Array.from(Hu.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${o} or define customTags array`)}if(Array.isArray(e))for(let o of e)r=r.concat(o);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(Sn.merge)),r.reduce((o,s)=>{let a=typeof s=="string"?Ju[s]:s;if(!a){let l=JSON.stringify(s),c=Object.keys(Ju).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return o.includes(a)||o.push(a),o},[])}es.coreKnownTags=g0;es.getTags=b0});var is=S(rf=>{"use strict";var ts=I(),S0=Tt(),v0=It(),A0=mn(),Vi=nf(),w0=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,ns=class e{constructor({compat:t,customTags:n,merge:i,resolveKnownTags:r,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(t)?Vi.getTags(t,"compat"):t?Vi.getTags(null,t):null,this.name=typeof o=="string"&&o||"core",this.knownTags=r?Vi.coreKnownTags:{},this.tags=Vi.getTags(n,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,ts.MAP,{value:S0.map}),Object.defineProperty(this,ts.SCALAR,{value:A0.string}),Object.defineProperty(this,ts.SEQ,{value:v0.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?w0:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};rf.Schema=ns});var sf=S(of=>{"use strict";var _0=I(),rs=fn(),vn=an();function E0(e,t){let n=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");let r=rs.createStringifyContext(e,t),{commentString:o}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=o(e.commentBefore);n.unshift(vn.indentComment(l,""))}let s=!1,a=null;if(e.contents){if(_0.isNode(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){let u=o(e.contents.commentBefore);n.push(vn.indentComment(u,""))}r.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>s=!0,c=rs.stringify(e.contents,r,()=>a=null,l);a&&(c+=vn.lineComment(c,"",o(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(rs.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let l=o(e.comment);l.includes(`
|
|
57
57
|
`)?(n.push("..."),n.push(vn.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=e.comment;l&&s&&(l=l.replace(/^\n+/,"")),l&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(vn.indentComment(o(l),"")))}return n.join(`
|
|
58
58
|
`)+`
|
|
59
|
-
`}
|
|
59
|
+
`}of.stringifyDocument=E0});var An=S(af=>{"use strict";var x0=on(),Mt=ui(),de=I(),k0=$e(),C0=Fe(),O0=is(),T0=sf(),os=si(),I0=lo(),L0=sn(),ss=ao(),as=class e{constructor(t,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,de.NODE_TYPE,{value:de.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:i===void 0&&n&&(i=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=o;let{version:s}=o;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new ss.Directives({version:s}),this.setSchema(s,i),this.contents=t===void 0?null:this.createNode(t,r,i)}clone(){let t=Object.create(e.prototype,{[de.NODE_TYPE]:{value:de.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=de.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Nt(this.contents)&&this.contents.add(t)}addIn(t,n){Nt(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let i=os.anchorNames(this);t.anchor=!n||i.has(n)?os.findNewAnchor(n||"a",i):n}return new x0.Alias(t.anchor)}createNode(t,n,i){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){let h=b=>typeof b=="number"||b instanceof String||b instanceof Number,g=n.filter(h).map(String);g.length>0&&(n=n.concat(g)),r=n}else i===void 0&&n&&(i=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:l,onTagObj:c,tag:u}=i??{},{onAnchor:f,setAnchors:d,sourceObjects:p}=os.createNodeAnchors(this,s||"a"),y={aliasDuplicateObjects:o??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:p},m=L0.createNode(t,u,y);return a&&de.isCollection(m)&&(m.flow=!0),d(),m}createPair(t,n,i={}){let r=this.createNode(t,null,i),o=this.createNode(n,null,i);return new k0.Pair(r,o)}delete(t){return Nt(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Mt.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Nt(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return de.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Mt.isEmptyPath(t)?!n&&de.isScalar(this.contents)?this.contents.value:this.contents:de.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return de.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Mt.isEmptyPath(t)?this.contents!==void 0:de.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Mt.collectionFromPath(this.schema,[t],n):Nt(this.contents)&&this.contents.set(t,n)}setIn(t,n){Mt.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=Mt.collectionFromPath(this.schema,Array.from(t),n):Nt(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ss.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new ss.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new O0.Schema(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:i,maxAliasCount:r,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},l=C0.toJS(this.contents,n??"",a);if(typeof o=="function")for(let{count:c,res:u}of a.anchors.values())o(u,c);return typeof s=="function"?I0.applyReviver(s,{"":l},"",l):l}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return T0.stringifyDocument(this,t)}};function Nt(e){if(de.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}af.Document=as});var En=S(_n=>{"use strict";var wn=class extends Error{constructor(t,n,i,r){super(),this.name=t,this.code=i,this.message=r,this.pos=n}},ls=class extends wn{constructor(t,n,i){super("YAMLParseError",t,n,i)}},cs=class extends wn{constructor(t,n,i){super("YAMLWarning",t,n,i)}},M0=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>t.linePos(a));let{line:i,col:r}=n.linePos[0];n.message+=` at line ${i}, column ${r}`;let o=r-1,s=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(s.substring(0,o))){let a=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
60
60
|
`),s=a+s}if(/[^ ]/.test(s)){let a=1,l=n.linePos[1];l?.line===i&&l.col>r&&(a=Math.max(1,Math.min(l.col-r,80-o)));let c=" ".repeat(o)+"^".repeat(a);n.message+=`:
|
|
61
61
|
|
|
62
62
|
${s}
|
|
63
63
|
${c}
|
|
64
|
-
`}};_n.YAMLError=wn;_n.YAMLParseError=
|
|
65
|
-
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(
|
|
66
|
-
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||
|
|
67
|
-
`+v.comment:b.comment=v.comment);let x=new
|
|
68
|
-
`+C.comment:c.comment=C.comment),f=C.end;continue}!s&&n.options.strict&&
|
|
69
|
-
`+L:w.comment=L,C.comment=C.comment.substring(L.length+1)}}if(!s&&!x&&!C.found){let L=k?e(n,k,C,r):t(n,C.end,x,null,C,r);c.items.push(L),f=L.range[2],
|
|
70
|
-
`+A.comment:w.comment=A.comment);let E=new
|
|
71
|
-
`+h.comment:c.comment=h.comment),c.range=[i.offset,m,h.offset]}else c.range=[i.offset,m,m];return c}
|
|
64
|
+
`}};_n.YAMLError=wn;_n.YAMLParseError=ls;_n.YAMLWarning=cs;_n.prettifyError=M0});var xn=S(lf=>{"use strict";function N0(e,{flow:t,indicator:n,next:i,offset:r,onError:o,parentIndent:s,startOnNewline:a}){let l=!1,c=a,u=a,f="",d="",p=!1,y=!1,m=null,h=null,g=null,b=null,v=null,x=null,k=null;for(let w of e)switch(y&&(w.type!=="space"&&w.type!=="newline"&&w.type!=="comma"&&o(w.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),m&&(c&&w.type!=="comment"&&w.type!=="newline"&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),w.type){case"space":!t&&(n!=="doc-start"||i?.type!=="flow-collection")&&w.source.includes(" ")&&(m=w),u=!0;break;case"comment":{u||o(w,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=w.source.substring(1)||" ";f?f+=d+A:f=A,d="",c=!1;break}case"newline":c?f?f+=w.source:(!x||n!=="seq-item-ind")&&(l=!0):d+=w.source,c=!0,p=!0,(h||g)&&(b=w),u=!0;break;case"anchor":h&&o(w,"MULTIPLE_ANCHORS","A node can have at most one anchor"),w.source.endsWith(":")&&o(w.offset+w.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=w,k??(k=w.offset),c=!1,u=!1,y=!0;break;case"tag":{g&&o(w,"MULTIPLE_TAGS","A node can have at most one tag"),g=w,k??(k=w.offset),c=!1,u=!1,y=!0;break}case n:(h||g)&&o(w,"BAD_PROP_ORDER",`Anchors and tags must be after the ${w.source} indicator`),x&&o(w,"UNEXPECTED_TOKEN",`Unexpected ${w.source} in ${t??"collection"}`),x=w,c=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(t){v&&o(w,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),v=w,c=!1,u=!1;break}default:o(w,"UNEXPECTED_TOKEN",`Unexpected ${w.type} token`),c=!1,u=!1}let C=e[e.length-1],L=C?C.offset+C.source.length:r;return y&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&o(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.indent<=s||i?.type==="block-map"||i?.type==="block-seq")&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:v,found:x,spaceBefore:l,comment:f,hasNewline:p,anchor:h,tag:g,newlineAfterProp:b,end:L,start:k??L}}lf.resolveProps=N0});var Yi=S(cf=>{"use strict";function us(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
65
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(us(t.key)||us(t.value))return!0}return!1;default:return!0}}cf.containsNewline=us});var fs=S(uf=>{"use strict";var R0=Yi();function P0(e,t,n){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&R0.containsNewline(t)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}uf.flowIndentCheck=P0});var ds=S(df=>{"use strict";var ff=I();function F0(e,t,n){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let r=typeof i=="function"?i:(o,s)=>o===s||ff.isScalar(o)&&ff.isScalar(s)&&o.value===s.value;return t.some(o=>r(o.key,n))}df.mapIncludes=F0});var bf=S(gf=>{"use strict";var pf=$e(),D0=Ue(),mf=xn(),B0=Yi(),hf=fs(),q0=ds(),yf="All mapping items must start at the same column";function $0({composeNode:e,composeEmptyNode:t},n,i,r,o){let s=o?.nodeClass??D0.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let l=i.offset,c=null;for(let u of i.items){let{start:f,key:d,sep:p,value:y}=u,m=mf.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:l,onError:r,parentIndent:i.indent,startOnNewline:!0}),h=!m.found;if(h){if(d&&(d.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==i.indent&&r(l,"BAD_INDENT",yf)),!m.anchor&&!m.tag&&!p){c=m.end,m.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||B0.containsNewline(d))&&r(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==i.indent&&r(l,"BAD_INDENT",yf);n.atKey=!0;let g=m.end,b=d?e(n,d,m,r):t(n,g,f,null,m,r);n.schema.compat&&hf.flowIndentCheck(i.indent,d,r),n.atKey=!1,q0.mapIncludes(n,a.items,b)&&r(g,"DUPLICATE_KEY","Map keys must be unique");let v=mf.resolveProps(p??[],{indicator:"map-value-ind",next:y,offset:b.range[2],onError:r,parentIndent:i.indent,startOnNewline:!d||d.type==="block-scalar"});if(l=v.end,v.found){h&&(y?.type==="block-map"&&!v.hasNewline&&r(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<v.found.offset-1024&&r(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=y?e(n,y,v,r):t(n,l,p,null,v,r);n.schema.compat&&hf.flowIndentCheck(i.indent,y,r),l=x.range[2];let k=new pf.Pair(b,x);n.options.keepSourceTokens&&(k.srcToken=u),a.items.push(k)}else{h&&r(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),v.comment&&(b.comment?b.comment+=`
|
|
67
|
+
`+v.comment:b.comment=v.comment);let x=new pf.Pair(b);n.options.keepSourceTokens&&(x.srcToken=u),a.items.push(x)}}return c&&c<l&&r(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,l,c??l],a}gf.resolveBlockMap=$0});var vf=S(Sf=>{"use strict";var j0=Ke(),U0=xn(),K0=fs();function V0({composeNode:e,composeEmptyNode:t},n,i,r,o){let s=o?.nodeClass??j0.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=i.offset,c=null;for(let{start:u,value:f}of i.items){let d=U0.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:l,onError:r,parentIndent:i.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?r(d.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{c=d.end,d.comment&&(a.comment=d.comment);continue}let p=f?e(n,f,d,r):t(n,d.end,u,null,d,r);n.schema.compat&&K0.flowIndentCheck(i.indent,f,r),l=p.range[2],a.items.push(p)}return a.range=[i.offset,l,c??l],a}Sf.resolveBlockSeq=V0});var Rt=S(Af=>{"use strict";function Y0(e,t,n,i){let r="";if(e){let o=!1,s="";for(let a of e){let{source:l,type:c}=a;switch(c){case"space":o=!0;break;case"comment":{n&&!o&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=l.substring(1)||" ";r?r+=s+u:r=u,s="";break}case"newline":r&&(s+=l),o=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=l.length}}return{comment:r,offset:t}}Af.resolveEnd=Y0});var xf=S(Ef=>{"use strict";var G0=I(),W0=$e(),wf=Ue(),H0=Ke(),J0=Rt(),_f=xn(),X0=Yi(),Q0=ds(),ps="Block collections are not allowed within flow collections",ms=e=>e&&(e.type==="block-map"||e.type==="block-seq");function z0({composeNode:e,composeEmptyNode:t},n,i,r,o){let s=i.start.source==="{",a=s?"flow map":"flow sequence",l=o?.nodeClass??(s?wf.YAMLMap:H0.YAMLSeq),c=new l(n.schema);c.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=i.offset+i.start.source.length;for(let h=0;h<i.items.length;++h){let g=i.items[h],{start:b,key:v,sep:x,value:k}=g,C=_f.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:v??x?.[0],offset:f,onError:r,parentIndent:i.indent,startOnNewline:!1});if(!C.found){if(!C.anchor&&!C.tag&&!x&&!k){h===0&&C.comma?r(C.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<i.items.length-1&&r(C.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),C.comment&&(c.comment?c.comment+=`
|
|
68
|
+
`+C.comment:c.comment=C.comment),f=C.end;continue}!s&&n.options.strict&&X0.containsNewline(v)&&r(v,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)C.comma&&r(C.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(C.comma||r(C.start,"MISSING_CHAR",`Missing , between ${a} items`),C.comment){let L="";e:for(let w of b)switch(w.type){case"comma":case"space":break;case"comment":L=w.source.substring(1);break e;default:break e}if(L){let w=c.items[c.items.length-1];G0.isPair(w)&&(w=w.value??w.key),w.comment?w.comment+=`
|
|
69
|
+
`+L:w.comment=L,C.comment=C.comment.substring(L.length+1)}}if(!s&&!x&&!C.found){let L=k?e(n,k,C,r):t(n,C.end,x,null,C,r);c.items.push(L),f=L.range[2],ms(k)&&r(L.range,"BLOCK_IN_FLOW",ps)}else{n.atKey=!0;let L=C.end,w=v?e(n,v,C,r):t(n,L,b,null,C,r);ms(v)&&r(w.range,"BLOCK_IN_FLOW",ps),n.atKey=!1;let A=_f.resolveProps(x??[],{flow:a,indicator:"map-value-ind",next:k,offset:w.range[2],onError:r,parentIndent:i.indent,startOnNewline:!1});if(A.found){if(!s&&!C.found&&n.options.strict){if(x)for(let T of x){if(T===A.found)break;if(T.type==="newline"){r(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}C.start<A.found.offset-1024&&r(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source?.[0]===":"?r(k,"MISSING_CHAR",`Missing space after : in ${a}`):r(A.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let O=k?e(n,k,A,r):A.found?t(n,A.end,x,null,A,r):null;O?ms(k)&&r(O.range,"BLOCK_IN_FLOW",ps):A.comment&&(w.comment?w.comment+=`
|
|
70
|
+
`+A.comment:w.comment=A.comment);let E=new W0.Pair(w,O);if(n.options.keepSourceTokens&&(E.srcToken=g),s){let T=c;Q0.mapIncludes(n,T.items,w)&&r(L,"DUPLICATE_KEY","Map keys must be unique"),T.items.push(E)}else{let T=new wf.YAMLMap(n.schema);T.flow=!0,T.items.push(E);let $=(O??w).range;T.range=[w.range[0],$[1],$[2]],c.items.push(T)}f=O?O.range[2]:A.end}}let d=s?"}":"]",[p,...y]=i.end,m=f;if(p?.source===d)m=p.offset+p.source.length;else{let h=a[0].toUpperCase()+a.substring(1),g=u?`${h} must end with a ${d}`:`${h} in block collection must be sufficiently indented and end with a ${d}`;r(f,u?"MISSING_CHAR":"BAD_INDENT",g),p&&p.source.length!==1&&y.unshift(p)}if(y.length>0){let h=J0.resolveEnd(y,m,n.options.strict,r);h.comment&&(c.comment?c.comment+=`
|
|
71
|
+
`+h.comment:c.comment=h.comment),c.range=[i.offset,m,h.offset]}else c.range=[i.offset,m,m];return c}Ef.resolveFlowCollection=z0});var Cf=S(kf=>{"use strict";var Z0=I(),eS=U(),tS=Ue(),nS=Ke(),iS=bf(),rS=vf(),oS=xf();function hs(e,t,n,i,r,o){let s=n.type==="block-map"?iS.resolveBlockMap(e,t,n,i,o):n.type==="block-seq"?rS.resolveBlockSeq(e,t,n,i,o):oS.resolveFlowCollection(e,t,n,i,o),a=s.constructor;return r==="!"||r===a.tagName?(s.tag=a.tagName,s):(r&&(s.tag=r),s)}function sS(e,t,n,i,r){let o=i.tag,s=o?t.directives.tagName(o.source,d=>r(o,"TAG_RESOLVE_FAILED",d)):null;if(n.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=i,y=d&&o?d.offset>o.offset?d:o:d??o;y&&(!p||p.offset<y.offset)&&r(y,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===tS.YAMLMap.tagName&&a==="map"||s===nS.YAMLSeq.tagName&&a==="seq")return hs(e,t,n,r,s);let l=t.schema.tags.find(d=>d.tag===s&&d.collection===a);if(!l){let d=t.schema.knownTags[s];if(d?.collection===a)t.schema.tags.push(Object.assign({},d,{default:!1})),l=d;else return d?r(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):r(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),hs(e,t,n,r,s)}let c=hs(e,t,n,r,s,l),u=l.resolve?.(c,d=>r(o,"TAG_RESOLVE_FAILED",d),t.options)??c,f=Z0.isNode(u)?u:new eS.Scalar(u);return f.range=c.range,f.tag=s,l?.format&&(f.format=l.format),f}kf.composeCollection=sS});var gs=S(Of=>{"use strict";var ys=U();function aS(e,t,n){let i=t.offset,r=lS(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[i,i,i]};let o=r.mode===">"?ys.Scalar.BLOCK_FOLDED:ys.Scalar.BLOCK_LITERAL,s=t.source?cS(t.source):[],a=s.length;for(let m=s.length-1;m>=0;--m){let h=s[m][1];if(h===""||h==="\r")a=m;else break}if(a===0){let m=r.chomp==="+"&&s.length>0?`
|
|
72
72
|
`.repeat(Math.max(1,s.length-1)):"",h=i+r.length;return t.source&&(h+=t.source.length),{value:m,type:o,comment:r.comment,range:[i,h,h]}}let l=t.indent+r.indent,c=t.offset+r.length,u=0;for(let m=0;m<a;++m){let[h,g]=s[m];if(g===""||g==="\r")r.indent===0&&h.length>l&&(l=h.length);else{h.length<l&&n(c+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(l=h.length),u=m,l===0&&!e.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=h.length+g.length+1}for(let m=s.length-1;m>=a;--m)s[m][0].length>l&&(a=m+1);let f="",d="",p=!1;for(let m=0;m<u;++m)f+=s[m][0].slice(l)+`
|
|
73
|
-
`;for(let m=u;m<a;++m){let[h,g]=s[m];c+=h.length+g.length+1;let b=g[g.length-1]==="\r";if(b&&(g=g.slice(0,-1)),g&&h.length<l){let x=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(c-g.length-(b?2:1),"BAD_INDENT",x),h=""}o===
|
|
73
|
+
`;for(let m=u;m<a;++m){let[h,g]=s[m];c+=h.length+g.length+1;let b=g[g.length-1]==="\r";if(b&&(g=g.slice(0,-1)),g&&h.length<l){let x=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(c-g.length-(b?2:1),"BAD_INDENT",x),h=""}o===ys.Scalar.BLOCK_LITERAL?(f+=d+h.slice(l)+g,d=`
|
|
74
74
|
`):h.length>l||g[0]===" "?(d===" "?d=`
|
|
75
75
|
`:!p&&d===`
|
|
76
76
|
`&&(d=`
|
|
@@ -83,46 +83,46 @@ ${c}
|
|
|
83
83
|
`+s[m][0].slice(l);f[f.length-1]!==`
|
|
84
84
|
`&&(f+=`
|
|
85
85
|
`);break;default:f+=`
|
|
86
|
-
`}let y=i+r.length+t.source.length;return{value:f,type:o,comment:r.comment,range:[i,y,y]}}function
|
|
86
|
+
`}let y=i+r.length+t.source.length;return{value:f,type:o,comment:r.comment,range:[i,y,y]}}function lS({offset:e,props:t},n,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=t[0],o=r[0],s=0,a="",l=-1;for(let d=1;d<r.length;++d){let p=r[d];if(!a&&(p==="-"||p==="+"))a=p;else{let y=Number(p);!s&&y?s=y:l===-1&&(l=e+d)}}l!==-1&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let c=!1,u="",f=r.length;for(let d=1;d<t.length;++d){let p=t[d];switch(p.type){case"space":c=!0;case"newline":f+=p.source.length;break;case"comment":n&&!c&&i(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":i(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let y=`Unexpected token in block scalar header: ${p.type}`;i(p,"UNEXPECTED_TOKEN",y);let m=p.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:o,indent:s,chomp:a,comment:u,length:f}}function cS(e){let t=e.split(/\n( *)/),n=t[0],i=n.match(/^( *)/),o=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let s=1;s<t.length;s+=2)o.push([t[s],t[s+1]]);return o}Of.resolveBlockScalar=aS});var Ss=S(If=>{"use strict";var bs=U(),uS=Rt();function fS(e,t,n){let{offset:i,type:r,source:o,end:s}=e,a,l,c=(d,p,y)=>n(i+d,p,y);switch(r){case"scalar":a=bs.Scalar.PLAIN,l=dS(o,c);break;case"single-quoted-scalar":a=bs.Scalar.QUOTE_SINGLE,l=pS(o,c);break;case"double-quoted-scalar":a=bs.Scalar.QUOTE_DOUBLE,l=mS(o,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[i,i+o.length,i+o.length]}}let u=i+o.length,f=uS.resolveEnd(s,u,t,n);return{value:l,type:a,comment:f.comment,range:[i,u,f.offset]}}function dS(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Tf(e)}function pS(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Tf(e.slice(1,-1)).replace(/''/g,"'")}function Tf(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
87
87
|
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
88
88
|
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=t.exec(e);if(!i)return e;let r=i[1],o=" ",s=t.lastIndex;for(n.lastIndex=s;i=n.exec(e);)i[1]===""?o===`
|
|
89
89
|
`?r+=o:o=`
|
|
90
|
-
`:(r+=o+i[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,i=a.exec(e),r+o+(i?.[1]??"")}function
|
|
90
|
+
`:(r+=o+i[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,i=a.exec(e),r+o+(i?.[1]??"")}function mS(e,t){let n="";for(let i=1;i<e.length-1;++i){let r=e[i];if(!(r==="\r"&&e[i+1]===`
|
|
91
91
|
`))if(r===`
|
|
92
|
-
`){let{fold:o,offset:s}=
|
|
92
|
+
`){let{fold:o,offset:s}=hS(e,i);n+=o,i=s}else if(r==="\\"){let o=e[++i],s=yS[o];if(s)n+=s;else if(o===`
|
|
93
93
|
`)for(o=e[i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="\r"&&e[i+1]===`
|
|
94
|
-
`)for(o=e[++i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=
|
|
94
|
+
`)for(o=e[++i+1];o===" "||o===" ";)o=e[++i+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=gS(e,i+1,a,t),i+=a}else{let a=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let o=i,s=e[i+1];for(;s===" "||s===" ";)s=e[++i+1];s!==`
|
|
95
95
|
`&&!(s==="\r"&&e[i+2]===`
|
|
96
|
-
`)&&(n+=i>o?e.slice(o,i+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function
|
|
96
|
+
`)&&(n+=i>o?e.slice(o,i+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function hS(e,t){let n="",i=e[t+1];for(;(i===" "||i===" "||i===`
|
|
97
97
|
`||i==="\r")&&!(i==="\r"&&e[t+2]!==`
|
|
98
98
|
`);)i===`
|
|
99
99
|
`&&(n+=`
|
|
100
|
-
`),t+=1,i=e[t+1];return n||(n=" "),{fold:n,offset:t}}var
|
|
101
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
100
|
+
`),t+=1,i=e[t+1];return n||(n=" "),{fold:n,offset:t}}var yS={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
101
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function gS(e,t,n,i){let r=e.substr(t,n),s=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(s)}catch{let a=e.substr(t-2,n+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}If.resolveFlowScalar=fS});var Nf=S(Mf=>{"use strict";var lt=I(),Lf=U(),bS=gs(),SS=Ss();function vS(e,t,n,i){let{value:r,type:o,comment:s,range:a}=t.type==="block-scalar"?bS.resolveBlockScalar(e,t,i):SS.resolveFlowScalar(t,e.options.strict,i),l=n?e.directives.tagName(n.source,f=>i(n,"TAG_RESOLVE_FAILED",f)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[lt.SCALAR]:l?c=AS(e.schema,r,l,n,i):t.type==="scalar"?c=wS(e,r,t,i):c=e.schema[lt.SCALAR];let u;try{let f=c.resolve(r,d=>i(n??t,"TAG_RESOLVE_FAILED",d),e.options);u=lt.isScalar(f)?f:new Lf.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);i(n??t,"TAG_RESOLVE_FAILED",d),u=new Lf.Scalar(r)}return u.range=a,u.source=r,o&&(u.type=o),l&&(u.tag=l),c.format&&(u.format=c.format),s&&(u.comment=s),u}function AS(e,t,n,i,r){if(n==="!")return e[lt.SCALAR];let o=[];for(let a of e.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(t))return a;let s=e.knownTags[n];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[lt.SCALAR])}function wS({atKey:e,directives:t,schema:n},i,r,o){let s=n.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(i))||n[lt.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(i))??n[lt.SCALAR];if(s.tag!==a.tag){let l=t.tagString(s.tag),c=t.tagString(a.tag),u=`Value may be parsed as either ${l} or ${c}`;o(r,"TAG_RESOLVE_FAILED",u,!0)}}return s}Mf.composeScalar=vS});var Pf=S(Rf=>{"use strict";function _S(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let r=t[i];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++i];r?.type==="space";)e+=r.source.length,r=t[++i];break}}return e}Rf.emptyScalarPosition=_S});var Bf=S(As=>{"use strict";var ES=on(),xS=I(),kS=Cf(),Ff=Nf(),CS=Rt(),OS=Pf(),TS={composeNode:Df,composeEmptyNode:vs};function Df(e,t,n,i){let r=e.atKey,{spaceBefore:o,comment:s,anchor:a,tag:l}=n,c,u=!0;switch(t.type){case"alias":c=IS(e,t,i),(a||l)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=Ff.composeScalar(e,t,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=kS.composeCollection(TS,e,t,n,i),a&&(c.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);i(t,"RESOURCE_EXHAUSTION",d)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",f),u=!1}}return c??(c=vs(e,t.offset,void 0,null,n,i)),a&&c.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!xS.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&i(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(c.spaceBefore=!0),s&&(t.type==="scalar"&&t.source===""?c.comment=s:c.commentBefore=s),e.options.keepSourceTokens&&u&&(c.srcToken=t),c}function vs(e,t,n,i,{spaceBefore:r,comment:o,anchor:s,tag:a,end:l},c){let u={type:"scalar",offset:OS.emptyScalarPosition(t,n,i),indent:-1,source:""},f=Ff.composeScalar(e,u,a,c);return s&&(f.anchor=s.source.substring(1),f.anchor===""&&c(s,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(f.spaceBefore=!0),o&&(f.comment=o,f.range[2]=l),f}function IS({options:e},{offset:t,source:n,end:i},r){let o=new ES.Alias(n.substring(1));o.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=t+n.length,a=CS.resolveEnd(i,s,e.strict,r);return o.range=[t,s,a.offset],a.comment&&(o.comment=a.comment),o}As.composeEmptyNode=vs;As.composeNode=Df});var jf=S($f=>{"use strict";var LS=An(),qf=Bf(),MS=Rt(),NS=xn();function RS(e,t,{offset:n,start:i,value:r,end:o},s){let a=Object.assign({_directives:t},e),l=new LS.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},u=NS.resolveProps(i,{indicator:"doc-start",next:r??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});u.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!u.hasNewline&&s(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?qf.composeNode(c,r,u,s):qf.composeEmptyNode(c,u.end,i,null,u,s);let f=l.contents.range[2],d=MS.resolveEnd(o,f,!1,s);return d.comment&&(l.comment=d.comment),l.range=[n,f,d.offset],l}$f.composeDoc=RS});var _s=S(Vf=>{"use strict";var PS=ue("process"),FS=ao(),DS=An(),kn=En(),Uf=I(),BS=jf(),qS=Rt();function Cn(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function Kf(e){let t="",n=!1,i=!1;for(let r=0;r<e.length;++r){let o=e[r];switch(o[0]){case"#":t+=(t===""?"":i?`
|
|
102
102
|
|
|
103
103
|
`:`
|
|
104
|
-
`)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}var
|
|
105
|
-
${i}`:i;else if(r||t.directives.docStart||!o)t.commentBefore=i;else if(
|
|
104
|
+
`)+(o.substring(1)||" "),n=!0,i=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}var ws=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,r,o)=>{let s=Cn(n);o?this.warnings.push(new kn.YAMLWarning(s,i,r)):this.errors.push(new kn.YAMLParseError(s,i,r))},this.directives=new FS.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:i,afterEmptyLine:r}=Kf(this.prelude);if(i){let o=t.contents;if(n)t.comment=t.comment?`${t.comment}
|
|
105
|
+
${i}`:i;else if(r||t.directives.docStart||!o)t.commentBefore=i;else if(Uf.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];Uf.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${i}
|
|
106
106
|
${a}`:i}else{let s=o.commentBefore;o.commentBefore=s?`${i}
|
|
107
|
-
${s}`:i}}if(n){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
108
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new kn.YAMLParseError(Cn(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),r=new DS.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};
|
|
107
|
+
${s}`:i}}if(n){for(let o=0;o<this.errors.length;++o)t.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)t.warnings.push(this.warnings[o])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Kf(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,i=-1){for(let r of t)yield*this.next(r);yield*this.end(n,i)}*next(t){switch(PS.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,i,r)=>{let o=Cn(t);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",i,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=BS.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new kn.YAMLParseError(Cn(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new kn.YAMLParseError(Cn(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let n=qS.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
|
|
108
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new kn.YAMLParseError(Cn(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),r=new DS.Document(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};Vf.Composer=ws});var Wf=S(Gi=>{"use strict";var $S=gs(),jS=Ss(),US=En(),Yf=un();function KS(e,t=!0,n){if(e){let i=(r,o,s)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,o,s);else throw new US.YAMLParseError([a,a+1],o,s)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return jS.resolveFlowScalar(e,t,i);case"block-scalar":return $S.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function VS(e,t){let{implicitKey:n=!1,indent:i,inFlow:r=!1,offset:o=-1,type:s="PLAIN"}=t,a=Yf.stringifyString({type:s,value:e},{implicitKey:n,indent:i>0?" ".repeat(i):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:i,source:`
|
|
109
109
|
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
110
110
|
`),u=a.substring(0,c),f=a.substring(c+1)+`
|
|
111
|
-
`,d=[{type:"block-scalar-header",offset:o,indent:i,source:u}];return
|
|
112
|
-
`}),{type:"block-scalar",offset:o,indent:i,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:a,end:l};default:return{type:"scalar",offset:o,indent:i,source:a,end:l}}}function
|
|
111
|
+
`,d=[{type:"block-scalar-header",offset:o,indent:i,source:u}];return Gf(d,l)||d.push({type:"newline",offset:-1,indent:i,source:`
|
|
112
|
+
`}),{type:"block-scalar",offset:o,indent:i,props:d,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:i,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:o,indent:i,source:a,end:l};default:return{type:"scalar",offset:o,indent:i,source:a,end:l}}}function YS(e,t,n={}){let{afterKey:i=!1,implicitKey:r=!1,inFlow:o=!1,type:s}=n,a="indent"in e?e.indent:null;if(i&&typeof a=="number"&&(a+=2),!s)switch(e.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let c=e.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let l=Yf.stringifyString({type:s,value:t},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":GS(e,l);break;case'"':Es(e,l,"double-quoted-scalar");break;case"'":Es(e,l,"single-quoted-scalar");break;default:Es(e,l,"scalar")}}function GS(e,t){let n=t.indexOf(`
|
|
113
113
|
`),i=t.substring(0,n),r=t.substring(n+1)+`
|
|
114
|
-
`;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=i,e.source=r}else{let{offset:o}=e,s="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:i}];
|
|
115
|
-
`});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:s,props:a,source:r})}}function
|
|
116
|
-
`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let i="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))o!=="type"&&o!=="offset"&&delete e[o];Object.assign(e,{type:n,indent:i,source:t,end:r})}}}Gi.createScalarToken=
|
|
114
|
+
`;if(e.type==="block-scalar"){let o=e.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=i,e.source=r}else{let{offset:o}=e,s="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:i}];Gf(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
|
|
115
|
+
`});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:s,props:a,source:r})}}function Gf(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function Es(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),r=t.length;e.props[0].type==="block-scalar-header"&&(r-=e.props[0].source.length);for(let o of i)o.offset+=r;delete e.props,Object.assign(e,{type:n,source:t,end:i});break}case"block-map":case"block-seq":{let r={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
116
|
+
`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let i="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(e))o!=="type"&&o!=="offset"&&delete e[o];Object.assign(e,{type:n,indent:i,source:t,end:r})}}}Gi.createScalarToken=VS;Gi.resolveAsScalar=KS;Gi.setScalarValue=YS});var Jf=S(Hf=>{"use strict";var WS=e=>"type"in e?Hi(e):Wi(e);function Hi(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=Hi(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=Wi(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=Wi(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=Wi(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function Wi({start:e,key:t,sep:n,value:i}){let r="";for(let o of e)r+=o.source;if(t&&(r+=Hi(t)),n)for(let o of n)r+=o.source;return i&&(r+=Hi(i)),r}Hf.stringify=WS});var Zf=S(zf=>{"use strict";var xs=Symbol("break visit"),HS=Symbol("skip children"),Xf=Symbol("remove item");function ct(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Qf(Object.freeze([]),e,t)}ct.BREAK=xs;ct.SKIP=HS;ct.REMOVE=Xf;ct.itemAtPath=(e,t)=>{let n=e;for(let[i,r]of t){let o=n?.[i];if(o&&"items"in o)n=o.items[r];else return}return n};ct.parentCollection=(e,t)=>{let n=ct.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],r=n?.[i];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function Qf(e,t,n){let i=n(t,e);if(typeof i=="symbol")return i;for(let r of["key","value"]){let o=t[r];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=Qf(Object.freeze(e.concat([[r,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===xs)return xs;a===Xf&&(o.items.splice(s,1),s-=1)}}typeof i=="function"&&r==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}zf.visit=ct});var Ji=S(le=>{"use strict";var ks=Wf(),JS=Jf(),XS=Zf(),Cs="\uFEFF",Os="",Ts="",Is="",QS=e=>!!e&&"items"in e,zS=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function ZS(e){switch(e){case Cs:return"<BOM>";case Os:return"<DOC>";case Ts:return"<FLOW_END>";case Is:return"<SCALAR>";default:return JSON.stringify(e)}}function ev(e){switch(e){case Cs:return"byte-order-mark";case Os:return"doc-mode";case Ts:return"flow-error-end";case Is:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
117
117
|
`:case`\r
|
|
118
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}le.createScalarToken=
|
|
119
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
120
|
-
\r `),
|
|
118
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}le.createScalarToken=ks.createScalarToken;le.resolveAsScalar=ks.resolveAsScalar;le.setScalarValue=ks.setScalarValue;le.stringify=JS.stringify;le.visit=XS.visit;le.BOM=Cs;le.DOCUMENT=Os;le.FLOW_END=Ts;le.SCALAR=Is;le.isCollection=QS;le.isScalar=zS;le.prettyToken=ZS;le.tokenType=ev});var Ns=S(td=>{"use strict";var On=Ji();function me(e){switch(e){case void 0:case" ":case`
|
|
119
|
+
`:case"\r":case" ":return!0;default:return!1}}var ed=new Set("0123456789ABCDEFabcdef"),tv=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Xi=new Set(",[]{}"),nv=new Set(` ,[]{}
|
|
120
|
+
\r `),Ls=e=>!e||nv.has(e),Ms=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
|
|
121
121
|
`?!0:n==="\r"?this.buffer[t+1]===`
|
|
122
122
|
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+t];if(n==="\r"){let r=this.buffer[i+t+1];if(r===`
|
|
123
123
|
`||!r&&!this.atEnd)return t+i+1}return n===`
|
|
124
124
|
`||i>=this.indentNext||!n&&!this.atEnd?t+i:-1}if(n==="-"||n==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&me(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
125
|
-
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===On.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,i=t.indexOf("#");for(;i!==-1;){let o=t[i-1];if(o===" "||o===" "){n=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let o=t[n-1];if(o===" "||o===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield On.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&me(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!me(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&me(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(
|
|
125
|
+
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===On.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,i=t.indexOf("#");for(;i!==-1;){let o=t[i-1];if(o===" "||o===" "){n=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let o=t[n-1];if(o===" "||o===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield On.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&me(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!me(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&me(n)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ls),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,i=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&r[0]!=="#"||i===0&&(r.startsWith("---")||r.startsWith("..."))&&me(r[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield On.FLOW_END,yield*this.parseLineStart();let o=0;for(;r[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),r[o]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ls),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||me(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let i=this.buffer.substring(0,n),r=i.indexOf(`
|
|
126
126
|
`,this.pos);if(r!==-1){for(;r!==-1;){let o=this.continueScalar(r+1);if(o===-1)break;r=i.indexOf(`
|
|
127
127
|
`,o)}r!==-1&&(n=r-(i[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>me(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,i;e:for(let o=this.pos;i=this.buffer[o];++o)switch(i){case" ":n+=1;break;case`
|
|
128
128
|
`:t=o,n=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
@@ -132,13 +132,13 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
132
132
|
`&&o>=this.pos&&o+1+n>a)t=o;else break}while(!0);return yield On.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,i=this.pos-1,r;for(;r=this.buffer[++i];)if(r===":"){let o=this.buffer[i+1];if(me(o)||t&&Xi.has(o))break;n=i}else if(me(r)){let o=this.buffer[i+1];if(r==="\r"&&(o===`
|
|
133
133
|
`?(i+=1,r=`
|
|
134
134
|
`,o=this.buffer[i+1]):n=i),o==="#"||t&&Xi.has(o))break;if(r===`
|
|
135
|
-
`){let s=this.continueScalar(i+1);if(s===-1)break;i=Math.max(i,s-2)}}else{if(t&&Xi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield On.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(
|
|
135
|
+
`){let s=this.continueScalar(i+1);if(s===-1)break;i=Math.max(i,s-2)}}else{if(t&&Xi.has(r))break;n=i}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield On.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Ls),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,i=this.charAt(1);if(me(i)||n&&Xi.has(i)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!me(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(tv.has(n))n=this.buffer[++t];else if(n==="%"&&ed.has(this.buffer[t+1])&&ed.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
|
136
136
|
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
137
|
-
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||t&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};
|
|
137
|
+
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||t&&i===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,i=this.buffer[n];for(;!t(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};td.Lexer=Ms});var Ps=S(nd=>{"use strict";var Rs=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,i=this.lineStarts.length;for(;n<i;){let o=n+i>>1;this.lineStarts[o]<t?n=o+1:i=o}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let r=this.lineStarts[n-1];return{line:n,col:t-r+1}}}};nd.LineCounter=Rs});var Ds=S(ad=>{"use strict";var iv=ue("process"),id=Ji(),rv=Ns();function Ve(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function rd(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function sd(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Qi(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Pt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function zi(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function od(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ve(t.start,"explicit-key-ind")&&!Ve(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,sd(t.value)?t.value.end?zi(t.value.end,t.sep):t.value.end=t.sep:zi(t.start,t.sep),delete t.sep)}var Fs=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new rv.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,n))yield*this.next(i);n||(yield*this.end())}*next(t){if(this.source=t,iv.env.LOG_TOKENS&&console.log("|",id.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=id.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&od(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{let r=i.items[i.items.length-1];if(r.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=i.items[i.items.length-1];r.value?i.items.push({start:[],value:n}):r.value=n;break}case"flow-collection":{let r=i.items[i.items.length-1];!r||r.value?i.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&rd(r.start)===-1&&(n.indent===0||r.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(i.type==="document"?i.end=r.start:i.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{rd(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=Qi(this.peek(2)),i=Pt(n),r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
138
138
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
139
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){zi(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(r&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":s.push(a);break;case"space":break;case"comment":l.indent>t.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(
|
|
139
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){zi(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,r=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(r&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":s.push(a);break;case"space":break;case"comment":l.indent>t.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ve(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(sd(n.key)&&!Ve(n.sep,"newline")){let s=Pt(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:l}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(Ve(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=Pt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:o,key:null,sep:[this.sourceToken]}):Ve(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);r||n.value?(t.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(t);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ve(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&t.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){zi(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Ve(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let r=Qi(i),o=Pt(r);od(t);let s=t.end.splice(1,t.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
|
|
140
140
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
141
|
-
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Qi(t),i=Pt(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Qi(t),i=Pt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};
|
|
141
|
+
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Qi(t),i=Pt(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Qi(t),i=Pt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};ad.Parser=Fs});var dd=S(In=>{"use strict";var ld=_s(),ov=An(),Tn=En(),sv=Ao(),av=I(),lv=Ps(),cd=Ds();function ud(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new lv.LineCounter||null,prettyErrors:t}}function cv(e,t={}){let{lineCounter:n,prettyErrors:i}=ud(t),r=new cd.Parser(n?.addNewLine),o=new ld.Composer(t),s=Array.from(o.compose(r.parse(e)));if(i&&n)for(let a of s)a.errors.forEach(Tn.prettifyError(e,n)),a.warnings.forEach(Tn.prettifyError(e,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function fd(e,t={}){let{lineCounter:n,prettyErrors:i}=ud(t),r=new cd.Parser(n?.addNewLine),o=new ld.Composer(t),s=null;for(let a of o.compose(r.parse(e),!0,e.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Tn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(s.errors.forEach(Tn.prettifyError(e,n)),s.warnings.forEach(Tn.prettifyError(e,n))),s}function uv(e,t,n){let i;typeof t=="function"?i=t:n===void 0&&t&&typeof t=="object"&&(n=t);let r=fd(e,n);if(!r)return null;if(r.warnings.forEach(o=>sv.warn(r.options.logLevel,o)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:i},n))}function fv(e,t,n){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){let{keepUndefined:r}=n??t??{};if(!r)return}return av.isDocument(e)&&!i?e.toString(n):new ov.Document(e,i,n).toString(n)}In.parse=uv;In.parseAllDocuments=cv;In.parseDocument=fd;In.stringify=fv});var md=S(M=>{"use strict";var dv=_s(),pv=An(),mv=is(),Bs=En(),hv=on(),Ye=I(),yv=$e(),gv=U(),bv=Ue(),Sv=Ke(),vv=Ji(),Av=Ns(),wv=Ps(),_v=Ds(),Zi=dd(),pd=en();M.Composer=dv.Composer;M.Document=pv.Document;M.Schema=mv.Schema;M.YAMLError=Bs.YAMLError;M.YAMLParseError=Bs.YAMLParseError;M.YAMLWarning=Bs.YAMLWarning;M.Alias=hv.Alias;M.isAlias=Ye.isAlias;M.isCollection=Ye.isCollection;M.isDocument=Ye.isDocument;M.isMap=Ye.isMap;M.isNode=Ye.isNode;M.isPair=Ye.isPair;M.isScalar=Ye.isScalar;M.isSeq=Ye.isSeq;M.Pair=yv.Pair;M.Scalar=gv.Scalar;M.YAMLMap=bv.YAMLMap;M.YAMLSeq=Sv.YAMLSeq;M.CST=vv;M.Lexer=Av.Lexer;M.LineCounter=wv.LineCounter;M.Parser=_v.Parser;M.parse=Zi.parse;M.parseAllDocuments=Zi.parseAllDocuments;M.parseDocument=Zi.parseDocument;M.stringify=Zi.stringify;M.visit=pd.visit;M.visitAsync=pd.visitAsync});function qa(e){return!1}function f_(e){return e.replace(/^#{2,4} MCP\/App citation examples\r?\n\r?\n```\r?\n[\s\S]*?^```\r?\n\s*/gm,t=>t.includes("#mavis-source=")?"":t).replace(/^#{2,4} Citations\r?\n(?:[ \t]*\r?\n)*Cite every used result where it supports the answer\.[\s\S]*?^Do not cite unused calls or unsupported claims, invent metadata, output bare parenthesized links, or add trailing source\/reference lists\.\r?\n*/gm,t=>t.includes("Citation candidate")?"":t)}function d_(e){let n=["- Independent tool calls can run in parallel in one response.","- Issue independent tool calls together when safe. Run dependent calls or conflicting writes sequentially, and follow each tool's concurrency restrictions."].find(u=>e.includes(u));if(!n)return e;let i="- Reference code as `file_path:line_number` \u2014 it's clickable.",r="- Reference code as `file_path:line_number` so it is clickable. Place references near the relevant claim; group them only when there are many files.",o=["- Cite sources where they support the answer, using exact source URLs or supplied links.","- Place references near the relevant claim; group them only when there are many files.","- Cite only sources you used; do not invent sources or links."].join(`
|
|
142
142
|
`),a=["- When referencing code, use `file_path:line_number` format.","- When citing one or two files, place one or two `file_path:line_number` references in the relevant conclusion sentence. Use a separate evidence list only when there are many references.",i,"- Reference code as `file_path:line_number` \u2014 it's clickable in the TUI."].reduce((u,f)=>u.replaceAll(`${f}\r
|
|
143
143
|
`,"").replaceAll(`${f}
|
|
144
144
|
`,""),e.replace(r,"- Place references near the relevant claim; group them only when there are many files.")).replace(n,`${n}
|
|
@@ -153,41 +153,41 @@ ${o}
|
|
|
153
153
|
${u}`):`${a.trimEnd()}
|
|
154
154
|
|
|
155
155
|
## References
|
|
156
|
-
${o}`}function
|
|
156
|
+
${o}`}function Zp(e,t=process.env){return qa({platform:e,internalBuild:t.__MAVIS_BUILD_INTERNAL==="true",insideBuild:t.__MAVIS_BUILD_INSIDE==="true"})}import{randomBytes as Hy}from"node:crypto";import{promises as Pe}from"node:fs";import{dirname as Jy,join as vc}from"node:path";function tl(e){return typeof e>"u"||e===null}function em(e){return typeof e=="object"&&e!==null}function tm(e){return Array.isArray(e)?e:tl(e)?[]:[e]}function nm(e,t){var n,i,r,o;if(t)for(o=Object.keys(t),n=0,i=o.length;n<i;n+=1)r=o[n],e[r]=t[r];return e}function im(e,t){var n="",i;for(i=0;i<t;i+=1)n+=e;return n}function rm(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var om=tl,sm=em,am=tm,lm=im,cm=rm,um=nm,K={isNothing:om,isObject:sm,toArray:am,repeat:lm,isNegativeZero:cm,extend:um};function nl(e,t){var n="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
157
157
|
|
|
158
|
-
`+e.mark.snippet),i+" "+n):i}function Wt(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=
|
|
159
|
-
`+a;for(c=
|
|
158
|
+
`+e.mark.snippet),i+" "+n):i}function Wt(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=nl(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Wt.prototype=Object.create(Error.prototype);Wt.prototype.constructor=Wt;Wt.prototype.toString=function(t){return this.name+": "+nl(this,t)};var ie=Wt;function Or(e,t,n,i,r){var o="",s="",a=Math.floor(r/2)-1;return i-t>a&&(o=" ... ",t=i-a+o.length),n-i>a&&(s=" ...",n=i+a-s.length),{str:o+e.slice(t,n).replace(/\t/g,"\u2192")+s,pos:i-t+o.length}}function Tr(e,t){return K.repeat(" ",t-e.length)+e}function fm(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,i=[0],r=[],o,s=-1;o=n.exec(e.buffer);)r.push(o.index),i.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=i.length-2);s<0&&(s=i.length-1);var a="",l,c,u=Math.min(e.line+t.linesAfter,r.length).toString().length,f=t.maxLength-(t.indent+u+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)c=Or(e.buffer,i[s-l],r[s-l],e.position-(i[s]-i[s-l]),f),a=K.repeat(" ",t.indent)+Tr((e.line-l+1).toString(),u)+" | "+c.str+`
|
|
159
|
+
`+a;for(c=Or(e.buffer,i[s],r[s],e.position,f),a+=K.repeat(" ",t.indent)+Tr((e.line+1).toString(),u)+" | "+c.str+`
|
|
160
160
|
`,a+=K.repeat("-",t.indent+u+3+c.pos)+`^
|
|
161
|
-
`,l=1;l<=t.linesAfter&&!(s+l>=r.length);l++)c=
|
|
162
|
-
`;return a.replace(/\n$/,"")}var fm
|
|
163
|
-
\r`;function
|
|
164
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function
|
|
165
|
-
`,t-1))}function
|
|
166
|
-
`,o?1+l:l):r===
|
|
161
|
+
`,l=1;l<=t.linesAfter&&!(s+l>=r.length);l++)c=Or(e.buffer,i[s+l],r[s+l],e.position-(i[s]-i[s+l]),f),a+=K.repeat(" ",t.indent)+Tr((e.line+l+1).toString(),u)+" | "+c.str+`
|
|
162
|
+
`;return a.replace(/\n$/,"")}var dm=fm,pm=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],mm=["scalar","sequence","mapping"];function hm(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(i){t[String(i)]=n})}),t}function ym(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(pm.indexOf(n)===-1)throw new ie('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=hm(t.styleAliases||null),mm.indexOf(this.kind)===-1)throw new ie('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Q=ym;function $a(e,t){var n=[];return e[t].forEach(function(i){var r=n.length;n.forEach(function(o,s){o.tag===i.tag&&o.kind===i.kind&&o.multi===i.multi&&(r=s)}),n[r]=i}),n}function gm(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function i(r){r.multi?(e.multi[r.kind].push(r),e.multi.fallback.push(r)):e[r.kind][r.tag]=e.fallback[r.tag]=r}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(i);return e}function Lr(e){return this.extend(e)}Lr.prototype.extend=function(t){var n=[],i=[];if(t instanceof Q)i.push(t);else if(Array.isArray(t))i=i.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit));else throw new ie("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(o){if(!(o instanceof Q))throw new ie("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new ie("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(o.multi)throw new ie("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(o){if(!(o instanceof Q))throw new ie("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var r=Object.create(Lr.prototype);return r.implicit=(this.implicit||[]).concat(n),r.explicit=(this.explicit||[]).concat(i),r.compiledImplicit=$a(r,"implicit"),r.compiledExplicit=$a(r,"explicit"),r.compiledTypeMap=gm(r.compiledImplicit,r.compiledExplicit),r};var il=Lr,rl=new Q("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),ol=new Q("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),sl=new Q("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),al=new il({explicit:[rl,ol,sl]});function bm(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function Sm(){return null}function vm(e){return e===null}var ll=new Q("tag:yaml.org,2002:null",{kind:"scalar",resolve:bm,construct:Sm,predicate:vm,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Am(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function wm(e){return e==="true"||e==="True"||e==="TRUE"}function _m(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var cl=new Q("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Am,construct:wm,predicate:_m,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Em(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function xm(e){return 48<=e&&e<=55}function km(e){return 48<=e&&e<=57}function Cm(e){if(e===null)return!1;var t=e.length,n=0,i=!1,r;if(!t)return!1;if(r=e[n],(r==="-"||r==="+")&&(r=e[++n]),r==="0"){if(n+1===t)return!0;if(r=e[++n],r==="b"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(r!=="0"&&r!=="1")return!1;i=!0}return i&&r!=="_"}if(r==="x"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(!Em(e.charCodeAt(n)))return!1;i=!0}return i&&r!=="_"}if(r==="o"){for(n++;n<t;n++)if(r=e[n],r!=="_"){if(!xm(e.charCodeAt(n)))return!1;i=!0}return i&&r!=="_"}}if(r==="_")return!1;for(;n<t;n++)if(r=e[n],r!=="_"){if(!km(e.charCodeAt(n)))return!1;i=!0}return!(!i||r==="_")}function Om(e){var t=e,n=1,i;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),i=t[0],(i==="-"||i==="+")&&(i==="-"&&(n=-1),t=t.slice(1),i=t[0]),t==="0")return 0;if(i==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function Tm(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!K.isNegativeZero(e)}var ul=new Q("tag:yaml.org,2002:int",{kind:"scalar",resolve:Cm,construct:Om,predicate:Tm,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Im=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Lm(e){return!(e===null||!Im.test(e)||e[e.length-1]==="_")}function Mm(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var Nm=/^[-+]?[0-9]+e/;function Rm(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(K.isNegativeZero(e))return"-0.0";return n=e.toString(10),Nm.test(n)?n.replace("e",".e"):n}function Pm(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||K.isNegativeZero(e))}var fl=new Q("tag:yaml.org,2002:float",{kind:"scalar",resolve:Lm,construct:Mm,predicate:Pm,represent:Rm,defaultStyle:"lowercase"}),dl=al.extend({implicit:[ll,cl,ul,fl]}),pl=dl,ml=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),hl=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Fm(e){return e===null?!1:ml.exec(e)!==null||hl.exec(e)!==null}function Dm(e){var t,n,i,r,o,s,a,l=0,c=null,u,f,d;if(t=ml.exec(e),t===null&&(t=hl.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],s=+t[5],a=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=+t[10],f=+(t[11]||0),c=(u*60+f)*6e4,t[9]==="-"&&(c=-c)),d=new Date(Date.UTC(n,i,r,o,s,a,l)),c&&d.setTime(d.getTime()-c),d}function Bm(e){return e.toISOString()}var yl=new Q("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Fm,construct:Dm,instanceOf:Date,represent:Bm});function qm(e){return e==="<<"||e===null}var gl=new Q("tag:yaml.org,2002:merge",{kind:"scalar",resolve:qm}),Fr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
163
|
+
\r`;function $m(e){if(e===null)return!1;var t,n,i=0,r=e.length,o=Fr;for(n=0;n<r;n++)if(t=o.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;i+=6}return i%8===0}function jm(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=Fr,s=0,a=[];for(t=0;t<r;t++)t%4===0&&t&&(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)),s=s<<6|o.indexOf(i.charAt(t));return n=r%4*6,n===0?(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)):n===18?(a.push(s>>10&255),a.push(s>>2&255)):n===12&&a.push(s>>4&255),new Uint8Array(a)}function Um(e){var t="",n=0,i,r,o=e.length,s=Fr;for(i=0;i<o;i++)i%3===0&&i&&(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]),n=(n<<8)+e[i];return r=o%3,r===0?(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]):r===2?(t+=s[n>>10&63],t+=s[n>>4&63],t+=s[n<<2&63],t+=s[64]):r===1&&(t+=s[n>>2&63],t+=s[n<<4&63],t+=s[64],t+=s[64]),t}function Km(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var bl=new Q("tag:yaml.org,2002:binary",{kind:"scalar",resolve:$m,construct:jm,predicate:Km,represent:Um}),Vm=Object.prototype.hasOwnProperty,Ym=Object.prototype.toString;function Gm(e){if(e===null)return!0;var t=[],n,i,r,o,s,a=e;for(n=0,i=a.length;n<i;n+=1){if(r=a[n],s=!1,Ym.call(r)!=="[object Object]")return!1;for(o in r)if(Vm.call(r,o))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(o)===-1)t.push(o);else return!1}return!0}function Wm(e){return e!==null?e:[]}var Sl=new Q("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Gm,construct:Wm}),Hm=Object.prototype.toString;function Jm(e){if(e===null)return!0;var t,n,i,r,o,s=e;for(o=new Array(s.length),t=0,n=s.length;t<n;t+=1){if(i=s[t],Hm.call(i)!=="[object Object]"||(r=Object.keys(i),r.length!==1))return!1;o[t]=[r[0],i[r[0]]]}return!0}function Xm(e){if(e===null)return[];var t,n,i,r,o,s=e;for(o=new Array(s.length),t=0,n=s.length;t<n;t+=1)i=s[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}var vl=new Q("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Jm,construct:Xm}),Qm=Object.prototype.hasOwnProperty;function zm(e){if(e===null)return!0;var t,n=e;for(t in n)if(Qm.call(n,t)&&n[t]!==null)return!1;return!0}function Zm(e){return e!==null?e:{}}var Al=new Q("tag:yaml.org,2002:set",{kind:"mapping",resolve:zm,construct:Zm}),Dr=pl.extend({implicit:[yl,gl],explicit:[bl,Sl,vl,Al]}),Me=Object.prototype.hasOwnProperty,qn=1,wl=2,_l=3,$n=4,Ir=1,eh=2,ja=3,th=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,nh=/[\x85\u2028\u2029]/,ih=/[,\[\]\{\}]/,El=/^(?:!|!!|![a-z\-]+!)$/i,xl=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Ua(e){return Object.prototype.toString.call(e)}function ge(e){return e===10||e===13}function ze(e){return e===9||e===32}function se(e){return e===9||e===32||e===10||e===13}function ht(e){return e===44||e===91||e===93||e===123||e===125}function rh(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function oh(e){return e===120?2:e===117?4:e===85?8:0}function sh(e){return 48<=e&&e<=57?e-48:-1}function Ka(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
164
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function ah(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function kl(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var Cl=new Array(256),Ol=new Array(256);for(Qe=0;Qe<256;Qe++)Cl[Qe]=Ka(Qe)?1:0,Ol[Qe]=Ka(Qe);var Qe;function lh(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Dr,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Tl(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=dm(n),new ie(t,n)}function _(e,t){throw Tl(e,t)}function jn(e,t){e.onWarning&&e.onWarning.call(null,Tl(e,t))}var Va={YAML:function(t,n,i){var r,o,s;t.version!==null&&_(t,"duplication of %YAML directive"),i.length!==1&&_(t,"YAML directive accepts exactly one argument"),r=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),r===null&&_(t,"ill-formed argument of the YAML directive"),o=parseInt(r[1],10),s=parseInt(r[2],10),o!==1&&_(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&jn(t,"unsupported YAML version of the document")},TAG:function(t,n,i){var r,o;i.length!==2&&_(t,"TAG directive accepts exactly two arguments"),r=i[0],o=i[1],El.test(r)||_(t,"ill-formed tag handle (first argument) of the TAG directive"),Me.call(t.tagMap,r)&&_(t,'there is a previously declared suffix for "'+r+'" tag handle'),xl.test(o)||_(t,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{_(t,"tag prefix is malformed: "+o)}t.tagMap[r]=o}};function Le(e,t,n,i){var r,o,s,a;if(t<n){if(a=e.input.slice(t,n),i)for(r=0,o=a.length;r<o;r+=1)s=a.charCodeAt(r),s===9||32<=s&&s<=1114111||_(e,"expected valid JSON character");else th.test(a)&&_(e,"the stream contains non-printable characters");e.result+=a}}function Ya(e,t,n,i){var r,o,s,a;for(K.isObject(n)||_(e,"cannot merge mappings; the provided source object is unacceptable"),r=Object.keys(n),s=0,a=r.length;s<a;s+=1)o=r[s],Me.call(t,o)||(kl(t,o,n[o]),i[o]=!0)}function yt(e,t,n,i,r,o,s,a,l){var c,u;if(Array.isArray(r))for(r=Array.prototype.slice.call(r),c=0,u=r.length;c<u;c+=1)Array.isArray(r[c])&&_(e,"nested arrays are not supported inside keys"),typeof r=="object"&&Ua(r[c])==="[object Object]"&&(r[c]="[object Object]");if(typeof r=="object"&&Ua(r)==="[object Object]"&&(r="[object Object]"),r=String(r),t===null&&(t={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(c=0,u=o.length;c<u;c+=1)Ya(e,t,o[c],n);else Ya(e,t,o,n);else!e.json&&!Me.call(n,r)&&Me.call(t,r)&&(e.line=s||e.line,e.lineStart=a||e.lineStart,e.position=l||e.position,_(e,"duplicated mapping key")),kl(t,r,o),delete n[r];return t}function Br(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):_(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function j(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);r!==0;){for(;ze(r);)r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&r===35)do r=e.input.charCodeAt(++e.position);while(r!==10&&r!==13&&r!==0);if(ge(r))for(Br(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position);else break}return n!==-1&&i!==0&&e.lineIndent<n&&jn(e,"deficient indentation"),i}function Vn(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||se(n)))}function qr(e,t){t===1?e.result+=" ":t>1&&(e.result+=K.repeat(`
|
|
165
|
+
`,t-1))}function ch(e,t,n){var i,r,o,s,a,l,c,u,f=e.kind,d=e.result,p;if(p=e.input.charCodeAt(e.position),se(p)||ht(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(r=e.input.charCodeAt(e.position+1),se(r)||n&&ht(r)))return!1;for(e.kind="scalar",e.result="",o=s=e.position,a=!1;p!==0;){if(p===58){if(r=e.input.charCodeAt(e.position+1),se(r)||n&&ht(r))break}else if(p===35){if(i=e.input.charCodeAt(e.position-1),se(i))break}else{if(e.position===e.lineStart&&Vn(e)||n&&ht(p))break;if(ge(p))if(l=e.line,c=e.lineStart,u=e.lineIndent,j(e,!1,-1),e.lineIndent>=t){a=!0,p=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=c,e.lineIndent=u;break}}a&&(Le(e,o,s,!1),qr(e,e.line-l),o=s=e.position,a=!1),ze(p)||(s=e.position+1),p=e.input.charCodeAt(++e.position)}return Le(e,o,s,!1),e.result?!0:(e.kind=f,e.result=d,!1)}function uh(e,t){var n,i,r;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(Le(e,i,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)i=e.position,e.position++,r=e.position;else return!0;else ge(n)?(Le(e,i,r,!0),qr(e,j(e,!1,t)),i=r=e.position):e.position===e.lineStart&&Vn(e)?_(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);_(e,"unexpected end of the stream within a single quoted scalar")}function fh(e,t){var n,i,r,o,s,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return Le(e,n,e.position,!0),e.position++,!0;if(a===92){if(Le(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),ge(a))j(e,!1,t);else if(a<256&&Cl[a])e.result+=Ol[a],e.position++;else if((s=oh(a))>0){for(r=s,o=0;r>0;r--)a=e.input.charCodeAt(++e.position),(s=rh(a))>=0?o=(o<<4)+s:_(e,"expected hexadecimal character");e.result+=ah(o),e.position++}else _(e,"unknown escape sequence");n=i=e.position}else ge(a)?(Le(e,n,i,!0),qr(e,j(e,!1,t)),n=i=e.position):e.position===e.lineStart&&Vn(e)?_(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}_(e,"unexpected end of the stream within a double quoted scalar")}function dh(e,t){var n=!0,i,r,o,s=e.tag,a,l=e.anchor,c,u,f,d,p,y=Object.create(null),m,h,g,b;if(b=e.input.charCodeAt(e.position),b===91)u=93,p=!1,a=[];else if(b===123)u=125,p=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),b=e.input.charCodeAt(++e.position);b!==0;){if(j(e,!0,t),b=e.input.charCodeAt(e.position),b===u)return e.position++,e.tag=s,e.anchor=l,e.kind=p?"mapping":"sequence",e.result=a,!0;n?b===44&&_(e,"expected the node content, but found ','"):_(e,"missed comma between flow collection entries"),h=m=g=null,f=d=!1,b===63&&(c=e.input.charCodeAt(e.position+1),se(c)&&(f=d=!0,e.position++,j(e,!0,t))),i=e.line,r=e.lineStart,o=e.position,gt(e,t,qn,!1,!0),h=e.tag,m=e.result,j(e,!0,t),b=e.input.charCodeAt(e.position),(d||e.line===i)&&b===58&&(f=!0,b=e.input.charCodeAt(++e.position),j(e,!0,t),gt(e,t,qn,!1,!0),g=e.result),p?yt(e,a,y,h,m,g,i,r,o):f?a.push(yt(e,null,y,h,m,g,i,r,o)):a.push(m),j(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(n=!0,b=e.input.charCodeAt(++e.position)):n=!1}_(e,"unexpected end of the stream within a flow collection")}function ph(e,t){var n,i,r=Ir,o=!1,s=!1,a=t,l=0,c=!1,u,f;if(f=e.input.charCodeAt(e.position),f===124)i=!1;else if(f===62)i=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)Ir===r?r=f===43?ja:eh:_(e,"repeat of a chomping mode identifier");else if((u=sh(f))>=0)u===0?_(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?_(e,"repeat of an indentation width identifier"):(a=t+u-1,s=!0);else break;if(ze(f)){do f=e.input.charCodeAt(++e.position);while(ze(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!ge(f)&&f!==0)}for(;f!==0;){for(Br(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!s||e.lineIndent<a)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>a&&(a=e.lineIndent),ge(f)){l++;continue}if(e.lineIndent<a){r===ja?e.result+=K.repeat(`
|
|
166
|
+
`,o?1+l:l):r===Ir&&o&&(e.result+=`
|
|
167
167
|
`);break}for(i?ze(f)?(c=!0,e.result+=K.repeat(`
|
|
168
168
|
`,o?1+l:l)):c?(c=!1,e.result+=K.repeat(`
|
|
169
169
|
`,l+1)):l===0?o&&(e.result+=" "):e.result+=K.repeat(`
|
|
170
170
|
`,l):e.result+=K.repeat(`
|
|
171
|
-
`,o?1+l:l),o=!0,s=!0,l=0,n=e.position;!ge(f)&&f!==0;)f=e.input.charCodeAt(++e.position);
|
|
172
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new
|
|
171
|
+
`,o?1+l:l),o=!0,s=!0,l=0,n=e.position;!ge(f)&&f!==0;)f=e.input.charCodeAt(++e.position);Le(e,n,e.position,!1)}return!0}function Ga(e,t){var n,i=e.tag,r=e.anchor,o=[],s,a=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,_(e,"tab characters must not be used in indentation")),!(l!==45||(s=e.input.charCodeAt(e.position+1),!se(s))));){if(a=!0,e.position++,j(e,!0,-1)&&e.lineIndent<=t){o.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,gt(e,t,_l,!1,!0),o.push(e.result),j(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&l!==0)_(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return a?(e.tag=i,e.anchor=r,e.kind="sequence",e.result=o,!0):!1}function mh(e,t,n){var i,r,o,s,a,l,c=e.tag,u=e.anchor,f={},d=Object.create(null),p=null,y=null,m=null,h=!1,g=!1,b;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),b=e.input.charCodeAt(e.position);b!==0;){if(!h&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,_(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),o=e.line,(b===63||b===58)&&se(i))b===63?(h&&(yt(e,f,d,p,y,null,s,a,l),p=y=m=null),g=!0,h=!0,r=!0):h?(h=!1,r=!0):_(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,b=i;else{if(s=e.line,a=e.lineStart,l=e.position,!gt(e,n,wl,!1,!0))break;if(e.line===o){for(b=e.input.charCodeAt(e.position);ze(b);)b=e.input.charCodeAt(++e.position);if(b===58)b=e.input.charCodeAt(++e.position),se(b)||_(e,"a whitespace character is expected after the key-value separator within a block mapping"),h&&(yt(e,f,d,p,y,null,s,a,l),p=y=m=null),g=!0,h=!1,r=!1,p=e.tag,y=e.result;else if(g)_(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=u,!0}else if(g)_(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=u,!0}if((e.line===o||e.lineIndent>t)&&(h&&(s=e.line,a=e.lineStart,l=e.position),gt(e,t,$n,!0,r)&&(h?y=e.result:m=e.result),h||(yt(e,f,d,p,y,m,s,a,l),p=y=m=null),j(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&b!==0)_(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return h&&yt(e,f,d,p,y,null,s,a,l),g&&(e.tag=c,e.anchor=u,e.kind="mapping",e.result=f),g}function hh(e){var t,n=!1,i=!1,r,o,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&_(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(n=!0,s=e.input.charCodeAt(++e.position)):s===33?(i=!0,r="!!",s=e.input.charCodeAt(++e.position)):r="!",t=e.position,n){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(o=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):_(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!se(s);)s===33&&(i?_(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),El.test(r)||_(e,"named tag handle cannot contain such characters"),i=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);o=e.input.slice(t,e.position),ih.test(o)&&_(e,"tag suffix cannot contain flow indicator characters")}o&&!xl.test(o)&&_(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{_(e,"tag name is malformed: "+o)}return n?e.tag=o:Me.call(e.tagMap,r)?e.tag=e.tagMap[r]+o:r==="!"?e.tag="!"+o:r==="!!"?e.tag="tag:yaml.org,2002:"+o:_(e,'undeclared tag handle "'+r+'"'),!0}function yh(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&_(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!se(n)&&!ht(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&_(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function gh(e){var t,n,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;i!==0&&!se(i)&&!ht(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&_(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Me.call(e.anchorMap,n)||_(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],j(e,!0,-1),!0}function gt(e,t,n,i,r){var o,s,a,l=1,c=!1,u=!1,f,d,p,y,m,h;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=s=a=$n===n||_l===n,i&&j(e,!0,-1)&&(c=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;hh(e)||yh(e);)j(e,!0,-1)?(c=!0,a=o,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):a=!1;if(a&&(a=c||r),(l===1||$n===n)&&(qn===n||wl===n?m=t:m=t+1,h=e.position-e.lineStart,l===1?a&&(Ga(e,h)||mh(e,h,m))||dh(e,m)?u=!0:(s&&ph(e,m)||uh(e,m)||fh(e,m)?u=!0:gh(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&_(e,"alias node should not have any properties")):ch(e,m,qn===n)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(u=a&&Ga(e,h))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&_(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,d=e.implicitTypes.length;f<d;f+=1)if(y=e.implicitTypes[f],y.resolve(e.result)){e.result=y.construct(e.result),e.tag=y.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Me.call(e.typeMap[e.kind||"fallback"],e.tag))y=e.typeMap[e.kind||"fallback"][e.tag];else for(y=null,p=e.typeMap.multi[e.kind||"fallback"],f=0,d=p.length;f<d;f+=1)if(e.tag.slice(0,p[f].tag.length)===p[f].tag){y=p[f];break}y||_(e,"unknown tag !<"+e.tag+">"),e.result!==null&&y.kind!==e.kind&&_(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+y.kind+'", not "'+e.kind+'"'),y.resolve(e.result,e.tag)?(e.result=y.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):_(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||u}function bh(e){var t=e.position,n,i,r,o=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(j(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(o=!0,s=e.input.charCodeAt(++e.position),n=e.position;s!==0&&!se(s);)s=e.input.charCodeAt(++e.position);for(i=e.input.slice(n,e.position),r=[],i.length<1&&_(e,"directive name must not be less than one character in length");s!==0;){for(;ze(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!ge(s));break}if(ge(s))break;for(n=e.position;s!==0&&!se(s);)s=e.input.charCodeAt(++e.position);r.push(e.input.slice(n,e.position))}s!==0&&Br(e),Me.call(Va,i)?Va[i](e,i,r):jn(e,'unknown document directive "'+i+'"')}if(j(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,j(e,!0,-1)):o&&_(e,"directives end mark is expected"),gt(e,e.lineIndent-1,$n,!1,!0),j(e,!0,-1),e.checkLineBreaks&&nh.test(e.input.slice(t,e.position))&&jn(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Vn(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,j(e,!0,-1));return}if(e.position<e.length-1)_(e,"end of the stream or a document separator is expected");else return}function Il(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
172
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new lh(e,t),i=e.indexOf("\0");for(i!==-1&&(n.position=i,_(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)bh(n);return n.documents}function Sh(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var i=Il(e,n);if(typeof t!="function")return i;for(var r=0,o=i.length;r<o;r+=1)t(i[r])}function vh(e,t){var n=Il(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new ie("expected a single document in the stream, but found more")}}var Ah=Sh,wh=vh,Ll={loadAll:Ah,load:wh},Ml=Object.prototype.toString,Nl=Object.prototype.hasOwnProperty,$r=65279,_h=9,Ht=10,Eh=13,xh=32,kh=33,Ch=34,Mr=35,Oh=37,Th=38,Ih=39,Lh=42,Rl=44,Mh=45,Un=58,Nh=61,Rh=62,Ph=63,Fh=64,Pl=91,Fl=93,Dh=96,Dl=123,Bh=124,Bl=125,te={};te[0]="\\0";te[7]="\\a";te[8]="\\b";te[9]="\\t";te[10]="\\n";te[11]="\\v";te[12]="\\f";te[13]="\\r";te[27]="\\e";te[34]='\\"';te[92]="\\\\";te[133]="\\N";te[160]="\\_";te[8232]="\\L";te[8233]="\\P";var qh=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],$h=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function jh(e,t){var n,i,r,o,s,a,l;if(t===null)return{};for(n={},i=Object.keys(t),r=0,o=i.length;r<o;r+=1)s=i[r],a=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),l=e.compiledTypeMap.fallback[s],l&&Nl.call(l.styleAliases,a)&&(a=l.styleAliases[a]),n[s]=a;return n}function Uh(e){var t,n,i;if(t=e.toString(16).toUpperCase(),e<=255)n="x",i=2;else if(e<=65535)n="u",i=4;else if(e<=4294967295)n="U",i=8;else throw new ie("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+K.repeat("0",i-t.length)+t}var Kh=1,Jt=2;function Vh(e){this.schema=e.schema||Dr,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=K.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=jh(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?Jt:Kh,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Wa(e,t){for(var n=K.repeat(" ",t),i=0,r=-1,o="",s,a=e.length;i<a;)r=e.indexOf(`
|
|
173
173
|
`,i),r===-1?(s=e.slice(i),i=a):(s=e.slice(i,r+1),i=r+1),s.length&&s!==`
|
|
174
|
-
`&&(o+=n),o+=s;return o}function
|
|
175
|
-
`+K.repeat(" ",e.indent*t)}function
|
|
174
|
+
`&&(o+=n),o+=s;return o}function Nr(e,t){return`
|
|
175
|
+
`+K.repeat(" ",e.indent*t)}function Yh(e,t){var n,i,r;for(n=0,i=e.implicitTypes.length;n<i;n+=1)if(r=e.implicitTypes[n],r.resolve(t))return!0;return!1}function Kn(e){return e===xh||e===_h}function Xt(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==$r||65536<=e&&e<=1114111}function Ha(e){return Xt(e)&&e!==$r&&e!==Eh&&e!==Ht}function Ja(e,t,n){var i=Ha(e),r=i&&!Kn(e);return(n?i:i&&e!==Rl&&e!==Pl&&e!==Fl&&e!==Dl&&e!==Bl)&&e!==Mr&&!(t===Un&&!r)||Ha(t)&&!Kn(t)&&e===Mr||t===Un&&r}function Gh(e){return Xt(e)&&e!==$r&&!Kn(e)&&e!==Mh&&e!==Ph&&e!==Un&&e!==Rl&&e!==Pl&&e!==Fl&&e!==Dl&&e!==Bl&&e!==Mr&&e!==Th&&e!==Lh&&e!==kh&&e!==Bh&&e!==Nh&&e!==Rh&&e!==Ih&&e!==Ch&&e!==Oh&&e!==Fh&&e!==Dh}function Wh(e){return!Kn(e)&&e!==Un}function Gt(e,t){var n=e.charCodeAt(t),i;return n>=55296&&n<=56319&&t+1<e.length&&(i=e.charCodeAt(t+1),i>=56320&&i<=57343)?(n-55296)*1024+i-56320+65536:n}function ql(e){var t=/^\n* /;return t.test(e)}var $l=1,Rr=2,jl=3,Ul=4,mt=5;function Hh(e,t,n,i,r,o,s,a){var l,c=0,u=null,f=!1,d=!1,p=i!==-1,y=-1,m=Gh(Gt(e,0))&&Wh(Gt(e,e.length-1));if(t||s)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Gt(e,l),!Xt(c))return mt;m=m&&Ja(c,u,a),u=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Gt(e,l),c===Ht)f=!0,p&&(d=d||l-y-1>i&&e[y+1]!==" ",y=l);else if(!Xt(c))return mt;m=m&&Ja(c,u,a),u=c}d=d||p&&l-y-1>i&&e[y+1]!==" "}return!f&&!d?m&&!s&&!r(e)?$l:o===Jt?mt:Rr:n>9&&ql(e)?mt:s?o===Jt?mt:Rr:d?Ul:jl}function Jh(e,t,n,i,r){e.dump=(function(){if(t.length===0)return e.quotingType===Jt?'""':"''";if(!e.noCompatMode&&(qh.indexOf(t)!==-1||$h.test(t)))return e.quotingType===Jt?'"'+t+'"':"'"+t+"'";var o=e.indent*Math.max(1,n),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),a=i||e.flowLevel>-1&&n>=e.flowLevel;function l(c){return Yh(e,c)}switch(Hh(t,a,e.indent,s,l,e.quotingType,e.forceQuotes&&!i,r)){case $l:return t;case Rr:return"'"+t.replace(/'/g,"''")+"'";case jl:return"|"+Xa(t,e.indent)+Qa(Wa(t,o));case Ul:return">"+Xa(t,e.indent)+Qa(Wa(Xh(t,s),o));case mt:return'"'+Qh(t)+'"';default:throw new ie("impossible error: invalid scalar style")}})()}function Xa(e,t){var n=ql(e)?String(t):"",i=e[e.length-1]===`
|
|
176
176
|
`,r=i&&(e[e.length-2]===`
|
|
177
177
|
`||e===`
|
|
178
178
|
`),o=r?"+":i?"":"-";return n+o+`
|
|
179
|
-
`}function
|
|
180
|
-
`?e.slice(0,-1):e}function
|
|
181
|
-
`);return c=c!==-1?c:e.length,n.lastIndex=c,
|
|
179
|
+
`}function Qa(e){return e[e.length-1]===`
|
|
180
|
+
`?e.slice(0,-1):e}function Xh(e,t){for(var n=/(\n+)([^\n]*)/g,i=(function(){var c=e.indexOf(`
|
|
181
|
+
`);return c=c!==-1?c:e.length,n.lastIndex=c,za(e.slice(0,c),t)})(),r=e[0]===`
|
|
182
182
|
`||e[0]===" ",o,s;s=n.exec(e);){var a=s[1],l=s[2];o=l[0]===" ",i+=a+(!r&&!o&&l!==""?`
|
|
183
|
-
`:"")+
|
|
183
|
+
`:"")+za(l,t),r=o}return i}function za(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,i,r=0,o,s=0,a=0,l="";i=n.exec(e);)a=i.index,a-r>t&&(o=s>r?s:a,l+=`
|
|
184
184
|
`+e.slice(r,o),r=o+1),s=a;return l+=`
|
|
185
185
|
`,e.length-r>t&&s>r?l+=e.slice(r,s)+`
|
|
186
|
-
`+e.slice(s+1):l+=e.slice(r),l.slice(1)}function
|
|
187
|
-
`:""}var ny
|
|
188
|
-
`)?n.source:JSON.stringify(n.source),r=n.tag?`!<${n.tag}> `:"",o=W.load(`value: ${r}${i}`).value;
|
|
189
|
-
`)||void 0,i.items=i.items.filter(a=>!r.includes(a));for(let[a,l]of Object.entries(o))i.has(yd(i,a))||i.set(a,pd(e,l))}}),e.setSchema(e.directives?.yaml.version??"1.2",{schema:"core",compat:"yaml-1.1",customTags:["timestamp"],merge:!1})}function pd(e,t){let n=e.createNode(t,{aliasDuplicateObjects:!1});return(0,ee.visit)(n,{Pair(i,r){(0,ee.isScalar)(r.key)&&r.key.value==="<<"&&(r.key.type="QUOTE_DOUBLE")}}),n}function gd(e,t,n=[]){if(!Bs(e)||!Bs(t))return kv(e,t)?[]:[{kind:"set",path:n,value:t}];let i=[];for(let r of new Set([...Object.keys(e),...Object.keys(t)])){let o=[...n,r];!(r in t)||t[r]===void 0?i.push({kind:"delete",path:o}):r in e?i.push(...gd(e[r],t[r],o)):i.push({kind:"set",path:o,value:t[r]})}return i}function kv(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function md(e){return W.dump(e,{indent:2,lineWidth:-1,noRefs:!0})}function Bs(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Rt(e){if(typeof e!="object"||e===null)return!1;if("v2_enabled"in e&&typeof e.v2_enabled=="boolean")return e.v2_enabled;if(!("v2"in e))return!1;let t=e.v2;return typeof t!="object"||t===null?!1:"enabled"in t&&typeof t.enabled=="boolean"?t.enabled:"writeEnabled"in t&&t.writeEnabled===!0||"recallEnabled"in t&&t.recallEnabled===!0}var tr={enabled:!1,detailedLoggingEnabled:!1,writeEnabled:!1,recallEnabled:!1,eligibleSessionIdleMs:600*1e3,maxCaptureInputTokens:64e3,maxSessionDocBytes:64*1024,maxSelectedSessions:256,maxConsolidationInputTokens:256e3,maxMemoryMarkdownBytes:2*1024*1024,maxSummaryInjectionTokens:2500,maxCaptureSessionsPerWake:6,maxCaptureConcurrency:2,eligibleSessionMaxAgeDays:30,maxCaptureAttemptsPerRevision:3,captureFailureBackoffMs:3600*1e3,publicationCooldownMs:360*60*1e3,maxConsolidationAgentTurns:64,minModelQuotaRemainingPercent:25,captureModel:void 0,captureReasoningEffort:"low",consolidationModel:void 0,consolidationReasoningEffort:"medium",retentionDays:90};function vd(e,t){let n=e.memory,i=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},r=i.dailyDigest,o=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},s=i.v2,a=s!=null&&typeof s=="object"&&!Array.isArray(s)?s:{},l=t.v2,c=i.legacyRecallDisabledAgents;return{legacyRecallDisabledAgents:c&&typeof c=="object"&&!Array.isArray(c)?Object.fromEntries(Object.entries(c).filter(([,u])=>typeof u=="boolean")):{},enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled,proactive:typeof i.proactive=="boolean"?i.proactive:t.proactive,dailyDigest:{enabled:typeof o.enabled=="boolean"?o.enabled:t.dailyDigest.enabled},v2_enabled:typeof i.v2_enabled=="boolean"||["enabled","writeEnabled","recallEnabled"].some(u=>typeof a[u]=="boolean")?Rt(i):Rt(t),v2:{...typeof a.enabled=="boolean"?{enabled:a.enabled}:{},detailedLoggingEnabled:qs(a.detailedLoggingEnabled,l.detailedLoggingEnabled),writeEnabled:qs(a.writeEnabled,l.writeEnabled),recallEnabled:qs(a.recallEnabled,l.recallEnabled),eligibleSessionIdleMs:re(a.eligibleSessionIdleMs,l.eligibleSessionIdleMs),maxCaptureInputTokens:re(a.maxCaptureInputTokens,l.maxCaptureInputTokens),maxSessionDocBytes:re(a.maxSessionDocBytes,l.maxSessionDocBytes),maxSelectedSessions:re(a.maxSelectedSessions,l.maxSelectedSessions),maxConsolidationInputTokens:re(a.maxConsolidationInputTokens,l.maxConsolidationInputTokens),maxMemoryMarkdownBytes:re(a.maxMemoryMarkdownBytes,l.maxMemoryMarkdownBytes),maxSummaryInjectionTokens:re(a.maxSummaryInjectionTokens,l.maxSummaryInjectionTokens),maxCaptureSessionsPerWake:re(a.maxCaptureSessionsPerWake,l.maxCaptureSessionsPerWake),maxCaptureConcurrency:re(a.maxCaptureConcurrency,l.maxCaptureConcurrency),eligibleSessionMaxAgeDays:re(a.eligibleSessionMaxAgeDays,l.eligibleSessionMaxAgeDays),maxCaptureAttemptsPerRevision:re(a.maxCaptureAttemptsPerRevision,l.maxCaptureAttemptsPerRevision),captureFailureBackoffMs:re(a.captureFailureBackoffMs,l.captureFailureBackoffMs),publicationCooldownMs:re(a.publicationCooldownMs,l.publicationCooldownMs),maxConsolidationAgentTurns:re(a.maxConsolidationAgentTurns,l.maxConsolidationAgentTurns),minModelQuotaRemainingPercent:Cv(a.minModelQuotaRemainingPercent,l.minModelQuotaRemainingPercent),captureModel:bd(a.captureModel,l.captureModel),captureReasoningEffort:Sd(a.captureReasoningEffort,l.captureReasoningEffort),consolidationModel:bd(a.consolidationModel,l.consolidationModel),consolidationReasoningEffort:Sd(a.consolidationReasoningEffort,l.consolidationReasoningEffort),retentionDays:re(a.retentionDays,l.retentionDays)}}}function qs(e,t){return typeof e=="boolean"?e:t}function re(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:t}function Cv(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0&&e<=100?e:t}function bd(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}function Sd(e,t){return e==="low"||e==="medium"||e==="high"?e:t}function Ov(e,t){return!Rt(e)&&e?.enabled!==!1&&e?.legacyRecallDisabledAgents?.[t]!==!0}import oe from"node:path";import CA from"node:os";import{spawnSync as OA}from"node:child_process";import{fileURLToPath as TA}from"node:url";function Ad(e){let t=e.tui;if(t==null||typeof t!="object"||Array.isArray(t))return{};let n=t,i=n.notifications,r;if(i&&typeof i=="object"&&!Array.isArray(i)){let{when:l,method:c}=i;r={...l==="unfocused"||l==="always"||l==="never"?{when:l}:{},...c==="auto"||c==="osc9"||c==="osc777"||c==="bel"?{method:c}:{}}}let o=n.statusLine,s=Array.isArray(o)?o.filter(l=>typeof l=="string").map(l=>l.trim()).filter(Boolean):void 0,a=Tv(n.customStatusLine);return{...typeof n.showTips=="boolean"?{showTips:n.showTips}:{},...r?{notifications:r}:{},...s?{statusLine:s}:{},...a?{customStatusLine:a}:{}}}function Tv(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e,n=typeof t.command=="string"?t.command.trim():"";if(n)return{command:n,...t.display==="inline"||t.display==="block"?{display:t.display}:{},...t.position==="above"||t.position==="below"?{position:t.position}:{},...t.colorMode==="plain"||t.colorMode==="ansi"?{colorMode:t.colorMode}:{},...typeof t.maxLines=="number"&&Number.isFinite(t.maxLines)?{maxLines:t.maxLines}:{},...typeof t.timeoutMs=="number"&&Number.isFinite(t.timeoutMs)?{timeoutMs:t.timeoutMs}:{},...typeof t.intervalSeconds=="number"&&Number.isFinite(t.intervalSeconds)?{intervalSeconds:t.intervalSeconds}:{}}}import{createHash as Iv,randomUUID as Lv}from"node:crypto";import ir from"node:fs";import nr from"node:path";function Ed(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e,n={};typeof t.apiKey=="string"&&(n.apiKey=t.apiKey),typeof t.baseURL=="string"&&(n.baseURL=t.baseURL);let i=js(t.modelContextLimits);return i&&(n.modelContextLimits=i),Object.keys(n).length>0?n:void 0}function js(e){if(!B(e))return;let t=Object.entries(e).filter(n=>n[0].length>0&&Number.isSafeInteger(n[1])&&n[1]>0);return t.length>0?Object.fromEntries(t):void 0}function xd(e,t){let n=e.minimax;if(!n?.models||!t)return e;let i=!1,r=Object.fromEntries(Object.entries(n.models).map(([o,s])=>{let a=t[o];return a===void 0||!s.contextWindowOptions?.includes(a)||s.limit?.context===a?[o,s]:(i=!0,[o,{...s,limit:{...s.limit,context:a}}])}));return i?{...e,minimax:{...n,models:r}}:e}function kd(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=Object.entries(e).filter(([,n])=>n!=null&&typeof n=="object"&&!Array.isArray(n));if(t.length!==0)return Object.fromEntries(t.map(([n,i])=>[n,Od(i)]))}function Cd(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,B(n)?Od(n):n]))}function Od(e){if(!B(e.models))return e;let t=!1,n=Object.fromEntries(Object.entries(e.models).map(([i,r])=>{if(!B(r)||!B(r.thinking))return[i,r];let o=typeof r.thinking.effort=="string"?r.thinking.effort.trim():"",s=typeof r.thinking.defaultEffort=="string"?r.thinking.defaultEffort.trim():"";if(!Object.hasOwn(r.thinking,"effort")&&!Object.hasOwn(r.thinking,"defaultEffort"))return[i,r];let a=[],l=new Set;if(Array.isArray(r.thinking.effortOptions))for(let d of r.thinking.effortOptions){if(typeof d!="string")continue;let p=d.trim();!p||l.has(p)||(l.add(p),a.push(p))}o&&!l.has(o)&&(l.add(o),a.push(o)),s&&!l.has(s)&&(l.add(s),a.push(s));let c={...r.thinking};delete c.effort,delete c.effortOptions,delete c.defaultEffort;let u={...c,...a.length>0?{effortOptions:a}:{},...s?{defaultEffort:s}:{}},f={...r};return Object.keys(u).length>0?f.thinking=u:delete f.thinking,t=!0,[i,f]}));return t?{...e,models:n}:e}var Td="byok_legacy_provider_to_custom_provider_v1",Id="config.yaml.bak.byok-legacy-provider.",$s=new Set(["minimax","minimax_api","provider","custom_provider"]),Mv=/^[A-Za-z0-9 _-]+$/;function Ld(e,t){let n={migrated:!1,migratedProviders:{}};if(!t.isManagedRuntime()||!ir.existsSync(e))return n;let i=Rv(e);if(!B(i.provider))return n;let r=i.provider,o=B(i.custom_provider)?i.custom_provider:{},s=Vv(i),a={},l={...o},c=new Set(Object.keys(l)),u=!1,f=t.getManagedPreset().provider;for(let[d,p]of Object.entries(r)){if(!Dv(d,p,f))continue;let y=s.providers[d];if(y&&!$s.has(y)&&!B(l[y])){delete r[d],u=!0;continue}let m=y&&!$s.has(y)?y:qv(d,p,c);a[d]=m,B(l[m])||(l[m]=Bv(p),c.add(m),u=!0),s.providers[d]!==m&&(s.providers[d]=m,u=!0),delete r[d],u=!0}if(!u&&Object.keys(a).length===0)return n;if(u=_d(i,"defaultModel",a)||u,u=_d(i,"defaultLightModel",a)||u,u=Uv(i,a)||u,!u)return{migrated:!1,migratedProviders:a};Object.keys(l).length>0?i.custom_provider=l:delete i.custom_provider,Yv(i,s);try{let d=Kv(e);return it(e,W.dump(i,{indent:2,lineWidth:-1,noRefs:!0})),{migrated:!0,migratedProviders:a,backupPath:d}}catch(d){return console.warn(`[config] legacy BYOK provider migration skipped: ${Wv(d)}`),{migrated:!1,migratedProviders:a}}}function Md(e,t){let n=e.provider,i=e.defaultModel;if(Object.prototype.hasOwnProperty.call(n,"minimax_api")){let{minimax_api:y,...m}=n;n=m,console.warn('[config] "minimax_api" is a reserved provider id; ignoring provider.minimax_api from config.yaml')}let o=t.getManagedPreset().provider.minimax,s=n.minimax,a=t.isManagedRuntime();if(!(a||Nv(s,t)))return{provider:n,defaultModel:i};let c=s?.options,u=a&&t.shouldEnforceManagedProviderProtection(),f=Pv(o.models,s?.models),d=typeof c?.baseURL=="string"&&c.baseURL.length>0?c.baseURL:void 0,p=u&&d!=null&&!t.isManagedPresetBaseUrl(d);return n={...n,minimax:{...o,...s??{},npm:s?.npm??o.npm,models:f,options:{...o.options??{},...c??{},...p?{apiKey:o.options?.apiKey}:{},...u?{authMode:"managed-login",baseURL:o.options?.baseURL}:{}}}},{provider:n,defaultModel:i}}function Nv(e,t){let n=e?.options;return n?.authMode==="managed-login"?!0:typeof n?.baseURL=="string"&&t.isManagedPresetBaseUrl(n.baseURL)}function Pv(e,t){return t&&Object.keys(t).length>0?t:e??{}}function Rv(e){try{let t=W.load(ir.readFileSync(e,"utf-8"));return B(t)?t:{}}catch{return{}}}function Dv(e,t,n){return e==="minimax"||e==="minimax_api"||!Gv(t)||!Fv(t)?!1:!Object.prototype.hasOwnProperty.call(n,e)}function Fv(e){let t=B(e.options)?e.options:void 0;return typeof t?.apiKey=="string"&&t.apiKey.trim().length>0&&typeof t.baseURL=="string"&&t.baseURL.trim().length>0&&B(e.models)}function Bv(e){let t=B(e.options)?e.options:{};return{...e,kind:"custom",enabled:e.enabled!==!1,options:{...t,authMode:"api-key"}}}function qv(e,t,n){let i=B(t)?t:{},r=typeof i.name=="string"?i.name:void 0,o=`provider-${$v(e)}`,s=wd(e)??wd(r)??o;for(let a=0;;a+=1){let l=a===0?s:`${s}-${a+1}`;if(!n.has(l)&&!$s.has(l))return l}}function wd(e){let t=e?.trim();return!t||!Mv.test(t)?void 0:t.toLowerCase().replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function $v(e){return Iv("sha256").update(e).digest("hex").slice(0,8)}function _d(e,t,n){let i=e[t];if(typeof i!="string")return!1;let r=jv(i,n);return r===i?!1:(e[t]=r,!0)}function jv(e,t){let n=e.indexOf("/");if(n<=0||n===e.length-1)return e;let i=e.slice(0,n),r=t[i];return r?`custom_provider:${r}/${e.slice(n+1)}`:e}function Uv(e,t){if(!B(e.nexus)||!B(e.nexus.model))return!1;let n=e.nexus.model.providerID;if(typeof n!="string")return!1;let i=t[n];return i?(e.nexus.model.providerID=`custom_provider:${i}`,!0):!1}function Nd(e){if(process.platform==="win32")return;let t=nr.dirname(e),n;try{n=ir.readdirSync(t,{withFileTypes:!0})}catch{console.warn(`[config] Could not inspect legacy BYOK backups in ${JSON.stringify(t)}. Backup permissions were not verified; check directory access and restrict backup permissions manually.`);return}for(let i of n)if(i.isFile()&&i.name.startsWith(Id)){let r=nr.join(t,i.name);try{_t(r)}catch{console.warn(`[config] Could not restrict legacy BYOK backup ${JSON.stringify(r)}. It may still be readable by other users; restrict its permissions manually.`)}}}function Kv(e){let t=nr.join(nr.dirname(e),`${Id}${Date.now()}.${Lv()}`);return _t(e),it(t,ir.readFileSync(e),!0),t}function Vv(e){let n=(B(e.migrations)?e.migrations:void 0)?.[Td];return{providers:B(n)&&B(n.providers)?Object.fromEntries(Object.entries(n.providers).filter(r=>typeof r[1]=="string")):{}}}function Yv(e,t){let n=B(e.migrations)?e.migrations:{};n[Td]={version:1,providers:t.providers},e.migrations=n}function Gv(e){return B(e)?typeof e.name=="string"||typeof e.npm=="string"||typeof e.api=="string"||B(e.options)||B(e.models):!1}function B(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Wv(e){return e instanceof Error?e.message:String(e)}function Pd(e,t){if(e==null||typeof e!="object"||Array.isArray(e))return t;let n=Reflect.get(e,"mode"),i=Reflect.get(e,"turnDiffCard");return{mode:n==="inline"||n==="subagent"?n:t.mode,turnDiffCard:i==="concise"||i==="standard"?i:t.turnDiffCard,modeSource:n==="inline"||n==="subagent"?"explicit":"default"}}function Rd(e,t){let n=t.keepAlive,i=t.xdg,r=t.spawnConcurrency,o=()=>({enabled:n.enabled,maxProcesses:n.maxProcesses,maxLifetimeMs:n.maxLifetimeMs,agents:[...n.agents]}),s=e.opencode;if(s==null||typeof s!="object"||Array.isArray(s))return{keepAlive:o(),xdg:{...i},spawnConcurrency:r};let a=s,l=a.spawnConcurrency,c=typeof l=="number"&&Number.isFinite(l)&&l>0&&Number.isInteger(l)?l:r,u=Hv(a.xdg,i),f=a.keepAlive;if(f==null||typeof f!="object"||Array.isArray(f))return{keepAlive:o(),xdg:u,spawnConcurrency:c};let d=f,p=d.maxProcesses,y=typeof p=="number"&&Number.isFinite(p)&&p>0&&Number.isInteger(p)?p:n.maxProcesses,m=d.maxLifetimeMs,h=typeof m=="number"&&Number.isFinite(m)&&m>0&&Number.isInteger(m)?m:n.maxLifetimeMs,g=d.agents,b;return Array.isArray(g)?(b=g.filter(v=>typeof v=="string"&&v.length>0),b.length===0&&(b=[...n.agents])):b=[...n.agents],{keepAlive:{enabled:typeof d.enabled=="boolean"?d.enabled:n.enabled,maxProcesses:y,maxLifetimeMs:h,agents:b},xdg:u,spawnConcurrency:c}}function Hv(e,t){let n=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0,i=n?.startupImport,r=i==="background"||i==="blocking"||i==="off"?i:t.startupImport;return{dataIsolation:typeof n?.dataIsolation=="boolean"?n.dataIsolation:t.dataIsolation,startupImport:r}}function rr(e){let t=JSON.stringify({level:40,time:Date.now(),name:"config.asr",msg:e});process.stderr.write(`${t}
|
|
190
|
-
`)}var sr={enabled:!0};function Dd(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e,n=typeof t.apiKey=="string"&&t.apiKey.trim().length>0,i=typeof t.resourceId=="string"&&t.resourceId.trim().length>0;return n||i}function or(e){return typeof e=="string"&&e.trim().length>0}function Fd(e){let t=e.asr;if(t==null||typeof t!="object"||Array.isArray(t))return{...sr};let n=t;return Dd(n.seed)&&rr("Ignoring legacy `asr.seed.*` in config \u2014 Seed ASR was retired from the daemon; only Amadeus remains. Remove `asr.seed` from config.yaml."),Dd(n.qwen)&&rr("Ignoring legacy `asr.qwen.apiKey` in config \u2014 Qwen ASR was retired from the daemon; only Amadeus remains. Remove `asr.qwen` from config.yaml."),(or(n.mode)||or(n.proxyBaseUrl))&&rr("Ignoring legacy `asr.mode` / `asr.proxyBaseUrl` in config \u2014 the daemon no longer runs the shared asr-proxy WebSocket path. The Amadeus HTTP proxy is managed by the application environment. Remove these keys from config.yaml."),(or(n.primaryProvider)||or(n.fallbackProvider))&&rr("Ignoring legacy `asr.primaryProvider` / `asr.fallbackProvider` in config \u2014 only Amadeus remains and provider selection is no longer configurable. Remove these keys from config.yaml."),{enabled:typeof n.enabled=="boolean"?n.enabled:sr.enabled}}var Jv={policyOwner:"core",storageWriteVersion:2,classifierTimeoutMs:6e4,userConfirmationEnabled:!0};function Bd(e,t=Jv){let n=e.permission;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.policyOwner===void 0?t.policyOwner:i.policyOwner==="engine"||i.policyOwner==="core"?i.policyOwner:"engine",o=i.storageWriteVersion===1||i.storageWriteVersion===2?i.storageWriteVersion:t.storageWriteVersion,s=i.classifierTimeoutMs,a=typeof s=="number"&&Number.isFinite(s)&&s>=5e3?Math.floor(s):t.classifierTimeoutMs,l=typeof i.userConfirmationEnabled=="boolean"?i.userConfirmationEnabled:t.userConfirmationEnabled;return{policyOwner:r,storageWriteVersion:o,classifierTimeoutMs:a,userConfirmationEnabled:l}}var qd=["user-cc","user-codex","user-agents","workspace-minimax","workspace-cc","workspace-agents"],Xv={"user-cc":"user-claude","workspace-cc":"workspace-claude"},lr={external:{enabled:!0,walkUp:!0,duplicateWarn:!0,sources:{"workspace-minimax":{enabled:!0,priority:65},"workspace-cc":{enabled:!0,priority:60},"workspace-agents":{enabled:!0,priority:55},"user-cc":{enabled:!0,priority:40},"user-codex":{enabled:!0,priority:35},"user-agents":{enabled:!0,priority:30}}}};function ar(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Qv(e,t){return ar(e)?{enabled:typeof e.enabled=="boolean"?e.enabled:t.enabled,priority:typeof e.priority=="number"&&Number.isFinite(e.priority)?e.priority:t.priority}:t}function Us(e){let t=lr,n=ar(e.skills)?e.skills:{},i=ar(n.external)?n.external:{},r=ar(i.sources)?i.sources:{},o={...t.external.sources};for(let s of qd){let a=Xv[s],l=Object.hasOwn(r,s)?r[s]:a?r[a]:void 0;o[s]=Qv(l,t.external.sources[s])}return{external:{enabled:typeof i.enabled=="boolean"?i.enabled:t.external.enabled,walkUp:typeof i.walkUp=="boolean"?i.walkUp:t.external.walkUp,duplicateWarn:typeof i.duplicateWarn=="boolean"?i.duplicateWarn:t.external.duplicateWarn,sources:o}}}var zv=qd;var $d=["pi-agent"],Dt="pi-agent";function jd(e){return typeof e!="string"?Dt:$d.includes(e)?e:Dt}function Ks(e){return e==null||typeof e!="object"||Array.isArray(e)?{defaultFramework:Dt}:{defaultFramework:jd(e.defaultFramework)}}import Y from"node:fs";import Zv from"node:os";import Ft from"node:path";var Wd=".minimax",Hd=".mavis",eA={error:()=>{},info:()=>{},warn:()=>{}};function Hs(e){return e??Zv.homedir()}function Jd(e,t){return t?`${e}-${t}`:e}function Xd(e,t){return Ft.join(Hs(e),Jd(Wd,t))}function Qd(e,t){return Ft.join(Hs(e),Jd(Hd,t))}function Ys(e){try{let t=Y.lstatSync(e);return t.isSymbolicLink()?{kind:"link"}:t.isDirectory()?{kind:"directory"}:{kind:"other"}}catch(t){let n=t.code;return n==="ENOENT"||n==="ENOTDIR"?{kind:"missing"}:{kind:"inaccessible",error:t}}}function Vs(e){let t=Ft.resolve(e);return process.platform==="win32"?(t=t.replace(/^\\\\\?\\/,""),t.toLowerCase()):t}function Js(e,t){try{let n=Y.readlinkSync(e),i=Vs(t);return Vs(Ft.resolve(Ft.dirname(e),n))===i||Vs(n)===i}catch{return!1}}function cr(e,t,n){if(!Js(e,t))try{Y.symlinkSync(t,e,process.platform==="win32"?"junction":"dir")}catch(i){n.warn(`Failed to create compat link ${e} -> ${t}: ${String(i)}`)}}function Ud(e,t,n){if(t.kind==="missing")return!0;if(t.kind==="link"||t.kind==="other")try{return Y.unlinkSync(e),!0}catch(i){return n.warn(`Failed to remove ${e} before creating compat link: ${String(i)}`),!1}return!1}function Gs(e){try{let t=Y.readdirSync(e);if(t.length===0)return"empty";if(t.length===1&&t[0]==="workspace")try{return Y.readdirSync(Ft.join(e,"workspace")).length>0?"hasData":"empty"}catch{return"unknown"}return"hasData"}catch{return"unknown"}}function Ws(e){try{return Y.statSync(e).isDirectory()?Gs(e):void 0}catch{return"unknown"}}function tA(e,t){return`${e}.backup-${t()}`}function nA(e,t,n){let i=tA(e,n);try{return Y.renameSync(e,i),t.warn(`Backed up legacy data dir ${e} -> ${i}`),!0}catch(r){return t.warn(`Failed to back up legacy data dir ${e}: ${String(r)}`),!1}}function iA(e,t,n,i){if(Js(e,t))return!0;let r=Ys(e);if(r.kind==="missing")return!0;if(r.kind==="link"){let o=Ws(e);return o==="hasData"||o==="unknown"?(n.warn(`Cannot replace legacy data dir symlink ${e}; it may point to real data outside ${t}`),!1):Ud(e,r,n)}return r.kind==="other"?Ud(e,r,n):r.kind==="directory"?nA(e,n,i):(n.warn(`Cannot replace inaccessible legacy data dir ${e}; leaving it untouched`),!1)}function Kd(e,t,n,i){iA(e,t,n,i)&&cr(e,t,n)}function rA(e,t){try{return Y.rmSync(e,{recursive:!0,force:!1}),!0}catch(n){return t.warn(`Failed to remove empty primary data dir ${e}: ${String(n)}`),!1}}function Vd(e,t,n){try{return Y.renameSync(e,t),n.info(`Migrated legacy data dir ${e} -> ${t}`),!0}catch(i){return n.warn(`Failed to migrate legacy data dir ${e} -> ${t}: ${String(i)}`),!1}}function oA(e,t,n,i){try{Y.cpSync(e,n,{recursive:!0,errorOnExist:!0,force:!1}),Y.unlinkSync(t);try{Y.rmSync(e,{recursive:!0,force:!1})}catch(r){i.warn(`Copied legacy symlink data dir ${e} -> ${n}, but failed to remove old target: ${String(r)}`)}return i.info(`Copied legacy data dir symlink target ${e} -> ${n}`),!0}catch(r){try{Y.existsSync(n)&&Y.rmSync(n,{recursive:!0,force:!0})}catch(o){i.warn(`Failed to clean up partial primary data dir ${n}: ${String(o)}`)}return i.warn(`Failed to copy legacy symlink data dir ${t} -> ${n}: ${String(r)}`),!1}}function Yd(e,t,n){try{let i=Y.realpathSync(e);try{Y.renameSync(i,t)}catch(r){if(r.code==="EXDEV")return oA(i,e,t,n);throw r}return Y.unlinkSync(e),n.info(`Migrated legacy data dir symlink target ${i} -> ${t}`),!0}catch(i){return n.warn(`Failed to migrate legacy symlink data dir ${e} -> ${t}: ${String(i)}`),!1}}function Gd(e,t){try{return Y.mkdirSync(e,{recursive:!0}),!0}catch(n){return t.warn(`Failed to create primary data dir ${e}: ${String(n)}`),!1}}function sA(e,t,n,i){let r=Ys(e),o=Ys(t);if(r.kind==="inaccessible")return n.warn(`Primary data dir ${e} is inaccessible; not treating it as missing`),e;if(r.kind==="directory"){let s=Gs(e),a=o.kind==="directory"?Gs(t):o.kind==="link"?Ws(t)??"empty":"empty";if(s==="empty"){if(o.kind==="inaccessible"||a==="unknown")return n.warn(`Legacy data dir ${t} may contain data but is inaccessible; not using empty primary ${e}`),t;if((o.kind==="directory"||o.kind==="link")&&a==="hasData"){if(!rA(e,n))return t;if(o.kind==="link"){if(!Yd(t,e,n))return t}else if(!Vd(t,e,n))return t;return cr(t,e,n),e}}return Kd(t,e,n,i),e}if(Js(t,e))return Gd(e,n),e;if(o.kind==="directory")return Vd(t,e,n)?(cr(t,e,n),e):t;if(o.kind==="link"){let s=Ws(t);if(s==="hasData")return Yd(t,e,n)?(cr(t,e,n),e):t;if(s==="unknown")return n.warn(`Legacy data dir symlink ${t} target is inaccessible; not treating it as missing`),t}return o.kind==="inaccessible"?(n.warn(`Legacy data dir ${t} is inaccessible; not treating it as missing`),t):r.kind==="link"||r.kind==="other"?(n.warn(`Primary data dir path ${e} exists but is not a directory; using it without migration`),e):(Gd(e,n),Kd(t,e,n,i),e)}function Ye(e={}){let t=Hs(e.homeDir),n=e.profile??null;return sA(Xd(t,n),Qd(t,n),e.logger??eA,e.nowMs??Date.now)}function aA(e,t){return Ye({homeDir:e,logger:t})}function lA(e,t,n){return Ye({homeDir:t,profile:e,logger:n})}var ta=["read","write","edit","bash","task_query","task_output","task_stop","grep","glob","todowrite","web_fetch","website_deploy","workspace_semantic_search"],na=["images_understand","image_synthesize","images_search_and_download","image_reverse_search","submit_video_generation","query_video_generation","gen_videos","batch_text_to_video","batch_image_to_video","get_voice_list","batch_text_to_audio","batch_text_to_music","synthesize_speech","batch_synthesize_speech","audios_understand","videos_understand","transcribe_audio"],ia=["code-review","deep-research","deploy-website","docx","edit-deployed-website","init","lark-tools","llm-call","mcode-tools-master","mavis-doctor","pdf","plugin-creator","pptx","skill-creator","skill-refiner","visual-page","x-link-reader","xlsx"],ep=["control-in-app-browser","resume-codex","mavis","create-agent","minimax-code-product","miniapp-creator"],cA=new Set(["modelConfigId","persona","tools","builtinTools","skills","features"]),uA=new Set(["enabled"]),Zs=new Set(["mavis","delegation","webSearch"]),tp=new Set(ta),zd=["task_query","task_output","task_stop"],np=new Set(na),ea=new Set(ia),ip=new Set(ep),fA=new Set(["plan-mode"]);function ra(e){let t=ur(e),n=ur(t?.default);return{default:n?pA(n):{}}}function dA(e,t="agent"){if(e===void 0)return{};let n=Qs(e,t);zs(n,cA,t);let i={};if(n.modelConfigId!==void 0&&((typeof n.modelConfigId!="string"||!n.modelConfigId.trim())&&ce(`${t}.modelConfigId`,"must be a non-empty string"),i.modelConfigId=n.modelConfigId.trim()),n.persona!==void 0){let r=Qs(n.persona,`${t}.persona`);zs(r,uA,`${t}.persona`),r.enabled!==void 0&&typeof r.enabled!="boolean"&&ce(`${t}.persona.enabled`,"must be a boolean"),i.persona={...typeof r.enabled=="boolean"?{enabled:r.enabled}:{}}}if(n.tools!==void 0&&(Array.isArray(n.tools)||ce(`${t}.tools`,"must be an array"),i.tools=n.tools.map((r,o)=>((typeof r!="string"||!tp.has(r))&&ce(`${t}.tools[${o}]`,`must be one of ${ta.join(", ")}`),r))),n.builtinTools!==void 0&&(Array.isArray(n.builtinTools)||ce(`${t}.builtinTools`,"must be an array"),i.builtinTools=n.builtinTools.map((r,o)=>(r==="web_search"&&ce(`${t}.builtinTools[${o}]`,"web_search is feature-owned; use features.webSearch"),(typeof r!="string"||!np.has(r))&&ce(`${t}.builtinTools[${o}]`,`must be one of ${na.join(", ")}`),r))),n.skills!==void 0&&(Array.isArray(n.skills)||ce(`${t}.skills`,"must be an array"),i.skills=n.skills.map((r,o)=>{if(typeof r=="string"&&ip.has(r.trim())){let s=r.trim();ce(`${t}.skills[${o}]`,`${s} is capability-owned; use its owning Tool or feature switch`)}return(typeof r!="string"||!ea.has(r.trim()))&&ce(`${t}.skills[${o}]`,`must be one of ${ia.join(", ")}`),r.trim()})),n.features!==void 0){let r=Qs(n.features,`${t}.features`);zs(r,Zs,`${t}.features`);for(let o of Zs)r[o]!==void 0&&typeof r[o]!="boolean"&&ce(`${t}.features.${o}`,"must be a boolean");i.features={...typeof r.mavis=="boolean"?{mavis:r.mavis}:{},...typeof r.delegation=="boolean"?{delegation:r.delegation}:{},...typeof r.webSearch=="boolean"?{webSearch:r.webSearch}:{}}}return i}function pA(e){let t={};typeof e.modelConfigId=="string"&&e.modelConfigId.trim()&&(t.modelConfigId=e.modelConfigId.trim());let n=ur(e.persona);if(typeof n?.enabled=="boolean"&&(t.persona={enabled:n.enabled}),Zd(e.tools,tp)){let r=[...e.tools];zd.some(o=>r.includes(o))||r.push(...zd),t.tools=r}if(Zd(e.builtinTools,np)&&(t.builtinTools=[...e.builtinTools]),Array.isArray(e.skills)){let r=e.skills.map(o=>typeof o=="string"?o.trim():o);r.every(o=>typeof o=="string"&&(ea.has(o)||fA.has(o))&&!ip.has(o))&&(t.skills=r.filter(o=>typeof o=="string"&&ea.has(o)))}let i=ur(e.features);if(i){let r={};for(let o of Zs)typeof i[o]=="boolean"&&(r[o]=i[o]);Object.keys(r).length>0&&(t.features=r)}return t}function ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function Zd(e,t){return Array.isArray(e)&&e.every(n=>typeof n=="string"&&t.has(n))}function mA(e={},t={}){return{persona:{enabled:t.persona?.enabled??e.persona?.enabled??!0},tools:Xs(t.tools??e.tools),builtinTools:Xs(t.builtinTools??e.builtinTools),skills:Xs(t.skills??e.skills),features:{mavis:t.features?.mavis??e.features?.mavis??!0,delegation:t.features?.delegation??e.features?.delegation??!0,webSearch:t.features?.webSearch??e.features?.webSearch??!0}}}function hA(e,t){return e.tools===void 0||e.tools.includes(t)}function yA(e,t){return e.builtinTools===void 0||e.builtinTools.includes(t)}function gA(e,t){return e.skills===void 0||e.skills.includes(t)}function Xs(e){return e===void 0?void 0:[...e]}function Qs(e,t){return(e==null||typeof e!="object"||Array.isArray(e))&&ce(t,"must be an object"),e}function zs(e,t,n){for(let i of Object.keys(e))t.has(i)||ce(`${n}.${i}`,"is not supported")}function ce(e,t){throw new Error(`Invalid configuration at ${e}: ${t}`)}var oa={enabled:!0};function rp(e,t=oa){let n=e.askUser;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled}}var Ge={enabled:!0,enabledSource:"default"};function sa(e,t=Ge){let n=e.dataContribution;if(n==null||typeof n!="object"||Array.isArray(n))return{...t,enabledSource:"default"};let i=n,r=typeof i.enabled=="boolean";return{enabled:r?i.enabled:t.enabled,enabledSource:r?"explicit":"default"}}function op(e){try{let t=e()?.dataContribution?.enabled;return typeof t=="boolean"?t:Ge.enabled}catch{return Ge.enabled}}var lp=["none","evaluator","subagent"],cp=["brief","transcript"],up=["same-route-small-fast"],fp="goal-verifier-readonly",dp=[fp],he={budget:{graceSteps:1},breaker:{repeatedReplyLimit:3},verifier:{repeatedNotMetLimit:5,evidence:"brief"},evaluator:{modelPolicy:"same-route-small-fast",maxTokens:32e3,timeoutSeconds:60,maxRetries:1}},aa={budget:{graceSteps:3},evaluator:{maxRetries:1}};function la(e){let t=[],n=Bt(e,"goal",t);qt(n,"goal",t,["objectiveMaxChars","verification","budget","breaker","verifier","evaluator","subagent"]);let i=Bt(n.budget,"goal.budget",t);qt(i,"goal.budget",t,["defaultTokens","defaultMainTurns","defaultActiveSeconds","graceSteps"]);let r=Bt(n.breaker,"goal.breaker",t);qt(r,"goal.breaker",t,["repeatedReplyLimit"]);let o=Bt(n.verifier,"goal.verifier",t);qt(o,"goal.verifier",t,["repeatedNotMetLimit","evidence"]);let s=Bt(n.evaluator,"goal.evaluator",t);qt(s,"goal.evaluator",t,["modelPolicy","maxTokens","timeoutSeconds","maxRetries"]);let a=Bt(n.subagent,"goal.subagent",t);qt(a,"goal.subagent",t,["profile","maxTurns","maxTokens","timeoutSeconds"]);let l=ap(n.verification,"goal.verification",lp,t),c=ut(n.objectiveMaxChars,"goal.objectiveMaxChars",t,{min:1}),u=ut(i.defaultTokens,"goal.budget.defaultTokens",t,{min:1}),f=ut(i.defaultMainTurns,"goal.budget.defaultMainTurns",t,{min:1}),d=ut(i.defaultActiveSeconds,"goal.budget.defaultActiveSeconds",t,{min:1}),p=ap(a.profile,"goal.subagent.profile",dp,t),y=ut(a.maxTurns,"goal.subagent.maxTurns",t,{min:1}),m=ut(a.maxTokens,"goal.subagent.maxTokens",t,{min:1}),h=ut(a.timeoutSeconds,"goal.subagent.timeoutSeconds",t,{min:1}),g={...p!==void 0?{profile:p}:{},...y!==void 0?{maxTurns:y}:{},...m!==void 0?{maxTokens:m}:{},...h!==void 0?{timeoutSeconds:h}:{}};return{config:{...c!==void 0?{objectiveMaxChars:c}:{},...l!==void 0?{verification:l}:{},budget:{...u!==void 0?{defaultTokens:u}:{},...f!==void 0?{defaultMainTurns:f}:{},...d!==void 0?{defaultActiveSeconds:d}:{},graceSteps:$t(i.graceSteps,"goal.budget.graceSteps",he.budget.graceSteps,t,{min:0,max:aa.budget.graceSteps})},breaker:{repeatedReplyLimit:$t(r.repeatedReplyLimit,"goal.breaker.repeatedReplyLimit",he.breaker.repeatedReplyLimit,t,{min:1})},verifier:{repeatedNotMetLimit:$t(o.repeatedNotMetLimit,"goal.verifier.repeatedNotMetLimit",he.verifier.repeatedNotMetLimit,t,{min:1}),evidence:sp(o.evidence,"goal.verifier.evidence",cp,he.verifier.evidence,t)},evaluator:{modelPolicy:sp(s.modelPolicy,"goal.evaluator.modelPolicy",up,he.evaluator.modelPolicy,t),maxTokens:$t(s.maxTokens,"goal.evaluator.maxTokens",he.evaluator.maxTokens,t,{min:1}),timeoutSeconds:$t(s.timeoutSeconds,"goal.evaluator.timeoutSeconds",he.evaluator.timeoutSeconds,t,{min:1}),maxRetries:$t(s.maxRetries,"goal.evaluator.maxRetries",he.evaluator.maxRetries,t,{min:0,max:aa.evaluator.maxRetries})},...Object.keys(g).length>0?{subagent:g}:{}},warnings:t}}function Bt(e,t,n){return e===void 0?{}:e===null||typeof e!="object"||Array.isArray(e)?(n.push(We(t,"expected an object; using defaults")),{}):e}function qt(e,t,n,i){for(let r of Object.keys(e))i.includes(r)||n.push(We(`${t}.${r}`,"unknown key ignored"))}function $t(e,t,n,i,r){return e==null?n:!Number.isInteger(e)||e<r.min?(i.push(We(t,`expected an integer >= ${r.min}; using default`)),n):r.max!=null&&e>r.max?(i.push(We(t,`exceeds maximum ${r.max}; clamped`)),r.max):e}function ut(e,t,n,i){if(e!=null){if(!Number.isInteger(e)||e<i.min){n.push(We(t,`expected an integer >= ${i.min}; ignored`));return}return i.max!=null&&e>i.max?(n.push(We(t,`exceeds maximum ${i.max}; clamped`)),i.max):e}}function sp(e,t,n,i,r){return e==null?i:typeof e!="string"||!n.includes(e)?(r.push(We(t,`expected one of: ${n.join(", ")}; using default`)),i):e}function ap(e,t,n,i){if(e!=null){if(typeof e!="string"||!n.includes(e)){i.push(We(t,`expected one of: ${n.join(", ")}; ignored`));return}return e}}function We(e,t){return`Invalid goal config at ${e}: ${t}`}var Ae={enabled:!0,maxInlineKiB:64,mcpDetailsMaxInlineKiB:32,watermarkKiB:256,minSavingsKiB:256,minCandidateKiB:2,keepRecentRounds:5},bA=Math.floor(Number.MAX_SAFE_INTEGER/1024);function ca(e){let t=vA(e)?e:{};return{enabled:typeof t.enabled=="boolean"?t.enabled:Ae.enabled,maxInlineKiB:Mn(t.maxInlineKiB,Ae.maxInlineKiB),mcpDetailsMaxInlineKiB:Mn(t.mcpDetailsMaxInlineKiB,Ae.mcpDetailsMaxInlineKiB),watermarkKiB:Mn(t.watermarkKiB,Ae.watermarkKiB),minSavingsKiB:Mn(t.minSavingsKiB,Ae.minSavingsKiB),minCandidateKiB:Mn(t.minCandidateKiB,Ae.minCandidateKiB),keepRecentRounds:SA(t.keepRecentRounds,Ae.keepRecentRounds)}}function Mn(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=bA?e:t}function SA(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:t}function vA(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Nn={};function ua(e){if(e==null||typeof e!="object"||Array.isArray(e))return{...Nn};let t=Reflect.get(e,"chromePath");return typeof t!="string"||!t.trim()?{...Nn}:{chromePath:t.trim()}}import{isIP as AA}from"node:net";function pp(e){return{enabled:!1,filesystemMode:"full_access"}}function mp(e){return!e.enabled||e.filesystemMode==="full_access"?{enabled:!1,filesystemMode:"full_access"}:{...e}}function da(e){let t=pp(e);return{enabled:t.enabled,filesystem:{policy:{mode:t.filesystemMode},denyRead:[],denyWrite:[]},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:"open"}}var pa=da(process.platform),wA=new Set(["read_only","workspace_write","delete_guard","full_access"]),_A=new Set(["deny","allow_all"]);function ma(e,t=process.platform){let n=da(t);if(e===void 0)return n;let i=Pn(e,"sandbox",["enabled","filesystem","network","localAccess"]),r=i.filesystem===void 0?{}:Pn(i.filesystem,"sandbox.filesystem",["policy","denyRead","denyWrite","allowGitConfig"]),o=r.policy===void 0?{}:Pn(r.policy,"sandbox.filesystem.policy",["mode"]),s=i.network===void 0?{}:Pn(i.network,"sandbox.network",["policy","deniedDomains"]),a=s.policy===void 0?{}:Pn(s.policy,"sandbox.network.policy",["mode"]),l=i.enabled===void 0?n.enabled:EA(i.enabled,"sandbox.enabled"),c=o.mode??(l?"delete_guard":"full_access");if(typeof c!="string"||!wA.has(c))throw new Error(`Invalid sandbox.filesystem.policy.mode "${String(c)}"`);let u=a.mode??n.network.policy.mode;if(typeof u!="string"||!_A.has(u))throw new Error(`Invalid sandbox.network.policy.mode "${String(u)}"`);let f=s.deniedDomains===void 0?[...n.network.deniedDomains]:fa(s.deniedDomains,"sandbox.network.deniedDomains");for(let p of f)xA(p);let d=mp({enabled:l,filesystemMode:c});return{enabled:d.enabled,filesystem:{policy:{mode:d.filesystemMode},denyRead:r.denyRead===void 0?[...n.filesystem.denyRead]:fa(r.denyRead,"sandbox.filesystem.denyRead"),denyWrite:r.denyWrite===void 0?[...n.filesystem.denyWrite]:fa(r.denyWrite,"sandbox.filesystem.denyWrite")},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:i.localAccess===void 0?n.localAccess:i.localAccess==="open"||i.localAccess==="restricted"?i.localAccess:(()=>{throw new Error(`Invalid sandbox.localAccess "${String(i.localAccess)}"`)})()}}function Pn(e,t,n){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid ${t}: expected object`);let i=e,r=Object.keys(i).find(o=>!n.includes(o));if(r)throw new Error(`Unknown ${t}.${r}`);return i}function EA(e,t){if(typeof e!="boolean")throw new Error(`Invalid ${t}: expected boolean`);return e}function fa(e,t){if(!Array.isArray(e)||e.some(n=>typeof n!="string"))throw new Error(`Invalid ${t}: expected string array`);return[...e]}function xA(e){let t=()=>{throw new Error(`Invalid sandbox.network.deniedDomains entry "${e}"`)},n=e.match(/^\[([^\]]+)\](?::(.+))?$/);if(n){AA(n[1]??"")!==6&&t(),hp(n[2],e);return}(e.match(/:/g)??[]).length>1&&t();let i=e.lastIndexOf(":"),r=i>-1?e.slice(0,i):e,o=i>-1?e.slice(i+1):void 0;hp(o,e),r!=="*"&&(kA(r)||t())}function kA(e){if(e.includes("://")||e.includes("/")||e.includes(":"))return!1;if(e==="localhost")return!0;if(e.startsWith("*.")){let n=e.slice(2).split(".");return n.length>=2&&n.every(i=>i.length>0)}return e.includes("*")?!1:e.includes(".")&&!e.startsWith(".")&&!e.endsWith(".")}function hp(e,t){if(e===void 0)return;let n=Number(e);if(!/^[1-9][0-9]{0,4}$/.test(e)||!Number.isInteger(n)||n>65535)throw new Error(`Invalid sandbox.network.deniedDomains entry "${t}"`)}var fr={maxConcurrentPerSession:4};function ha(e){let n=(e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}).maxConcurrentPerSession;return{maxConcurrentPerSession:typeof n=="number"&&Number.isSafeInteger(n)&&n>0?n:fr.maxConcurrentPerSession}}function yp(e,t){return t.length===0?!1:t.includes("*")?!0:t.includes(e)}function IA(){return process.env.__MAVIS_ALLOW_LEGACY_RUNTIME_ENV==="1"}var gp={dev:"test",test:"test",staging:"staging",prod:"prod"};function LA(e){return e==="cn"||e==="en"}function Ep(e){return e==="test"||e==="prod"||e==="dev"||e==="staging"}function xp(){let e=process.env.MAVIS_REGION;if(LA(e))return e;if(pr()){let t=process.env.NEXT_PUBLIC_LOCALE;if(t==="zh")return"cn";if(t==="en")return"en"}return"en"}function Te(){let e=process.env.MAVIS_BUILD_ENV;if(Ep(e))return e;if(pr()){let t=process.env.NEXT_PUBLIC_BUILD_ENV,n=t&&Object.prototype.hasOwnProperty.call(gp,t)?gp[t]:void 0;if(n)return n}return"dev"}function dr(){if(Cp("managed"))return!0;let e=process.env.__MAVIS_RUNTIME_MANAGED;return e==="1"?!0:e==="0"?!1:!!(pr()||Te()==="prod"||Te()==="staging")}function pr(){let e=process.versions;return process.env.ELECTRON_RUN_AS_NODE==="1"||typeof e.electron=="string"}function mr(){return`${xp()}-${Te()}`}var Ce={none:0,test:1,internal:2,online:3},MA={internal:"internal",inside:"online"};function NA(e){for(let[t,n]of Object.entries(e)){if(Ce[n.defaultVisibility]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultVisibility (${n.defaultVisibility}) must not exceed configurableVisibility (${n.configurableVisibility})`);for(let i of n.defaultBuildVariants??[]){let r=MA[i];if(Ce[r]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultBuildVariant (${i}) must not exceed configurableVisibility (${n.configurableVisibility})`)}for(let i of n.defaultBuildEnvironments??[])if(Ce[i==="prod"?"online":"test"]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultBuildEnvironment (${i}) must not exceed configurableVisibility (${n.configurableVisibility})`)}}var Dn={autoMemory:{defaultVisibility:"online",configurableVisibility:"online"},skillEvolve:{defaultVisibility:"test",configurableVisibility:"online"},skillEvolveBuiltinMr:{defaultVisibility:"none",configurableVisibility:"test"},skillProposal:{defaultVisibility:"test",configurableVisibility:"online"},browserBridge:{defaultVisibility:"test",configurableVisibility:"online"},filePanelBrowser:{defaultVisibility:"online",configurableVisibility:"online"},filePanelBrowserMultiTab:{defaultVisibility:"online",configurableVisibility:"online"},browserUseTooling:{defaultVisibility:"online",configurableVisibility:"online"},browserUseAutoOpenPanel:{defaultVisibility:"online",configurableVisibility:"online"},browserAgentCursor:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanMode:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanModeAgentEntry:{defaultVisibility:"none",configurableVisibility:"online"},peek:{defaultVisibility:"test",configurableVisibility:"test"},keepAlive:{defaultVisibility:"test",configurableVisibility:"test"},promptOverride:{defaultVisibility:"test",configurableVisibility:"test"},asr:{defaultVisibility:"online",configurableVisibility:"online"},taskHistoryProjectGrouping:{defaultVisibility:"online",configurableVisibility:"online"},threadGoal:{defaultVisibility:"online",configurableVisibility:"online"},mcodeTools:{defaultVisibility:"none",defaultBuildEnvironments:["dev","test","staging","prod"],defaultPlatforms:["darwin","linux","win32"],configurableVisibility:"online"},codexOAuth:{defaultVisibility:"none",defaultBuildEnvironments:["dev"],defaultBuildVariants:["internal"],configurableVisibility:"online"}};NA(Dn);function PA(e){return(e.buildEnv??Te())!=="prod"?"test":e.internalBuild===!0?"internal":"online"}function RA(e,t){let n=e.defaultBuildVariants;return n?t.internalBuild===!0&&n.includes("internal")||t.insideBuild===!0&&n.includes("inside"):!1}function DA(e,t){let n=t.defaultBuildEnvironment??t.buildEnv??Sa();return e.defaultBuildEnvironments?.includes(n)===!0}function Sa(){let e=pr()?process.env.NEXT_PUBLIC_BUILD_ENV:void 0;return Ep(e)?e:Te()}function bp(e,t){return e.defaultPlatforms?.includes(t.platform??process.platform)!==!1}function va(e,t,n={}){let i=Dn[e],r=Ce[PA(n)],o=n.defaultBuildEnvironment??n.buildEnv??Sa();return e==="mcodeTools"&&o==="dev"&&n.mcodeToolsDevMode==="published"&&bp(i,n)?!0:t===!1?!1:t===!0?r<=Ce[i.configurableVisibility]:bp(i,n)?DA(i,n)||RA(i,n)?!0:r<=Ce[i.defaultVisibility]:!1}function FA(e){return Dn[e].configurableVisibility==="online"}function Aa(e=process.env){return e.__MAVIS_BUILD_INTERNAL==="true"}function BA(e=process.env){return e.__MAVIS_BUILD_INSIDE==="true"}var qA={APP_DIR:".minimax",ENV_PREFIX:"minimax",CLI_NAME:"minimax"},kp="__MAVIS_RUNTIME";function hr(e){return IA()?process.env[`${kp}_${e}`]:void 0}function yr(e){let t=`--${e}`;for(let n=2;n<process.argv.length;n++){let i=process.argv[n];if(i===t)return process.argv[n+1];if(i?.startsWith(`${t}=`))return i.slice(t.length+1)}}function Cp(e){let t=`--${e}`;return process.argv.slice(2).some(n=>n===t||n.startsWith(`${t}=`))}var jt=5321,ga=5001,ya=65535,Op=500,wa=2,$A=Op*wa,Tp=$A+wa,Sp=1,jA=new Set(["agent-archon","mavis"]),vp=(()=>{let t=new Uint32Array(256);for(let n=0;n<256;n++){let i=n<<24;for(let r=0;r<8;r++)i=(i&2147483648)!==0?79764919^i<<1:i<<1,i>>>=0;t[n]=i>>>0}return t})();function UA(e){let t=Buffer.from(`${e}
|
|
191
|
-
`,"utf-8"),n=0;for(let r of t)n=(
|
|
192
|
-
`)){let n=/file:\/\/[^)\s]+/u.exec(t)?.[0]?.replace(/:\d+:\d+$/u,"");if(n)try{return oe.dirname(TA(n))}catch{}let i=/\(?((?:\/|[A-Za-z]:\\)[^()]+?\.(?:cjs|mjs|js|ts)):\d+:\d+\)?/u.exec(t)?.[1];if(i)return oe.dirname(i)}}function HA(){let e=br();return e||(gr()?dt().profile:null)}function _a(){let e=br();if(YA())return ba();if(gr()){let n=dt();if(n.autoDetected&&n.profile)return Ye({profile:n.profile})}let t=ba();return t||(e?Ye({profile:e}):Ye())}function Ut(){return oe.join(_a(),"config.yaml")}var wp={support_files_api:!0,files_api_upload_endpoint:"/v1/files/upload",max_image_bytes_inline:10485760,max_video_bytes_inline:52428800,max_request_body_bytes:67108864,max_attachments_count:4},Np={"MiniMax-M3":{name:"MiniMax-M3",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text","image","video"],output:["text"]},limit:{context:512e3,output:128e3},contextWindowOptions:[512e3,1e6],contextWindowOptionHints:{1e6:"higher_usage"},options:{reasoningSummary:"auto"},thinking_config:{mode:"switchable",default_value:"true"},variants:{"none-thinking":{thinking:{type:"disabled"}},thinking:{thinking:{type:"adaptive"}}},capabilities:wp},"MiniMax-M3.1-Flash-Preview":{name:"M3.1-Flash-Preview",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text","image","video"],output:["text"]},limit:{context:512e3,output:128e3},contextWindowOptions:[512e3,1e6],contextWindowOptionHints:{1e6:"higher_usage"},options:{reasoningSummary:"auto"},thinking:{effortOptions:["default","low","medium","high","xhigh","max"],defaultEffort:"default"},thinking_config:{mode:"forced_on"},variants:{"none-thinking":{thinking:{type:"disabled"}},thinking:{thinking:{type:"adaptive"}}},capabilities:wp},"MiniMax-M2.7-highspeed":{name:"MiniMax-M2.7-highspeed",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text"],output:["text"]},limit:{context:2e5,output:128e3}},"MiniMax-M2.7":{name:"MiniMax-M2.7",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text"],output:["text"]},limit:{context:2e5,output:128e3}}},Kt=Np,Sr={"cn-test":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","cn-dev":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","cn-staging":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","en-test":"https://agent.minimax.io/mavis/api/v1/llm/v1","en-dev":"https://agent.minimax.io/mavis/api/v1/llm/v1","en-staging":"https://agent.minimax.io/mavis/api/v1/llm/v1","cn-prod":"https://agent.minimax.cn/mavis/api/v1/llm/v1","en-prod":"https://agent.minimax.io/mavis/api/v1/llm/v1"},Pp=["https://agent.minimaxi.com/mavis/api/v1/llm/v1"],JA=new Set([...Object.values(Sr),...Pp]),XA=new Set([...Object.values(Sr),...Pp].map(e=>new URL(e).origin));function Rp(e){if(JA.has(e))return!0;try{let t=new URL(e);return!t.username&&!t.password&&XA.has(t.origin)}catch{return!1}}function Dp(){return Te()==="test"}function QA(){return!Dp()}function zA(e){if(!dr()||!Oe.existsSync(e))return;let t=Fp(e),{provider:n}=t;if(n==null||typeof n!="object"||Array.isArray(n))return;let{minimax:i}=n;if(i==null||typeof i!="object"||Array.isArray(i))return;let{options:r}=i;if(r==null||typeof r!="object"||Array.isArray(r))return;let o=r.baseURL;if(typeof o!="string")return;let s=Sr[mr()];if(o===s||!Rp(o))return;let a=Oe.readFileSync(e);r.baseURL=s;try{let l=a.toString("utf-8");it(e,Ln(l,er(l),t))}catch(l){let c=!1;try{c=Oe.readFileSync(e).equals(a)}catch{}if(!c)throw l;console.warn("[config] managed preset baseURL sync skipped; config file unchanged, using runtime provider settings")}}function He(e){return{provider:{minimax:{name:"MiniMax",npm:"@ai-sdk/anthropic",options:{authMode:"managed-login",apiKey:"sk-xxx",baseURL:Sr[e]},models:Np}},defaultModel:"minimax/MiniMax-M3"}}var Ea={"cn-test":He("cn-test"),"cn-dev":He("cn-dev"),"cn-staging":He("cn-staging"),"cn-prod":He("cn-prod"),"en-test":He("en-test"),"en-dev":He("en-dev"),"en-staging":He("en-staging"),"en-prod":He("en-prod")},J={logLevel:"info",devPort:ga,permissionMode:"auto",sseErrorPush:{history:!0,stream:!0},beta:Object.fromEntries(Object.keys(Dn).map(e=>[e,va(e,void 0,{buildEnv:"dev"})])),agents:{default:{}},memory:{enabled:!0,proactive:!1,dailyDigest:{enabled:!1},v2:{...tr}},subagent:{...fr},skillEvolve:{enabled:!0,inSession:{N:20,minIntervalSeconds:30,maxPendingPerSession:1},signalCooldownHours:24,minConfidence:.7,excludeAgents:["skill-editor"],disableModelPrefixes:["MiniMax-M2"],builtinMrEnabled:!1,sourceRepo:void 0,proposal:{enabled:!1,eligibleAgents:["mavis"],minMessageCount:40,skipPassiveSessionEnd:!0},lifecycle:{staleThresholdDays:15,archiveThresholdDays:30}},sessionRotate:{enabled:!0,activeSessionLookbackHours:12},agentStop:{debounceMs:500,maxActiveSpanMs:1800*1e3},asr:{...sr},skills:lr,askUser:{...oa},dataContribution:{...Ge},sessionTitle:{enabled:!0},cli:{spawn:{enabled:!1}},browser:{...Nn},tui:{},opencode:{xdg:{dataIsolation:!1,startupImport:"off"},keepAlive:{enabled:!1,maxProcesses:5,maxLifetimeMs:288e5,agents:["mavis","main","verifier","code-reviewer"]},spawnConcurrency:3},contextManagement:{disableSystemReminderModels:[],cuMaxScreenshotsInContext:2},runawayGuard:{enabled:!0},toolResultCompaction:{...Ae},agentRuntime:{defaultFramework:Dt},logRetentionDays:3,review:{mode:"subagent",turnDiffCard:"concise",modeSource:"default"},goal:structuredClone(he),sandbox:structuredClone(pa),goalWarnings:[]};function ZA(){let e=Ut(),t=oe.dirname(e);if(Oe.existsSync(t)||Oe.mkdirSync(t,{recursive:!0}),Oe.existsSync(e)){ka(e);return}if(!dr()){let r=Ye({homeDir:CA.homedir()}),o=oe.join(r,"config.yaml");e!==o&&Oe.existsSync(o)&&(_t(o),it(e,Oe.readFileSync(o),!0));return}let n=Ea[mr()],i=W.dump({logLevel:J.logLevel,provider:xa?n.provider:void 0,defaultModel:n.defaultModel,dataContribution:{enabled:Ge.enabled},memory:{enabled:!1}});it(e,i,!0)}function Fp(e=Ut()){return er(ew(e))}function ew(e=Ut()){try{return Oe.readFileSync(e,"utf-8")}catch{return""}}var Rn=null;function tw(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e;return{branchFinish:typeof t.branchFinish=="boolean"?t.branchFinish:!1}}var Bp={isManagedRuntime:dr,shouldEnforceManagedProviderProtection:QA,getManagedPreset:()=>Ea[mr()],isManagedPresetBaseUrl:Rp},qp=!0,xa=!0;function nw(e){qp=e}function iw(e){xa=e}function ka(e){_t(e),Nd(e),qp&&Ld(e,Bp),xa&&zA(e)}function vr(){Rn=null}function Ar(){if(Rn)return Rn;ZA();let e=Fp();return Rn=Ca(e,_a()),Rn}function Ca(e,t){let n=e.sseErrorPush,i=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:void 0,r=typeof e.devPort=="number"?e.devPort:J.devPort;if(gr()&&!Mp()){let c=dt();c.autoDetected&&(r=c.uiPort)}let o=la(e.goal),s=Md({provider:e.provider!=null&&typeof e.provider=="object"&&!Array.isArray(e.provider)?Cd(e.provider):{},defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0},Bp),a=js(e.minimaxModelContextLimits),l=rw(e);return{logLevel:typeof e.logLevel=="string"?e.logLevel:J.logLevel,devPort:r,...s,provider:xd(s.provider,a),defaultModelVariant:typeof e.defaultModelVariant=="string"?e.defaultModelVariant:void 0,defaultModelThinking:e.defaultModelThinking&&typeof e.defaultModelThinking=="object"&&typeof e.defaultModelThinking.effort=="string"?{effort:e.defaultModelThinking.effort}:void 0,defaultModelContextWindow:Number.isSafeInteger(e.defaultModelContextWindow)&&Number(e.defaultModelContextWindow)>0&&Number(e.defaultModelContextWindow)<=2147483647?Number(e.defaultModelContextWindow):void 0,minimax_api:Ed(e.minimax_api),minimaxModelContextLimits:a,custom_provider:kd(e.custom_provider),minimaxModelSource:typeof e.minimaxModelSource=="string"&&(e.minimaxModelSource==="token_plan"||e.minimaxModelSource==="minimax_api_key")?e.minimaxModelSource:void 0,nexus:e.nexus!=null&&typeof e.nexus=="object"&&!Array.isArray(e.nexus)?(()=>{let c={};typeof Reflect.get(e.nexus,"enabled")=="boolean"&&(c.enabled=Reflect.get(e.nexus,"enabled"));let u=Reflect.get(e.nexus,"model");return u!=null&&typeof u=="object"&&!Array.isArray(u)&&typeof Reflect.get(u,"providerID")=="string"&&typeof Reflect.get(u,"modelID")=="string"&&(c.model={providerID:Reflect.get(u,"providerID"),modelID:Reflect.get(u,"modelID"),...typeof Reflect.get(u,"variant")=="string"?{variant:Reflect.get(u,"variant")}:{}}),Object.keys(c).length>0?c:void 0})():void 0,defaultLightModel:typeof e.defaultLightModel=="string"?e.defaultLightModel:void 0,permissionMode:typeof e.permissionMode=="string"&&["default","bypassPermissions","auto","off"].includes(e.permissionMode)?e.permissionMode:J.permissionMode,permission:Bd(e),sseErrorPush:{history:typeof i?.history=="boolean"?i.history:J.sseErrorPush.history,stream:typeof i?.stream=="boolean"?i.stream:J.sseErrorPush.stream},notifications:tw(e.notifications),dataDir:t,agentsDir:oe.join(t,"agents"),sessionsDir:oe.join(t,"sessions"),memoryDir:oe.join(t,"memory"),skillsDir:oe.join(t,"skills"),builtinSkillsDir:oe.join(t,".builtin-skills"),logsDir:oe.join(t,"logs"),pluginsDir:oe.join(t,"plugins"),plansDir:oe.join(t,"plans"),harnessesDir:oe.join(t,"harnesses"),subAgentsDir:oe.join(t,"subagents"),beta:l,agents:ra(e.agents),memory:vd(e,J.memory),subagent:ha(e.subagent),skillEvolve:aw(e,l),sessionRotate:lw(e),agentStop:cw(e),asr:Fd(e),skills:Us(e),askUser:rp(e,J.askUser),dataContribution:sa(e,J.dataContribution),sessionTitle:uw(e),cli:fw(e),browser:ua(e.browser),tui:Ad(e),opencode:Rd(e,J.opencode),contextManagement:dw(e),runawayGuard:no(e.runawayGuard),toolResultCompaction:ca(e.toolResultCompaction),agentRuntime:Ks(e.agentRuntime),logRetentionDays:pw(e),contentReview:mw(e),mcpToolSearch:hw(e),review:Pd(e.review,J.review),promptConfig:$p(e.promptConfig),goal:o.config,goalWarnings:o.warnings,sandbox:ma(e.sandbox)}}function rw(e){let t=e.beta!=null&&typeof e.beta=="object"&&!Array.isArray(e.beta)?e.beta:{},n={buildEnv:Te(),defaultBuildEnvironment:Sa(),internalBuild:Aa(),insideBuild:BA(),mcodeToolsDevMode:process.env.MAVIS_DEV_MCODE_TOOLS_MODE==="published"?"published":void 0},i={};for(let r of Object.keys(Dn))i[r]=va(r,t[r],n);return i}function ow(e){let t=e.provider;if(t==null||typeof t!="object"||Array.isArray(t))return[];let n=[];for(let i of Object.values(t)){if(i==null||typeof i!="object"||Array.isArray(i))continue;let{models:r}=i;r==null||typeof r!="object"||Array.isArray(r)||n.push(...Object.keys(r))}return n}function sw(e,t){if(t.length===0)return!0;let n=ow(e);if(n.length===0)return!1;let i=t.map(r=>r.toLowerCase());return!n.every(r=>i.some(o=>r.toLowerCase().startsWith(o)))}function _p(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function aw(e,t){let n=J.skillEvolve,i=e.skillEvolve,o=i!=null&&typeof i=="object"&&!Array.isArray(i)?i:{},s=o.inSession,{inSession:a}=n;if(s!=null&&typeof s=="object"&&!Array.isArray(s)){let E=s;a={N:typeof E.N=="number"&&E.N>0?E.N:n.inSession.N,minIntervalSeconds:typeof E.minIntervalSeconds=="number"&&E.minIntervalSeconds>=0?E.minIntervalSeconds:n.inSession.minIntervalSeconds,maxPendingPerSession:typeof E.maxPendingPerSession=="number"&&E.maxPendingPerSession>=1?E.maxPendingPerSession:n.inSession.maxPendingPerSession}}let l=o.excludeAgents,c=Array.isArray(l)&&l.every(E=>typeof E=="string")?l:n.excludeAgents,u=Array.isArray(o.disableModelPrefixes)&&o.disableModelPrefixes.every(E=>typeof E=="string")?o.disableModelPrefixes:n.disableModelPrefixes,f=t.skillEvolve?typeof o.enabled=="boolean"?o.enabled:sw(e,u):!1,d=f&&t.skillEvolveBuiltinMr?typeof o.builtinMrEnabled=="boolean"?o.builtinMrEnabled:n.builtinMrEnabled:!1,p=o.sourceRepo,y=typeof p=="string"&&p.trim().length>0?p.trim():n.sourceRepo,m=o.proposal,h=n.proposal,g=m!=null&&typeof m=="object"&&!Array.isArray(m)?m:{},b=Array.isArray(g.eligibleAgents)&&g.eligibleAgents.every(E=>typeof E=="string")?g.eligibleAgents:h.eligibleAgents,v=typeof g.minMessageCount=="number"&&g.minMessageCount>=1?Math.floor(g.minMessageCount):h.minMessageCount,x=typeof g.skipPassiveSessionEnd=="boolean"?g.skipPassiveSessionEnd:h.skipPassiveSessionEnd,k=typeof g.enabled=="boolean"?g.enabled:null,C=f&&t.skillProposal?k??!0:!1,L=o.lifecycle,w=L&&typeof L=="object"&&!Array.isArray(L)?L:{},A=_p(w.staleThresholdDays,n.lifecycle.staleThresholdDays),O=_p(w.archiveThresholdDays,n.lifecycle.archiveThresholdDays);if(!(A<O))throw new Error(`Invalid skillEvolve.lifecycle config: staleThresholdDays (${A}) must be strictly less than archiveThresholdDays (${O}).`);return{enabled:f,inSession:a,signalCooldownHours:typeof o.signalCooldownHours=="number"&&o.signalCooldownHours>0?o.signalCooldownHours:n.signalCooldownHours,minConfidence:typeof o.minConfidence=="number"&&o.minConfidence>=0&&o.minConfidence<=1?o.minConfidence:n.minConfidence,scannerModel:typeof o.scannerModel=="string"?o.scannerModel:void 0,excludeAgents:c,disableModelPrefixes:u,builtinMrEnabled:d,sourceRepo:y,proposal:{enabled:C,eligibleAgents:b,minMessageCount:v,skipPassiveSessionEnd:x},lifecycle:{staleThresholdDays:A,archiveThresholdDays:O}}}function lw(e){let t=J.sessionRotate,n=e.sessionRotate;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.activeSessionLookbackHours;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled,activeSessionLookbackHours:typeof r=="number"&&Number.isFinite(r)&&r>0?r:t.activeSessionLookbackHours}}function cw(e){let t=J.agentStop,n=e.agentStop;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.debounceMs,o=i.maxActiveSpanMs;return{debounceMs:typeof r=="number"&&Number.isFinite(r)&&r>=0?r:t.debounceMs,maxActiveSpanMs:typeof o=="number"&&Number.isFinite(o)&&o>=0?o:t.maxActiveSpanMs}}function $p(e){let t=Te()==="prod"&&!Aa();if(e==null||typeof e!="object"||Array.isArray(e))return{autoUpdate:t};let n=e.autoUpdate;return{autoUpdate:typeof n=="boolean"?n:t}}function uw(e){let t=J.sessionTitle,n=e.sessionTitle;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled}}function fw(e){let t=J.cli,n=e.cli;if(n==null||typeof n!="object"||Array.isArray(n))return{spawn:{...t.spawn}};let i=n.spawn;if(i==null||typeof i!="object"||Array.isArray(i))return{spawn:{...t.spawn}};let r=i;return{spawn:{enabled:typeof r.enabled=="boolean"?r.enabled:t.spawn.enabled}}}function dw(e){let t=J.contextManagement,n=e.contextManagement;if(n==null||typeof n!="object"||Array.isArray(n))return{disableSystemReminderModels:[...t.disableSystemReminderModels],cuMaxScreenshotsInContext:t.cuMaxScreenshotsInContext};let i=n,r=i.disableSystemReminderModels,o=Array.isArray(r)&&r.every(l=>typeof l=="string"&&l.length>0)?r:[...t.disableSystemReminderModels],s=i.cuMaxScreenshotsInContext,a=typeof s=="number"&&Number.isFinite(s)&&s>=0?Math.floor(s):t.cuMaxScreenshotsInContext;return{disableSystemReminderModels:o,cuMaxScreenshotsInContext:a}}function pw(e){let t=e.logRetentionDays;return typeof t=="number"&&t>=1&&Number.isFinite(t)?Math.floor(t):J.logRetentionDays}function mw(e){let t=e.contentReview;if(t==null||typeof t!="object"||Array.isArray(t))return;let n={},i=Reflect.get(t,"enabled");typeof i=="boolean"&&(n.enabled=i);let r=Reflect.get(t,"testBaseURL");return typeof r=="string"&&r.trim()&&(n.testBaseURL=r.trim()),Object.keys(n).length>0?n:void 0}function hw(e){let t=e.mcpToolSearch;if(t==null||typeof t!="object"||Array.isArray(t))return;let n={},i=Reflect.get(t,"enabled");typeof i=="boolean"&&(n.enabled=i);let r=Reflect.get(t,"systemHint");typeof r=="boolean"&&(n.systemHint=r);let o=Reflect.get(t,"thresholdPct");typeof o=="number"&&(n.thresholdPct=o);let s=Reflect.get(t,"minDeferCount");typeof s=="number"&&(n.minDeferCount=s);let a=Reflect.get(t,"topKDefault");typeof a=="number"&&(n.topKDefault=a);let l=Reflect.get(t,"topKMax");typeof l=="number"&&(n.topKMax=l);let c=Reflect.get(t,"maxSchemaTextLen");typeof c=="number"&&(n.maxSchemaTextLen=c);let u=Reflect.get(t,"modelWhitelist");return Array.isArray(u)&&(n.modelWhitelist=u.filter(f=>typeof f=="string")),Object.keys(n).length>0?n:void 0}function jp(){let e=Lp();if(gr()&&!Mp()){let t=dt();if(t.autoDetected)return t.runtimePort}return e??jt}function yw(e=jp()){let t=e+Tp;if(t<=ya)return t;let n=e+Sp;if(n<=ya)return n;throw new Error(`Cannot allocate an OpenCode sidecar port for runtime port ${String(e)}; choose a runtime port <= ${String(ya-Sp)}.`)}var gw=["agent.minimaxi.com","agent.minimaxi.com","agent.minimax.io","agent.minimax.io","agent.minimax.io","agent.minimax.cn","agent.minimaxi.com"],bw=new Set(gw.map(e=>`https://${e}`));function Sw(e,t){return/^custom_provider:minimax-legacy(?:-\d+)?$/u.test(e)&&(!t||Oa(t))}function Oa(e){try{let t=new URL(e);return t.username||t.password?!1:bw.has(t.origin.toLowerCase())}catch{return!1}}function vw(e){if(!(e!=="managed-login"&&e!=="api-key"&&e!=="oauth"))return e}function Ta(e){let t=typeof e?.baseURL=="string"?e.baseURL.trim():"",n=t.length>0&&Oa(t),i=vw(e?.authMode),r=[];return typeof e?.authMode=="string"&&!i&&r.push(`Unknown provider authMode "${e.authMode}"; falling back to compatibility resolution.`),i?(i==="managed-login"&&t.length>0&&!n&&!e?.allowManagedBaseURLOverride&&r.push("Provider authMode is managed-login but baseURL is not a known managed MiniMax host."),{authMode:i,source:"explicit",managedBaseURL:n,warnings:r}):n?(r.push("Provider authMode is inferred from a managed MiniMax baseURL; set options.authMode: managed-login to make this explicit."),{authMode:"managed-login",source:"inferred-managed-base-url",managedBaseURL:n,warnings:r}):{authMode:"api-key",source:"default-api-key",managedBaseURL:n,warnings:r}}var Je="minimax",Vt="minimax_api",La="custom_provider:";function Aw(e,t){return e==="anthropic-messages"&&(t===Je||t===Vt)}function Ma(e,t){if(t===Vt)return"minimax_api_key";if(t.startsWith(La))return"custom_provider";if(t!==Je)return"configured_provider";if(e.minimaxModelSource==="minimax_api_key")return"minimax_api_key";let n=e.provider?.[t]?.options;return Ta({authMode:n?.authMode,baseURL:n?.baseURL}).authMode==="managed-login"?"managed_token_plan":"configured_provider"}function Up(e,t,n){switch(Ma(e,t)){case"managed_token_plan":return Ia(e.provider?.[t],!0);case"minimax_api_key":return Object.keys(Kt);case"custom_provider":{let r=e.custom_provider?.[t.slice(La.length)];return!r||r.enabled===!1?[]:Ia(r)}case"configured_provider":return Ia(e.provider?.[t])}}function ww(e){let t=Ma(e.config,e.providerId),n=e.modelId.trim();return n.length>0&&Up(e.config,e.providerId,e.preset).includes(n)?{available:!0,route:t}:{available:!1,route:t,code:e.source==="config_default"?"DEFAULT_MODEL_NOT_AVAILABLE_FOR_ROUTE":"MODEL_NOT_AVAILABLE_FOR_ROUTE",message:`Model "${e.providerId}/${e.modelId}" is not available for the "${t}" route (preset ${e.preset}).`}}function Ia(e,t=!1){let n=Object.entries(e?.models??{}).filter(([,s])=>s?.enabled!==!1).map(([s])=>s),i=e?.model_order;if(!t||!Array.isArray(i)||!i.every(s=>typeof s=="string"))return n;let r=new Set(n);return[...i.filter(s=>r.delete(s)),...n.filter(s=>r.has(s))]}var _w=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function Na(e){if(typeof e=="string")return _w.exec(e.trim())?.[1]}function Kp(e){let{field:t,provider:n,value:i}=e;if(i==null)return;if(typeof i!="string")throw new Error(`Provider "${n}": ${t} must be a string or a \`\${NAME}\` environment variable reference, received ${kw(i)}.`);let r=i.trim();if(!r)return;let o=Na(r);if(!o)return r;let s=(e.env??process.env)[o]?.trim();if(!s)throw new Error(`Provider "${n}": ${t} references environment variable "${o}", which is not set.`);return s}function Ew(e){if(!(typeof e.value=="string"&&e.value.trim().length>0))return{configured:!1};let n=xw(e.value)?"env":"plaintext";try{let i=Kp(e);return{configured:!0,source:n,...i?{secret:i}:{}}}catch{return{configured:!0,source:n}}}function xw(e){return Na(e)!==void 0}function kw(e){return Array.isArray(e)?"a list":`a ${typeof e}`}import{randomBytes as Cw}from"node:crypto";import pt,{readFileSync as Ow}from"node:fs";import{dirname as Vp,join as Tw}from"node:path";var Yp=xr(eo(),1);var Ra=384,wr=new Set(["__proto__","prototype","constructor"]),Iw=["minimax_api","custom_provider"];async function Lw(e){let t=e.trim();if(!t||t.includes(".")||wr.has(t))throw new ne("Invalid provider id");return Bn(async n=>(ye(n.provider)&&delete n.provider[t],{write:!0,value:void 0})).then(({config:n})=>({config:n}))}async function Mw(e){if(!ye(e)||!ye(e.models))throw new ne("Invalid managed MiniMax provider snapshot");return _r(e),Bn(async t=>(t.provider={...ye(t.provider)?t.provider:{},[Je]:structuredClone(e)},{write:!0,value:void 0})).then(({config:t})=>({config:t}))}var ne=class extends Error{name="LocalModelProviderConfigValidationError"},Fn=class extends Error{name="LocalModelProviderConfigWriteError";constructor(){super("Local runtime failed to update config file")}};async function Nw(e){return Bn(async(t,n)=>{let i={minimax_api:ye(t.minimax_api)?t.minimax_api:void 0,custom_provider:qw(ye(t.custom_provider)?t.custom_provider:void 0),minimaxModelSource:typeof t.minimaxModelSource=="string"?t.minimaxModelSource:void 0,defaultModel:typeof t.defaultModel=="string"?t.defaultModel:void 0,defaultModelVariant:typeof t.defaultModelVariant=="string"?t.defaultModelVariant:void 0};await e(i,n);for(let r of Iw){let o=i[r];if(o===void 0){delete t[r];continue}if(!ye(o))throw new ne(`Invalid BYOK config subtree "${r}"`);_r(o),t[r]=o}return Pa(t,"minimaxModelSource",i.minimaxModelSource),t.defaultModel!==i.defaultModel&&(delete t.defaultModelThinking,delete t.defaultModelContextWindow),Pa(t,"defaultModel",i.defaultModel),Pa(t,"defaultModelVariant",i.defaultModelVariant),{write:!0,value:void 0}}).then(({config:t})=>({config:t}))}async function Pw(e){let t=e.modelKey.trim();if(!t)throw new ne("Default model must not be empty");if(e.contextLimit!==void 0&&(!Number.isSafeInteger(e.contextLimit)||e.contextLimit<=0||e.contextLimit>2147483647))throw new ne("Invalid default context");if(e.thinking?.effort!==void 0&&(typeof e.thinking.effort!="string"||!e.thinking.effort.trim()))throw new ne("Invalid default effort");return Bn(async n=>(n.defaultModel=t,e.contextLimit===void 0?delete n.defaultModelContextWindow:n.defaultModelContextWindow=e.contextLimit,e.thinking?.effort===void 0?delete n.defaultModelThinking:n.defaultModelThinking={effort:e.thinking.effort},e.variant===void 0?delete n.defaultModelVariant:n.defaultModelVariant=e.variant,{write:!0,value:void 0})).then(({config:n})=>({config:n}))}async function Rw(e,t){let n=e.modelId.trim();if(e.providerId!==Je&&e.providerId!==Vt||!n||wr.has(n))throw new ne("Invalid MiniMax model context target");if(e.providerId===Vt&&!Kt[n]?.contextWindowOptions?.includes(e.contextLimit))throw new ne("Invalid MiniMax API context limit");let i=await Bn(async(r,o)=>{if((e.providerId===Je?o.provider?.[e.providerId]?.models?.[n]?.limit?.context:Dw(o,n))!==e.expectedContextLimit)return{write:!1,value:!1};if(!await t(o))return{write:!1,value:!1};let a=e.providerId===Je?["minimaxModelContextLimits",n]:["minimax_api","modelContextLimits",n];return $w(r,a,e.contextLimit),{write:!0,value:!0}});return{config:i.config,updated:i.value}}function Dw(e,t){let n=Kt[t],i=e.minimax_api?.modelContextLimits?.[t];return i!==void 0&&n?.contextWindowOptions?.includes(i)?i:n?.limit?.context}async function Bn(e){let t=Ut(),n;try{await pt.promises.mkdir(Vp(t),{recursive:!0}),await pt.promises.writeFile(t,"",{flag:"a",mode:Ra}),await pt.promises.chmod(t,Ra),n=await Yp.default.lock(t,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}});let i=Bw(t),r=structuredClone(i);vr();let o=await e(r,Ar());return o.write&&(_r(r),await Fw(t,Ln(Ow(t,"utf-8"),i,r)),vr()),{config:Ar(),value:o.value}}catch(i){throw i instanceof ne||i instanceof Fn?i:new Fn}finally{await n?.().catch(()=>{})}}async function Fw(e,t){let n=Tw(Vp(e),`.config-tmp-${Cw(6).toString("hex")}`),i=!1;try{let r=Ra,o=await pt.promises.open(n,"wx",r);i=!0;try{await o.writeFile(t,"utf-8"),await o.chmod(r)}finally{await o.close()}await pt.promises.rename(n,e)}catch{throw i&&await pt.promises.unlink(n).catch(()=>{}),new Fn}}function Bw(e){let t=pt.readFileSync(e,"utf-8"),n;try{n=W.load(t)}catch{throw new ne("Invalid config.yaml: unable to parse YAML")}if(n==null)return{};if(!ye(n)||Object.getPrototypeOf(n)!==Object.prototype)throw new ne("Invalid config.yaml: expected a YAML mapping");return n}function qw(e){if(e)return Object.fromEntries(Object.entries(e).filter(([,t])=>ye(t)))}function Pa(e,t,n){n===void 0?delete e[t]:e[t]=n}function $w(e,t,n){let i=t.at(-1);if(!i)throw new ne("Invalid config path");let r=e;for(let o of t.slice(0,-1)){if(!o||wr.has(o))throw new ne("Invalid config path");let s=r[o];if(ye(s))r=s;else{let a={};r[o]=a,r=a}}r[i]=n}function _r(e){for(let[t,n]of Object.entries(e)){if(!t||wr.has(t))throw new ne(`Local runtime cannot update config field segment "${t}"`);ye(n)&&_r(n)}}function ye(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Xw(e){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let i=JSON.parse(t),r=typeof i.pid=="number"?i.pid:parseInt(String(i.pid),10);if(isNaN(r)||r<=0)return null;let o=Qw(i.owner)?i.owner:"unknown",s=zw(i.startedAt);return{pid:r,owner:o,...s!==void 0?{startedAt:s}:{},...typeof i.mode=="string"?{mode:i.mode}:{},...typeof i.startupToken=="string"?{startupToken:i.startupToken}:{}}}catch{return null}let n=parseInt(t,10);return isNaN(n)||n<=0?null:{pid:n,owner:"unknown"}}function Qw(e){return e==="electron"||e==="cli"||e==="unknown"}function zw(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="string")return;let t=new Date(e).getTime();return Number.isFinite(t)?t:void 0}function Zw(e,t){let n={pid:e,owner:t,startedAt:Date.now()};return JSON.stringify(n)}function e_(){let e=process.argv.slice(2);for(let t=0;t<e.length;t++){let n=e[t],i=n==="--owner"?e[t+1]:n?.startsWith("--owner=")?n.slice(8):void 0;if(i==="electron")return"electron";if(i==="service"||i==="cli")return"cli"}return"cli"}import Xe from"node:fs";import t_ from"node:path";var Gp="local-runtime.auth.json";function we(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function Da(e){return e?{...we(e.accessToken)?{accessToken:we(e.accessToken)}:{},...we(e.realUserID)?{realUserID:we(e.realUserID)}:{},...we(e.userEmail)?{userEmail:we(e.userEmail)}:{},...we(e.userName)?{userName:we(e.userName)}:{},...we(e.subUserName)?{subUserName:we(e.subUserName)}:{}}:{}}function Er(e){return t_.join(e,Gp)}function n_(e){try{let t=Xe.readFileSync(Er(e),"utf-8"),n=JSON.parse(t);if(n.version!==1||!n.auth||typeof n.auth!="object")return;let i=Da(n.auth);return i.accessToken?i:void 0}catch{return}}function i_(e,t,n={}){let i=Er(e),r=Da(t);if(!r.accessToken)return Wp(e),{path:i,written:!1};Xe.mkdirSync(e,{recursive:!0,mode:448});let o={version:1,updatedAtMs:Date.now(),auth:r},s=`${i}.${process.pid}.${Date.now()}.tmp`;return Xe.writeFileSync(s,`${JSON.stringify(o,null,2)}
|
|
193
|
-
`,{encoding:"utf-8",mode:384}),n.retryWindowsFileSystem?(
|
|
186
|
+
`+e.slice(s+1):l+=e.slice(r),l.slice(1)}function Qh(e){for(var t="",n=0,i,r=0;r<e.length;n>=65536?r+=2:r++)n=Gt(e,r),i=te[n],!i&&Xt(n)?(t+=e[r],n>=65536&&(t+=e[r+1])):t+=i||Uh(n);return t}function zh(e,t,n){var i="",r=e.tag,o,s,a;for(o=0,s=n.length;o<s;o+=1)a=n[o],e.replacer&&(a=e.replacer.call(n,String(o),a)),(_e(e,t,a,!1,!1)||typeof a>"u"&&_e(e,t,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=r,e.dump="["+i+"]"}function Za(e,t,n,i){var r="",o=e.tag,s,a,l;for(s=0,a=n.length;s<a;s+=1)l=n[s],e.replacer&&(l=e.replacer.call(n,String(s),l)),(_e(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&_e(e,t+1,null,!0,!0,!1,!0))&&((!i||r!=="")&&(r+=Nr(e,t)),e.dump&&Ht===e.dump.charCodeAt(0)?r+="-":r+="- ",r+=e.dump);e.tag=o,e.dump=r||"[]"}function Zh(e,t,n){var i="",r=e.tag,o=Object.keys(n),s,a,l,c,u;for(s=0,a=o.length;s<a;s+=1)u="",i!==""&&(u+=", "),e.condenseFlow&&(u+='"'),l=o[s],c=n[l],e.replacer&&(c=e.replacer.call(n,l,c)),_e(e,t,l,!1,!1)&&(e.dump.length>1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),_e(e,t,c,!1,!1)&&(u+=e.dump,i+=u));e.tag=r,e.dump="{"+i+"}"}function ey(e,t,n,i){var r="",o=e.tag,s=Object.keys(n),a,l,c,u,f,d;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new ie("sortKeys must be a boolean or a function");for(a=0,l=s.length;a<l;a+=1)d="",(!i||r!=="")&&(d+=Nr(e,t)),c=s[a],u=n[c],e.replacer&&(u=e.replacer.call(n,c,u)),_e(e,t+1,c,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&Ht===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,f&&(d+=Nr(e,t)),_e(e,t+1,u,!0,f)&&(e.dump&&Ht===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,r+=d));e.tag=o,e.dump=r||"{}"}function el(e,t,n){var i,r,o,s,a,l;for(r=n?e.explicitTypes:e.implicitTypes,o=0,s=r.length;o<s;o+=1)if(a=r[o],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(n?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(l=e.styleMap[a.tag]||a.defaultStyle,Ml.call(a.represent)==="[object Function]")i=a.represent(t,l);else if(Nl.call(a.represent,l))i=a.represent[l](t,l);else throw new ie("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');e.dump=i}return!0}return!1}function _e(e,t,n,i,r,o,s){e.tag=null,e.dump=n,el(e,n,!1)||el(e,n,!0);var a=Ml.call(e.dump),l=i,c;i&&(i=e.flowLevel<0||e.flowLevel>t);var u=a==="[object Object]"||a==="[object Array]",f,d;if(u&&(f=e.duplicates.indexOf(n),d=f!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&t>0)&&(r=!1),d&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(u&&d&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),a==="[object Object]")i&&Object.keys(e.dump).length!==0?(ey(e,t,e.dump,r),d&&(e.dump="&ref_"+f+e.dump)):(Zh(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?Za(e,t-1,e.dump,r):Za(e,t,e.dump,r),d&&(e.dump="&ref_"+f+e.dump)):(zh(e,t,e.dump),d&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&Jh(e,e.dump,t,o,l);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new ie("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function ty(e,t){var n=[],i=[],r,o;for(Pr(e,n,i),r=0,o=i.length;r<o;r+=1)t.duplicates.push(n[i[r]]);t.usedDuplicates=new Array(o)}function Pr(e,t,n){var i,r,o;if(e!==null&&typeof e=="object")if(r=t.indexOf(e),r!==-1)n.indexOf(r)===-1&&n.push(r);else if(t.push(e),Array.isArray(e))for(r=0,o=e.length;r<o;r+=1)Pr(e[r],t,n);else for(i=Object.keys(e),r=0,o=i.length;r<o;r+=1)Pr(e[i[r]],t,n)}function ny(e,t){t=t||{};var n=new Vh(t);n.noRefs||ty(e,n);var i=e;return n.replacer&&(i=n.replacer.call({"":i},"",i)),_e(n,0,i,!0,!0)?n.dump+`
|
|
187
|
+
`:""}var iy=ny,ry={dump:iy};function jr(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var oy=Q,sy=il,ay=al,ly=dl,cy=pl,uy=Dr,fy=Ll.load,dy=Ll.loadAll,py=ry.dump,my=ie,hy={binary:bl,float:fl,map:sl,null:ll,pairs:vl,set:Al,timestamp:yl,bool:cl,int:ul,merge:gl,omap:Sl,seq:ol,str:rl},yy=jr("safeLoad","load"),gy=jr("safeLoadAll","loadAll"),by=jr("safeDump","dump"),W={Type:oy,Schema:sy,FAILSAFE_SCHEMA:ay,JSON_SCHEMA:ly,CORE_SCHEMA:cy,DEFAULT_SCHEMA:uy,load:fy,loadAll:dy,dump:py,YAMLException:my,types:hy,safeLoad:yy,safeLoadAll:gy,safeDump:by};var wc=kr(to(),1);async function Xy(e,t){let n=vc(e,"config.yaml"),i,r=!1,o;try{await Pe.mkdir(e,{recursive:!0}),await Pe.writeFile(n,"",{flag:"a",mode:384}),await Pe.chmod(n,384);let s=await Pe.realpath(n);i=vc(Jy(s),`.config-tmp-${Hy(6).toString("hex")}`),o=await wc.default.lock(s,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}});let l=W.load(await Pe.readFile(s,"utf8"))??{};if(!Ac(l))throw new Error("Invalid config document");let c=l.tui??{};if(!Ac(c))throw new Error("Invalid TUI settings");let u={...c};t===void 0?delete u.statusLine:u.statusLine=[...t];let f={...l,tui:u},d=384,p=await Pe.open(i,"wx",d);r=!0;try{await p.writeFile(W.dump(f,{lineWidth:-1,noRefs:!0}),"utf8"),await p.chmod(d)}finally{await p.close()}await Pe.rename(i,s)}catch{throw new Error("Unable to save status line settings. Check config.yaml syntax and permissions.")}finally{r&&i&&await Pe.unlink(i).catch(()=>{}),await o?.().catch(()=>{})}}function Ac(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype}function no(e){if(typeof e!="object"||e===null||Array.isArray(e))return{};let t=e.enabled;return typeof t=="boolean"?{enabled:t}:{}}function io(e,t){return{enabled:no(t).enabled??no(e).enabled??!0}}var _c={support_files_api:!0,files_api_upload_endpoint:"/v1/files/upload",max_image_bytes_inline:10485760,max_video_bytes_inline:52428800,max_request_body_bytes:67108864,max_attachments_count:4},_t={"MiniMax-M3":{name:"MiniMax-M3",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text","image","video"],output:["text"]},limit:{context:512e3,output:128e3},contextWindowOptions:[512e3,1e6],contextWindowOptionHints:{1e6:"higher_usage"},options:{reasoningSummary:"auto"},thinking_config:{mode:"switchable",default_value:"true"},variants:{"none-thinking":{thinking:{type:"disabled"}},thinking:{thinking:{type:"adaptive"}}},capabilities:_c},"MiniMax-M3.1-Flash-Preview":{name:"M3.1-Flash-Preview",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text","image","video"],output:["text"]},limit:{context:512e3,output:128e3},contextWindowOptions:[512e3,1e6],contextWindowOptionHints:{1e6:"higher_usage"},options:{reasoningSummary:"auto"},thinking:{effortOptions:["default","low","medium","high","xhigh","max"],defaultEffort:"default"},thinking_config:{mode:"forced_on"},variants:{"none-thinking":{thinking:{type:"disabled"}},thinking:{thinking:{type:"adaptive"}}},capabilities:_c},"MiniMax-M2.7-highspeed":{name:"MiniMax-M2.7-highspeed",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text"],output:["text"]},limit:{context:2e5,output:128e3}},"MiniMax-M2.7":{name:"MiniMax-M2.7",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,modalities:{input:["text"],output:["text"]},limit:{context:2e5,output:128e3}}};import Oe from"node:fs";import be from"node:fs";var Ec=384;function Et(e){if(process.platform==="win32")return;let t=be.statSync(e).mode;(t&63)!==0&&be.chmodSync(e,t&448)}function it(e,t,n=!1){let i=be.constants.O_WRONLY|be.constants.O_CREAT|(n?be.constants.O_EXCL:0),r=be.openSync(e,i,Ec);try{be.fchmodSync(r,Ec),be.ftruncateSync(r,0),be.writeFileSync(r,t)}finally{be.closeSync(r)}}import{isDeepStrictEqual as gd}from"node:util";var ee=kr(md(),1);function er(e){try{let t=W.load(e);return qs(t)?t:{}}catch{return{}}}function Ln(e,t,n){let i=(0,ee.parseDocument)(e,{schema:"core",compat:"yaml-1.1",customTags:["timestamp"],merge:!0});if(i.errors.length>0||!(0,ee.isMap)(i.contents)&&e.trim()!=="")return yd(n);try{let r=Sd(t,n);if(r.length===0)return e;Ev(i),kv(i);for(let s of r){let a=xv(i,s.path);s.kind==="delete"?i.deleteIn(a):i.setIn(a,s.value)}let o=i.toString({indent:2,lineWidth:-1});if(!gd(W.load(o),W.load(yd(n))))throw new Error("The serialized configuration does not match the intended values");return o}catch(r){throw new Error(`config.yaml could not be rewritten: ${r instanceof Error?r.message:String(r)}${r instanceof RangeError?". Remove the self-referential YAML anchor and retry.":""}`)}}function Ev(e){(0,ee.visit)(e,{Scalar(t,n){if(n.addToJSMap||typeof n.source!="string"||n.type!=="PLAIN"&&!n.tag)return;let i=n.type==="PLAIN"&&!n.source.includes(`
|
|
188
|
+
`)?n.source:JSON.stringify(n.source),r=n.tag?`!<${n.tag}> `:"",o=W.load(`value: ${r}${i}`).value;gd(n.value,o)||(n.value=o,delete n.format)}})}function bd(e,t){return e.items.find(n=>(0,ee.isScalar)(n.key)&&String(n.key.value)===t)?.key??t}function xv(e,t){let n=[],i=e.contents;for(let r of t)n.push((0,ee.isMap)(i)?bd(i,r):r),i=e.getIn(n,!0);return n}function kv(e){let t=new Map;(0,ee.visit)(e,{Alias(n,i){let r=i.toJS(e),o=hd(e,r);o.comment=i.comment,o.commentBefore=i.commentBefore,o.spaceBefore=i.spaceBefore,t.set(i,o)}}),(0,ee.visit)(e,{Alias:(n,i)=>t.get(i)}),(0,ee.visit)(e,{Map(n,i){let r=i.items.filter(a=>(0,ee.isScalar)(a.key)&&a.key.addToJSMap);if(r.length===0)return;let o=i.toJS(e),s=r.flatMap(a=>[a.key,a.value].flatMap(l=>(0,ee.isNode)(l)?[l.commentBefore,l.comment]:[]));i.commentBefore=[i.commentBefore,...s].filter(Boolean).join(`
|
|
189
|
+
`)||void 0,i.items=i.items.filter(a=>!r.includes(a));for(let[a,l]of Object.entries(o))i.has(bd(i,a))||i.set(a,hd(e,l))}}),e.setSchema(e.directives?.yaml.version??"1.2",{schema:"core",compat:"yaml-1.1",customTags:["timestamp"],merge:!1})}function hd(e,t){let n=e.createNode(t,{aliasDuplicateObjects:!1});return(0,ee.visit)(n,{Pair(i,r){(0,ee.isScalar)(r.key)&&r.key.value==="<<"&&(r.key.type="QUOTE_DOUBLE")}}),n}function Sd(e,t,n=[]){if(!qs(e)||!qs(t))return Cv(e,t)?[]:[{kind:"set",path:n,value:t}];let i=[];for(let r of new Set([...Object.keys(e),...Object.keys(t)])){let o=[...n,r];!(r in t)||t[r]===void 0?i.push({kind:"delete",path:o}):r in e?i.push(...Sd(e[r],t[r],o)):i.push({kind:"set",path:o,value:t[r]})}return i}function Cv(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function yd(e){return W.dump(e,{indent:2,lineWidth:-1,noRefs:!0})}function qs(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ft(e){if(typeof e!="object"||e===null)return!1;if("v2_enabled"in e&&typeof e.v2_enabled=="boolean")return e.v2_enabled;if(!("v2"in e))return!1;let t=e.v2;return typeof t!="object"||t===null?!1:"enabled"in t&&typeof t.enabled=="boolean"?t.enabled:"writeEnabled"in t&&t.writeEnabled===!0||"recallEnabled"in t&&t.recallEnabled===!0}var tr={enabled:!1,detailedLoggingEnabled:!1,writeEnabled:!1,recallEnabled:!1,eligibleSessionIdleMs:600*1e3,maxCaptureInputTokens:64e3,maxSessionDocBytes:64*1024,maxSelectedSessions:256,maxConsolidationInputTokens:256e3,maxMemoryMarkdownBytes:2*1024*1024,maxSummaryInjectionTokens:2500,maxCaptureSessionsPerWake:6,maxCaptureConcurrency:2,eligibleSessionMaxAgeDays:30,maxCaptureAttemptsPerRevision:3,captureFailureBackoffMs:3600*1e3,publicationCooldownMs:360*60*1e3,maxConsolidationAgentTurns:64,minModelQuotaRemainingPercent:25,captureModel:void 0,captureReasoningEffort:"low",consolidationModel:void 0,consolidationReasoningEffort:"medium",retentionDays:90};function wd(e,t){let n=e.memory,i=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:{},r=i.dailyDigest,o=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},s=i.v2,a=s!=null&&typeof s=="object"&&!Array.isArray(s)?s:{},l=t.v2,c=i.legacyRecallDisabledAgents;return{legacyRecallDisabledAgents:c&&typeof c=="object"&&!Array.isArray(c)?Object.fromEntries(Object.entries(c).filter(([,u])=>typeof u=="boolean")):{},enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled,proactive:typeof i.proactive=="boolean"?i.proactive:t.proactive,dailyDigest:{enabled:typeof o.enabled=="boolean"?o.enabled:t.dailyDigest.enabled},v2_enabled:typeof i.v2_enabled=="boolean"||["enabled","writeEnabled","recallEnabled"].some(u=>typeof a[u]=="boolean")?Ft(i):Ft(t),v2:{...typeof a.enabled=="boolean"?{enabled:a.enabled}:{},detailedLoggingEnabled:$s(a.detailedLoggingEnabled,l.detailedLoggingEnabled),writeEnabled:$s(a.writeEnabled,l.writeEnabled),recallEnabled:$s(a.recallEnabled,l.recallEnabled),eligibleSessionIdleMs:re(a.eligibleSessionIdleMs,l.eligibleSessionIdleMs),maxCaptureInputTokens:re(a.maxCaptureInputTokens,l.maxCaptureInputTokens),maxSessionDocBytes:re(a.maxSessionDocBytes,l.maxSessionDocBytes),maxSelectedSessions:re(a.maxSelectedSessions,l.maxSelectedSessions),maxConsolidationInputTokens:re(a.maxConsolidationInputTokens,l.maxConsolidationInputTokens),maxMemoryMarkdownBytes:re(a.maxMemoryMarkdownBytes,l.maxMemoryMarkdownBytes),maxSummaryInjectionTokens:re(a.maxSummaryInjectionTokens,l.maxSummaryInjectionTokens),maxCaptureSessionsPerWake:re(a.maxCaptureSessionsPerWake,l.maxCaptureSessionsPerWake),maxCaptureConcurrency:re(a.maxCaptureConcurrency,l.maxCaptureConcurrency),eligibleSessionMaxAgeDays:re(a.eligibleSessionMaxAgeDays,l.eligibleSessionMaxAgeDays),maxCaptureAttemptsPerRevision:re(a.maxCaptureAttemptsPerRevision,l.maxCaptureAttemptsPerRevision),captureFailureBackoffMs:re(a.captureFailureBackoffMs,l.captureFailureBackoffMs),publicationCooldownMs:re(a.publicationCooldownMs,l.publicationCooldownMs),maxConsolidationAgentTurns:re(a.maxConsolidationAgentTurns,l.maxConsolidationAgentTurns),minModelQuotaRemainingPercent:Ov(a.minModelQuotaRemainingPercent,l.minModelQuotaRemainingPercent),captureModel:vd(a.captureModel,l.captureModel),captureReasoningEffort:Ad(a.captureReasoningEffort,l.captureReasoningEffort),consolidationModel:vd(a.consolidationModel,l.consolidationModel),consolidationReasoningEffort:Ad(a.consolidationReasoningEffort,l.consolidationReasoningEffort),retentionDays:re(a.retentionDays,l.retentionDays)}}}function $s(e,t){return typeof e=="boolean"?e:t}function re(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:t}function Ov(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0&&e<=100?e:t}function vd(e,t){return typeof e=="string"&&e.trim().length>0?e.trim():t}function Ad(e,t){return e==="low"||e==="medium"||e==="high"?e:t}function Tv(e,t){return!Ft(e)&&e?.enabled!==!1&&e?.legacyRecallDisabledAgents?.[t]!==!0}import oe from"node:path";import OA from"node:os";import{spawnSync as TA}from"node:child_process";import{fileURLToPath as IA}from"node:url";function _d(e){let t=e.tui;if(t==null||typeof t!="object"||Array.isArray(t))return{};let n=t,i=n.notifications,r;if(i&&typeof i=="object"&&!Array.isArray(i)){let{when:l,method:c}=i;r={...l==="unfocused"||l==="always"||l==="never"?{when:l}:{},...c==="auto"||c==="osc9"||c==="osc777"||c==="bel"?{method:c}:{}}}let o=n.statusLine,s=Array.isArray(o)?o.filter(l=>typeof l=="string").map(l=>l.trim()).filter(Boolean):void 0,a=Iv(n.customStatusLine);return{...typeof n.showTips=="boolean"?{showTips:n.showTips}:{},...r?{notifications:r}:{},...s?{statusLine:s}:{},...a?{customStatusLine:a}:{}}}function Iv(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e,n=typeof t.command=="string"?t.command.trim():"";if(n)return{command:n,...t.display==="inline"||t.display==="block"?{display:t.display}:{},...t.position==="above"||t.position==="below"?{position:t.position}:{},...t.colorMode==="plain"||t.colorMode==="ansi"?{colorMode:t.colorMode}:{},...typeof t.maxLines=="number"&&Number.isFinite(t.maxLines)?{maxLines:t.maxLines}:{},...typeof t.timeoutMs=="number"&&Number.isFinite(t.timeoutMs)?{timeoutMs:t.timeoutMs}:{},...typeof t.intervalSeconds=="number"&&Number.isFinite(t.intervalSeconds)?{intervalSeconds:t.intervalSeconds}:{}}}import{createHash as Lv,randomUUID as Mv}from"node:crypto";import ir from"node:fs";import nr from"node:path";function kd(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e,n={};typeof t.apiKey=="string"&&(n.apiKey=t.apiKey),typeof t.baseURL=="string"&&(n.baseURL=t.baseURL);let i=Us(t.modelContextLimits);return i&&(n.modelContextLimits=i),Object.keys(n).length>0?n:void 0}function Us(e){if(!B(e))return;let t=Object.entries(e).filter(n=>n[0].length>0&&Number.isSafeInteger(n[1])&&n[1]>0);return t.length>0?Object.fromEntries(t):void 0}function Cd(e,t){return t?Object.fromEntries(Object.entries(e).map(([n,i])=>{let r=t[n];return[n,r!==void 0&&i.contextWindowOptions?.includes(r)?{...i,limit:{...i.limit,context:r}}:i]})):e}function Ks(e){let t=e.provider?.minimax,n=t?.catalogModels??t?.models??_t;return Cd(Object.fromEntries(Object.entries(n).filter(([,i])=>i.enabled!==!1)),e.minimax_api?.modelContextLimits)}function Od(e,t){let n=e.minimax;return n?.models?{...e,minimax:{...n,catalogModels:n.models,models:Cd(n.models,t)}}:e}function Td(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=Object.entries(e).filter(([,n])=>n!=null&&typeof n=="object"&&!Array.isArray(n));if(t.length!==0)return Object.fromEntries(t.map(([n,i])=>[n,Ld(i)]))}function Id(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,B(n)?Ld(n):n]))}function Ld(e){if(!B(e.models))return e;let t=!1,n=Object.fromEntries(Object.entries(e.models).map(([i,r])=>{if(!B(r)||!B(r.thinking))return[i,r];let o=typeof r.thinking.effort=="string"?r.thinking.effort.trim():"",s=typeof r.thinking.defaultEffort=="string"?r.thinking.defaultEffort.trim():"";if(!Object.hasOwn(r.thinking,"effort")&&!Object.hasOwn(r.thinking,"defaultEffort"))return[i,r];let a=[],l=new Set;if(Array.isArray(r.thinking.effortOptions))for(let d of r.thinking.effortOptions){if(typeof d!="string")continue;let p=d.trim();!p||l.has(p)||(l.add(p),a.push(p))}o&&!l.has(o)&&(l.add(o),a.push(o)),s&&!l.has(s)&&(l.add(s),a.push(s));let c={...r.thinking};delete c.effort,delete c.effortOptions,delete c.defaultEffort;let u={...c,...a.length>0?{effortOptions:a}:{},...s?{defaultEffort:s}:{}},f={...r};return Object.keys(u).length>0?f.thinking=u:delete f.thinking,t=!0,[i,f]}));return t?{...e,models:n}:e}var Md="byok_legacy_provider_to_custom_provider_v1",Nd="config.yaml.bak.byok-legacy-provider.",js=new Set(["minimax","minimax_api","provider","custom_provider"]),Nv=/^[A-Za-z0-9 _-]+$/;function Rd(e,t){let n={migrated:!1,migratedProviders:{}};if(!t.isManagedRuntime()||!ir.existsSync(e))return n;let i=Fv(e);if(!B(i.provider))return n;let r=i.provider,o=B(i.custom_provider)?i.custom_provider:{},s=Yv(i),a={},l={...o},c=new Set(Object.keys(l)),u=!1,f=t.getManagedPreset().provider;for(let[d,p]of Object.entries(r)){if(!Dv(d,p,f))continue;let y=s.providers[d];if(y&&!js.has(y)&&!B(l[y])){delete r[d],u=!0;continue}let m=y&&!js.has(y)?y:$v(d,p,c);a[d]=m,B(l[m])||(l[m]=qv(p),c.add(m),u=!0),s.providers[d]!==m&&(s.providers[d]=m,u=!0),delete r[d],u=!0}if(!u&&Object.keys(a).length===0)return n;if(u=xd(i,"defaultModel",a)||u,u=xd(i,"defaultLightModel",a)||u,u=Kv(i,a)||u,!u)return{migrated:!1,migratedProviders:a};Object.keys(l).length>0?i.custom_provider=l:delete i.custom_provider,Gv(i,s);try{let d=Vv(e);return it(e,W.dump(i,{indent:2,lineWidth:-1,noRefs:!0})),{migrated:!0,migratedProviders:a,backupPath:d}}catch(d){return console.warn(`[config] legacy BYOK provider migration skipped: ${Hv(d)}`),{migrated:!1,migratedProviders:a}}}function Pd(e,t){let n=e.provider,i=e.defaultModel;if(Object.prototype.hasOwnProperty.call(n,"minimax_api")){let{minimax_api:y,...m}=n;n=m,console.warn('[config] "minimax_api" is a reserved provider id; ignoring provider.minimax_api from config.yaml')}let o=t.getManagedPreset().provider.minimax,s=n.minimax,a=t.isManagedRuntime();if(!(a||Rv(s,t)))return{provider:n,defaultModel:i};let c=s?.options,u=a&&t.shouldEnforceManagedProviderProtection(),f=Pv(o.models,s?.models),d=typeof c?.baseURL=="string"&&c.baseURL.length>0?c.baseURL:void 0,p=u&&d!=null&&!t.isManagedPresetBaseUrl(d);return n={...n,minimax:{...o,...s??{},npm:s?.npm??o.npm,models:f,options:{...o.options??{},...c??{},...p?{apiKey:o.options?.apiKey}:{},...u?{authMode:"managed-login",baseURL:o.options?.baseURL}:{}}}},{provider:n,defaultModel:i}}function Rv(e,t){let n=e?.options;return n?.authMode==="managed-login"?!0:typeof n?.baseURL=="string"&&t.isManagedPresetBaseUrl(n.baseURL)}function Pv(e,t){return t&&Object.keys(t).length>0?t:e??{}}function Fv(e){try{let t=W.load(ir.readFileSync(e,"utf-8"));return B(t)?t:{}}catch{return{}}}function Dv(e,t,n){return e==="minimax"||e==="minimax_api"||!Wv(t)||!Bv(t)?!1:!Object.prototype.hasOwnProperty.call(n,e)}function Bv(e){let t=B(e.options)?e.options:void 0;return typeof t?.apiKey=="string"&&t.apiKey.trim().length>0&&typeof t.baseURL=="string"&&t.baseURL.trim().length>0&&B(e.models)}function qv(e){let t=B(e.options)?e.options:{};return{...e,kind:"custom",enabled:e.enabled!==!1,options:{...t,authMode:"api-key"}}}function $v(e,t,n){let i=B(t)?t:{},r=typeof i.name=="string"?i.name:void 0,o=`provider-${jv(e)}`,s=Ed(e)??Ed(r)??o;for(let a=0;;a+=1){let l=a===0?s:`${s}-${a+1}`;if(!n.has(l)&&!js.has(l))return l}}function Ed(e){let t=e?.trim();return!t||!Nv.test(t)?void 0:t.toLowerCase().replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function jv(e){return Lv("sha256").update(e).digest("hex").slice(0,8)}function xd(e,t,n){let i=e[t];if(typeof i!="string")return!1;let r=Uv(i,n);return r===i?!1:(e[t]=r,!0)}function Uv(e,t){let n=e.indexOf("/");if(n<=0||n===e.length-1)return e;let i=e.slice(0,n),r=t[i];return r?`custom_provider:${r}/${e.slice(n+1)}`:e}function Kv(e,t){if(!B(e.nexus)||!B(e.nexus.model))return!1;let n=e.nexus.model.providerID;if(typeof n!="string")return!1;let i=t[n];return i?(e.nexus.model.providerID=`custom_provider:${i}`,!0):!1}function Fd(e){if(process.platform==="win32")return;let t=nr.dirname(e),n;try{n=ir.readdirSync(t,{withFileTypes:!0})}catch{console.warn(`[config] Could not inspect legacy BYOK backups in ${JSON.stringify(t)}. Backup permissions were not verified; check directory access and restrict backup permissions manually.`);return}for(let i of n)if(i.isFile()&&i.name.startsWith(Nd)){let r=nr.join(t,i.name);try{Et(r)}catch{console.warn(`[config] Could not restrict legacy BYOK backup ${JSON.stringify(r)}. It may still be readable by other users; restrict its permissions manually.`)}}}function Vv(e){let t=nr.join(nr.dirname(e),`${Nd}${Date.now()}.${Mv()}`);return Et(e),it(t,ir.readFileSync(e),!0),t}function Yv(e){let n=(B(e.migrations)?e.migrations:void 0)?.[Md];return{providers:B(n)&&B(n.providers)?Object.fromEntries(Object.entries(n.providers).filter(r=>typeof r[1]=="string")):{}}}function Gv(e,t){let n=B(e.migrations)?e.migrations:{};n[Md]={version:1,providers:t.providers},e.migrations=n}function Wv(e){return B(e)?typeof e.name=="string"||typeof e.npm=="string"||typeof e.api=="string"||B(e.options)||B(e.models):!1}function B(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Hv(e){return e instanceof Error?e.message:String(e)}function Dd(e,t){if(e==null||typeof e!="object"||Array.isArray(e))return t;let n=Reflect.get(e,"mode"),i=Reflect.get(e,"turnDiffCard");return{mode:n==="inline"||n==="subagent"?n:t.mode,turnDiffCard:i==="concise"||i==="standard"?i:t.turnDiffCard,modeSource:n==="inline"||n==="subagent"?"explicit":"default"}}function Bd(e,t){let n=t.keepAlive,i=t.xdg,r=t.spawnConcurrency,o=()=>({enabled:n.enabled,maxProcesses:n.maxProcesses,maxLifetimeMs:n.maxLifetimeMs,agents:[...n.agents]}),s=e.opencode;if(s==null||typeof s!="object"||Array.isArray(s))return{keepAlive:o(),xdg:{...i},spawnConcurrency:r};let a=s,l=a.spawnConcurrency,c=typeof l=="number"&&Number.isFinite(l)&&l>0&&Number.isInteger(l)?l:r,u=Jv(a.xdg,i),f=a.keepAlive;if(f==null||typeof f!="object"||Array.isArray(f))return{keepAlive:o(),xdg:u,spawnConcurrency:c};let d=f,p=d.maxProcesses,y=typeof p=="number"&&Number.isFinite(p)&&p>0&&Number.isInteger(p)?p:n.maxProcesses,m=d.maxLifetimeMs,h=typeof m=="number"&&Number.isFinite(m)&&m>0&&Number.isInteger(m)?m:n.maxLifetimeMs,g=d.agents,b;return Array.isArray(g)?(b=g.filter(v=>typeof v=="string"&&v.length>0),b.length===0&&(b=[...n.agents])):b=[...n.agents],{keepAlive:{enabled:typeof d.enabled=="boolean"?d.enabled:n.enabled,maxProcesses:y,maxLifetimeMs:h,agents:b},xdg:u,spawnConcurrency:c}}function Jv(e,t){let n=e!=null&&typeof e=="object"&&!Array.isArray(e)?e:void 0,i=n?.startupImport,r=i==="background"||i==="blocking"||i==="off"?i:t.startupImport;return{dataIsolation:typeof n?.dataIsolation=="boolean"?n.dataIsolation:t.dataIsolation,startupImport:r}}function rr(e){let t=JSON.stringify({level:40,time:Date.now(),name:"config.asr",msg:e});process.stderr.write(`${t}
|
|
190
|
+
`)}var sr={enabled:!0};function qd(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e,n=typeof t.apiKey=="string"&&t.apiKey.trim().length>0,i=typeof t.resourceId=="string"&&t.resourceId.trim().length>0;return n||i}function or(e){return typeof e=="string"&&e.trim().length>0}function $d(e){let t=e.asr;if(t==null||typeof t!="object"||Array.isArray(t))return{...sr};let n=t;return qd(n.seed)&&rr("Ignoring legacy `asr.seed.*` in config \u2014 Seed ASR was retired from the daemon; only Amadeus remains. Remove `asr.seed` from config.yaml."),qd(n.qwen)&&rr("Ignoring legacy `asr.qwen.apiKey` in config \u2014 Qwen ASR was retired from the daemon; only Amadeus remains. Remove `asr.qwen` from config.yaml."),(or(n.mode)||or(n.proxyBaseUrl))&&rr("Ignoring legacy `asr.mode` / `asr.proxyBaseUrl` in config \u2014 the daemon no longer runs the shared asr-proxy WebSocket path. The Amadeus HTTP proxy is managed by the application environment. Remove these keys from config.yaml."),(or(n.primaryProvider)||or(n.fallbackProvider))&&rr("Ignoring legacy `asr.primaryProvider` / `asr.fallbackProvider` in config \u2014 only Amadeus remains and provider selection is no longer configurable. Remove these keys from config.yaml."),{enabled:typeof n.enabled=="boolean"?n.enabled:sr.enabled}}var Xv={policyOwner:"core",storageWriteVersion:2,classifierTimeoutMs:6e4,userConfirmationEnabled:!0};function jd(e,t=Xv){let n=e.permission;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.policyOwner===void 0?t.policyOwner:i.policyOwner==="engine"||i.policyOwner==="core"?i.policyOwner:"engine",o=i.storageWriteVersion===1||i.storageWriteVersion===2?i.storageWriteVersion:t.storageWriteVersion,s=i.classifierTimeoutMs,a=typeof s=="number"&&Number.isFinite(s)&&s>=5e3?Math.floor(s):t.classifierTimeoutMs,l=typeof i.userConfirmationEnabled=="boolean"?i.userConfirmationEnabled:t.userConfirmationEnabled;return{policyOwner:r,storageWriteVersion:o,classifierTimeoutMs:a,userConfirmationEnabled:l}}var Ud=["user-cc","user-codex","user-agents","workspace-minimax","workspace-cc","workspace-agents"],Qv={"user-cc":"user-claude","workspace-cc":"workspace-claude"},lr={external:{enabled:!0,walkUp:!0,duplicateWarn:!0,sources:{"workspace-minimax":{enabled:!0,priority:65},"workspace-cc":{enabled:!0,priority:60},"workspace-agents":{enabled:!0,priority:55},"user-cc":{enabled:!0,priority:40},"user-codex":{enabled:!0,priority:35},"user-agents":{enabled:!0,priority:30}}}};function ar(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function zv(e,t){return ar(e)?{enabled:typeof e.enabled=="boolean"?e.enabled:t.enabled,priority:typeof e.priority=="number"&&Number.isFinite(e.priority)?e.priority:t.priority}:t}function Vs(e){let t=lr,n=ar(e.skills)?e.skills:{},i=ar(n.external)?n.external:{},r=ar(i.sources)?i.sources:{},o={...t.external.sources};for(let s of Ud){let a=Qv[s],l=Object.hasOwn(r,s)?r[s]:a?r[a]:void 0;o[s]=zv(l,t.external.sources[s])}return{external:{enabled:typeof i.enabled=="boolean"?i.enabled:t.external.enabled,walkUp:typeof i.walkUp=="boolean"?i.walkUp:t.external.walkUp,duplicateWarn:typeof i.duplicateWarn=="boolean"?i.duplicateWarn:t.external.duplicateWarn,sources:o}}}var Zv=Ud;var Kd=["pi-agent"],Dt="pi-agent";function Vd(e){return typeof e!="string"?Dt:Kd.includes(e)?e:Dt}function Ys(e){return e==null||typeof e!="object"||Array.isArray(e)?{defaultFramework:Dt}:{defaultFramework:Vd(e.defaultFramework)}}import Y from"node:fs";import eA from"node:os";import Bt from"node:path";var Xd=".minimax",Qd=".mavis",tA={error:()=>{},info:()=>{},warn:()=>{}};function Xs(e){return e??eA.homedir()}function zd(e,t){return t?`${e}-${t}`:e}function Zd(e,t){return Bt.join(Xs(e),zd(Xd,t))}function ep(e,t){return Bt.join(Xs(e),zd(Qd,t))}function Ws(e){try{let t=Y.lstatSync(e);return t.isSymbolicLink()?{kind:"link"}:t.isDirectory()?{kind:"directory"}:{kind:"other"}}catch(t){let n=t.code;return n==="ENOENT"||n==="ENOTDIR"?{kind:"missing"}:{kind:"inaccessible",error:t}}}function Gs(e){let t=Bt.resolve(e);return process.platform==="win32"?(t=t.replace(/^\\\\\?\\/,""),t.toLowerCase()):t}function Qs(e,t){try{let n=Y.readlinkSync(e),i=Gs(t);return Gs(Bt.resolve(Bt.dirname(e),n))===i||Gs(n)===i}catch{return!1}}function cr(e,t,n){if(!Qs(e,t))try{Y.symlinkSync(t,e,process.platform==="win32"?"junction":"dir")}catch(i){n.warn(`Failed to create compat link ${e} -> ${t}: ${String(i)}`)}}function Yd(e,t,n){if(t.kind==="missing")return!0;if(t.kind==="link"||t.kind==="other")try{return Y.unlinkSync(e),!0}catch(i){return n.warn(`Failed to remove ${e} before creating compat link: ${String(i)}`),!1}return!1}function Hs(e){try{let t=Y.readdirSync(e);if(t.length===0)return"empty";if(t.length===1&&t[0]==="workspace")try{return Y.readdirSync(Bt.join(e,"workspace")).length>0?"hasData":"empty"}catch{return"unknown"}return"hasData"}catch{return"unknown"}}function Js(e){try{return Y.statSync(e).isDirectory()?Hs(e):void 0}catch{return"unknown"}}function nA(e,t){return`${e}.backup-${t()}`}function iA(e,t,n){let i=nA(e,n);try{return Y.renameSync(e,i),t.warn(`Backed up legacy data dir ${e} -> ${i}`),!0}catch(r){return t.warn(`Failed to back up legacy data dir ${e}: ${String(r)}`),!1}}function rA(e,t,n,i){if(Qs(e,t))return!0;let r=Ws(e);if(r.kind==="missing")return!0;if(r.kind==="link"){let o=Js(e);return o==="hasData"||o==="unknown"?(n.warn(`Cannot replace legacy data dir symlink ${e}; it may point to real data outside ${t}`),!1):Yd(e,r,n)}return r.kind==="other"?Yd(e,r,n):r.kind==="directory"?iA(e,n,i):(n.warn(`Cannot replace inaccessible legacy data dir ${e}; leaving it untouched`),!1)}function Gd(e,t,n,i){rA(e,t,n,i)&&cr(e,t,n)}function oA(e,t){try{return Y.rmSync(e,{recursive:!0,force:!1}),!0}catch(n){return t.warn(`Failed to remove empty primary data dir ${e}: ${String(n)}`),!1}}function Wd(e,t,n){try{return Y.renameSync(e,t),n.info(`Migrated legacy data dir ${e} -> ${t}`),!0}catch(i){return n.warn(`Failed to migrate legacy data dir ${e} -> ${t}: ${String(i)}`),!1}}function sA(e,t,n,i){try{Y.cpSync(e,n,{recursive:!0,errorOnExist:!0,force:!1}),Y.unlinkSync(t);try{Y.rmSync(e,{recursive:!0,force:!1})}catch(r){i.warn(`Copied legacy symlink data dir ${e} -> ${n}, but failed to remove old target: ${String(r)}`)}return i.info(`Copied legacy data dir symlink target ${e} -> ${n}`),!0}catch(r){try{Y.existsSync(n)&&Y.rmSync(n,{recursive:!0,force:!0})}catch(o){i.warn(`Failed to clean up partial primary data dir ${n}: ${String(o)}`)}return i.warn(`Failed to copy legacy symlink data dir ${t} -> ${n}: ${String(r)}`),!1}}function Hd(e,t,n){try{let i=Y.realpathSync(e);try{Y.renameSync(i,t)}catch(r){if(r.code==="EXDEV")return sA(i,e,t,n);throw r}return Y.unlinkSync(e),n.info(`Migrated legacy data dir symlink target ${i} -> ${t}`),!0}catch(i){return n.warn(`Failed to migrate legacy symlink data dir ${e} -> ${t}: ${String(i)}`),!1}}function Jd(e,t){try{return Y.mkdirSync(e,{recursive:!0}),!0}catch(n){return t.warn(`Failed to create primary data dir ${e}: ${String(n)}`),!1}}function aA(e,t,n,i){let r=Ws(e),o=Ws(t);if(r.kind==="inaccessible")return n.warn(`Primary data dir ${e} is inaccessible; not treating it as missing`),e;if(r.kind==="directory"){let s=Hs(e),a=o.kind==="directory"?Hs(t):o.kind==="link"?Js(t)??"empty":"empty";if(s==="empty"){if(o.kind==="inaccessible"||a==="unknown")return n.warn(`Legacy data dir ${t} may contain data but is inaccessible; not using empty primary ${e}`),t;if((o.kind==="directory"||o.kind==="link")&&a==="hasData"){if(!oA(e,n))return t;if(o.kind==="link"){if(!Hd(t,e,n))return t}else if(!Wd(t,e,n))return t;return cr(t,e,n),e}}return Gd(t,e,n,i),e}if(Qs(t,e))return Jd(e,n),e;if(o.kind==="directory")return Wd(t,e,n)?(cr(t,e,n),e):t;if(o.kind==="link"){let s=Js(t);if(s==="hasData")return Hd(t,e,n)?(cr(t,e,n),e):t;if(s==="unknown")return n.warn(`Legacy data dir symlink ${t} target is inaccessible; not treating it as missing`),t}return o.kind==="inaccessible"?(n.warn(`Legacy data dir ${t} is inaccessible; not treating it as missing`),t):r.kind==="link"||r.kind==="other"?(n.warn(`Primary data dir path ${e} exists but is not a directory; using it without migration`),e):(Jd(e,n),Gd(t,e,n,i),e)}function Ge(e={}){let t=Xs(e.homeDir),n=e.profile??null;return aA(Zd(t,n),ep(t,n),e.logger??tA,e.nowMs??Date.now)}function lA(e,t){return Ge({homeDir:e,logger:t})}function cA(e,t,n){return Ge({homeDir:t,profile:e,logger:n})}var ia=["read","write","edit","bash","task_query","task_output","task_stop","grep","glob","todowrite","web_fetch","website_deploy","workspace_semantic_search"],ra=["images_understand","image_synthesize","images_search_and_download","image_reverse_search","submit_video_generation","query_video_generation","gen_videos","batch_text_to_video","batch_image_to_video","get_voice_list","batch_text_to_audio","batch_text_to_music","synthesize_speech","batch_synthesize_speech","audios_understand","videos_understand","transcribe_audio"],oa=["code-review","deep-research","deploy-website","docx","edit-deployed-website","init","lark-tools","llm-call","mcode-tools-master","mavis-doctor","pdf","plugin-creator","pptx","skill-creator","skill-refiner","visual-page","x-link-reader","xlsx"],ip=["control-in-app-browser","resume-codex","mavis","create-agent","minimax-code-product","miniapp-creator"],uA=new Set(["modelConfigId","persona","tools","builtinTools","skills","features"]),fA=new Set(["enabled"]),ta=new Set(["mavis","delegation","webSearch"]),rp=new Set(ia),tp=["task_query","task_output","task_stop"],op=new Set(ra),na=new Set(oa),sp=new Set(ip),dA=new Set(["plan-mode"]);function sa(e){let t=ur(e),n=ur(t?.default);return{default:n?mA(n):{}}}function pA(e,t="agent"){if(e===void 0)return{};let n=Zs(e,t);ea(n,uA,t);let i={};if(n.modelConfigId!==void 0&&((typeof n.modelConfigId!="string"||!n.modelConfigId.trim())&&ce(`${t}.modelConfigId`,"must be a non-empty string"),i.modelConfigId=n.modelConfigId.trim()),n.persona!==void 0){let r=Zs(n.persona,`${t}.persona`);ea(r,fA,`${t}.persona`),r.enabled!==void 0&&typeof r.enabled!="boolean"&&ce(`${t}.persona.enabled`,"must be a boolean"),i.persona={...typeof r.enabled=="boolean"?{enabled:r.enabled}:{}}}if(n.tools!==void 0&&(Array.isArray(n.tools)||ce(`${t}.tools`,"must be an array"),i.tools=n.tools.map((r,o)=>((typeof r!="string"||!rp.has(r))&&ce(`${t}.tools[${o}]`,`must be one of ${ia.join(", ")}`),r))),n.builtinTools!==void 0&&(Array.isArray(n.builtinTools)||ce(`${t}.builtinTools`,"must be an array"),i.builtinTools=n.builtinTools.map((r,o)=>(r==="web_search"&&ce(`${t}.builtinTools[${o}]`,"web_search is feature-owned; use features.webSearch"),(typeof r!="string"||!op.has(r))&&ce(`${t}.builtinTools[${o}]`,`must be one of ${ra.join(", ")}`),r))),n.skills!==void 0&&(Array.isArray(n.skills)||ce(`${t}.skills`,"must be an array"),i.skills=n.skills.map((r,o)=>{if(typeof r=="string"&&sp.has(r.trim())){let s=r.trim();ce(`${t}.skills[${o}]`,`${s} is capability-owned; use its owning Tool or feature switch`)}return(typeof r!="string"||!na.has(r.trim()))&&ce(`${t}.skills[${o}]`,`must be one of ${oa.join(", ")}`),r.trim()})),n.features!==void 0){let r=Zs(n.features,`${t}.features`);ea(r,ta,`${t}.features`);for(let o of ta)r[o]!==void 0&&typeof r[o]!="boolean"&&ce(`${t}.features.${o}`,"must be a boolean");i.features={...typeof r.mavis=="boolean"?{mavis:r.mavis}:{},...typeof r.delegation=="boolean"?{delegation:r.delegation}:{},...typeof r.webSearch=="boolean"?{webSearch:r.webSearch}:{}}}return i}function mA(e){let t={};typeof e.modelConfigId=="string"&&e.modelConfigId.trim()&&(t.modelConfigId=e.modelConfigId.trim());let n=ur(e.persona);if(typeof n?.enabled=="boolean"&&(t.persona={enabled:n.enabled}),np(e.tools,rp)){let r=[...e.tools];tp.some(o=>r.includes(o))||r.push(...tp),t.tools=r}if(np(e.builtinTools,op)&&(t.builtinTools=[...e.builtinTools]),Array.isArray(e.skills)){let r=e.skills.map(o=>typeof o=="string"?o.trim():o);r.every(o=>typeof o=="string"&&(na.has(o)||dA.has(o))&&!sp.has(o))&&(t.skills=r.filter(o=>typeof o=="string"&&na.has(o)))}let i=ur(e.features);if(i){let r={};for(let o of ta)typeof i[o]=="boolean"&&(r[o]=i[o]);Object.keys(r).length>0&&(t.features=r)}return t}function ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0}function np(e,t){return Array.isArray(e)&&e.every(n=>typeof n=="string"&&t.has(n))}function hA(e={},t={}){return{persona:{enabled:t.persona?.enabled??e.persona?.enabled??!0},tools:zs(t.tools??e.tools),builtinTools:zs(t.builtinTools??e.builtinTools),skills:zs(t.skills??e.skills),features:{mavis:t.features?.mavis??e.features?.mavis??!0,delegation:t.features?.delegation??e.features?.delegation??!0,webSearch:t.features?.webSearch??e.features?.webSearch??!0}}}function yA(e,t){return e.tools===void 0||e.tools.includes(t)}function gA(e,t){return e.builtinTools===void 0||e.builtinTools.includes(t)}function bA(e,t){return e.skills===void 0||e.skills.includes(t)}function zs(e){return e===void 0?void 0:[...e]}function Zs(e,t){return(e==null||typeof e!="object"||Array.isArray(e))&&ce(t,"must be an object"),e}function ea(e,t,n){for(let i of Object.keys(e))t.has(i)||ce(`${n}.${i}`,"is not supported")}function ce(e,t){throw new Error(`Invalid configuration at ${e}: ${t}`)}var aa={enabled:!0};function ap(e,t=aa){let n=e.askUser;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled}}var We={enabled:!0,enabledSource:"default"};function la(e,t=We){let n=e.dataContribution;if(n==null||typeof n!="object"||Array.isArray(n))return{...t,enabledSource:"default"};let i=n,r=typeof i.enabled=="boolean";return{enabled:r?i.enabled:t.enabled,enabledSource:r?"explicit":"default"}}function lp(e){try{let t=e()?.dataContribution?.enabled;return typeof t=="boolean"?t:We.enabled}catch{return We.enabled}}var fp=["none","evaluator","subagent"],dp=["brief","transcript"],pp=["same-route-small-fast"],mp="goal-verifier-readonly",hp=[mp],he={budget:{graceSteps:1},breaker:{repeatedReplyLimit:3},verifier:{repeatedNotMetLimit:5,evidence:"brief"},evaluator:{modelPolicy:"same-route-small-fast",maxTokens:32e3,timeoutSeconds:60,maxRetries:1}},ca={budget:{graceSteps:3},evaluator:{maxRetries:1}};function ua(e){let t=[],n=qt(e,"goal",t);$t(n,"goal",t,["objectiveMaxChars","verification","budget","breaker","verifier","evaluator","subagent"]);let i=qt(n.budget,"goal.budget",t);$t(i,"goal.budget",t,["defaultTokens","defaultMainTurns","defaultActiveSeconds","graceSteps"]);let r=qt(n.breaker,"goal.breaker",t);$t(r,"goal.breaker",t,["repeatedReplyLimit"]);let o=qt(n.verifier,"goal.verifier",t);$t(o,"goal.verifier",t,["repeatedNotMetLimit","evidence"]);let s=qt(n.evaluator,"goal.evaluator",t);$t(s,"goal.evaluator",t,["modelPolicy","maxTokens","timeoutSeconds","maxRetries"]);let a=qt(n.subagent,"goal.subagent",t);$t(a,"goal.subagent",t,["profile","maxTurns","maxTokens","timeoutSeconds"]);let l=up(n.verification,"goal.verification",fp,t),c=ut(n.objectiveMaxChars,"goal.objectiveMaxChars",t,{min:1}),u=ut(i.defaultTokens,"goal.budget.defaultTokens",t,{min:1}),f=ut(i.defaultMainTurns,"goal.budget.defaultMainTurns",t,{min:1}),d=ut(i.defaultActiveSeconds,"goal.budget.defaultActiveSeconds",t,{min:1}),p=up(a.profile,"goal.subagent.profile",hp,t),y=ut(a.maxTurns,"goal.subagent.maxTurns",t,{min:1}),m=ut(a.maxTokens,"goal.subagent.maxTokens",t,{min:1}),h=ut(a.timeoutSeconds,"goal.subagent.timeoutSeconds",t,{min:1}),g={...p!==void 0?{profile:p}:{},...y!==void 0?{maxTurns:y}:{},...m!==void 0?{maxTokens:m}:{},...h!==void 0?{timeoutSeconds:h}:{}};return{config:{...c!==void 0?{objectiveMaxChars:c}:{},...l!==void 0?{verification:l}:{},budget:{...u!==void 0?{defaultTokens:u}:{},...f!==void 0?{defaultMainTurns:f}:{},...d!==void 0?{defaultActiveSeconds:d}:{},graceSteps:jt(i.graceSteps,"goal.budget.graceSteps",he.budget.graceSteps,t,{min:0,max:ca.budget.graceSteps})},breaker:{repeatedReplyLimit:jt(r.repeatedReplyLimit,"goal.breaker.repeatedReplyLimit",he.breaker.repeatedReplyLimit,t,{min:1})},verifier:{repeatedNotMetLimit:jt(o.repeatedNotMetLimit,"goal.verifier.repeatedNotMetLimit",he.verifier.repeatedNotMetLimit,t,{min:1}),evidence:cp(o.evidence,"goal.verifier.evidence",dp,he.verifier.evidence,t)},evaluator:{modelPolicy:cp(s.modelPolicy,"goal.evaluator.modelPolicy",pp,he.evaluator.modelPolicy,t),maxTokens:jt(s.maxTokens,"goal.evaluator.maxTokens",he.evaluator.maxTokens,t,{min:1}),timeoutSeconds:jt(s.timeoutSeconds,"goal.evaluator.timeoutSeconds",he.evaluator.timeoutSeconds,t,{min:1}),maxRetries:jt(s.maxRetries,"goal.evaluator.maxRetries",he.evaluator.maxRetries,t,{min:0,max:ca.evaluator.maxRetries})},...Object.keys(g).length>0?{subagent:g}:{}},warnings:t}}function qt(e,t,n){return e===void 0?{}:e===null||typeof e!="object"||Array.isArray(e)?(n.push(He(t,"expected an object; using defaults")),{}):e}function $t(e,t,n,i){for(let r of Object.keys(e))i.includes(r)||n.push(He(`${t}.${r}`,"unknown key ignored"))}function jt(e,t,n,i,r){return e==null?n:!Number.isInteger(e)||e<r.min?(i.push(He(t,`expected an integer >= ${r.min}; using default`)),n):r.max!=null&&e>r.max?(i.push(He(t,`exceeds maximum ${r.max}; clamped`)),r.max):e}function ut(e,t,n,i){if(e!=null){if(!Number.isInteger(e)||e<i.min){n.push(He(t,`expected an integer >= ${i.min}; ignored`));return}return i.max!=null&&e>i.max?(n.push(He(t,`exceeds maximum ${i.max}; clamped`)),i.max):e}}function cp(e,t,n,i,r){return e==null?i:typeof e!="string"||!n.includes(e)?(r.push(He(t,`expected one of: ${n.join(", ")}; using default`)),i):e}function up(e,t,n,i){if(e!=null){if(typeof e!="string"||!n.includes(e)){i.push(He(t,`expected one of: ${n.join(", ")}; ignored`));return}return e}}function He(e,t){return`Invalid goal config at ${e}: ${t}`}var Ae={enabled:!0,maxInlineKiB:64,mcpDetailsMaxInlineKiB:32,watermarkKiB:256,minSavingsKiB:256,minCandidateKiB:2,keepRecentRounds:5},SA=Math.floor(Number.MAX_SAFE_INTEGER/1024);function fa(e){let t=AA(e)?e:{};return{enabled:typeof t.enabled=="boolean"?t.enabled:Ae.enabled,maxInlineKiB:Mn(t.maxInlineKiB,Ae.maxInlineKiB),mcpDetailsMaxInlineKiB:Mn(t.mcpDetailsMaxInlineKiB,Ae.mcpDetailsMaxInlineKiB),watermarkKiB:Mn(t.watermarkKiB,Ae.watermarkKiB),minSavingsKiB:Mn(t.minSavingsKiB,Ae.minSavingsKiB),minCandidateKiB:Mn(t.minCandidateKiB,Ae.minCandidateKiB),keepRecentRounds:vA(t.keepRecentRounds,Ae.keepRecentRounds)}}function Mn(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=SA?e:t}function vA(e,t){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:t}function AA(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Nn={};function da(e){if(e==null||typeof e!="object"||Array.isArray(e))return{...Nn};let t=Reflect.get(e,"chromePath");return typeof t!="string"||!t.trim()?{...Nn}:{chromePath:t.trim()}}import{isIP as wA}from"node:net";function yp(e){return{enabled:!1,filesystemMode:"full_access"}}function gp(e){return!e.enabled||e.filesystemMode==="full_access"?{enabled:!1,filesystemMode:"full_access"}:{...e}}function ma(e){let t=yp(e);return{enabled:t.enabled,filesystem:{policy:{mode:t.filesystemMode},denyRead:[],denyWrite:[]},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:"open"}}var ha=ma(process.platform),_A=new Set(["read_only","workspace_write","delete_guard","full_access"]),EA=new Set(["deny","allow_all"]);function ya(e,t=process.platform){let n=ma(t);if(e===void 0)return n;let i=Rn(e,"sandbox",["enabled","filesystem","network","localAccess"]),r=i.filesystem===void 0?{}:Rn(i.filesystem,"sandbox.filesystem",["policy","denyRead","denyWrite","allowGitConfig"]),o=r.policy===void 0?{}:Rn(r.policy,"sandbox.filesystem.policy",["mode"]),s=i.network===void 0?{}:Rn(i.network,"sandbox.network",["policy","deniedDomains"]),a=s.policy===void 0?{}:Rn(s.policy,"sandbox.network.policy",["mode"]),l=i.enabled===void 0?n.enabled:xA(i.enabled,"sandbox.enabled"),c=o.mode??(l?"delete_guard":"full_access");if(typeof c!="string"||!_A.has(c))throw new Error(`Invalid sandbox.filesystem.policy.mode "${String(c)}"`);let u=a.mode??n.network.policy.mode;if(typeof u!="string"||!EA.has(u))throw new Error(`Invalid sandbox.network.policy.mode "${String(u)}"`);let f=s.deniedDomains===void 0?[...n.network.deniedDomains]:pa(s.deniedDomains,"sandbox.network.deniedDomains");for(let p of f)kA(p);let d=gp({enabled:l,filesystemMode:c});return{enabled:d.enabled,filesystem:{policy:{mode:d.filesystemMode},denyRead:r.denyRead===void 0?[...n.filesystem.denyRead]:pa(r.denyRead,"sandbox.filesystem.denyRead"),denyWrite:r.denyWrite===void 0?[...n.filesystem.denyWrite]:pa(r.denyWrite,"sandbox.filesystem.denyWrite")},network:{policy:{mode:"allow_all"},deniedDomains:[]},localAccess:i.localAccess===void 0?n.localAccess:i.localAccess==="open"||i.localAccess==="restricted"?i.localAccess:(()=>{throw new Error(`Invalid sandbox.localAccess "${String(i.localAccess)}"`)})()}}function Rn(e,t,n){if(e==null||typeof e!="object"||Array.isArray(e))throw new Error(`Invalid ${t}: expected object`);let i=e,r=Object.keys(i).find(o=>!n.includes(o));if(r)throw new Error(`Unknown ${t}.${r}`);return i}function xA(e,t){if(typeof e!="boolean")throw new Error(`Invalid ${t}: expected boolean`);return e}function pa(e,t){if(!Array.isArray(e)||e.some(n=>typeof n!="string"))throw new Error(`Invalid ${t}: expected string array`);return[...e]}function kA(e){let t=()=>{throw new Error(`Invalid sandbox.network.deniedDomains entry "${e}"`)},n=e.match(/^\[([^\]]+)\](?::(.+))?$/);if(n){wA(n[1]??"")!==6&&t(),bp(n[2],e);return}(e.match(/:/g)??[]).length>1&&t();let i=e.lastIndexOf(":"),r=i>-1?e.slice(0,i):e,o=i>-1?e.slice(i+1):void 0;bp(o,e),r!=="*"&&(CA(r)||t())}function CA(e){if(e.includes("://")||e.includes("/")||e.includes(":"))return!1;if(e==="localhost")return!0;if(e.startsWith("*.")){let n=e.slice(2).split(".");return n.length>=2&&n.every(i=>i.length>0)}return e.includes("*")?!1:e.includes(".")&&!e.startsWith(".")&&!e.endsWith(".")}function bp(e,t){if(e===void 0)return;let n=Number(e);if(!/^[1-9][0-9]{0,4}$/.test(e)||!Number.isInteger(n)||n>65535)throw new Error(`Invalid sandbox.network.deniedDomains entry "${t}"`)}var fr={maxConcurrentPerSession:4};function ga(e){let n=(e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}).maxConcurrentPerSession;return{maxConcurrentPerSession:typeof n=="number"&&Number.isSafeInteger(n)&&n>0?n:fr.maxConcurrentPerSession}}function Sp(e,t){return t.length===0?!1:t.includes("*")?!0:t.includes(e)}function LA(){return process.env.__MAVIS_ALLOW_LEGACY_RUNTIME_ENV==="1"}var vp={dev:"test",test:"test",staging:"staging",prod:"prod"};function MA(e){return e==="cn"||e==="en"}function kp(e){return e==="test"||e==="prod"||e==="dev"||e==="staging"}function Cp(){let e=process.env.MAVIS_REGION;if(MA(e))return e;if(pr()){let t=process.env.NEXT_PUBLIC_LOCALE;if(t==="zh")return"cn";if(t==="en")return"en"}return"en"}function Te(){let e=process.env.MAVIS_BUILD_ENV;if(kp(e))return e;if(pr()){let t=process.env.NEXT_PUBLIC_BUILD_ENV,n=t&&Object.prototype.hasOwnProperty.call(vp,t)?vp[t]:void 0;if(n)return n}return"dev"}function dr(){if(Tp("managed"))return!0;let e=process.env.__MAVIS_RUNTIME_MANAGED;return e==="1"?!0:e==="0"?!1:!!(pr()||Te()==="prod"||Te()==="staging")}function pr(){let e=process.versions;return process.env.ELECTRON_RUN_AS_NODE==="1"||typeof e.electron=="string"}function mr(){return`${Cp()}-${Te()}`}var Ce={none:0,test:1,internal:2,online:3},NA={internal:"internal",inside:"online"};function RA(e){for(let[t,n]of Object.entries(e)){if(Ce[n.defaultVisibility]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultVisibility (${n.defaultVisibility}) must not exceed configurableVisibility (${n.configurableVisibility})`);for(let i of n.defaultBuildVariants??[]){let r=NA[i];if(Ce[r]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultBuildVariant (${i}) must not exceed configurableVisibility (${n.configurableVisibility})`)}for(let i of n.defaultBuildEnvironments??[])if(Ce[i==="prod"?"online":"test"]>Ce[n.configurableVisibility])throw new Error(`Invalid beta feature definition "${t}": defaultBuildEnvironment (${i}) must not exceed configurableVisibility (${n.configurableVisibility})`)}}var Fn={autoMemory:{defaultVisibility:"online",configurableVisibility:"online"},skillEvolve:{defaultVisibility:"test",configurableVisibility:"online"},skillEvolveBuiltinMr:{defaultVisibility:"none",configurableVisibility:"test"},skillProposal:{defaultVisibility:"test",configurableVisibility:"online"},browserBridge:{defaultVisibility:"test",configurableVisibility:"online"},filePanelBrowser:{defaultVisibility:"online",configurableVisibility:"online"},filePanelBrowserMultiTab:{defaultVisibility:"online",configurableVisibility:"online"},browserUseTooling:{defaultVisibility:"online",configurableVisibility:"online"},browserUseAutoOpenPanel:{defaultVisibility:"online",configurableVisibility:"online"},browserAgentCursor:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanMode:{defaultVisibility:"online",configurableVisibility:"online"},desktopPlanModeAgentEntry:{defaultVisibility:"none",configurableVisibility:"online"},peek:{defaultVisibility:"test",configurableVisibility:"test"},keepAlive:{defaultVisibility:"test",configurableVisibility:"test"},promptOverride:{defaultVisibility:"test",configurableVisibility:"test"},asr:{defaultVisibility:"online",configurableVisibility:"online"},taskHistoryProjectGrouping:{defaultVisibility:"online",configurableVisibility:"online"},threadGoal:{defaultVisibility:"online",configurableVisibility:"online"},mcodeTools:{defaultVisibility:"none",defaultBuildEnvironments:["dev","test","staging","prod"],defaultPlatforms:["darwin","linux","win32"],configurableVisibility:"online"},codexOAuth:{defaultVisibility:"online",configurableVisibility:"online"}};RA(Fn);function PA(e){return(e.buildEnv??Te())!=="prod"?"test":e.internalBuild===!0?"internal":"online"}function FA(e,t){let n=e.defaultBuildVariants;return n?t.internalBuild===!0&&n.includes("internal")||t.insideBuild===!0&&n.includes("inside"):!1}function DA(e,t){let n=t.defaultBuildEnvironment??t.buildEnv??Aa();return e.defaultBuildEnvironments?.includes(n)===!0}function Aa(){let e=pr()?process.env.NEXT_PUBLIC_BUILD_ENV:void 0;return kp(e)?e:Te()}function Ap(e,t){return e.defaultPlatforms?.includes(t.platform??process.platform)!==!1}function wa(e,t,n={}){let i=Fn[e],r=Ce[PA(n)],o=n.defaultBuildEnvironment??n.buildEnv??Aa();return e==="mcodeTools"&&o==="dev"&&n.mcodeToolsDevMode==="published"&&Ap(i,n)?!0:t===!1?!1:t===!0?r<=Ce[i.configurableVisibility]:Ap(i,n)?DA(i,n)||FA(i,n)?!0:r<=Ce[i.defaultVisibility]:!1}function BA(e){return Fn[e].configurableVisibility==="online"}function _a(e=process.env){return e.__MAVIS_BUILD_INTERNAL==="true"}function qA(e=process.env){return e.__MAVIS_BUILD_INSIDE==="true"}var $A={APP_DIR:".minimax",ENV_PREFIX:"minimax",CLI_NAME:"minimax"},Op="__MAVIS_RUNTIME";function hr(e){return LA()?process.env[`${Op}_${e}`]:void 0}function yr(e){let t=`--${e}`;for(let n=2;n<process.argv.length;n++){let i=process.argv[n];if(i===t)return process.argv[n+1];if(i?.startsWith(`${t}=`))return i.slice(t.length+1)}}function Tp(e){let t=`--${e}`;return process.argv.slice(2).some(n=>n===t||n.startsWith(`${t}=`))}var Ut=5321,Sa=5001,ba=65535,Ip=500,Ea=2,jA=Ip*Ea,Lp=jA+Ea,wp=1,UA=new Set(["agent-archon","mavis"]),_p=(()=>{let t=new Uint32Array(256);for(let n=0;n<256;n++){let i=n<<24;for(let r=0;r<8;r++)i=(i&2147483648)!==0?79764919^i<<1:i<<1,i>>>=0;t[n]=i>>>0}return t})();function KA(e){let t=Buffer.from(`${e}
|
|
191
|
+
`,"utf-8"),n=0;for(let r of t)n=(_p[(n>>>24^r)&255]^n<<8)>>>0;let i=t.length;for(;i!==0;)n=(_p[(n>>>24^i&255)&255]^n<<8)>>>0,i>>>=8;return(n^4294967295)>>>0}function VA(e){return KA(e)%Ip*Ea+2}function Ep(e,t){try{let n=TA("git",e,{encoding:"utf-8",timeout:3e3,stdio:["ignore","pipe","pipe"],...t?{cwd:t}:{}});return n.status===0&&n.stdout?n.stdout.trim():null}catch{return null}}function YA(e){return e.match(/[/:]([^/:]+?)(?:\.git)?$/)?.[1]??null}function Mp(){return process.env.MINIMAX_DATA_DIR?.trim()||process.env.MAVIS_DATA_DIR?.trim()}function gr(){return!(Tp("disable-git-auto-config")||hr("DISABLE_GIT_AUTO_CONFIG")||yr("data-dir")||Mp())}function br(){let e=yr("profile")??hr("PROFILE");return e&&e.length>0?e:null}function Np(){let e=yr("port")??hr("PORT"),t=e?parseInt(e,10):NaN;return Number.isNaN(t)?null:t}function va(){let e=yr("data-dir")??Mp()??hr("DATA_DIR");return e&&e.length>0?e:null}function GA(){return!!(br()&&va())}function Rp(){return!!(br()&&Np()!==null)}var ft=null;function WA(){ft=null}function dt(){if(ft!==null)return ft;let e={runtimePort:Ut,uiPort:Sa,profile:null,autoDetected:!1};return ft=e,e}function HA(){try{if(typeof __dirname=="string")return __dirname}catch{}let e=new Error().stack??"";for(let t of e.split(`
|
|
192
|
+
`)){let n=/file:\/\/[^)\s]+/u.exec(t)?.[0]?.replace(/:\d+:\d+$/u,"");if(n)try{return oe.dirname(IA(n))}catch{}let i=/\(?((?:\/|[A-Za-z]:\\)[^()]+?\.(?:cjs|mjs|js|ts)):\d+:\d+\)?/u.exec(t)?.[1];if(i)return oe.dirname(i)}}function JA(){let e=br();return e||(gr()?dt().profile:null)}function xa(){let e=br();if(GA())return va();if(gr()){let n=dt();if(n.autoDetected&&n.profile)return Ge({profile:n.profile})}let t=va();return t||(e?Ge({profile:e}):Ge())}function Kt(){return oe.join(xa(),"config.yaml")}var Sr={"cn-test":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","cn-dev":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","cn-staging":"https://agent.minimaxi.com/mavis/api/v1/llm/v1","en-test":"https://agent.minimax.io/mavis/api/v1/llm/v1","en-dev":"https://agent.minimax.io/mavis/api/v1/llm/v1","en-staging":"https://agent.minimax.io/mavis/api/v1/llm/v1","cn-prod":"https://agent.minimax.cn/mavis/api/v1/llm/v1","en-prod":"https://agent.minimax.io/mavis/api/v1/llm/v1"},Pp=["https://agent.minimaxi.com/mavis/api/v1/llm/v1"],XA=new Set([...Object.values(Sr),...Pp]),QA=new Set([...Object.values(Sr),...Pp].map(e=>new URL(e).origin));function Fp(e){if(XA.has(e))return!0;try{let t=new URL(e);return!t.username&&!t.password&&QA.has(t.origin)}catch{return!1}}function Dp(){return Te()==="test"}function zA(){return!Dp()}function ZA(e){if(!dr()||!Oe.existsSync(e))return;let t=Bp(e),{provider:n}=t;if(n==null||typeof n!="object"||Array.isArray(n))return;let{minimax:i}=n;if(i==null||typeof i!="object"||Array.isArray(i))return;let{options:r}=i;if(r==null||typeof r!="object"||Array.isArray(r))return;let o=r.baseURL;if(typeof o!="string")return;let s=Sr[mr()];if(o===s||!Fp(o))return;let a=Oe.readFileSync(e);r.baseURL=s;try{let l=a.toString("utf-8");it(e,Ln(l,er(l),t))}catch(l){let c=!1;try{c=Oe.readFileSync(e).equals(a)}catch{}if(!c)throw l;console.warn("[config] managed preset baseURL sync skipped; config file unchanged, using runtime provider settings")}}function Je(e){return{provider:{minimax:{name:"MiniMax",npm:"@ai-sdk/anthropic",options:{authMode:"managed-login",apiKey:"sk-xxx",baseURL:Sr[e]},models:_t}},defaultModel:"minimax/MiniMax-M3"}}var ka={"cn-test":Je("cn-test"),"cn-dev":Je("cn-dev"),"cn-staging":Je("cn-staging"),"cn-prod":Je("cn-prod"),"en-test":Je("en-test"),"en-dev":Je("en-dev"),"en-staging":Je("en-staging"),"en-prod":Je("en-prod")},J={logLevel:"info",devPort:Sa,permissionMode:"auto",sseErrorPush:{history:!0,stream:!0},beta:Object.fromEntries(Object.keys(Fn).map(e=>[e,wa(e,void 0,{buildEnv:"dev"})])),agents:{default:{}},memory:{enabled:!0,proactive:!1,dailyDigest:{enabled:!1},v2:{...tr}},subagent:{...fr},skillEvolve:{enabled:!0,inSession:{N:20,minIntervalSeconds:30,maxPendingPerSession:1},signalCooldownHours:24,minConfidence:.7,excludeAgents:["skill-editor"],disableModelPrefixes:["MiniMax-M2"],builtinMrEnabled:!1,sourceRepo:void 0,proposal:{enabled:!1,eligibleAgents:["mavis"],minMessageCount:40,skipPassiveSessionEnd:!0},lifecycle:{staleThresholdDays:15,archiveThresholdDays:30}},sessionRotate:{enabled:!0,activeSessionLookbackHours:12},agentStop:{debounceMs:500,maxActiveSpanMs:1800*1e3},asr:{...sr},skills:lr,askUser:{...aa},dataContribution:{...We},sessionTitle:{enabled:!0},cli:{spawn:{enabled:!1}},browser:{...Nn},tui:{},opencode:{xdg:{dataIsolation:!1,startupImport:"off"},keepAlive:{enabled:!1,maxProcesses:5,maxLifetimeMs:288e5,agents:["mavis","main","verifier","code-reviewer"]},spawnConcurrency:3},contextManagement:{disableSystemReminderModels:[],cuMaxScreenshotsInContext:2},runawayGuard:{enabled:!0},toolResultCompaction:{...Ae},agentRuntime:{defaultFramework:Dt},logRetentionDays:3,worktreeRefreshBeforeCreate:!0,review:{mode:"subagent",turnDiffCard:"concise",modeSource:"default"},goal:structuredClone(he),sandbox:structuredClone(ha),goalWarnings:[]};function ew(){let e=Kt(),t=oe.dirname(e);if(Oe.existsSync(t)||Oe.mkdirSync(t,{recursive:!0}),Oe.existsSync(e)){Oa(e);return}if(!dr()){let r=Ge({homeDir:OA.homedir()}),o=oe.join(r,"config.yaml");e!==o&&Oe.existsSync(o)&&(Et(o),it(e,Oe.readFileSync(o),!0));return}let n=ka[mr()],i=W.dump({logLevel:J.logLevel,provider:Ca?n.provider:void 0,defaultModel:n.defaultModel,dataContribution:{enabled:We.enabled},memory:{enabled:!1}});it(e,i,!0)}function Bp(e=Kt()){return er(tw(e))}function tw(e=Kt()){try{return Oe.readFileSync(e,"utf-8")}catch{return""}}var Pn=null;function nw(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let t=e;return{branchFinish:typeof t.branchFinish=="boolean"?t.branchFinish:!1}}var qp={isManagedRuntime:dr,shouldEnforceManagedProviderProtection:zA,getManagedPreset:()=>ka[mr()],isManagedPresetBaseUrl:Fp},$p=!0,Ca=!0;function iw(e){$p=e}function rw(e){Ca=e}function Oa(e){Et(e),Fd(e),$p&&Rd(e,qp),Ca&&ZA(e)}function vr(){Pn=null}function Ar(){if(Pn)return Pn;ew();let e=Bp();return Pn=Ta(e,xa()),Pn}function Ta(e,t){let n=e.sseErrorPush,i=n!=null&&typeof n=="object"&&!Array.isArray(n)?n:void 0,r=typeof e.devPort=="number"?e.devPort:J.devPort;if(gr()&&!Rp()){let c=dt();c.autoDetected&&(r=c.uiPort)}let o=ua(e.goal),s=Pd({provider:e.provider!=null&&typeof e.provider=="object"&&!Array.isArray(e.provider)?Id(e.provider):{},defaultModel:typeof e.defaultModel=="string"?e.defaultModel:void 0},qp),a=Us(e.minimaxModelContextLimits),l=ow(e);return{logLevel:typeof e.logLevel=="string"?e.logLevel:J.logLevel,devPort:r,...s,provider:Od(s.provider,a),defaultModelVariant:typeof e.defaultModelVariant=="string"?e.defaultModelVariant:void 0,defaultModelThinking:e.defaultModelThinking&&typeof e.defaultModelThinking=="object"&&typeof e.defaultModelThinking.effort=="string"?{effort:e.defaultModelThinking.effort}:void 0,defaultModelContextWindow:Number.isSafeInteger(e.defaultModelContextWindow)&&Number(e.defaultModelContextWindow)>0&&Number(e.defaultModelContextWindow)<=2147483647?Number(e.defaultModelContextWindow):void 0,minimax_api:kd(e.minimax_api),minimaxModelContextLimits:a,custom_provider:Td(e.custom_provider),minimaxModelSource:typeof e.minimaxModelSource=="string"&&(e.minimaxModelSource==="token_plan"||e.minimaxModelSource==="minimax_api_key")?e.minimaxModelSource:void 0,nexus:e.nexus!=null&&typeof e.nexus=="object"&&!Array.isArray(e.nexus)?(()=>{let c={};typeof Reflect.get(e.nexus,"enabled")=="boolean"&&(c.enabled=Reflect.get(e.nexus,"enabled"));let u=Reflect.get(e.nexus,"model");return u!=null&&typeof u=="object"&&!Array.isArray(u)&&typeof Reflect.get(u,"providerID")=="string"&&typeof Reflect.get(u,"modelID")=="string"&&(c.model={providerID:Reflect.get(u,"providerID"),modelID:Reflect.get(u,"modelID"),...typeof Reflect.get(u,"variant")=="string"?{variant:Reflect.get(u,"variant")}:{}}),Object.keys(c).length>0?c:void 0})():void 0,defaultLightModel:typeof e.defaultLightModel=="string"?e.defaultLightModel:void 0,permissionMode:typeof e.permissionMode=="string"&&["default","bypassPermissions","auto","off"].includes(e.permissionMode)?e.permissionMode:J.permissionMode,permission:jd(e),sseErrorPush:{history:typeof i?.history=="boolean"?i.history:J.sseErrorPush.history,stream:typeof i?.stream=="boolean"?i.stream:J.sseErrorPush.stream},notifications:nw(e.notifications),dataDir:t,agentsDir:oe.join(t,"agents"),sessionsDir:oe.join(t,"sessions"),memoryDir:oe.join(t,"memory"),skillsDir:oe.join(t,"skills"),builtinSkillsDir:oe.join(t,".builtin-skills"),logsDir:oe.join(t,"logs"),pluginsDir:oe.join(t,"plugins"),plansDir:oe.join(t,"plans"),harnessesDir:oe.join(t,"harnesses"),subAgentsDir:oe.join(t,"subagents"),beta:l,agents:sa(e.agents),memory:wd(e,J.memory),subagent:ga(e.subagent),skillEvolve:lw(e,l),sessionRotate:cw(e),agentStop:uw(e),asr:$d(e),skills:Vs(e),askUser:ap(e,J.askUser),dataContribution:la(e,J.dataContribution),sessionTitle:fw(e),cli:dw(e),browser:da(e.browser),tui:_d(e),opencode:Bd(e,J.opencode),contextManagement:pw(e),runawayGuard:io(e.runawayGuard),toolResultCompaction:fa(e.toolResultCompaction),agentRuntime:Ys(e.agentRuntime),logRetentionDays:mw(e),contentReview:hw(e),mcpToolSearch:yw(e),review:Dd(e.review,J.review),worktreeRefreshBeforeCreate:e.worktreeRefreshBeforeCreate!==!1,promptConfig:jp(e.promptConfig),goal:o.config,goalWarnings:o.warnings,sandbox:ya(e.sandbox)}}function ow(e){let t=e.beta!=null&&typeof e.beta=="object"&&!Array.isArray(e.beta)?e.beta:{},n={buildEnv:Te(),defaultBuildEnvironment:Aa(),internalBuild:_a(),insideBuild:qA(),mcodeToolsDevMode:process.env.MAVIS_DEV_MCODE_TOOLS_MODE==="published"?"published":void 0},i={};for(let r of Object.keys(Fn))i[r]=wa(r,t[r],n);return i}function sw(e){let t=e.provider;if(t==null||typeof t!="object"||Array.isArray(t))return[];let n=[];for(let i of Object.values(t)){if(i==null||typeof i!="object"||Array.isArray(i))continue;let{models:r}=i;r==null||typeof r!="object"||Array.isArray(r)||n.push(...Object.keys(r))}return n}function aw(e,t){if(t.length===0)return!0;let n=sw(e);if(n.length===0)return!1;let i=t.map(r=>r.toLowerCase());return!n.every(r=>i.some(o=>r.toLowerCase().startsWith(o)))}function xp(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function lw(e,t){let n=J.skillEvolve,i=e.skillEvolve,o=i!=null&&typeof i=="object"&&!Array.isArray(i)?i:{},s=o.inSession,{inSession:a}=n;if(s!=null&&typeof s=="object"&&!Array.isArray(s)){let E=s;a={N:typeof E.N=="number"&&E.N>0?E.N:n.inSession.N,minIntervalSeconds:typeof E.minIntervalSeconds=="number"&&E.minIntervalSeconds>=0?E.minIntervalSeconds:n.inSession.minIntervalSeconds,maxPendingPerSession:typeof E.maxPendingPerSession=="number"&&E.maxPendingPerSession>=1?E.maxPendingPerSession:n.inSession.maxPendingPerSession}}let l=o.excludeAgents,c=Array.isArray(l)&&l.every(E=>typeof E=="string")?l:n.excludeAgents,u=Array.isArray(o.disableModelPrefixes)&&o.disableModelPrefixes.every(E=>typeof E=="string")?o.disableModelPrefixes:n.disableModelPrefixes,f=t.skillEvolve?typeof o.enabled=="boolean"?o.enabled:aw(e,u):!1,d=f&&t.skillEvolveBuiltinMr?typeof o.builtinMrEnabled=="boolean"?o.builtinMrEnabled:n.builtinMrEnabled:!1,p=o.sourceRepo,y=typeof p=="string"&&p.trim().length>0?p.trim():n.sourceRepo,m=o.proposal,h=n.proposal,g=m!=null&&typeof m=="object"&&!Array.isArray(m)?m:{},b=Array.isArray(g.eligibleAgents)&&g.eligibleAgents.every(E=>typeof E=="string")?g.eligibleAgents:h.eligibleAgents,v=typeof g.minMessageCount=="number"&&g.minMessageCount>=1?Math.floor(g.minMessageCount):h.minMessageCount,x=typeof g.skipPassiveSessionEnd=="boolean"?g.skipPassiveSessionEnd:h.skipPassiveSessionEnd,k=typeof g.enabled=="boolean"?g.enabled:null,C=f&&t.skillProposal?k??!0:!1,L=o.lifecycle,w=L&&typeof L=="object"&&!Array.isArray(L)?L:{},A=xp(w.staleThresholdDays,n.lifecycle.staleThresholdDays),O=xp(w.archiveThresholdDays,n.lifecycle.archiveThresholdDays);if(!(A<O))throw new Error(`Invalid skillEvolve.lifecycle config: staleThresholdDays (${A}) must be strictly less than archiveThresholdDays (${O}).`);return{enabled:f,inSession:a,signalCooldownHours:typeof o.signalCooldownHours=="number"&&o.signalCooldownHours>0?o.signalCooldownHours:n.signalCooldownHours,minConfidence:typeof o.minConfidence=="number"&&o.minConfidence>=0&&o.minConfidence<=1?o.minConfidence:n.minConfidence,scannerModel:typeof o.scannerModel=="string"?o.scannerModel:void 0,excludeAgents:c,disableModelPrefixes:u,builtinMrEnabled:d,sourceRepo:y,proposal:{enabled:C,eligibleAgents:b,minMessageCount:v,skipPassiveSessionEnd:x},lifecycle:{staleThresholdDays:A,archiveThresholdDays:O}}}function cw(e){let t=J.sessionRotate,n=e.sessionRotate;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.activeSessionLookbackHours;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled,activeSessionLookbackHours:typeof r=="number"&&Number.isFinite(r)&&r>0?r:t.activeSessionLookbackHours}}function uw(e){let t=J.agentStop,n=e.agentStop;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n,r=i.debounceMs,o=i.maxActiveSpanMs;return{debounceMs:typeof r=="number"&&Number.isFinite(r)&&r>=0?r:t.debounceMs,maxActiveSpanMs:typeof o=="number"&&Number.isFinite(o)&&o>=0?o:t.maxActiveSpanMs}}function jp(e){let t=Te()==="prod"&&!_a();if(e==null||typeof e!="object"||Array.isArray(e))return{autoUpdate:t};let n=e.autoUpdate;return{autoUpdate:typeof n=="boolean"?n:t}}function fw(e){let t=J.sessionTitle,n=e.sessionTitle;if(n==null||typeof n!="object"||Array.isArray(n))return{...t};let i=n;return{enabled:typeof i.enabled=="boolean"?i.enabled:t.enabled}}function dw(e){let t=J.cli,n=e.cli;if(n==null||typeof n!="object"||Array.isArray(n))return{spawn:{...t.spawn}};let i=n.spawn;if(i==null||typeof i!="object"||Array.isArray(i))return{spawn:{...t.spawn}};let r=i;return{spawn:{enabled:typeof r.enabled=="boolean"?r.enabled:t.spawn.enabled}}}function pw(e){let t=J.contextManagement,n=e.contextManagement;if(n==null||typeof n!="object"||Array.isArray(n))return{disableSystemReminderModels:[...t.disableSystemReminderModels],cuMaxScreenshotsInContext:t.cuMaxScreenshotsInContext};let i=n,r=i.disableSystemReminderModels,o=Array.isArray(r)&&r.every(l=>typeof l=="string"&&l.length>0)?r:[...t.disableSystemReminderModels],s=i.cuMaxScreenshotsInContext,a=typeof s=="number"&&Number.isFinite(s)&&s>=0?Math.floor(s):t.cuMaxScreenshotsInContext;return{disableSystemReminderModels:o,cuMaxScreenshotsInContext:a}}function mw(e){let t=e.logRetentionDays;return typeof t=="number"&&t>=1&&Number.isFinite(t)?Math.floor(t):J.logRetentionDays}function hw(e){let t=e.contentReview;if(t==null||typeof t!="object"||Array.isArray(t))return;let n={},i=Reflect.get(t,"enabled");typeof i=="boolean"&&(n.enabled=i);let r=Reflect.get(t,"testBaseURL");return typeof r=="string"&&r.trim()&&(n.testBaseURL=r.trim()),Object.keys(n).length>0?n:void 0}function yw(e){let t=e.mcpToolSearch;if(t==null||typeof t!="object"||Array.isArray(t))return;let n={},i=Reflect.get(t,"enabled");typeof i=="boolean"&&(n.enabled=i);let r=Reflect.get(t,"systemHint");typeof r=="boolean"&&(n.systemHint=r);let o=Reflect.get(t,"thresholdPct");typeof o=="number"&&(n.thresholdPct=o);let s=Reflect.get(t,"minDeferCount");typeof s=="number"&&(n.minDeferCount=s);let a=Reflect.get(t,"topKDefault");typeof a=="number"&&(n.topKDefault=a);let l=Reflect.get(t,"topKMax");typeof l=="number"&&(n.topKMax=l);let c=Reflect.get(t,"maxSchemaTextLen");typeof c=="number"&&(n.maxSchemaTextLen=c);let u=Reflect.get(t,"modelWhitelist");return Array.isArray(u)&&(n.modelWhitelist=u.filter(f=>typeof f=="string")),Object.keys(n).length>0?n:void 0}function Up(){let e=Np();if(gr()&&!Rp()){let t=dt();if(t.autoDetected)return t.runtimePort}return e??Ut}function gw(e=Up()){let t=e+Lp;if(t<=ba)return t;let n=e+wp;if(n<=ba)return n;throw new Error(`Cannot allocate an OpenCode sidecar port for runtime port ${String(e)}; choose a runtime port <= ${String(ba-wp)}.`)}var bw=["agent.minimaxi.com","agent.minimaxi.com","agent.minimax.io","agent.minimax.io","agent.minimax.io","agent.minimax.cn","agent.minimaxi.com"],Sw=new Set(bw.map(e=>`https://${e}`));function vw(e,t){return/^custom_provider:minimax-legacy(?:-\d+)?$/u.test(e)&&(!t||Ia(t))}function Ia(e){try{let t=new URL(e);return t.username||t.password?!1:Sw.has(t.origin.toLowerCase())}catch{return!1}}function Aw(e){if(!(e!=="managed-login"&&e!=="api-key"&&e!=="oauth"))return e}function La(e){let t=typeof e?.baseURL=="string"?e.baseURL.trim():"",n=t.length>0&&Ia(t),i=Aw(e?.authMode),r=[];return typeof e?.authMode=="string"&&!i&&r.push(`Unknown provider authMode "${e.authMode}"; falling back to compatibility resolution.`),i?(i==="managed-login"&&t.length>0&&!n&&!e?.allowManagedBaseURLOverride&&r.push("Provider authMode is managed-login but baseURL is not a known managed MiniMax host."),{authMode:i,source:"explicit",managedBaseURL:n,warnings:r}):n?(r.push("Provider authMode is inferred from a managed MiniMax baseURL; set options.authMode: managed-login to make this explicit."),{authMode:"managed-login",source:"inferred-managed-base-url",managedBaseURL:n,warnings:r}):{authMode:"api-key",source:"default-api-key",managedBaseURL:n,warnings:r}}var Ie="minimax",Vt="minimax_api",Ma="custom_provider:";function ww(e,t){return e==="anthropic-messages"&&(t===Ie||t===Vt)}function Na(e,t){if(t===Vt)return"minimax_api_key";if(t.startsWith(Ma))return"custom_provider";if(t!==Ie)return"configured_provider";if(e.minimaxModelSource==="minimax_api_key")return"minimax_api_key";let n=e.provider?.[t]?.options;return La({authMode:n?.authMode,baseURL:n?.baseURL}).authMode==="managed-login"?"managed_token_plan":"configured_provider"}function Kp(e,t,n){switch(Na(e,t)){case"managed_token_plan":return wr(e.provider?.[t],!0);case"minimax_api_key":{let r=e.provider?.[Ie];return wr({...r,models:r?.models??_t},!0)}case"custom_provider":{let r=e.custom_provider?.[t.slice(Ma.length)];return!r||r.enabled===!1?[]:wr(r)}case"configured_provider":return wr(e.provider?.[t])}}function _w(e){let t=Na(e.config,e.providerId),n=e.modelId.trim();return n.length>0&&Kp(e.config,e.providerId,e.preset).includes(n)?{available:!0,route:t}:{available:!1,route:t,code:e.source==="config_default"?"DEFAULT_MODEL_NOT_AVAILABLE_FOR_ROUTE":"MODEL_NOT_AVAILABLE_FOR_ROUTE",message:`Model "${e.providerId}/${e.modelId}" is not available for the "${t}" route (preset ${e.preset}).`}}function wr(e,t=!1){let n=Object.entries(e?.models??{}).filter(([,s])=>s?.enabled!==!1).map(([s])=>s),i=e?.model_order;if(!t||!Array.isArray(i)||!i.every(s=>typeof s=="string"))return n;let r=new Set(n);return[...i.filter(s=>r.delete(s)),...n.filter(s=>r.has(s))]}var Ew=/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/;function Ra(e){if(typeof e=="string")return Ew.exec(e.trim())?.[1]}function Vp(e){let{field:t,provider:n,value:i}=e;if(i==null)return;if(typeof i!="string")throw new Error(`Provider "${n}": ${t} must be a string or a \`\${NAME}\` environment variable reference, received ${Cw(i)}.`);let r=i.trim();if(!r)return;let o=Ra(r);if(!o)return r;let s=(e.env??process.env)[o]?.trim();if(!s)throw new Error(`Provider "${n}": ${t} references environment variable "${o}", which is not set.`);return s}function xw(e){if(!(typeof e.value=="string"&&e.value.trim().length>0))return{configured:!1};let n=kw(e.value)?"env":"plaintext";try{let i=Vp(e);return{configured:!0,source:n,...i?{secret:i}:{}}}catch{return{configured:!0,source:n}}}function kw(e){return Ra(e)!==void 0}function Cw(e){return Array.isArray(e)?"a list":`a ${typeof e}`}import{randomBytes as Ow}from"node:crypto";import pt,{readFileSync as Tw}from"node:fs";import{dirname as Yp,join as Iw}from"node:path";var Gp=kr(to(),1);var Fa=384,_r=new Set(["__proto__","prototype","constructor"]),Lw=["minimax_api","custom_provider"];async function Mw(e){let t=e.trim();if(!t||t.includes(".")||_r.has(t))throw new ne("Invalid provider id");return Bn(async n=>(ye(n.provider)&&delete n.provider[t],{write:!0,value:void 0})).then(({config:n})=>({config:n}))}async function Nw(e){if(!ye(e)||!ye(e.models))throw new ne("Invalid managed MiniMax provider snapshot");return Er(e),Bn(async t=>(t.provider={...ye(t.provider)?t.provider:{},[Ie]:structuredClone(e)},{write:!0,value:void 0})).then(({config:t})=>({config:t}))}var ne=class extends Error{name="LocalModelProviderConfigValidationError"},Dn=class extends Error{name="LocalModelProviderConfigWriteError";constructor(){super("Local runtime failed to update config file")}};async function Rw(e){return Bn(async(t,n)=>{let i={minimax_api:ye(t.minimax_api)?t.minimax_api:void 0,custom_provider:qw(ye(t.custom_provider)?t.custom_provider:void 0),minimaxModelSource:typeof t.minimaxModelSource=="string"?t.minimaxModelSource:void 0,defaultModel:typeof t.defaultModel=="string"?t.defaultModel:void 0,defaultModelVariant:typeof t.defaultModelVariant=="string"?t.defaultModelVariant:void 0};await e(i,n);for(let r of Lw){let o=i[r];if(o===void 0){delete t[r];continue}if(!ye(o))throw new ne(`Invalid BYOK config subtree "${r}"`);Er(o),t[r]=o}return Pa(t,"minimaxModelSource",i.minimaxModelSource),t.defaultModel!==i.defaultModel&&(delete t.defaultModelThinking,delete t.defaultModelContextWindow),Pa(t,"defaultModel",i.defaultModel),Pa(t,"defaultModelVariant",i.defaultModelVariant),{write:!0,value:void 0}}).then(({config:t})=>({config:t}))}async function Pw(e){let t=e.modelKey.trim();if(!t)throw new ne("Default model must not be empty");if(e.contextLimit!==void 0&&(!Number.isSafeInteger(e.contextLimit)||e.contextLimit<=0||e.contextLimit>2147483647))throw new ne("Invalid default context");if(e.thinking?.effort!==void 0&&(typeof e.thinking.effort!="string"||!e.thinking.effort.trim()))throw new ne("Invalid default effort");return Bn(async n=>(n.defaultModel=t,e.contextLimit===void 0?delete n.defaultModelContextWindow:n.defaultModelContextWindow=e.contextLimit,e.thinking?.effort===void 0?delete n.defaultModelThinking:n.defaultModelThinking={effort:e.thinking.effort},e.variant===void 0?delete n.defaultModelVariant:n.defaultModelVariant=e.variant,{write:!0,value:void 0})).then(({config:n})=>({config:n}))}async function Fw(e,t){let n=e.modelId.trim();if(e.providerId!==Ie&&e.providerId!==Vt||!n||_r.has(n))throw new ne("Invalid MiniMax model context target");let i=await Bn(async(r,o)=>{let s=e.providerId===Ie?o.provider?.[e.providerId]?.models?.[n]:Ks(o)[n];if(e.providerId===Vt&&!s?.contextWindowOptions?.includes(e.contextLimit))throw new ne("Invalid MiniMax API context limit");if(s?.limit?.context!==e.expectedContextLimit)return{write:!1,value:!1};if(!await t(o))return{write:!1,value:!1};let a=e.providerId===Ie?["minimaxModelContextLimits",n]:["minimax_api","modelContextLimits",n];return $w(r,a,e.contextLimit),{write:!0,value:!0}});return{config:i.config,updated:i.value}}async function Bn(e){let t=Kt(),n;try{await pt.promises.mkdir(Yp(t),{recursive:!0}),await pt.promises.writeFile(t,"",{flag:"a",mode:Fa}),await pt.promises.chmod(t,Fa),n=await Gp.default.lock(t,{stale:1e4,retries:{retries:20,factor:1,minTimeout:5,maxTimeout:25}});let i=Bw(t),r=structuredClone(i);vr();let o=await e(r,Ar());return o.write&&(Er(r),await Dw(t,Ln(Tw(t,"utf-8"),i,r)),vr()),{config:Ar(),value:o.value}}catch(i){throw i instanceof ne||i instanceof Dn?i:new Dn}finally{await n?.().catch(()=>{})}}async function Dw(e,t){let n=Iw(Yp(e),`.config-tmp-${Ow(6).toString("hex")}`),i=!1;try{let r=Fa,o=await pt.promises.open(n,"wx",r);i=!0;try{await o.writeFile(t,"utf-8"),await o.chmod(r)}finally{await o.close()}await pt.promises.rename(n,e)}catch{throw i&&await pt.promises.unlink(n).catch(()=>{}),new Dn}}function Bw(e){let t=pt.readFileSync(e,"utf-8"),n;try{n=W.load(t)}catch{throw new ne("Invalid config.yaml: unable to parse YAML")}if(n==null)return{};if(!ye(n)||Object.getPrototypeOf(n)!==Object.prototype)throw new ne("Invalid config.yaml: expected a YAML mapping");return n}function qw(e){if(e)return Object.fromEntries(Object.entries(e).filter(([,t])=>ye(t)))}function Pa(e,t,n){n===void 0?delete e[t]:e[t]=n}function $w(e,t,n){let i=t.at(-1);if(!i)throw new ne("Invalid config path");let r=e;for(let o of t.slice(0,-1)){if(!o||_r.has(o))throw new ne("Invalid config path");let s=r[o];if(ye(s))r=s;else{let a={};r[o]=a,r=a}}r[i]=n}function Er(e){for(let[t,n]of Object.entries(e)){if(!t||_r.has(t))throw new ne(`Local runtime cannot update config field segment "${t}"`);ye(n)&&Er(n)}}function ye(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Xw(e){let t=e.trim();if(!t)return null;if(t.startsWith("{"))try{let i=JSON.parse(t),r=typeof i.pid=="number"?i.pid:parseInt(String(i.pid),10);if(isNaN(r)||r<=0)return null;let o=Qw(i.owner)?i.owner:"unknown",s=zw(i.startedAt);return{pid:r,owner:o,...s!==void 0?{startedAt:s}:{},...typeof i.mode=="string"?{mode:i.mode}:{},...typeof i.startupToken=="string"?{startupToken:i.startupToken}:{}}}catch{return null}let n=parseInt(t,10);return isNaN(n)||n<=0?null:{pid:n,owner:"unknown"}}function Qw(e){return e==="electron"||e==="cli"||e==="unknown"}function zw(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e!="string")return;let t=new Date(e).getTime();return Number.isFinite(t)?t:void 0}function Zw(e,t){let n={pid:e,owner:t,startedAt:Date.now()};return JSON.stringify(n)}function e_(){let e=process.argv.slice(2);for(let t=0;t<e.length;t++){let n=e[t],i=n==="--owner"?e[t+1]:n?.startsWith("--owner=")?n.slice(8):void 0;if(i==="electron")return"electron";if(i==="service"||i==="cli")return"cli"}return"cli"}import Xe from"node:fs";import t_ from"node:path";var Wp="local-runtime.auth.json";function we(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function Da(e){return e?{...we(e.accessToken)?{accessToken:we(e.accessToken)}:{},...we(e.realUserID)?{realUserID:we(e.realUserID)}:{},...we(e.userEmail)?{userEmail:we(e.userEmail)}:{},...we(e.userName)?{userName:we(e.userName)}:{},...we(e.subUserName)?{subUserName:we(e.subUserName)}:{}}:{}}function xr(e){return t_.join(e,Wp)}function n_(e){try{let t=Xe.readFileSync(xr(e),"utf-8"),n=JSON.parse(t);if(n.version!==1||!n.auth||typeof n.auth!="object")return;let i=Da(n.auth);return i.accessToken?i:void 0}catch{return}}function i_(e,t,n={}){let i=xr(e),r=Da(t);if(!r.accessToken)return Hp(e),{path:i,written:!1};Xe.mkdirSync(e,{recursive:!0,mode:448});let o={version:1,updatedAtMs:Date.now(),auth:r},s=`${i}.${process.pid}.${Date.now()}.tmp`;return Xe.writeFileSync(s,`${JSON.stringify(o,null,2)}
|
|
193
|
+
`,{encoding:"utf-8",mode:384}),n.retryWindowsFileSystem?(Cr(()=>Xe.renameSync(s,i)),Cr(()=>Xe.chmodSync(i,384))):(Xe.renameSync(s,i),Xe.chmodSync(i,384)),{path:i,written:!0}}function Hp(e){try{Xe.rmSync(xr(e),{force:!0})}catch{}}import Jp from"node:net";var Xp={"e2e-runtime":5e3,"e2e-ui":5500,"smoke-runtime":7e3},Ba=100;async function r_(e,t={}){let n=t.isPortFree??s_,i=t.getFreePort??a_,r=t.getWorktreeBasePort??o_,o=r()+Xp[e],s=o-r();if(s<Ba)throw new Error(`pickTestPort(${e}): role offset ${s} collides with app runtime (0); must be >= ${Ba}.`);return o>65535?i():await n(o)?o:i()}function o_(){let e=dt();return e.autoDetected?e.runtimePort:Ut}async function s_(e){return new Promise(t=>{let n=Jp.createServer();n.once("error",()=>t(!1)),n.listen(e,"127.0.0.1",()=>{n.close(()=>t(!0))})})}async function a_(){return new Promise((e,t)=>{let n=Jp.createServer();n.listen(0,"127.0.0.1",()=>{let i=n.address();if(i&&typeof i!="string"){let{port:r}=i;n.close(()=>e(r))}else n.close(()=>t(new Error("Failed to get free port")))}),n.on("error",t)})}import Qp from"node:fs";var Yt=class extends Error{code;configPath;constructor(t,n,i,r){super(i,r),this.name="ConfigFileError",this.code=t,this.configPath=n}};function zp(e){let t;try{t=Qp.readFileSync(e,"utf-8")}catch(i){throw new Yt("CONFIG_READ_FAILED",e,`Cannot read config ${e}.`,{cause:i})}let n;try{n=W.load(t)}catch(i){throw new Yt("CONFIG_PARSE_FAILED",e,`Config is not valid YAML: ${e}`,{cause:i})}if(n==null||typeof n!="object"||Array.isArray(n))throw new Yt("CONFIG_ROOT_INVALID",e,`Config root must be an object: ${e}`);return n}function l_(e,t){return Qp.existsSync(e)&&Oa(e),Ta(zp(e),t.dataDir)}function c_(e,t){let n=zp(e);if(n.beta==null||typeof n.beta!="object"||Array.isArray(n.beta))return;let i=n.beta[t];return typeof i=="boolean"?i:void 0}export{to as a,f_ as b,d_ as c,Zp as d,W as e,Xy as f,no as g,io as h,md as i,er as j,Ln as k,Ft as l,tr as m,Tv as n,Ks as o,lr as p,Vs as q,Zv as r,Kd as s,Dt as t,Vd as u,Ys as v,Xd as w,Qd as x,Zd as y,ep as z,Ge as A,lA as B,cA as C,ia as D,ra as E,oa as F,ip as G,sa as H,pA as I,hA as J,yA as K,gA as L,bA as M,We as N,la as O,lp as P,fp as Q,dp as R,pp as S,mp as T,hp as U,he as V,ca as W,ua as X,Ae as Y,fa as Z,Nn as _,da as $,gp as aa,ma as ba,ha as ca,ya as da,fr as ea,ga as fa,Sp as ga,Cp as ha,Te as ia,dr as ja,mr as ka,wa as la,BA as ma,_a as na,$A as oa,Op as pa,Ut as qa,Lp as ra,WA as sa,dt as ta,JA as ua,xa as va,Kt as wa,Dp as xa,ka as ya,iw as za,rw as Aa,vr as Ba,Ar as Ca,jp as Da,Up as Ea,gw as Fa,vw as Ga,Ia as Ha,La as Ia,Ie as Ja,Vt as Ka,Ma as La,ww as Ma,Na,Kp as Oa,_w as Pa,Ra as Qa,Vp as Ra,xw as Sa,Mw as Ta,Nw as Ua,Rw as Va,Pw as Wa,Fw as Xa,Xw as Ya,Zw as Za,e_ as _a,Wp as $a,Da as ab,xr as bb,n_ as cb,i_ as db,Hp as eb,Xp as fb,Ba as gb,r_ as hb,Yt as ib,l_ as jb,c_ as kb};
|