planx 19.132.1 → 19.133.0
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/main.js +4 -4
- package/package.json +6 -6
- package/session.main.mjs +4 -4
- package/transport.main.mjs +4 -4
package/main.js
CHANGED
|
@@ -1141,7 +1141,7 @@ Use --offset to see more results`)}}catch(i){console.error("Error listing tasks:
|
|
|
1141
1141
|
\u{1F4CA} \u4F9D\u5B58\u95A2\u4FC2\u3092\u8A2D\u5B9A\u4E2D...`));for(let h of u)if(h.dependsOn){let m=((s=h.description.match(/【(.+?)】/))===null||s===void 0?void 0:s[1])||h.description,A=l.get(m),E=l.get(h.dependsOn);A&&E&&(yield r.updateTask({id:A,depends_on:[E]}),console.log(wy.default.gray(` \u2514\u2500 ${m} \u2192 ${h.dependsOn}`)))}console.log(wy.default.cyan(`
|
|
1142
1142
|
\u{1F4CB} \u4F5C\u6210\u3055\u308C\u305F\u30BF\u30B9\u30AF\u968E\u5C64:`));let c=yield r.getTaskTree(a.id),f=fAt(c,a.id);console.log(f),console.log(wy.default.green(`
|
|
1143
1143
|
\u2705 \u30BF\u30B9\u30AF\u5206\u89E3\u304C\u6B63\u5E38\u306B\u5B8C\u4E86\u3057\u307E\u3057\u305F`)),console.log(wy.default.yellow(`
|
|
1144
|
-
\u{1F4A1} \u6B21\u306E\u30B9\u30C6\u30C3\u30D7:`)),console.log(wy.default.gray(`1. \u81EA\u52D5\u5B9F\u884C: /action ${a.id} --mode=auto`)),console.log(wy.default.gray(`2. \u6700\u521D\u306E\u30BF\u30B9\u30AF\u304B\u3089\u958B\u59CB: /action ${l.get("\u6700\u521D\u306EPR\u4F5C\u6210")}`)),console.log(wy.default.gray(`3. \u30BF\u30B9\u30AF\u30C4\u30EA\u30FC\u306E\u78BA\u8A8D: node dist/packages/@machina.at/
|
|
1144
|
+
\u{1F4A1} \u6B21\u306E\u30B9\u30C6\u30C3\u30D7:`)),console.log(wy.default.gray(`1. \u81EA\u52D5\u5B9F\u884C: /action ${a.id} --mode=auto`)),console.log(wy.default.gray(`2. \u6700\u521D\u306E\u30BF\u30B9\u30AF\u304B\u3089\u958B\u59CB: /action ${l.get("\u6700\u521D\u306EPR\u4F5C\u6210")}`)),console.log(wy.default.gray(`3. \u30BF\u30B9\u30AF\u30C4\u30EA\u30FC\u306E\u78BA\u8A8D: node dist/packages/@planx.machina.at/cli/main.cjs task tree ${a.id}`))}catch(a){console.error(wy.default.red("\u274C \u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:"),a.message),process.exit(1)}}))})}var wy,DKr=g(()=>{we();DR();wy=Be(Zfe());_Kr();bKr()});var SKr={};yn(SKr,{commands:()=>izi});var izi,wKr=g(()=>{izi=[{name:"create",load:()=>Promise.resolve().then(()=>(Rzr(),Ozr)).then(t=>t.program)},{name:"update",load:()=>Promise.resolve().then(()=>(Bzr(),Pzr)).then(t=>t.program)},{name:"get",load:()=>Promise.resolve().then(()=>(Mzr(),kzr)).then(t=>t.program)},{name:"list",load:()=>Promise.resolve().then(()=>(Lzr(),Fzr)).then(t=>t.program)},{name:"tree",load:()=>Promise.resolve().then(()=>(qzr(),jzr)).then(t=>t.program)},{name:"plan",load:()=>Promise.resolve().then(()=>(DKr(),EKr)).then(t=>t.program)}]});var Px,CKr=g(()=>{we();Sd();ES();Re();Px=class{constructor(){this.workerRepo=ZV(uN)}upsertWorker(e){return N(this,void 0,void 0,function*(){try{console.log("[DEBUG] Upserting worker:",e);let r=yield this.workerRepo.save({name:e.name});return console.log("[DEBUG] Upsert result:",r),r}catch(r){throw console.error("[ERROR] Failed to upsert worker:",r),r}})}listWorkers(){return N(this,arguments,void 0,function*(e={}){try{let r=yield this.workerRepo.list();return{workers:r.slice(e.offset||0,(e.offset||0)+(e.limit||100)),total:r.length}}catch(r){throw console.error("[ERROR] Failed to list workers:",r),r}})}deleteWorker(e){return N(this,void 0,void 0,function*(){try{let n=(yield this.workerRepo.list()).find(i=>i.name===e);return n?(yield this.workerRepo.delete({id:n.id}),1):0}catch(r){throw console.error("[ERROR] Failed to delete worker:",r),r}})}};Px.\u0275fac=function(e){return new(e||Px)};Px.\u0275prov=Ce({token:Px,factory:Px.\u0275fac,providedIn:"root"})});var IKr=g(()=>{CKr()});var TKr=g(()=>{IKr()});var xKr=g(()=>{bxe();GPe();DR();TKr()});var NKr=g(()=>{xKr()});var OKr={};yn(OKr,{program:()=>ozi});function ozi(t,e){return N(this,void 0,void 0,function*(){let r=e.get(Px);t.command("list").description("List all workers").action(()=>N(this,void 0,void 0,function*(){try{let n=yield r.listWorkers();console.table(n.workers.map(i=>({id:i.id,name:i.name})))}catch(n){console.error("Error listing workers:",n.message),process.exit(1)}}))})}var RKr=g(()=>{we();NKr()});var Lm,PKr=g(()=>{we();Re();Jl();Fr();Re();Lm=class{constructor(){this.logger=ft("SessionCreateService"),this.client=Z(io)}createSession(){return N(this,arguments,void 0,function*(e={}){return this.logger.debug("createSession:",e),this.create({serverId:e.serverId,id:e.id,name:e.name,command:e.command,parentId:e.parentId,cwd:e.cwd,env:e.env})})}create(e){return N(this,void 0,void 0,function*(){let r=yield this.client.resolveServerPeerId(e.serverId,{timeout:3e4});if(!this.client.createSession)throw new Error("SessionCreateService: client.createSession is not implemented (App \u7D4C\u8DEF\u306F SessionCommandFacade \u7D4C\u7531\u3092\u4F7F\u7528)");let n=yield this.client.createSession(e.serverId,{sessionId:e.id,name:e.name,command:e.command||"/bin/bash",parentId:e.parentId,cwd:e.cwd,env:e.env});return Object.assign(Object.assign({},n),{serverId:r||n.serverId})})}};Lm.\u0275fac=function(e){return new(e||Lm)};Lm.\u0275prov=Ce({token:Lm,factory:Lm.\u0275fac,providedIn:"root"})});var BKr=g(()=>{PKr()});var Xfe=g(()=>{BKr()});function kKr(t,e,r){if(t)return t;if(!(e&&r!==e))return process.cwd()}var MKr=g(()=>{});function FKr(t){return t.optionParent?t.optionParent:!!t.currentServerId&&t.serverName===t.currentServerId||!!t.currentServerName&&t.serverName===t.currentServerName?t.currentSessionId:void 0}var LKr=g(()=>{});var jKr={};yn(jKr,{commands:()=>szi});var szi,qKr=g(()=>{we();Re();Mn();Xfe();bce();Jl();a1();MKr();LKr();szi=[{name:"",description:"Create a new session",arguments:[["[name]","Session name"],["[command...]","Command to run in the session"]],options:[["-d, --detached","Create session in detached mode (default: create and attach)",void 0,!1],["-n, --server-name <name>","Session server name",void 0,"server-default"],["-p, --parent <session-id>","Parent session ID for hierarchical sessions"],["-w, --cwd <path>","Working directory for the session (default: current directory)"],["-e, --env <KEY=VALUE...>","Environment variables (can be specified multiple times)"],["--json","Output in JSON format",void 0,!1]],action:(t,e,r)=>N(void 0,void 0,void 0,function*(){var n;console.log("[diag-session-create] action entry");let i=Z(Lm),o=Z(Rb),s=Z(Uc),a=Z(No),u=Z(io);console.log("[diag-session-create] before keyManager.initialize()"),yield a.initialize(),console.log("[diag-session-create] after keyManager.initialize(), before sessionClient.initialize()"),yield u.initialize(),console.log("[diag-session-create] after sessionClient.initialize()");try{console.log("[diag-session-create] entered try block");let l=e&&e.length>0?e.join(" "):void 0,c=r?.serverName||process.env.PLANX_SERVER_ID||s.defaultServerId,f=process.env.PLANX_SERVER_ID,h=FKr({optionParent:r?.parent,serverName:c,currentServerId:f,currentServerName:process.env.PLANX_SERVER_NAME,currentSessionId:process.env.PLANX_SESSION_ID}),m=(n=r?.env)===null||n===void 0?void 0:n.reduce((S,w)=>{let C=w.indexOf("=");return C>0&&(S[w.slice(0,C)]=w.slice(C+1)),S},{}),A={id:my(),name:t||`session-${Date.now()}`,command:l||s.defaultCommand||"/bin/bash",serverId:c,parentId:h,cwd:kKr(r?.cwd,f,c),env:m&&Object.keys(m).length>0?m:void 0},E=yield i.createSession(A);if(r?.json){if(c)try{let S=yield u.resolveServerPeerId(c);console.log(JSON.stringify(Object.assign(Object.assign({},E),{serverPeerId:S}),null,2))}catch{console.log(JSON.stringify(E,null,2))}else console.log(JSON.stringify(E,null,2));return}let b=E.status==="detached"?"detached":E.status;console.log(`Session created: ${E.name} (${E.id})`),console.log(`PID: ${E.pid}`),console.log(`Command: ${E.command}`),console.log(`Status: ${b}`),E.parentId&&console.log(`Parent: ${E.parentId}`),E.cwd&&console.log(`CWD: ${E.cwd}`),r?.detached||console.log(`
|
|
1145
1145
|
Note: Session created in detached mode. Use "machina session attach" to connect.`)}catch(l){console.error("Failed to create session:",l.message),process.exit(1)}})}]});function $Kr(t,e,r,n,i){return N(this,void 0,void 0,function*(){var o;let s=(o=i?.timeout)!==null&&o!==void 0?o:3e4;if(t.getCachedSessions){let c=yield t.getCachedSessions(n,{timeout:s});if(c.length>0)return e.debug("Using cached sessions from Daemon"),c;e.debug("Cache empty (initial race or backoff), falling back to direct server query")}if(n){let c=yield(0,rd.lastValueFrom)(r(n,{timeout:s})),h=(yield(0,rd.lastValueFrom)(t.servers$.pipe((0,rd.take)(1),(0,rd.timeout)(5e3),(0,rd.catchError)(()=>(0,rd.of)([]))))).find(m=>m.id===n);return c.map(m=>Object.assign(Object.assign({},m),{serverName:h?.name}))}let a=yield(0,rd.lastValueFrom)(t.servers$.pipe((0,rd.filter)(c=>c.length>0),(0,rd.timeout)(s),(0,rd.take)(1),(0,rd.catchError)(c=>(c.name==="TimeoutError"&&e.warn("No servers found within timeout"),(0,rd.of)([])))));if(a.length===0)return[];let u=new Map(a.map(c=>[c.id,c.name]));return(yield Promise.all(a.map(c=>(0,rd.lastValueFrom)(r(c.id,{timeout:3e4}).pipe((0,rd.catchError)(f=>(e.error("Failed to connect to server",c.id,f),(0,rd.of)([])))))))).flat().map(c=>Object.assign(Object.assign({},c),{serverName:u.get(c.serverId)}))})}var rd,UKr=g(()=>{we();rd=Be(Zt())});var QKr=g(()=>{UKr()});var Xs,Za,VKr=g(()=>{we();Re();Jl();Fr();Xs=Be(Zt());QKr();Re();Za=class{constructor(){this.client=Z(io),this.logger=ft("SessionListService")}listSessions$(e){return this.list(e?[e]:[])}list(e=[]){return e.length>0?(0,Xs.combineLatest)(e.map(r=>this.listByServerId(r,{timeout:3e4}).pipe((0,Xs.catchError)(n=>(console.error("Failed to connect to server",r,n),(0,Xs.of)([])))))).pipe((0,Xs.map)(r=>r.flat()),(0,Xs.tap)(r=>this.logger.debug("sessions",r))):this.client.servers$.pipe((0,Xs.map)(r=>r.map(n=>n.id)),(0,Xs.distinctUntilChanged)((r,n)=>JSON.stringify(r)===JSON.stringify(n)),(0,Xs.debounceTime)(500),(0,Xs.tap)(r=>this.logger.debug("peerIds",r)),(0,Xs.switchMap)(r=>r.length===0?(0,Xs.of)([]):(0,Xs.combineLatest)(r.map(n=>this.listByServerId(n,{timeout:3e4}).pipe((0,Xs.catchError)(i=>(console.error("Failed to connect to server",i),(0,Xs.of)([]))))))),(0,Xs.map)(r=>r.flat()),(0,Xs.tap)(r=>this.logger.debug("sessions",r)))}listSessionsDirect(e,r){return N(this,void 0,void 0,function*(){return(0,Xs.lastValueFrom)(this.listByServerId(e,r).pipe((0,Xs.catchError)(n=>(this.logger.error("listSessionsDirect failed",e,n),(0,Xs.of)([])))))})}listByServerId(e,r){let n=r?.timeout!==void 0?Math.min(r.timeout,3e4):void 0;return(0,Xs.from)(n!==void 0?this.client.resolveServerPeerId(e,{timeout:n}):this.client.resolveServerPeerId(e)).pipe((0,Xs.switchMap)(i=>{if(!this.client.listServerSessions)throw new Error("SessionListService: client.listServerSessions is not implemented (App \u7D4C\u8DEF\u306F SessionCommandFacade \u7D4C\u7531\u3092\u4F7F\u7528)");return(0,Xs.from)(this.client.listServerSessions(e,r)).pipe((0,Xs.map)(o=>o.map(s=>Object.assign(Object.assign({},s),{serverId:i||s.serverId}))))}))}listSessions(e,r){return N(this,void 0,void 0,function*(){return $Kr(this.client,this.logger,(n,i)=>this.listByServerId(n,i),e,r)})}};Za.\u0275fac=function(e){return new(e||Za)};Za.\u0275prov=Ce({token:Za,factory:Za.\u0275fac,providedIn:"root"})});var HKr=g(()=>{VKr()});var rE=g(()=>{HKr()});var e9e=F((iPa,zKr)=>{var pAt=[],GKr=0,Bh=(t,e)=>{GKr>=e&&pAt.push(t)};Bh.WARN=1;Bh.INFO=2;Bh.DEBUG=3;Bh.reset=()=>{pAt=[]};Bh.setDebugLevel=t=>{GKr=t};Bh.warn=t=>Bh(t,Bh.WARN);Bh.info=t=>Bh(t,Bh.INFO);Bh.debug=t=>Bh(t,Bh.DEBUG);Bh.debugMessages=()=>pAt;zKr.exports=Bh});var WKr=F((oPa,KKr)=>{"use strict";KKr.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var JKr=F((sPa,YKr)=>{"use strict";var azi=WKr();YKr.exports=t=>typeof t=="string"?t.replace(azi(),""):t});var XKr=F((aPa,hAt)=>{"use strict";var ZKr=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);hAt.exports=ZKr;hAt.exports.default=ZKr});var tWr=F((uPa,eWr)=>{"use strict";eWr.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var nWr=F((lPa,mAt)=>{"use strict";var uzi=JKr(),lzi=XKr(),czi=tWr(),rWr=t=>{if(typeof t!="string"||t.length===0||(t=uzi(t),t.length===0))return 0;t=t.replace(czi()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=lzi(n)?2:1)}return e};mAt.exports=rWr;mAt.exports.default=rWr});var gAt=F((cPa,aWr)=>{var iWr=nWr();function t9e(t){return t?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function Aw(t){let e=t9e();return(""+t).replace(e,"").split(`
|
|
1146
1146
|
`).reduce(function(i,o){return iWr(o)>i?iWr(o):i},0)}function epe(t,e){return Array(e+1).join(t)}function dzi(t,e,r,n){let i=Aw(t);if(e+1>=i){let o=e-i;switch(n){case"right":{t=epe(r,o)+t;break}case"center":{let s=Math.ceil(o/2),a=o-s;t=epe(r,a)+t+epe(r,s);break}default:{t=t+epe(r,o);break}}}return t}var eY={};function tpe(t,e,r){e="\x1B["+e+"m",r="\x1B["+r+"m",eY[e]={set:t,to:!0},eY[r]={set:t,to:!1},eY[t]={on:e,off:r}}tpe("bold",1,22);tpe("italics",3,23);tpe("underline",4,24);tpe("inverse",7,27);tpe("strikethrough",9,29);function oWr(t,e){let r=e[1]?parseInt(e[1].split(";")[0]):0;if(r>=30&&r<=39||r>=90&&r<=97){t.lastForegroundAdded=e[0];return}if(r>=40&&r<=49||r>=100&&r<=107){t.lastBackgroundAdded=e[0];return}if(r===0){for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&delete t[i];return}let n=eY[e[0]];n&&(t[n.set]=n.to)}function fzi(t){let e=t9e(!0),r=e.exec(t),n={};for(;r!==null;)oWr(n,r),r=e.exec(t);return n}function sWr(t,e){let r=t.lastBackgroundAdded,n=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(i){t[i]&&(e+=eY[i].off)}),r&&r!="\x1B[49m"&&(e+="\x1B[49m"),n&&n!="\x1B[39m"&&(e+="\x1B[39m"),e}function pzi(t,e){let r=t.lastBackgroundAdded,n=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(i){t[i]&&(e=eY[i].on+e)}),r&&r!="\x1B[49m"&&(e=r+e),n&&n!="\x1B[39m"&&(e=n+e),e}function hzi(t,e){if(t.length===Aw(t))return t.substr(0,e);for(;Aw(t)>e;)t=t.slice(0,-1);return t}function mzi(t,e){let r=t9e(!0),n=t.split(t9e()),i=0,o=0,s="",a,u={};for(;o<e;){a=r.exec(t);let l=n[i];if(i++,o+Aw(l)>e&&(l=hzi(l,e-o)),s+=l,o+=Aw(l),o<e){if(!a)break;s+=a[0],oWr(u,a)}}return sWr(u,s)}function gzi(t,e,r){if(r=r||"\u2026",Aw(t)<=e)return t;e-=Aw(r);let i=mzi(t,e);i+=r;let o="\x1B]8;;\x07";return t.includes(o)&&!i.includes(o)&&(i+=o),i}function yzi(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function vzi(t,e){t=t||{},e=e||yzi();let r=Object.assign({},e,t);return r.chars=Object.assign({},e.chars,t.chars),r.style=Object.assign({},e.style,t.style),r}function Azi(t,e){let r=[],n=e.split(/(\s+)/g),i=[],o=0,s;for(let a=0;a<n.length;a+=2){let u=n[a],l=o+Aw(u);o>0&&s&&(l+=s.length),l>t?(o!==0&&r.push(i.join("")),i=[u],o=Aw(u)):(i.push(s||"",u),o=l),s=n[a+1]}return o&&r.push(i.join("")),r}function _zi(t,e){let r=[],n="";function i(s,a){for(n.length&&a&&(n+=a),n+=s;n.length>t;)r.push(n.slice(0,t)),n=n.slice(t)}let o=e.split(/(\s+)/g);for(let s=0;s<o.length;s+=2)i(o[s],s&&o[s-1]);return n.length&&r.push(n),r}function bzi(t,e,r=!0){let n=[];e=e.split(`
|
|
1147
1147
|
`);let i=r?Azi:_zi;for(let o=0;o<e.length;o++)n.push.apply(n,i(t,e[o]));return n}function Ezi(t){let e={},r=[];for(let n=0;n<t.length;n++){let i=pzi(e,t[n]);e=fzi(i);let o=Object.assign({},e);r.push(sWr(o,i))}return r}function Dzi(t,e){return["\x1B]","8",";",";",t||e,"\x07",e,"\x1B]","8",";",";","\x07"].join("")}aWr.exports={strlen:Aw,repeat:epe,pad:dzi,truncate:gzi,mergeOptions:vzi,wordWrap:bzi,colorizeLines:Ezi,hyperlink:Dzi}});var dWr=F((dPa,cWr)=>{var lWr={};cWr.exports=lWr;var uWr={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(uWr).forEach(function(t){var e=uWr[t],r=lWr[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var pWr=F((fPa,fWr)=>{"use strict";fWr.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",i=e.indexOf(n+t);return i!==-1&&(r===-1?!0:i<r)}});var mWr=F((pPa,hWr)=>{"use strict";var Szi=bu("os"),nE=pWr(),jm=process.env,tY=void 0;nE("no-color")||nE("no-colors")||nE("color=false")?tY=!1:(nE("color")||nE("colors")||nE("color=true")||nE("color=always"))&&(tY=!0);"FORCE_COLOR"in jm&&(tY=jm.FORCE_COLOR.length===0||parseInt(jm.FORCE_COLOR,10)!==0);function wzi(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Czi(t){if(tY===!1)return 0;if(nE("color=16m")||nE("color=full")||nE("color=truecolor"))return 3;if(nE("color=256"))return 2;if(t&&!t.isTTY&&tY!==!0)return 0;var e=tY?1:0;if(process.platform==="win32"){var r=Szi.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in jm)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in jm})||jm.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in jm)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(jm.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in jm){var n=parseInt((jm.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(jm.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(jm.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(jm.TERM)||"COLORTERM"in jm?1:(jm.TERM==="dumb",e)}function yAt(t){var e=Czi(t);return wzi(e)}hWr.exports={supportsColor:yAt,stdout:yAt(process.stdout),stderr:yAt(process.stderr)}});var yWr=F((hPa,gWr)=>{gWr.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var i={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(o){o=o.toLowerCase();var s=i[o]||[" "],a=Math.floor(Math.random()*s.length);typeof i[o]<"u"?n+=i[o][a]:n+=o}),n}});var AWr=F((mPa,vWr)=>{vWr.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},i=[].concat(n.up,n.down,n.mid);function o(u){var l=Math.floor(Math.random()*u);return l}function s(u){var l=!1;return i.filter(function(c){l=c===u}),l}function a(u,l){var c="",f,h;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",u=u.split("");for(h in u)if(!s(h)){switch(c=c+u[h],f={up:0,down:0,mid:0},l.size){case"mini":f.up=o(8),f.mid=o(2),f.down=o(8);break;case"maxi":f.up=o(16)+3,f.mid=o(4)+1,f.down=o(64)+3;break;default:f.up=o(8)+1,f.mid=o(6)/2,f.down=o(8)+1;break}var m=["up","mid","down"];for(var A in m)for(var E=m[A],b=0;b<=f[E];b++)l[E]&&(c=c+n[E][o(n[E].length)])}return c}return a(e,r)}});var bWr=F((gPa,_Wr)=>{_Wr.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var DWr=F((yPa,EWr)=>{EWr.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var wWr=F((vPa,SWr)=>{SWr.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,i){return r===" "?r:t[e[n++%e.length]](r)}}});var IWr=F((APa,CWr)=>{CWr.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,i){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var PWr=F((bPa,RWr)=>{var ls={};RWr.exports=ls;ls.themes={};var Izi=bu("util"),C7=ls.styles=dWr(),xWr=Object.defineProperties,Tzi=new RegExp(/[\r\n]+/g);ls.supportsColor=mWr().supportsColor;typeof ls.enabled>"u"&&(ls.enabled=ls.supportsColor()!==!1);ls.enable=function(){ls.enabled=!0};ls.disable=function(){ls.enabled=!1};ls.stripColors=ls.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var _Pa=ls.stylize=function(e,r){if(!ls.enabled)return e+"";var n=C7[r];return!n&&r in ls?ls[r](e):n.open+e+n.close},xzi=/[|\\{}()[\]^$+*?.]/g,Nzi=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(xzi,"\\$&")};function NWr(t){var e=function r(){return Rzi.apply(r,arguments)};return e._styles=t,e.__proto__=Ozi,e}var OWr=(function(){var t={};return C7.grey=C7.gray,Object.keys(C7).forEach(function(e){C7[e].closeRe=new RegExp(Nzi(C7[e].close),"g"),t[e]={get:function(){return NWr(this._styles.concat(e))}}}),t})(),Ozi=xWr(function(){},OWr);function Rzi(){var t=Array.prototype.slice.call(arguments),e=t.map(function(s){return s!=null&&s.constructor===String?s:Izi.inspect(s)}).join(" ");if(!ls.enabled||!e)return e;for(var r=e.indexOf(`
|
|
@@ -1162,7 +1162,7 @@ Deleted ${l.deletedCount} session(s)`))}else{let l=yield i.deleteSession({sessio
|
|
|
1162
1162
|
`)}),Ie.start()}function wr(xr,Qe){return N(this,void 0,void 0,function*(){xr.exitCode===null&&(yield new Promise(dt=>{var It;let er=setTimeout(dt,Qe);(It=er.unref)===null||It===void 0||It.call(er),xr.once("exit",()=>{clearTimeout(er),dt()})}))})}function Ar(xr){return N(this,void 0,void 0,function*(){if(me)return"fail";let Qe=de.get(xr);if(Qe&&Qe.process.exitCode===null){try{Qe.process.kill("SIGTERM")}catch{}if(yield wr(Qe.process,S),Qe.process.exitCode===null){try{Qe.process.kill("SIGKILL")}catch{}yield wr(Qe.process,1e3)}}try{if(xr==="transport"){let er=$(TAt(wt,wt.session)),[fr,Sn]=yield wR(Promise.all([er.transportWaiter.promise,er.proxyWaiter.promise]),w,"transport+proxy port (restart)");return $e.transport=fr.pid,wt.transport=fr.port,$e.proxy=Sn.pid,wt.proxy=Sn.port,C.write(`[supervisor] transport child respawned (pid=${fr.pid}, port=${fr.port}, proxyPort=${Sn.port})
|
|
1163
1163
|
`),"success"}let{waiter:dt}=ee(xr,zYr(xr,wt)),It=yield wR(dt.promise,w,`${xr} port (restart)`);return wt[xr]=It.port,$e[xr]=It.pid,C.write(`[supervisor] ${xr} child respawned (pid=${It.pid}, port=${It.port})
|
|
1164
1164
|
`),"success"}catch(dt){x.write(`[supervisor] respawn ${xr} failed: ${dt.message}
|
|
1165
|
-
`);let It=de.get(xr);if(It&&It.process.exitCode===null){It.reaped=!0;try{It.process.kill("SIGKILL")}catch{}}return"fail"}})}function pi(xr){return N(this,void 0,void 0,function*(){var Qe;if(!(me||!Le)&&!Te.get(xr)){Te.set(xr,!0);try{let dt=yield Le.restart(xr);if((Qe=t.onRestart)===null||Qe===void 0||Qe.call(t,xr,dt),dt==="circuit-open"){re===0&&(re=1),on();return}dt==="success"&&Ie&&Ie.resetFailureCount(xr)}finally{Te.set(xr,!1)}}})}function Un(xr){return N(this,void 0,void 0,function*(){if(Te.get(xr))return"fail";Ie?.suspendProbe(xr),Te.set(xr,!0);try{let Qe=yield Ar(xr);return Qe==="success"&&Ie?.resetFailureCount(xr),Qe}finally{Te.set(xr,!1),Ie?.resumeProbe(xr)}})}function on(){return N(this,void 0,void 0,function*(){if(me)return;if(me=!0,Ie)try{yield Ie.stop()}catch{}let xr=Array.from(de.values());for(let fr of xr)if(fr.process.exitCode===null)try{fr.process.kill("SIGTERM")}catch{}let Qe=xr.map(fr=>new Promise(Sn=>{if(fr.process.exitCode!==null)return Sn();fr.process.once("exit",()=>Sn())})),dt,It=new Promise(fr=>{dt=setTimeout(()=>{for(let Sn of xr)if(Sn.process.exitCode===null)try{Sn.process.kill("SIGKILL")}catch{}fr()},S)});yield Promise.race([Promise.all(Qe),It]);let er=Array.from(de.values());for(let fr of er)if(fr.process.exitCode===null)try{fr.process.kill("SIGKILL")}catch{}yield Promise.race([Promise.all(er.map(fr=>new Promise(Sn=>{if(fr.process.exitCode!==null)return Sn();fr.process.once("exit",()=>Sn())}))),new Promise(fr=>{var Sn;let dn=setTimeout(fr,2e3);(Sn=dn.unref)===null||Sn===void 0||Sn.call(dn)})]),dt&&clearTimeout(dt),ce(re)})}return{pids:$e,ports:wt,exitCode$:pe.promise,stop:()=>N(this,void 0,void 0,function*(){yield on()}),restartService:xr=>Un(xr)}})}var wKi,CKi,IKi,TKi,xKi,oJr=g(()=>{we();$Yr();VYr();GYr();KYr();JYr();xAt();xAt();wKi=5e3,CKi=1e4,IKi=5e3,TKi=3,xKi=["transport","layout","session","log"]});import{existsSync as sJr,realpathSync as NKi}from"fs";import{dirname as aJr,resolve as uJr}from"path";function OKi(t){var e;let r=`${t}.main.mjs`,n=(e=process.argv[1])!==null&&e!==void 0?e:"";if(n){let o="";try{o=aJr(NKi(n))}catch{o=aJr(n)}let s=uJr(o,r);if(sJr(s))return s}let i=uJr(process.cwd(),"dist/packages/@machina.at/
|
|
1165
|
+
`);let It=de.get(xr);if(It&&It.process.exitCode===null){It.reaped=!0;try{It.process.kill("SIGKILL")}catch{}}return"fail"}})}function pi(xr){return N(this,void 0,void 0,function*(){var Qe;if(!(me||!Le)&&!Te.get(xr)){Te.set(xr,!0);try{let dt=yield Le.restart(xr);if((Qe=t.onRestart)===null||Qe===void 0||Qe.call(t,xr,dt),dt==="circuit-open"){re===0&&(re=1),on();return}dt==="success"&&Ie&&Ie.resetFailureCount(xr)}finally{Te.set(xr,!1)}}})}function Un(xr){return N(this,void 0,void 0,function*(){if(Te.get(xr))return"fail";Ie?.suspendProbe(xr),Te.set(xr,!0);try{let Qe=yield Ar(xr);return Qe==="success"&&Ie?.resetFailureCount(xr),Qe}finally{Te.set(xr,!1),Ie?.resumeProbe(xr)}})}function on(){return N(this,void 0,void 0,function*(){if(me)return;if(me=!0,Ie)try{yield Ie.stop()}catch{}let xr=Array.from(de.values());for(let fr of xr)if(fr.process.exitCode===null)try{fr.process.kill("SIGTERM")}catch{}let Qe=xr.map(fr=>new Promise(Sn=>{if(fr.process.exitCode!==null)return Sn();fr.process.once("exit",()=>Sn())})),dt,It=new Promise(fr=>{dt=setTimeout(()=>{for(let Sn of xr)if(Sn.process.exitCode===null)try{Sn.process.kill("SIGKILL")}catch{}fr()},S)});yield Promise.race([Promise.all(Qe),It]);let er=Array.from(de.values());for(let fr of er)if(fr.process.exitCode===null)try{fr.process.kill("SIGKILL")}catch{}yield Promise.race([Promise.all(er.map(fr=>new Promise(Sn=>{if(fr.process.exitCode!==null)return Sn();fr.process.once("exit",()=>Sn())}))),new Promise(fr=>{var Sn;let dn=setTimeout(fr,2e3);(Sn=dn.unref)===null||Sn===void 0||Sn.call(dn)})]),dt&&clearTimeout(dt),ce(re)})}return{pids:$e,ports:wt,exitCode$:pe.promise,stop:()=>N(this,void 0,void 0,function*(){yield on()}),restartService:xr=>Un(xr)}})}var wKi,CKi,IKi,TKi,xKi,oJr=g(()=>{we();$Yr();VYr();GYr();KYr();JYr();xAt();xAt();wKi=5e3,CKi=1e4,IKi=5e3,TKi=3,xKi=["transport","layout","session","log"]});import{existsSync as sJr,realpathSync as NKi}from"fs";import{dirname as aJr,resolve as uJr}from"path";function OKi(t){var e;let r=`${t}.main.mjs`,n=(e=process.argv[1])!==null&&e!==void 0?e:"";if(n){let o="";try{o=aJr(NKi(n))}catch{o=aJr(n)}let s=uJr(o,r);if(sJr(s))return s}let i=uJr(process.cwd(),"dist/packages/@planx.machina.at/cli",r);return sJr(i)?i:null}function OAt(){let t={};for(let e of RKi){let r=OKi(e);r&&(t[e]=r)}return t}var RKi,lJr=g(()=>{RKi=["layout","session","transport","log"]});function RAt(t){let{supervisor:e,logger:r,extraCleanup:n}=t,i=()=>N(this,void 0,void 0,function*(){try{yield e.stop()}catch(o){console.warn("[session-server] supervisor.stop failed:",o)}try{yield n?.()}catch(o){console.warn("[session-server] extraCleanup failed:",o)}try{r.close()}catch(o){console.warn("[session-server] logger.close failed:",o)}});return e.exitCode$.then(o=>N(this,void 0,void 0,function*(){o!==0&&(console.error(`[session-server] supervisor exited with code ${o}, terminating parent`),yield i(),process.exit(o))})).catch(()=>{}),process.on("uncaughtException",o=>N(this,void 0,void 0,function*(){console.error("[session-server] Uncaught exception:",o),yield i(),process.exit(1)})),process.on("unhandledRejection",o=>{console.warn("[session-server] Unhandled rejection:",o)}),new Promise(o=>{let s=a=>N(this,void 0,void 0,function*(){console.error(`[lifecycle-diag] parent process received ${a} at ${new Date().toISOString()} (pid=${process.pid})`),console.error("[lifecycle-diag] trace:",new Error("signal source").stack),yield i(),o()});process.on("SIGINT",()=>{s("SIGINT")}),process.on("SIGTERM",()=>{s("SIGTERM")})})}var cJr=g(()=>{we()});var PAt=g(()=>{LYr();jYr();oJr();lJr();cJr()});function dJr(t,e){return N(this,void 0,void 0,function*(){try{let r=yield e(t);if(!r.ok)return"fail";let n=yield r.json().catch(()=>null);return n?.status==="ok"?"ok":"fail"}catch{return"unreachable"}})}function fJr(t){return N(this,void 0,void 0,function*(){var e;let r=(e=t.fetchImpl)!==null&&e!==void 0?e:fetch,[n,i]=yield Promise.all([dJr(`http://localhost:${t.sessionPort}/health`,r),dJr(`http://localhost:${t.layoutPort}/health`,r)]),o=n==="ok"&&i==="ok";return console.log(`[server-services] session<->layout reachable=${o} session=${n} layout=${i}`),{session:n,layout:i,reachable:o}})}var pJr=g(()=>{we()});import{mkdirSync as PKi,writeFileSync as BKi}from"fs";import{join as kKi}from"path";function hJr(t,e){let r=Lfe(t),n=`${r}/transport.port`;return process.env.PLANX_TRANSPORT_PORT_FILE=n,e&&(PKi(r,{recursive:!0}),BKi(kKi(r,"self.hip"),_H(e))),n}var mJr=g(()=>{Mn();Zg()});import{join as gJr}from"path";function Xa(t,e){return gJr(t,`${e}.pid`)}function Yu(t,e){return gJr(t,`${e}.port`)}var Um=g(()=>{});import{join as yJr}from"path";function vJr(t){let e=t.configDir;return{PLANX_SERVER_NAME:t.serverName,PLANX_SERVER_ID:t.peerId,PLANX_SERVER_CONFIG_DIR:e,PLANX_LAYOUT_PORT_FILE:Yu(e,"layout"),PLANX_LAYOUT_PID_FILE:Xa(e,"layout"),PLANX_SESSION_PORT_FILE:Yu(e,"session"),PLANX_PROXY_PORT_FILE:Yu(e,"proxy"),PLANX_PROXY_PID_FILE:Xa(e,"proxy"),PLANX_LOG_PORT_FILE:Yu(e,"log"),PLANX_LOG_PID_FILE:Xa(e,"log"),PLANX_LOG_DB:yJr(e,"logs.db"),PLANX_LAYOUT_STATE_DIR:yJr(e,"layout-state")}}function AJr(t){let e=MKi.filter(r=>!t[r]);if(e.length>0)throw new Error(`child process \u306B identity env \u304C\u6CE8\u5165\u3055\u308C\u3066\u3044\u307E\u305B\u3093: ${e.join(", ")} (supervisor \u7D4C\u7531\u3067\u306A\u3044\u8D77\u52D5\u304B\u3001childEnv \u306E\u914D\u7DDA\u6F0F\u308C\u3067\u3059)`);return{serverName:t.PLANX_SERVER_NAME,peerId:t.PLANX_SERVER_ID,configDir:t.PLANX_SERVER_CONFIG_DIR}}var MKi,BAt=g(()=>{Um();MKi=["PLANX_SERVER_NAME","PLANX_SERVER_ID","PLANX_SERVER_CONFIG_DIR"]});import{Writable as FKi}from"node:stream";function _Jr(t){var e,r,n,i;let o=(e=t.fetchFn)!==null&&e!==void 0?e:fetch,s=(r=t.maxBuffer)!==null&&r!==void 0?r:jKi,a=[],u=null,l=null,c=Promise.resolve(),f=0,h=!1,m=(w,C)=>{var x,B;let L=Date.now();return{id:`${String(L).padStart(14,"0")}-sup${process.pid.toString(36)}-${(f++).toString(36).padStart(6,"0")}`,timestamp:L,peer_id:"local",process_id:process.pid,level:C,component:(B=(x=$Ki.exec(w))===null||x===void 0?void 0:x[1])!==null&&B!==void 0?B:"unknown",message:w,context:null,error:null}},A=(w,C)=>{if(!h){for(let x of w.split(`
|
|
1166
1166
|
`))x.length!==0&&a.push(m(x,C));a.length>s&&a.splice(0,a.length-s)}},E=()=>N(this,void 0,void 0,function*(){if(u===null||a.length===0)return;let w=a.splice(0,qKi);try{yield o(`${u}/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)})}catch{}}),b=()=>{c=c.then(E)},S=(w,C)=>new FKi({write(x,B,L){let q=String(x);C?.write(q),A(q,w),L()}});return{stdout:S("INFO",(n=t.echo)===null||n===void 0?void 0:n.stdout),stderr:S("ERROR",(i=t.echo)===null||i===void 0?void 0:i.stderr),setLogdPort(w){var C,x;u=`http://127.0.0.1:${w}`,b(),l===null&&(l=setInterval(b,(C=t.flushIntervalMs)!==null&&C!==void 0?C:LKi),(x=l.unref)===null||x===void 0||x.call(l))},close(){return N(this,void 0,void 0,function*(){for(l!==null&&clearInterval(l),l=null;u!==null&&a.length>0;)b(),yield c;yield c,h=!0})}}}var LKi,jKi,qKi,$Ki,bJr=g(()=>{we();LKi=1e3,jKi=5e3,qKi=200,$Ki=/^\[([^[\]\s]+)\]/});import*as EJr from"node:fs";import{Writable as UKi}from"node:stream";function DJr(t,e,r){return e.PLANX_SUPERVISOR_ECHO||!r?!0:A1t(t,e)!==Ei.SILENT}function SJr(t){var e;let r=EJr.createWriteStream(t.logFilePath,{flags:"a"}),n=_Jr({echo:(e=t.echo)!==null&&e!==void 0?e:null,fetchFn:t.fetchFn}),i=o=>new UKi({write(s,a,u){try{r.write(s)}catch{}o.write(s),u()}});return{stdout:i(n.stdout),stderr:i(n.stderr),setLogdPort:o=>n.setLogdPort(o),close(){return N(this,void 0,void 0,function*(){yield n.close(),yield new Promise(o=>r.end(o))})}}}var wJr=g(()=>{we();qv();_1t();bJr()});function a9e(t){return N(this,void 0,void 0,function*(){var e;let{injector:r,usecase:n,logger:i,peerId:o,identity:s,serverName:a}=t,u=n.getConfig(),l=process.env;l.PLANX_LOG_PORT_FILE=Yu(u.SESSIONS_DIR,"log");let c=r.get(Tl),f=hJr(a,o),h=Object.assign(Object.assign({},vJr({serverName:a,configDir:u.SESSIONS_DIR,peerId:o})),{PLANX_TRANSPORT_PORT_FILE:f}),m=DJr(process.argv,l,process.stdout.isTTY===!0),A=SJr({logFilePath:u.LOG_FILE,echo:m?{stdout:process.stdout,stderr:process.stderr}:null}),E=yield NAt({cliPath:process.argv[1],serviceEntryPaths:OAt(),transportPortFile:f,nodePath:process.execPath,shutdownTimeoutMs:5e3,bootTimeoutMs:6e4,extraArgs:["--name",a],childEnv:h,stdout:A.stdout,stderr:A.stderr,onRestart:(C,x)=>{var B;return(B=i.warn)===null||B===void 0?void 0:B.call(i,`[supervisor] restart ${C}: ${x}`)}});A.setLogdPort(E.ports.log);for(let C of["layout","session","proxy","log"])c.register(C,E.ports[C]);let b=[{name:"transport",port:E.ports.transport,status:"running"},{name:"layout",port:E.ports.layout,status:"running"},{name:"session-trpc",port:E.ports.session,status:"running"},{name:"proxy-trpc",port:E.ports.proxy,status:"running"},{name:"log",port:E.ports.log,status:"running"}],S=yield n.getPeerInfo(),w=yield PPe((e=S.allowPeers)!==null&&e!==void 0?e:[],yield n.getMyPeers().catch(()=>[]));VW("session-server",{version:Gp(),pid:process.pid,name:a,configDir:u.SESSIONS_DIR,logFile:u.LOG_FILE,pidFile:u.PID_FILE,services:b,peerName:a,uuid:S.uuid,identity:{peerId:s.peerId,publicKey:s.publicKey},allowPeers:w,isAuthenticated:S.isAuthenticated}),fJr({sessionPort:E.ports.session,layoutPort:E.ports.layout}).catch(()=>{}),yield RAt({supervisor:E,logger:i,extraCleanup:()=>A.close()})})}var kAt=g(()=>{we();hW();PAt();Cx();pJr();mJr();BAt();Um();wJr()});function u9e(t=process.env){let e=Object.assign({},t);for(let r of QKi)delete e[r];return e}var QKi,MAt=g(()=>{QKi=["PLANX_SESSION_ID","PLANX_SESSION_NAME","PLANX_SERVER_ID","PLANX_SERVER_NAME","PLANX_TRANSPORT_TRPC_URL","PLANX_TRANSPORT_PORT_FILE"]});import{spawn as VKi,spawnSync as HKi}from"child_process";import*as CJr from"fs";import{dirname as GKi}from"path";function zKi(t){return N(this,void 0,void 0,function*(){var e;let r=mu.infrastructure.session.server.configDir;if(process.stdin.isTTY!==!0||OOe(process.argv,r,tv)!==null)return!1;let{promptServerName:n}=yield Promise.resolve().then(()=>(xUe(),l9t)),i=yield(0,FAt.firstValueFrom)(JMr({argv:process.argv,baseDir:r,loadConfig:tv,saveConfig:D_e,isInteractive:()=>!0,prompt:n}));if(i===t)return!1;console.error(`[session-server] Restarting with --name ${i} (configDir \u3092\u63C3\u3048\u308B\u305F\u3081)`);let o=[process.argv[1],...process.argv.slice(2),"--name",i],s=HKi(process.execPath,o,{stdio:"inherit"});process.exit((e=s.status)!==null&&e!==void 0?e:1)})}function KKi(t){return Object.assign(Object.assign({},t),{info:(...e)=>{t.info(...e),console.error("[session-server]",...e)}})}function IJr(t,e){return N(this,void 0,void 0,function*(){var r,n,i;let o=setInterval(()=>{},6e4),{usecase:s,injector:a,logger:u,servicePortRegistry:l,ptyService:c}=t,f=Gp(),h=uw(s.getConfig().SESSIONS_DIR);if(!e?.background&&(yield zKi(h))){clearInterval(o);return}if(e?.background){let S=s.getConfig(),w=[process.argv[1],"server","start","--name",h];e?.withLogin&&w.push("--with-login",e.withLogin);let C=VKi(process.execPath,w,{detached:!0,stdio:"ignore",env:u9e()});C.unref(),VW("session-server",{version:Gp(),pid:C.pid,name:h,configDir:S.SESSIONS_DIR,logFile:S.LOG_FILE,pidFile:S.PID_FILE}),console.log("[session-server] Started in background"),process.exit(0)}yield Promise.resolve().then(()=>(E7(),T1t));let A=s.getConfig().SUPERVISOR_PID_FILE;A&&!IAt(A)&&(console.error(`[session-server] Error: supervisor with name "${h}" is already running`),console.error("[session-server] Use a different --name or stop the existing supervisor first"),clearInterval(o),process.exit(1));let E={authService:a.get(Ku),peerUsecase:a.get(pf),serverCommand:s,logger:KKi(a.get(Uf).getLogger("ServerBootstrap"))};yield(0,FAt.firstValueFrom)(CAt(E,Object.assign(Object.assign({},e),{version:f,serverName:h})));let b=s.getConfig();try{CJr.mkdirSync(GKi(b.LOG_FILE),{recursive:!0}),u.initialize(b.LOG_FILE,!1,{pipeStdio:!0});let S=s.getIdentity(),w=setInterval(()=>{},1e3*60);w.ref(),process.stdin.resume(),clearInterval(o),yield a9e({injector:a,usecase:s,logger:u,peerId:S.peerId,identity:S,serverName:h}),clearInterval(w)}catch(S){clearInterval(o);let w=S,C=(r=w?.name)!==null&&r!==void 0?r:"UnknownError",x=(n=w?.message)!==null&&n!==void 0?n:String(S),B=(i=w?.stack)!==null&&i!==void 0?i:"<no stack>";console.error(`[session-server] Failed to start server: ${C}: ${x}`),console.error(`[session-server] stack: ${B}`),process.exit(1)}})}var FAt,TJr=g(()=>{we();Dj();CUe();YF();FAt=Be(Zt());fw();BW();Fr();Cx();E7();PAt();kAt();MAt()});var xJr={};yn(xJr,{commands:()=>WKi});var WKi,NJr=g(()=>{we();Re();$m();kfe();hW();DN();TJr();WKi=[{name:"",description:"Start the session server",options:[["-n, --name <name>","Session server name (must be unique)","server-default"],["-b, --background","Run in background (default: foreground)"],["--with-login <token>","Login with token and register peer before starting server"]],action:t=>N(void 0,void 0,void 0,function*(){let e=Z(Is),r=Z(Gs),n=Z(Vp),i=Z(Tl),o=Z(Jd);yield IJr({usecase:e,injector:r,logger:n,servicePortRegistry:i,ptyService:o},t)})}]});var OJr={};yn(OJr,{commands:()=>YKi});var YKi,RJr=g(()=>{we();Re();$m();YF();YKi=[{name:"",description:"Stop the session server",options:[["-n, --name <name>","Session server name","server-default"]],action:t=>N(void 0,void 0,void 0,function*(){let e=Z(Is);yield e.initializeConfig(t),yield e.killServer({name:uw(e.getConfig().SESSIONS_DIR)})})}]});var PJr={};yn(PJr,{commands:()=>ZKi});import{spawn as JKi}from"child_process";var ZKi,BJr=g(()=>{we();Re();YF();$m();kfe();Cx();kAt();MAt();ZKi=[{name:"",description:"Restart the session server",options:[["-n, --name <name>","Session server name","server-default"],["-b, --background","Run in background (default: foreground)"],["--no-cleanup-orphans","Skip pgrep-based --name orphan rescue (default: ON)"]],action:t=>N(void 0,void 0,void 0,function*(){let e=Z(Is),r=Z(Gs),n=Z(Vp),i=e.getConfig(),o=uw(i.SESSIONS_DIR);if(yield e.killServer({name:o,cleanupOrphans:t?.cleanupOrphans!==!1}),t?.background){let s=[process.argv[1],"server","start","--name",o],a=JKi(process.execPath,s,{detached:!0,stdio:"ignore",env:u9e()});a.unref(),VW("session-server",{version:Gp(),pid:a.pid,name:o,configDir:i.SESSIONS_DIR,logFile:i.LOG_FILE,pidFile:i.PID_FILE}),console.log("[session-server] Restarted in background"),process.exit(0)}try{yield Promise.resolve().then(()=>(E7(),T1t)),yield e.initializeKeyManager(),n.initialize(i.LOG_FILE,!1,{pipeStdio:!0}),yield e.loadAllowPeers({name:o});let s=e.getIdentity();yield a9e({injector:r,usecase:e,logger:n,peerId:s.peerId,identity:s,serverName:o})}catch(s){console.error("[session-server] Failed to restart server:",s),process.exit(1)}})}]});var kJr={};yn(kJr,{commands:()=>rWi});import{existsSync as XKi,readFileSync as eWi,statSync as tWi}from"fs";var rWi,MJr=g(()=>{we();Re();xg();$m();Cx();YF();rWi=[{name:"",description:"Show session server status",options:[["-n, --name <name>","Session server name","server-default"]],action:t=>N(void 0,void 0,void 0,function*(){let e=Z(Is),r=Gp();yield e.initializeConfig(t);let n=e.getConfig(),i=uw(n.SESSIONS_DIR),o=n.PID_FILE;if(console.log(`[session-server] v${r}`),XKi(o)){let s=eWi(o,"utf-8").trim(),u=tWi(o).mtime,l=vHr(Date.now()-u.getTime());console.log("[session-server] Status: running"),console.log(`[session-server] Name: ${i}`),console.log(`[session-server] PID: ${s}`),console.log(`[session-server] Started: ${u.toLocaleString()}`),console.log(`[session-server] Uptime: ${l}`),bm(parseInt(s))||console.warn("[session-server] Warning: PID file exists but process not found"),yield e.initializeKeyManager(),yield e.loadAllowPeers();let c=yield e.getPeerInfo(),f=yield e.getMyPeers().catch(()=>[]),h=yield PPe(c.allowPeers,f);BPe("session-server",{peerName:i,uuid:c.uuid,allowPeers:h,isAuthenticated:c.isAuthenticated})}else console.log("[session-server] Status: stopped"),console.log(`[session-server] Name: ${i}`)})}]});var LJr={};yn(LJr,{commands:()=>nWi});var FJr,LAt,nWi,jJr=g(()=>{we();Re();Mn();Jl();FJr=Be(DAt()),LAt=class{present(e,r){switch(r.type){case"json":return this.json(e);case"table":return this.table(e)}}json(e){return JSON.stringify(e.map(r=>({id:r.id,name:r.name||"(unnamed)",roles:r.roles})),null,2)}table(e){let r=new FJr.default({head:["ID","Name","Roles"],colWidths:[40,25,20]});return e.forEach(n=>{var i;r.push([n.id.substring(0,36)+(n.id.length>36?"...":""),n.name||"(unnamed)",((i=n.roles)===null||i===void 0?void 0:i.join(", "))||"-"])}),r.toString()}},nWi=[{name:"",description:"List available session servers",options:[["--json","Output in JSON format",void 0,!1]],action:t=>N(void 0,void 0,void 0,function*(){let e=Z(io),r=Z(No),n=new LAt;yield r.initialize(),e.initialize();try{let i=e.getServers?yield e.getServers():[];if(i.length===0){console.log("No servers available. Daemon may not be connected to any Session Servers.");return}let o=n.present(i,{type:t?.json?"json":"table"});console.log(o)}catch(i){console.error("Failed to list servers:",i.message),process.exit(1)}})}]});var xy,l9e,_w,qJr,c9e=g(()=>{xy=()=>new Map,l9e=t=>{let e=xy();return t.forEach((r,n)=>{e.set(n,r)}),e},_w=(t,e,r)=>{let n=t.get(e);return n===void 0&&t.set(e,n=r()),n},qJr=(t,e)=>{for(let[r,n]of t)if(e(n,r))return!0;return!1}});var I7,qAt=g(()=>{I7=()=>new Set});var d9e,UJr,bw,$At,f9e=g(()=>{d9e=t=>t[t.length-1],UJr=(t,e)=>{for(let r=0;r<e.length;r++)t.push(e[r])},bw=Array.from,$At=Array.isArray});var p9e,QJr=g(()=>{c9e();qAt();f9e();p9e=class{constructor(){this._observers=xy()}on(e,r){return _w(this._observers,e,I7).add(r),r}once(e,r){let n=(...i)=>{this.off(e,n),r(...i)};this.on(e,n)}off(e,r){let n=this._observers.get(e);n!==void 0&&(n.delete(r),n.size===0&&this._observers.delete(e))}emit(e,r){return bw((this._observers.get(e)||xy()).values()).forEach(n=>n(...r))}destroy(){this._observers=xy()}}});var C1,nY,h9e,jx,gMa,m9e,ape=g(()=>{C1=Math.floor,nY=Math.abs,h9e=(t,e)=>t<e?t:e,jx=(t,e)=>t>e?t:e,gMa=Number.isNaN,m9e=t=>t!==0?t<0:1/t<0});var QAt,yMa,vMa,VJr,AMa,_Ma,VAt=g(()=>{ape();QAt=Number.MAX_SAFE_INTEGER,yMa=Number.MIN_SAFE_INTEGER,vMa=1<<31,VJr=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&C1(t)===t),AMa=Number.isNaN,_Ma=Number.parseInt});var iWi,bMa,EMa,oWi,sWi,aWi,uWi,HAt,lWi,oY,cWi,GJr,iY,y9e=g(()=>{iWi=String.fromCharCode,bMa=String.fromCodePoint,EMa=iWi(65535),oWi=t=>t.toLowerCase(),sWi=/^\s*/g,aWi=t=>t.replace(sWi,""),uWi=/([A-Z])/g,HAt=(t,e)=>aWi(t.replace(uWi,r=>`${e}${oWi(r)}`)),lWi=t=>{let e=unescape(encodeURIComponent(t)),r=e.length,n=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=e.codePointAt(i);return n},oY=typeof TextEncoder<"u"?new TextEncoder:null,cWi=t=>oY.encode(t),GJr=oY?cWi:lWi,iY=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});iY&&iY.decode(new Uint8Array).length===1&&(iY=null)});var T7,lpe,dWi,oE,fWi,Yf,A9e,cs,_9e,zAt,pWi,hWi,mWi,x7,cpe,t0,KAt,gWi,yWi,vWi,KJr,AWi,aY,upe,WJr,N7,YJr,uY,v9e,JJr=g(()=>{ape();VAt();y9e();f9e();T7=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},lpe=()=>new T7,dWi=t=>{let e=t.cpos;for(let r=0;r<t.bufs.length;r++)e+=t.bufs[r].length;return e},oE=t=>{let e=new Uint8Array(dWi(t)),r=0;for(let n=0;n<t.bufs.length;n++){let i=t.bufs[n];e.set(i,r),r+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),r),e},fWi=(t,e)=>{let r=t.cbuf.length;r-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(jx(r,e)*2),t.cpos=0)},Yf=(t,e)=>{let r=t.cbuf.length;t.cpos===r&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(r*2),t.cpos=0),t.cbuf[t.cpos++]=e},A9e=Yf,cs=(t,e)=>{for(;e>127;)Yf(t,128|127&e),e=C1(e/128);Yf(t,127&e)},_9e=(t,e)=>{let r=m9e(e);for(r&&(e=-e),Yf(t,(e>63?128:0)|(r?64:0)|63&e),e=C1(e/64);e>0;)Yf(t,(e>127?128:0)|127&e),e=C1(e/128)},zAt=new Uint8Array(3e4),pWi=zAt.length/3,hWi=(t,e)=>{if(e.length<pWi){let r=oY.encodeInto(e,zAt).written||0;cs(t,r);for(let n=0;n<r;n++)Yf(t,zAt[n])}else t0(t,GJr(e))},mWi=(t,e)=>{let r=unescape(encodeURIComponent(e)),n=r.length;cs(t,n);for(let i=0;i<n;i++)Yf(t,r.codePointAt(i))},x7=oY&&oY.encodeInto?hWi:mWi,cpe=(t,e)=>{let r=t.cbuf.length,n=t.cpos,i=h9e(r-n,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),n),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(jx(r*2,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},t0=(t,e)=>{cs(t,e.byteLength),cpe(t,e)},KAt=(t,e)=>{fWi(t,e);let r=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,r},gWi=(t,e)=>KAt(t,4).setFloat32(0,e,!1),yWi=(t,e)=>KAt(t,8).setFloat64(0,e,!1),vWi=(t,e)=>KAt(t,8).setBigInt64(0,e,!1),KJr=new DataView(new ArrayBuffer(4)),AWi=t=>(KJr.setFloat32(0,t),KJr.getFloat32(0)===t),aY=(t,e)=>{switch(typeof e){case"string":Yf(t,119),x7(t,e);break;case"number":VJr(e)&&nY(e)<=2147483647?(Yf(t,125),_9e(t,e)):AWi(e)?(Yf(t,124),gWi(t,e)):(Yf(t,123),yWi(t,e));break;case"bigint":Yf(t,122),vWi(t,e);break;case"object":if(e===null)Yf(t,126);else if($At(e)){Yf(t,117),cs(t,e.length);for(let r=0;r<e.length;r++)aY(t,e[r])}else if(e instanceof Uint8Array)Yf(t,116),t0(t,e);else{Yf(t,118);let r=Object.keys(e);cs(t,r.length);for(let n=0;n<r.length;n++){let i=r[n];x7(t,i),aY(t,e[i])}}break;case"boolean":Yf(t,e?120:121);break;default:Yf(t,127)}},upe=class extends T7{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&cs(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},WJr=t=>{t.count>0&&(_9e(t.encoder,t.count===1?t.s:-t.s),t.count>1&&cs(t.encoder,t.count-2))},N7=class{constructor(){this.encoder=new T7,this.s=0,this.count=0}write(e){this.s===e?this.count++:(WJr(this),this.count=1,this.s=e)}toUint8Array(){return WJr(this),oE(this.encoder)}},YJr=t=>{if(t.count>0){let e=t.diff*2+(t.count===1?0:1);_9e(t.encoder,e),t.count>1&&cs(t.encoder,t.count-2)}},uY=class{constructor(){this.encoder=new T7,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(YJr(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return YJr(this),oE(this.encoder)}},v9e=class{constructor(){this.sarr=[],this.s="",this.lensE=new N7}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){let e=new T7;return this.sarr.push(this.s),this.s="",x7(e,this.sarr.join("")),cpe(e,this.lensE.toUint8Array()),oE(e)}}});var Ew,sE,aE,WAt=g(()=>{Ew=t=>new Error(t),sE=()=>{throw Ew("Method unimplemented")},aE=()=>{throw Ew("Unexpected case")}});var XJr,eZr,lY,B7,tZr,bWi,r0,O7,Vo,E9e,EWi,DWi,R7,YAt,SWi,wWi,CWi,IWi,cY,dpe,P7,dY,b9e,rZr=g(()=>{ape();VAt();y9e();WAt();XJr=Ew("Unexpected end of array"),eZr=Ew("Integer out of Range"),lY=class{constructor(e){this.arr=e,this.pos=0}},B7=t=>new lY(t),tZr=t=>t.pos!==t.arr.length,bWi=(t,e)=>{let r=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,r},r0=t=>bWi(t,Vo(t)),O7=t=>t.arr[t.pos++],Vo=t=>{let e=0,r=1,n=t.arr.length;for(;t.pos<n;){let i=t.arr[t.pos++];if(e=e+(i&127)*r,r*=128,i<128)return e;if(e>QAt)throw eZr}throw XJr},E9e=t=>{let e=t.arr[t.pos++],r=e&63,n=64,i=(e&64)>0?-1:1;if((e&128)===0)return i*r;let o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],r=r+(e&127)*n,n*=128,e<128)return i*r;if(r>QAt)throw eZr}throw XJr},EWi=t=>{let e=Vo(t);if(e===0)return"";{let r=String.fromCodePoint(O7(t));if(--e<100)for(;e--;)r+=String.fromCodePoint(O7(t));else for(;e>0;){let n=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+n);t.pos+=n,r+=String.fromCodePoint.apply(null,i),e-=n}return decodeURIComponent(escape(r))}},DWi=t=>iY.decode(r0(t)),R7=iY?DWi:EWi,YAt=(t,e)=>{let r=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,r},SWi=t=>YAt(t,4).getFloat32(0,!1),wWi=t=>YAt(t,8).getFloat64(0,!1),CWi=t=>YAt(t,8).getBigInt64(0,!1),IWi=[t=>{},t=>null,E9e,SWi,wWi,CWi,t=>!1,t=>!0,R7,t=>{let e=Vo(t),r={};for(let n=0;n<e;n++){let i=R7(t);r[i]=cY(t)}return r},t=>{let e=Vo(t),r=[];for(let n=0;n<e;n++)r.push(cY(t));return r},r0],cY=t=>IWi[127-O7(t)](t),dpe=class extends lY{constructor(e,r){super(e),this.reader=r,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),tZr(this)?this.count=Vo(this)+1:this.count=-1),this.count--,this.s}},P7=class extends lY{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=E9e(this);let e=m9e(this.s);this.count=1,e&&(this.s=-this.s,this.count=Vo(this)+2)}return this.count--,this.s}},dY=class extends lY{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=E9e(this),r=e&1;this.diff=C1(e/2),this.count=1,r&&(this.count=Vo(this)+2)}return this.s+=this.diff,this.count--,this.s}},b9e=class{constructor(e){this.decoder=new P7(e),this.str=R7(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),r=this.str.slice(this.spos,e);return this.spos=e,r}}});import{webcrypto as JAt}from"node:crypto";var CMa,nZr,iZr=g(()=>{CMa=JAt.subtle,nZr=JAt.getRandomValues.bind(JAt)});var ZAt,xWi,oZr,sZr=g(()=>{iZr();ZAt=()=>nZr(new Uint32Array(1))[0],xWi="10000000-1000-4000-8000"+-1e11,oZr=()=>xWi.replace(/[018]/g,t=>(t^ZAt()&15>>t/4).toString(16))});var aZr,uZr=g(()=>{aZr=Date.now});var XAt,xMa,lZr=g(()=>{XAt=t=>new Promise(t),xMa=Promise.all.bind(Promise)});var e_t,cZr=g(()=>{e_t=t=>t===void 0?null:t});var t_t,dZr,BWi,fZr,pZr=g(()=>{t_t=class{constructor(){this.map=new Map}setItem(e,r){this.map.set(e,r)}getItem(e){return this.map.get(e)}},dZr=new t_t,BWi=!0;try{typeof localStorage<"u"&&localStorage&&(dZr=localStorage,BWi=!1)}catch{}fZr=dZr});var MWi,hZr,mZr=g(()=>{MWi=Symbol("Equality"),hZr=(t,e)=>t===e||!!t?.[MWi]?.(e)||!1});var yZr,LWi,vZr,gZr,AZr,jWi,qWi,_Zr,$Wi,r_t,bZr=g(()=>{mZr();yZr=Object.assign,LWi=Object.keys,vZr=(t,e)=>{for(let r in t)e(t[r],r)},gZr=t=>LWi(t).length,AZr=t=>{for(let e in t)return!1;return!0},jWi=(t,e)=>{for(let r in t)if(!e(t[r],r))return!1;return!0},qWi=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),_Zr=(t,e)=>t===e||gZr(t)===gZr(e)&&jWi(t,(r,n)=>(r!==void 0||qWi(e,n))&&hZr(e[n],r)),$Wi=Object.freeze,r_t=t=>{for(let e in t){let r=t[e];(typeof r=="object"||typeof r=="function")&&r_t(t[e])}return $Wi(t)}});var fpe,EZr,DZr,D9e=g(()=>{fpe=(t,e,r=0)=>{try{for(;r<t.length;r++)t[r](...e)}finally{r<t.length&&fpe(t,e,r+1)}},EZr=t=>t,DZr=(t,e)=>e.includes(t)});var ppe,NMa,Dw,QWi,VWi,n_t,hpe,wZr,OMa,HWi,CZr,i_t=g(()=>{c9e();y9e();cZr();pZr();D9e();ppe=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",NMa=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,QWi=[],VWi=()=>{if(Dw===void 0)if(ppe){Dw=xy();let t=process.argv,e=null;for(let r=0;r<t.length;r++){let n=t[r];n[0]==="-"?(e!==null&&Dw.set(e,""),e=n):e!==null?(Dw.set(e,n),e=null):QWi.push(n)}e!==null&&Dw.set(e,"")}else typeof location=="object"?(Dw=xy(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){let[e,r]=t.split("=");Dw.set(`--${HAt(e,"-")}`,r),Dw.set(`-${HAt(e,"-")}`,r)}})):Dw=xy();return Dw},n_t=t=>VWi().has(t),hpe=t=>ppe?e_t(process.env[t.toUpperCase().replaceAll("-","_")]):e_t(fZr.getItem(t)),wZr=t=>n_t("--"+t)||hpe(t)!==null,OMa=wZr("production"),HWi=ppe&&DZr(process.env.FORCE_COLOR,["true","1","2"]),CZr=HWi||!n_t("--no-colors")&&!wZr("no-color")&&(!ppe||process.stdout.isTTY)&&(!ppe||n_t("--color")||hpe("COLORTERM")!==null||(hpe("TERM")||"").includes("color"))});var GWi,TZr,xZr=g(()=>{GWi=t=>new Uint8Array(t),TZr=t=>{let e=GWi(t.byteLength);return e.set(t),e}});var Sw,NZr=g(()=>{Sw=Symbol});var mpe,gpe,o_t,s_t,a_t,ype,u_t,vpe,l_t,OZr,RMa,c_t=g(()=>{NZr();uZr();mpe=Sw(),gpe=Sw(),o_t=Sw(),s_t=Sw(),a_t=Sw(),ype=Sw(),u_t=Sw(),vpe=Sw(),l_t=Sw(),OZr=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());let e=[],r=[],n=0;for(;n<t.length;n++){let i=t[n];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(n>0&&r.push(e.join(""));n<t.length;n++){let i=t[n];i instanceof Symbol||r.push(i)}return r},RMa=aZr()});var YWi,JWi,RZr,PZr,BZr,kZr=g(()=>{i_t();c_t();c_t();YWi={[mpe]:"\x1B[1m",[gpe]:"\x1B[2m",[o_t]:"\x1B[34m",[a_t]:"\x1B[32m",[s_t]:"\x1B[37m",[ype]:"\x1B[31m",[u_t]:"\x1B[35m",[vpe]:"\x1B[38;5;208m",[l_t]:"\x1B[0m"},JWi=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());let e=[],r=[],n=0;for(;n<t.length;n++){let i=t[n],o=YWi[i];if(o!==void 0)e.push(o);else{if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else break}}for(n>0&&(e.push("\x1B[0m"),r.push(e.join("")));n<t.length;n++){let i=t[n];i instanceof Symbol||r.push(i)}return r},RZr=CZr?JWi:OZr,PZr=(...t)=>{console.log(...RZr(t))},BZr=(...t)=>{console.warn(...RZr(t))}});var MZr,FZr,S9e,LZr=g(()=>{MZr=t=>({[Symbol.iterator](){return this},next:t}),FZr=(t,e)=>MZr(()=>{let r;do r=t.next();while(!r.done&&!e(r.value));return r}),S9e=(t,e)=>MZr(()=>{let{done:r,value:n}=t.next();return{done:r,value:r?void 0:e(n)}})});function*bYi(t){let e=Vo(t.restDecoder);for(let r=0;r<e;r++){let n=Vo(t.restDecoder),i=t.readClient(),o=Vo(t.restDecoder);for(let s=0;s<n;s++){let a=t.readInfo();if(a===10){let u=Vo(t.restDecoder);yield new i0(Ts(i,o),u),o+=u}else if((31&a)!==0){let u=(a&192)===0,l=new Zf(Ts(i,o),null,(a&128)===128?t.readLeftID():null,null,(a&64)===64?t.readRightID():null,u?t.readParentInfo()?t.readString():t.readLeftID():null,u&&(a&32)===32?t.readString():null,IXr(t,a));yield l,o+=l.length}else{let u=t.readLen();yield new n0(Ts(i,o),u),o+=u}}}}var _pe,k7,ZZr,rYi,XZr,T_t,nYi,N9e,eXr,iYi,gY,x_t,$Zr,tXr,qx,O9e,R9e,p_t,NR,P9e,M7,B9e,$x,oYi,N_t,sYi,aYi,uYi,lYi,rXr,O_t,cYi,dYi,R_t,fYi,nXr,iXr,pYi,hYi,oXr,h_t,UZr,QZr,VZr,sXr,xR,w9e,Ts,mYi,m_t,gYi,jMa,fY,g_t,k9e,U9e,Jf,aXr,ww,yYi,d_t,y_t,OR,HZr,vYi,uXr,v_t,GZr,zZr,T9e,AYi,_Yi,lXr,Tu,bpe,Epe,P_t,EYi,M9e,DYi,cXr,IR,B_t,SYi,wYi,KZr,pY,CYi,kh,dXr,k_t,A_t,IYi,fXr,TYi,Q9e,Dpe,V9e,mf,pXr,hXr,Spe,mXr,xYi,gXr,F9e,yXr,vXr,NYi,AXr,L9e,M_t,F_t,_Xr,bXr,OYi,C9e,__t,j9e,RYi,b_t,wpe,PYi,TR,Cpe,WZr,I9e,EXr,yY,DXr,SXr,f_t,YZr,wXr,BYi,kYi,MYi,JZr,E_t,Ipe,FYi,Ape,hY,LYi,Tpe,jYi,D_t,S_t,qYi,w_t,$Yi,xpe,UYi,n0,Npe,QYi,q9e,VYi,CXr,Ope,HYi,F7,GYi,gf,zYi,C_t,KYi,WYi,mY,YYi,Ux,JYi,ZYi,XYi,eJi,tJi,rJi,nJi,iJi,oJi,Qx,sJi,$9e,Zf,IXr,aJi,uJi,i0,TXr,xXr,H9e=g(()=>{QJr();f9e();ape();c9e();JJr();rZr();sZr();lZr();xZr();WAt();D9e();D9e();qAt();kZr();LZr();bZr();i_t();_pe=class{constructor(e,r){this.clock=e,this.len=r}},k7=class{constructor(){this.clients=new Map}},ZZr=(t,e,r)=>e.clients.forEach((n,i)=>{let o=t.doc.store.clients.get(i);if(o!=null){let s=o[o.length-1],a=s.id.clock+s.length;for(let u=0,l=n[u];u<n.length&&l.clock<a;l=n[++u])uXr(t,o,l.clock,l.len,r)}}),rYi=(t,e)=>{let r=0,n=t.length-1;for(;r<=n;){let i=C1((r+n)/2),o=t[i],s=o.clock;if(s<=e){if(e<s+o.len)return i;r=i+1}else n=i-1}return null},XZr=(t,e)=>{let r=t.clients.get(e.client);return r!==void 0&&rYi(r,e.clock)!==null},T_t=t=>{t.clients.forEach(e=>{e.sort((i,o)=>i.clock-o.clock);let r,n;for(r=1,n=1;r<e.length;r++){let i=e[n-1],o=e[r];i.clock+i.len>=o.clock?i.len=jx(i.len,o.clock+o.len-i.clock):(n<r&&(e[n]=o),n++)}e.length=n})},nYi=t=>{let e=new k7;for(let r=0;r<t.length;r++)t[r].clients.forEach((n,i)=>{if(!e.clients.has(i)){let o=n.slice();for(let s=r+1;s<t.length;s++)UJr(o,t[s].clients.get(i)||[]);e.clients.set(i,o)}});return T_t(e),e},N9e=(t,e,r,n)=>{_w(t.clients,e,()=>[]).push(new _pe(r,n))},eXr=()=>new k7,iYi=t=>{let e=eXr();return t.clients.forEach((r,n)=>{let i=[];for(let o=0;o<r.length;o++){let s=r[o];if(s.deleted){let a=s.id.clock,u=s.length;if(o+1<r.length)for(let l=r[o+1];o+1<r.length&&l.deleted;l=r[++o+1])u+=l.length;i.push(new _pe(a,u))}}i.length>0&&e.clients.set(n,i)}),e},gY=(t,e)=>{cs(t.restEncoder,e.clients.size),bw(e.clients.entries()).sort((r,n)=>n[0]-r[0]).forEach(([r,n])=>{t.resetDsCurVal(),cs(t.restEncoder,r);let i=n.length;cs(t.restEncoder,i);for(let o=0;o<i;o++){let s=n[o];t.writeDsClock(s.clock),t.writeDsLen(s.len)}})},x_t=t=>{let e=new k7,r=Vo(t.restDecoder);for(let n=0;n<r;n++){t.resetDsCurVal();let i=Vo(t.restDecoder),o=Vo(t.restDecoder);if(o>0){let s=_w(e.clients,i,()=>[]);for(let a=0;a<o;a++)s.push(new _pe(t.readDsClock(),t.readDsLen()))}}return e},$Zr=(t,e,r)=>{let n=new k7,i=Vo(t.restDecoder);for(let o=0;o<i;o++){t.resetDsCurVal();let s=Vo(t.restDecoder),a=Vo(t.restDecoder),u=r.clients.get(s)||[],l=Jf(r,s);for(let c=0;c<a;c++){let f=t.readDsClock(),h=f+t.readDsLen();if(f<l){l<h&&N9e(n,s,l,h-l);let m=ww(u,f),A=u[m];for(!A.deleted&&A.id.clock<f&&(u.splice(m+1,0,$9e(e,A,f-A.id.clock)),m++);m<u.length&&(A=u[m++],A.id.clock<h);)A.deleted||(h<A.id.clock+A.length&&u.splice(m,0,$9e(e,A,h-A.id.clock)),A.delete(e))}else N9e(n,s,f,h-f)}}if(n.clients.size>0){let o=new $x;return cs(o.restEncoder,0),gY(o,n),o.toUint8Array()}return null},tXr=ZAt,qx=class t extends p9e{constructor({guid:e=oZr(),collectionid:r=null,gc:n=!0,gcFilter:i=()=>!0,meta:o=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=n,this.gcFilter=i,this.clientID=tXr(),this.guid=e,this.collectionid=r,this.share=new Map,this.store=new k9e,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=o,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=XAt(l=>{this.on("load",()=>{this.isLoaded=!0,l(this)})});let u=()=>XAt(l=>{let c=f=>{(f===void 0||f===!0)&&(this.off("sync",c),l())};this.on("sync",c)});this.on("sync",l=>{l===!1&&this.isSynced&&(this.whenSynced=u()),this.isSynced=l===void 0||l===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=u()}load(){let e=this._item;e!==null&&!this.shouldLoad&&Tu(e.parent.doc,r=>{r.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(bw(this.subdocs).map(e=>e.guid))}transact(e,r=null){return Tu(this,e,r)}get(e,r=mf){let n=_w(this.share,e,()=>{let o=new r;return o._integrate(this,null),o}),i=n.constructor;if(r!==mf&&i!==r)if(i===mf){let o=new r;o._map=n._map,n._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=o}),o._start=n._start;for(let s=o._start;s!==null;s=s.right)s.parent=o;return o._length=n._length,this.share.set(e,o),o._integrate(this,null),o}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return n}getArray(e=""){return this.get(e,j9e)}getText(e=""){return this.get(e,Ipe)}getMap(e=""){return this.get(e,wpe)}getXmlElement(e=""){return this.get(e,Tpe)}getXmlFragment(e=""){return this.get(e,hY)}toJSON(){let e={};return this.share.forEach((r,n)=>{e[n]=r.toJSON()}),e}destroy(){this.isDestroyed=!0,bw(this.subdocs).forEach(r=>r.destroy());let e=this._item;if(e!==null){this._item=null;let r=e.content;r.doc=new t({guid:this.guid,...r.opts,shouldLoad:!1}),r.doc._item=e,Tu(e.parent.doc,n=>{let i=r.doc;e.deleted||n.subdocsAdded.add(i),n.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},O9e=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Vo(this.restDecoder)}readDsLen(){return Vo(this.restDecoder)}},R9e=class extends O9e{readLeftID(){return Ts(Vo(this.restDecoder),Vo(this.restDecoder))}readRightID(){return Ts(Vo(this.restDecoder),Vo(this.restDecoder))}readClient(){return Vo(this.restDecoder)}readInfo(){return O7(this.restDecoder)}readString(){return R7(this.restDecoder)}readParentInfo(){return Vo(this.restDecoder)===1}readTypeRef(){return Vo(this.restDecoder)}readLen(){return Vo(this.restDecoder)}readAny(){return cY(this.restDecoder)}readBuf(){return TZr(r0(this.restDecoder))}readJSON(){return JSON.parse(R7(this.restDecoder))}readKey(){return R7(this.restDecoder)}},p_t=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Vo(this.restDecoder),this.dsCurrVal}readDsLen(){let e=Vo(this.restDecoder)+1;return this.dsCurrVal+=e,e}},NR=class extends p_t{constructor(e){super(e),this.keys=[],Vo(e),this.keyClockDecoder=new dY(r0(e)),this.clientDecoder=new P7(r0(e)),this.leftClockDecoder=new dY(r0(e)),this.rightClockDecoder=new dY(r0(e)),this.infoDecoder=new dpe(r0(e),O7),this.stringDecoder=new b9e(r0(e)),this.parentInfoDecoder=new dpe(r0(e),O7),this.typeRefDecoder=new P7(r0(e)),this.lenDecoder=new P7(r0(e))}readLeftID(){return new xR(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new xR(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return cY(this.restDecoder)}readBuf(){return r0(this.restDecoder)}readJSON(){return cY(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let r=this.stringDecoder.read();return this.keys.push(r),r}}},P9e=class{constructor(){this.restEncoder=lpe()}toUint8Array(){return oE(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){cs(this.restEncoder,e)}writeDsLen(e){cs(this.restEncoder,e)}},M7=class extends P9e{writeLeftID(e){cs(this.restEncoder,e.client),cs(this.restEncoder,e.clock)}writeRightID(e){cs(this.restEncoder,e.client),cs(this.restEncoder,e.clock)}writeClient(e){cs(this.restEncoder,e)}writeInfo(e){A9e(this.restEncoder,e)}writeString(e){x7(this.restEncoder,e)}writeParentInfo(e){cs(this.restEncoder,e?1:0)}writeTypeRef(e){cs(this.restEncoder,e)}writeLen(e){cs(this.restEncoder,e)}writeAny(e){aY(this.restEncoder,e)}writeBuf(e){t0(this.restEncoder,e)}writeJSON(e){x7(this.restEncoder,JSON.stringify(e))}writeKey(e){x7(this.restEncoder,e)}},B9e=class{constructor(){this.restEncoder=lpe(),this.dsCurrVal=0}toUint8Array(){return oE(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let r=e-this.dsCurrVal;this.dsCurrVal=e,cs(this.restEncoder,r)}writeDsLen(e){e===0&&aE(),cs(this.restEncoder,e-1),this.dsCurrVal+=e}},$x=class extends B9e{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new uY,this.clientEncoder=new N7,this.leftClockEncoder=new uY,this.rightClockEncoder=new uY,this.infoEncoder=new upe(A9e),this.stringEncoder=new v9e,this.parentInfoEncoder=new upe(A9e),this.typeRefEncoder=new N7,this.lenEncoder=new N7}toUint8Array(){let e=lpe();return cs(e,0),t0(e,this.keyClockEncoder.toUint8Array()),t0(e,this.clientEncoder.toUint8Array()),t0(e,this.leftClockEncoder.toUint8Array()),t0(e,this.rightClockEncoder.toUint8Array()),t0(e,oE(this.infoEncoder)),t0(e,this.stringEncoder.toUint8Array()),t0(e,oE(this.parentInfoEncoder)),t0(e,this.typeRefEncoder.toUint8Array()),t0(e,this.lenEncoder.toUint8Array()),cpe(e,oE(this.restEncoder)),oE(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){aY(this.restEncoder,e)}writeBuf(e){t0(this.restEncoder,e)}writeJSON(e){aY(this.restEncoder,e)}writeKey(e){let r=this.keyMap.get(e);r===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(r)}},oYi=(t,e,r,n)=>{n=jx(n,e[0].id.clock);let i=ww(e,n);cs(t.restEncoder,e.length-i),t.writeClient(r),cs(t.restEncoder,n);let o=e[i];o.write(t,n-o.id.clock);for(let s=i+1;s<e.length;s++)e[s].write(t,0)},N_t=(t,e,r)=>{let n=new Map;r.forEach((i,o)=>{Jf(e,o)>i&&n.set(o,i)}),U9e(e).forEach((i,o)=>{r.has(o)||n.set(o,0)}),cs(t.restEncoder,n.size),bw(n.entries()).sort((i,o)=>o[0]-i[0]).forEach(([i,o])=>{oYi(t,e.clients.get(i),i,o)})},sYi=(t,e)=>{let r=xy(),n=Vo(t.restDecoder);for(let i=0;i<n;i++){let o=Vo(t.restDecoder),s=new Array(o),a=t.readClient(),u=Vo(t.restDecoder);r.set(a,{i:0,refs:s});for(let l=0;l<o;l++){let c=t.readInfo();switch(31&c){case 0:{let f=t.readLen();s[l]=new n0(Ts(a,u),f),u+=f;break}case 10:{let f=Vo(t.restDecoder);s[l]=new i0(Ts(a,u),f),u+=f;break}default:{let f=(c&192)===0,h=new Zf(Ts(a,u),null,(c&128)===128?t.readLeftID():null,null,(c&64)===64?t.readRightID():null,f?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,f&&(c&32)===32?t.readString():null,IXr(t,c));s[l]=h,u+=h.length}}}}return r},aYi=(t,e,r)=>{let n=[],i=bw(r.keys()).sort((m,A)=>m-A);if(i.length===0)return null;let o=()=>{if(i.length===0)return null;let m=r.get(i[i.length-1]);for(;m.refs.length===m.i;)if(i.pop(),i.length>0)m=r.get(i[i.length-1]);else return null;return m},s=o();if(s===null)return null;let a=new k9e,u=new Map,l=(m,A)=>{let E=u.get(m);(E==null||E>A)&&u.set(m,A)},c=s.refs[s.i++],f=new Map,h=()=>{for(let m of n){let A=m.id.client,E=r.get(A);E?(E.i--,a.clients.set(A,E.refs.slice(E.i)),r.delete(A),E.i=0,E.refs=[]):a.clients.set(A,[m]),i=i.filter(b=>b!==A)}n.length=0};for(;;){if(c.constructor!==i0){let A=_w(f,c.id.client,()=>Jf(e,c.id.client))-c.id.clock;if(A<0)n.push(c),l(c.id.client,c.id.clock-1),h();else{let E=c.getMissing(t,e);if(E!==null){n.push(c);let b=r.get(E)||{refs:[],i:0};if(b.refs.length===b.i)l(E,Jf(e,E)),h();else{c=b.refs[b.i++];continue}}else(A===0||A<c.length)&&(c.integrate(t,A),f.set(c.id.client,c.id.clock+c.length))}}if(n.length>0)c=n.pop();else if(s!==null&&s.i<s.refs.length)c=s.refs[s.i++];else{if(s=o(),s===null)break;c=s.refs[s.i++]}}if(a.clients.size>0){let m=new $x;return N_t(m,a,new Map),cs(m.restEncoder,0),{missing:u,update:m.toUint8Array()}}return null},uYi=(t,e)=>N_t(t,e.doc.store,e.beforeState),lYi=(t,e,r,n=new NR(t))=>Tu(e,i=>{i.local=!1;let o=!1,s=i.doc,a=s.store,u=sYi(n,s),l=aYi(i,a,u),c=a.pendingStructs;if(c){for(let[h,m]of c.missing)if(m<Jf(a,h)){o=!0;break}if(l){for(let[h,m]of l.missing){let A=c.missing.get(h);(A==null||A>m)&&c.missing.set(h,m)}c.update=M9e([c.update,l.update])}}else a.pendingStructs=l;let f=$Zr(n,i,a);if(a.pendingDs){let h=new NR(B7(a.pendingDs));Vo(h.restDecoder);let m=$Zr(h,i,a);f&&m?a.pendingDs=M9e([f,m]):a.pendingDs=f||m}else a.pendingDs=f;if(o){let h=a.pendingStructs.update;a.pendingStructs=null,rXr(i.doc,h)}},r,!1),rXr=(t,e,r,n=NR)=>{let i=B7(e);lYi(i,t,r,new n(i))},O_t=(t,e,r)=>rXr(t,e,r,R9e),cYi=(t,e,r=new Map)=>{N_t(t,e.store,r),gY(t,iYi(e.store))},dYi=(t,e=new Uint8Array([0]),r=new $x)=>{let n=nXr(e);cYi(r,t,n);let i=[r.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(DYi(t.store.pendingStructs.update,e)),i.length>1){if(r.constructor===M7)return P_t(i.map((o,s)=>s===0?o:wYi(o)));if(r.constructor===$x)return M9e(i)}return i[0]},R_t=(t,e)=>dYi(t,e,new M7),fYi=t=>{let e=new Map,r=Vo(t.restDecoder);for(let n=0;n<r;n++){let i=Vo(t.restDecoder),o=Vo(t.restDecoder);e.set(i,o)}return e},nXr=t=>fYi(new O9e(B7(t))),iXr=(t,e)=>(cs(t.restEncoder,e.size),bw(e.entries()).sort((r,n)=>n[0]-r[0]).forEach(([r,n])=>{cs(t.restEncoder,r),cs(t.restEncoder,n)}),t),pYi=(t,e)=>iXr(t,U9e(e.store)),hYi=(t,e=new B9e)=>(t instanceof Map?iXr(e,t):pYi(e,t),e.toUint8Array()),oXr=t=>hYi(t,new P9e),h_t=class{constructor(){this.l=[]}},UZr=()=>new h_t,QZr=(t,e)=>t.l.push(e),VZr=(t,e)=>{let r=t.l,n=r.length;t.l=r.filter(i=>e!==i),n===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},sXr=(t,e,r)=>fpe(t.l,[e,r]),xR=class{constructor(e,r){this.client=e,this.clock=r}},w9e=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Ts=(t,e)=>new xR(t,e),mYi=t=>{for(let[e,r]of t.doc.share.entries())if(r===t)return e;throw aE()},m_t=class{constructor(e,r){this.ds=e,this.sv=r}},gYi=(t,e)=>new m_t(t,e),jMa=gYi(eXr(),new Map),fY=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!XZr(e.ds,t.id),g_t=(t,e)=>{let r=_w(t.meta,g_t,I7),n=t.doc.store;r.has(e)||(e.sv.forEach((i,o)=>{i<Jf(n,o)&&OR(t,Ts(o,i))}),ZZr(t,e.ds,i=>{}),r.add(e))},k9e=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},U9e=t=>{let e=new Map;return t.clients.forEach((r,n)=>{let i=r[r.length-1];e.set(n,i.id.clock+i.length)}),e},Jf=(t,e)=>{let r=t.clients.get(e);if(r===void 0)return 0;let n=r[r.length-1];return n.id.clock+n.length},aXr=(t,e)=>{let r=t.clients.get(e.id.client);if(r===void 0)r=[],t.clients.set(e.id.client,r);else{let n=r[r.length-1];if(n.id.clock+n.length!==e.id.clock)throw aE()}r.push(e)},ww=(t,e)=>{let r=0,n=t.length-1,i=t[n],o=i.id.clock;if(o===e)return n;let s=C1(e/(o+i.length-1)*n);for(;r<=n;){if(i=t[s],o=i.id.clock,o<=e){if(e<o+i.length)return s;r=s+1}else n=s-1;s=C1((r+n)/2)}throw aE()},yYi=(t,e)=>{let r=t.clients.get(e.client);return r[ww(r,e.clock)]},d_t=yYi,y_t=(t,e,r)=>{let n=ww(e,r),i=e[n];return i.id.clock<r&&i instanceof Zf?(e.splice(n+1,0,$9e(t,i,r-i.id.clock)),n+1):n},OR=(t,e)=>{let r=t.doc.store.clients.get(e.client);return r[y_t(t,r,e.clock)]},HZr=(t,e,r)=>{let n=e.clients.get(r.client),i=ww(n,r.clock),o=n[i];return r.clock!==o.id.clock+o.length-1&&o.constructor!==n0&&n.splice(i+1,0,$9e(t,o,r.clock-o.id.clock+1)),o},vYi=(t,e,r)=>{let n=t.clients.get(e.id.client);n[ww(n,e.id.clock)]=r},uXr=(t,e,r,n,i)=>{if(n===0)return;let o=r+n,s=y_t(t,e,r),a;do a=e[s++],o<a.id.clock+a.length&&y_t(t,e,o),i(a);while(s<e.length&&e[s].id.clock<o)},v_t=class{constructor(e,r,n){this.doc=e,this.deleteSet=new k7,this.beforeState=U9e(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=r,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},GZr=(t,e)=>e.deleteSet.clients.size===0&&!qJr(e.afterState,(r,n)=>e.beforeState.get(n)!==r)?!1:(T_t(e.deleteSet),uYi(t,e),gY(t,e.deleteSet),!0),zZr=(t,e,r)=>{let n=e._item;(n===null||n.id.clock<(t.beforeState.get(n.id.client)||0)&&!n.deleted)&&_w(t.changed,e,I7).add(r)},T9e=(t,e)=>{let r=t[e],n=t[e-1],i=e;for(;i>0;r=n,n=t[--i-1]){if(n.deleted===r.deleted&&n.constructor===r.constructor&&n.mergeWith(r)){r instanceof Zf&&r.parentSub!==null&&r.parent._map.get(r.parentSub)===r&&r.parent._map.set(r.parentSub,n);continue}break}let o=e-i;return o&&t.splice(e+1-o,o),o},AYi=(t,e,r)=>{for(let[n,i]of t.clients.entries()){let o=e.clients.get(n);for(let s=i.length-1;s>=0;s--){let a=i[s],u=a.clock+a.len;for(let l=ww(o,a.clock),c=o[l];l<o.length&&c.id.clock<u;c=o[++l]){let f=o[l];if(a.clock+a.len<=f.id.clock)break;f instanceof Zf&&f.deleted&&!f.keep&&r(f)&&f.gc(e,!1)}}}},_Yi=(t,e)=>{t.clients.forEach((r,n)=>{let i=e.clients.get(n);for(let o=r.length-1;o>=0;o--){let s=r[o],a=h9e(i.length-1,1+ww(i,s.clock+s.len-1));for(let u=a,l=i[u];u>0&&l.id.clock>=s.clock;l=i[u])u-=1+T9e(i,u)}})},lXr=(t,e)=>{if(e<t.length){let r=t[e],n=r.doc,i=n.store,o=r.deleteSet,s=r._mergeStructs;try{T_t(o),r.afterState=U9e(r.doc.store),n.emit("beforeObserverCalls",[r,n]);let a=[];r.changed.forEach((u,l)=>a.push(()=>{(l._item===null||!l._item.deleted)&&l._callObserver(r,u)})),a.push(()=>{r.changedParentTypes.forEach((u,l)=>{l._dEH.l.length>0&&(l._item===null||!l._item.deleted)&&(u=u.filter(c=>c.target._item===null||!c.target._item.deleted),u.forEach(c=>{c.currentTarget=l,c._path=null}),u.sort((c,f)=>c.path.length-f.path.length),a.push(()=>{sXr(l._dEH,u,r)}))}),a.push(()=>n.emit("afterTransaction",[r,n])),a.push(()=>{r._needFormattingCleanup&&MYi(r)})}),fpe(a,[])}finally{n.gc&&AYi(o,i,n.gcFilter),_Yi(o,i),r.afterState.forEach((c,f)=>{let h=r.beforeState.get(f)||0;if(h!==c){let m=i.clients.get(f),A=jx(ww(m,h),1);for(let E=m.length-1;E>=A;)E-=1+T9e(m,E)}});for(let c=s.length-1;c>=0;c--){let{client:f,clock:h}=s[c].id,m=i.clients.get(f),A=ww(m,h);A+1<m.length&&T9e(m,A+1)>1||A>0&&T9e(m,A)}if(!r.local&&r.afterState.get(n.clientID)!==r.beforeState.get(n.clientID)&&(PZr(vpe,mpe,"[yjs] ",gpe,ype,"Changed the client-id because another client seems to be using it."),n.clientID=tXr()),n.emit("afterTransactionCleanup",[r,n]),n._observers.has("update")){let c=new M7;GZr(c,r)&&n.emit("update",[c.toUint8Array(),r.origin,n,r])}if(n._observers.has("updateV2")){let c=new $x;GZr(c,r)&&n.emit("updateV2",[c.toUint8Array(),r.origin,n,r])}let{subdocsAdded:a,subdocsLoaded:u,subdocsRemoved:l}=r;(a.size>0||l.size>0||u.size>0)&&(a.forEach(c=>{c.clientID=n.clientID,c.collectionid==null&&(c.collectionid=n.collectionid),n.subdocs.add(c)}),l.forEach(c=>n.subdocs.delete(c)),n.emit("subdocs",[{loaded:u,added:a,removed:l},n,r]),l.forEach(c=>c.destroy())),t.length<=e+1?(n._transactionCleanups=[],n.emit("afterAllTransactions",[n,t])):lXr(t,e+1)}}},Tu=(t,e,r=null,n=!0)=>{let i=t._transactionCleanups,o=!1,s=null;t._transaction===null&&(o=!0,t._transaction=new v_t(t,r,n),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{s=e(t._transaction)}finally{if(o){let a=t._transaction===i[0];t._transaction=null,a&&lXr(i,0)}}return s};bpe=class{constructor(e,r){this.gen=bYi(e),this.curr=null,this.done=!1,this.filterSkips=r,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===i0);return this.curr}},Epe=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},P_t=t=>M9e(t,R9e,M7),EYi=(t,e)=>{if(t.constructor===n0){let{client:r,clock:n}=t.id;return new n0(Ts(r,n+e),t.length-e)}else if(t.constructor===i0){let{client:r,clock:n}=t.id;return new i0(Ts(r,n+e),t.length-e)}else{let r=t,{client:n,clock:i}=r.id;return new Zf(Ts(n,i+e),null,Ts(n,i+e-1),null,r.rightOrigin,r.parent,r.parentSub,r.content.splice(e))}},M9e=(t,e=NR,r=$x)=>{if(t.length===1)return t[0];let n=t.map(c=>new e(B7(c))),i=n.map(c=>new bpe(c,!0)),o=null,s=new r,a=new Epe(s);for(;i=i.filter(h=>h.curr!==null),i.sort((h,m)=>{if(h.curr.id.client===m.curr.id.client){let A=h.curr.id.clock-m.curr.id.clock;return A===0?h.curr.constructor===m.curr.constructor?0:h.curr.constructor===i0?1:-1:A}else return m.curr.id.client-h.curr.id.client}),i.length!==0;){let c=i[0],f=c.curr.id.client;if(o!==null){let h=c.curr,m=!1;for(;h!==null&&h.id.clock+h.length<=o.struct.id.clock+o.struct.length&&h.id.client>=o.struct.id.client;)h=c.next(),m=!0;if(h===null||h.id.client!==f||m&&h.id.clock>o.struct.id.clock+o.struct.length)continue;if(f!==o.struct.id.client)IR(a,o.struct,o.offset),o={struct:h,offset:0},c.next();else if(o.struct.id.clock+o.struct.length<h.id.clock)if(o.struct.constructor===i0)o.struct.length=h.id.clock+h.length-o.struct.id.clock;else{IR(a,o.struct,o.offset);let A=h.id.clock-o.struct.id.clock-o.struct.length;o={struct:new i0(Ts(f,o.struct.id.clock+o.struct.length),A),offset:0}}else{let A=o.struct.id.clock+o.struct.length-h.id.clock;A>0&&(o.struct.constructor===i0?o.struct.length-=A:h=EYi(h,A)),o.struct.mergeWith(h)||(IR(a,o.struct,o.offset),o={struct:h,offset:0},c.next())}}else o={struct:c.curr,offset:0},c.next();for(let h=c.curr;h!==null&&h.id.client===f&&h.id.clock===o.struct.id.clock+o.struct.length&&h.constructor!==i0;h=c.next())IR(a,o.struct,o.offset),o={struct:h,offset:0}}o!==null&&(IR(a,o.struct,o.offset),o=null),B_t(a);let u=n.map(c=>x_t(c)),l=nYi(u);return gY(s,l),s.toUint8Array()},DYi=(t,e,r=NR,n=$x)=>{let i=nXr(e),o=new n,s=new Epe(o),a=new r(B7(t)),u=new bpe(a,!1);for(;u.curr;){let c=u.curr,f=c.id.client,h=i.get(f)||0;if(u.curr.constructor===i0){u.next();continue}if(c.id.clock+c.length>h)for(IR(s,c,jx(h-c.id.clock,0)),u.next();u.curr&&u.curr.id.client===f;)IR(s,u.curr,0),u.next();else for(;u.curr&&u.curr.id.client===f&&u.curr.id.clock+u.curr.length<=h;)u.next()}B_t(s);let l=x_t(a);return gY(o,l),o.toUint8Array()},cXr=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:oE(t.encoder.restEncoder)}),t.encoder.restEncoder=lpe(),t.written=0)},IR=(t,e,r)=>{t.written>0&&t.currClient!==e.id.client&&cXr(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),cs(t.encoder.restEncoder,e.id.clock+r)),e.write(t.encoder,r),t.written++},B_t=t=>{cXr(t);let e=t.encoder.restEncoder;cs(e,t.clientStructs.length);for(let r=0;r<t.clientStructs.length;r++){let n=t.clientStructs[r];cs(e,n.written),cpe(e,n.restEncoder)}},SYi=(t,e,r,n)=>{let i=new r(B7(t)),o=new bpe(i,!1),s=new n,a=new Epe(s);for(let l=o.curr;l!==null;l=o.next())IR(a,e(l),0);B_t(a);let u=x_t(i);return gY(s,u),s.toUint8Array()},wYi=t=>SYi(t,EZr,NR,M7),KZr="You must not compute changes after the event-handler fired.",pY=class{constructor(e,r){this.target=e,this.currentTarget=e,this.transaction=r,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=CYi(this.currentTarget,this.target))}deletes(e){return XZr(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ew(KZr);let e=new Map,r=this.target;this.transaction.changed.get(r).forEach(i=>{if(i!==null){let o=r._map.get(i),s,a;if(this.adds(o)){let u=o.left;for(;u!==null&&this.adds(u);)u=u.left;if(this.deletes(o))if(u!==null&&this.deletes(u))s="delete",a=d9e(u.content.getContent());else return;else u!==null&&this.deletes(u)?(s="update",a=d9e(u.content.getContent())):(s="add",a=void 0)}else if(this.deletes(o))s="delete",a=d9e(o.content.getContent());else return;e.set(i,{action:s,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ew(KZr);let r=this.target,n=I7(),i=I7(),o=[];if(e={added:n,deleted:i,delta:o,keys:this.keys},this.transaction.changed.get(r).has(null)){let a=null,u=()=>{a&&o.push(a)};for(let l=r._start;l!==null;l=l.right)l.deleted?this.deletes(l)&&!this.adds(l)&&((a===null||a.delete===void 0)&&(u(),a={delete:0}),a.delete+=l.length,i.add(l)):this.adds(l)?((a===null||a.insert===void 0)&&(u(),a={insert:[]}),a.insert=a.insert.concat(l.content.getContent()),n.add(l)):((a===null||a.retain===void 0)&&(u(),a={retain:0}),a.retain+=l.length);a!==null&&a.retain===void 0&&u()}this._changes=e}return e}},CYi=(t,e)=>{let r=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)r.unshift(e._item.parentSub);else{let n=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(n+=i.length),i=i.right;r.unshift(n)}e=e._item.parent}return r},kh=()=>{BZr("Invalid access: Add Yjs type to a document before reading data.")},dXr=80,k_t=0,A_t=class{constructor(e,r){e.marker=!0,this.p=e,this.index=r,this.timestamp=k_t++}},IYi=t=>{t.timestamp=k_t++},fXr=(t,e,r)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=r,t.timestamp=k_t++},TYi=(t,e,r)=>{if(t.length>=dXr){let n=t.reduce((i,o)=>i.timestamp<o.timestamp?i:o);return fXr(n,e,r),n}else{let n=new A_t(e,r);return t.push(n),n}},Q9e=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;let r=t._searchMarker.length===0?null:t._searchMarker.reduce((o,s)=>nY(e-o.index)<nY(e-s.index)?o:s),n=t._start,i=0;for(r!==null&&(n=r.p,i=r.index,IYi(r));n.right!==null&&i<e;){if(!n.deleted&&n.countable){if(e<i+n.length)break;i+=n.length}n=n.right}for(;n.left!==null&&i>e;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);for(;n.left!==null&&n.left.id.client===n.id.client&&n.left.id.clock+n.left.length===n.id.clock;)n=n.left,!n.deleted&&n.countable&&(i-=n.length);return r!==null&&nY(r.index-i)<n.parent.length/dXr?(fXr(r,n,i),r):TYi(t._searchMarker,n,i)},Dpe=(t,e,r)=>{for(let n=t.length-1;n>=0;n--){let i=t[n];if(r>0){let o=i.p;for(o.marker=!1;o&&(o.deleted||!o.countable);)o=o.left,o&&!o.deleted&&o.countable&&(i.index-=o.length);if(o===null||o.marker===!0){t.splice(n,1);continue}i.p=o,o.marker=!0}(e<i.index||r>0&&e===i.index)&&(i.index=jx(e,i.index+r))}},V9e=(t,e,r)=>{let n=t,i=e.changedParentTypes;for(;_w(i,t,()=>[]).push(r),t._item!==null;)t=t._item.parent;sXr(n._eH,r,e)},mf=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=UZr(),this._dEH=UZr(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,r){this.doc=e,this._item=r}_copy(){throw sE()}clone(){throw sE()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,r){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){QZr(this._eH,e)}observeDeep(e){QZr(this._dEH,e)}unobserve(e){VZr(this._eH,e)}unobserveDeep(e){VZr(this._dEH,e)}toJSON(){}},pXr=(t,e,r)=>{t.doc??kh(),e<0&&(e=t._length+e),r<0&&(r=t._length+r);let n=r-e,i=[],o=t._start;for(;o!==null&&n>0;){if(o.countable&&!o.deleted){let s=o.content.getContent();if(s.length<=e)e-=s.length;else{for(let a=e;a<s.length&&n>0;a++)i.push(s[a]),n--;e=0}}o=o.right}return i},hXr=t=>{t.doc??kh();let e=[],r=t._start;for(;r!==null;){if(r.countable&&!r.deleted){let n=r.content.getContent();for(let i=0;i<n.length;i++)e.push(n[i])}r=r.right}return e},Spe=(t,e)=>{let r=0,n=t._start;for(t.doc??kh();n!==null;){if(n.countable&&!n.deleted){let i=n.content.getContent();for(let o=0;o<i.length;o++)e(i[o],r++,t)}n=n.right}},mXr=(t,e)=>{let r=[];return Spe(t,(n,i)=>{r.push(e(n,i,t))}),r},xYi=t=>{let e=t._start,r=null,n=0;return{[Symbol.iterator](){return this},next:()=>{if(r===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};r=e.content.getContent(),n=0,e=e.right}let i=r[n++];return r.length<=n&&(r=null),{done:!1,value:i}}}},gXr=(t,e)=>{t.doc??kh();let r=Q9e(t,e),n=t._start;for(r!==null&&(n=r.p,e-=r.index);n!==null;n=n.right)if(!n.deleted&&n.countable){if(e<n.length)return n.content.getContent()[e];e-=n.length}},F9e=(t,e,r,n)=>{let i=r,o=t.doc,s=o.clientID,a=o.store,u=r===null?e._start:r.right,l=[],c=()=>{l.length>0&&(i=new Zf(Ts(s,Jf(a,s)),i,i&&i.lastId,u,u&&u.id,e,null,new mY(l)),i.integrate(t,0),l=[])};n.forEach(f=>{if(f===null)l.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:l.push(f);break;default:switch(c(),f.constructor){case Uint8Array:case ArrayBuffer:i=new Zf(Ts(s,Jf(a,s)),i,i&&i.lastId,u,u&&u.id,e,null,new Npe(new Uint8Array(f))),i.integrate(t,0);break;case qx:i=new Zf(Ts(s,Jf(a,s)),i,i&&i.lastId,u,u&&u.id,e,null,new Ope(f)),i.integrate(t,0);break;default:if(f instanceof mf)i=new Zf(Ts(s,Jf(a,s)),i,i&&i.lastId,u,u&&u.id,e,null,new Qx(f)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},yXr=()=>Ew("Length exceeded!"),vXr=(t,e,r,n)=>{if(r>e._length)throw yXr();if(r===0)return e._searchMarker&&Dpe(e._searchMarker,r,n.length),F9e(t,e,null,n);let i=r,o=Q9e(e,r),s=e._start;for(o!==null&&(s=o.p,r-=o.index,r===0&&(s=s.prev,r+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(r<=s.length){r<s.length&&OR(t,Ts(s.id.client,s.id.clock+r));break}r-=s.length}return e._searchMarker&&Dpe(e._searchMarker,i,n.length),F9e(t,e,s,n)},NYi=(t,e,r)=>{let i=(e._searchMarker||[]).reduce((o,s)=>s.index>o.index?s:o,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return F9e(t,e,i,r)},AXr=(t,e,r,n)=>{if(n===0)return;let i=r,o=n,s=Q9e(e,r),a=e._start;for(s!==null&&(a=s.p,r-=s.index);a!==null&&r>0;a=a.right)!a.deleted&&a.countable&&(r<a.length&&OR(t,Ts(a.id.client,a.id.clock+r)),r-=a.length);for(;n>0&&a!==null;)a.deleted||(n<a.length&&OR(t,Ts(a.id.client,a.id.clock+n)),a.delete(t),n-=a.length),a=a.right;if(n>0)throw yXr();e._searchMarker&&Dpe(e._searchMarker,i,-o+n)},L9e=(t,e,r)=>{let n=e._map.get(r);n!==void 0&&n.delete(t)},M_t=(t,e,r,n)=>{let i=e._map.get(r)||null,o=t.doc,s=o.clientID,a;if(n==null)a=new mY([n]);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new mY([n]);break;case Uint8Array:a=new Npe(n);break;case qx:a=new Ope(n);break;default:if(n instanceof mf)a=new Qx(n);else throw new Error("Unexpected content type")}new Zf(Ts(s,Jf(o.store,s)),i,i&&i.lastId,null,null,e,r,a).integrate(t,0)},F_t=(t,e)=>{t.doc??kh();let r=t._map.get(e);return r!==void 0&&!r.deleted?r.content.getContent()[r.length-1]:void 0},_Xr=t=>{let e={};return t.doc??kh(),t._map.forEach((r,n)=>{r.deleted||(e[n]=r.content.getContent()[r.length-1])}),e},bXr=(t,e)=>{t.doc??kh();let r=t._map.get(e);return r!==void 0&&!r.deleted},OYi=(t,e)=>{let r={};return t._map.forEach((n,i)=>{let o=n;for(;o!==null&&(!e.sv.has(o.id.client)||o.id.clock>=(e.sv.get(o.id.client)||0));)o=o.left;o!==null&&fY(o,e)&&(r[i]=o.content.getContent()[o.length-1])}),r},C9e=t=>(t.doc??kh(),FZr(t._map.entries(),e=>!e[1].deleted)),__t=class extends pY{},j9e=class t extends mf{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){let r=new t;return r.push(e),r}_integrate(e,r){super._integrate(e,r),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new t}clone(){let e=new t;return e.insert(0,this.toArray().map(r=>r instanceof mf?r.clone():r)),e}get length(){return this.doc??kh(),this._length}_callObserver(e,r){super._callObserver(e,r),V9e(this,e,new __t(this,e))}insert(e,r){this.doc!==null?Tu(this.doc,n=>{vXr(n,this,e,r)}):this._prelimContent.splice(e,0,...r)}push(e){this.doc!==null?Tu(this.doc,r=>{NYi(r,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,r=1){this.doc!==null?Tu(this.doc,n=>{AXr(n,this,e,r)}):this._prelimContent.splice(e,r)}get(e){return gXr(this,e)}toArray(){return hXr(this)}slice(e=0,r=this.length){return pXr(this,e,r)}toJSON(){return this.map(e=>e instanceof mf?e.toJSON():e)}map(e){return mXr(this,e)}forEach(e){Spe(this,e)}[Symbol.iterator](){return xYi(this)}_write(e){e.writeTypeRef(XYi)}},RYi=t=>new j9e,b_t=class extends pY{constructor(e,r,n){super(e,r),this.keysChanged=n}},wpe=class t extends mf{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,r){super._integrate(e,r),this._prelimContent.forEach((n,i)=>{this.set(i,n)}),this._prelimContent=null}_copy(){return new t}clone(){let e=new t;return this.forEach((r,n)=>{e.set(n,r instanceof mf?r.clone():r)}),e}_callObserver(e,r){V9e(this,e,new b_t(this,e,r))}toJSON(){this.doc??kh();let e={};return this._map.forEach((r,n)=>{if(!r.deleted){let i=r.content.getContent()[r.length-1];e[n]=i instanceof mf?i.toJSON():i}}),e}get size(){return[...C9e(this)].length}keys(){return S9e(C9e(this),e=>e[0])}values(){return S9e(C9e(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return S9e(C9e(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??kh(),this._map.forEach((r,n)=>{r.deleted||e(r.content.getContent()[r.length-1],n,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Tu(this.doc,r=>{L9e(r,this,e)}):this._prelimContent.delete(e)}set(e,r){return this.doc!==null?Tu(this.doc,n=>{M_t(n,this,e,r)}):this._prelimContent.set(e,r),r}get(e){return F_t(this,e)}has(e){return bXr(this,e)}clear(){this.doc!==null?Tu(this.doc,e=>{this.forEach(function(r,n,i){L9e(e,i,n)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(eJi)}},PYi=t=>new wpe,TR=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&_Zr(t,e),Cpe=class{constructor(e,r,n,i){this.left=e,this.right=r,this.index=n,this.currentAttributes=i}forward(){this.right===null&&aE(),this.right.content.constructor===gf?this.right.deleted||yY(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},WZr=(t,e,r)=>{for(;e.right!==null&&r>0;)e.right.content.constructor===gf?e.right.deleted||yY(e.currentAttributes,e.right.content):e.right.deleted||(r<e.right.length&&OR(t,Ts(e.right.id.client,e.right.id.clock+r)),e.index+=e.right.length,r-=e.right.length),e.left=e.right,e.right=e.right.right;return e},I9e=(t,e,r,n)=>{let i=new Map,o=n?Q9e(e,r):null;if(o){let s=new Cpe(o.p.left,o.p,o.index,i);return WZr(t,s,r-o.index)}else{let s=new Cpe(null,e._start,0,i);return WZr(t,s,r)}},EXr=(t,e,r,n)=>{for(;r.right!==null&&(r.right.deleted===!0||r.right.content.constructor===gf&&TR(n.get(r.right.content.key),r.right.content.value));)r.right.deleted||n.delete(r.right.content.key),r.forward();let i=t.doc,o=i.clientID;n.forEach((s,a)=>{let u=r.left,l=r.right,c=new Zf(Ts(o,Jf(i.store,o)),u,u&&u.lastId,l,l&&l.id,e,null,new gf(a,s));c.integrate(t,0),r.right=c,r.forward()})},yY=(t,e)=>{let{key:r,value:n}=e;n===null?t.delete(r):t.set(r,n)},DXr=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===gf&&TR(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},SXr=(t,e,r,n)=>{let i=t.doc,o=i.clientID,s=new Map;for(let a in n){let u=n[a],l=r.currentAttributes.get(a)??null;if(!TR(l,u)){s.set(a,l);let{left:c,right:f}=r;r.right=new Zf(Ts(o,Jf(i.store,o)),c,c&&c.lastId,f,f&&f.id,e,null,new gf(a,u)),r.right.integrate(t,0),r.forward()}}return s},f_t=(t,e,r,n,i)=>{r.currentAttributes.forEach((h,m)=>{i[m]===void 0&&(i[m]=null)});let o=t.doc,s=o.clientID;DXr(r,i);let a=SXr(t,e,r,i),u=n.constructor===String?new Ux(n):n instanceof mf?new Qx(n):new F7(n),{left:l,right:c,index:f}=r;e._searchMarker&&Dpe(e._searchMarker,r.index,u.getLength()),c=new Zf(Ts(s,Jf(o.store,s)),l,l&&l.lastId,c,c&&c.id,e,null,u),c.integrate(t,0),r.right=c,r.index=f,r.forward(),EXr(t,e,r,a)},YZr=(t,e,r,n,i)=>{let o=t.doc,s=o.clientID;DXr(r,i);let a=SXr(t,e,r,i);e:for(;r.right!==null&&(n>0||a.size>0&&(r.right.deleted||r.right.content.constructor===gf));){if(!r.right.deleted)switch(r.right.content.constructor){case gf:{let{key:u,value:l}=r.right.content,c=i[u];if(c!==void 0){if(TR(c,l))a.delete(u);else{if(n===0)break e;a.set(u,l)}r.right.delete(t)}else r.currentAttributes.set(u,l);break}default:n<r.right.length&&OR(t,Ts(r.right.id.client,r.right.id.clock+n)),n-=r.right.length;break}r.forward()}if(n>0){let u="";for(;n>0;n--)u+=`
|
|
1167
1167
|
`;r.right=new Zf(Ts(s,Jf(o.store,s)),r.left,r.left&&r.left.lastId,r.right,r.right&&r.right.id,e,null,new Ux(u)),r.right.integrate(t,0),r.forward()}EXr(t,e,r,a)},wXr=(t,e,r,n,i)=>{let o=e,s=xy();for(;o&&(!o.countable||o.deleted);){if(!o.deleted&&o.content.constructor===gf){let l=o.content;s.set(l.key,l)}o=o.right}let a=0,u=!1;for(;e!==o;){if(r===e&&(u=!0),!e.deleted){let l=e.content;if(l.constructor===gf){let{key:c,value:f}=l,h=n.get(c)??null;(s.get(c)!==l||h===f)&&(e.delete(t),a++,!u&&(i.get(c)??null)===f&&h!==f&&(h===null?i.delete(c):i.set(c,h))),!u&&!e.deleted&&yY(i,l)}}e=e.right}return a},BYi=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;let r=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===gf){let n=e.content.key;r.has(n)?e.delete(t):r.add(n)}e=e.left}},kYi=t=>{let e=0;return Tu(t.doc,r=>{let n=t._start,i=t._start,o=xy(),s=l9e(o);for(;i;)i.deleted===!1&&(i.content.constructor===gf?yY(s,i.content):(e+=wXr(r,n,i,o,s),o=l9e(s),n=i)),i=i.right}),e},MYi=t=>{let e=new Set,r=t.doc;for(let[n,i]of t.afterState.entries()){let o=t.beforeState.get(n)||0;i!==o&&uXr(t,r.store.clients.get(n),o,i,s=>{!s.deleted&&s.content.constructor===gf&&s.constructor!==n0&&e.add(s.parent)})}Tu(r,n=>{ZZr(t,t.deleteSet,i=>{if(i instanceof n0||!i.parent._hasFormatting||e.has(i.parent))return;let o=i.parent;i.content.constructor===gf?e.add(o):BYi(n,i)});for(let i of e)kYi(i)})},JZr=(t,e,r)=>{let n=r,i=l9e(e.currentAttributes),o=e.right;for(;r>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Qx:case F7:case Ux:r<e.right.length&&OR(t,Ts(e.right.id.client,e.right.id.clock+r)),r-=e.right.length,e.right.delete(t);break}e.forward()}o&&wXr(t,o,e.right,i,e.currentAttributes);let s=(e.left||e.right).parent;return s._searchMarker&&Dpe(s._searchMarker,e.index,-n+r),e},E_t=class extends pY{constructor(e,r,n){super(e,r),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){let e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){let e=this.target.doc,r=[];Tu(e,n=>{let i=new Map,o=new Map,s=this.target._start,a=null,u={},l="",c=0,f=0,h=()=>{if(a!==null){let m=null;switch(a){case"delete":f>0&&(m={delete:f}),f=0;break;case"insert":(typeof l=="object"||l.length>0)&&(m={insert:l},i.size>0&&(m.attributes={},i.forEach((A,E)=>{A!==null&&(m.attributes[E]=A)}))),l="";break;case"retain":c>0&&(m={retain:c},AZr(u)||(m.attributes=yZr({},u))),c=0;break}m&&r.push(m),a=null}};for(;s!==null;){switch(s.content.constructor){case Qx:case F7:this.adds(s)?this.deletes(s)||(h(),a="insert",l=s.content.getContent()[0],h()):this.deletes(s)?(a!=="delete"&&(h(),a="delete"),f+=1):s.deleted||(a!=="retain"&&(h(),a="retain"),c+=1);break;case Ux:this.adds(s)?this.deletes(s)||(a!=="insert"&&(h(),a="insert"),l+=s.content.str):this.deletes(s)?(a!=="delete"&&(h(),a="delete"),f+=s.length):s.deleted||(a!=="retain"&&(h(),a="retain"),c+=s.length);break;case gf:{let{key:m,value:A}=s.content;if(this.adds(s)){if(!this.deletes(s)){let E=i.get(m)??null;TR(E,A)?A!==null&&s.delete(n):(a==="retain"&&h(),TR(A,o.get(m)??null)?delete u[m]:u[m]=A)}}else if(this.deletes(s)){o.set(m,A);let E=i.get(m)??null;TR(E,A)||(a==="retain"&&h(),u[m]=E)}else if(!s.deleted){o.set(m,A);let E=u[m];E!==void 0&&(TR(E,A)?E!==null&&s.delete(n):(a==="retain"&&h(),A===null?delete u[m]:u[m]=A))}s.deleted||(a==="insert"&&h(),yY(i,s.content));break}}s=s.right}for(h();r.length>0;){let m=r[r.length-1];if(m.retain!==void 0&&m.attributes===void 0)r.pop();else break}}),this._delta=r}return this._delta}},Ipe=class t extends mf{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??kh(),this._length}_integrate(e,r){super._integrate(e,r);try{this._pending.forEach(n=>n())}catch(n){console.error(n)}this._pending=null}_copy(){return new t}clone(){let e=new t;return e.applyDelta(this.toDelta()),e}_callObserver(e,r){super._callObserver(e,r);let n=new E_t(this,e,r);V9e(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??kh();let e="",r=this._start;for(;r!==null;)!r.deleted&&r.countable&&r.content.constructor===Ux&&(e+=r.content.str),r=r.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:r=!0}={}){this.doc!==null?Tu(this.doc,n=>{let i=new Cpe(null,this._start,0,new Map);for(let o=0;o<e.length;o++){let s=e[o];if(s.insert!==void 0){let a=!r&&typeof s.insert=="string"&&o===e.length-1&&i.right===null&&s.insert.slice(-1)===`
|
|
1168
1168
|
`?s.insert.slice(0,-1):s.insert;(typeof a!="string"||a.length>0)&&f_t(n,this,i,a,s.attributes||{})}else s.retain!==void 0?YZr(n,this,i,s.retain,s.attributes||{}):s.delete!==void 0&&JZr(n,i,s.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,r,n){this.doc??kh();let i=[],o=new Map,s=this.doc,a="",u=this._start;function l(){if(a.length>0){let f={},h=!1;o.forEach((A,E)=>{h=!0,f[E]=A});let m={insert:a};h&&(m.attributes=f),i.push(m),a=""}}let c=()=>{for(;u!==null;){if(fY(u,e)||r!==void 0&&fY(u,r))switch(u.content.constructor){case Ux:{let f=o.get("ychange");e!==void 0&&!fY(u,e)?(f===void 0||f.user!==u.id.client||f.type!=="removed")&&(l(),o.set("ychange",n?n("removed",u.id):{type:"removed"})):r!==void 0&&!fY(u,r)?(f===void 0||f.user!==u.id.client||f.type!=="added")&&(l(),o.set("ychange",n?n("added",u.id):{type:"added"})):f!==void 0&&(l(),o.delete("ychange")),a+=u.content.str;break}case Qx:case F7:{l();let f={insert:u.content.getContent()[0]};if(o.size>0){let h={};f.attributes=h,o.forEach((m,A)=>{h[A]=m})}i.push(f);break}case gf:fY(u,e)&&(l(),yY(o,u.content));break}u=u.right}l()};return e||r?Tu(s,f=>{e&&g_t(f,e),r&&g_t(f,r),c()},"cleanup"):c(),i}insert(e,r,n){if(r.length<=0)return;let i=this.doc;i!==null?Tu(i,o=>{let s=I9e(o,this,e,!n);n||(n={},s.currentAttributes.forEach((a,u)=>{n[u]=a})),f_t(o,this,s,r,n)}):this._pending.push(()=>this.insert(e,r,n))}insertEmbed(e,r,n){let i=this.doc;i!==null?Tu(i,o=>{let s=I9e(o,this,e,!n);f_t(o,this,s,r,n||{})}):this._pending.push(()=>this.insertEmbed(e,r,n||{}))}delete(e,r){if(r===0)return;let n=this.doc;n!==null?Tu(n,i=>{JZr(i,I9e(i,this,e,!0),r)}):this._pending.push(()=>this.delete(e,r))}format(e,r,n){if(r===0)return;let i=this.doc;i!==null?Tu(i,o=>{let s=I9e(o,this,e,!1);s.right!==null&&YZr(o,this,s,r,n)}):this._pending.push(()=>this.format(e,r,n))}removeAttribute(e){this.doc!==null?Tu(this.doc,r=>{L9e(r,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,r){this.doc!==null?Tu(this.doc,n=>{M_t(n,this,e,r)}):this._pending.push(()=>this.setAttribute(e,r))}getAttribute(e){return F_t(this,e)}getAttributes(){return _Xr(this)}_write(e){e.writeTypeRef(tJi)}},FYi=t=>new Ipe,Ape=class{constructor(e,r=()=>!0){this._filter=r,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??kh()}[Symbol.iterator](){return this}next(){let e=this._currentNode,r=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(r)))do if(r=e.content.type,!e.deleted&&(r.constructor===Tpe||r.constructor===hY)&&r._start!==null)e=r._start;else for(;e!==null;){let n=e.next;if(n!==null){e=n;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},hY=class t extends mf{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,r){super._integrate(e,r),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new t}clone(){let e=new t;return e.insert(0,this.toArray().map(r=>r instanceof mf?r.clone():r)),e}get length(){return this.doc??kh(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Ape(this,e)}querySelector(e){e=e.toUpperCase();let n=new Ape(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return n.done?null:n.value}querySelectorAll(e){return e=e.toUpperCase(),bw(new Ape(this,r=>r.nodeName&&r.nodeName.toUpperCase()===e))}_callObserver(e,r){V9e(this,e,new D_t(this,r,e))}toString(){return mXr(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,r={},n){let i=e.createDocumentFragment();return n!==void 0&&n._createAssociation(i,this),Spe(this,o=>{i.insertBefore(o.toDOM(e,r,n),null)}),i}insert(e,r){this.doc!==null?Tu(this.doc,n=>{vXr(n,this,e,r)}):this._prelimContent.splice(e,0,...r)}insertAfter(e,r){if(this.doc!==null)Tu(this.doc,n=>{let i=e&&e instanceof mf?e._item:e;F9e(n,this,i,r)});else{let n=this._prelimContent,i=e===null?0:n.findIndex(o=>o===e)+1;if(i===0&&e!==null)throw Ew("Reference item not found");n.splice(i,0,...r)}}delete(e,r=1){this.doc!==null?Tu(this.doc,n=>{AXr(n,this,e,r)}):this._prelimContent.splice(e,r)}toArray(){return hXr(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return gXr(this,e)}slice(e=0,r=this.length){return pXr(this,e,r)}forEach(e){Spe(this,e)}_write(e){e.writeTypeRef(nJi)}},LYi=t=>new hY,Tpe=class t extends hY{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,r){super._integrate(e,r),this._prelimAttrs.forEach((n,i)=>{this.setAttribute(i,n)}),this._prelimAttrs=null}_copy(){return new t(this.nodeName)}clone(){let e=new t(this.nodeName),r=this.getAttributes();return vZr(r,(n,i)=>{e.setAttribute(i,n)}),e.insert(0,this.toArray().map(n=>n instanceof mf?n.clone():n)),e}toString(){let e=this.getAttributes(),r=[],n=[];for(let a in e)n.push(a);n.sort();let i=n.length;for(let a=0;a<i;a++){let u=n[a];r.push(u+'="'+e[u]+'"')}let o=this.nodeName.toLocaleLowerCase(),s=r.length>0?" "+r.join(" "):"";return`<${o}${s}>${super.toString()}</${o}>`}removeAttribute(e){this.doc!==null?Tu(this.doc,r=>{L9e(r,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,r){this.doc!==null?Tu(this.doc,n=>{M_t(n,this,e,r)}):this._prelimAttrs.set(e,r)}getAttribute(e){return F_t(this,e)}hasAttribute(e){return bXr(this,e)}getAttributes(e){return e?OYi(this,e):_Xr(this)}toDOM(e=document,r={},n){let i=e.createElement(this.nodeName),o=this.getAttributes();for(let s in o){let a=o[s];typeof a=="string"&&i.setAttribute(s,a)}return Spe(this,s=>{i.appendChild(s.toDOM(e,r,n))}),n!==void 0&&n._createAssociation(i,this),i}_write(e){e.writeTypeRef(rJi),e.writeKey(this.nodeName)}},jYi=t=>new Tpe(t.readKey()),D_t=class extends pY{constructor(e,r,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}},S_t=class t extends wpe{constructor(e){super(),this.hookName=e}_copy(){return new t(this.hookName)}clone(){let e=new t(this.hookName);return this.forEach((r,n)=>{e.set(n,r)}),e}toDOM(e=document,r={},n){let i=r[this.hookName],o;return i!==void 0?o=i.createDom(this):o=document.createElement(this.hookName),o.setAttribute("data-yjs-hook",this.hookName),n!==void 0&&n._createAssociation(o,this),o}_write(e){e.writeTypeRef(iJi),e.writeKey(this.hookName)}},qYi=t=>new S_t(t.readKey()),w_t=class t extends Ipe{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new t}clone(){let e=new t;return e.applyDelta(this.toDelta()),e}toDOM(e=document,r,n){let i=e.createTextNode(this.toString());return n!==void 0&&n._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{let r=[];for(let i in e.attributes){let o=[];for(let s in e.attributes[i])o.push({key:s,value:e.attributes[i][s]});o.sort((s,a)=>s.key<a.key?-1:1),r.push({nodeName:i,attrs:o})}r.sort((i,o)=>i.nodeName<o.nodeName?-1:1);let n="";for(let i=0;i<r.length;i++){let o=r[i];n+=`<${o.nodeName}`;for(let s=0;s<o.attrs.length;s++){let a=o.attrs[s];n+=` ${a.key}="${a.value}"`}n+=">"}n+=e.insert;for(let i=r.length-1;i>=0;i--)n+=`</${r[i].nodeName}>`;return n}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(oJi)}},$Yi=t=>new w_t,xpe=class{constructor(e,r){this.id=e,this.length=r}get deleted(){throw sE()}mergeWith(e){return!1}write(e,r,n){throw sE()}integrate(e,r){throw sE()}},UYi=0,n0=class extends xpe{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,r){r>0&&(this.id.clock+=r,this.length-=r),aXr(e.doc.store,this)}write(e,r){e.writeInfo(UYi),e.writeLen(this.length-r)}getMissing(e,r){return null}},Npe=class t{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new t(this.content)}splice(e){throw sE()}mergeWith(e){return!1}integrate(e,r){}delete(e){}gc(e){}write(e,r){e.writeBuf(this.content)}getRef(){return 3}},QYi=t=>new Npe(t.readBuf()),q9e=class t{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new t(this.len)}splice(e){let r=new t(this.len-e);return this.len=e,r}mergeWith(e){return this.len+=e.len,!0}integrate(e,r){N9e(e.deleteSet,r.id.client,r.id.clock,this.len),r.markDeleted()}delete(e){}gc(e){}write(e,r){e.writeLen(this.len-r)}getRef(){return 1}},VYi=t=>new q9e(t.readLen()),CXr=(t,e)=>new qx({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1}),Ope=class t{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;let r={};this.opts=r,e.gc||(r.gc=!1),e.autoLoad&&(r.autoLoad=!0),e.meta!==null&&(r.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new t(CXr(this.doc.guid,this.opts))}splice(e){throw sE()}mergeWith(e){return!1}integrate(e,r){this.doc._item=r,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,r){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}},HYi=t=>new Ope(CXr(t.readString(),t.readAny())),F7=class t{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new t(this.embed)}splice(e){throw sE()}mergeWith(e){return!1}integrate(e,r){}delete(e){}gc(e){}write(e,r){e.writeJSON(this.embed)}getRef(){return 5}},GYi=t=>new F7(t.readJSON()),gf=class t{constructor(e,r){this.key=e,this.value=r}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new t(this.key,this.value)}splice(e){throw sE()}mergeWith(e){return!1}integrate(e,r){let n=r.parent;n._searchMarker=null,n._hasFormatting=!0}delete(e){}gc(e){}write(e,r){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}},zYi=t=>new gf(t.readKey(),t.readJSON()),C_t=class t{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new t(this.arr)}splice(e){let r=new t(this.arr.slice(e));return this.arr=this.arr.slice(0,e),r}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,r){}delete(e){}gc(e){}write(e,r){let n=this.arr.length;e.writeLen(n-r);for(let i=r;i<n;i++){let o=this.arr[i];e.writeString(o===void 0?"undefined":JSON.stringify(o))}}getRef(){return 2}},KYi=t=>{let e=t.readLen(),r=[];for(let n=0;n<e;n++){let i=t.readString();i==="undefined"?r.push(void 0):r.push(JSON.parse(i))}return new C_t(r)},WYi=hpe("node_env")==="development",mY=class t{constructor(e){this.arr=e,WYi&&r_t(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new t(this.arr)}splice(e){let r=new t(this.arr.slice(e));return this.arr=this.arr.slice(0,e),r}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,r){}delete(e){}gc(e){}write(e,r){let n=this.arr.length;e.writeLen(n-r);for(let i=r;i<n;i++){let o=this.arr[i];e.writeAny(o)}}getRef(){return 8}},YYi=t=>{let e=t.readLen(),r=[];for(let n=0;n<e;n++)r.push(t.readAny());return new mY(r)},Ux=class t{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new t(this.str)}splice(e){let r=new t(this.str.slice(e));this.str=this.str.slice(0,e);let n=this.str.charCodeAt(e-1);return n>=55296&&n<=56319&&(this.str=this.str.slice(0,e-1)+"\uFFFD",r.str="\uFFFD"+r.str.slice(1)),r}mergeWith(e){return this.str+=e.str,!0}integrate(e,r){}delete(e){}gc(e){}write(e,r){e.writeString(r===0?this.str:this.str.slice(r))}getRef(){return 4}},JYi=t=>new Ux(t.readString()),ZYi=[RYi,PYi,FYi,jYi,LYi,qYi,$Yi],XYi=0,eJi=1,tJi=2,rJi=3,nJi=4,iJi=5,oJi=6,Qx=class t{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new t(this.type._copy())}splice(e){throw sE()}mergeWith(e){return!1}integrate(e,r){this.type._integrate(e.doc,r)}delete(e){let r=this.type._start;for(;r!==null;)r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e),r=r.right;this.type._map.forEach(n=>{n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e)}),e.changed.delete(this.type)}gc(e){let r=this.type._start;for(;r!==null;)r.gc(e,!0),r=r.right;this.type._start=null,this.type._map.forEach(n=>{for(;n!==null;)n.gc(e,!0),n=n.left}),this.type._map=new Map}write(e,r){this.type._write(e)}getRef(){return 7}},sJi=t=>new Qx(ZYi[t.readTypeRef()](t)),$9e=(t,e,r)=>{let{client:n,clock:i}=e.id,o=new Zf(Ts(n,i+r),e,Ts(n,i+r-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(r));return e.deleted&&o.markDeleted(),e.keep&&(o.keep=!0),e.redone!==null&&(o.redone=Ts(e.redone.client,e.redone.clock+r)),e.right=o,o.right!==null&&(o.right.left=o),t._mergeStructs.push(o),o.parentSub!==null&&o.right===null&&o.parent._map.set(o.parentSub,o),e.length=r,o},Zf=class t extends xpe{constructor(e,r,n,i,o,s,a,u){super(e,u.getLength()),this.origin=n,this.left=r,this.right=i,this.rightOrigin=o,this.parent=s,this.parentSub=a,this.redone=null,this.content=u,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(e,r){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=Jf(r,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=Jf(r,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===xR&&this.id.client!==this.parent.client&&this.parent.clock>=Jf(r,this.parent.client))return this.parent.client;if(this.origin&&(this.left=HZr(e,r,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=OR(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===n0||this.right&&this.right.constructor===n0)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===t?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===t&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===xR){let n=d_t(r,this.parent);n.constructor===n0?this.parent=null:this.parent=n.content.type}return null}integrate(e,r){if(r>0&&(this.id.clock+=r,this.left=HZr(e,e.doc.store,Ts(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(r),this.length-=r),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let n=this.left,i;if(n!==null)i=n.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;let o=new Set,s=new Set;for(;i!==null&&i!==this.right;){if(s.add(i),o.add(i),w9e(this.origin,i.origin)){if(i.id.client<this.id.client)n=i,o.clear();else if(w9e(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&s.has(d_t(e.doc.store,i.origin)))o.has(d_t(e.doc.store,i.origin))||(n=i,o.clear());else break;i=i.right}this.left=n}if(this.left!==null){let n=this.left.right;this.right=n,this.left.right=this}else{let n;if(this.parentSub!==null)for(n=this.parent._map.get(this.parentSub)||null;n!==null&&n.left!==null;)n=n.left;else n=this.parent._start,this.parent._start=this;this.right=n}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),aXr(e.doc.store,this),this.content.integrate(e,this),zZr(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new n0(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:Ts(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&w9e(e.origin,this.lastId)&&this.right===e&&w9e(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){let r=this.parent._searchMarker;return r&&r.forEach(n=>{n.p===e&&(n.p=this,!this.deleted&&this.countable&&(n.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){let r=this.parent;this.countable&&this.parentSub===null&&(r._length-=this.length),this.markDeleted(),N9e(e.deleteSet,this.id.client,this.id.clock,this.length),zZr(e,r,this.parentSub),this.content.delete(e)}}gc(e,r){if(!this.deleted)throw aE();this.content.gc(e),r?vYi(e,this,new n0(this.id,this.length)):this.content=new q9e(this.length)}write(e,r){let n=r>0?Ts(this.id.client,this.id.clock+r-1):this.origin,i=this.rightOrigin,o=this.parentSub,s=this.content.getRef()&31|(n===null?0:128)|(i===null?0:64)|(o===null?0:32);if(e.writeInfo(s),n!==null&&e.writeLeftID(n),i!==null&&e.writeRightID(i),n===null&&i===null){let a=this.parent;if(a._item!==void 0){let u=a._item;if(u===null){let l=mYi(a);e.writeParentInfo(!0),e.writeString(l)}else e.writeParentInfo(!1),e.writeLeftID(u.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===xR?(e.writeParentInfo(!1),e.writeLeftID(a)):aE();o!==null&&e.writeString(o)}this.content.write(e,r)}},IXr=(t,e)=>aJi[e&31](t),aJi=[()=>{aE()},VYi,KYi,QYi,JYi,GYi,zYi,sJi,YYi,HYi,()=>{aE()}],uJi=10,i0=class extends xpe{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,r){aE()}write(e,r){e.writeInfo(uJi),cs(e.restEncoder,this.length-r)}getMissing(e,r){return null}},TXr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},xXr="__ $YJS$ __";TXr[xXr]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");TXr[xXr]=!0});function j_t(t){return t==="root"||/^servers\/[^/]+$/.test(t)}var NXr=g(()=>{});var lJi,OXr,cJi,L7,Rpe=g(()=>{lJi=["positions","sizes","sessionSettings","autoLayout","sizePinned","nodeStructure"],OXr=["derivedPositions","derivedSizes"],cJi=["dead"],L7=[...lJi,...cJi]});function q_t(t){return t._doc.getMap("dead")}function PXr(t,e,r){let n=q_t(t);n.has(e)||t._doc.transact(()=>{n.set(e,r)},"janitor")}function BXr(t,e){let r=q_t(t);r.has(e)&&t._doc.transact(()=>{r.delete(e)},"janitor")}function $_t(t,e){let r=[];for(let[n,i]of q_t(t).entries())i+t.tombstoneGraceMs<=e&&r.push(n);r.length!==0&&t._doc.transact(()=>{for(let n of r){for(let i of L7)t._doc.getMap(i).delete(n);for(let i of OXr)t._doc.getMap(i).delete(n)}},"janitor")}function kXr(t){var e,r;if(t.tombstoneTimer)return;let n=setInterval(()=>$_t(t,Date.now()),dJi);(r=(e=n).unref)===null||r===void 0||r.call(e),t.tombstoneTimer=n}var RXr,dJi,U_t=g(()=>{Rpe();RXr=6e4,dJi=1e4});function MXr(t,e,r,n){t._doc.transact(()=>{t.sizes.set(e,r),t.sizePinned.set(e,n)},"user-resize")}function FXr(t,e,r,n="server-write"){t._doc.transact(()=>{t.positions.set(e,r)},n)}function LXr(t,e,r,n="server-write"){t._doc.transact(()=>{t.sizes.set(e,r)},n)}function jXr(t,e,r,n="server-write"){t._doc.transact(()=>{t.sessionSettings.set(e,r)},n)}function qXr(t,e,r,n="server-write"){t._doc.transact(()=>{t.autoLayout.set(e,r)},n)}function $Xr(t,e,r,n="server-write"){t._doc.transact(()=>{t.sizePinned.set(e,r)},n)}function UXr(t,e,r,n="server-write"){t._doc.transact(()=>{t.nodeStructure.set(e,r)},n)}function QXr(t,e,r="server-write"){t._doc.transact(()=>{t.nodeStructure.delete(e)},r)}function VXr(t,e,r="apply-changes"){t._doc.transact(()=>{if(e.positions)for(let[n,i]of Object.entries(e.positions))t.positions.set(n,i);if(e.sizes)for(let[n,i]of Object.entries(e.sizes))i===null?t.sizes.delete(n):t.sizes.set(n,i);if(e.sessionSettings)for(let[n,i]of Object.entries(e.sessionSettings))t.sessionSettings.set(n,i);if(e.autoLayout)for(let[n,i]of Object.entries(e.autoLayout))t.autoLayout.set(n,i);if(e.sizePinned)for(let[n,i]of Object.entries(e.sizePinned))t.sizePinned.set(n,i);if(e.nodeStructure)for(let[n,i]of Object.entries(e.nodeStructure))i===null?t.nodeStructure.delete(n):t.nodeStructure.set(n,i)},r)}function HXr(t,e,r){let n=new Set([e,...r.map(s=>s.id)]);t._doc.transact(()=>{var s;for(let u of L7){let l=t._doc.getMap(u);for(let c of Array.from(l.keys()))j_t(c)&&l.delete(c)}t.nodeStructure.has(e)||t.nodeStructure.set(e,{});let a=0;for(let u of t.nodeStructure.values())typeof u?.order=="number"&&u.order>a&&(a=u.order);for(let u of r){let l=t.nodeStructure.get(u.id);l?u.parentId!==void 0&&l.parentId!==u.parentId&&t.nodeStructure.set(u.id,Object.assign(Object.assign({},l),{parentId:u.parentId})):(a+=1,t.nodeStructure.set(u.id,{parentId:(s=u.parentId)!==null&&s!==void 0?s:e,order:a}))}},"set-sessions");let i=Date.now(),o=new Set;for(let s of t.nodeStructure.values())s?.parentId&&o.add(s.parentId);for(let s of Array.from(t.nodeStructure.keys()))s===e||j_t(s)||(n.has(s)||o.has(s)?BXr(t,s):PXr(t,s,i))}var GXr=g(()=>{NXr();Rpe();U_t()});function zXr(t){return R_t(t._doc)}function KXr(t,e){O_t(t._doc,e)}function WXr(t){return oXr(t._doc)}function YXr(t,e){return R_t(t._doc,e)}function JXr(t,e){t.updateHandlers.add(e),t._doc.on("update",e)}function ZXr(t,e){t.updateHandlers.delete(e),t._doc.off("update",e)}function XXr(t,e){O_t(t._doc,e,"remote")}var een=g(()=>{H9e()});function ten(t){let e=new qx;return t!==void 0&&(e.clientID=t),e}function ren(t,e,r){var n,i;let o=ten(r?.sharedClientID);return(n=r?.onCreate)===null||n===void 0||n.call(r,o),o.transact(()=>{for(let s of e){let a=t.getMap(s),u=o.getMap(s);a.forEach((l,c)=>u.set(c,l))}},(i=r?.origin)!==null&&i!==void 0?i:"compact"),o}var Q_t=g(()=>{H9e();Rpe()});var G9e,Ppe,nen,ien,ZMa,V_t=g(()=>{Cd();G9e=X.object({x:X.number(),y:X.number()}),Ppe=X.object({width:X.number(),height:X.number()}),nen=X.object({displayMode:X.enum(["presentation","develop"]).optional(),panelStates:X.object({query:X.boolean().optional(),transformer:X.boolean().optional(),presenter:X.boolean().optional()}).optional(),transformerId:X.string().optional(),presenterId:X.string().optional()}).strict(),ien=X.object({parentId:X.string().optional(),order:X.number().optional()}).strict(),ZMa=X.object({serverId:X.string()})});function fJi(t){return t==="autolayout"||t==="refit"||t==="compact"||t==="janitor"}function sen(t){t.janitorBound||(t.janitorBound=!0,H_t(t))}function H_t(t){vY(t,t.positions,G9e),vY(t,t.sizes,Ppe),vY(t,t.sessionSettings,nen),vY(t,t.autoLayout,oen),vY(t,t.sizePinned,oen),vY(t,t.nodeStructure,ien)}function vY(t,e,r){e.observe((n,i)=>{if(fJi(i.origin))return;let o=[];for(let[s,a]of n.changes.keys)a.action!=="delete"&&(r.safeParse(e.get(s)).success||o.push(s));o.length!==0&&t._doc.transact(()=>{for(let s of o)e.delete(s)},"janitor")})}var oen,G_t=g(()=>{Cd();V_t();oen=X.boolean()});function z_t(t){let e=t._doc,r=Array.from(t.updateHandlers);t.epoch+=1,ren(e,[...L7],{onCreate:n=>{t._doc=n,K_t(t);for(let i of r)n.on("update",i)}}),t.janitorBound&&H_t(t),e.destroy()}function K_t(t){let e=(r,n)=>{n!=="compact"&&(t.compactScheduled||(t.compactScheduled=!0,queueMicrotask(()=>{t.compactScheduled=!1,t.encodeState().byteLength>=t.compactThresholdBytes&&z_t(t)})))};t._doc.on("update",e)}var aen=g(()=>{Q_t();Rpe();G_t()});function W_t(t,e,r){var n;if(!t&&!e)return;if(!t)return{x:e.x,y:e.y};if(!e)return{x:t.x,y:t.y};if(!r)return{x:t.x,y:t.y};let i=(n=t.rev)!==null&&n!==void 0?n:0;return e.basedOnRev>=i?{x:e.x,y:e.y}:{x:t.x,y:t.y}}function Y_t(t,e,r){return r?t??e:e??t}function J_t(t,e,r){var n;let i=(n=r?.[t])===null||n===void 0?void 0:n.parentId;return i?e[i]!==!1:!0}function uen(t){var e;let r={},n=new Set([...Object.keys(t.positions),...Object.keys(t.derivedPositions)]);for(let i of n){let o=W_t(t.positions[i],t.derivedPositions[i],J_t(i,t.autoLayout,t.nodeStructure));if(!o)continue;let s=(e=t.positions[i])===null||e===void 0?void 0:e.rev;r[i]=s===void 0?o:Object.assign(Object.assign({},o),{rev:s})}return r}function len(t){let e={},r=new Set([...Object.keys(t.sizes),...Object.keys(t.derivedSizes)]);for(let n of r){let i=Y_t(t.sizes[n],t.derivedSizes[n],t.sizePinned[n]===!0);i&&(e[n]=i)}return e}var Z_t=g(()=>{});var z9e,cen,den,fen,Bpe,pen,kpe=g(()=>{z9e={left:1280,right:80,top:128,bottom:80},cen=16,den=48,fen=3,Bpe={width:850,height:650},pen=Math.ceil(Bpe.height/2/16)*16});function pJi(t,e){var r,n,i,o;let s=t.x!==void 0&&t.y!==void 0,a=e.x!==void 0&&e.y!==void 0;if(s&&!a)return-1;if(!s&&a)return 1;let u=(r=t.y)!==null&&r!==void 0?r:0,l=(n=e.y)!==null&&n!==void 0?n:0,c=(i=t.x)!==null&&i!==void 0?i:0,f=(o=e.x)!==null&&o!==void 0?o:0;return Math.abs(u-l)>pen?u-l:c!==f?c-f:0}function hen(t){return[...t].sort((e,r)=>{var n,i;let o=(n=e.order)!==null&&n!==void 0?n:Number.POSITIVE_INFINITY,s=(i=r.order)!==null&&i!==void 0?i:Number.POSITIVE_INFINITY;if(o!==s)return o-s;if(e.order===void 0&&r.order===void 0){let a=pJi(e,r);if(a!==0)return a}return e.id.localeCompare(r.id)})}var men=g(()=>{kpe()});function X_t(t,e,r,n,i,o){let s=new Map,a=new Map,u=z9e,l=den,c=n??Bpe,f=b=>{var S,w;let C=a.get(b.id);if(C)return{width:Rd(C.width),height:Rd(C.height)};let x=i?.[b.id],B=(S=x?.width)!==null&&S!==void 0?S:c.width,L=(w=x?.height)!==null&&w!==void 0?w:c.height;return{width:Rd(B),height:Rd(L)}},h=e.find(b=>b.id===t),m=!h?.parentId,A=b=>b&&b.x!==void 0&&b.y!==void 0?{x:Rd(b.x),y:Rd(b.y)}:{x:Rd(cen),y:Rd(u.top)},E=b=>{var S,w,C,x;let B=hen(e.filter(re=>re.parentId===b));if(B.length===0){let re=i?.[b],oe=(S=re?.width)!==null&&S!==void 0?S:c.width,ve=(w=re?.height)!==null&&w!==void 0?w:c.height;r?.has(b)?a.set(b,{width:oe,height:ve}):a.set(b,{width:Rd(oe),height:Rd(ve)}),b===t&&m&&s.set(b,A(e.find(Ie=>Ie.id===b)));return}if(o?.has(b)){let re=i?.[b];if(re)a.set(b,re);else{let oe=0,ve=0;for(let Ie of B){let Le=f(Ie),Te=(C=Ie.x)!==null&&C!==void 0?C:0,ce=(x=Ie.y)!==null&&x!==void 0?x:0;oe=Math.max(oe,Te+Le.width),ve=Math.max(ve,ce+Le.height)}a.set(b,{width:Rd(oe+u.right),height:Rd(ve+u.bottom)})}b===t&&m&&s.set(b,A(e.find(oe=>oe.id===b)));return}for(let re of B)E(re.id);let L=u.left,q=[],Q=[];for(let re of B)Q.length>=fen?(q.push(Q),Q=[re]):Q.push(re);Q.length>0&&q.push(Q);let V=u.top,le=0;for(let re of q){let oe=0;for(let Ie of re)oe=Math.max(oe,f(Ie).height);let ve=L;for(let Ie of re){let{width:Le}=f(Ie);if(s.set(Ie.id,{x:Rd(ve),y:Rd(V)}),!r?.has(Ie.id)){let Te=a.get(Ie.id);a.set(Ie.id,{width:Te.width,height:oe})}ve+=Le+l}le=Math.max(le,ve-l),V+=oe+l}let pe=Rd(le+u.right),de=Rd(V-l+u.bottom),me=i?.[b];r?.has(b)&&me?a.set(b,me):a.set(b,{width:pe,height:de}),b===t&&m&&s.set(b,A(e.find(re=>re.id===b)))};return E(t),{positions:s,sizes:a}}var gen=g(()=>{kpe();Mpe();men()});function ebt(t,e,r){var n;let i=z9e,o=new Map;for(let u of t)if(u.parentId){let l=(n=o.get(u.parentId))!==null&&n!==void 0?n:[];l.push(u.id),o.set(u.parentId,l)}let s=new Map,a=u=>{var l,c,f;let h=o.get(u);if(!h)return;for(let w of h)a(w);let m=0,A=0;for(let w of h){let C=(l=e[w])!==null&&l!==void 0?l:{x:0,y:0},x=(f=(c=s.get(w))!==null&&c!==void 0?c:r[w])!==null&&f!==void 0?f:Bpe;m=Math.max(m,C.x+x.width),A=Math.max(A,C.y+x.height)}let E=Rd(m+i.right),b=Rd(A+i.bottom),S=r[u];s.set(u,{width:S?Math.max(E,S.width):E,height:S?Math.max(b,S.height):b})};for(let u of t)!u.parentId&&o.has(u.id)&&a(u.id);return s}var yen=g(()=>{kpe();Mpe()});function Rd(t){return Math.ceil(t/16)*16}var Mpe=g(()=>{kpe();gen();yen()});function hJi(t,e){let r=new Set([t]),n=!0;for(;n;){n=!1;for(let i of e)i.parentId&&r.has(i.parentId)&&!r.has(i.id)&&(r.add(i.id),n=!0)}return r}function Aen(t,e){let r=hJi(t,e.nodes),n=e.nodes.filter(u=>r.has(u.id)).map(u=>{var l,c,f;return[u.id,(l=u.parentId)!==null&&l!==void 0?l:null,(c=u.x)!==null&&c!==void 0?c:null,(f=u.y)!==null&&f!==void 0?f:null]}).sort((u,l)=>u[0]<l[0]?-1:u[0]>l[0]?1:0),i=[];if(e.storedSizes){for(let u of r){let l=e.storedSizes[u];l&&i.push([u,{width:l.width,height:l.height}])}i.sort((u,l)=>u[0]<l[0]?-1:1)}let o=[];if(e.disabledNodeIds){for(let u of r)e.disabledNodeIds.has(u)&&o.push(u);o.sort()}let s=[];if(e.autoLayoutOffIds){for(let u of r)e.autoLayoutOffIds.has(u)&&s.push(u);s.sort()}let a=e.defaultNodeSize?{width:e.defaultNodeSize.width,height:e.defaultNodeSize.height}:null;return JSON.stringify([n,i,o,s,a])}function tbt(t){return{positions:new Map(t.positions),sizes:new Map(t.sizes)}}var _en=g(()=>{});function gJi(t,e){let r=Aen(t,e),n=K9e.get(t);if(n&&n.hash===r)return tbt(n.result);let i=X_t(t,e.nodes,e.disabledNodeIds,e.defaultNodeSize,e.storedSizes,e.autoLayoutOffIds),o={positions:i.positions,sizes:i.sizes};return K9e.set(t,{hash:r,result:o}),mJi++,ben.push(t),tbt(o)}function Een(t,e){ben=[];let r=new Map,n=new Map;for(let o of t){let s=gJi(o,e);s.positions.forEach((a,u)=>r.set(u,a)),s.sizes.forEach((a,u)=>n.set(u,a))}let i=new Set(t);for(let o of[...K9e.keys()])i.has(o)||K9e.delete(o);return{positions:r,sizes:n}}var K9e,ben,mJi,Den=g(()=>{Mpe();_en();K9e=new Map,ben=[],mJi=0});function Sen(t,e){return[...Object.entries(t).filter(([,r])=>r===!1).map(([r])=>r),...Object.entries(e).filter(([,r])=>r===!0).map(([r])=>r)]}function wen(t,e){let r=new Set(Object.entries(e).filter(([,s])=>s===!1).map(([s])=>s)),n=new Map(t.map(s=>[s.id,s])),i=new Set(t.filter(s=>s.parentId).map(s=>s.parentId)),o=new Set;for(let s of t){if(s.parentId&&!i.has(s.id)||r.has(s.id))continue;let a=s.id,u=s.id;for(;;){let l=n.get(a);if(!l?.parentId||r.has(l.parentId))break;u=l.parentId,a=l.parentId}o.add(u)}return[...o].sort()}var Cen=g(()=>{});function rbt(t,e){let r={};for(let[n,i]of Object.entries(t))e.safeParse(i).success&&(r[n]=i);return r}function Ien(t){var e,r;let n=(e=t.deadIds)!==null&&e!==void 0?e:new Set,i=Object.entries(t.nodeStructure).filter(([E])=>!n.has(E));if(i.length===0)return{derivedPositions:{},derivedSizes:{}};let o=t.autoLayout,s=t.sizePinned,a=rbt(t.positions,G9e),u=rbt(t.sizes,Ppe),l=rbt((r=t.prevDerivedSizes)!==null&&r!==void 0?r:{},Ppe),c={};for(let E of new Set([...Object.keys(u),...Object.keys(l)])){let b=Y_t(u[E],l[E],s[E]===!0);b&&(c[E]=b)}let f={},h={},m=i.map(([E,b])=>({id:E,parentId:b.parentId})),A=wen(m,o);if(A.length>0){let E=new Set(Sen(o,s)),b=new Set(Object.entries(o).filter(([,x])=>x===!1).map(([x])=>x)),w={nodes:i.map(([x,B])=>{let L=a[x];return L?{id:x,parentId:B.parentId,order:B.order,x:L.x,y:L.y}:{id:x,parentId:B.parentId,order:B.order}}),disabledNodeIds:E,autoLayoutOffIds:b,storedSizes:c},C=Een(A,w);C.positions.forEach((x,B)=>{var L,q;f[B]={x:x.x,y:x.y,basedOnRev:(q=(L=a[B])===null||L===void 0?void 0:L.rev)!==null&&q!==void 0?q:0}}),C.sizes.forEach((x,B)=>{s[B]!==!0&&(h[B]=x)})}return yJi(i,a,f,h,c,o,s,t.nodeStructure),{derivedPositions:f,derivedSizes:h}}function yJi(t,e,r,n,i,o,s,a){let u=t.map(([f,h])=>({id:f,parentId:h.parentId})),l={};for(let f of new Set([...Object.keys(e),...Object.keys(r)])){let h=W_t(e[f],r[f],J_t(f,o,a));h&&(l[f]=h)}ebt(u,l,Object.assign(Object.assign({},i),n)).forEach((f,h)=>{s[h]!==!0&&(n[h]=f)})}var Ten=g(()=>{Den();Cen();Z_t();Mpe();V_t()});function xen(t){let e=t.dead.toJSON(),r=new Set(Object.keys(e)),n={positions:t.positions.toJSON(),sizes:t.sizes.toJSON(),autoLayout:t.autoLayout.toJSON(),sizePinned:t.sizePinned.toJSON(),nodeStructure:t.nodeStructure.toJSON()},i=Ien(Object.assign(Object.assign({},n),{deadIds:r})),o=Object.assign(Object.assign({},n),{derivedPositions:i.derivedPositions,derivedSizes:i.derivedSizes});return{positions:uen(o),sizes:len(o),sessionSettings:t.sessionSettings.toJSON(),autoLayout:o.autoLayout,sizePinned:o.sizePinned,nodeStructure:o.nodeStructure,dead:e}}var Nen=g(()=>{Z_t();Ten()});var Fpe,Oen=g(()=>{H9e();GXr();een();aen();Nen();G_t();U_t();Fpe=class t{constructor(e){var r,n;this._doc=new qx,this.updateHandlers=new Set,this.compactScheduled=!1,this.janitorBound=!1,this.tombstoneTimer=null,this.epoch=0,this.compactThresholdBytes=(r=e?.compactThresholdBytes)!==null&&r!==void 0?r:t.DEFAULT_COMPACT_THRESHOLD_BYTES,this.tombstoneGraceMs=(n=e?.tombstoneGraceMs)!==null&&n!==void 0?n:RXr,K_t(this)}get doc(){return this._doc}get positions(){return this._doc.getMap("positions")}get sizes(){return this._doc.getMap("sizes")}get sessionSettings(){return this._doc.getMap("sessionSettings")}get autoLayout(){return this._doc.getMap("autoLayout")}get sizePinned(){return this._doc.getMap("sizePinned")}get nodeStructure(){return this._doc.getMap("nodeStructure")}get derivedPositions(){return this._doc.getMap("derivedPositions")}get derivedSizes(){return this._doc.getMap("derivedSizes")}get intentPositions(){return this._doc.getMap("positions")}get dead(){return this._doc.getMap("dead")}static mergeUpdates(e){return P_t(e)}encodeState(){return zXr(this)}applyUpdate(e){KXr(this,e)}getStateVector(){return WXr(this)}getDiffUpdate(e){return YXr(this,e)}onUpdate(e){JXr(this,e)}offUpdate(e){ZXr(this,e)}applyRemoteUpdate(e){XXr(this,e)}setSizeWithPinned(e,r,n){MXr(this,e,r,n)}setPosition(e,r,n="server-write"){FXr(this,e,r,n)}setSize(e,r,n="server-write"){LXr(this,e,r,n)}setSessionSettings(e,r,n="server-write"){jXr(this,e,r,n)}setAutoLayout(e,r,n="server-write"){qXr(this,e,r,n)}setSizePinned(e,r,n="server-write"){$Xr(this,e,r,n)}setNodeStructure(e,r,n="server-write"){UXr(this,e,r,n)}deleteNodeStructure(e,r="server-write"){QXr(this,e,r)}applyChangesTyped(e,r="apply-changes"){VXr(this,e,r)}setSessions(e,r){HXr(this,e,r)}toJSON(){return xen(this)}compact(){z_t(this)}setupJanitor(){sen(this)}setupTombstoneJanitor(){kXr(this)}sweepTombstones(e){$_t(this,e)}destroy(){this.tombstoneTimer&&(clearInterval(this.tombstoneTimer),this.tombstoneTimer=null),this._doc.destroy()}};Fpe.DEFAULT_COMPACT_THRESHOLD_BYTES=64*1024});import{existsSync as vJi,mkdirSync as AJi,readFileSync as _Ji,writeFileSync as bJi,renameSync as EJi}from"fs";import{join as DJi}from"path";function Ren(t,e){return DJi(t,`${e}${SJi}`)}function wJi(t,e,r){AJi(t,{recursive:!0});let n=Buffer.alloc(W9e+r.state.byteLength);n.writeUInt32BE(r.epoch>>>0,0),Buffer.from(r.state.buffer,r.state.byteOffset,r.state.byteLength).copy(n,W9e);let i=Ren(t,e),o=`${i}.${process.pid}.tmp`;bJi(o,n),EJi(o,i)}function Pen(t,e){let r=Ren(t,e);if(!vJi(r))return null;try{let n=_Ji(r);if(n.byteLength<W9e)return null;let i=n.readUInt32BE(0),o=new Uint8Array(n.subarray(W9e));return{epoch:i,state:o}}catch{return null}}function Ben(t,e,r,n){var i;let o=(i=n?.debounceMs)!==null&&i!==void 0?i:500,s=null,a=!1,u=()=>{a=!1,wJi(e,r,{epoch:t.epoch,state:t.encodeState()})},l=()=>{var c,f;a=!0,!s&&(s=setTimeout(()=>{s=null,a&&u()},o),(f=(c=s).unref)===null||f===void 0||f.call(c))};return t.onUpdate(l),{flush:()=>{s&&(clearTimeout(s),s=null),a&&u()},stop:()=>{s&&(clearTimeout(s),s=null),t.offUpdate(l)}}}var SJi,W9e,ken=g(()=>{SJi=".layout.bin",W9e=4});function Lpe(t){let e=nbt.get(t);if(!e){if(e=new Fpe,Y9e){let r=Pen(Y9e,t);r&&(e.applyUpdate(r.state),e.epoch=r.epoch)}e.setupJanitor(),e.setupTombstoneJanitor(),Y9e&&CJi.set(t,Ben(e,Y9e,t)),nbt.set(t,e);for(let r of ibt)r(t,e)}return e}function Men(){return nbt}function Fen(t){return ibt.add(t),()=>{ibt.delete(t)}}var nbt,CJi,Y9e,ibt,J9e=g(()=>{Oen();ken();nbt=new Map,CJi=new Map,Y9e=null,ibt=new Set});function obt(t){return N(this,void 0,void 0,function*(){try{return yield t.json()}catch{return null}})}function jen(){let t=new Vu;return t.post("/sync",e=>N(this,void 0,void 0,function*(){let r=IJi.safeParse(yield obt(e.req.raw));if(!r.success)return e.json({error:{code:"INVALID_BODY",message:r.error.message}},400);let n=Lpe(r.data.serverId);return e.json({diff:Array.from(n.getDiffUpdate(new Uint8Array(r.data.stateVector))),stateVector:Array.from(n.getStateVector()),epoch:n.epoch})})),t.post("/updates",e=>N(this,void 0,void 0,function*(){let r=TJi.safeParse(yield obt(e.req.raw));return r.success?(Lpe(r.data.serverId).applyRemoteUpdate(new Uint8Array(r.data.update)),e.json({applied:!0})):e.json({error:{code:"INVALID_BODY",message:r.error.message}},400)})),t.post("/autolayout",e=>N(this,void 0,void 0,function*(){let r=xJi.safeParse(yield obt(e.req.raw));return r.success?(Lpe(r.data.serverId),e.json({success:!0})):e.json({error:{code:"INVALID_BODY",message:r.error.message}},400)})),t}var Len,IJi,TJi,xJi,qen=g(()=>{we();ey();Cd();J9e();Len=4*1024*1024,IJi=X.object({serverId:X.string(),stateVector:X.array(X.number())}),TJi=X.object({serverId:X.string(),update:X.custom(t=>Array.isArray(t)&&t.length<=Len,{message:`update must be number[] with <= ${Len} elements`})}),xJi=X.object({serverId:X.string()})});function $en(t){var e,r;let n=(e=t.intervalMs)!==null&&e!==void 0?e:25e3,i=(r=t.now)!==null&&r!==void 0?r:(()=>Date.now()),o=new TextEncoder,s=!1,a=setInterval(()=>{if(!s)try{t.enqueue(o.encode(`: heartbeat ${i()}
|
|
@@ -1313,7 +1313,7 @@ WORKFLOW:
|
|
|
1313
1313
|
4. Take action based on user request
|
|
1314
1314
|
5. Report results concisely
|
|
1315
1315
|
|
|
1316
|
-
Be proactive. Be efficient. Minimize chat, maximize action.`,Nln={"machina-session":{command:"node",args:["dist/packages/@machina.at/
|
|
1316
|
+
Be proactive. Be efficient. Minimize chat, maximize action.`,Nln={"machina-session":{command:"node",args:["dist/packages/@planx.machina.at/cli/main.js","mcp"]}},Oln=["mcp__machina-session__list_servers","mcp__machina-session__list_sessions","mcp__machina-session__create_session","mcp__machina-session__delete_session","mcp__machina-session__rename_session","mcp__machina-session__send_keys","mcp__machina-session__get_session_output","mcp__machina-session__init_state","mcp__machina-session__get_state","mcp__machina-session__update_state","mcp__machina-session__destroy_state"]});var Rln,Pln,Bln,rwt=g(()=>{Rln=`You are an autonomous investigation agent with access to session management and code analysis tools.
|
|
1317
1317
|
|
|
1318
1318
|
Available capabilities:
|
|
1319
1319
|
1. Session Management: Create, monitor, and manage sessions via machina-session MCP
|
|
@@ -1326,7 +1326,7 @@ WORKFLOW:
|
|
|
1326
1326
|
3. Analyze findings
|
|
1327
1327
|
4. Report results clearly
|
|
1328
1328
|
|
|
1329
|
-
Be thorough but efficient. Use the most appropriate tool for each task.`,Pln={"machina-session":{command:"node",args:["dist/packages/@machina.at/
|
|
1329
|
+
Be thorough but efficient. Use the most appropriate tool for each task.`,Pln={"machina-session":{command:"node",args:["dist/packages/@planx.machina.at/cli/main.js","mcp"]},serena:{command:"uvx",args:["--from","serena-agent","serena","--project",process.cwd()]}},Bln=["mcp__machina-session__list_servers","mcp__machina-session__list_sessions","mcp__machina-session__create_session","mcp__machina-session__delete_session","mcp__machina-session__rename_session","mcp__machina-session__send_keys","mcp__machina-session__get_session_output","mcp__machina-session__init_state","mcp__machina-session__get_state","mcp__machina-session__update_state","mcp__machina-session__destroy_state","mcp__serena__list_dir","mcp__serena__find_file","mcp__serena__search_for_pattern","mcp__serena__get_symbols_overview","mcp__serena__find_symbol","mcp__serena__find_referencing_symbols","mcp__serena__read_memory","mcp__serena__list_memories"]});function nwt(t){return t==="worker"?{systemPrompt:Rln,mcpConfig:Pln,allowedTools:Bln}:{systemPrompt:xln,mcpConfig:Nln,allowedTools:Oln}}var kln=g(()=>{twt();rwt()});var L1,Mln=g(()=>{L1={thinking:"\u{1F914}",tool:"\u{1F527}",done:"\u2705",error:"\u274C",info:"\u2139\uFE0F"}});import{execSync as dgo}from"child_process";function fgo(){try{return dgo("which claude",{encoding:"utf-8"}).trim()}catch{return}}var iwt,Fln=g(()=>{iwt=fgo()});var owt=g(()=>{twt();rwt();kln();Mln();Fln()});function zm(t){let e=t,r=new Set;return{get:()=>e,set:n=>{e=n,r.forEach(i=>i())},update:n=>{e=n(e),r.forEach(i=>i())},subscribe:n=>(r.add(n),()=>r.delete(n))}}function swt(t){let e=zm(t||""),r=zm([]),n=zm("running"),i=zm(void 0),o=zm(void 0),s=zm(void 0),a=zm(void 0),u=zm(void 0),l=zm(void 0),c=zm(void 0),f=zm(void 0),h=zm(void 0),m=zm(void 0),A=zm(void 0),E=zm(void 0);return{input:e,messages:r,status:n,model:i,sessionId:o,serverId:s,serverName:a,sessionName:u,branchName:l,cwd:c,numTurns:f,totalCostUsd:h,errors:m,state:A,stateSchema:E,toOutput:()=>({input:e.get(),messages:r.get(),status:n.get(),model:i.get(),sessionId:o.get(),serverId:s.get(),serverName:a.get(),sessionName:u.get(),branchName:l.get(),cwd:c.get(),numTurns:f.get(),totalCostUsd:h.get(),errors:m.get(),state:A.get(),stateSchema:E.get()}),effect:w=>{let C=!1,x=()=>{C||(C=!0,queueMicrotask(()=>{C=!1,w()}))},B=[e.subscribe(x),r.subscribe(x),n.subscribe(x),f.subscribe(x),h.subscribe(x),m.subscribe(x),A.subscribe(x)];return()=>B.forEach(L=>L())},addMessage:w=>{r.update(C=>[...C,w])},addUserMessage:w=>{e.set(""),n.set("running"),r.update(C=>[...C,{type:"user",content:w,timestamp:new Date().toISOString()}])},setSuccess:(w,C)=>{f.set(w),h.set(C),n.set("success")},setError:w=>{m.set(w),n.set("error")},setCancelled:w=>{w&&m.set(w),n.set("cancelled")}}}var Lln=g(()=>{});function lwt(t){return t?new awt:new uwt}var jln,awt,uwt,qln=g(()=>{owt();jln="\x1B[3J\x1B[2J\x1B[H",awt=class{render(e){let r=JSON.stringify(e,null,2);process.stdout.write(jln+r+`
|
|
1330
1330
|
`)}},uwt=class{constructor(){this.tempStatus=null}render(e){var r,n;let i=[];for(let o of e.messages){let s=this.formatMessage(o);s&&i.push(s)}e.input&&e.status==="running"&&i.push(`> ${e.input}`),this.tempStatus&&i.push(this.tempStatus),e.status==="success"?i.push(`${L1.done} Done (${e.numTurns} turns, $${(r=e.totalCostUsd)===null||r===void 0?void 0:r.toFixed(4)})`):e.status==="error"?(i.push(`${L1.error} Error`),(n=e.errors)===null||n===void 0||n.forEach(o=>i.push(` ${o}`))):e.status==="cancelled"&&i.push(`${L1.error} Cancelled`),process.stdout.write(jln+i.join(`
|
|
1331
1331
|
`)+`
|
|
1332
1332
|
`)}formatMessage(e){switch(e.type){case"user":return`> ${e.content}`;case"system":return e.content==="init"?`${L1.info} Session initialized`:null;case"text":return e.content;case"tool_use":return`${L1.tool} Using tool: ${e.toolName}`;case"tool_result":return`${L1.tool} [Tool result: ${e.toolName}]`;default:return null}}showStatus(e,r){this.tempStatus=`${e} ${r}`}}});function cwt(t,e,r){return N(this,void 0,void 0,function*(){let n=Y7(e);if(n.length>0)throw new Error(`Schema validation failed:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "planx",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.133.0",
|
|
4
4
|
"description": "planx — Angular DI ベースの machina ターミナルマルチプレクサ / ピアセッション管理 CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"ws": "8.18.3"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@planx.machina.at/tunnel-darwin-arm64": "19.
|
|
38
|
-
"@planx.machina.at/tunnel-darwin-x64": "19.
|
|
39
|
-
"@planx.machina.at/tunnel-linux-x64-gnu": "19.
|
|
40
|
-
"@planx.machina.at/tunnel-linux-arm64-gnu": "19.
|
|
41
|
-
"@planx.machina.at/tunnel-linux-x64-musl": "19.
|
|
37
|
+
"@planx.machina.at/tunnel-darwin-arm64": "19.133.0",
|
|
38
|
+
"@planx.machina.at/tunnel-darwin-x64": "19.133.0",
|
|
39
|
+
"@planx.machina.at/tunnel-linux-x64-gnu": "19.133.0",
|
|
40
|
+
"@planx.machina.at/tunnel-linux-arm64-gnu": "19.133.0",
|
|
41
|
+
"@planx.machina.at/tunnel-linux-x64-musl": "19.133.0"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
package/session.main.mjs
CHANGED
|
@@ -867,7 +867,7 @@ Use --offset to see more results`)}}catch(i){console.error("Error listing tasks:
|
|
|
867
867
|
\u{1F4CA} \u4F9D\u5B58\u95A2\u4FC2\u3092\u8A2D\u5B9A\u4E2D...`));for(let f of c)if(f.dependsOn){let h=((o=f.description.match(/【(.+?)】/))===null||o===void 0?void 0:o[1])||f.description,m=l.get(h),y=l.get(f.dependsOn);m&&y&&(yield r.updateTask({id:m,depends_on:[y]}),console.log(zp.default.gray(` \u2514\u2500 ${h} \u2192 ${f.dependsOn}`)))}console.log(zp.default.cyan(`
|
|
868
868
|
\u{1F4CB} \u4F5C\u6210\u3055\u308C\u305F\u30BF\u30B9\u30AF\u968E\u5C64:`));let u=yield r.getTaskTree(a.id),d=Yrt(u,a.id);console.log(d),console.log(zp.default.green(`
|
|
869
869
|
\u2705 \u30BF\u30B9\u30AF\u5206\u89E3\u304C\u6B63\u5E38\u306B\u5B8C\u4E86\u3057\u307E\u3057\u305F`)),console.log(zp.default.yellow(`
|
|
870
|
-
\u{1F4A1} \u6B21\u306E\u30B9\u30C6\u30C3\u30D7:`)),console.log(zp.default.gray(`1. \u81EA\u52D5\u5B9F\u884C: /action ${a.id} --mode=auto`)),console.log(zp.default.gray(`2. \u6700\u521D\u306E\u30BF\u30B9\u30AF\u304B\u3089\u958B\u59CB: /action ${l.get("\u6700\u521D\u306EPR\u4F5C\u6210")}`)),console.log(zp.default.gray(`3. \u30BF\u30B9\u30AF\u30C4\u30EA\u30FC\u306E\u78BA\u8A8D: node dist/packages/@machina.at/
|
|
870
|
+
\u{1F4A1} \u6B21\u306E\u30B9\u30C6\u30C3\u30D7:`)),console.log(zp.default.gray(`1. \u81EA\u52D5\u5B9F\u884C: /action ${a.id} --mode=auto`)),console.log(zp.default.gray(`2. \u6700\u521D\u306E\u30BF\u30B9\u30AF\u304B\u3089\u958B\u59CB: /action ${l.get("\u6700\u521D\u306EPR\u4F5C\u6210")}`)),console.log(zp.default.gray(`3. \u30BF\u30B9\u30AF\u30C4\u30EA\u30FC\u306E\u78BA\u8A8D: node dist/packages/@planx.machina.at/cli/main.cjs task tree ${a.id}`))}catch(a){console.error(zp.default.red("\u274C \u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:"),a.message),process.exit(1)}}))})}var zp,p3r=p(()=>{ce();LA();zp=Ie(gee());u3r();d3r()});var h3r={};fr(h3r,{commands:()=>NIi});var NIi,m3r=p(()=>{NIi=[{name:"create",load:()=>Promise.resolve().then(()=>(S4r(),w4r)).then(t=>t.program)},{name:"update",load:()=>Promise.resolve().then(()=>(I4r(),E4r)).then(t=>t.program)},{name:"get",load:()=>Promise.resolve().then(()=>(x4r(),T4r)).then(t=>t.program)},{name:"list",load:()=>Promise.resolve().then(()=>(A4r(),C4r)).then(t=>t.program)},{name:"tree",load:()=>Promise.resolve().then(()=>(P4r(),O4r)).then(t=>t.program)},{name:"plan",load:()=>Promise.resolve().then(()=>(p3r(),f3r)).then(t=>t.program)}]});var V2,g3r=p(()=>{ce();vc();_1();de();V2=class{constructor(){this.workerRepo=CM(bx)}upsertWorker(e){return I(this,void 0,void 0,function*(){try{console.log("[DEBUG] Upserting worker:",e);let r=yield this.workerRepo.save({name:e.name});return console.log("[DEBUG] Upsert result:",r),r}catch(r){throw console.error("[ERROR] Failed to upsert worker:",r),r}})}listWorkers(){return I(this,arguments,void 0,function*(e={}){try{let r=yield this.workerRepo.list();return{workers:r.slice(e.offset||0,(e.offset||0)+(e.limit||100)),total:r.length}}catch(r){throw console.error("[ERROR] Failed to list workers:",r),r}})}deleteWorker(e){return I(this,void 0,void 0,function*(){try{let n=(yield this.workerRepo.list()).find(i=>i.name===e);return n?(yield this.workerRepo.delete({id:n.id}),1):0}catch(r){throw console.error("[ERROR] Failed to delete worker:",r),r}})}};V2.\u0275fac=function(e){return new(e||V2)};V2.\u0275prov=le({token:V2,factory:V2.\u0275fac,providedIn:"root"})});var v3r=p(()=>{g3r()});var y3r=p(()=>{v3r()});var _3r=p(()=>{g0e();V2e();LA();y3r()});var b3r=p(()=>{_3r()});var w3r={};fr(w3r,{program:()=>kIi});function kIi(t,e){return I(this,void 0,void 0,function*(){let r=e.get(V2);t.command("list").description("List all workers").action(()=>I(this,void 0,void 0,function*(){try{let n=yield r.listWorkers();console.table(n.workers.map(i=>({id:i.id,name:i.name})))}catch(n){console.error("Error listing workers:",n.message),process.exit(1)}}))})}var S3r=p(()=>{ce();b3r()});var Od,E3r=p(()=>{ce();de();ya();Lt();de();Od=class{constructor(){this.logger=qe("SessionCreateService"),this.client=q(jn)}createSession(){return I(this,arguments,void 0,function*(e={}){return this.logger.debug("createSession:",e),this.create({serverId:e.serverId,id:e.id,name:e.name,command:e.command,parentId:e.parentId,cwd:e.cwd,env:e.env})})}create(e){return I(this,void 0,void 0,function*(){let r=yield this.client.resolveServerPeerId(e.serverId,{timeout:3e4});if(!this.client.createSession)throw new Error("SessionCreateService: client.createSession is not implemented (App \u7D4C\u8DEF\u306F SessionCommandFacade \u7D4C\u7531\u3092\u4F7F\u7528)");let n=yield this.client.createSession(e.serverId,{sessionId:e.id,name:e.name,command:e.command||"/bin/bash",parentId:e.parentId,cwd:e.cwd,env:e.env});return Object.assign(Object.assign({},n),{serverId:r||n.serverId})})}};Od.\u0275fac=function(e){return new(e||Od)};Od.\u0275prov=le({token:Od,factory:Od.\u0275fac,providedIn:"root"})});var I3r=p(()=>{E3r()});var vee=p(()=>{I3r()});function T3r(t,e,r){if(t)return t;if(!(e&&r!==e))return process.cwd()}var x3r=p(()=>{});function C3r(t){return t.optionParent?t.optionParent:!!t.currentServerId&&t.serverName===t.currentServerId||!!t.currentServerName&&t.serverName===t.currentServerName?t.currentSessionId:void 0}var A3r=p(()=>{});var O3r={};fr(O3r,{commands:()=>RIi});var RIi,P3r=p(()=>{ce();de();yr();vee();jJ();ya();im();x3r();A3r();RIi=[{name:"",description:"Create a new session",arguments:[["[name]","Session name"],["[command...]","Command to run in the session"]],options:[["-d, --detached","Create session in detached mode (default: create and attach)",void 0,!1],["-n, --server-name <name>","Session server name",void 0,"server-default"],["-p, --parent <session-id>","Parent session ID for hierarchical sessions"],["-w, --cwd <path>","Working directory for the session (default: current directory)"],["-e, --env <KEY=VALUE...>","Environment variables (can be specified multiple times)"],["--json","Output in JSON format",void 0,!1]],action:(t,e,r)=>I(void 0,void 0,void 0,function*(){var n;console.log("[diag-session-create] action entry");let i=q(Od),s=q(av),o=q(tc),a=q(ni),c=q(jn);console.log("[diag-session-create] before keyManager.initialize()"),yield a.initialize(),console.log("[diag-session-create] after keyManager.initialize(), before sessionClient.initialize()"),yield c.initialize(),console.log("[diag-session-create] after sessionClient.initialize()");try{console.log("[diag-session-create] entered try block");let l=e&&e.length>0?e.join(" "):void 0,u=r?.serverName||process.env.PLANX_SERVER_ID||o.defaultServerId,d=process.env.PLANX_SERVER_ID,f=C3r({optionParent:r?.parent,serverName:u,currentServerId:d,currentServerName:process.env.PLANX_SERVER_NAME,currentSessionId:process.env.PLANX_SESSION_ID}),h=(n=r?.env)===null||n===void 0?void 0:n.reduce((_,b)=>{let w=b.indexOf("=");return w>0&&(_[b.slice(0,w)]=b.slice(w+1)),_},{}),m={id:$p(),name:t||`session-${Date.now()}`,command:l||o.defaultCommand||"/bin/bash",serverId:u,parentId:f,cwd:T3r(r?.cwd,d,u),env:h&&Object.keys(h).length>0?h:void 0},y=yield i.createSession(m);if(r?.json){if(u)try{let _=yield c.resolveServerPeerId(u);console.log(JSON.stringify(Object.assign(Object.assign({},y),{serverPeerId:_}),null,2))}catch{console.log(JSON.stringify(y,null,2))}else console.log(JSON.stringify(y,null,2));return}let g=y.status==="detached"?"detached":y.status;console.log(`Session created: ${y.name} (${y.id})`),console.log(`PID: ${y.pid}`),console.log(`Command: ${y.command}`),console.log(`Status: ${g}`),y.parentId&&console.log(`Parent: ${y.parentId}`),y.cwd&&console.log(`CWD: ${y.cwd}`),r?.detached||console.log(`
|
|
871
871
|
Note: Session created in detached mode. Use "machina session attach" to connect.`)}catch(l){console.error("Failed to create session:",l.message),process.exit(1)}})}]});function D3r(t,e,r,n,i){return I(this,void 0,void 0,function*(){var s;let o=(s=i?.timeout)!==null&&s!==void 0?s:3e4;if(t.getCachedSessions){let u=yield t.getCachedSessions(n,{timeout:o});if(u.length>0)return e.debug("Using cached sessions from Daemon"),u;e.debug("Cache empty (initial race or backoff), falling back to direct server query")}if(n){let u=yield(0,oc.lastValueFrom)(r(n,{timeout:o})),f=(yield(0,oc.lastValueFrom)(t.servers$.pipe((0,oc.take)(1),(0,oc.timeout)(5e3),(0,oc.catchError)(()=>(0,oc.of)([]))))).find(h=>h.id===n);return u.map(h=>Object.assign(Object.assign({},h),{serverName:f?.name}))}let a=yield(0,oc.lastValueFrom)(t.servers$.pipe((0,oc.filter)(u=>u.length>0),(0,oc.timeout)(o),(0,oc.take)(1),(0,oc.catchError)(u=>(u.name==="TimeoutError"&&e.warn("No servers found within timeout"),(0,oc.of)([])))));if(a.length===0)return[];let c=new Map(a.map(u=>[u.id,u.name]));return(yield Promise.all(a.map(u=>(0,oc.lastValueFrom)(r(u.id,{timeout:3e4}).pipe((0,oc.catchError)(d=>(e.error("Failed to connect to server",u.id,d),(0,oc.of)([])))))))).flat().map(u=>Object.assign(Object.assign({},u),{serverName:c.get(u.serverId)}))})}var oc,N3r=p(()=>{ce();oc=Ie(at())});var k3r=p(()=>{N3r()});var cs,Zs,R3r=p(()=>{ce();de();ya();Lt();cs=Ie(at());k3r();de();Zs=class{constructor(){this.client=q(jn),this.logger=qe("SessionListService")}listSessions$(e){return this.list(e?[e]:[])}list(e=[]){return e.length>0?(0,cs.combineLatest)(e.map(r=>this.listByServerId(r,{timeout:3e4}).pipe((0,cs.catchError)(n=>(console.error("Failed to connect to server",r,n),(0,cs.of)([])))))).pipe((0,cs.map)(r=>r.flat()),(0,cs.tap)(r=>this.logger.debug("sessions",r))):this.client.servers$.pipe((0,cs.map)(r=>r.map(n=>n.id)),(0,cs.distinctUntilChanged)((r,n)=>JSON.stringify(r)===JSON.stringify(n)),(0,cs.debounceTime)(500),(0,cs.tap)(r=>this.logger.debug("peerIds",r)),(0,cs.switchMap)(r=>r.length===0?(0,cs.of)([]):(0,cs.combineLatest)(r.map(n=>this.listByServerId(n,{timeout:3e4}).pipe((0,cs.catchError)(i=>(console.error("Failed to connect to server",i),(0,cs.of)([]))))))),(0,cs.map)(r=>r.flat()),(0,cs.tap)(r=>this.logger.debug("sessions",r)))}listSessionsDirect(e,r){return I(this,void 0,void 0,function*(){return(0,cs.lastValueFrom)(this.listByServerId(e,r).pipe((0,cs.catchError)(n=>(this.logger.error("listSessionsDirect failed",e,n),(0,cs.of)([])))))})}listByServerId(e,r){let n=r?.timeout!==void 0?Math.min(r.timeout,3e4):void 0;return(0,cs.from)(n!==void 0?this.client.resolveServerPeerId(e,{timeout:n}):this.client.resolveServerPeerId(e)).pipe((0,cs.switchMap)(i=>{if(!this.client.listServerSessions)throw new Error("SessionListService: client.listServerSessions is not implemented (App \u7D4C\u8DEF\u306F SessionCommandFacade \u7D4C\u7531\u3092\u4F7F\u7528)");return(0,cs.from)(this.client.listServerSessions(e,r)).pipe((0,cs.map)(s=>s.map(o=>Object.assign(Object.assign({},o),{serverId:i||o.serverId}))))}))}listSessions(e,r){return I(this,void 0,void 0,function*(){return D3r(this.client,this.logger,(n,i)=>this.listByServerId(n,i),e,r)})}};Zs.\u0275fac=function(e){return new(e||Zs)};Zs.\u0275prov=le({token:Zs,factory:Zs.\u0275fac,providedIn:"root"})});var M3r=p(()=>{R3r()});var Dv=p(()=>{M3r()});var Q2e=C((Kra,$3r)=>{var Qrt=[],L3r=0,$u=(t,e)=>{L3r>=e&&Qrt.push(t)};$u.WARN=1;$u.INFO=2;$u.DEBUG=3;$u.reset=()=>{Qrt=[]};$u.setDebugLevel=t=>{L3r=t};$u.warn=t=>$u(t,$u.WARN);$u.info=t=>$u(t,$u.INFO);$u.debug=t=>$u(t,$u.DEBUG);$u.debugMessages=()=>Qrt;$3r.exports=$u});var j3r=C((Yra,F3r)=>{"use strict";F3r.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var B3r=C((Qra,q3r)=>{"use strict";var MIi=j3r();q3r.exports=t=>typeof t=="string"?t.replace(MIi(),""):t});var U3r=C((Jra,Jrt)=>{"use strict";var V3r=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);Jrt.exports=V3r;Jrt.exports.default=V3r});var W3r=C((Zra,H3r)=>{"use strict";H3r.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var z3r=C((Xra,Zrt)=>{"use strict";var LIi=B3r(),$Ii=U3r(),FIi=W3r(),G3r=t=>{if(typeof t!="string"||t.length===0||(t=LIi(t),t.length===0))return 0;t=t.replace(FIi()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=$Ii(n)?2:1)}return e};Zrt.exports=G3r;Zrt.exports.default=G3r});var Xrt=C((ena,J3r)=>{var K3r=z3r();function J2e(t){return t?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function g_(t){let e=J2e();return(""+t).replace(e,"").split(`
|
|
872
872
|
`).reduce(function(i,s){return K3r(s)>i?K3r(s):i},0)}function yee(t,e){return Array(e+1).join(t)}function jIi(t,e,r,n){let i=g_(t);if(e+1>=i){let s=e-i;switch(n){case"right":{t=yee(r,s)+t;break}case"center":{let o=Math.ceil(s/2),a=s-o;t=yee(r,a)+t+yee(r,o);break}default:{t=t+yee(r,s);break}}}return t}var Oj={};function _ee(t,e,r){e="\x1B["+e+"m",r="\x1B["+r+"m",Oj[e]={set:t,to:!0},Oj[r]={set:t,to:!1},Oj[t]={on:e,off:r}}_ee("bold",1,22);_ee("italics",3,23);_ee("underline",4,24);_ee("inverse",7,27);_ee("strikethrough",9,29);function Y3r(t,e){let r=e[1]?parseInt(e[1].split(";")[0]):0;if(r>=30&&r<=39||r>=90&&r<=97){t.lastForegroundAdded=e[0];return}if(r>=40&&r<=49||r>=100&&r<=107){t.lastBackgroundAdded=e[0];return}if(r===0){for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&delete t[i];return}let n=Oj[e[0]];n&&(t[n.set]=n.to)}function qIi(t){let e=J2e(!0),r=e.exec(t),n={};for(;r!==null;)Y3r(n,r),r=e.exec(t);return n}function Q3r(t,e){let r=t.lastBackgroundAdded,n=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(i){t[i]&&(e+=Oj[i].off)}),r&&r!="\x1B[49m"&&(e+="\x1B[49m"),n&&n!="\x1B[39m"&&(e+="\x1B[39m"),e}function BIi(t,e){let r=t.lastBackgroundAdded,n=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(i){t[i]&&(e=Oj[i].on+e)}),r&&r!="\x1B[49m"&&(e=r+e),n&&n!="\x1B[39m"&&(e=n+e),e}function VIi(t,e){if(t.length===g_(t))return t.substr(0,e);for(;g_(t)>e;)t=t.slice(0,-1);return t}function UIi(t,e){let r=J2e(!0),n=t.split(J2e()),i=0,s=0,o="",a,c={};for(;s<e;){a=r.exec(t);let l=n[i];if(i++,s+g_(l)>e&&(l=VIi(l,e-s)),o+=l,s+=g_(l),s<e){if(!a)break;o+=a[0],Y3r(c,a)}}return Q3r(c,o)}function HIi(t,e,r){if(r=r||"\u2026",g_(t)<=e)return t;e-=g_(r);let i=UIi(t,e);i+=r;let s="\x1B]8;;\x07";return t.includes(s)&&!i.includes(s)&&(i+=s),i}function WIi(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function GIi(t,e){t=t||{},e=e||WIi();let r=Object.assign({},e,t);return r.chars=Object.assign({},e.chars,t.chars),r.style=Object.assign({},e.style,t.style),r}function zIi(t,e){let r=[],n=e.split(/(\s+)/g),i=[],s=0,o;for(let a=0;a<n.length;a+=2){let c=n[a],l=s+g_(c);s>0&&o&&(l+=o.length),l>t?(s!==0&&r.push(i.join("")),i=[c],s=g_(c)):(i.push(o||"",c),s=l),o=n[a+1]}return s&&r.push(i.join("")),r}function KIi(t,e){let r=[],n="";function i(o,a){for(n.length&&a&&(n+=a),n+=o;n.length>t;)r.push(n.slice(0,t)),n=n.slice(t)}let s=e.split(/(\s+)/g);for(let o=0;o<s.length;o+=2)i(s[o],o&&s[o-1]);return n.length&&r.push(n),r}function YIi(t,e,r=!0){let n=[];e=e.split(`
|
|
873
873
|
`);let i=r?zIi:KIi;for(let s=0;s<e.length;s++)n.push.apply(n,i(t,e[s]));return n}function QIi(t){let e={},r=[];for(let n=0;n<t.length;n++){let i=BIi(e,t[n]);e=qIi(i);let s=Object.assign({},e);r.push(Q3r(s,i))}return r}function JIi(t,e){return["\x1B]","8",";",";",t||e,"\x07",e,"\x1B]","8",";",";","\x07"].join("")}J3r.exports={strlen:g_,repeat:yee,pad:jIi,truncate:HIi,mergeOptions:GIi,wordWrap:YIi,colorizeLines:QIi,hyperlink:JIi}});var t6r=C((tna,e6r)=>{var X3r={};e6r.exports=X3r;var Z3r={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(Z3r).forEach(function(t){var e=Z3r[t],r=X3r[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var n6r=C((rna,r6r)=>{"use strict";r6r.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",i=e.indexOf(n+t);return i!==-1&&(r===-1?!0:i<r)}});var s6r=C((nna,i6r)=>{"use strict";var ZIi=aa("os"),Nv=n6r(),Pd=process.env,Pj=void 0;Nv("no-color")||Nv("no-colors")||Nv("color=false")?Pj=!1:(Nv("color")||Nv("colors")||Nv("color=true")||Nv("color=always"))&&(Pj=!0);"FORCE_COLOR"in Pd&&(Pj=Pd.FORCE_COLOR.length===0||parseInt(Pd.FORCE_COLOR,10)!==0);function XIi(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function eTi(t){if(Pj===!1)return 0;if(Nv("color=16m")||Nv("color=full")||Nv("color=truecolor"))return 3;if(Nv("color=256"))return 2;if(t&&!t.isTTY&&Pj!==!0)return 0;var e=Pj?1:0;if(process.platform==="win32"){var r=ZIi.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Pd)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in Pd})||Pd.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Pd)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Pd.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Pd){var n=parseInt((Pd.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Pd.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Pd.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Pd.TERM)||"COLORTERM"in Pd?1:(Pd.TERM==="dumb",e)}function ent(t){var e=eTi(t);return XIi(e)}i6r.exports={supportsColor:ent,stdout:ent(process.stdout),stderr:ent(process.stderr)}});var a6r=C((ina,o6r)=>{o6r.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var i={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(s){s=s.toLowerCase();var o=i[s]||[" "],a=Math.floor(Math.random()*o.length);typeof i[s]<"u"?n+=i[s][a]:n+=s}),n}});var l6r=C((sna,c6r)=>{c6r.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},i=[].concat(n.up,n.down,n.mid);function s(c){var l=Math.floor(Math.random()*c);return l}function o(c){var l=!1;return i.filter(function(u){l=u===c}),l}function a(c,l){var u="",d,f;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",c=c.split("");for(f in c)if(!o(f)){switch(u=u+c[f],d={up:0,down:0,mid:0},l.size){case"mini":d.up=s(8),d.mid=s(2),d.down=s(8);break;case"maxi":d.up=s(16)+3,d.mid=s(4)+1,d.down=s(64)+3;break;default:d.up=s(8)+1,d.mid=s(6)/2,d.down=s(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var y=h[m],g=0;g<=d[y];g++)l[y]&&(u=u+n[y][s(n[y].length)])}return u}return a(e,r)}});var d6r=C((ona,u6r)=>{u6r.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var p6r=C((ana,f6r)=>{f6r.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var m6r=C((cna,h6r)=>{h6r.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,i){return r===" "?r:t[e[n++%e.length]](r)}}});var v6r=C((lna,g6r)=>{g6r.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,i){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var E6r=C((dna,S6r)=>{var Ai={};S6r.exports=Ai;Ai.themes={};var tTi=aa("util"),GN=Ai.styles=t6r(),_6r=Object.defineProperties,rTi=new RegExp(/[\r\n]+/g);Ai.supportsColor=s6r().supportsColor;typeof Ai.enabled>"u"&&(Ai.enabled=Ai.supportsColor()!==!1);Ai.enable=function(){Ai.enabled=!0};Ai.disable=function(){Ai.enabled=!1};Ai.stripColors=Ai.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var una=Ai.stylize=function(e,r){if(!Ai.enabled)return e+"";var n=GN[r];return!n&&r in Ai?Ai[r](e):n.open+e+n.close},nTi=/[|\\{}()[\]^$+*?.]/g,iTi=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(nTi,"\\$&")};function b6r(t){var e=function r(){return oTi.apply(r,arguments)};return e._styles=t,e.__proto__=sTi,e}var w6r=(function(){var t={};return GN.grey=GN.gray,Object.keys(GN).forEach(function(e){GN[e].closeRe=new RegExp(iTi(GN[e].close),"g"),t[e]={get:function(){return b6r(this._styles.concat(e))}}}),t})(),sTi=_6r(function(){},w6r);function oTi(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:tTi.inspect(o)}).join(" ");if(!Ai.enabled||!e)return e;for(var r=e.indexOf(`
|
|
@@ -889,7 +889,7 @@ Deleted ${l.deletedCount} session(s)`))}else{let l=yield i.deleteSession({sessio
|
|
|
889
889
|
`)}),ge.start()}function Wt(zt,be){return I(this,void 0,void 0,function*(){zt.exitCode===null&&(yield new Promise(Ue=>{var rt;let Tt=setTimeout(Ue,be);(rt=Tt.unref)===null||rt===void 0||rt.call(Tt),zt.once("exit",()=>{clearTimeout(Tt),Ue()})}))})}function en(zt){return I(this,void 0,void 0,function*(){if(X)return"fail";let be=re.get(zt);if(be&&be.process.exitCode===null){try{be.process.kill("SIGTERM")}catch{}if(yield Wt(be.process,_),be.process.exitCode===null){try{be.process.kill("SIGKILL")}catch{}yield Wt(be.process,1e3)}}try{if(zt==="transport"){let Tt=P(fnt(Ze,Ze.session)),[Rt,Zr]=yield FA(Promise.all([Tt.transportWaiter.promise,Tt.proxyWaiter.promise]),b,"transport+proxy port (restart)");return Ce.transport=Rt.pid,Ze.transport=Rt.port,Ce.proxy=Zr.pid,Ze.proxy=Zr.port,w.write(`[supervisor] transport child respawned (pid=${Rt.pid}, port=${Rt.port}, proxyPort=${Zr.port})
|
|
890
890
|
`),"success"}let{waiter:Ue}=H(zt,$Or(zt,Ze)),rt=yield FA(Ue.promise,b,`${zt} port (restart)`);return Ze[zt]=rt.port,Ce[zt]=rt.pid,w.write(`[supervisor] ${zt} child respawned (pid=${rt.pid}, port=${rt.port})
|
|
891
891
|
`),"success"}catch(Ue){E.write(`[supervisor] respawn ${zt} failed: ${Ue.message}
|
|
892
|
-
`);let rt=re.get(zt);if(rt&&rt.process.exitCode===null){rt.reaped=!0;try{rt.process.kill("SIGKILL")}catch{}}return"fail"}})}function gi(zt){return I(this,void 0,void 0,function*(){var be;if(!(X||!Te)&&!pe.get(zt)){pe.set(zt,!0);try{let Ue=yield Te.restart(zt);if((be=t.onRestart)===null||be===void 0||be.call(t,zt,Ue),Ue==="circuit-open"){U===0&&(U=1),zr();return}Ue==="success"&&ge&&ge.resetFailureCount(zt)}finally{pe.set(zt,!1)}}})}function Vn(zt){return I(this,void 0,void 0,function*(){if(pe.get(zt))return"fail";ge?.suspendProbe(zt),pe.set(zt,!0);try{let be=yield en(zt);return be==="success"&&ge?.resetFailureCount(zt),be}finally{pe.set(zt,!1),ge?.resumeProbe(zt)}})}function zr(){return I(this,void 0,void 0,function*(){if(X)return;if(X=!0,ge)try{yield ge.stop()}catch{}let zt=Array.from(re.values());for(let Rt of zt)if(Rt.process.exitCode===null)try{Rt.process.kill("SIGTERM")}catch{}let be=zt.map(Rt=>new Promise(Zr=>{if(Rt.process.exitCode!==null)return Zr();Rt.process.once("exit",()=>Zr())})),Ue,rt=new Promise(Rt=>{Ue=setTimeout(()=>{for(let Zr of zt)if(Zr.process.exitCode===null)try{Zr.process.kill("SIGKILL")}catch{}Rt()},_)});yield Promise.race([Promise.all(be),rt]);let Tt=Array.from(re.values());for(let Rt of Tt)if(Rt.process.exitCode===null)try{Rt.process.kill("SIGKILL")}catch{}yield Promise.race([Promise.all(Tt.map(Rt=>new Promise(Zr=>{if(Rt.process.exitCode!==null)return Zr();Rt.process.once("exit",()=>Zr())}))),new Promise(Rt=>{var Zr;let kr=setTimeout(Rt,2e3);(Zr=kr.unref)===null||Zr===void 0||Zr.call(kr)})]),Ue&&clearTimeout(Ue),Y(U)})}return{pids:Ce,ports:Ze,exitCode$:Z.promise,stop:()=>I(this,void 0,void 0,function*(){yield zr()}),restartService:zt=>Vn(zt)}})}var sxi,oxi,axi,cxi,lxi,YOr=p(()=>{ce();DOr();ROr();LOr();FOr();BOr();pnt();pnt();sxi=5e3,oxi=1e4,axi=5e3,cxi=3,lxi=["transport","layout","session","log"]});import{existsSync as QOr,realpathSync as uxi}from"fs";import{dirname as JOr,resolve as ZOr}from"path";function dxi(t){var e;let r=`${t}.main.mjs`,n=(e=process.argv[1])!==null&&e!==void 0?e:"";if(n){let s="";try{s=JOr(uxi(n))}catch{s=JOr(n)}let o=ZOr(s,r);if(QOr(o))return o}let i=ZOr(process.cwd(),"dist/packages/@machina.at/
|
|
892
|
+
`);let rt=re.get(zt);if(rt&&rt.process.exitCode===null){rt.reaped=!0;try{rt.process.kill("SIGKILL")}catch{}}return"fail"}})}function gi(zt){return I(this,void 0,void 0,function*(){var be;if(!(X||!Te)&&!pe.get(zt)){pe.set(zt,!0);try{let Ue=yield Te.restart(zt);if((be=t.onRestart)===null||be===void 0||be.call(t,zt,Ue),Ue==="circuit-open"){U===0&&(U=1),zr();return}Ue==="success"&&ge&&ge.resetFailureCount(zt)}finally{pe.set(zt,!1)}}})}function Vn(zt){return I(this,void 0,void 0,function*(){if(pe.get(zt))return"fail";ge?.suspendProbe(zt),pe.set(zt,!0);try{let be=yield en(zt);return be==="success"&&ge?.resetFailureCount(zt),be}finally{pe.set(zt,!1),ge?.resumeProbe(zt)}})}function zr(){return I(this,void 0,void 0,function*(){if(X)return;if(X=!0,ge)try{yield ge.stop()}catch{}let zt=Array.from(re.values());for(let Rt of zt)if(Rt.process.exitCode===null)try{Rt.process.kill("SIGTERM")}catch{}let be=zt.map(Rt=>new Promise(Zr=>{if(Rt.process.exitCode!==null)return Zr();Rt.process.once("exit",()=>Zr())})),Ue,rt=new Promise(Rt=>{Ue=setTimeout(()=>{for(let Zr of zt)if(Zr.process.exitCode===null)try{Zr.process.kill("SIGKILL")}catch{}Rt()},_)});yield Promise.race([Promise.all(be),rt]);let Tt=Array.from(re.values());for(let Rt of Tt)if(Rt.process.exitCode===null)try{Rt.process.kill("SIGKILL")}catch{}yield Promise.race([Promise.all(Tt.map(Rt=>new Promise(Zr=>{if(Rt.process.exitCode!==null)return Zr();Rt.process.once("exit",()=>Zr())}))),new Promise(Rt=>{var Zr;let kr=setTimeout(Rt,2e3);(Zr=kr.unref)===null||Zr===void 0||Zr.call(kr)})]),Ue&&clearTimeout(Ue),Y(U)})}return{pids:Ce,ports:Ze,exitCode$:Z.promise,stop:()=>I(this,void 0,void 0,function*(){yield zr()}),restartService:zt=>Vn(zt)}})}var sxi,oxi,axi,cxi,lxi,YOr=p(()=>{ce();DOr();ROr();LOr();FOr();BOr();pnt();pnt();sxi=5e3,oxi=1e4,axi=5e3,cxi=3,lxi=["transport","layout","session","log"]});import{existsSync as QOr,realpathSync as uxi}from"fs";import{dirname as JOr,resolve as ZOr}from"path";function dxi(t){var e;let r=`${t}.main.mjs`,n=(e=process.argv[1])!==null&&e!==void 0?e:"";if(n){let s="";try{s=JOr(uxi(n))}catch{s=JOr(n)}let o=ZOr(s,r);if(QOr(o))return o}let i=ZOr(process.cwd(),"dist/packages/@planx.machina.at/cli",r);return QOr(i)?i:null}function mnt(){let t={};for(let e of fxi){let r=dxi(e);r&&(t[e]=r)}return t}var fxi,XOr=p(()=>{fxi=["layout","session","transport","log"]});function gnt(t){let{supervisor:e,logger:r,extraCleanup:n}=t,i=()=>I(this,void 0,void 0,function*(){try{yield e.stop()}catch(s){console.warn("[session-server] supervisor.stop failed:",s)}try{yield n?.()}catch(s){console.warn("[session-server] extraCleanup failed:",s)}try{r.close()}catch(s){console.warn("[session-server] logger.close failed:",s)}});return e.exitCode$.then(s=>I(this,void 0,void 0,function*(){s!==0&&(console.error(`[session-server] supervisor exited with code ${s}, terminating parent`),yield i(),process.exit(s))})).catch(()=>{}),process.on("uncaughtException",s=>I(this,void 0,void 0,function*(){console.error("[session-server] Uncaught exception:",s),yield i(),process.exit(1)})),process.on("unhandledRejection",s=>{console.warn("[session-server] Unhandled rejection:",s)}),new Promise(s=>{let o=a=>I(this,void 0,void 0,function*(){console.error(`[lifecycle-diag] parent process received ${a} at ${new Date().toISOString()} (pid=${process.pid})`),console.error("[lifecycle-diag] trace:",new Error("signal source").stack),yield i(),s()});process.on("SIGINT",()=>{o("SIGINT")}),process.on("SIGTERM",()=>{o("SIGTERM")})})}var ePr=p(()=>{ce()});var vnt=p(()=>{AOr();OOr();YOr();XOr();ePr()});function tPr(t,e){return I(this,void 0,void 0,function*(){try{let r=yield e(t);if(!r.ok)return"fail";let n=yield r.json().catch(()=>null);return n?.status==="ok"?"ok":"fail"}catch{return"unreachable"}})}function rPr(t){return I(this,void 0,void 0,function*(){var e;let r=(e=t.fetchImpl)!==null&&e!==void 0?e:fetch,[n,i]=yield Promise.all([tPr(`http://localhost:${t.sessionPort}/health`,r),tPr(`http://localhost:${t.layoutPort}/health`,r)]),s=n==="ok"&&i==="ok";return console.log(`[server-services] session<->layout reachable=${s} session=${n} layout=${i}`),{session:n,layout:i,reachable:s}})}var nPr=p(()=>{ce()});import{mkdirSync as pxi,writeFileSync as hxi}from"fs";import{join as mxi}from"path";function iPr(t,e){let r=ree(t),n=`${r}/transport.port`;return process.env.PLANX_TRANSPORT_PORT_FILE=n,e&&(pxi(r,{recursive:!0}),hxi(mxi(r,"self.hip"),YM(e))),n}var sPr=p(()=>{yr();Nf()});import{join as oPr}from"path";function Xs(t,e){return oPr(t,`${e}.pid`)}function Lo(t,e){return oPr(t,`${e}.port`)}var kd=p(()=>{});import{join as aPr}from"path";function cPr(t){let e=t.configDir;return{PLANX_SERVER_NAME:t.serverName,PLANX_SERVER_ID:t.peerId,PLANX_SERVER_CONFIG_DIR:e,PLANX_LAYOUT_PORT_FILE:Lo(e,"layout"),PLANX_LAYOUT_PID_FILE:Xs(e,"layout"),PLANX_SESSION_PORT_FILE:Lo(e,"session"),PLANX_PROXY_PORT_FILE:Lo(e,"proxy"),PLANX_PROXY_PID_FILE:Xs(e,"proxy"),PLANX_LOG_PORT_FILE:Lo(e,"log"),PLANX_LOG_PID_FILE:Xs(e,"log"),PLANX_LOG_DB:aPr(e,"logs.db"),PLANX_LAYOUT_STATE_DIR:aPr(e,"layout-state")}}function lPr(t){let e=gxi.filter(r=>!t[r]);if(e.length>0)throw new Error(`child process \u306B identity env \u304C\u6CE8\u5165\u3055\u308C\u3066\u3044\u307E\u305B\u3093: ${e.join(", ")} (supervisor \u7D4C\u7531\u3067\u306A\u3044\u8D77\u52D5\u304B\u3001childEnv \u306E\u914D\u7DDA\u6F0F\u308C\u3067\u3059)`);return{serverName:t.PLANX_SERVER_NAME,peerId:t.PLANX_SERVER_ID,configDir:t.PLANX_SERVER_CONFIG_DIR}}var gxi,ynt=p(()=>{kd();gxi=["PLANX_SERVER_NAME","PLANX_SERVER_ID","PLANX_SERVER_CONFIG_DIR"]});import{Writable as vxi}from"node:stream";function uPr(t){var e,r,n,i;let s=(e=t.fetchFn)!==null&&e!==void 0?e:fetch,o=(r=t.maxBuffer)!==null&&r!==void 0?r:_xi,a=[],c=null,l=null,u=Promise.resolve(),d=0,f=!1,h=(b,w)=>{var E,x;let A=Date.now();return{id:`${String(A).padStart(14,"0")}-sup${process.pid.toString(36)}-${(d++).toString(36).padStart(6,"0")}`,timestamp:A,peer_id:"local",process_id:process.pid,level:w,component:(x=(E=wxi.exec(b))===null||E===void 0?void 0:E[1])!==null&&x!==void 0?x:"unknown",message:b,context:null,error:null}},m=(b,w)=>{if(!f){for(let E of b.split(`
|
|
893
893
|
`))E.length!==0&&a.push(h(E,w));a.length>o&&a.splice(0,a.length-o)}},y=()=>I(this,void 0,void 0,function*(){if(c===null||a.length===0)return;let b=a.splice(0,bxi);try{yield s(`${c}/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}catch{}}),g=()=>{u=u.then(y)},_=(b,w)=>new vxi({write(E,x,A){let O=String(E);w?.write(O),m(O,b),A()}});return{stdout:_("INFO",(n=t.echo)===null||n===void 0?void 0:n.stdout),stderr:_("ERROR",(i=t.echo)===null||i===void 0?void 0:i.stderr),setLogdPort(b){var w,E;c=`http://127.0.0.1:${b}`,g(),l===null&&(l=setInterval(g,(w=t.flushIntervalMs)!==null&&w!==void 0?w:yxi),(E=l.unref)===null||E===void 0||E.call(l))},close(){return I(this,void 0,void 0,function*(){for(l!==null&&clearInterval(l),l=null;c!==null&&a.length>0;)g(),yield u;yield u,f=!0})}}}var yxi,_xi,bxi,wxi,dPr=p(()=>{ce();yxi=1e3,_xi=5e3,bxi=200,wxi=/^\[([^[\]\s]+)\]/});import*as fPr from"node:fs";import{Writable as Sxi}from"node:stream";function pPr(t,e,r){return e.PLANX_SUPERVISOR_ECHO||!r?!0:rrt(t,e)!==on.SILENT}function hPr(t){var e;let r=fPr.createWriteStream(t.logFilePath,{flags:"a"}),n=uPr({echo:(e=t.echo)!==null&&e!==void 0?e:null,fetchFn:t.fetchFn}),i=s=>new Sxi({write(o,a,c){try{r.write(o)}catch{}s.write(o),c()}});return{stdout:i(n.stdout),stderr:i(n.stderr),setLogdPort:s=>n.setLogdPort(s),close(){return I(this,void 0,void 0,function*(){yield n.close(),yield new Promise(s=>r.end(s))})}}}var mPr=p(()=>{ce();$h();nrt();dPr()});function iEe(t){return I(this,void 0,void 0,function*(){var e;let{injector:r,usecase:n,logger:i,peerId:s,identity:o,serverName:a}=t,c=n.getConfig(),l=process.env;l.PLANX_LOG_PORT_FILE=Lo(c.SESSIONS_DIR,"log");let u=r.get(ta),d=iPr(a,s),f=Object.assign(Object.assign({},cPr({serverName:a,configDir:c.SESSIONS_DIR,peerId:s})),{PLANX_TRANSPORT_PORT_FILE:d}),h=pPr(process.argv,l,process.stdout.isTTY===!0),m=hPr({logFilePath:c.LOG_FILE,echo:h?{stdout:process.stdout,stderr:process.stderr}:null}),y=yield hnt({cliPath:process.argv[1],serviceEntryPaths:mnt(),transportPortFile:d,nodePath:process.execPath,shutdownTimeoutMs:5e3,bootTimeoutMs:6e4,extraArgs:["--name",a],childEnv:f,stdout:m.stdout,stderr:m.stderr,onRestart:(w,E)=>{var x;return(x=i.warn)===null||x===void 0?void 0:x.call(i,`[supervisor] restart ${w}: ${E}`)}});m.setLogdPort(y.ports.log);for(let w of["layout","session","proxy","log"])u.register(w,y.ports[w]);let g=[{name:"transport",port:y.ports.transport,status:"running"},{name:"layout",port:y.ports.layout,status:"running"},{name:"session-trpc",port:y.ports.session,status:"running"},{name:"proxy-trpc",port:y.ports.proxy,status:"running"},{name:"log",port:y.ports.log,status:"running"}],_=yield n.getPeerInfo(),b=yield O2e((e=_.allowPeers)!==null&&e!==void 0?e:[],yield n.getMyPeers().catch(()=>[]));_j("session-server",{version:cu(),pid:process.pid,name:a,configDir:c.SESSIONS_DIR,logFile:c.LOG_FILE,pidFile:c.PID_FILE,services:g,peerName:a,uuid:_.uuid,identity:{peerId:o.peerId,publicKey:o.publicKey},allowPeers:b,isAuthenticated:_.isAuthenticated}),rPr({sessionPort:y.ports.session,layoutPort:y.ports.layout}).catch(()=>{}),yield gnt({supervisor:y,logger:i,extraCleanup:()=>m.close()})})}var _nt=p(()=>{ce();UF();vnt();M2();nPr();sPr();ynt();kd();mPr()});function sEe(t=process.env){let e=Object.assign({},t);for(let r of Exi)delete e[r];return e}var Exi,bnt=p(()=>{Exi=["PLANX_SESSION_ID","PLANX_SESSION_NAME","PLANX_SERVER_ID","PLANX_SERVER_NAME","PLANX_TRANSPORT_TRPC_URL","PLANX_TRANSPORT_PORT_FILE"]});function gPr(t,e,r){return I(this,void 0,void 0,function*(){var n,i,s;let o=(n=r.isInteractive)!==null&&n!==void 0?n:(()=>process.stdin.isTTY===!0);if(t!==hx||!o())return t;let a=(i=r.loadConfig)!==null&&i!==void 0?i:dA,c=(s=r.saveConfig)!==null&&s!==void 0?s:rEe,l=a(e),u=xYt(l);if(l.defaultServerName)return u;let d=yield r.prompt(u);return c(e,{defaultServerName:d}),d})}var vPr=p(()=>{ce();xwe();lnt();p1()});var _Pr={};fr(_Pr,{promptServerName:()=>yPr,resolveServerNameInteractively:()=>Axi});import{homedir as Ixi}from"os";function yPr(t,e){return I(this,void 0,void 0,function*(){return process.stdin.isTTY?e?(yield e(`Server name [${t}]: `)).trim()||t:Oxi("Server name: ",t):t})}function Axi(t,e){return I(this,void 0,void 0,function*(){let r=e??Ixi()+"/.planx";return gPr(t,r,{prompt:yPr})})}function Oxi(t,e){return new Promise(r=>{let n="",i=()=>{process.stdout.write(`\r\x1B[K${t}`),n.length===0?(process.stdout.write(`${Txi}${e}${wnt}`),process.stdout.write(`\r\x1B[${t.length}C`)):process.stdout.write(`${xxi}${n}${wnt}`)};process.stdin.setRawMode(!0),process.stdin.resume(),i();let s=o=>{let a=o.toString();if(a==="\r"||a===`
|
|
894
894
|
`){process.stdin.setRawMode(!1),process.stdin.pause(),process.stdin.removeListener("data",s);let c=n||e;process.stdout.write(`\r\x1B[K${t}${Cxi}${c}${wnt}
|
|
895
895
|
`),r(c);return}a===""&&(process.stdin.setRawMode(!1),process.stdout.write(`
|
|
@@ -1043,7 +1043,7 @@ WORKFLOW:
|
|
|
1043
1043
|
4. Take action based on user request
|
|
1044
1044
|
5. Report results concisely
|
|
1045
1045
|
|
|
1046
|
-
Be proactive. Be efficient. Minimize chat, maximize action.`,IFr={"machina-session":{command:"node",args:["dist/packages/@machina.at/
|
|
1046
|
+
Be proactive. Be efficient. Minimize chat, maximize action.`,IFr={"machina-session":{command:"node",args:["dist/packages/@planx.machina.at/cli/main.js","mcp"]}},TFr=["mcp__machina-session__list_servers","mcp__machina-session__list_sessions","mcp__machina-session__create_session","mcp__machina-session__delete_session","mcp__machina-session__rename_session","mcp__machina-session__send_keys","mcp__machina-session__get_session_output","mcp__machina-session__init_state","mcp__machina-session__get_state","mcp__machina-session__update_state","mcp__machina-session__destroy_state"]});var xFr,CFr,AFr,Bct=p(()=>{xFr=`You are an autonomous investigation agent with access to session management and code analysis tools.
|
|
1047
1047
|
|
|
1048
1048
|
Available capabilities:
|
|
1049
1049
|
1. Session Management: Create, monitor, and manage sessions via machina-session MCP
|
|
@@ -1056,7 +1056,7 @@ WORKFLOW:
|
|
|
1056
1056
|
3. Analyze findings
|
|
1057
1057
|
4. Report results clearly
|
|
1058
1058
|
|
|
1059
|
-
Be thorough but efficient. Use the most appropriate tool for each task.`,CFr={"machina-session":{command:"node",args:["dist/packages/@machina.at/
|
|
1059
|
+
Be thorough but efficient. Use the most appropriate tool for each task.`,CFr={"machina-session":{command:"node",args:["dist/packages/@planx.machina.at/cli/main.js","mcp"]},serena:{command:"uvx",args:["--from","serena-agent","serena","--project",process.cwd()]}},AFr=["mcp__machina-session__list_servers","mcp__machina-session__list_sessions","mcp__machina-session__create_session","mcp__machina-session__delete_session","mcp__machina-session__rename_session","mcp__machina-session__send_keys","mcp__machina-session__get_session_output","mcp__machina-session__init_state","mcp__machina-session__get_state","mcp__machina-session__update_state","mcp__machina-session__destroy_state","mcp__serena__list_dir","mcp__serena__find_file","mcp__serena__search_for_pattern","mcp__serena__get_symbols_overview","mcp__serena__find_symbol","mcp__serena__find_referencing_symbols","mcp__serena__read_memory","mcp__serena__list_memories"]});function Vct(t){return t==="worker"?{systemPrompt:xFr,mcpConfig:CFr,allowedTools:AFr}:{systemPrompt:EFr,mcpConfig:IFr,allowedTools:TFr}}var OFr=p(()=>{qct();Bct()});var Mm,PFr=p(()=>{Mm={thinking:"\u{1F914}",tool:"\u{1F527}",done:"\u2705",error:"\u274C",info:"\u2139\uFE0F"}});import{execSync as Jqi}from"child_process";function Zqi(){try{return Jqi("which claude",{encoding:"utf-8"}).trim()}catch{return}}var Uct,DFr=p(()=>{Uct=Zqi()});var Hct=p(()=>{qct();Bct();OFr();PFr();DFr()});function Fd(t){let e=t,r=new Set;return{get:()=>e,set:n=>{e=n,r.forEach(i=>i())},update:n=>{e=n(e),r.forEach(i=>i())},subscribe:n=>(r.add(n),()=>r.delete(n))}}function Wct(t){let e=Fd(t||""),r=Fd([]),n=Fd("running"),i=Fd(void 0),s=Fd(void 0),o=Fd(void 0),a=Fd(void 0),c=Fd(void 0),l=Fd(void 0),u=Fd(void 0),d=Fd(void 0),f=Fd(void 0),h=Fd(void 0),m=Fd(void 0),y=Fd(void 0);return{input:e,messages:r,status:n,model:i,sessionId:s,serverId:o,serverName:a,sessionName:c,branchName:l,cwd:u,numTurns:d,totalCostUsd:f,errors:h,state:m,stateSchema:y,toOutput:()=>({input:e.get(),messages:r.get(),status:n.get(),model:i.get(),sessionId:s.get(),serverId:o.get(),serverName:a.get(),sessionName:c.get(),branchName:l.get(),cwd:u.get(),numTurns:d.get(),totalCostUsd:f.get(),errors:h.get(),state:m.get(),stateSchema:y.get()}),effect:b=>{let w=!1,E=()=>{w||(w=!0,queueMicrotask(()=>{w=!1,b()}))},x=[e.subscribe(E),r.subscribe(E),n.subscribe(E),d.subscribe(E),f.subscribe(E),h.subscribe(E),m.subscribe(E)];return()=>x.forEach(A=>A())},addMessage:b=>{r.update(w=>[...w,b])},addUserMessage:b=>{e.set(""),n.set("running"),r.update(w=>[...w,{type:"user",content:b,timestamp:new Date().toISOString()}])},setSuccess:(b,w)=>{d.set(b),f.set(w),n.set("success")},setError:b=>{h.set(b),n.set("error")},setCancelled:b=>{b&&h.set(b),n.set("cancelled")}}}var NFr=p(()=>{});function Kct(t){return t?new Gct:new zct}var kFr,Gct,zct,RFr=p(()=>{Hct();kFr="\x1B[3J\x1B[2J\x1B[H",Gct=class{render(e){let r=JSON.stringify(e,null,2);process.stdout.write(kFr+r+`
|
|
1060
1060
|
`)}},zct=class{constructor(){this.tempStatus=null}render(e){var r,n;let i=[];for(let s of e.messages){let o=this.formatMessage(s);o&&i.push(o)}e.input&&e.status==="running"&&i.push(`> ${e.input}`),this.tempStatus&&i.push(this.tempStatus),e.status==="success"?i.push(`${Mm.done} Done (${e.numTurns} turns, $${(r=e.totalCostUsd)===null||r===void 0?void 0:r.toFixed(4)})`):e.status==="error"?(i.push(`${Mm.error} Error`),(n=e.errors)===null||n===void 0||n.forEach(s=>i.push(` ${s}`))):e.status==="cancelled"&&i.push(`${Mm.error} Cancelled`),process.stdout.write(kFr+i.join(`
|
|
1061
1061
|
`)+`
|
|
1062
1062
|
`)}formatMessage(e){switch(e.type){case"user":return`> ${e.content}`;case"system":return e.content==="init"?`${Mm.info} Session initialized`:null;case"text":return e.content;case"tool_use":return`${Mm.tool} Using tool: ${e.toolName}`;case"tool_result":return`${Mm.tool} [Tool result: ${e.toolName}]`;default:return null}}showStatus(e,r){this.tempStatus=`${e} ${r}`}}});function Yct(t,e,r){return I(this,void 0,void 0,function*(){let n=g8(e);if(n.length>0)throw new Error(`Schema validation failed:
|
package/transport.main.mjs
CHANGED
|
@@ -867,7 +867,7 @@ Use --offset to see more results`)}}catch(i){console.error("Error listing tasks:
|
|
|
867
867
|
\u{1F4CA} \u4F9D\u5B58\u95A2\u4FC2\u3092\u8A2D\u5B9A\u4E2D...`));for(let f of c)if(f.dependsOn){let h=((o=f.description.match(/【(.+?)】/))===null||o===void 0?void 0:o[1])||f.description,m=l.get(h),y=l.get(f.dependsOn);m&&y&&(yield r.updateTask({id:m,depends_on:[y]}),console.log(zp.default.gray(` \u2514\u2500 ${h} \u2192 ${f.dependsOn}`)))}console.log(zp.default.cyan(`
|
|
868
868
|
\u{1F4CB} \u4F5C\u6210\u3055\u308C\u305F\u30BF\u30B9\u30AF\u968E\u5C64:`));let u=yield r.getTaskTree(a.id),d=Yrt(u,a.id);console.log(d),console.log(zp.default.green(`
|
|
869
869
|
\u2705 \u30BF\u30B9\u30AF\u5206\u89E3\u304C\u6B63\u5E38\u306B\u5B8C\u4E86\u3057\u307E\u3057\u305F`)),console.log(zp.default.yellow(`
|
|
870
|
-
\u{1F4A1} \u6B21\u306E\u30B9\u30C6\u30C3\u30D7:`)),console.log(zp.default.gray(`1. \u81EA\u52D5\u5B9F\u884C: /action ${a.id} --mode=auto`)),console.log(zp.default.gray(`2. \u6700\u521D\u306E\u30BF\u30B9\u30AF\u304B\u3089\u958B\u59CB: /action ${l.get("\u6700\u521D\u306EPR\u4F5C\u6210")}`)),console.log(zp.default.gray(`3. \u30BF\u30B9\u30AF\u30C4\u30EA\u30FC\u306E\u78BA\u8A8D: node dist/packages/@machina.at/
|
|
870
|
+
\u{1F4A1} \u6B21\u306E\u30B9\u30C6\u30C3\u30D7:`)),console.log(zp.default.gray(`1. \u81EA\u52D5\u5B9F\u884C: /action ${a.id} --mode=auto`)),console.log(zp.default.gray(`2. \u6700\u521D\u306E\u30BF\u30B9\u30AF\u304B\u3089\u958B\u59CB: /action ${l.get("\u6700\u521D\u306EPR\u4F5C\u6210")}`)),console.log(zp.default.gray(`3. \u30BF\u30B9\u30AF\u30C4\u30EA\u30FC\u306E\u78BA\u8A8D: node dist/packages/@planx.machina.at/cli/main.cjs task tree ${a.id}`))}catch(a){console.error(zp.default.red("\u274C \u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F:"),a.message),process.exit(1)}}))})}var zp,p3r=p(()=>{ce();LA();zp=Ie(gee());u3r();d3r()});var h3r={};fr(h3r,{commands:()=>NIi});var NIi,m3r=p(()=>{NIi=[{name:"create",load:()=>Promise.resolve().then(()=>(S4r(),w4r)).then(t=>t.program)},{name:"update",load:()=>Promise.resolve().then(()=>(I4r(),E4r)).then(t=>t.program)},{name:"get",load:()=>Promise.resolve().then(()=>(x4r(),T4r)).then(t=>t.program)},{name:"list",load:()=>Promise.resolve().then(()=>(A4r(),C4r)).then(t=>t.program)},{name:"tree",load:()=>Promise.resolve().then(()=>(P4r(),O4r)).then(t=>t.program)},{name:"plan",load:()=>Promise.resolve().then(()=>(p3r(),f3r)).then(t=>t.program)}]});var V2,g3r=p(()=>{ce();vc();_1();de();V2=class{constructor(){this.workerRepo=CM(bx)}upsertWorker(e){return I(this,void 0,void 0,function*(){try{console.log("[DEBUG] Upserting worker:",e);let r=yield this.workerRepo.save({name:e.name});return console.log("[DEBUG] Upsert result:",r),r}catch(r){throw console.error("[ERROR] Failed to upsert worker:",r),r}})}listWorkers(){return I(this,arguments,void 0,function*(e={}){try{let r=yield this.workerRepo.list();return{workers:r.slice(e.offset||0,(e.offset||0)+(e.limit||100)),total:r.length}}catch(r){throw console.error("[ERROR] Failed to list workers:",r),r}})}deleteWorker(e){return I(this,void 0,void 0,function*(){try{let n=(yield this.workerRepo.list()).find(i=>i.name===e);return n?(yield this.workerRepo.delete({id:n.id}),1):0}catch(r){throw console.error("[ERROR] Failed to delete worker:",r),r}})}};V2.\u0275fac=function(e){return new(e||V2)};V2.\u0275prov=le({token:V2,factory:V2.\u0275fac,providedIn:"root"})});var v3r=p(()=>{g3r()});var y3r=p(()=>{v3r()});var _3r=p(()=>{g0e();V2e();LA();y3r()});var b3r=p(()=>{_3r()});var w3r={};fr(w3r,{program:()=>kIi});function kIi(t,e){return I(this,void 0,void 0,function*(){let r=e.get(V2);t.command("list").description("List all workers").action(()=>I(this,void 0,void 0,function*(){try{let n=yield r.listWorkers();console.table(n.workers.map(i=>({id:i.id,name:i.name})))}catch(n){console.error("Error listing workers:",n.message),process.exit(1)}}))})}var S3r=p(()=>{ce();b3r()});var Od,E3r=p(()=>{ce();de();ya();Lt();de();Od=class{constructor(){this.logger=qe("SessionCreateService"),this.client=q(jn)}createSession(){return I(this,arguments,void 0,function*(e={}){return this.logger.debug("createSession:",e),this.create({serverId:e.serverId,id:e.id,name:e.name,command:e.command,parentId:e.parentId,cwd:e.cwd,env:e.env})})}create(e){return I(this,void 0,void 0,function*(){let r=yield this.client.resolveServerPeerId(e.serverId,{timeout:3e4});if(!this.client.createSession)throw new Error("SessionCreateService: client.createSession is not implemented (App \u7D4C\u8DEF\u306F SessionCommandFacade \u7D4C\u7531\u3092\u4F7F\u7528)");let n=yield this.client.createSession(e.serverId,{sessionId:e.id,name:e.name,command:e.command||"/bin/bash",parentId:e.parentId,cwd:e.cwd,env:e.env});return Object.assign(Object.assign({},n),{serverId:r||n.serverId})})}};Od.\u0275fac=function(e){return new(e||Od)};Od.\u0275prov=le({token:Od,factory:Od.\u0275fac,providedIn:"root"})});var I3r=p(()=>{E3r()});var vee=p(()=>{I3r()});function T3r(t,e,r){if(t)return t;if(!(e&&r!==e))return process.cwd()}var x3r=p(()=>{});function C3r(t){return t.optionParent?t.optionParent:!!t.currentServerId&&t.serverName===t.currentServerId||!!t.currentServerName&&t.serverName===t.currentServerName?t.currentSessionId:void 0}var A3r=p(()=>{});var O3r={};fr(O3r,{commands:()=>RIi});var RIi,P3r=p(()=>{ce();de();yr();vee();jJ();ya();im();x3r();A3r();RIi=[{name:"",description:"Create a new session",arguments:[["[name]","Session name"],["[command...]","Command to run in the session"]],options:[["-d, --detached","Create session in detached mode (default: create and attach)",void 0,!1],["-n, --server-name <name>","Session server name",void 0,"server-default"],["-p, --parent <session-id>","Parent session ID for hierarchical sessions"],["-w, --cwd <path>","Working directory for the session (default: current directory)"],["-e, --env <KEY=VALUE...>","Environment variables (can be specified multiple times)"],["--json","Output in JSON format",void 0,!1]],action:(t,e,r)=>I(void 0,void 0,void 0,function*(){var n;console.log("[diag-session-create] action entry");let i=q(Od),s=q(av),o=q(tc),a=q(ni),c=q(jn);console.log("[diag-session-create] before keyManager.initialize()"),yield a.initialize(),console.log("[diag-session-create] after keyManager.initialize(), before sessionClient.initialize()"),yield c.initialize(),console.log("[diag-session-create] after sessionClient.initialize()");try{console.log("[diag-session-create] entered try block");let l=e&&e.length>0?e.join(" "):void 0,u=r?.serverName||process.env.PLANX_SERVER_ID||o.defaultServerId,d=process.env.PLANX_SERVER_ID,f=C3r({optionParent:r?.parent,serverName:u,currentServerId:d,currentServerName:process.env.PLANX_SERVER_NAME,currentSessionId:process.env.PLANX_SESSION_ID}),h=(n=r?.env)===null||n===void 0?void 0:n.reduce((_,b)=>{let w=b.indexOf("=");return w>0&&(_[b.slice(0,w)]=b.slice(w+1)),_},{}),m={id:$p(),name:t||`session-${Date.now()}`,command:l||o.defaultCommand||"/bin/bash",serverId:u,parentId:f,cwd:T3r(r?.cwd,d,u),env:h&&Object.keys(h).length>0?h:void 0},y=yield i.createSession(m);if(r?.json){if(u)try{let _=yield c.resolveServerPeerId(u);console.log(JSON.stringify(Object.assign(Object.assign({},y),{serverPeerId:_}),null,2))}catch{console.log(JSON.stringify(y,null,2))}else console.log(JSON.stringify(y,null,2));return}let g=y.status==="detached"?"detached":y.status;console.log(`Session created: ${y.name} (${y.id})`),console.log(`PID: ${y.pid}`),console.log(`Command: ${y.command}`),console.log(`Status: ${g}`),y.parentId&&console.log(`Parent: ${y.parentId}`),y.cwd&&console.log(`CWD: ${y.cwd}`),r?.detached||console.log(`
|
|
871
871
|
Note: Session created in detached mode. Use "machina session attach" to connect.`)}catch(l){console.error("Failed to create session:",l.message),process.exit(1)}})}]});function D3r(t,e,r,n,i){return I(this,void 0,void 0,function*(){var s;let o=(s=i?.timeout)!==null&&s!==void 0?s:3e4;if(t.getCachedSessions){let u=yield t.getCachedSessions(n,{timeout:o});if(u.length>0)return e.debug("Using cached sessions from Daemon"),u;e.debug("Cache empty (initial race or backoff), falling back to direct server query")}if(n){let u=yield(0,oc.lastValueFrom)(r(n,{timeout:o})),f=(yield(0,oc.lastValueFrom)(t.servers$.pipe((0,oc.take)(1),(0,oc.timeout)(5e3),(0,oc.catchError)(()=>(0,oc.of)([]))))).find(h=>h.id===n);return u.map(h=>Object.assign(Object.assign({},h),{serverName:f?.name}))}let a=yield(0,oc.lastValueFrom)(t.servers$.pipe((0,oc.filter)(u=>u.length>0),(0,oc.timeout)(o),(0,oc.take)(1),(0,oc.catchError)(u=>(u.name==="TimeoutError"&&e.warn("No servers found within timeout"),(0,oc.of)([])))));if(a.length===0)return[];let c=new Map(a.map(u=>[u.id,u.name]));return(yield Promise.all(a.map(u=>(0,oc.lastValueFrom)(r(u.id,{timeout:3e4}).pipe((0,oc.catchError)(d=>(e.error("Failed to connect to server",u.id,d),(0,oc.of)([])))))))).flat().map(u=>Object.assign(Object.assign({},u),{serverName:c.get(u.serverId)}))})}var oc,N3r=p(()=>{ce();oc=Ie(at())});var k3r=p(()=>{N3r()});var cs,Zs,R3r=p(()=>{ce();de();ya();Lt();cs=Ie(at());k3r();de();Zs=class{constructor(){this.client=q(jn),this.logger=qe("SessionListService")}listSessions$(e){return this.list(e?[e]:[])}list(e=[]){return e.length>0?(0,cs.combineLatest)(e.map(r=>this.listByServerId(r,{timeout:3e4}).pipe((0,cs.catchError)(n=>(console.error("Failed to connect to server",r,n),(0,cs.of)([])))))).pipe((0,cs.map)(r=>r.flat()),(0,cs.tap)(r=>this.logger.debug("sessions",r))):this.client.servers$.pipe((0,cs.map)(r=>r.map(n=>n.id)),(0,cs.distinctUntilChanged)((r,n)=>JSON.stringify(r)===JSON.stringify(n)),(0,cs.debounceTime)(500),(0,cs.tap)(r=>this.logger.debug("peerIds",r)),(0,cs.switchMap)(r=>r.length===0?(0,cs.of)([]):(0,cs.combineLatest)(r.map(n=>this.listByServerId(n,{timeout:3e4}).pipe((0,cs.catchError)(i=>(console.error("Failed to connect to server",i),(0,cs.of)([]))))))),(0,cs.map)(r=>r.flat()),(0,cs.tap)(r=>this.logger.debug("sessions",r)))}listSessionsDirect(e,r){return I(this,void 0,void 0,function*(){return(0,cs.lastValueFrom)(this.listByServerId(e,r).pipe((0,cs.catchError)(n=>(this.logger.error("listSessionsDirect failed",e,n),(0,cs.of)([])))))})}listByServerId(e,r){let n=r?.timeout!==void 0?Math.min(r.timeout,3e4):void 0;return(0,cs.from)(n!==void 0?this.client.resolveServerPeerId(e,{timeout:n}):this.client.resolveServerPeerId(e)).pipe((0,cs.switchMap)(i=>{if(!this.client.listServerSessions)throw new Error("SessionListService: client.listServerSessions is not implemented (App \u7D4C\u8DEF\u306F SessionCommandFacade \u7D4C\u7531\u3092\u4F7F\u7528)");return(0,cs.from)(this.client.listServerSessions(e,r)).pipe((0,cs.map)(s=>s.map(o=>Object.assign(Object.assign({},o),{serverId:i||o.serverId}))))}))}listSessions(e,r){return I(this,void 0,void 0,function*(){return D3r(this.client,this.logger,(n,i)=>this.listByServerId(n,i),e,r)})}};Zs.\u0275fac=function(e){return new(e||Zs)};Zs.\u0275prov=le({token:Zs,factory:Zs.\u0275fac,providedIn:"root"})});var M3r=p(()=>{R3r()});var Dv=p(()=>{M3r()});var Q2e=C((Kra,$3r)=>{var Qrt=[],L3r=0,$u=(t,e)=>{L3r>=e&&Qrt.push(t)};$u.WARN=1;$u.INFO=2;$u.DEBUG=3;$u.reset=()=>{Qrt=[]};$u.setDebugLevel=t=>{L3r=t};$u.warn=t=>$u(t,$u.WARN);$u.info=t=>$u(t,$u.INFO);$u.debug=t=>$u(t,$u.DEBUG);$u.debugMessages=()=>Qrt;$3r.exports=$u});var j3r=C((Yra,F3r)=>{"use strict";F3r.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var B3r=C((Qra,q3r)=>{"use strict";var MIi=j3r();q3r.exports=t=>typeof t=="string"?t.replace(MIi(),""):t});var U3r=C((Jra,Jrt)=>{"use strict";var V3r=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);Jrt.exports=V3r;Jrt.exports.default=V3r});var W3r=C((Zra,H3r)=>{"use strict";H3r.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var z3r=C((Xra,Zrt)=>{"use strict";var LIi=B3r(),$Ii=U3r(),FIi=W3r(),G3r=t=>{if(typeof t!="string"||t.length===0||(t=LIi(t),t.length===0))return 0;t=t.replace(FIi()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=$Ii(n)?2:1)}return e};Zrt.exports=G3r;Zrt.exports.default=G3r});var Xrt=C((ena,J3r)=>{var K3r=z3r();function J2e(t){return t?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function g_(t){let e=J2e();return(""+t).replace(e,"").split(`
|
|
872
872
|
`).reduce(function(i,s){return K3r(s)>i?K3r(s):i},0)}function yee(t,e){return Array(e+1).join(t)}function jIi(t,e,r,n){let i=g_(t);if(e+1>=i){let s=e-i;switch(n){case"right":{t=yee(r,s)+t;break}case"center":{let o=Math.ceil(s/2),a=s-o;t=yee(r,a)+t+yee(r,o);break}default:{t=t+yee(r,s);break}}}return t}var Oj={};function _ee(t,e,r){e="\x1B["+e+"m",r="\x1B["+r+"m",Oj[e]={set:t,to:!0},Oj[r]={set:t,to:!1},Oj[t]={on:e,off:r}}_ee("bold",1,22);_ee("italics",3,23);_ee("underline",4,24);_ee("inverse",7,27);_ee("strikethrough",9,29);function Y3r(t,e){let r=e[1]?parseInt(e[1].split(";")[0]):0;if(r>=30&&r<=39||r>=90&&r<=97){t.lastForegroundAdded=e[0];return}if(r>=40&&r<=49||r>=100&&r<=107){t.lastBackgroundAdded=e[0];return}if(r===0){for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&delete t[i];return}let n=Oj[e[0]];n&&(t[n.set]=n.to)}function qIi(t){let e=J2e(!0),r=e.exec(t),n={};for(;r!==null;)Y3r(n,r),r=e.exec(t);return n}function Q3r(t,e){let r=t.lastBackgroundAdded,n=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(i){t[i]&&(e+=Oj[i].off)}),r&&r!="\x1B[49m"&&(e+="\x1B[49m"),n&&n!="\x1B[39m"&&(e+="\x1B[39m"),e}function BIi(t,e){let r=t.lastBackgroundAdded,n=t.lastForegroundAdded;return delete t.lastBackgroundAdded,delete t.lastForegroundAdded,Object.keys(t).forEach(function(i){t[i]&&(e=Oj[i].on+e)}),r&&r!="\x1B[49m"&&(e=r+e),n&&n!="\x1B[39m"&&(e=n+e),e}function VIi(t,e){if(t.length===g_(t))return t.substr(0,e);for(;g_(t)>e;)t=t.slice(0,-1);return t}function UIi(t,e){let r=J2e(!0),n=t.split(J2e()),i=0,s=0,o="",a,c={};for(;s<e;){a=r.exec(t);let l=n[i];if(i++,s+g_(l)>e&&(l=VIi(l,e-s)),o+=l,s+=g_(l),s<e){if(!a)break;o+=a[0],Y3r(c,a)}}return Q3r(c,o)}function HIi(t,e,r){if(r=r||"\u2026",g_(t)<=e)return t;e-=g_(r);let i=UIi(t,e);i+=r;let s="\x1B]8;;\x07";return t.includes(s)&&!i.includes(s)&&(i+=s),i}function WIi(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function GIi(t,e){t=t||{},e=e||WIi();let r=Object.assign({},e,t);return r.chars=Object.assign({},e.chars,t.chars),r.style=Object.assign({},e.style,t.style),r}function zIi(t,e){let r=[],n=e.split(/(\s+)/g),i=[],s=0,o;for(let a=0;a<n.length;a+=2){let c=n[a],l=s+g_(c);s>0&&o&&(l+=o.length),l>t?(s!==0&&r.push(i.join("")),i=[c],s=g_(c)):(i.push(o||"",c),s=l),o=n[a+1]}return s&&r.push(i.join("")),r}function KIi(t,e){let r=[],n="";function i(o,a){for(n.length&&a&&(n+=a),n+=o;n.length>t;)r.push(n.slice(0,t)),n=n.slice(t)}let s=e.split(/(\s+)/g);for(let o=0;o<s.length;o+=2)i(s[o],o&&s[o-1]);return n.length&&r.push(n),r}function YIi(t,e,r=!0){let n=[];e=e.split(`
|
|
873
873
|
`);let i=r?zIi:KIi;for(let s=0;s<e.length;s++)n.push.apply(n,i(t,e[s]));return n}function QIi(t){let e={},r=[];for(let n=0;n<t.length;n++){let i=BIi(e,t[n]);e=qIi(i);let s=Object.assign({},e);r.push(Q3r(s,i))}return r}function JIi(t,e){return["\x1B]","8",";",";",t||e,"\x07",e,"\x1B]","8",";",";","\x07"].join("")}J3r.exports={strlen:g_,repeat:yee,pad:jIi,truncate:HIi,mergeOptions:GIi,wordWrap:YIi,colorizeLines:QIi,hyperlink:JIi}});var t6r=C((tna,e6r)=>{var X3r={};e6r.exports=X3r;var Z3r={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(Z3r).forEach(function(t){var e=Z3r[t],r=X3r[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var n6r=C((rna,r6r)=>{"use strict";r6r.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",i=e.indexOf(n+t);return i!==-1&&(r===-1?!0:i<r)}});var s6r=C((nna,i6r)=>{"use strict";var ZIi=aa("os"),Nv=n6r(),Pd=process.env,Pj=void 0;Nv("no-color")||Nv("no-colors")||Nv("color=false")?Pj=!1:(Nv("color")||Nv("colors")||Nv("color=true")||Nv("color=always"))&&(Pj=!0);"FORCE_COLOR"in Pd&&(Pj=Pd.FORCE_COLOR.length===0||parseInt(Pd.FORCE_COLOR,10)!==0);function XIi(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function eTi(t){if(Pj===!1)return 0;if(Nv("color=16m")||Nv("color=full")||Nv("color=truecolor"))return 3;if(Nv("color=256"))return 2;if(t&&!t.isTTY&&Pj!==!0)return 0;var e=Pj?1:0;if(process.platform==="win32"){var r=ZIi.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Pd)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in Pd})||Pd.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Pd)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Pd.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Pd){var n=parseInt((Pd.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Pd.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Pd.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Pd.TERM)||"COLORTERM"in Pd?1:(Pd.TERM==="dumb",e)}function ent(t){var e=eTi(t);return XIi(e)}i6r.exports={supportsColor:ent,stdout:ent(process.stdout),stderr:ent(process.stderr)}});var a6r=C((ina,o6r)=>{o6r.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var i={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(s){s=s.toLowerCase();var o=i[s]||[" "],a=Math.floor(Math.random()*o.length);typeof i[s]<"u"?n+=i[s][a]:n+=s}),n}});var l6r=C((sna,c6r)=>{c6r.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},i=[].concat(n.up,n.down,n.mid);function s(c){var l=Math.floor(Math.random()*c);return l}function o(c){var l=!1;return i.filter(function(u){l=u===c}),l}function a(c,l){var u="",d,f;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",c=c.split("");for(f in c)if(!o(f)){switch(u=u+c[f],d={up:0,down:0,mid:0},l.size){case"mini":d.up=s(8),d.mid=s(2),d.down=s(8);break;case"maxi":d.up=s(16)+3,d.mid=s(4)+1,d.down=s(64)+3;break;default:d.up=s(8)+1,d.mid=s(6)/2,d.down=s(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var y=h[m],g=0;g<=d[y];g++)l[y]&&(u=u+n[y][s(n[y].length)])}return u}return a(e,r)}});var d6r=C((ona,u6r)=>{u6r.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var p6r=C((ana,f6r)=>{f6r.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var m6r=C((cna,h6r)=>{h6r.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,i){return r===" "?r:t[e[n++%e.length]](r)}}});var v6r=C((lna,g6r)=>{g6r.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,i){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var E6r=C((dna,S6r)=>{var Ai={};S6r.exports=Ai;Ai.themes={};var tTi=aa("util"),GN=Ai.styles=t6r(),_6r=Object.defineProperties,rTi=new RegExp(/[\r\n]+/g);Ai.supportsColor=s6r().supportsColor;typeof Ai.enabled>"u"&&(Ai.enabled=Ai.supportsColor()!==!1);Ai.enable=function(){Ai.enabled=!0};Ai.disable=function(){Ai.enabled=!1};Ai.stripColors=Ai.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var una=Ai.stylize=function(e,r){if(!Ai.enabled)return e+"";var n=GN[r];return!n&&r in Ai?Ai[r](e):n.open+e+n.close},nTi=/[|\\{}()[\]^$+*?.]/g,iTi=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(nTi,"\\$&")};function b6r(t){var e=function r(){return oTi.apply(r,arguments)};return e._styles=t,e.__proto__=sTi,e}var w6r=(function(){var t={};return GN.grey=GN.gray,Object.keys(GN).forEach(function(e){GN[e].closeRe=new RegExp(iTi(GN[e].close),"g"),t[e]={get:function(){return b6r(this._styles.concat(e))}}}),t})(),sTi=_6r(function(){},w6r);function oTi(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:tTi.inspect(o)}).join(" ");if(!Ai.enabled||!e)return e;for(var r=e.indexOf(`
|
|
@@ -889,7 +889,7 @@ Deleted ${l.deletedCount} session(s)`))}else{let l=yield i.deleteSession({sessio
|
|
|
889
889
|
`)}),ge.start()}function Wt(zt,be){return I(this,void 0,void 0,function*(){zt.exitCode===null&&(yield new Promise(Ue=>{var rt;let Tt=setTimeout(Ue,be);(rt=Tt.unref)===null||rt===void 0||rt.call(Tt),zt.once("exit",()=>{clearTimeout(Tt),Ue()})}))})}function en(zt){return I(this,void 0,void 0,function*(){if(X)return"fail";let be=re.get(zt);if(be&&be.process.exitCode===null){try{be.process.kill("SIGTERM")}catch{}if(yield Wt(be.process,_),be.process.exitCode===null){try{be.process.kill("SIGKILL")}catch{}yield Wt(be.process,1e3)}}try{if(zt==="transport"){let Tt=P(fnt(Ze,Ze.session)),[Rt,Zr]=yield FA(Promise.all([Tt.transportWaiter.promise,Tt.proxyWaiter.promise]),b,"transport+proxy port (restart)");return Ce.transport=Rt.pid,Ze.transport=Rt.port,Ce.proxy=Zr.pid,Ze.proxy=Zr.port,w.write(`[supervisor] transport child respawned (pid=${Rt.pid}, port=${Rt.port}, proxyPort=${Zr.port})
|
|
890
890
|
`),"success"}let{waiter:Ue}=H(zt,$Or(zt,Ze)),rt=yield FA(Ue.promise,b,`${zt} port (restart)`);return Ze[zt]=rt.port,Ce[zt]=rt.pid,w.write(`[supervisor] ${zt} child respawned (pid=${rt.pid}, port=${rt.port})
|
|
891
891
|
`),"success"}catch(Ue){E.write(`[supervisor] respawn ${zt} failed: ${Ue.message}
|
|
892
|
-
`);let rt=re.get(zt);if(rt&&rt.process.exitCode===null){rt.reaped=!0;try{rt.process.kill("SIGKILL")}catch{}}return"fail"}})}function gi(zt){return I(this,void 0,void 0,function*(){var be;if(!(X||!Te)&&!pe.get(zt)){pe.set(zt,!0);try{let Ue=yield Te.restart(zt);if((be=t.onRestart)===null||be===void 0||be.call(t,zt,Ue),Ue==="circuit-open"){U===0&&(U=1),zr();return}Ue==="success"&&ge&&ge.resetFailureCount(zt)}finally{pe.set(zt,!1)}}})}function Vn(zt){return I(this,void 0,void 0,function*(){if(pe.get(zt))return"fail";ge?.suspendProbe(zt),pe.set(zt,!0);try{let be=yield en(zt);return be==="success"&&ge?.resetFailureCount(zt),be}finally{pe.set(zt,!1),ge?.resumeProbe(zt)}})}function zr(){return I(this,void 0,void 0,function*(){if(X)return;if(X=!0,ge)try{yield ge.stop()}catch{}let zt=Array.from(re.values());for(let Rt of zt)if(Rt.process.exitCode===null)try{Rt.process.kill("SIGTERM")}catch{}let be=zt.map(Rt=>new Promise(Zr=>{if(Rt.process.exitCode!==null)return Zr();Rt.process.once("exit",()=>Zr())})),Ue,rt=new Promise(Rt=>{Ue=setTimeout(()=>{for(let Zr of zt)if(Zr.process.exitCode===null)try{Zr.process.kill("SIGKILL")}catch{}Rt()},_)});yield Promise.race([Promise.all(be),rt]);let Tt=Array.from(re.values());for(let Rt of Tt)if(Rt.process.exitCode===null)try{Rt.process.kill("SIGKILL")}catch{}yield Promise.race([Promise.all(Tt.map(Rt=>new Promise(Zr=>{if(Rt.process.exitCode!==null)return Zr();Rt.process.once("exit",()=>Zr())}))),new Promise(Rt=>{var Zr;let kr=setTimeout(Rt,2e3);(Zr=kr.unref)===null||Zr===void 0||Zr.call(kr)})]),Ue&&clearTimeout(Ue),Y(U)})}return{pids:Ce,ports:Ze,exitCode$:Z.promise,stop:()=>I(this,void 0,void 0,function*(){yield zr()}),restartService:zt=>Vn(zt)}})}var sxi,oxi,axi,cxi,lxi,YOr=p(()=>{ce();DOr();ROr();LOr();FOr();BOr();pnt();pnt();sxi=5e3,oxi=1e4,axi=5e3,cxi=3,lxi=["transport","layout","session","log"]});import{existsSync as QOr,realpathSync as uxi}from"fs";import{dirname as JOr,resolve as ZOr}from"path";function dxi(t){var e;let r=`${t}.main.mjs`,n=(e=process.argv[1])!==null&&e!==void 0?e:"";if(n){let s="";try{s=JOr(uxi(n))}catch{s=JOr(n)}let o=ZOr(s,r);if(QOr(o))return o}let i=ZOr(process.cwd(),"dist/packages/@machina.at/
|
|
892
|
+
`);let rt=re.get(zt);if(rt&&rt.process.exitCode===null){rt.reaped=!0;try{rt.process.kill("SIGKILL")}catch{}}return"fail"}})}function gi(zt){return I(this,void 0,void 0,function*(){var be;if(!(X||!Te)&&!pe.get(zt)){pe.set(zt,!0);try{let Ue=yield Te.restart(zt);if((be=t.onRestart)===null||be===void 0||be.call(t,zt,Ue),Ue==="circuit-open"){U===0&&(U=1),zr();return}Ue==="success"&&ge&&ge.resetFailureCount(zt)}finally{pe.set(zt,!1)}}})}function Vn(zt){return I(this,void 0,void 0,function*(){if(pe.get(zt))return"fail";ge?.suspendProbe(zt),pe.set(zt,!0);try{let be=yield en(zt);return be==="success"&&ge?.resetFailureCount(zt),be}finally{pe.set(zt,!1),ge?.resumeProbe(zt)}})}function zr(){return I(this,void 0,void 0,function*(){if(X)return;if(X=!0,ge)try{yield ge.stop()}catch{}let zt=Array.from(re.values());for(let Rt of zt)if(Rt.process.exitCode===null)try{Rt.process.kill("SIGTERM")}catch{}let be=zt.map(Rt=>new Promise(Zr=>{if(Rt.process.exitCode!==null)return Zr();Rt.process.once("exit",()=>Zr())})),Ue,rt=new Promise(Rt=>{Ue=setTimeout(()=>{for(let Zr of zt)if(Zr.process.exitCode===null)try{Zr.process.kill("SIGKILL")}catch{}Rt()},_)});yield Promise.race([Promise.all(be),rt]);let Tt=Array.from(re.values());for(let Rt of Tt)if(Rt.process.exitCode===null)try{Rt.process.kill("SIGKILL")}catch{}yield Promise.race([Promise.all(Tt.map(Rt=>new Promise(Zr=>{if(Rt.process.exitCode!==null)return Zr();Rt.process.once("exit",()=>Zr())}))),new Promise(Rt=>{var Zr;let kr=setTimeout(Rt,2e3);(Zr=kr.unref)===null||Zr===void 0||Zr.call(kr)})]),Ue&&clearTimeout(Ue),Y(U)})}return{pids:Ce,ports:Ze,exitCode$:Z.promise,stop:()=>I(this,void 0,void 0,function*(){yield zr()}),restartService:zt=>Vn(zt)}})}var sxi,oxi,axi,cxi,lxi,YOr=p(()=>{ce();DOr();ROr();LOr();FOr();BOr();pnt();pnt();sxi=5e3,oxi=1e4,axi=5e3,cxi=3,lxi=["transport","layout","session","log"]});import{existsSync as QOr,realpathSync as uxi}from"fs";import{dirname as JOr,resolve as ZOr}from"path";function dxi(t){var e;let r=`${t}.main.mjs`,n=(e=process.argv[1])!==null&&e!==void 0?e:"";if(n){let s="";try{s=JOr(uxi(n))}catch{s=JOr(n)}let o=ZOr(s,r);if(QOr(o))return o}let i=ZOr(process.cwd(),"dist/packages/@planx.machina.at/cli",r);return QOr(i)?i:null}function mnt(){let t={};for(let e of fxi){let r=dxi(e);r&&(t[e]=r)}return t}var fxi,XOr=p(()=>{fxi=["layout","session","transport","log"]});function gnt(t){let{supervisor:e,logger:r,extraCleanup:n}=t,i=()=>I(this,void 0,void 0,function*(){try{yield e.stop()}catch(s){console.warn("[session-server] supervisor.stop failed:",s)}try{yield n?.()}catch(s){console.warn("[session-server] extraCleanup failed:",s)}try{r.close()}catch(s){console.warn("[session-server] logger.close failed:",s)}});return e.exitCode$.then(s=>I(this,void 0,void 0,function*(){s!==0&&(console.error(`[session-server] supervisor exited with code ${s}, terminating parent`),yield i(),process.exit(s))})).catch(()=>{}),process.on("uncaughtException",s=>I(this,void 0,void 0,function*(){console.error("[session-server] Uncaught exception:",s),yield i(),process.exit(1)})),process.on("unhandledRejection",s=>{console.warn("[session-server] Unhandled rejection:",s)}),new Promise(s=>{let o=a=>I(this,void 0,void 0,function*(){console.error(`[lifecycle-diag] parent process received ${a} at ${new Date().toISOString()} (pid=${process.pid})`),console.error("[lifecycle-diag] trace:",new Error("signal source").stack),yield i(),s()});process.on("SIGINT",()=>{o("SIGINT")}),process.on("SIGTERM",()=>{o("SIGTERM")})})}var ePr=p(()=>{ce()});var vnt=p(()=>{AOr();OOr();YOr();XOr();ePr()});function tPr(t,e){return I(this,void 0,void 0,function*(){try{let r=yield e(t);if(!r.ok)return"fail";let n=yield r.json().catch(()=>null);return n?.status==="ok"?"ok":"fail"}catch{return"unreachable"}})}function rPr(t){return I(this,void 0,void 0,function*(){var e;let r=(e=t.fetchImpl)!==null&&e!==void 0?e:fetch,[n,i]=yield Promise.all([tPr(`http://localhost:${t.sessionPort}/health`,r),tPr(`http://localhost:${t.layoutPort}/health`,r)]),s=n==="ok"&&i==="ok";return console.log(`[server-services] session<->layout reachable=${s} session=${n} layout=${i}`),{session:n,layout:i,reachable:s}})}var nPr=p(()=>{ce()});import{mkdirSync as pxi,writeFileSync as hxi}from"fs";import{join as mxi}from"path";function iPr(t,e){let r=ree(t),n=`${r}/transport.port`;return process.env.PLANX_TRANSPORT_PORT_FILE=n,e&&(pxi(r,{recursive:!0}),hxi(mxi(r,"self.hip"),YM(e))),n}var sPr=p(()=>{yr();Nf()});import{join as oPr}from"path";function Xs(t,e){return oPr(t,`${e}.pid`)}function Lo(t,e){return oPr(t,`${e}.port`)}var kd=p(()=>{});import{join as aPr}from"path";function cPr(t){let e=t.configDir;return{PLANX_SERVER_NAME:t.serverName,PLANX_SERVER_ID:t.peerId,PLANX_SERVER_CONFIG_DIR:e,PLANX_LAYOUT_PORT_FILE:Lo(e,"layout"),PLANX_LAYOUT_PID_FILE:Xs(e,"layout"),PLANX_SESSION_PORT_FILE:Lo(e,"session"),PLANX_PROXY_PORT_FILE:Lo(e,"proxy"),PLANX_PROXY_PID_FILE:Xs(e,"proxy"),PLANX_LOG_PORT_FILE:Lo(e,"log"),PLANX_LOG_PID_FILE:Xs(e,"log"),PLANX_LOG_DB:aPr(e,"logs.db"),PLANX_LAYOUT_STATE_DIR:aPr(e,"layout-state")}}function lPr(t){let e=gxi.filter(r=>!t[r]);if(e.length>0)throw new Error(`child process \u306B identity env \u304C\u6CE8\u5165\u3055\u308C\u3066\u3044\u307E\u305B\u3093: ${e.join(", ")} (supervisor \u7D4C\u7531\u3067\u306A\u3044\u8D77\u52D5\u304B\u3001childEnv \u306E\u914D\u7DDA\u6F0F\u308C\u3067\u3059)`);return{serverName:t.PLANX_SERVER_NAME,peerId:t.PLANX_SERVER_ID,configDir:t.PLANX_SERVER_CONFIG_DIR}}var gxi,ynt=p(()=>{kd();gxi=["PLANX_SERVER_NAME","PLANX_SERVER_ID","PLANX_SERVER_CONFIG_DIR"]});import{Writable as vxi}from"node:stream";function uPr(t){var e,r,n,i;let s=(e=t.fetchFn)!==null&&e!==void 0?e:fetch,o=(r=t.maxBuffer)!==null&&r!==void 0?r:_xi,a=[],c=null,l=null,u=Promise.resolve(),d=0,f=!1,h=(b,w)=>{var E,x;let A=Date.now();return{id:`${String(A).padStart(14,"0")}-sup${process.pid.toString(36)}-${(d++).toString(36).padStart(6,"0")}`,timestamp:A,peer_id:"local",process_id:process.pid,level:w,component:(x=(E=wxi.exec(b))===null||E===void 0?void 0:E[1])!==null&&x!==void 0?x:"unknown",message:b,context:null,error:null}},m=(b,w)=>{if(!f){for(let E of b.split(`
|
|
893
893
|
`))E.length!==0&&a.push(h(E,w));a.length>o&&a.splice(0,a.length-o)}},y=()=>I(this,void 0,void 0,function*(){if(c===null||a.length===0)return;let b=a.splice(0,bxi);try{yield s(`${c}/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})}catch{}}),g=()=>{u=u.then(y)},_=(b,w)=>new vxi({write(E,x,A){let O=String(E);w?.write(O),m(O,b),A()}});return{stdout:_("INFO",(n=t.echo)===null||n===void 0?void 0:n.stdout),stderr:_("ERROR",(i=t.echo)===null||i===void 0?void 0:i.stderr),setLogdPort(b){var w,E;c=`http://127.0.0.1:${b}`,g(),l===null&&(l=setInterval(g,(w=t.flushIntervalMs)!==null&&w!==void 0?w:yxi),(E=l.unref)===null||E===void 0||E.call(l))},close(){return I(this,void 0,void 0,function*(){for(l!==null&&clearInterval(l),l=null;c!==null&&a.length>0;)g(),yield u;yield u,f=!0})}}}var yxi,_xi,bxi,wxi,dPr=p(()=>{ce();yxi=1e3,_xi=5e3,bxi=200,wxi=/^\[([^[\]\s]+)\]/});import*as fPr from"node:fs";import{Writable as Sxi}from"node:stream";function pPr(t,e,r){return e.PLANX_SUPERVISOR_ECHO||!r?!0:rrt(t,e)!==on.SILENT}function hPr(t){var e;let r=fPr.createWriteStream(t.logFilePath,{flags:"a"}),n=uPr({echo:(e=t.echo)!==null&&e!==void 0?e:null,fetchFn:t.fetchFn}),i=s=>new Sxi({write(o,a,c){try{r.write(o)}catch{}s.write(o),c()}});return{stdout:i(n.stdout),stderr:i(n.stderr),setLogdPort:s=>n.setLogdPort(s),close(){return I(this,void 0,void 0,function*(){yield n.close(),yield new Promise(s=>r.end(s))})}}}var mPr=p(()=>{ce();$h();nrt();dPr()});function iEe(t){return I(this,void 0,void 0,function*(){var e;let{injector:r,usecase:n,logger:i,peerId:s,identity:o,serverName:a}=t,c=n.getConfig(),l=process.env;l.PLANX_LOG_PORT_FILE=Lo(c.SESSIONS_DIR,"log");let u=r.get(ta),d=iPr(a,s),f=Object.assign(Object.assign({},cPr({serverName:a,configDir:c.SESSIONS_DIR,peerId:s})),{PLANX_TRANSPORT_PORT_FILE:d}),h=pPr(process.argv,l,process.stdout.isTTY===!0),m=hPr({logFilePath:c.LOG_FILE,echo:h?{stdout:process.stdout,stderr:process.stderr}:null}),y=yield hnt({cliPath:process.argv[1],serviceEntryPaths:mnt(),transportPortFile:d,nodePath:process.execPath,shutdownTimeoutMs:5e3,bootTimeoutMs:6e4,extraArgs:["--name",a],childEnv:f,stdout:m.stdout,stderr:m.stderr,onRestart:(w,E)=>{var x;return(x=i.warn)===null||x===void 0?void 0:x.call(i,`[supervisor] restart ${w}: ${E}`)}});m.setLogdPort(y.ports.log);for(let w of["layout","session","proxy","log"])u.register(w,y.ports[w]);let g=[{name:"transport",port:y.ports.transport,status:"running"},{name:"layout",port:y.ports.layout,status:"running"},{name:"session-trpc",port:y.ports.session,status:"running"},{name:"proxy-trpc",port:y.ports.proxy,status:"running"},{name:"log",port:y.ports.log,status:"running"}],_=yield n.getPeerInfo(),b=yield O2e((e=_.allowPeers)!==null&&e!==void 0?e:[],yield n.getMyPeers().catch(()=>[]));_j("session-server",{version:cu(),pid:process.pid,name:a,configDir:c.SESSIONS_DIR,logFile:c.LOG_FILE,pidFile:c.PID_FILE,services:g,peerName:a,uuid:_.uuid,identity:{peerId:o.peerId,publicKey:o.publicKey},allowPeers:b,isAuthenticated:_.isAuthenticated}),rPr({sessionPort:y.ports.session,layoutPort:y.ports.layout}).catch(()=>{}),yield gnt({supervisor:y,logger:i,extraCleanup:()=>m.close()})})}var _nt=p(()=>{ce();UF();vnt();M2();nPr();sPr();ynt();kd();mPr()});function sEe(t=process.env){let e=Object.assign({},t);for(let r of Exi)delete e[r];return e}var Exi,bnt=p(()=>{Exi=["PLANX_SESSION_ID","PLANX_SESSION_NAME","PLANX_SERVER_ID","PLANX_SERVER_NAME","PLANX_TRANSPORT_TRPC_URL","PLANX_TRANSPORT_PORT_FILE"]});function gPr(t,e,r){return I(this,void 0,void 0,function*(){var n,i,s;let o=(n=r.isInteractive)!==null&&n!==void 0?n:(()=>process.stdin.isTTY===!0);if(t!==hx||!o())return t;let a=(i=r.loadConfig)!==null&&i!==void 0?i:dA,c=(s=r.saveConfig)!==null&&s!==void 0?s:rEe,l=a(e),u=xYt(l);if(l.defaultServerName)return u;let d=yield r.prompt(u);return c(e,{defaultServerName:d}),d})}var vPr=p(()=>{ce();xwe();lnt();p1()});var _Pr={};fr(_Pr,{promptServerName:()=>yPr,resolveServerNameInteractively:()=>Axi});import{homedir as Ixi}from"os";function yPr(t,e){return I(this,void 0,void 0,function*(){return process.stdin.isTTY?e?(yield e(`Server name [${t}]: `)).trim()||t:Oxi("Server name: ",t):t})}function Axi(t,e){return I(this,void 0,void 0,function*(){let r=e??Ixi()+"/.planx";return gPr(t,r,{prompt:yPr})})}function Oxi(t,e){return new Promise(r=>{let n="",i=()=>{process.stdout.write(`\r\x1B[K${t}`),n.length===0?(process.stdout.write(`${Txi}${e}${wnt}`),process.stdout.write(`\r\x1B[${t.length}C`)):process.stdout.write(`${xxi}${n}${wnt}`)};process.stdin.setRawMode(!0),process.stdin.resume(),i();let s=o=>{let a=o.toString();if(a==="\r"||a===`
|
|
894
894
|
`){process.stdin.setRawMode(!1),process.stdin.pause(),process.stdin.removeListener("data",s);let c=n||e;process.stdout.write(`\r\x1B[K${t}${Cxi}${c}${wnt}
|
|
895
895
|
`),r(c);return}a===""&&(process.stdin.setRawMode(!1),process.stdout.write(`
|
|
@@ -1043,7 +1043,7 @@ WORKFLOW:
|
|
|
1043
1043
|
4. Take action based on user request
|
|
1044
1044
|
5. Report results concisely
|
|
1045
1045
|
|
|
1046
|
-
Be proactive. Be efficient. Minimize chat, maximize action.`,IFr={"machina-session":{command:"node",args:["dist/packages/@machina.at/
|
|
1046
|
+
Be proactive. Be efficient. Minimize chat, maximize action.`,IFr={"machina-session":{command:"node",args:["dist/packages/@planx.machina.at/cli/main.js","mcp"]}},TFr=["mcp__machina-session__list_servers","mcp__machina-session__list_sessions","mcp__machina-session__create_session","mcp__machina-session__delete_session","mcp__machina-session__rename_session","mcp__machina-session__send_keys","mcp__machina-session__get_session_output","mcp__machina-session__init_state","mcp__machina-session__get_state","mcp__machina-session__update_state","mcp__machina-session__destroy_state"]});var xFr,CFr,AFr,Bct=p(()=>{xFr=`You are an autonomous investigation agent with access to session management and code analysis tools.
|
|
1047
1047
|
|
|
1048
1048
|
Available capabilities:
|
|
1049
1049
|
1. Session Management: Create, monitor, and manage sessions via machina-session MCP
|
|
@@ -1056,7 +1056,7 @@ WORKFLOW:
|
|
|
1056
1056
|
3. Analyze findings
|
|
1057
1057
|
4. Report results clearly
|
|
1058
1058
|
|
|
1059
|
-
Be thorough but efficient. Use the most appropriate tool for each task.`,CFr={"machina-session":{command:"node",args:["dist/packages/@machina.at/
|
|
1059
|
+
Be thorough but efficient. Use the most appropriate tool for each task.`,CFr={"machina-session":{command:"node",args:["dist/packages/@planx.machina.at/cli/main.js","mcp"]},serena:{command:"uvx",args:["--from","serena-agent","serena","--project",process.cwd()]}},AFr=["mcp__machina-session__list_servers","mcp__machina-session__list_sessions","mcp__machina-session__create_session","mcp__machina-session__delete_session","mcp__machina-session__rename_session","mcp__machina-session__send_keys","mcp__machina-session__get_session_output","mcp__machina-session__init_state","mcp__machina-session__get_state","mcp__machina-session__update_state","mcp__machina-session__destroy_state","mcp__serena__list_dir","mcp__serena__find_file","mcp__serena__search_for_pattern","mcp__serena__get_symbols_overview","mcp__serena__find_symbol","mcp__serena__find_referencing_symbols","mcp__serena__read_memory","mcp__serena__list_memories"]});function Vct(t){return t==="worker"?{systemPrompt:xFr,mcpConfig:CFr,allowedTools:AFr}:{systemPrompt:EFr,mcpConfig:IFr,allowedTools:TFr}}var OFr=p(()=>{qct();Bct()});var Mm,PFr=p(()=>{Mm={thinking:"\u{1F914}",tool:"\u{1F527}",done:"\u2705",error:"\u274C",info:"\u2139\uFE0F"}});import{execSync as Jqi}from"child_process";function Zqi(){try{return Jqi("which claude",{encoding:"utf-8"}).trim()}catch{return}}var Uct,DFr=p(()=>{Uct=Zqi()});var Hct=p(()=>{qct();Bct();OFr();PFr();DFr()});function Fd(t){let e=t,r=new Set;return{get:()=>e,set:n=>{e=n,r.forEach(i=>i())},update:n=>{e=n(e),r.forEach(i=>i())},subscribe:n=>(r.add(n),()=>r.delete(n))}}function Wct(t){let e=Fd(t||""),r=Fd([]),n=Fd("running"),i=Fd(void 0),s=Fd(void 0),o=Fd(void 0),a=Fd(void 0),c=Fd(void 0),l=Fd(void 0),u=Fd(void 0),d=Fd(void 0),f=Fd(void 0),h=Fd(void 0),m=Fd(void 0),y=Fd(void 0);return{input:e,messages:r,status:n,model:i,sessionId:s,serverId:o,serverName:a,sessionName:c,branchName:l,cwd:u,numTurns:d,totalCostUsd:f,errors:h,state:m,stateSchema:y,toOutput:()=>({input:e.get(),messages:r.get(),status:n.get(),model:i.get(),sessionId:s.get(),serverId:o.get(),serverName:a.get(),sessionName:c.get(),branchName:l.get(),cwd:u.get(),numTurns:d.get(),totalCostUsd:f.get(),errors:h.get(),state:m.get(),stateSchema:y.get()}),effect:b=>{let w=!1,E=()=>{w||(w=!0,queueMicrotask(()=>{w=!1,b()}))},x=[e.subscribe(E),r.subscribe(E),n.subscribe(E),d.subscribe(E),f.subscribe(E),h.subscribe(E),m.subscribe(E)];return()=>x.forEach(A=>A())},addMessage:b=>{r.update(w=>[...w,b])},addUserMessage:b=>{e.set(""),n.set("running"),r.update(w=>[...w,{type:"user",content:b,timestamp:new Date().toISOString()}])},setSuccess:(b,w)=>{d.set(b),f.set(w),n.set("success")},setError:b=>{h.set(b),n.set("error")},setCancelled:b=>{b&&h.set(b),n.set("cancelled")}}}var NFr=p(()=>{});function Kct(t){return t?new Gct:new zct}var kFr,Gct,zct,RFr=p(()=>{Hct();kFr="\x1B[3J\x1B[2J\x1B[H",Gct=class{render(e){let r=JSON.stringify(e,null,2);process.stdout.write(kFr+r+`
|
|
1060
1060
|
`)}},zct=class{constructor(){this.tempStatus=null}render(e){var r,n;let i=[];for(let s of e.messages){let o=this.formatMessage(s);o&&i.push(o)}e.input&&e.status==="running"&&i.push(`> ${e.input}`),this.tempStatus&&i.push(this.tempStatus),e.status==="success"?i.push(`${Mm.done} Done (${e.numTurns} turns, $${(r=e.totalCostUsd)===null||r===void 0?void 0:r.toFixed(4)})`):e.status==="error"?(i.push(`${Mm.error} Error`),(n=e.errors)===null||n===void 0||n.forEach(s=>i.push(` ${s}`))):e.status==="cancelled"&&i.push(`${Mm.error} Cancelled`),process.stdout.write(kFr+i.join(`
|
|
1061
1061
|
`)+`
|
|
1062
1062
|
`)}formatMessage(e){switch(e.type){case"user":return`> ${e.content}`;case"system":return e.content==="init"?`${Mm.info} Session initialized`:null;case"text":return e.content;case"tool_use":return`${Mm.tool} Using tool: ${e.toolName}`;case"tool_result":return`${Mm.tool} [Tool result: ${e.toolName}]`;default:return null}}showStatus(e,r){this.tempStatus=`${e} ${r}`}}});function Yct(t,e,r){return I(this,void 0,void 0,function*(){let n=g8(e);if(n.length>0)throw new Error(`Schema validation failed:
|