@junobuild/cli 0.14.2 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1016,7 +1016,7 @@ const require = topLevelCreateRequire(resolve(process.cwd(), '.juno-pseudo-requi
|
|
|
1016
1016
|
`),console.log("\u{1F194} ",Number(s)),console.log("\u23F3 ",Object.keys(p)[0]??p),It(d)&&(l.stop(),console.log("\u274C Hash undefined. This is unexpected."),process.exit(1)),console.log("\u{1F512} ",NT(d)),{sha256:d}}catch(c){throw l.stop(),c}},{sha256:o}=await a();return n?(await(async()=>{console.log("");let l=Ri("Committing proposal...").start();try{await Uee({proposal:{proposal_id:s,sha256:o},cdn:t}),l.stop(),console.log(`\u{1F3AF} Change #${s} applied.`)}catch(c){throw l.stop(),c}})(),{proposalId:s}):{proposalId:s}},UR=e=>{let t=e>=1e3?"megabyte":"kilobyte";return new Intl.NumberFormat("en",{style:"unit",unit:t}).format(e/(t==="megabyte"?1e6:1e3))},r0r=nN(Gfr(),1),n0r=r0r.default,i0r=nN(Zfr(),1),DYe="\x1B[",CYe={CURSOR_HIDE:DYe+"?25l",CURSOR_SHOW:DYe+"?25h"},Zce=(function(e){return e.FORCE_UNICODE="LISTR_FORCE_UNICODE",e.FORCE_TTY="LISTR_FORCE_TTY",e.DISABLE_COLOR="NO_COLOR",e.FORCE_COLOR="FORCE_COLOR",e})({}),PR=(function(e){return e.WILL_RETRY="WILL_RETRY",e.WILL_ROLLBACK="WILL_ROLLBACK",e.HAS_FAILED_TO_ROLLBACK="HAS_FAILED_TO_ROLLBACK",e.HAS_FAILED="HAS_FAILED",e.HAS_FAILED_WITHOUT_ERROR="HAS_FAILED_WITHOUT_ERROR",e})({}),Mx=(function(e){return e.SHOULD_REFRESH_RENDER="SHOUD_REFRESH_RENDER",e})({}),DR=(function(e){return e.PRIMARY="PRIMARY",e.SECONDARY="SECONDARY",e.SILENT="SILENT",e})({}),Ss=(function(e){return e.TITLE="TITLE",e.STATE="STATE",e.ENABLED="ENABLED",e.SUBTASK="SUBTASK",e.PROMPT="PROMPT",e.OUTPUT="OUTPUT",e.MESSAGE="MESSAGE",e.CLOSED="CLOSED",e})({}),Zs=(function(e){return e.WAITING="WAITING",e.STARTED="STARTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.SKIPPED="SKIPPED",e.ROLLING_BACK="ROLLING_BACK",e.ROLLED_BACK="ROLLED_BACK",e.RETRY="RETRY",e.PAUSED="PAUSED",e.PROMPT="PROMPT",e.PROMPT_COMPLETED="PROMPT_COMPLETED",e.PROMPT_FAILED="PROMPT_FAILED",e})({}),aWe=class{emitter=new n0r;emit(e,t){this.emitter.emit(e,t)}on(e,t){this.emitter.addListener(e,t)}once(e,t){this.emitter.once(e,t)}off(e,t){this.emitter.off(e,t)}complete(){this.emitter.removeAllListeners()}};function p0r(e){return!!e&&typeof e=="object"&&typeof e.subscribe=="function"}function d0r(e){return!!e&&typeof e=="object"&&e.readable===!0&&typeof e.read=="function"&&typeof e.on=="function"}function oWe(){return!!process.env[Zce.FORCE_UNICODE]||process.platform!=="win32"||!!process.env.CI||!!process.env.WT_SESSION||process.env.TERM_PROGRAM==="vscode"||process.env.TERM==="xterm-256color"||process.env.TERM==="alacritty"}var f0r="(?:\\u001b|\\u009b)\\[[\\=><~/#&.:=?%@~_-]*[0-9]*[\\a-ln-tqyz=><~/#&.:=?%@~_-]+",m0r=/\u0007/;function BR(e){return String(e).replace(new RegExp(f0r,"gmi"),"").replace(new RegExp(m0r,"gmi"),"").trim()}var Po=Object.fromEntries(Object.keys(s0r.colors).map(e=>[e,t=>a0r(e,String(t))]));function kYe(e,t){return e.replace(/^(?!\s*$)/gm," ".repeat(t))}var lWe={warning:"\u26A0",cross:"\u2716",arrowDown:"\u2193",tick:"\u2714",arrowRight:"\u2192",pointer:"\u276F",checkboxOn:"\u2612",arrowLeft:"\u2190",squareSmallFilled:"\u25FC",pointerSmall:"\u203A"},h0r={...lWe,warning:"\u203C",cross:"\xD7",tick:"\u221A",pointer:">",checkboxOn:"[\xD7]",squareSmallFilled:"\u25A0"},Vl=oWe()?lWe:h0r;function CR(e,...t){return o0r(String(e),...t)}var Oi=(function(e){return e.STARTED="STARTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.SKIPPED="SKIPPED",e.OUTPUT="OUTPUT",e.TITLE="TITLE",e.ROLLBACK="ROLLBACK",e.RETRY="RETRY",e.PROMPT="PROMPT",e.PAUSED="PAUSED",e})({}),vV={icon:{[Oi.STARTED]:Vl.pointer,[Oi.FAILED]:Vl.cross,[Oi.SKIPPED]:Vl.arrowDown,[Oi.COMPLETED]:Vl.tick,[Oi.OUTPUT]:Vl.pointerSmall,[Oi.TITLE]:Vl.arrowRight,[Oi.RETRY]:Vl.warning,[Oi.ROLLBACK]:Vl.arrowLeft,[Oi.PAUSED]:Vl.squareSmallFilled},color:{[Oi.STARTED]:Po.yellow,[Oi.FAILED]:Po.red,[Oi.SKIPPED]:Po.yellow,[Oi.COMPLETED]:Po.green,[Oi.RETRY]:Po.yellowBright,[Oi.ROLLBACK]:Po.redBright,[Oi.PAUSED]:Po.yellowBright}},cWe=[Oi.RETRY,Oi.ROLLBACK,Oi.FAILED],IV=class{process;constructor(e){this.options=e,this.options={useIcons:!0,toStderr:[],...e??{}},this.options.fields??={},this.options.fields.prefix??=[],this.options.fields.suffix??=[],this.process=this.options.processOutput??new y0r}log(e,t,r){let n=this.format(e,t,r);if(this.options.toStderr.includes(e)){this.process.toStderr(n);return}this.process.toStdout(n)}toStdout(e,t,r=!0){this.process.toStdout(this.format(null,e,t),r)}toStderr(e,t,r=!0){this.process.toStderr(this.format(null,e,t),r)}wrap(e,t){return e&&this.applyFormat(`[${e}]`,t)}splat(...e){let t=e.shift()??"";return e.length===0?t:CR(t,e)}suffix(e,...t){return t.filter(Boolean).forEach(r=>{if(e+=this.spacing(e),typeof r=="string")e+=this.wrap(r);else if(typeof r=="object"){if(r.args??=[],typeof r.condition=="function"?!r.condition(...r.args):!(r.condition??!0))return e;e+=this.wrap(typeof r.field=="function"?r.field(...r.args):r.field,{format:r?.format(...r.args)})}}),e}prefix(e,...t){return t.filter(Boolean).forEach(r=>{if(e=this.spacing(e)+e,typeof r=="string")e=this.wrap(r)+e;else if(typeof r=="object"){if(r.args??=[],typeof r.condition=="function"?!r.condition(...r.args):!(r.condition??!0))return e;e=this.wrap(typeof r.field=="function"?r.field(...r.args):r.field,{format:r?.format()})+e}}),e}fields(e,t){return this.options?.fields?.prefix&&(e=this.prefix(e,...this.options.fields.prefix)),t?.prefix&&(e=this.prefix(e,...t.prefix)),t?.suffix&&(e=this.suffix(e,...t.suffix)),this.options?.fields?.suffix&&(e=this.suffix(e,...this.options.fields.suffix)),e}icon(e,t){if(!e)return null;if(!t){let n=this.options.icon?.[e];t=typeof n=="function"?n():n}let r=this.options.color?.[e];return t&&r&&(t=r(t)),t}format(e,t,r){return Array.isArray(t)||(t=[t]),t=this.splat(t.shift(),...t).toString().split(WT).filter(n=>!n||n.trim()!=="").map(n=>this.style(e,this.fields(n,{prefix:Array.isArray(r?.prefix)?r.prefix:[r?.prefix],suffix:Array.isArray(r?.suffix)?r.suffix:[r?.suffix]}))).join(WT),t}style(e,t){if(!e||!t)return t;let r=this.icon(e,!this.options.useIcons&&this.wrap(e));return r&&(t=r+" "+t),t}applyFormat(e,t){return t?.format?t.format(e):e}spacing(e){return typeof e>"u"||e.trim()===""?"":" "}},Qce=class{buffer=[];decoder=new l0r;constructor(e){this.options=e}get all(){return this.buffer}get last(){return this.buffer.at(-1)}get length(){return this.buffer.length}write(e,...t){let r=t[t.length-1];return this.buffer.push({time:Date.now(),stream:this.options?.stream,entry:this.decoder.write(typeof e=="string"?Buffer.from(e,typeof t[0]=="string"?t[0]:void 0):Buffer.from(e))}),this.options?.limit&&(this.buffer=this.buffer.slice(-this.options.limit)),typeof r=="function"&&r(),!0}reset(){this.buffer=[]}},LYe=class{method;buffer;constructor(e){this.stream=e,this.method=e.write,this.buffer=new Qce({stream:e})}get out(){let e=this;return new Proxy(this.stream,{get(t,r,n){return r==="write"?e.write.bind(e):Reflect.get(t,r,n)}})}hijack(){this.stream.write=this.buffer.write.bind(this.buffer)}release(){this.stream.write=this.method;let e=[...this.buffer.all];return this.buffer.reset(),e}write(...e){return this.method.apply(this.stream,e)}},y0r=class{stream;active;constructor(e,t,r){this.options=r,this.stream={stdout:new LYe(e??process.stdout),stderr:new LYe(t??process.stderr)},this.options={dump:["stdout","stderr"],leaveEmptyLine:!0,...r}}get stdout(){return this.stream.stdout.out}get stderr(){return this.stream.stderr.out}hijack(){if(this.active)throw new Error("ProcessOutput has been already hijacked!");this.stream.stdout.write(CYe.CURSOR_HIDE),Object.values(this.stream).forEach(e=>e.hijack()),this.active=!0}release(){let e=Object.entries(this.stream).map(([t,r])=>({name:t,buffer:r.release()})).filter(t=>this.options.dump.includes(t.name)).flatMap(t=>t.buffer).sort((t,r)=>t.time-r.time).map(t=>({...t,entry:BR(t.entry)})).filter(t=>t.entry);e.length>0&&(this.options.leaveEmptyLine&&this.stdout.write(WT),e.forEach(t=>{(t.stream??this.stdout).write(t.entry+WT)})),this.stream.stdout.write(CYe.CURSOR_SHOW),this.active=!1}toStdout(e,t=!0){return t&&(e=e+WT),this.stream.stdout.write(e)}toStderr(e,t=!0){return t&&(e=e+WT),this.stream.stderr.write(e)}};function T0r(e){let t=new c0r;return t.rows=1/0,t.columns=1/0,t.write=r=>(e(r.toString()),!0),t}var g0r=class{spinner=oWe()?["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]:["-","\\","|","/"];id;spinnerPosition=0;spin(){this.spinnerPosition=++this.spinnerPosition%this.spinner.length}fetch(){return this.spinner[this.spinnerPosition]}isRunning(){return!!this.id}start(e,t=100){this.id=setInterval(()=>{this.spin(),e&&e()},t)}stop(){clearInterval(this.id),this.id=void 0}},rs=(function(e){return e.SKIPPED_WITH_COLLAPSE="SKIPPED_WITH_COLLAPSE",e.SKIPPED_WITHOUT_COLLAPSE="SKIPPED_WITHOUT_COLLAPSE",e.OUTPUT="OUTPUT",e.OUTPUT_WITH_BOTTOMBAR="OUTPUT_WITH_BOTTOMBAR",e.PENDING="PENDING",e.COMPLETED="COMPLETED",e.COMPLETED_WITH_FAILED_SUBTASKS="COMPLETED_WITH_FAILED_SUBTASKS",e.COMPLETED_WITH_FAILED_SISTER_TASKS="COMPLETED_WITH_SISTER_TASKS_FAILED",e.RETRY="RETRY",e.ROLLING_BACK="ROLLING_BACK",e.ROLLED_BACK="ROLLED_BACK",e.FAILED="FAILED",e.FAILED_WITH_FAILED_SUBTASKS="FAILED_WITH_SUBTASKS",e.WAITING="WAITING",e.PAUSED="PAUSED",e})({}),RYe={icon:{[rs.SKIPPED_WITH_COLLAPSE]:Vl.arrowDown,[rs.SKIPPED_WITHOUT_COLLAPSE]:Vl.warning,[rs.OUTPUT]:Vl.pointerSmall,[rs.OUTPUT_WITH_BOTTOMBAR]:Vl.pointerSmall,[rs.PENDING]:Vl.pointer,[rs.COMPLETED]:Vl.tick,[rs.COMPLETED_WITH_FAILED_SUBTASKS]:Vl.warning,[rs.COMPLETED_WITH_FAILED_SISTER_TASKS]:Vl.squareSmallFilled,[rs.RETRY]:Vl.warning,[rs.ROLLING_BACK]:Vl.warning,[rs.ROLLED_BACK]:Vl.arrowLeft,[rs.FAILED]:Vl.cross,[rs.FAILED_WITH_FAILED_SUBTASKS]:Vl.pointer,[rs.WAITING]:Vl.squareSmallFilled,[rs.PAUSED]:Vl.squareSmallFilled},color:{[rs.SKIPPED_WITH_COLLAPSE]:Po.yellow,[rs.SKIPPED_WITHOUT_COLLAPSE]:Po.yellow,[rs.PENDING]:Po.yellow,[rs.COMPLETED]:Po.green,[rs.COMPLETED_WITH_FAILED_SUBTASKS]:Po.yellow,[rs.COMPLETED_WITH_FAILED_SISTER_TASKS]:Po.red,[rs.RETRY]:Po.yellowBright,[rs.ROLLING_BACK]:Po.redBright,[rs.ROLLED_BACK]:Po.redBright,[rs.FAILED]:Po.red,[rs.FAILED_WITH_FAILED_SUBTASKS]:Po.red,[rs.WAITING]:Po.dim,[rs.PAUSED]:Po.yellowBright}};function S0r(e){let t=Math.floor(e/1e3),r=Math.floor(t/60),n;return t===0&&r===0&&(n=`0.${Math.floor(e/100)}s`),t>0&&(n=`${t%60}s`),r>0&&(n=`${r}m${n}`),n}var bue={condition:!0,field:S0r,format:()=>Po.dim},b0r=class eue{static nonTTY=!1;static rendererOptions={indentation:2,clearOutput:!1,showSubtasks:!0,collapseSubtasks:!0,collapseSkips:!0,showSkipMessage:!0,suffixSkips:!1,collapseErrors:!0,showErrorMessage:!0,suffixRetries:!0,lazy:!1,removeEmptyLines:!0,formatOutput:"wrap",pausedTimer:{...bue,format:()=>Po.yellowBright}};static rendererTaskOptions={outputBar:!0};prompt;activePrompt;spinner;logger;updater;truncate;wrap;buffer={output:new Map,bottom:new Map};cache={render:new Map,rendererOptions:new Map,rendererTaskOptions:new Map};constructor(t,r,n){this.tasks=t,this.options=r,this.events=n,this.options={...eue.rendererOptions,...this.options,icon:{...RYe.icon,...r?.icon??{}},color:{...RYe.color,...r?.color??{}}},this.spinner=this.options.spinner??new g0r,this.logger=this.options.logger??new IV({useIcons:!0,toStderr:[]}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color}async render(){let{createLogUpdate:t}=await Promise.resolve().then(()=>(Qmr(),kze)),{default:r}=await Promise.resolve().then(()=>(Bhr(),bJe)),{default:n}=await Promise.resolve().then(()=>(Whr(),wJe));this.updater=t(this.logger.process.stdout),this.truncate=r,this.wrap=n,this.logger.process.hijack(),this.options?.lazy||this.spinner.start(()=>{this.update()}),this.events.on(Mx.SHOULD_REFRESH_RENDER,()=>{this.update()})}update(){this.updater(this.create())}end(){this.spinner.stop(),this.updater.clear(),this.updater.done(),this.options.clearOutput||this.logger.process.toStdout(this.create({prompt:!1})),this.logger.process.release()}create(t){t={tasks:!0,bottomBar:!0,prompt:!0,...t};let r=[],n=this.renderer(this.tasks),i=this.renderBottomBar(),s=this.renderPrompt();return t.tasks&&n.length>0&&r.push(...n),t.bottomBar&&i.length>0&&(r.length>0&&r.push(""),r.push(...i)),t.prompt&&s.length>0&&(r.length>0&&r.push(""),r.push(...s)),r.join(WT)}style(t,r=!1){let n=this.cache.rendererOptions.get(t.id);if(t.isSkipped()){if(r||n.collapseSkips)return this.logger.icon(rs.SKIPPED_WITH_COLLAPSE);if(n.collapseSkips===!1)return this.logger.icon(rs.SKIPPED_WITHOUT_COLLAPSE)}if(r)return this.shouldOutputToBottomBar(t)?this.logger.icon(rs.OUTPUT_WITH_BOTTOMBAR):this.logger.icon(rs.OUTPUT);if(t.hasSubtasks()){if(t.isStarted()||t.isPrompt()&&n.showSubtasks!==!1&&!t.subtasks.every(i=>!i.hasTitle()))return this.logger.icon(rs.PENDING);if(t.isCompleted()&&t.subtasks.some(i=>i.hasFailed()))return this.logger.icon(rs.COMPLETED_WITH_FAILED_SUBTASKS);if(t.hasFailed())return this.logger.icon(rs.FAILED_WITH_FAILED_SUBTASKS)}return t.isStarted()||t.isPrompt()?this.logger.icon(rs.PENDING,!this.options?.lazy&&this.spinner.fetch()):t.isCompleted()?this.logger.icon(rs.COMPLETED):t.isRetrying()?this.logger.icon(rs.RETRY,!this.options?.lazy&&this.spinner.fetch()):t.isRollingBack()?this.logger.icon(rs.ROLLING_BACK,!this.options?.lazy&&this.spinner.fetch()):t.hasRolledBack()?this.logger.icon(rs.ROLLED_BACK):t.hasFailed()?this.logger.icon(rs.FAILED):t.isPaused()?this.logger.icon(rs.PAUSED):this.logger.icon(rs.WAITING)}format(t,r,n){if(t.trim()==="")return[];r&&(t=r+" "+t);let i,s=(process.stdout.columns??80)-n*this.options.indentation-2;switch(this.options.formatOutput){case"truncate":i=t.split(WT).map((a,o)=>this.truncate(this.indent(a,o),s));break;case"wrap":i=this.wrap(t,s,{hard:!0,trim:!1}).split(WT).map((a,o)=>this.indent(a,o));break;default:throw new BYe("Format option for the renderer is wrong.")}return this.options.removeEmptyLines&&(i=i.filter(Boolean)),i.map(a=>kYe(a,n*this.options.indentation))}shouldOutputToOutputBar(t){let r=this.cache.rendererTaskOptions.get(t.id).outputBar;return typeof r=="number"&&r!==0||typeof r=="boolean"&&r!==!1}shouldOutputToBottomBar(t){let r=this.cache.rendererTaskOptions.get(t.id).bottomBar;return typeof r=="number"&&r!==0||typeof r=="boolean"&&r!==!1||!t.hasTitle()}renderer(t,r=0){return t.flatMap(n=>{if(!n.isEnabled())return[];if(this.cache.render.has(n.id))return this.cache.render.get(n.id);this.calculate(n),this.setupBuffer(n);let i=this.cache.rendererOptions.get(n.id),s=this.cache.rendererTaskOptions.get(n.id),a=[];if(n.isPrompt()){if(this.activePrompt&&this.activePrompt!==n.id)throw new BYe("Only one prompt can be active at the given time, please re-evaluate your task design.");this.activePrompt||(n.on(Ss.PROMPT,o=>{let l=BR(o);l&&(this.prompt=l)}),n.on(Ss.STATE,o=>{(o===Zs.PROMPT_COMPLETED||n.hasFinalized()||n.hasReset())&&(this.prompt=null,this.activePrompt=null,n.off(Ss.PROMPT))}),this.activePrompt=n.id)}if(n.hasTitle()&&(t.some(o=>o.hasFailed())&&!n.hasFailed()&&n.options.exitOnError!==!1&&!(n.isCompleted()||n.isSkipped())?a.push(...this.format(n.title,this.logger.icon(rs.COMPLETED_WITH_FAILED_SISTER_TASKS),r)):n.hasFailed()&&i.collapseErrors?a.push(...this.format(!n.hasSubtasks()&&n.message.error&&i.showErrorMessage?n.message.error:n.title,this.style(n),r)):n.isSkipped()&&i.collapseSkips?a.push(...this.format(this.logger.suffix(n.message.skip&&i.showSkipMessage?n.message.skip:n.title,{field:Oi.SKIPPED,condition:i.suffixSkips,format:()=>Po.dim}),this.style(n),r)):n.isRetrying()?a.push(...this.format(this.logger.suffix(n.title,{field:`${Oi.RETRY}:${n.message.retry.count}`,format:()=>Po.yellow,condition:i.suffixRetries}),this.style(n),r)):n.isCompleted()&&n.hasTitle()&&tN(s.timer?.condition,n.message.duration)?a.push(...this.format(this.logger.suffix(n?.title,{...s.timer,args:[n.message.duration]}),this.style(n),r)):n.isPaused()?a.push(...this.format(this.logger.suffix(n.title,{...i.pausedTimer,args:[n.message.paused-Date.now()]}),this.style(n),r)):a.push(...this.format(n.title,this.style(n),r))),(!n.hasSubtasks()||!i.showSubtasks)&&(n.hasFailed()&&i.collapseErrors===!1&&(i.showErrorMessage||!i.showSubtasks)?a.push(...this.dump(n,r,Oi.FAILED)):n.isSkipped()&&i.collapseSkips===!1&&(i.showSkipMessage||!i.showSubtasks)&&a.push(...this.dump(n,r,Oi.SKIPPED))),(n.isPending()||s.persistentOutput)&&a.push(...this.renderOutputBar(n,r)),i.showSubtasks!==!1&&n.hasSubtasks()&&(n.isPending()||n.hasFinalized()&&!n.hasTitle()||n.isCompleted()&&i.collapseSubtasks===!1&&!n.subtasks.some(o=>this.cache.rendererOptions.get(o.id)?.collapseSubtasks===!0)||n.subtasks.some(o=>this.cache.rendererOptions.get(o.id)?.collapseSubtasks===!1)||n.subtasks.some(o=>o.hasFailed())||n.subtasks.some(o=>o.hasRolledBack()))){let o=n.hasTitle()?r+1:r,l=this.renderer(n.subtasks,o);a.push(...l)}return n.hasFinalized()&&(s.persistentOutput||(this.buffer.bottom.delete(n.id),this.buffer.output.delete(n.id))),n.isClosed()&&(this.cache.render.set(n.id,a),this.reset(n)),a})}renderOutputBar(t,r){let n=this.buffer.output.get(t.id);return n?n.all.flatMap(i=>this.dump(t,r,Oi.OUTPUT,i.entry)):[]}renderBottomBar(){return this.buffer.bottom.size===0?[]:Array.from(this.buffer.bottom.values()).flatMap(t=>t.all).sort((t,r)=>t.time-r.time).map(t=>t.entry)}renderPrompt(){return this.prompt?[this.prompt]:[]}calculate(t){if(this.cache.rendererOptions.has(t.id)&&this.cache.rendererTaskOptions.has(t.id))return;let r={...this.options,...t.rendererOptions};this.cache.rendererOptions.set(t.id,r),this.cache.rendererTaskOptions.set(t.id,{...eue.rendererTaskOptions,timer:r.timer,...t.rendererTaskOptions})}setupBuffer(t){if(this.buffer.bottom.has(t.id)||this.buffer.output.has(t.id))return;let r=this.cache.rendererTaskOptions.get(t.id);this.shouldOutputToBottomBar(t)&&!this.buffer.bottom.has(t.id)?(this.buffer.bottom.set(t.id,new Qce({limit:typeof r.bottomBar=="number"?r.bottomBar:1})),t.on(Ss.OUTPUT,n=>{let i=this.dump(t,-1,Oi.OUTPUT,n);this.buffer.bottom.get(t.id).write(i.join(WT))}),t.on(Ss.STATE,n=>{n===(Zs.RETRY||Zs.ROLLING_BACK)&&this.buffer.bottom.delete(t.id)})):this.shouldOutputToOutputBar(t)&&!this.buffer.output.has(t.id)&&(this.buffer.output.set(t.id,new Qce({limit:typeof r.outputBar=="number"?r.outputBar:1})),t.on(Ss.OUTPUT,n=>{this.buffer.output.get(t.id).write(n)}),t.on(Ss.STATE,n=>{n===(Zs.RETRY||Zs.ROLLING_BACK)&&this.buffer.output.delete(t.id)}))}reset(t){this.cache.rendererOptions.delete(t.id),this.cache.rendererTaskOptions.delete(t.id),this.buffer.output.delete(t.id)}dump(t,r,n=Oi.OUTPUT,i){if(!i)switch(n){case Oi.OUTPUT:i=t.output;break;case Oi.SKIPPED:i=t.message.skip;break;case Oi.FAILED:i=t.message.error;break}return t.hasTitle()&&n===Oi.FAILED&&i===t.title||typeof i!="string"?[]:(n===Oi.OUTPUT&&(i=BR(i)),this.format(i,this.style(t,!0),r+1))}indent(t,r){return r>0?kYe(t.trimEnd(),this.options.indentation):t.trimEnd()}},x0r=class{static nonTTY=!0;static rendererOptions;static rendererTaskOptions;constructor(e,t){this.tasks=e,this.options=t}render(){}end(){}},E0r=class tue{static nonTTY=!0;static rendererOptions={pausedTimer:{...bue,field:t=>`${Oi.PAUSED}:${t}`,format:()=>Po.yellowBright}};static rendererTaskOptions={};logger;cache={rendererOptions:new Map,rendererTaskOptions:new Map};constructor(t,r){this.tasks=t,this.options=r,this.options={...tue.rendererOptions,...r,icon:{...vV.icon,...r?.icon??{}},color:{...vV.color,...r?.color??{}}},this.logger=this.options.logger??new IV({useIcons:!0,toStderr:cWe}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp&&this.logger.options.fields.prefix.unshift(this.options.timestamp)}end(){}render(){this.renderer(this.tasks)}renderer(t){t.forEach(r=>{this.calculate(r),r.once(Ss.CLOSED,()=>{this.reset(r)});let n=this.cache.rendererOptions.get(r.id),i=this.cache.rendererTaskOptions.get(r.id);r.on(Ss.SUBTASK,s=>{this.renderer(s)}),r.on(Ss.STATE,s=>{if(r.hasTitle())if(s===Zs.STARTED)this.logger.log(Oi.STARTED,r.title);else if(s===Zs.COMPLETED){let a=i?.timer;this.logger.log(Oi.COMPLETED,r.title,a&&{suffix:{...a,condition:!!r.message?.duration&&a.condition,args:[r.message.duration]}})}else s===Zs.PROMPT?(this.logger.process.hijack(),r.on(Ss.PROMPT,a=>{this.logger.process.toStderr(a,!1)})):s===Zs.PROMPT_COMPLETED&&(r.off(Ss.PROMPT),this.logger.process.release())}),r.on(Ss.OUTPUT,s=>{this.logger.log(Oi.OUTPUT,s)}),r.on(Ss.MESSAGE,s=>{if(s.error)this.logger.log(Oi.FAILED,r.title,{suffix:{field:`${Oi.FAILED}: ${s.error}`,format:()=>Po.red}});else if(s.skip)this.logger.log(Oi.SKIPPED,r.title,{suffix:{field:`${Oi.SKIPPED}: ${s.skip}`,format:()=>Po.yellow}});else if(s.rollback)this.logger.log(Oi.ROLLBACK,r.title,{suffix:{field:`${Oi.ROLLBACK}: ${s.rollback}`,format:()=>Po.red}});else if(s.retry)this.logger.log(Oi.RETRY,r.title,{suffix:{field:`${Oi.RETRY}:${s.retry.count}`,format:()=>Po.red}});else if(s.paused){let a=n?.pausedTimer;this.logger.log(Oi.PAUSED,r.title,a&&{suffix:{...a,condition:!!s?.paused&&a.condition,args:[s.paused-Date.now()]}})}})})}calculate(t){if(this.cache.rendererOptions.has(t.id)&&this.cache.rendererTaskOptions.has(t.id))return;let r={...this.options,...t.rendererOptions};this.cache.rendererOptions.set(t.id,r),this.cache.rendererTaskOptions.set(t.id,{...tue.rendererTaskOptions,timer:r.timer,...t.rendererTaskOptions})}reset(t){this.cache.rendererOptions.delete(t.id),this.cache.rendererTaskOptions.delete(t.id)}},v0r=class{constructor(e){this.options=e}serialize(e,t,r){return JSON.stringify(this.generate(e,t,r))}generate(e,t,r){let n={event:e,data:t};if(typeof this.options?.task!="boolean"){let i=Object.fromEntries(this.options.task.map(s=>{let a=r[s];return typeof a=="function"?[s,a.call(r)]:[s,a]}));Object.keys(r).length>0&&(n.task=i)}return n}},_0r=class uWe{static nonTTY=!0;static rendererOptions={subtasks:!0,state:Object.values(Zs),output:!0,prompt:!0,title:!0,messages:["skip","error","retry","rollback","paused"],messagesToStderr:["error","rollback","retry"],task:["hasRolledBack","isRollingBack","isCompleted","isSkipped","hasFinalized","hasSubtasks","title","hasReset","hasTitle","isPrompt","isPaused","isPending","isSkipped","isStarted","hasFailed","isEnabled","isRetrying","path"]};static rendererTaskOptions;logger;serializer;constructor(t,r){this.tasks=t,this.options=r,this.options={...uWe.rendererOptions,...this.options},this.logger=this.options.logger??new IV({useIcons:!1}),this.serializer=new v0r(this.options)}render(){this.renderer(this.tasks)}end(){}renderer(t){t.forEach(r=>{this.options.subtasks&&r.on(Ss.SUBTASK,n=>{this.renderer(n)}),this.options.state&&r.on(Ss.STATE,n=>{this.logger.toStdout(this.serializer.serialize(Ss.STATE,n,r))}),this.options.output&&r.on(Ss.OUTPUT,n=>{this.logger.toStdout(this.serializer.serialize(Ss.OUTPUT,n,r))}),this.options.prompt&&r.on(Ss.PROMPT,n=>{this.logger.toStdout(this.serializer.serialize(Ss.PROMPT,n,r))}),this.options.title&&r.on(Ss.TITLE,n=>{this.logger.toStdout(this.serializer.serialize(Ss.TITLE,n,r))}),r.on(Ss.MESSAGE,n=>{let i=Object.fromEntries(Object.entries(n).map(([s,a])=>{if(this.options.messages.includes(s))return[s,a]}).filter(Boolean));if(Object.keys(i).length>0){let s=this.serializer.serialize(Ss.MESSAGE,i,r);this.options.messagesToStderr.some(a=>Object.keys(i).includes(a))?this.logger.toStderr(s):this.logger.toStdout(s)}})})}},P0r=class rue{static nonTTY=!0;static rendererOptions={logTitleChange:!1,pausedTimer:{...bue,format:()=>Po.yellowBright}};static rendererTaskOptions;logger;cache={rendererOptions:new Map,rendererTaskOptions:new Map};constructor(t,r){this.tasks=t,this.options=r,this.options={...rue.rendererOptions,...this.options,icon:{...vV.icon,...r?.icon??{}},color:{...vV.color,...r?.color??{}}},this.logger=this.options.logger??new IV({useIcons:!1,toStderr:cWe}),this.logger.options.icon=this.options.icon,this.logger.options.color=this.options.color,this.options.timestamp&&this.logger.options.fields.prefix.unshift(this.options.timestamp)}render(){this.renderer(this.tasks)}end(){}renderer(t){t.forEach(r=>{this.calculate(r),r.once(Ss.CLOSED,()=>{this.reset(r)});let n=this.cache.rendererOptions.get(r.id),i=this.cache.rendererTaskOptions.get(r.id);r.on(Ss.SUBTASK,s=>{this.renderer(s)}),r.on(Ss.STATE,s=>{if(r.hasTitle()){if(s===Zs.STARTED)this.logger.log(Oi.STARTED,r.title);else if(s===Zs.COMPLETED){let a=i.timer;this.logger.log(Oi.COMPLETED,r.title,a&&{suffix:{...a,condition:!!r.message?.duration&&a.condition,args:[r.message.duration]}})}}}),r.on(Ss.OUTPUT,s=>{this.logger.log(Oi.OUTPUT,s)}),r.on(Ss.PROMPT,s=>{let a=BR(s);a&&this.logger.log(Oi.PROMPT,a)}),this.options?.logTitleChange!==!1&&r.on(Ss.TITLE,s=>{this.logger.log(Oi.TITLE,s)}),r.on(Ss.MESSAGE,s=>{if(s?.error)this.logger.log(Oi.FAILED,s.error);else if(s?.skip)this.logger.log(Oi.SKIPPED,s.skip);else if(s?.rollback)this.logger.log(Oi.ROLLBACK,s.rollback);else if(s?.retry)this.logger.log(Oi.RETRY,r.title,{suffix:s.retry.count.toString()});else if(s?.paused){let a=n?.pausedTimer;this.logger.log(Oi.PAUSED,r.title,a&&{suffix:{...a,condition:!!s?.paused&&a.condition,args:[s.paused-Date.now()]}})}})})}calculate(t){if(this.cache.rendererOptions.has(t.id)&&this.cache.rendererTaskOptions.has(t.id))return;let r={...this.options,...t.rendererOptions};this.cache.rendererOptions.set(t.id,r),this.cache.rendererTaskOptions.set(t.id,{...rue.rendererTaskOptions,timer:r.timer,...t.rendererTaskOptions})}reset(t){this.cache.rendererOptions.delete(t.id),this.cache.rendererTaskOptions.delete(t.id)}},hce={default:b0r,simple:E0r,verbose:P0r,test:_0r,silent:x0r};function A0r(e){return process.stdout.isTTY===!0||e.nonTTY===!0}function hV(e){return typeof e=="string"?hce[e]??hce.default:typeof e=="function"?e:hce.default}function w0r(e){if(tN(e?.silentRendererCondition))return{renderer:hV("silent"),selection:DR.SILENT};let t={renderer:hV(e.renderer),options:e.rendererOptions,selection:DR.PRIMARY};return!A0r(t.renderer)||tN(e?.fallbackRendererCondition)?{renderer:hV(e.fallbackRenderer),options:e.fallbackRendererOptions,selection:DR.SECONDARY}:t}function tN(e,...t){return typeof e=="function"?e(...t):e}var O0r=(0,i0r.default)({circles:!0});function FYe(e){return O0r(e)}var N0r=class{concurrency;count;queue;constructor(e){this.concurrency=e.concurrency,this.count=0,this.queue=new Set}add(e){return this.count<this.concurrency?this.run(e):new Promise(t=>{let r=()=>t(this.run(e));this.queue.add(r)})}flush(){for(let e of this.queue){if(this.count>=this.concurrency)break;this.queue.delete(e),e()}}run(e){this.count++;let t=e(),r=()=>{this.count--,this.flush()};return t.then(r,()=>{this.queue.clear()}),t}};function I0r(e){return new Promise(t=>{setTimeout(t,e)})}var D0r=class extends Error{path;ctx;constructor(e,t,r){super(e.message),this.error=e,this.type=t,this.task=r,this.name="ListrError",this.path=r.path,r?.options.collectErrors==="full"&&(this.task=FYe(r),this.ctx=FYe(r.listr.ctx)),this.stack=e?.stack}},BYe=class extends Error{},C0r=class extends Error{},k0r=class{constructor(e){this.task=e}get title(){return this.task.title}set title(e){e=Array.isArray(e)?e:[e],this.task.title$=CR(e.shift(),...e)}get output(){return this.task.output}set output(e){e=Array.isArray(e)?e:[e],this.task.output$=CR(e.shift(),...e)}set promptOutput(e){this.task.promptOutput$=e}newListr(e,t){let r;return typeof e=="function"?r=e(this):r=e,new qR(r,t,this.task)}report(e,t){this.task.options.collectErrors!==!1&&this.task.listr.errors.push(new D0r(e,t,this.task)),this.task.message$={error:e.message??this.task?.title}}skip(e,...t){this.task.state$=Zs.SKIPPED,e&&(this.task.message$={skip:e?CR(e,...t):this.task?.title})}isRetrying(){return this.task.isRetrying()?this.task.retry:{count:0}}prompt(e){return this.task.prompt?this.task.prompt:new e(this.task,this)}stdout(e){return T0r(t=>{e===Ss.PROMPT?this.promptOutput=t:this.output=t})}run(e){return this.task.run(e,this)}},L0r=class extends aWe{},R0r=class extends L0r{id=u0r();state=Zs.WAITING;subtasks;title;initialTitle;output;retry;message={};prompt;parent;enabled;taskFn;closed;constructor(e,t,r,n,i){if(super(),this.listr=e,this.task=t,this.options=r,this.rendererOptions=n,this.rendererTaskOptions=i,t.title){let s=Array.isArray(t?.title)?t.title:[t.title];this.title=CR(s.shift(),...s),this.initialTitle=this.title}this.taskFn=t.task,this.parent=e.parentTask}set state$(e){if(this.state=e,this.emit(Ss.STATE,e),this.hasSubtasks()&&this.hasFailed())for(let t of this.subtasks)t.state===Zs.STARTED&&(t.state$=Zs.FAILED);this.listr.events.emit(Mx.SHOULD_REFRESH_RENDER)}set output$(e){this.output=e,this.emit(Ss.OUTPUT,e),this.listr.events.emit(Mx.SHOULD_REFRESH_RENDER)}set promptOutput$(e){this.emit(Ss.PROMPT,e),BR(e)&&this.listr.events.emit(Mx.SHOULD_REFRESH_RENDER)}set message$(e){this.message={...this.message,...e},this.emit(Ss.MESSAGE,e),this.listr.events.emit(Mx.SHOULD_REFRESH_RENDER)}set title$(e){this.title=e,this.emit(Ss.TITLE,e),this.listr.events.emit(Mx.SHOULD_REFRESH_RENDER)}get path(){return[...this.listr.path,this.initialTitle]}async check(e){return this.state===Zs.WAITING&&(this.enabled=await tN(this.task?.enabled??!0,e),this.emit(Ss.ENABLED,this.enabled),this.listr.events.emit(Mx.SHOULD_REFRESH_RENDER)),this.enabled}hasSubtasks(){return this.subtasks?.length>0}hasFinalized(){return this.isCompleted()||this.hasFailed()||this.isSkipped()||this.hasRolledBack()}isPending(){return this.isStarted()||this.isPrompt()||this.hasReset()}isStarted(){return this.state===Zs.STARTED}isSkipped(){return this.state===Zs.SKIPPED}isCompleted(){return this.state===Zs.COMPLETED}hasFailed(){return this.state===Zs.FAILED}isRollingBack(){return this.state===Zs.ROLLING_BACK}hasRolledBack(){return this.state===Zs.ROLLED_BACK}isRetrying(){return this.state===Zs.RETRY}hasReset(){return this.state===Zs.RETRY||this.state===Zs.ROLLING_BACK}isEnabled(){return this.enabled}hasTitle(){return typeof this?.title=="string"}isPrompt(){return this.state===Zs.PROMPT}isPaused(){return this.state===Zs.PAUSED}isClosed(){return this.closed}async pause(e){let t=this.state;this.state$=Zs.PAUSED,this.message$={paused:Date.now()+e},await I0r(e),this.state$=t,this.message$={paused:null}}async run(e,t){let r=s=>(s instanceof qR?(s.options={...this.options,...s.options},s.rendererClass=hV("silent"),this.subtasks=s.tasks,s.errors=this.listr.errors,this.emit(Ss.SUBTASK,this.subtasks),s=s.run(e)):s instanceof Promise?s=s.then(r):d0r(s)?s=new Promise((a,o)=>{s.on("data",l=>{this.output$=l.toString()}),s.on("error",l=>o(l)),s.on("end",()=>a(null))}):p0r(s)&&(s=new Promise((a,o)=>{s.subscribe({next:l=>{this.output$=l},error:o,complete:a})})),s),n=Date.now();this.state$=Zs.STARTED;let i=await tN(this.task?.skip??!1,e);if(i){typeof i=="string"?this.message$={skip:i}:this.hasTitle()?this.message$={skip:this.title}:this.message$={skip:"Skipped task without a title."},this.state$=Zs.SKIPPED;return}try{let s=typeof this.task?.retry=="number"&&this.task.retry>0?this.task.retry+1:typeof this.task?.retry=="object"&&this.task.retry.tries>0?this.task.retry.tries+1:1,a=typeof this.task.retry=="object"&&this.task.retry.delay;for(let o=1;o<=s;o++)try{await r(this.taskFn(e,t));break}catch(l){if(o!==s)this.retry={count:o,error:l},this.message$={retry:this.retry},this.title$=this.initialTitle,this.output=void 0,t.report(l,PR.WILL_RETRY),this.state$=Zs.RETRY,a&&await this.pause(a);else throw l}(this.isStarted()||this.isRetrying())&&(this.message$={duration:Date.now()-n},this.state$=Zs.COMPLETED)}catch(s){if(this.prompt instanceof C0r&&(s=this.prompt),this.task?.rollback){t.report(s,PR.WILL_ROLLBACK);try{this.state$=Zs.ROLLING_BACK,await this.task.rollback(e,t),this.message$={rollback:this.title},this.state$=Zs.ROLLED_BACK}catch(a){throw this.state$=Zs.FAILED,t.report(a,PR.HAS_FAILED_TO_ROLLBACK),this.close(),a}if(this.listr.options?.exitAfterRollback!==!1)throw this.close(),s}else{if(this.state$=Zs.FAILED,this.listr.options.exitOnError!==!1&&await tN(this.task?.exitOnError,e)!==!1)throw t.report(s,PR.HAS_FAILED),this.close(),s;this.hasSubtasks()||t.report(s,PR.HAS_FAILED_WITHOUT_ERROR)}}finally{this.close()}}close(){this.emit(Ss.CLOSED),this.listr.events.emit(Mx.SHOULD_REFRESH_RENDER),this.complete()}},MYe=class extends aWe{},qR=class{tasks=[];errors=[];ctx;events;path=[];rendererClass;rendererClassOptions;rendererSelection;boundSignalHandler;concurrency;renderer;constructor(e,t,r){this.task=e,this.options=t,this.parentTask=r,this.options={concurrent:!1,renderer:"default",fallbackRenderer:"simple",exitOnError:!0,exitAfterRollback:!0,collectErrors:!1,registerSignalListeners:!0,...this.parentTask?.options??{},...t},this.options.concurrent===!0?this.options.concurrent=1/0:typeof this.options.concurrent!="number"&&(this.options.concurrent=1),this.concurrency=new N0r({concurrency:this.options.concurrent}),r&&(this.path=[...r.listr.path,r.title],this.errors=r.listr.errors),this.parentTask?.listr.events instanceof MYe?this.events=this.parentTask.listr.events:this.events=new MYe,(this.options?.forceTTY||process.env[Zce.FORCE_TTY])&&(process.stdout.isTTY=!0,process.stderr.isTTY=!0),this.options?.forceUnicode&&(process.env[Zce.FORCE_UNICODE]="1");let n=w0r({renderer:this.options.renderer,rendererOptions:this.options.rendererOptions,fallbackRenderer:this.options.fallbackRenderer,fallbackRendererOptions:this.options.fallbackRendererOptions,fallbackRendererCondition:this.options?.fallbackRendererCondition,silentRendererCondition:this.options?.silentRendererCondition});this.rendererClass=n.renderer,this.rendererClassOptions=n.options,this.rendererSelection=n.selection,this.add(e??[]),this.options.registerSignalListeners&&(this.boundSignalHandler=this.signalHandler.bind(this),process.once("SIGINT",this.boundSignalHandler).setMaxListeners(0))}isRoot(){return!this.parentTask}isSubtask(){return!!this.parentTask}add(e){this.tasks.push(...this.generate(e))}async run(e){this.renderer||(this.renderer=new this.rendererClass(this.tasks,this.rendererClassOptions,this.events)),await this.renderer.render(),this.ctx=this.options?.ctx??e??{};try{await Promise.all(this.tasks.map(t=>t.check(this.ctx))),await Promise.all(this.tasks.map(t=>this.concurrency.add(()=>this.runTask(t)))),this.renderer.end(),this.removeSignalHandler()}catch(t){if(this.options.exitOnError!==!1)throw this.renderer.end(t),this.removeSignalHandler(),t}return this.ctx}generate(e){return e=Array.isArray(e)?e:[e],e.map(t=>{let r;return this.rendererSelection===DR.PRIMARY?r=t.rendererOptions:this.rendererSelection===DR.SECONDARY&&(r=t.fallbackRendererOptions),new R0r(this,t,this.options,this.rendererClassOptions,r)})}async runTask(e){if(await e.check(this.ctx))return new k0r(e).run(this.ctx)}signalHandler(){this.tasks?.forEach(async e=>{e.isPending()&&(e.state$=Zs.FAILED)}),this.isRoot()&&(this.renderer?.end(new Error("Interrupted.")),process.exit(127))}removeSignalHandler(){this.boundSignalHandler&&process.removeListener("SIGINT",this.boundSignalHandler)}},j0r=e=>e.reduce(([t,r],n)=>[[...t,...Xe(n.file.alternateFile)?[n]:[]],[...r,...It(n.file.alternateFile)?[n]:[]]],[[],[]]),pWe=async({file:e,fullPath:t,collection:r,filePath:n,token:i,description:s})=>({filename:M0r(n),fullPath:t,data:new Blob([await B0r(e.file)]),collection:r,headers:[...e.mime===void 0?[]:[["Content-Type",e.mime]]],encoding:e.encoding,...Xe(i)&&us(i)&&{token:i},...Xe(s)&&us(s)&&{description:s}}),dWe=async({files:e,uploadFiles:t})=>{let[r,n]=j0r(e);await t({groupFiles:r,step:"alternate"}),await t({groupFiles:n,step:"source"})},V0r=async({uploadFiles:e,collection:t,...r})=>{await $0r({upload:async({files:n,progress:i})=>{await U0r({collection:t,files:n,uploadFiles:e,progress:i})},...r})},$0r=async({files:e,sourceAbsolutePath:t,upload:r,batchSize:n})=>{await dWe({files:e,uploadFiles:async({groupFiles:i,step:s})=>{let a=Math.ceil(i.length/n);for(let o=0;o<i.length;o+=n){let l=i.slice(o,o+n),c=()=>{let g;return{promise:new Promise(S=>g=S),resolve:g}},u=l.map(g=>({...g,...c()})),p=c(),d=c(),f=u.map(({file:g,promise:S})=>({title:`Uploading ${F0r(t,g.file)}`,task:async()=>await S})),m=`[${Math.floor(o/n)+1}/${a}]`,h=s==="alternate"?"\u2728":"\u{1F4E6}",T=new qR([{title:`${h} Initializing ${m}`,task:async()=>await p.promise},{title:`${h} Uploading ${m}`,task:(g,S)=>S.newListr(f,{concurrent:!0})},{title:`${h} Committing ${m}`,task:async()=>await d.promise}],{concurrent:!1}).run();await r({files:l,progress:{onUploadedFileChunks:g=>{u.find(S=>S.paths.fullPath===g)?.resolve?.()},onInitiatedBatch:()=>p.resolve?.(),onCommittedBatch:()=>d.resolve?.()}}),await T}}})},U0r=async({uploadFiles:e,files:t,collection:r,progress:n})=>{let i=await Promise.all(t.map(async({file:s,paths:a})=>await pWe({collection:r,...a,file:s})));await e({files:i,progress:n})},K0r=async({uploadFile:e,collection:t,...r})=>{await Y0r({upload:async({file:n,paths:i})=>{await z0r({collection:t,...i,file:n,uploadFile:e})},...r})},Y0r=async({files:e,sourceAbsolutePath:t,upload:r,batchSize:n})=>{await dWe({files:e,uploadFiles:async({groupFiles:i,step:s})=>{for(let a=0;a<i.length;a+=n){let o=i.slice(a,a+n);await new qR(o.map(({file:l,paths:c})=>({title:`${s==="alternate"?"\u2728":"\u{1F4E6}"} Uploading ${q0r(t,l.file)}`,task:async()=>await r({file:l,paths:c})})),{concurrent:!0}).run()}}})},z0r=async({uploadFile:e,...t})=>{let r=await pWe(t);await e(r)},nue=async({upload:e,files:t,...r})=>{if("uploadFiles"in e){await V0r({uploadFiles:e.uploadFiles,files:t,...r}),jYe({files:t});return}await K0r({uploadFile:e.uploadFile,files:t,...r}),jYe({files:t})},jYe=({files:e})=>{let{count:t,size:r}=e.reduce(({count:n,size:i},{paths:s})=>({count:n+1,size:i+Jgr(s.filePath)}),{count:0,size:0});console.log(`
|
|
1017
1017
|
\u2714 ${t} files uploaded (total: ${UR(r)})`)},fWe=async({deploy:{upload:e,files:t,sourceAbsolutePath:r,collection:n,batchSize:i},proposal:{proposalType:s,autoCommit:a,...o}})=>{let l=async u=>{if("uploadFiles"in e){await nue({files:t,sourceAbsolutePath:r,collection:n,batchSize:i,upload:{uploadFiles:p=>e.uploadFiles({...p,proposalId:u})}});return}await nue({files:t,sourceAbsolutePath:r,collection:n,batchSize:i,upload:{uploadFile:p=>e.uploadFile({...p,proposalId:u})}})},{proposalId:c}=await t0r({...o,autoCommit:a,proposalType:s,executeChanges:l});return a?{result:"deployed",files:t.map(u=>u.file),proposalId:c}:{result:"submitted",files:t.map(u=>u.file),proposalId:c}},mWe=async({config:{predeploy:e}})=>{await FJe(e)},hWe=async({config:{postdeploy:e}})=>{await FJe(e)},yWe=async({params:e,upload:t})=>{let r=await gWe(e);if(r.result==="skipped")return{result:"skipped"};let{files:n,sourceAbsolutePath:i}=r,s={files:SWe({files:n,sourceAbsolutePath:i}),sourceAbsolutePath:i,batchSize:e.uploadBatchSize??uue};return await nue({...s,collection:rS,upload:t}),console.log(`
|
|
1018
1018
|
\u{1F680} Deploy complete!`),{result:"deployed",files:n}},TWe=async({deploy:{params:e,upload:t},proposal:{clearAssets:r,...n}})=>{let i=await gWe(e);if(i.result==="skipped")return{result:"skipped"};let{sourceAbsolutePath:s}=i,a=SWe(i),o=await fWe({deploy:{upload:t,files:a,sourceAbsolutePath:s,collection:rS,batchSize:e.uploadBatchSize??uue},proposal:{...n,proposalType:{AssetsUpgrade:{clear_existing_assets:$r(r)}}}});return o.result==="deployed"&&console.log(`
|
|
1019
|
-
\u{1F680} Deploy complete!`),o},gWe=async({assertMemory:e,...t})=>{let r=Ri("Preparing deploy...").start();try{let{files:n,sourceAbsolutePath:i}=await Hgr(t);return n.length===0?(r.stop(),console.log(""),console.log("\u26A0\uFE0F No file changes detected. Upload skipped."),{result:"skipped"}):(Xe(e)&&(r.text="Asserting memory..."),await e?.(),r.stop(),{result:"to-deploy",files:n,sourceAbsolutePath:i})}catch(n){throw r.stop(),n}},SWe=({files:e,sourceAbsolutePath:t})=>{let r=n=>{let i=n.alternateFile??n.file;return{fullPath:gue({file:i,sourceAbsolutePath:t}),filePath:i}};return e.map(n=>({file:n,paths:r(n)}))},bWe=async({outfileJs:e,outfileRs:t,...r})=>{let n=await X0r(r);if(n.status==="error")return n;let{result:{code:i,...s}}=n,a=await H0r({code:i,outfileRs:t}),o=await G0r({code:i,outfileJs:e});return{status:"success",result:{build:{...s,...o},generate:a}}},X0r=async({infile:e,banner:t})=>{let{metafile:r,errors:n,warnings:i,version:s,outputFiles:a}=await Hhr({infile:e,banner:t}),o=i.map(({text:p})=>p),l=n.map(({text:p})=>p);if(l.length>0)return{status:"error",errors:l,warnings:o};let c=Object.entries(r.outputs);if(c.length===0)return{status:"error",errors:["Unexpected: No metafile resulting from the build was found."]};let u=a?.[0]?.contents;return It(u)?{status:"error",errors:["Unexpected: No script build for the functions."]}:{status:"success",result:{output:c[0],version:s,code:u}}},H0r=async({code:e,outfileRs:t})=>await eKe({code:e,outputFile:t}),G0r=async({code:e,outfileJs:t})=>(await J0r(t,e),{outputPath:W0r(process.cwd(),t)}),Q0r=({sourceAbsolutePath:e,ignore:t})=>{let r=Sue(e).filter(n=>tSr({file:n,ignore:t}));return new Set(r.map(n=>gue({file:n,sourceAbsolutePath:e})))},eSr=({file:e,ignore:t})=>t.some(r=>Au(e,r,{matchBase:!0})),tSr=e=>!eSr(e),rSr=async({config:e,listAssets:t,assertSourceDirExists:r})=>{let{source:n=VR,ignore:i=CJe}=e,s=Z0r(process.cwd(),n);r?.(s);let a=Q0r({sourceAbsolutePath:s,ignore:i});return{files:(await nSr({localPaths:a,listAssets:t})).map(({fullPath:o})=>({fullPath:o}))}},nSr=async({localPaths:e,listAssets:t})=>(await t({})).filter(({fullPath:r})=>!e.has(r)),iSr=async({files:e,pruneFn:t,batchSize:r})=>{let n=Math.ceil(e.length/r);for(let i=0;i<e.length;i+=r){let s=e.slice(i,i+r),a=`[${Math.floor(i/r)+1}/${n}]`;await new qR([{title:`\u{1F5D1}\uFE0F Pruning assets ${a}`,task:async()=>await t({files:s})}],{concurrent:!1}).run()}console.log(`
|
|
1019
|
+
\u{1F680} Deploy complete!`),o},gWe=async({assertMemory:e,...t})=>{let r=Ri("Preparing deploy...").start();try{let{files:n,sourceAbsolutePath:i}=await Hgr(t);return n.length===0?(r.stop(),console.log(""),console.log("\u26A0\uFE0F No file changes detected. Upload skipped."),{result:"skipped"}):(Xe(e)&&(r.text="Asserting memory..."),await e?.(),r.stop(),{result:"to-deploy",files:n,sourceAbsolutePath:i})}catch(n){throw r.stop(),n}},SWe=({files:e,sourceAbsolutePath:t})=>{let r=n=>{let i=n.alternateFile??n.file;return{fullPath:gue({file:i,sourceAbsolutePath:t}),filePath:i}};return e.map(n=>({file:n,paths:r(n)}))},bWe=async({outfileJs:e,outfileRs:t,...r})=>{let n=await X0r(r);if(n.status==="error")return n;let{result:{code:i,...s}}=n,a=await H0r({code:i,outfileRs:t}),o=await G0r({code:i,outfileJs:e});return{status:"success",result:{build:{...s,...o},generate:a}}},X0r=async({infile:e,banner:t})=>{let{metafile:r,errors:n,warnings:i,version:s,outputFiles:a}=await Hhr({infile:e,banner:t}),o=i.map(({text:p})=>p),l=n.map(({text:p})=>p);if(l.length>0)return{status:"error",errors:l,warnings:o};let c=Object.entries(r.outputs);if(c.length===0)return{status:"error",errors:["Unexpected: No metafile resulting from the build was found."]};let u=a?.[0]?.contents;return It(u)?{status:"error",errors:["Unexpected: No script build for the functions."]}:{status:"success",result:{output:c[0],version:s,code:u}}},H0r=async({code:e,outfileRs:t})=>await eKe({code:e,outputFile:t}),G0r=async({code:e,outfileJs:t})=>(await J0r(t,e),{outputPath:W0r(process.cwd(),t)}),Q0r=({sourceAbsolutePath:e,ignore:t})=>{let r=Sue(e).filter(n=>tSr({file:n,ignore:t}));return new Set(r.map(n=>gue({file:n,sourceAbsolutePath:e})))},eSr=({file:e,ignore:t})=>t.some(r=>Au(e,r,{matchBase:!0})),tSr=e=>!eSr(e),rSr=async({config:e,listAssets:t,assertSourceDirExists:r})=>{let{source:n=VR,ignore:i=CJe}=e,s=Z0r(process.cwd(),n);r?.(s);let a=Q0r({sourceAbsolutePath:s,ignore:i});return{files:(await nSr({localPaths:a,listAssets:t})).map(({fullPath:o})=>({fullPath:o}))}},nSr=async({localPaths:e,listAssets:t})=>(await t({})).filter(({fullPath:r})=>!e.has(r)).filter(({fullPath:r})=>!["/.well-known/ic-domains","/.well-known/ii-alternative-origins"].includes(r)),iSr=async({files:e,pruneFn:t,batchSize:r})=>{let n=Math.ceil(e.length/r);for(let i=0;i<e.length;i+=r){let s=e.slice(i,i+r),a=`[${Math.floor(i/r)+1}/${n}]`;await new qR([{title:`\u{1F5D1}\uFE0F Pruning assets ${a}`,task:async()=>await t({files:s})}],{concurrent:!1}).run()}console.log(`
|
|
1020
1020
|
\u2714 ${e.length} stale asset(s) pruned.`)},xWe=async({params:{dryRun:e,batchSize:t,...r},pruneFn:n})=>{let i=await sSr(r);if(i.result==="skipped")return{result:"skipped"};let{files:s}=i;console.log(`
|
|
1021
1021
|
Found ${s.length} stale asset(s):`);for(let{fullPath:a}of s)console.log(` - ${a}`);return console.log(""),e===!0?{result:"simulated",files:s}:(await iSr({files:s,pruneFn:n,batchSize:t??100}),{result:"pruned",files:s})},sSr=async e=>{let t=Ri("Preparing prune...").start();try{let{files:r}=await rSr(e);return t.stop(),r.length===0?(console.log(""),console.log("\u{1F44D} No stale assets found. Satellite is already clean."),{result:"skipped"}):{result:"to-prune",files:r}}catch(r){throw t.stop(),r}},EWe=async({publish:{assertMemory:e,filePath:t,fullPath:r,upload:n,...i},proposal:{version:s,...a}})=>{await e?.();let o=await fWe({deploy:{...i,upload:n,files:[{file:{file:t},paths:{filePath:t,fullPath:r}}],collection:pue,batchSize:uue},proposal:{...a,proposalType:{SegmentsDeployment:{satellite_version:$r(s),orbiter:$r(),mission_control_version:$r()}}}});return o.result==="deployed"&&console.log(`
|
|
1022
1022
|
\u{1F4E1} Satellite WASM published to CDN.`),o},Ii=({args:e,options:t})=>e?.find(r=>t.includes(r))!==void 0,In=({args:e,option:t})=>{let r=(e??[]).findIndex(n=>n===t);if(r!==-1)return e?.[r+1]},xue=async e=>await new Promise((t,r)=>{((typeof e=="string"?URL.parse(e)?.protocol:e.protocol)==="http:"?aSr:oSr)(e,async n=>{Xe(n.statusCode)&&Xe(n.headers.location)&&[301,302].includes(n.statusCode)&&await xue(n.headers.location).then(t,r);let i=[];n.on("data",s=>i.push(s)),n.on("end",()=>{t(Buffer.concat(i))}),n.on("error",r)})}),vWe=async({packageJsonPath:e})=>{let t=await lSr(e,"utf-8"),{dependencies:r,version:n,juno:i,name:s}=JSON.parse(t);return{name:s,version:n,dependencies:r,juno:i}},Ul=(e,t)=>{(It(e)||e==="")&&(Xe(t)&&console.error(t),process.exit(1))};var zZ=or(cr(),1);function AWe(e){return e!==null&&typeof e=="object"}var KR=class e{static from(t){if(typeof t=="string"){let r=Du(t);return this.fromRaw(r)}else if(AWe(t)){let r=t;if(AWe(r)&&Object.hasOwnProperty.call(r,"__derEncodedPublicKey__"))return this.fromDer(r);if(ArrayBuffer.isView(r)){let n=r;return this.fromRaw(_T(n.buffer))}else{if(r instanceof ArrayBuffer)return this.fromRaw(_T(r));if("rawKey"in r&&r.rawKey instanceof Uint8Array)return this.fromRaw(r.rawKey);if("derKey"in r)return this.fromDer(r.derKey);if("toDer"in r)return this.fromDer(r.toDer())}}throw new Error("Cannot construct Ed25519PublicKey from the provided key.")}static fromRaw(t){return new e(t)}static fromDer(t){return new e(this.derDecode(t))}static{this.RAW_KEY_LENGTH=32}static derEncode(t){let r=Dj(t,Mw);return r.__derEncodedPublicKey__=void 0,r}static derDecode(t){let r=Cj(t,Mw);if(r.length!==this.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");return r}#e;get rawKey(){return this.#e}#t;get derKey(){return this.#t}constructor(t){if(t.byteLength!==e.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");this.#e=t,this.#t=e.derEncode(t)}toDer(){return this.derKey}toRaw(){return this.rawKey}},kp=class e extends Wb{static generate(t){if(t&&t.length!==32)throw new Error("Ed25519 Seed needs to be 32 bytes long.");t||(t=cd.utils.randomPrivateKey()),R8e(t,new Uint8Array(new Array(32).fill(0)))&&console.warn("Seed is all zeros. This is not a secure seed. Please provide a seed with sufficient entropy if this is a production environment.");let r=new Uint8Array(32);for(let i=0;i<32;i++)r[i]=t[i];let n=cd.getPublicKey(r);return e.fromKeyPair(n,r)}static fromParsedJson(t){let[r,n]=t;return new e(KR.fromDer(Du(r)),Du(n))}static fromJSON(t){let r=JSON.parse(t);if(Array.isArray(r)){if(typeof r[0]=="string"&&typeof r[1]=="string")return this.fromParsedJson([r[0],r[1]]);throw new Error("Deserialization error: JSON must have at least 2 items.")}throw new Error(`Deserialization error: Invalid JSON type for string: ${JSON.stringify(t)}`)}static fromKeyPair(t,r){return new e(KR.fromRaw(t),r)}static fromSecretKey(t){let r=cd.getPublicKey(t);return e.fromKeyPair(r,t)}#e;#t;constructor(t,r){super(),this.#e=KR.from(t),this.#t=r}toJSON(){return[os(this.#e.toDer()),os(this.#t)]}getKeyPair(){return{secretKey:this.#t,publicKey:this.#e}}getPublicKey(){return this.#e}async sign(t){let r=cd.sign(t,this.#t.slice(0,32));return Object.defineProperty(r,"__signature__",{enumerable:!1,value:void 0}),r}static verify(t,r,n){let[i,s,a]=[t,r,n].map(o=>(typeof o=="string"&&(o=Du(o)),_T(o)));return cd.verify(i,s,a)}};var Eue=class e extends Error{constructor(t){super(t),this.message=t,Object.setPrototypeOf(this,e.prototype)}};function wWe(e){if(typeof global<"u"&&global.crypto&&global.crypto.subtle)return global.crypto.subtle;if(e)return e;if(typeof crypto<"u"&&crypto.subtle)return crypto.subtle;throw new Eue("Global crypto was not available and none was provided. Please inlcude a SubtleCrypto implementation. See https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto")}var oN=class e extends Wb{static async generate(t){let{extractable:r=!1,keyUsages:n=["sign","verify"],subtleCrypto:i}=t??{},s=wWe(i),a=await s.generateKey({name:"ECDSA",namedCurve:"P-256"},r,n),o=_T(await s.exportKey("spki",a.publicKey));return Object.assign(o,{__derEncodedPublicKey__:void 0}),new this(a,o,s)}static async fromKeyPair(t,r){let n=wWe(r),i=_T(await n.exportKey("spki",t.publicKey));return Object.assign(i,{__derEncodedPublicKey__:void 0}),new e(t,i,n)}constructor(t,r,n){super(),this._keyPair=t,this._derKey=r,this._subtleCrypto=n}getKeyPair(){return this._keyPair}getPublicKey(){let t=this._derKey,r=Object.create(this._keyPair.publicKey);return r.toDer=function(){return t},r}async sign(t){let r={name:"ECDSA",hash:{name:"SHA-256"}},n=_T(await this._subtleCrypto.sign(r,this._keyPair.privateKey,t));return Object.assign(n,{__signature__:void 0}),n}};var DV=class{#e;get rawKey(){return this.#e.rawKey}get derKey(){return this.#e.derKey}toDer(){return this.#e.toDer()}getPublicKey(){return this.#e}getPrincipal(){if(!this.#e.rawKey)throw new Error("Cannot get principal from a public key without a raw key.");return zr.fromUint8Array(new Uint8Array(this.#e.rawKey))}transformRequest(){return Promise.reject("Not implemented. You are attempting to use a partial identity to sign calls, but this identity only has access to the public key.To sign calls, use a DelegationIdentity instead.")}constructor(t){this.#e=t}};function CV(e){return e instanceof Uint8Array?os(e):os(new Uint8Array(e))}function vue(e){if(typeof e!="string"||e.length<64)throw new Error("Invalid public key.");return Du(e)}var lN=class{constructor(t,r,n){this.pubkey=t,this.expiration=r,this.targets=n}toCborValue(){return{pubkey:this.pubkey,expiration:this.expiration,...this.targets&&{targets:this.targets}}}toJSON(){return{expiration:this.expiration.toString(16),pubkey:CV(this.pubkey),...this.targets&&{targets:this.targets.map(t=>t.toHex())}}}};async function fSr(e,t,r,n){let i=new lN(t.toDer(),BigInt(+r)*BigInt(1e6),n),s=new Uint8Array([...gQ,...new Uint8Array(w0({...i}))]),a=await e.sign(s);return{delegation:i,signature:a}}var YR=class e{static async create(t,r,n=new Date(Date.now()+900*1e3),i={}){let s=await fSr(t,r,n,i.targets);return new e([...i.previous?.delegations||[],s],i.previous?.publicKey||t.getPublicKey().toDer())}static fromJSON(t){let{publicKey:r,delegations:n}=typeof t=="string"?JSON.parse(t):t;if(!Array.isArray(n))throw new Error("Invalid delegations.");let i=n.map(s=>{let{delegation:a,signature:o}=s,{pubkey:l,expiration:c,targets:u}=a;if(u!==void 0&&!Array.isArray(u))throw new Error("Invalid targets.");return{delegation:new lN(vue(l),BigInt("0x"+c),u&&u.map(p=>{if(typeof p!="string")throw new Error("Invalid target.");return zr.fromHex(p)})),signature:vue(o)}});return new this(i,vue(r))}static fromDelegations(t,r){return new this(t,r)}constructor(t,r){this.delegations=t,this.publicKey=r}toJSON(){return{delegations:this.delegations.map(t=>{let{delegation:r,signature:n}=t,{targets:i}=r;return{delegation:{expiration:r.expiration.toString(16),pubkey:CV(r.pubkey),...i&&{targets:i.map(s=>s.toHex())}},signature:CV(n)}}),publicKey:CV(this.publicKey)}}},zR=class extends Wb{static fromDelegation(t,r){return new this(t,r)}constructor(t,r){super(),this._inner=t,this._delegation=r}getDelegation(){return this._delegation}getPublicKey(){return{derKey:this._delegation.publicKey,toDer:()=>this._delegation.publicKey}}sign(t){return this._inner.sign(t)}async transformRequest(t){let{body:r,...n}=t,i=await w0(r);return{...n,body:{content:r,sender_sig:await this.sign(new Uint8Array([...ik,...new Uint8Array(i)])),sender_delegation:this._delegation.delegations,sender_pubkey:this._delegation.publicKey}}}},JR=class e extends DV{#e;get delegation(){return this.#e}constructor(t,r){super(t),this.#e=r}static fromDelegation(t,r){return new e(t,r)}};function _ue(e,t){for(let{delegation:i}of e.delegations)if(+new Date(Number(i.expiration/BigInt(1e6)))<=+Date.now())return!1;let r=[],n=t?.scope;n&&(Array.isArray(n)?r.push(...n.map(i=>typeof i=="string"?zr.fromText(i):i)):r.push(typeof n=="string"?zr.fromText(n):n));for(let i of r){let s=i.toText();for(let{delegation:a}of e.delegations){if(a.targets===void 0)continue;let o=!0;for(let l of a.targets)if(l.toText()===s){o=!1;break}if(o)return!1}}return!0}var cC=or(cr(),1),J4t=or(eh(),1);var tZe=()=>{let[e,...t]=process.argv.slice(2),r=In({args:t,option:"-m"})??In({args:t,option:"--mode"}),n=In({args:t,option:"-p"})??In({args:t,option:"--profile"}),s=In({args:t,option:"--container-url"})??(r==="development"?"http://127.0.0.1:5987":void 0),a=process.env.CI==="true";return{profile:n,mode:r??"production",containerUrl:s,console:fEr({args:t,mode:r}),config:mEr({mode:r,profile:n}),ci:a}},fEr=({args:e,mode:t})=>{let n=In({args:e,option:"--console-url"})??(t==="development"?"http://localhost:5866":"https://console.juno.build");return{urls:{root:n,satellite:`${n}/satellite/?s=`,auth:`${n}/cli`}}},mEr=({mode:e,profile:t})=>{let r=us(e)&&(e!=="production"||us(t))?`-${e}`:"",i=`juno${us(t)?`-${t}`:""}${r}`;return{projectName:i,projectSettingsName:`${i}-cli-settings`,projectStateName:`${i}-cli-state`}};var Bi=tZe(),fN=Bi.mode==="development";var rG=or(cr(),1);var pZe=e=>n1(t=>e.implement(t)),HV="abcdefghijklmnopqrstuvwxyz234567",hN=Object.create(null);for(let e=0;e<HV.length;e++)hN[HV[e]]=e;hN[0]=hN.o;hN[1]=hN.i;function hEr(e){let t=0,r=0,n="";function i(s){return t<0?r|=s>>-t:r=s<<t&248,t>3?(t-=8,1):(t<4&&(n+=HV[r>>3],t+=5),0)}for(let s=0;s<e.length;)s+=i(e[s]);return n+(t<0?HV[r>>3]:"")}function yEr(e){let t=0,r=0,n=new Uint8Array(e.length*4/3|0),i=0;function s(a){let o=hN[a.toLowerCase()];if(o===void 0)throw new Error(`Invalid character: ${JSON.stringify(a)}`);o<<=3,r|=o>>>t,t+=5,t>=8&&(n[i++]=r,t-=8,t>0?r=o<<5-t&255:r=0)}for(let a of e)s(a);return n.slice(0,i)}var TEr=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function gEr(e){let t=-1;for(let r=0;r<e.length;r++){let n=(e[r]^t)&255;t=TEr[n]^t>>>8}return(t^-1)>>>0}function SEr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function GV(e,...t){if(!SEr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function rZe(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function bEr(e,t){GV(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function Mpe(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Rpe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function tg(e,t){return e<<32-t|e>>>t}var dZe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",xEr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function EEr(e){if(GV(e),dZe)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=xEr[e[r]];return t}var uS={_0:48,_9:57,A:65,F:70,a:97,f:102};function nZe(e){if(e>=uS._0&&e<=uS._9)return e-uS._0;if(e>=uS.A&&e<=uS.F)return e-(uS.A-10);if(e>=uS.a&&e<=uS.f)return e-(uS.a-10)}function vEr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(dZe)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,s=0;i<r;i++,s+=2){let a=nZe(e.charCodeAt(s)),o=nZe(e.charCodeAt(s+1));if(a===void 0||o===void 0){let l=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}n[i]=a*16+o}return n}function _Er(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function fZe(e){return typeof e=="string"&&(e=_Er(e)),GV(e),e}var PEr=class{};function AEr(e){let t=n=>e().update(fZe(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function wEr(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),a=Number(r>>i&s),o=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,a,n),e.setUint32(t+c,o,n)}function OEr(e,t,r){return e&t^~e&r}function NEr(e,t,r){return e&t^e&r^t&r}var IEr=class extends PEr{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=Rpe(this.buffer)}update(e){rZe(this),e=fZe(e),GV(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let s=0;s<i;){let a=Math.min(n-this.pos,i-s);if(a===n){let o=Rpe(e);for(;n<=i-s;s+=n)this.process(o,s);continue}r.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){rZe(this),bEr(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:s}=this;t[s++]=128,Mpe(this.buffer.subarray(s)),this.padOffset>n-s&&(this.process(r,0),s=0);for(let u=s;u<n;u++)t[u]=0;wEr(r,n-8,BigInt(this.length*8),i),this.process(r,0);let a=Rpe(e),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=o/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,c[u],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:a}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=a,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},Kx=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Yx=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),DEr=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),zx=new Uint32Array(64),CEr=class extends IEr{constructor(e=32){super(64,e,8,!1),this.A=Kx[0]|0,this.B=Kx[1]|0,this.C=Kx[2]|0,this.D=Kx[3]|0,this.E=Kx[4]|0,this.F=Kx[5]|0,this.G=Kx[6]|0,this.H=Kx[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:a,H:o}=this;return[e,t,r,n,i,s,a,o]}set(e,t,r,n,i,s,a,o){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=s|0,this.G=a|0,this.H=o|0}process(e,t){for(let u=0;u<16;u++,t+=4)zx[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){let p=zx[u-15],d=zx[u-2],f=tg(p,7)^tg(p,18)^p>>>3,m=tg(d,17)^tg(d,19)^d>>>10;zx[u]=m+zx[u-7]+f+zx[u-16]|0}let{A:r,B:n,C:i,D:s,E:a,F:o,G:l,H:c}=this;for(let u=0;u<64;u++){let p=tg(a,6)^tg(a,11)^tg(a,25),d=c+p+OEr(a,o,l)+DEr[u]+zx[u]|0,f=(tg(r,2)^tg(r,13)^tg(r,22))+NEr(r,n,i)|0;c=l,l=o,o=a,a=s+d|0,s=i,i=n,n=r,r=d+f|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,o=o+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,s,a,o,l,c)}roundClean(){Mpe(zx)}destroy(){this.set(0,0,0,0,0,0,0,0),Mpe(this.buffer)}},kEr=class extends CEr{constructor(){super(28),this.A=Yx[0]|0,this.B=Yx[1]|0,this.C=Yx[2]|0,this.D=Yx[3]|0,this.E=Yx[4]|0,this.F=Yx[5]|0,this.G=Yx[6]|0,this.H=Yx[7]|0}},LEr=AEr(()=>new kEr),XV="__principal__",REr=2,iZe=4,FEr="aaaaa-aa",sZe=class mN{static anonymous(){return new this(new Uint8Array([iZe]))}static managementCanister(){return this.fromText(FEr)}static selfAuthenticating(t){let r=LEr(t);return new this(new Uint8Array([...r,REr]))}static from(t){if(typeof t=="string")return mN.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new mN(t);if(mN.isPrincipal(t))return new mN(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(vEr(t))}static fromText(t){let r=t;if(t.includes(XV)){let a=JSON.parse(t);XV in a&&(r=a[XV])}let n=r.toLowerCase().replace(/-/g,""),i=yEr(n);i=i.slice(4,i.length);let s=new this(i);if(s.toText()!==r)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${r}" may not be a valid Principal ID).`);return s}static fromUint8Array(t){return new this(t)}static isPrincipal(t){return t instanceof mN||typeof t=="object"&&t!==null&&"_isPrincipal"in t&&t._isPrincipal===!0&&"_arr"in t&&t._arr instanceof Uint8Array}constructor(t){this._arr=t,this._isPrincipal=!0}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===iZe}toUint8Array(){return this._arr}toHex(){return EEr(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,gEr(this._arr));let r=new Uint8Array(t),n=new Uint8Array([...r,...this._arr]),i=hEr(n).match(/.{1,5}/g);if(!i)throw new Error;return i.join("-")}toString(){return this.toText()}toJSON(){return{[XV]:this.toText()}}compareTo(t){for(let r=0;r<Math.min(this._arr.length,t._arr.length);r++){if(this._arr[r]<t._arr[r])return"lt";if(this._arr[r]>t._arr[r])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let r=this.compareTo(t);return r=="lt"||r=="eq"}gtEq(t){let r=this.compareTo(t);return r=="gt"||r=="eq"}},Vpe=wi().refine(e=>Ey.safeParse(e).success,{message:"Invalid textual representation of a Principal."}),jpe=Td().transform((e,t)=>sZe.isPrincipal(e)?sZe.from(e):(t.issues.push({code:"custom",message:"Invalid Principal",input:e}),cO)),BEr=Td().refine(e=>e!=null&&typeof e=="object"&&"transformRequest"in e&&typeof e.transformRequest=="function"&&"getPrincipal"in e&&typeof e.getPrincipal=="function"&&jpe.safeParse(e.getPrincipal()).success,{message:"Invalid Identity"}),mZe=di({satelliteId:jpe,orbiterId:jpe.optional(),identity:BEr,container:wi().optional()}),MEr=r1({input:Nf([mZe]),output:oR(IO()).or(IO())}),ZV=di({run:pZe(MEr)}),jEr=r1({input:Nf([mZe]),output:ZV}),hZe=Fo([ZV,pZe(jEr)]);var QV=Fo([Gm("production"),wi()]),VEr=ds({mode:QV}),vAa=VEr.extend({profile:wi().optional()});var yZe=di({url:$T()}),$Er=di({derivationOrigin:$T().optional(),externalAlternativeOrigins:Da($T()).optional()}),TZe=di({allowedTargets:Da(Ey).nullable().optional(),sessionDuration:Ps().max(30n*24n*60n*60n*1000000000n,"The maximal length of a defined session duration - maxTimeToLive - cannot exceed 30 days").optional()}),UEr=di({clientId:wi().trim().regex(/^[0-9]+-[a-z0-9]+\.apps\.googleusercontent\.com$/,"Invalid Google client ID format").max(128,"Google clientId too long"),delegation:TZe.optional()}),qEr=di({clientId:wi().trim().min(1,"GitHub clientId cannot be empty").max(128,"GitHub clientId too long"),delegation:TZe.optional()}),KEr=di({allowedCallers:Da(Ey)}),gZe=di({internetIdentity:$Er.optional(),google:UEr.optional(),github:qEr.optional(),rules:KEr.optional(),version:Ps().optional()}),SZe=ds({heap:Ps().optional(),stable:Ps().optional()}).strict(),$pe=wi(),YEr=ds({source:$pe,headers:Da(Nf([wi(),wi()]))}).strict(),zEr=ds({source:$pe,destination:wi()}).strict(),JEr=ds({source:$pe,location:wi(),code:Fo([Gm(301),Gm(302)])}).strict(),bZe=ds({headers:Da(YEr).optional(),rewrites:Da(zEr).optional(),redirects:Da(JEr).optional(),iframe:Go(["deny","same-origin","allow-any"]).optional(),rawAccess:vu().optional(),maxMemorySize:SZe.optional(),version:Ps().optional()}),WEr=Go(["identity","gzip","compress","deflate","br"]),aZe=di({pattern:wi().optional(),mode:Go(["both","replace"]).optional(),algorithm:Go(["gzip","brotli"]).optional()}),XEr=di({source:wi().optional(),ignore:Da(wi()).optional(),precompress:Fo([aZe,Da(aZe),Gm(!1)]).optional(),encoding:Da(Nf([wi(),WEr])).optional(),predeploy:Da(wi()).optional(),postdeploy:Da(wi()).optional()}),HEr=ds({id:Ey}),GEr=ds({ids:Hm(QV,Vpe)}),oZe=ds({...XEr.shape,storage:bZe.optional(),authentication:gZe.optional(),api:yZe.optional()}),AAa=Fo([ds({...HEr.shape,...oZe.shape}).strict(),ds({...GEr.shape,...oZe.shape}).strict()]),ZEr=Hm(wi(),wi()),e$=ds({name:wi(),version:wi(),dependencies:ZEr.optional()}),Sd="@junobuild/satellite";var yN="@junobuild/mission-control",TN="@junobuild/orbiter";var QEr=di({heapMemory:Fo([Ps(),vu()]).optional()}),lZe=Go(["public","private","managed","controllers"]),evr=Go(["heap","stable"]),wAa=Go(["db","storage"]),xZe=di({collection:wi(),read:lZe,write:lZe,memory:evr,createdAt:Ps().optional(),updatedAt:Ps().optional(),version:Ps().optional(),maxSize:Ps().optional(),maxChangesPerUser:Ip().optional(),maxCapacity:Ip().optional(),mutablePermissions:vu().optional().default(!0),maxTokens:Ps().optional()}),tvr=xZe.omit({createdAt:!0,updatedAt:!0,maxSize:!0}),rvr=xZe.omit({createdAt:!0,updatedAt:!0,maxCapacity:!0}),nvr=di({datastore:Da(tvr).optional(),storage:Da(rvr).optional()}),ivr=di({maxMemorySize:SZe.optional(),version:Ps().optional()}),EZe={registry:!1,cmc:!0,icp:!0,cycles:!0,nns:!0,sns:!1,internet_identity:!0,nns_dapp:!1},svr={...EZe,cycles:!1,cmc:!1,nns:!1},avr=["icp"],ovr=["icp","nns"],lvr=["cmc","icp","nns"],cvr=["cmc","icp","nns","sns","internet_identity"],uvr=(e,t)=>{let r={..."satellite"in e?svr:EZe,...e.network?.services??{}},n=({requiredServices:i,key:s})=>{i.find(a=>r[a]===!1)!==void 0&&t.addIssue({code:"custom",path:["network","services",s],message:`${s} requires: ${i.join(", ")}`})};r.nns_dapp&&n({requiredServices:cvr,key:"nns_dapp"}),r.cmc&&n({requiredServices:ovr,key:"cmc"}),r.cycles&&n({requiredServices:lvr,key:"cycles"}),r.nns&&n({requiredServices:avr,key:"nns"})},pvr=(e,t)=>{e.network!==void 0&&e.network.services!==void 0&&uvr(e,t)},Upe=di({server:Ip().optional(),admin:Ip().optional(),timeoutInSeconds:Ip().int().positive().optional()}),dvr=di({console:Ip().optional()}),fvr=di({ports:Upe.extend(dvr.shape).optional()}),mvr=di({ports:Upe.optional()}),hvr=di({ports:Upe.optional()}),cZe=wi().min(1),Fpe=di({type:Go(["docker","podman"]),image:wi().optional(),name:wi().optional(),volume:wi().optional(),target:wi().optional(),platform:Go(["linux/amd64","linux/arm64"]).optional(),extraHosts:Da(Nf([cZe,Fo([YL(),JL(),Gm("host-gateway"),cZe])])).min(1).optional()}),yvr=di({registry:vu().optional(),cmc:vu().optional(),icp:vu().optional(),cycles:vu().optional(),nns:vu().optional(),sns:vu().optional(),internet_identity:vu().optional(),nns_dapp:vu().optional()}),Bpe=di({services:yvr}),qpe=Fo([di({runner:Fpe.optional(),network:Bpe.optional(),skylab:fvr}),di({runner:Fpe.optional(),network:Bpe.optional(),console:mvr}),di({runner:Fpe.optional(),network:Bpe.optional(),satellite:hvr})]).superRefine(pvr),Tvr=Go(["controllers","public"]),gvr=di({freezingThreshold:Ps().optional(),reservedCyclesLimit:Ps().optional(),logVisibility:Tvr.optional(),heapMemoryLimit:Ps().optional(),memoryAllocation:Ps().optional(),computeAllocation:Ps().optional()}),Svr=ds({id:Ey}),bvr=ds({ids:Hm(QV,Vpe)}),xvr=Fo([Svr.strict(),bvr.strict()]),Evr=Go(["Write","Submit"]),vvr=di({scope:Evr.optional(),timeToLive:Ps().max(60n*60n*1000000000n,"The maximal length of a defined session duration - maxTimeToLive - cannot exceed 1 hour").optional()}),_vr=di({owner:wi().trim().min(1,"Repository owner cannot be empty").max(256,"Repository owner too long"),name:wi().trim().min(1,"Repository name cannot be empty").max(256,"Repository name too long"),refs:Da(wi().trim().min(1)).optional()}),Pvr=di({repositories:Da(_vr).min(1,"At least one repository required").refine(e=>{let t=e.map(r=>`${r.owner}/${r.name}`);return t.length===new Set(t).size},{message:"Duplicate repositories are not allowed"}),accessKeys:vvr.optional()}),Avr=di({github:Pvr.optional(),version:Ps().optional()}),wvr=ds({id:Ey}),Ovr=ds({ids:Hm(QV,Vpe)}),uZe=ds({storage:bZe.optional(),datastore:ivr.optional(),authentication:gZe.optional(),automation:Avr.optional(),assertions:QEr.optional(),settings:gvr.optional(),collections:nvr.optional()}),Nvr=Fo([ds({...wvr.shape,...uZe.shape}).strict(),ds({...Ovr.shape,...uZe.shape}).strict()]),IAa=di({satellite:Nvr,orbiter:xvr.optional(),emulator:qpe.optional(),api:yZe.optional()});var y2t=or(cr(),1);import{join as Mu}from"node:path";var Jx="satellite",Kpe="sputnik",vZe=Mu(process.cwd(),"src"),Yc=Mu(vZe,Jx),Wx=Mu(vZe,"declarations",Jx),s4="Cargo.toml",t$="index.ts",r$="index.mjs",Ype=Mu(Yc,s4),n$=Mu(Yc,"index.ts"),i$=Mu(Yc,"index.mjs"),zpe="../templates/eject",Jpe=Mu(zpe,"rust"),gN=Mu(Jpe,"src",Jx),Wpe=Mu(zpe,"typescript"),_Ze=Mu(zpe,"javascript"),Xpe="1.70.0",SN="0.8.5",Hpe="24.0.0",s$=Mu(process.cwd(),"target"),a4=Mu(s$,"deploy"),o4=Mu(s$,"juno.package.json"),a$=Mu(process.cwd(),"package.json"),Gpe="sputnik.index.mjs",Ivr="sputnik_index.rs",o$=Mu(a4,Gpe),PZe=Mu(a4,Ivr),Dvr="/juno/src/sputnik",AZe=Mu(Dvr,s4),Zpe="satellite.wasm",wu=Mu(a4,Zpe);var wZe="jx5yt-yyaaa-aaaal-abzbq-cai",pS={ports:{server:5987,admin:5999,console:5866}};var Xx=async()=>await vWe({packageJsonPath:a$});var HIt=or(pu(),1),GIt=or(r4e(),1),ZIt=or(i4e(),1);import{createRequire as NVs}from"module";import{existsSync as P3}from"node:fs";import{readFile as IVs}from"node:fs/promises";import{extname as DVs,join as I4e}from"node:path";import{join as C4e}from"node:path";import{existsSync as JIt,readFileSync as RVs}from"node:fs";import{access as FVs,lstat as BVs}from"node:fs/promises";import{join as WIt}from"node:path";var CD=NVs(import.meta.url),_3=(e=>typeof CD<"u"?CD:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof CD<"u"?CD:t)[r]}):e)(function(e){if(typeof CD<"u")return CD.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),D4e=e=>C4e(process.cwd(),`${e}.ts`),CVs=e=>C4e(process.cwd(),`${e}.js`),XIt=e=>C4e(process.cwd(),`${e}.mjs`),kVs=({id:e,extension:t})=>{delete _3.cache[e];let r=_3("module"),n=r._load;try{return _3.extensions[t]=(i,s)=>{let a=(0,HIt.transformFileSync)(s,{presets:[ZIt.default],plugins:[GIt.default]}).code;i._compile(a,s)},r._load=function(i){return i==="@junobuild/config"?{defineConfig:s=>s,defineConsoleConfig:s=>s}:n.apply(this,arguments)},_3(e)}finally{_3.extensions[t]=void 0,r._load=n}},QIt=({filename:e})=>{let t=D4e(e);if(P3(t))return{configPath:t,configType:"ts"};let r=CVs(e);if(P3(r))return{configPath:r,configType:"js"};let n=XIt(e);if(P3(n))return{configPath:n,configType:"js"};let i=I4e(process.cwd(),`${e}.cjs`);if(P3(i))return{configPath:i,configType:"js"};let s=I4e(process.cwd(),`${e.replace(".config","")}.json`);return P3(s)?{configPath:s,configType:"json"}:{configPath:I4e(process.cwd(),`${e}.json`),configType:"json"}},LVs=async({config:e,...t})=>{let{configPath:r,configType:n}=QIt({...t});switch(n){case"ts":case"js":{let{default:i}=kVs({id:r,extension:DVs(r)});return e(i)}default:{let i=await IVs(r);return JSON.parse(i.toString("utf-8"))}}};var e2t=async e=>{try{let{configPath:t}=k4e(e);return await FVs(t),(await BVs(t)).isFile()}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}},k4e=QIt,t2t=({filename:e})=>{let t=WIt(process.cwd(),"tsconfig.json");if(JIt(t))return{configPath:D4e(e),configType:"ts"};try{let r=WIt(process.cwd(),"package.json");if(JIt(r)){let n=JSON.parse(RVs(r,"utf8"));if("typescript"in(n.dependencies??{})||"typescript"in(n.devDependencies??{}))return{configPath:D4e(e),configType:"ts"};if(n.type==="module")return{configPath:XIt(e),configType:"js"}}}catch{}},r2t=async e=>await LVs(e);import{writeFile as zX}from"node:fs/promises";var L4e="http://localhost:{port}",CA="juno.config",UX="satellite",qX="mission_control",KX="orbiter";var YX="https://cdn.juno.build",n2t="https://api.github.com/repos/junobuild/cli",i2t="https://api.github.com/repos/junobuild/juno-docker",s2t=["535yc-uxytb-gfk7h-tny7p-vjkoe-i4krp-3qmcl-uqfgr-cpgej-yqtjq-rqe"];var R4e="../templates/init",F4e="juno.skylab.config",a2t="juno.predeploy.config",B4e="juno.skylab.predeploy.config",o2t="juno.runner.config",l2t="juno.runner.predeploy.config";var kD=or(cr(),1);import{existsSync as p2t,lstatSync as UVs}from"node:fs";import{copyFile as qVs,readFile as KVs}from"node:fs/promises";import{dirname as YVs,join as j4e,relative as zVs}from"node:path";import{fileURLToPath as JVs}from"node:url";var u2t=or(eh(),1);var M4e=()=>{let e=process.env.JUNO_TOKEN;if(e!==void 0)try{let{token:t}=JSON.parse(atob(e));return t}catch(t){throw new Error("Cannot parse token provided as an environment variable.",{cause:t})}},MVs=()=>M4e()!==void 0,Tu=()=>{if(MVs())return!0;let[e,...t]=process.argv.slice(2);return Ii({args:t,options:["--headless"]})},c2t=()=>!Tu();var ep=`
|
|
@@ -1046,7 +1046,7 @@ Done. The ${Mc(t)} ${(0,Dm.green)(r)} has been configured for your terminal. \u2
|
|
|
1046
1046
|
${(0,ko.yellow)("--source-path")} Optional path to the TypeScript or JavaScript entry file.`,KM=`${dQs}
|
|
1047
1047
|
${fQs}`,m3e=`${(0,ko.yellow)("--container-url")} Override a custom container URL. If not provided, defaults to production or the local container in development mode.`,xo=`${KM}
|
|
1048
1048
|
${m3e}
|
|
1049
|
-
${(0,ko.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,vG=`The option ${(0,ko.yellow)("--keep-staged")} only applies when ${(0,ko.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var Nn=e=>Ii({args:e,options:["-d","--doc"]})?"doc":"cli";var mc=or(cr(),1);var Kv="0.14.
|
|
1049
|
+
${(0,ko.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,vG=`The option ${(0,ko.yellow)("--keep-staged")} only applies when ${(0,ko.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var Nn=e=>Ii({args:e,options:["-d","--doc"]})?"doc":"cli";var mc=or(cr(),1);var Kv="0.14.3";var hQs=` __ __ __ __ _ ____
|
|
1050
1050
|
__) || | || \\| |/ \\
|
|
1051
1051
|
\\___/ \\___/ |_|\\__|\\____/`,wn=`${hQs} CLI ${(0,mc.grey)(`v${Kv}`)}`,G4t=`Juno CLI ${(0,mc.grey)(`v${Kv}`)}`,YM=`
|
|
1052
1052
|
${wn}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junobuild/cli",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.3",
|
|
4
4
|
"description": "The Juno command-line interface",
|
|
5
5
|
"author": "David Dal Busco (https://daviddalbusco.com)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@icp-sdk/core": "^5.0.0",
|
|
35
35
|
"@junobuild/admin": "^4.2.1",
|
|
36
36
|
"@junobuild/cdn": "^2.3.1",
|
|
37
|
-
"@junobuild/cli-tools": "^0.12.
|
|
37
|
+
"@junobuild/cli-tools": "^0.12.4",
|
|
38
38
|
"@junobuild/config": "^2.15.0",
|
|
39
39
|
"@junobuild/config-loader": "^0.4.9",
|
|
40
40
|
"@junobuild/core": "^5.2.2",
|